So if you have a school firewall, and you want to use Dragon Dictate for iPad, start tweaking the proxy, because there's no way Nuance are going to tweak their product.Hello,Please note that the app is not proxy-aware, so if you're using a proxy, you'll need to disable it in order to get traffic through to the app. We do not believe that future versions of the app will change this.Regards,Nuance Mobility Support
Past (20 years or so) and present code. A variety of languages and platforms. Some gems. More gravel. Some useful stuff and some examples of how not to do it.
Thursday, March 29, 2012
[iPad] Dragon Dictate app
Wednesday, March 28, 2012
[AdSense] is making no cents
Monday, December 19, 2011
[Lhogho] IsInetOffline? an example of Win32 API wrapping.
The following code demonstrates wrapping the Win32 API, in this case the IsInetOffline function in URL.DLL. The commented line is taken from a WIN32API.TXT file I found on the internet.
; Private Declare Function InetIsOffline Lib "url.dll" (ByVal dwflags As Long) As Long make "url_handle libload "url.dll to InetIsOffline? :dwflags end external "InetIsOffline? [ U4 InetIsOffline U4] :url_handle ifelse InetIsOffline? 0 <> 0 [ print [internet offline] ] [ print [internet online] ]I rather like the notation for defining the call to the DLL itself:
'external' <localsymbol> '[' <returntype> <dllsymbol> <arg1type> ... ']' <libloadvalue>
I've written a few bits and pieces of code which can be found over on the Lhogho forum. Enjoy!
Monday, January 03, 2011
[VB6] Using VBScript's Escape and UnEscape (Take 2)
I'm using JScript rather than VBScript, so that I can use the String object's fromCharCode() method. I parse the input string, convert the characters to a list of their numeric equivalents for passing to fromCharCode() and then store the result in a JScript variable which is then passed to escape().
Thanks to Anonymous and anjali kalkarni for pointing out the problem.
© Bruce M. Axtens, 2011
Sunday, December 19, 2010
[Javascript] Wildcard string matching / globbing, Take 2.
I've reworked the matchesWild function, caling it
grepWild. It takes the wildCard parameter as before but instead of all the substr stuff, it replaces '?' with '.', '*' with '.*' and wraps with '^' and '$'. Then it feeds that into match(). It's simpler, easier on the eyes, and faster too.© Bruce M. Axtens, 2010
Tuesday, November 30, 2010
[Javascript] Wildcard string matching / globbing
Jack Handy's first and last (it seems) article on CodeProject implemented a wildcard string compare (also known as 'globbing') function in C. Below I present my port of that function to Javascript.
As a newbie Javascript programmer (4 weeks in as of 2010-11-30), I've pleasantly surprised by the expressive power of Javascript. What has caught my eye recently is the power of .prototype., so this implementation of matchesWild() is declared as a prototype extending the String class.
Here's the code, with some commentary:Apart from the comments, notice the way Javascript adds a method to an object, defining an anonymous function with, in this case, one parameter, and assigning it as a prototype.The C version did all kinds of interesting things with pointers. Javascript doesn't have that kind of stuff (AFAICT), so I had to do the equivalent with numeric offsets and substr().
Perhaps there are better ways of doing this. I have tried to do this kind of thing before, but this code seems to do a pretty good job of it and hasn't failed thus far.
What should be noted, and perhaps dealt with, is that there is no explicit check for calling the method without a parameter. If one does this, an error is raised. Chrome's V8 raises "TypeError: Cannot call method 'substr' of undefined".And now some examples (evaluated using macports's JavaScript-C 1.7.0 2007-10-03)Outputs:More Javascript coming soon. In the meantime, enjoy.
© Bruce M. Axtens, 2010
Tuesday, November 16, 2010
[iSync] Nokia 5000d-2
family.com.nokia.series40.3rdEd.bus.bt.The image for the phone was downloaded from ericfish.com and copied into the /Applications/iSync.app/Contents/PlugIns/ApplePhoneConduit.syncdevice/Contents/PlugIns/PhoneModelsSync.phoneplugin/Contents/Resources/ folder.
The following code was merged into the MetaClasses.plist file in /Applications/iSync.app/Contents/PlugIns/ApplePhoneConduit.syncdevice/Contents/PlugIns/PhoneModelsSync.phoneplugin/Contents/Resources/
I hope someone finds this helpful. It certainly makes things a bit easier for me. Now all I have to do is figure out how to manage the SMS subsystem. Gammu looks promising, once I figure out the link error. More on that another time.
© Bruce M. Axtens, 2010
Tuesday, September 14, 2010
[VBA] Something like COUNTIFS for Excel 2003
Clang!
Seems that Excel 2003 doesn't have the nice little COUNTIFS function that I have in my Excel 2007. What to do, what to do, what to do ...
Well, it'd be nice to install Office 07, but in the interim, how about a bit of VBA?
We'll call it RANGEDCOUNT, and it will accept a range of data, and a string being the criteria. The criteria can be
- a single value preceded by an operation (>, >=, =, <=, <, #), or
- a range of values, the upper and lower bounds separated by a dash.
Wednesday, April 28, 2010
[Batch File] Rediscovering CMD.EXE batch scripts
Insanity must be setting in; I’ve been trying to solve RosettaCode tasks with Windows CMD.EXE batch scripts. For example, their A+B task:
A+B - in programming contests, classic problem, which is given so contestants can gain familiarity with online judging system being used.
A+B is one of few problems on contests, which traditionally lacks fabula.
Problem statement Given 2 integer numbers, A and B. One needs to find their sum.
- Input data
- Two integer numbers are written in the input stream, separated by space.
- Output data
- The required output is one integer: the sum of A and B.
- Example:
Input Output
2 2 4
3 2 5
These are what I posted as solutions:
Prompts version
::aplusb.cmd @echo off setlocal set /p a="A: " set /p b="B: " set /a c=a+b echo %c% endlocal
All on the commandline version
::aplusb.cmd @echo off setlocal set a=%1 set b=%2 set /a c=a+b echo %c% endlocal
Formula on the command line version
::aplusb.cmd @echo off setlocal set /a c=%~1 echo %c% endlocal
Example of 'Formula on the command line version'
>aplusb 123+456 579 >aplusb "1+999" 1000
Parse the input stream version (thanks to Tom Lavedas on alt.msdos.batch.nt)
::aplusb.cmd @echo off setlocal set /p a="Input stream: " call :add %a% echo %res% endlocal goto :eof :add set /a res=res+%1 shift if "%1" neq "" goto :add
Example of 'parse the input stream version'
>aplusb Input stream: 1234 5678 6912 >aplusb Input stream: 123 234 345 456 567 678 789 890 4082
Batch files are a bit arcane, it’s true, but the extensions added post Windows 2000 make it a lot more entertaining.
Tuesday, April 06, 2010
Wednesday, February 10, 2010
[VBScript] Small contributions to RosettaCode
I recently discovered RosettaCode. The initial blurb from the site is as follows:
Rosetta Code is a programming chrestomathy site. The idea is to present solutions to the same task in as many different languages as possible, to demonstrate how languages are similar and different, and to aid a person with a grounding in one approach to a problem in learning another. Rosetta Code currently has 370 tasks, and covers 195 languages, though we do not (and cannot) have solutions to every task in every language.
A variety of tasks are listed, and visitors to this site are invited to solve the tasks in the language of their choice. The tasks cover everything from the mundane Empty Program to the classic Towers of Hanoi, the practical User Input, the mathematically-inclined Lucas-Lehmer test, and the involved yet entertaining RCRPG.
I have made some small contributions to its collection of VBScript programs, as below:
99 Bottles of Beer Array concatenation Assertions Delete a file Execute a Markov algorithm Fibonacci sequence Flatten a list Function definition Generic swap Palindrome detection Pangram checker Program termination Sorting algorithms/Gnome sort Tokenize a string
Feel free to edit what I’ve done and add your own in whatever language takes your fancy.
© Copyright Bruce M. Axtens, 2010.
Saturday, December 12, 2009
[Protium] PLEAC 1.0
<@ OMT>-------------------------- |
|
<@ LETVARLIT>string|\n</@> |
<@ OMT>two characters, \ and n</@> |
<@ LETVARLIT>string|Jon 'Maddog' Orwant</@> |
<@ OMT>literal single quotes</@> |
<@ OMT>-------------------------- |
|
<@ LETVARLIT>string| |
<@ OMT>a "newline" character</@> |
<@ LETVARKEY>string|__Newline</@> |
<@ OMT>a "newline" character</@> |
<@ LETVARLIT>string|Jon "Maddog" Orwant</@> |
<@ OMT>literal double quotes</@> |
<@ LETVAREXPLIT>string|Jon &pipe;Maddog&pipe; Orwant</@> |
<@ OMT>Because | and <@ and </@ are significant there are ways to quote them</@> |
<@ LETVARLIT>Bruce Goose|布魯斯鵝</@> |
<@ OMT>a variable name containing spaces. |
<@ OMT>-------------------------- |
|
<@ OMT>Multi-line strings. |
|
<@ LETVARLIT>a| |
|
<@ LETVARLIT>string|This is a multiline string |
|
<@ OMT>-------------------------- |
[Protium] PLEAC in Protium
For the next few postings I am going to do a PLEAC for Protium. You won't find Protium on PLEAC's pages because PLEAC is limited to open-source languages. Protium is proprietary and closed-source (at present.)
The challenge with converting from Perl to Protium is similar to that faced by linguists translating from one human language to another: do you translate the sense of the utterance, or do you just translate word for word. For example, the Tok Pisin word rabisman literally means "rubbish man". However, it is almost never used that way. Instead it often carries the sense of "fool" or "good-for-nothing." So when converting the Perl to Protium, I've tried to give the sense of the Perl, rather than follow it line for line or word for word.
There will be the odd non-PLEAC posting, but I will try to work my way through the entire PLEAC, all 300K's worth.
Wednesday, October 14, 2009
[Jabaco] JaCOB and WScript.Network
I wonder about myself sometimes. Am I sane? For instance, I’ve taken recently to learning and developing with Jabaco. This would seem from one angle, good, and from another, daft.
Jabaco is a simple programming language with a Visual Basic like syntax. Jabaco enables you to create powerful software for all Java supported operating systems.
So there you have it: a VB6-alike (more or less) syntax targeting the JVM. In my experience, people bagging VB syntax are in the majority. People bagging Java aren’t infrequent either. And I know Java about as well as I know Babylonia Cuneiform.
That said, it’s been a bit of fun figuring things out in Jabaco, and discovering just how effectively one can hook into the Java subsystem.
The code below demonstrates The JACOB Project: A JAva-COM Bridge talking to WScript.Network. Comments are a bit sparse, but VB folk should be able to figure it out quick enough.
Public Sub main(ByJava args() As String) Dim myArgs() As String myArgs = args Dim oShell As ActiveXComponent
'ActiveXComponent is exported by JACOB and referenced in the IDE
'(yes, there’s an IDE, and it’s pretty good too) Set oShell = New ActiveXComponent("WScript.Network") Dim a As String Dim b As String Dim c As String Dim dShell As Dispatch
'Dispatch also part of JACOB. Nice that it uses the standard jargon Set dShell = oShell.getObject() a = Dispatch.call(dShell,"UserDomain") b = Dispatch.call(dShell,"ComputerName") c = Dispatch.call(dShell,"UserName") MsgBox (a & ", " & b & ", " & c) comthread.Release() End Sub
The IDE makes possible ‘compiling’ to an EXE. The code above compiles to about 400K. Of course, the presence of a JRE is implied. And it runs, nicely.
I think I’ll be spending more time with Jabaco. It’s got a lot of promise, especially for the VB-deranged like me.
© Copyright Bruce M. Axtens, 2009.
Thursday, July 02, 2009
[VB6] Using VBScript's Escape and UnEscape
Escape and Unescape functions available to the VB6 programmer.The best thing would be add
MSSCRIPT.OCX to the project, but for the sake of demonstration, I'll use CreateObject instead.Using the code is easy.
It's that simple. And the technique can be used to get at other VBScript functionality. In fact,
.Language can have values other than "VBScript", making it possible to interface to any language with a Windows Scripting Host presence. © Copyright Bruce M. Axtens, 2009
Tuesday, May 19, 2009
[VB6] MAXDOUBLE, MINDOUBLE, +INFINITY, -INFINITY and NaN
Anyway, I came up with a way of storing these values into Doubles so that they could be used in a Complex Numbers library I've been writing.
Essentially, I create an 8 byte array, load it up with the relevant values, and then, using API calls and the VarPtr function, store the contents of the array into the storage used by the Double.
Here's the code. First the declarations.
Then the routine that does the work.
Finally, a slice out of the Complex Numbers project demonstrating the use of some of these declarations.
Enjoy!
© Copyright Bruce M. Axtens, 2009
Thursday, May 14, 2009
[VB6]Searching an ActiveX/COM object for a method
"After Googling around not quite finding what I wanted, I remembered the Edanmo site which got me thinking about TLBINF32.DLL, downloading Microsoft's TLBINF32.CHM and reading up on GetMembersWithSubStringEx.
Below is the implementation of it (done in VB6 with a reference to TLBINF32.DLL), some demo VBScript and output, and the wrapping of that functionality in some VBA.
VBScript demo. The above code was included in my StdLib DLL in the Registry coclass.
Output from the demo (script was run in SciTE).
Finally, the VBA code. A cell has a symbol in it and this routine finds it or returns an error string. (
reg. in this case refers to the Registry coclass in the StdLib.DLL)Hmm ... no error checking. Should fix that.
© Copyright Bruce M. Axtens, 2009
Sunday, April 12, 2009
[newLISP] restart-router
The following is a newLISP implementation of a project attempted in VB6. The VB6 one failed to work consistently. The newLISP one hasn't failed yet.
The situation is that our ADSL connection goes down at random times, necessitating a walk down the hall to the comms room, wherein one turns off the power to the router so that it resets. I found out during the week that if I telnet into the router, give the appropriate password and the enter 'restart', that'll restart the router. Will it reduce the need to walk to the comms room? I really don't know as, all of a sudden, the router is working fine.
Here's the code:I really like the fourth parameter on the net-receive call; not only do I receive but I can look for something in what is received. I suppose testing for not receiving it would be good, but I'll leave that for another time.
Once the restart command is sent, there's no need to attempt a net-receive. Just close the connection. Note also the easy way of referring to and using a function in a DLL.
Using the link.lsp script (which comes in the standard newLISP install) I've been able to turn this code into a standalone EXE, and once I've established that it really does do the job, I'll install it on a couple of other machines in the office.
I suppose we actually need the exercise, but maybe we don't need the aggravation.
By the way, my last newLISP posting has generated an interesting conversation on comp.lang.misc (also mirrored on comp.lang.lisp).
© Copyright Bruce M. Axtens, 2009
Thursday, April 09, 2009
[newLISP] reverse-find
Below is my first (ever) lambda expression, a port of the VBScript RevInstr() function.
I must say I'm impressed with newLISP. Note that the minus (-) function above can receive more than one argument. A lot of the functions are like that.
Using the reverse-find is very like the (find) function, as below
One thing that differentiates my lambda expression from the in-built find, is in the manner in which an error is flagged.
I'm not sure at this point why the difference and what to do about it. In my use of (find) I check for a result equal to nil, but with (reverse-find) I have to check to see if the result is a string. For example,
Doubtless, someone in the newLISP Fan Club will set me straight soon.
© Copyright Bruce M. Axtens, 2009
