... at Lion Nathan's Swan Brewery.
Thanks, by the way, to all the visitors who keep my stats at an average of 10 visits per week.
More code is in the works: a tcl archive exploder, and a Sudoku solver written as an HTA.
Don't hold your breath!
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.
Sunday, May 14, 2006
Sunday, April 09, 2006
[VBScript] When did I log on/off?
The Australian federal government has brought in new laws which seem to require a return to the old days of clocking in at the beginning of the working day and clocking out at the end. As a contractor I don't think I'm going to notice a big difference ... if I want to get paid for the hours I work, then I fill out my timesheet appropriately.
If you aren't in the habit of keeping this kind of information, don't worry too much: Windows keeps a track of your login and logout in one of its Event Logs. Getting that information is fairly easy, if you know what you're looking for. Otherwise its like the proverbial needle in the haystack.
The script outputs into an Excel spreadsheet, the date of each logon in a separate column containing time of logon and logoff. Please note that the script was designed to query someone else's machine, and will likely need modification if you are trying to get your own data out of your own event log.
Here's the code.
As is often the case in my scripts, the preamble loads external code libraries. The former is a the standard library and the latter (see the end of the posting) a symbol table class, based on the Scripting.Dictionary object.
Note that a check is made not to report more dates than MAX_INSTANCE, a limit that has not yet been encountered. AMax and AMin are listed at the bottom of the posting.
If you aren't in the habit of keeping this kind of information, don't worry too much: Windows keeps a track of your login and logout in one of its Event Logs. Getting that information is fairly easy, if you know what you're looking for. Otherwise its like the proverbial needle in the haystack.
The script outputs into an Excel spreadsheet, the date of each logon in a separate column containing time of logon and logoff. Please note that the script was designed to query someone else's machine, and will likely need modification if you are trying to get your own data out of your own event log.
Here's the code.
As is often the case in my scripts, the preamble loads external code libraries. The former is a the standard library and the latter (see the end of the posting) a symbol table class, based on the Scripting.Dictionary object.
Next comes code to split up the event log's timestamp, followed by the routine to store logon date and logon and logoff times into spreadsheet cells.
Next comes the variable declarations. In retrospect the variables sComputer and sUser could have been Const rather than Dim. For that matter they could have been taken from the command line. Note the double backslash in the uUser variable: this is needed for where it occurs in the WMI call.
This is the core of the script: pointing WMI at sComputer and executing an SQL query against Win32_NTLogEvent. It asks for everything from the 'Security' Logfile where the EventCode matches a logon or a logoff and where the User matches sUser.
Then the script starts to do things with the list of events now stored in cEvents. First a Dictionary is loaded with logons as (zero, comma, TimeSplit of datestamp) and logoffs as (one, comma, TimeSplit of datestamp). The reason for this is that there may be more than one logon and logoff event for a given user during a working day. By storing the logon and logoff times in this way, the first "0" reference can be assumed to be the first logon off the day, and the last "1" can be assumed to be the last logoff of the day.
From the Dictionary wrapper class the keys are extracted. A check is put in here to make sure that there are records to be reported.
Next comes the Excel interactions. The ExcelStart and ExcelNewSheet macros are listed at the bottom of this posting.
What follows is the guts of the Excel reporting. Despite the possibility of incorrect recording, the assumption is that the report will contain the first logon and the last logoff. If a logon occurs after the last logoff, it is discarded. The script is unable to cope with the situation where someone logs on today and logs off tomorrow.
Note that a check is made not to report more dates than MAX_INSTANCE, a limit that has not yet been encountered. AMax and AMin are listed at the bottom of the posting.
Excel is left running with the results of the report. It's up to the user to save it, print it or whatever. To finish, the macros ExcelStart, ExcelNewSheet, AMax and AMin, and the ClassSymTab class as promised.
Labels:
ActiveDirectory,
Excel,
timesheets,
VBScript,
WMI
Tuesday, March 14, 2006
[News] Looking for work ... again
Went and visited three new (to me) employment agencies today. Gryphon, Sinclair Knight Merz and Candle. I also went to the offices of the City of Perth and picked up a busking permit application. Do I have the guts to stand up and sing, a capella, in Murray St. Mall?
Labels:
Candle,
Gryphon,
Sinclair Knight Merz,
singing
Friday, February 24, 2006
[News] Codeaholic/LL
That's it then ... 99.9% of the languages that were listed down the left hand side are now over on the Code-a-holic Language List.
Mate! I'm glad that's over.
Mate! I'm glad that's over.
Labels:
programming languages
Wednesday, February 22, 2006
[News] Today and Tomorrow
Today it was swapping hard drives; sharing receipt printer; finding, downloading, and failing to get working the old touch-screen software; telling all the other machines to use LPT6 when running the POS application, but making sure that the POS machine itself still uses LPT1 (using Clipper 5.3); and getting the floppy drive to work in the SERVER.
Today I celebrated by 45th birthday. One of the gifts I received was a PLUG membership. Eventually the ancient source codes promised but never delivered on Code-a-holic will find their way there.
Tomorrow is the first day (of about 1.5 weeks) at Home Open working on the help desk. More news, and code, as it comes to hand.
Today I celebrated by 45th birthday. One of the gifts I received was a PLUG membership. Eventually the ancient source codes promised but never delivered on Code-a-holic will find their way there.
Tomorrow is the first day (of about 1.5 weeks) at Home Open working on the help desk. More news, and code, as it comes to hand.
Friday, February 10, 2006
[News] End of Contract ... again
The Holy Grail, permanent work, remains elusive. I have good KSAs (Knowledge, Skills, Attitudes) but employers seem only interested in having me around for a few weeks ... maybe it's my deodorant / mouthwash / politics / religion ...
A couple of times it's been suggested I try out writing for a living. What do I live on in the meantime? Others have suggested getting a heavy-rigid licence and signing up to be a bus driver. That's tempting, and it may leave time to write. But it also means stepping into the twilight between an IT career and "something else."
So Monday it's climb back into the suit, catch the bus into town, and go door to door, employment agency to employment agency, saying, "Hey, remember me? I'm looking for a job (again.)"
A couple of times it's been suggested I try out writing for a living. What do I live on in the meantime? Others have suggested getting a heavy-rigid licence and signing up to be a bus driver. That's tempting, and it may leave time to write. But it also means stepping into the twilight between an IT career and "something else."
So Monday it's climb back into the suit, catch the bus into town, and go door to door, employment agency to employment agency, saying, "Hey, remember me? I'm looking for a job (again.)"
Labels:
bus driver,
contracting
[Languages] The Left-Hand List
The list of programming languages on the left-hand side is shrinking. That's A to E done. They've all been moved over to the language list on Code-a-holic/LL.
Over the next few weeks I'll be posting the rest of the data I have on those languages (the bare minimum of name, link, and description.) If anyone's interested in the metacard database or having an XML-ish file with all of the extra details (platform, users' group, date of last activity, etc.), please leave a comment.
Leave a comment too, if you can see anything that needs changing / updating.
Over the next few weeks I'll be posting the rest of the data I have on those languages (the bare minimum of name, link, and description.) If anyone's interested in the metacard database or having an XML-ish file with all of the extra details (platform, users' group, date of last activity, etc.), please leave a comment.
Leave a comment too, if you can see anything that needs changing / updating.
Labels:
programming languages
Thursday, February 02, 2006
[VBScript] CliVE - Command Language Interpreter VBScript Environment
A few years back ZATZ Publishing, in their DominoPower Magazine, published an article entitled
Using Python to create a command line interpreter for Notes. Not being that au fait with Python I decided to have a go at doing the same thing in VBScript. CliVE is the result.
CliVE takes the basic CLI mechanism of my previous posting ([VBScript] CLI Framework) and adds a couple of extra bits: Loading, Saving, and a shorthand for 'WScript.Echo'
First the code supporting the standard header. Then support for putting script files on the commandline. Files specified on the command line are loaded and interpreted, one after the other. This is the main interpreter loop.
The aSession array stores each line passed to Evaluate so that a given session's script can be stored.
In the main loop, a prompt is output and input received. The sLine is split into a two element list: the first element being the keyword; the second being all subsequent text.
There are a few keywords starting with a dot. These are peculiar to CliVE:
Note that the code for Evaluate traps errors, and displays an error message. Note also that LoadRun has no such protection. It's something one might want to add ASAP!
Note also the call to AAdd, which adds the evaluated command to the aSession array if the command works without error. Rather than reproduce the entire StandardLibrary (1500+ lines), here are the referenced routines (AAdd, Exists, ReadFile, WriteFile), plus supporting symbols.
CliVE takes the basic CLI mechanism of my previous posting ([VBScript] CLI Framework) and adds a couple of extra bits: Loading, Saving, and a shorthand for 'WScript.Echo'
First the code supporting the standard header. Then support for putting script files on the commandline. Files specified on the command line are loaded and interpreted, one after the other. This is the main interpreter loop.
The aSession array stores each line passed to Evaluate so that a given session's script can be stored.
In the main loop, a prompt is output and input received. The sLine is split into a two element list: the first element being the keyword; the second being all subsequent text.
There are a few keywords starting with a dot. These are peculiar to CliVE:
- .quit
- .exit
- Synonyms for WScript.Quit
- .echo
- ?
- Synonyms for WScript.Echo. Unlike other dot commands, the line starting with this command is passed to the Evaluate function.
- .save
- Saves the contents of the aSession array to SaveClive.clive unless a filename is given as an argument.
- .run
- .load
- Reads the filename given in the argument and executes the code therein by passing it to ExecuteGlobal.
- .debug
- An empty procedure. A place to put test code.
Note that the code for Evaluate traps errors, and displays an error message. Note also that LoadRun has no such protection. It's something one might want to add ASAP!
Note also the call to AAdd, which adds the evaluated command to the aSession array if the command works without error. Rather than reproduce the entire StandardLibrary (1500+ lines), here are the referenced routines (AAdd, Exists, ReadFile, WriteFile), plus supporting symbols.
Labels:
CLIVE,
command language interpreter,
VBScript
Wednesday, February 01, 2006
[Community] Code-a-holic in print
TechTrax January 2006, from MouseTrax Computing Solutions.
Labels:
Codeaholic in print,
TechTrax
Friday, January 27, 2006
[VBScript] Where else have I logged in on this network?
It's not so much a question for me -- I remotely log into many pcs daily as part my job, and try to leave as few tracks as possible. However, today a customer rang saying she'd lost a few important Favourites and had no backup. The best way I could think of helping her, was to locate all the machines she's logged into and see if any of the Favourites could be found.
I did find what she was looking for. Here's the code I used.
First the standard header implementing the synthetic include (derived from Rube Goldberg Memorial Scripting Page)
Next a little function for a right fill. Having needed this only once, I haven't included it in the StandardLibrary.
1. Check commandline to see if a username is specified.
1.1 If nothing specified, throw a fit.
2. Get an array of all the computers currently online.
2.1 No error checking here but there ought to be
3. Tell everyone what's going on.
4. Loop through the names of the online machines
4.1 Trim off the leading \\ put on by NET VIEW
4.2 Write out the name, right filled with dots
4.3 Get an array of the login profiles for the computer
4.4 Scan the array to see if contains the the username (case insensitive search)
4.4.1 If found say so with a CRLF
4.4.2 otherwise issue a CR
The calls to BeginsWith are commented out. They apply only to my situation where a company edict ensures that all desktop pc names start with PC and all laptops with LP.
If anyone comes up with a faster way of doing this I'd be very interested.
I did find what she was looking for. Here's the code I used.
First the standard header implementing the synthetic include (derived from Rube Goldberg Memorial Scripting Page)
StandardLibrary.vbs is getting big. 1500+ lines of code.
Next a little function for a right fill. Having needed this only once, I haven't included it in the StandardLibrary.
Now the main body of the script.
1. Check commandline to see if a username is specified.
1.1 If nothing specified, throw a fit.
2. Get an array of all the computers currently online.
2.1 No error checking here but there ought to be
3. Tell everyone what's going on.
4. Loop through the names of the online machines
4.1 Trim off the leading \\ put on by NET VIEW
4.2 Write out the name, right filled with dots
4.3 Get an array of the login profiles for the computer
4.4 Scan the array to see if contains the the username (case insensitive search)
4.4.1 If found say so with a CRLF
4.4.2 otherwise issue a CR
The calls to BeginsWith are commented out. They apply only to my situation where a company edict ensures that all desktop pc names start with PC and all laptops with LP.
The supporting library rountines are below, First GetOnLineComputers with its supporting routines, GetNetView, CaptureDOS and ReadFile
Next, BeginsWith (included for completeness sake)
Then GetLoginProfiles, plus support routine AAdd
And, finally, StrInArray.
Unfortunately, this does not run quickly. It can take ages to get through the entire list and sometimes hangs inexplicably. Your mileage may vary.
If anyone comes up with a faster way of doing this I'd be very interested.
Labels:
ActiveDirectory,
NET VIEW,
VBScript,
winmgmts
Monday, January 23, 2006
[Euphoria] Structured Access, part 2
I knew I had it somewhere. Okay, these implement the following: BYTE, BYTES, WORD, DWORD, QWORD, ASCIIZ and PSTRING. You can pull the data one chunk at a time as per the last posting or else pull a whole set all at once.
The file versions don't work and I'm not sure why, and as I said before, I don't have the time to do anything about it.
By the way, this was written before Euphoria 2.5. In fact, possibly before 2.4 so the code may need some tweaking.
mread is like the getmem of the previous posting. memread takes a sequences of reads. I will eventually post an example (if I can find one).
(Since writing part 1, I've been in touch with CChris from Euphoria Standard Library who has taken over the development of getmem. It's great to be able to give something back to the Euphoria community after all these years (I've been using it since version 1.5).)
The file versions don't work and I'm not sure why, and as I said before, I don't have the time to do anything about it.
By the way, this was written before Euphoria 2.5. In fact, possibly before 2.4 so the code may need some tweaking.
mread is like the getmem of the previous posting. memread takes a sequences of reads. I will eventually post an example (if I can find one).
(Since writing part 1, I've been in touch with CChris from Euphoria Standard Library who has taken over the development of getmem. It's great to be able to give something back to the Euphoria community after all these years (I've been using it since version 1.5).)
Labels:
ESL,
Euphoria,
structures
Tuesday, January 17, 2006
[Euphoria] Structured Access
Late last century, in a developing part of the world, I tried writing a diskette cataloguer. It worked okay, once I'd figured out how to do all the gymnastics necessary for BIOS calls. In the process I wrote a function to access memory in a structured way. Brilliant as Euphoria sequences are, they are just that: sequences. There's little in the way of structure, unless you apply some of your own.
I've reproduced the function in its entirety below. Essentially, the code takes data from memory in a structure way, that is, in terms of BYTE, BYTES, WORD, DWORD or ASCIIZ.
An attempt was made to make the functions applicable to files. Those routines don't work, and I haven't taken the time to find out why. Good as Euphoria is, there's no Mac OS X version (so I can't use it at home) and there's no opportunity to use it at work -- Euphoria's not in the SOE. If you're interested in looking at the code, write.
From memory I remember writing a version of getmem() which received a sequence of BYTE, WORD, etc. specifications and returned the resulting sequence of results. When I find it I'll post it.
Enjoy.
I've reproduced the function in its entirety below. Essentially, the code takes data from memory in a structure way, that is, in terms of BYTE, BYTES, WORD, DWORD or ASCIIZ.
An attempt was made to make the functions applicable to files. Those routines don't work, and I haven't taken the time to find out why. Good as Euphoria is, there's no Mac OS X version (so I can't use it at home) and there's no opportunity to use it at work -- Euphoria's not in the SOE. If you're interested in looking at the code, write.
As an example of how to use getmen, below is the code for GetDriveParameterTable
As an example of the BYTES parameter:
The ASCIIZ parameter is like the BYTES except it keeps working its way through memory until it encounters a binary zero and then returns everything up to that point.
From memory I remember writing a version of getmem() which received a sequence of BYTE, WORD, etc. specifications and returned the resulting sequence of results. When I find it I'll post it.
Enjoy.
Labels:
Drive Parameter Table,
ESL,
Euphoria,
floppy diskette access,
structures
Wednesday, January 11, 2006
[VBScript] A CLI framework
Here's a simple framework for building your own CLI (Command Language Interface)
Keywords at this point are: quit, exit, bye, eval, echo, set and run. Below is a sample session.
Now my own version adds a little to this framework by including a .vbs file full of extra symbols, procedures and classes. I've reproduced it below just so that you can see how to do a synthetic include in VBScript. Interestingly, the technique also works in HTAs.
Enjoy.
[VBScript] CSV to variables using Execute
Nico wrote, on microsoft.public.scripting.vbscript:
Data, stored in DEMO.CSV Then the code which does nothing other than read the file, store the data in variables for each line of data, and for effect, echoes the first and last names And here's the results of the run, taken from SciTE's output window A possible extra step would be to read the header line, strips the spaces, build the "Dim" statements and execute them as well. Or maybe, create an instance of "Scripting.Dictionary" and use that. Or ... well, there must be more than two ways to do it, even in VBScript!
I need ASP to read the CSV file to read lines 2 on-wards and display it back to the user for verification. Each line has aprx 8 "," that control user properties.I wrote a response but thought a fuller treatment was in order, thus the following:
I am looking for each line to be displayed back to the user without the "," so they can verify and write to an access db.
All i am looking for is a simple way to read the text display to the user for acceptance before writing it back to the db.
Data, stored in DEMO.CSV Then the code which does nothing other than read the file, store the data in variables for each line of data, and for effect, echoes the first and last names And here's the results of the run, taken from SciTE's output window A possible extra step would be to read the header line, strips the spaces, build the "Dim" statements and execute them as well. Or maybe, create an instance of "Scripting.Dictionary" and use that. Or ... well, there must be more than two ways to do it, even in VBScript!
Labels:
CSV,
data-driven code,
VBScript
Tuesday, January 10, 2006
[VBScript] Threads ... thin ones
The following is an attempt at threads in VBScript. The code owes a lot to Greg Chapman of MouseTrax Computing Solutions. There are two scripts, the first calling the second (in many instances). The means for communicating between the two is via the Volatile environment. When the script runs, Outlook flickers (don't know why).
There are comments, but the basic idea is to keep a watch over how many instances of cscript.exe there are running and while there's only so many, add more. Use the Volatile environment for semaphores and make sure there's enough delay in there to get stuff to and from Volatile (which is actually in Registry and not blazingly fast).
First the controller. Then the controlled. There are quite a few extra useful routines in all that code, including an AADD(), and assorted WMI related routines.
I'm in the process of putting the thread functionality inside a Class so that I can change how things are done without causing drastic rewrites of the original VBScripts. I'm not entirely pleased with the Volatile environment and may end up playing with something else that can be used as a shared storage area between many programs ... like subdirectory structures.
There are comments, but the basic idea is to keep a watch over how many instances of cscript.exe there are running and while there's only so many, add more. Use the Volatile environment for semaphores and make sure there's enough delay in there to get stuff to and from Volatile (which is actually in Registry and not blazingly fast).
First the controller. Then the controlled. There are quite a few extra useful routines in all that code, including an AADD(), and assorted WMI related routines.
I'm in the process of putting the thread functionality inside a Class so that I can change how things are done without causing drastic rewrites of the original VBScripts. I'm not entirely pleased with the Volatile environment and may end up playing with something else that can be used as a shared storage area between many programs ... like subdirectory structures.
Labels:
ActiveDirectory,
GetDomainComputers,
semaphores,
threads,
VBScript,
winmgmts,
WMI
Monday, December 19, 2005
[VBScript] Deriving user name from computer name
I found a brilliant bit of code for deriving the username from the computer name. It's found inside Matt Williams's "ManagePC v1.31" HTA. His description of the routine is as follows
This bit of code is "cheating" slightly in that all it's doing is getting the owner of the explorer.exe process. Seeing as explorer.exe only runs if a user is logged on it is a reliable (but sneaky) way of getting the logged-on user. It does, however, mean that even if a user is logged on locally or the account is a generic account, it will retrieve the correct values (WMI cannot do this).Below is my routine, combining his code with some extra housekeeping. Of course, if no one is logged in, you get nothing. My own take on Matt's routine adds in a check to see if the computer is actually running, using ResolveIP() below:
-- Matthew Williams, ManagePC
[VBScript] Plugins
I had written a plugin architecture for one of my HTA applications. Now I discover that I can have plugins using almost any scripting language available. I found this bit of brilliance in a google search:
I can now pass whatever information I like to and fro from application to plugin and back again. And if another scripting languages does something better than VBScript I can use it (provided it gives access to the volatile store).
Labels:
command language interpreter,
VBScript,
VOLATILE
Wednesday, December 07, 2005
[Working Again]
After a short stint on the support queue at iiNet (part-time), I'm now on contract at Department of Land Information. L1 and L2 support with a bit of scripting on the side. VBScript again, sadly.
Labels:
Department Land Information,
DLI,
iiNet
Friday, November 04, 2005
[Pharmacy Software]
One of my clients has suggested I write pharmacy software. He has a home-grown Clipper app that does everything from Dispensing to Cash Register. I give him a hand with it from time to time. He reckons there's a market for a low-cost package which would fit the Western Australian situation better than the off-the-shelf ones now available.
So comes then the ever-present question: Closed Source, or Open Source.
No knowing a lot about how Open Source works as an income generator, I fear that there is the risk that my non-Open Source competitors may steal my ideas and woo my customers away because they have the resources to bring them (the ideas, not the customers) to the market faster than I can. Is that a valid concern?
Closed Source isn't without its problems either.
And then comes the other questions: programming language / IDE / RAD. I wonder if anyone's come up with a template for software projects in the style of Word / Excel / PowerPoint templates.
So comes then the ever-present question: Closed Source, or Open Source.
No knowing a lot about how Open Source works as an income generator, I fear that there is the risk that my non-Open Source competitors may steal my ideas and woo my customers away because they have the resources to bring them (the ideas, not the customers) to the market faster than I can. Is that a valid concern?
Closed Source isn't without its problems either.
And then comes the other questions: programming language / IDE / RAD. I wonder if anyone's come up with a template for software projects in the style of Word / Excel / PowerPoint templates.
Labels:
Clipper,
Pharmacy Software
[Visual Studio 2005 Team System Beta 2]
I went to a Microsoft do yesterday and that's what they gave me (amongst other things.) Now to find a machine to install it on (only Linux, MacOSX and Win98 at home).
Eventually I want to start bidding on jobs at Get A Coder and Get a Freelancer.
Until then ... Khuda janta he.
Eventually I want to start bidding on jobs at Get A Coder and Get a Freelancer.
Until then ... Khuda janta he.
Labels:
Get A Coder,
Get A Freelancer,
Visual Studio 2005
Thursday, October 20, 2005
[VBScript] Shell and Heap Sorts
The final versions of the Shell sort and Heap sort classes. First the ShellSorter:and then the HeapSorter
By the way, I'm unemployed again. Things might be a bit quiet around here for a while.
By the way, I'm unemployed again. Things might be a bit quiet around here for a while.
Labels:
heap sort,
shell sort,
sorting,
VBScript
Saturday, October 15, 2005
[VBScript] sorting algorithms
Thanks to Dr Hans Werner Lang for his helpful comments on the sorting routines, as below:
Hi,I've made the changes to the class as suggested but haven't posted them as yet.
but there is no need to rewrite the outer loop, is it?
for i=h to n-1
...
The inner loop, with the problem of the conditional And, could be written as
do while j>=h
if a(j-h)<=t then exit do
...
loop
In my opinion, exit do should be avoided (when possible).
Regards
H.W. Lang
Labels:
sorting
[MetaCard] Starter Kit script size limit, Part 2
And if anyone was curious what happened to the MetaCard script size issue, Ken Ray said,
>I've been told, via the MetaCard list, that you have a technique forand Geoff Canyon said
>getting around the script size limit in MetaCard. If that's so, please
>can you tell me whence I can download the whitepaper about it.
Sorry to disappoint you, Bruce, but I don't. In fact, given that DreamCard is only $99, it seems counterproductive to attempt to get around the script size limits when you can pick up a full development environment very inexpensively.
I don't recall that I wrote anything in particular. I did write an exporter for the documentation for earlier versions of Revolution, and they had a small section on dealing with the script limits in the starter kit. The basic point is to understand how to write tight code. You can insert scripts in front and back, and "start using" stacks, and use nested groups to your advantage. You can also store scripts in custom properties and use the "do" command on them.So the upshot of all this is: spend some money and stop complaining.
If you ask on the mailing list, there are several people there who spent significant time working within the script limits who can probably help you with any specific issues. I bought a license early on so I don't have much practical experience.
Finally, if you're concerned about whether Rev is a good fit for what you want to do, ask on the list. People will tell you the truth. There are (many) things Rev is very good for, and (almost as many) things it isn't well suited for.
>I'm told that, sometime late last century, you wrote
>something about side-stepping the script size limit in
>the MetaCard unregistered version.
Labels:
MetaCard,
Revolution
Thursday, October 13, 2005
[xbScript] Hooley Dooley! Move over VBScript, here comes xbScript
This is just amazing! "xbScript.dll enables xBase scripting (exactly like MS vbScript and JScript) in any MS ActiveScript compliant Host." Now I can help a friend, who has a large legacy Clipper app running in DOS under Windows, to integrate his software into the Windows environment. And he won't have to learn another language when he wants to tweak things. Hallelujah!!
Labels:
ActiveScript,
VBScript,
xBase,
xbScript,
xharbour
[EOC] T minus 2 and counting
It's Thurday. I'm busily updating the documentation.
Friday 14 October is "The Last Day". (I wish it was THE last day, that is, the day Jesus returns.)
Of the 19 agencies I've written to, 4 have replied to say they're working on it. Looks like it's back to getting suited up and walking from agency to agency in the Perth CBD saying, "G'day, remember me? Yeah, I'm actually 3D and have feelings."
There's this disease one can get -- I get it often -- called PLOM disease: Poor Little Old Me.
Friday 14 October is "The Last Day". (I wish it was THE last day, that is, the day Jesus returns.)
Of the 19 agencies I've written to, 4 have replied to say they're working on it. Looks like it's back to getting suited up and walking from agency to agency in the Perth CBD saying, "G'day, remember me? Yeah, I'm actually 3D and have feelings."
There's this disease one can get -- I get it often -- called PLOM disease: Poor Little Old Me.
Labels:
end of contract,
EOC,
PLOM
Wednesday, October 12, 2005
[VBScript] Please, please, no more sorting!!
After so many tries, I had thought I was done with it. Well the virtual memory limit on my machine still stands so when the shellSort encountered an array of 1.5 million records, it failed. I could have gone ahead with getting the VM size increased but decided it was better to deal with the limitation as it stood. Who knows, the next bloke may not have much virtual memory either (though, I suppose, he's more likely to have lots more.)
I handed the job over to SORT.EXE and used the Exec method to call it. Like this: The actual call to SortFile is what were talking about but the oSamples stuff needs some explaining. SuperContainer is a class based on the ADODB.Streams object. Interestingly I had a lot of trouble with the ReadFromFile method in ADODB.Stream. I think this had to do with it expecting Unicode but getting ASCII. When you hand a Unicode file over to SORT.EXE, it sorts it okay but changes it into ASCII. ReadFromFile tries to interpret the file as Unicode and you end up with a mess. Thus the GetFile()/Split/For Each thing in my ReadFile method.
The code for the sorting routine is: I have a global in my stdFunctions.vbs called bDebugging. It's normally False but I can change it and get some useful feedback thereby.
The upshot of all this is that the sorting seems to be working ... but still not perfectly -- when I gave SORT.EXE a 63 Gigabyte file it didn't like it. But the likelihood of generating datasets that large is low.
I handed the job over to SORT.EXE and used the Exec method to call it. Like this: The actual call to SortFile is what were talking about but the oSamples stuff needs some explaining. SuperContainer is a class based on the ADODB.Streams object. Interestingly I had a lot of trouble with the ReadFromFile method in ADODB.Stream. I think this had to do with it expecting Unicode but getting ASCII. When you hand a Unicode file over to SORT.EXE, it sorts it okay but changes it into ASCII. ReadFromFile tries to interpret the file as Unicode and you end up with a mess. Thus the GetFile()/Split/For Each thing in my ReadFile method.
The code for the sorting routine is: I have a global in my stdFunctions.vbs called bDebugging. It's normally False but I can change it and get some useful feedback thereby.
The upshot of all this is that the sorting seems to be working ... but still not perfectly -- when I gave SORT.EXE a 63 Gigabyte file it didn't like it. But the likelihood of generating datasets that large is low.
[VBScript] read and write local and remote files
Check out a wonderful write up by Antonin Foller of PSTRUH Software on reading and writing files in VBScript. Note the very helpful stuff on Binary Files.
Labels:
binary files,
reading and writing files,
VBScript
[General] Mergesort
This is a great site for algorithms, like Mergesort. A round of applause for the author, Prof. Dr. H. W. Lang. It's mostly German language, but there are some English translations and the Java code is fairly human-language-neutral.
Tuesday, October 11, 2005
[VScript] At last, a working shell sort
Finally found a shell sort that works. The problems I had previously might have been had because of this:
I converted that straight to VBScript and kept crashing because a[j-h] with a negative index would get evaluated. By using a do/loop and breaking the test up into two parts
... I got stuff to work. Here's the code. Usage is similar to that for heap sort.
Labels:
shell sort,
sorting,
VBScript
[VBScript] Arrrghh!! Sorting out sorting ...
Just when I thought my problems were all over ... or at least the sorting ones ... I found that my machine didn't have enough virtual memory to handle the sort using ADODB (and I don't have the privilege level to do anything about it).
So I ported a heap sort to VBScript and ... so far ... everything look like it's going to work.
Here's the code ... and to use it, something like this ...
So I ported a heap sort to VBScript and ... so far ... everything look like it's going to work.
Here's the code ... and to use it, something like this ...
[VBScript] Sorting ... another way
I have tried and tried to get Shell sorts working but every algorithm I've tried ends up crashing out with negative indexes into the array.
So below is another way around the whole issue: create a RecordSet, populate it with fields, add data to it and use the RecordSet's own internal sorting routines. And a trivial example of its use
So below is another way around the whole issue: create a RecordSet, populate it with fields, add data to it and use the RecordSet's own internal sorting routines. And a trivial example of its use
Labels:
ADODB.RecordSet,
sorting,
VBScript,
XML
Monday, October 10, 2005
[VBScript] Synthetic Includes in Traditional VBScript Files
Most of us are aware of the entry "Synthetic Includes in Traditional VBScript Files" in the Rube Goldberg Memorial Scripting Page.
Today I stumbled across how to embed test routines in the include file without causing these routines to be activated when the file is included.
My include file is called "StdFunctions.vbs". At the bottom of the file I've put When StdFunctions.vbs is included by a script, ScriptFullName evaluates to the name of that script. It's only when StdFunctions.vbs is run by itself that ScriptFullName ends with "StdFunctions.vbs".
BaseName is one of my routines and look a bit like this: [later that same day]
Read the manual, Bruce, read the manual: why use Basename with .ScriptFullName when you can just use .ScriptName?
Today I stumbled across how to embed test routines in the include file without causing these routines to be activated when the file is included.
My include file is called "StdFunctions.vbs". At the bottom of the file I've put When StdFunctions.vbs is included by a script, ScriptFullName evaluates to the name of that script. It's only when StdFunctions.vbs is run by itself that ScriptFullName ends with "StdFunctions.vbs".
BaseName is one of my routines and look a bit like this: [later that same day]
Read the manual, Bruce, read the manual: why use Basename with .ScriptFullName when you can just use .ScriptName?
Labels:
Synthetic Include,
VBScript
[EOC] Other things it could mean
| Meaning | Contributor |
| Elongated Orbital Crocodile | Bruce Axtens |
| Emu-Olive Cross | Daniel Axtens |
| Extra Old Codger | Robert Glanville, Icon Recruitment |
Labels:
end of contract,
EOC
Friday, October 07, 2005
[EOC] End of Contract
I've got one more week and then I'm unemployed again.
I feel down. I wish there was something "cutting edge" I could do. Everything I can think of is diametrically opposed to the cutting edge, being either the blunt bit at the back of the knife or the even blunter bit on top of the chisel handle.
Who cares about MetaCard? Who cares about S*BOL but a few diehard fanatics (who are mostly older and greyer than me)? Who cares about Clipper or xHarbour but a few South Americans into retro memorabilia? As for VBScript, this is just one of thousands of websites and I'm a relative newcomer to a tool that's been around for very long time.
Eventually I'll have posted all my MoonRock BASIC, Fitted Software Tools Modula-2, Turbo Pascal 5 and Euphoria code. Whooptie do. Even if I finish my CCNA, learn Haskell, and write Kiwi CatTools equivalents ... who cares?
I feel down. I wish there was something "cutting edge" I could do. Everything I can think of is diametrically opposed to the cutting edge, being either the blunt bit at the back of the knife or the even blunter bit on top of the chisel handle.
Who cares about MetaCard? Who cares about S*BOL but a few diehard fanatics (who are mostly older and greyer than me)? Who cares about Clipper or xHarbour but a few South Americans into retro memorabilia? As for VBScript, this is just one of thousands of websites and I'm a relative newcomer to a tool that's been around for very long time.
Eventually I'll have posted all my MoonRock BASIC, Fitted Software Tools Modula-2, Turbo Pascal 5 and Euphoria code. Whooptie do. Even if I finish my CCNA, learn Haskell, and write Kiwi CatTools equivalents ... who cares?
Labels:
CCNA,
Clipper,
depression,
end of contract,
EOC,
Euphoria,
leading edge,
MetaCard,
Modula-2,
MoonRock BASIC,
SNOBOL4,
TP5,
trailing edge,
VBScript,
xharbour
[MetaCard and Tcl] Blogs.mc
I got asked to describe the stack a little better. Here goes:
My blogs.mc stack has two text fields (fSource and fGenerated) and some buttons at the bottom (create_card, first, prev, next, last, render, preview, delete).About the same time I posted this to the MetaCard list:
With some marked-up text in the fSource field, I click 'render' and the output of the Tcl script (HTML) is put into the fGenerated field (line 6 of the 'Render' script).
Then when I click on 'preview' the HTML in the fGenerated field gets dumped to a file and passed to Safari. The fGenerated field is modifiable so I can play with things to get what I want and then tweak the Tcl script appropriately afterwards.
On my blog, codeaholic.blogspot.com, I've posted an item about MetaCard (on OS X) using Tcl to more-or-less bypass the script size limit of the unregistered version of MetaCard.Richard Gaskin wrote back, saying (in part):
since there is no MetaCard anymore anyway, and since Rev only offers a 30-day trial for the engine, I'm not sure how helpful the article will be.Also Alejandro Tejada wrote
At $99 for the low-end Rev license, is the pricing really so prohibitive?
i do not see how this could get around the 10 lines limit, but Geoff Canyon wrote an extensive tutorial to manage longer scripts within the 10 lines limits.I answered with
This tutorial is still useful for developers that want to run longer scripts in their standalone applications.
I get it from Ken Ray's website within the RR v 1.1 docs (saved as a pdf file). i'm not sure if this tutorial is still available in any website.
You could ask directly to Geoff Canyon. Look for his website: inspiredlogic.com
> i do not see how this could get around the
> 10 lines limit,
bad choice of words on my part. It doesn't so much get around it as it does acquiesce to the fact and try to use other tools to do what can't otherwise be done. Instead of using MetaCard's HTML mechanism or writin8g something in MetaTalk, I've farmed out the functionality to a Tcl script.
> but Geoff Canyon wrote an
> extensive tutorial to manage longer scripts
> within the 10 lines limits.
of this I was unaware. I have thought about doing something similar. What I usually end up doing however, when I need to hang more closely to MetaCard is to use AppleScript and 'do script' or 'evaluate' the things I need. I will nevertheless make enquiries now that I know better.
Wednesday, October 05, 2005
[General] Neuronstorm website update
I'm supposed to be one of the admins for Neuronstorm and when I successfully extract the digit, I'm to implement the Neuronstorm OSI (operating system interface) in GTk for Windows (and possibly Mac OS X).
Daniel's a good developer and there's certainly a fair bit of interest at his school in an open-source version of Inspiration™.
Daniel's a good developer and there's certainly a fair bit of interest at his school in an open-source version of Inspiration™.
Labels:
idea mapper,
Inspiration,
Neuronstorm
Monday, October 03, 2005
[Clipper 5.3 / xHarbour] .DBF to .CH (Clipper Header)
The client had Clipper 5.3. I had xHarbour. The client had a database of constants. I turned them into a .ch (Clipper Header) file with this bit of code which compiled both under xHarbour and Clipper 5.
Labels:
Clipper,
code generation,
xharbour
[VBScript] 99 bottles of beer - "class" version
Check out my 99 bottles of beer submission.
Look at the entries for your own favourite language. Some of them a dead boring. Submit an example that would show off the real power of the language.
If you're using a language that isn't on the board, submit a version of the song in that too.
Look at the entries for your own favourite language. Some of them a dead boring. Submit an example that would show off the real power of the language.
If you're using a language that isn't on the board, submit a version of the song in that too.
Labels:
99 bottles of beer,
99bob,
programming languages,
VBScript
Subscribe to:
Posts (Atom)