Thursday, September 3, 2009

The dreaded Input Error when calling cscript from within a .cmd script file

[PHOENIX] C:\Users\JD\Work (Thu 09/03/2009 18:48:34)
> cscript Whatever.js Why wont you work
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

Input Error: There is no script engine for file extension ".js".

[PHOENIX] C:\Users\JD\Work (Thu 09/03/2009 18:48:34)
>


I dreaded this error that greeted me several times this summer from the command line in Windows world.

My .js files were properly associated, so that wasn't the issue.

[PHOENIX] C:\Users\JD\Work (Thu 09/03/2009 18:48:34)
> assoc .js
.js=JSFile

[PHOENIX] C:\Users\
JD\Work (Thu 09/03/2009 18:49:48)
>


And the workaround I implemented was a pain and involved tweaking the registry. That would last for days until I had to restart or fired up a new command prompt window. So the registry tweak thing wasn't sticking for some reason! Was driving me insane!!

Finally, I studied the cscript help output..

[PHOENIX] C:\Users\JD\Work (Thu 09/03/2009 18:49:48)
> cscript /?
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

Usage: CScript scriptname.extension [option...] [arguments...]

Options:
//B Batch mode: Suppresses script errors and prompts from displaying
//D Enable Active Debugging
//E:engine Use engine for executing script
//H:CScript Changes the default script host to CScript.exe
//H:WScript Changes the default script host to WScript.exe (default)
//I Interactive mode (default, opposite of //B)
//Job:xxxx Execute a WSF job
//Logo Display logo (default)
//Nologo Prevent logo display: No banner will be shown at execution time
//S Save current command line options for this user
//T:nn Time out in seconds: Maximum time a script is permitted to run
//X Execute script in debugger
//U Use Unicode for redirected I/O from the console

[PHOENIX] C:\Users\JD\Work (Thu 09/03/2009 18:50:19)
>

There it was all along...tricky little option!! //E:engine

I added this into my real script like so:

[PHOENIX] C:\Users\JD\Work (Thu 09/03/2009 18:51:08)
> ImportData.cmd

[PHOENIX] C:\Users\
JD\Work (Thu 09/03/2009 18:51:13)
> cd /d C:\Users\AmiBroker\

[PHOENIX] C:\Users\
Users\AmiBroker\ (Thu 09/03/2009 18:51:13)
> cscript ImportDataToAmiBroker.js //E:JavaScript C:\Users\AmiBroker\data.futurestick\AmiBroker\
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

Arguments:
Ami Database Folder = C:\Users\AmiBroker\data.futurestick
Quotes Format FileName = quiksilver.format
Symbol Info Format FileName = quiksilver.symbol-info.format
Import Data Folder = C:\Users\AmiBroker\

Voila! Works every time now in between restarts and command line windows :)

Monday, August 31, 2009

One OS to rule them all

Well, I bought my first Mac earlier this year after being a long time Microsoft OS user since the early 80's. I purchased my sleek Macbook Air back in February, 2009 to play around with some iPhone programming. Last week I released the fruits of my labor - teamed up with some younger guys who wanted to develop a drinking reference app. Check it out at http://www.rizzlemania.com/.

After spending 6 months with the MacOS, I can say I should have switched years ago - perhaps a decade ago. Its my new favorite OS. Here's a nice tribute to its power as an OS (meant in a good way despite the evil Tolkien reference - which I found here):
Three OSes for the Microsoft-kings under the Redmond sky (Microsoft-DOS, Windows NT, Vista),
Seven for the Unix-Lords in their halls of stone (A/UX, AIX, HP-UX, Solaris, BSD, Minix, SunOS, UnixWare),
Nine (or 99) Mortal Linux Brands doomed to die (Mandriva, SuSE, Debian, Lindows, Red Hat, Knoppix, Ubuntu, Gentoo, Slackware),
One for Lord Jobs in his dark shirt and jeans
In the Land of Cupertino where the Shadows lie
One OS to rule them all,
One OS to find them,
One OS to bring them all
and using a VM, bind them
In the Land of Cupertino where the Shadows lie
I'll gather up some of my cool Mac tricks I've learned over the past 6 months and share with you soon. Until then, I'll be developing some more apps for the iPhone and getting to know Snow Leopard a bit better :).

Thursday, December 25, 2008

Merry Christmas! From Samsung


Well, I finally got my LCD TV last Christmas - a 46" Samsung Series 9 LCD. It is simply an amazing TV. I hung it up over the fireplace - spectacular. Will post pictures of this installation when I get back to the States.

Saturday, September 20, 2008

Icon Repair Trick



If you ever find one of your icons not displaying, this simple flipping of display settings will repair the icon:
  1. Right click Desktop -> Personalize -> Display Settings
  2. Change Colors from 32-bit to 16-bit -> Apply -> Yes
  3. Change Colors from 16-bit to 32-bit -> Apply -> Yes
Voila! Icons fixed.

Monday, September 8, 2008

Virtual PC 64-bit Trick

64-bit version of Virtual PC isn't really a 64-bit app but a 32-bit app. Supposedly only Virtual Server supports 64-bit, whereas Virtual PC supports only 64-bit drivers when needed as explained by Virtual PC's Guy Blog. The above link for 64 bit setup on Virtual PC's site is thus a misleading trick.

Thursday, September 4, 2008

TreeComp rocks!

I remember using this nifty tool years back when working in the Internet Services Group at Wells Fargo - TreeComp. Its a great way to compare hundreds/thousands of files to verify backups or installations and helped me handle a massive upgrade to Wells Fargo's application and documentation server farm (I tricked Windows into comparing trees that were actually networked maps onto samba shares with Solaris backends).

Anyways, I'm upgrading one of my PCs to Vista x64 from Vista x32 and I'm not sure I can simply rely on my Windows Home Server backups for restoring just the data files I want kept from my Vista x32 installation. So I'm covering my bases by manually copying all the critical data files I want in my new Vista x64 installation (I'll be wiping the hard drive for a fresh clean Vista x64 install).

Well after a long copy process, some files failed to copy over due to filenames being too long or something like that (most likely within my Music files section). So am not sure exactly how much was copied and don't really want to re-copy everything. So TreeComp to the rescue. This cool tool will allow you to choose two top level parent directories and it will compare the two tree branches for you. Further, once you've identified the folders that are missing on one side of the comparison, its as easy as right clicking left side for instance, and commanding it to sync to right side effectively filling in the gaps from where copy failed originally. Of course you could do this at the top root as well to do this all in one shot.

I'm glad this homegrown tool still lives on even with Vista. Well done Lennert Ploeger!

High DPC issue solved!



Well, after much sleuthing via Google and various technical forums, I finally got the hint at what is up. Things were definitely pointing towards Nvidia drivers until I read a couple of posts about how DPCs can be affected/masked by a myriad of issues from OS settings to BIOS settings to loose cables to poor driver implementations.

One such OS setting was with regard to Vista by default enabling AHCI mode. I tried to find reference to such a mode in BIOS but its not applicable to Nvidia based motherboards because I believe it only applies to Intel based mobos.

The solution was to disable AHCI in Vista by flipping this setting to zero in the registry:

\\HKLM\System\CurrentControlSet\Services\msahci\Start: 0

Voila! Transfer speeds went from avg of 5-10 MB/s to well over 50 MB/s sometimes bursting to over 100 MB/s! Nothing like solving something you know is wrong with hard sleuthing work! Thanks to TwoGuns who helped me start thinking about AHCI more with his focus on enabling AHCI via the BIOS - which made me realize I didn't even have such a setting to begin with (http://www.vistax64.com/vista-hardware-devices/99457-sata-esata-hard-drive-speed-poor.html).