Aladdin NetHASP and SP1 for SBS 2003

I ran into the following the hard way recently.  Since I don’t trust anybody’s tech support to actually test new service packs or publish known issues, I figured I’d mention it here: SP1 for SBS 2003 breaks Aladdin NetHASP, and programs which use it.

NetHASP is 3rd-party software which programs use to tie software licenses to a physical dongle (known as a “hasp” or “sim”).  In my case, our client was using SigmaTek’s SigmaNest and Develop programs (line-of-business stuff), we had the Network sim plugged into the SBS box and the NetHASP License Manager program running on it.  After the upgrade to SP1, SigmaNest on all workstations could no longer find the Network Sim, and would not run.

Anyway, judging by known issues I’d read about, I pursued a firewall angle.  I found out what port the NetHASP connection uses (475), and made sure workstations could see that on the server (they could).  I reinstalled the NetHASP License Manager.  I reinstalled SigmaNest.  Nothing worked. 

Finally, dreading a bad support like I’ve had all too often, I caved and called SigmaTek support.  After an hour on the phone with a well-intentioned, but lower-level support employee, he finally contacted Aladdin support (at my suggestion).  Eventually he got hold of them and the three of us worked together on it for a good while.  Eventually we tried a new (command-line) version of the NetHASP License Manager driver, and voila! it worked again.

For the record, we had purposely waited a month after SP1’s release to let any kinks get worked out (or at least known).  I’d also immediately mentioned the SP1 install to both SigmaTek and Aladdin’s support reps, since it was a likely culprit.  Seemingly neither had run into the issue. 

Now, I’m not sure, but this suggests to me that neither company is proactively testing new Windows patches and service packs.  If true, this is a very bad thing (if not, I’d love hear otherwise!).  It’s also possible that they did know, but simply hadn’t communicated that info with their support reps (and certainly had not via their support websites).

I asked them to document what we’d found, but I don’t have high hopes.  So… hopefully this anecdote will help out some other poor NetHASP clod like me: get the new/other NetHASP driver, and push the vendors to publish the problem and solution.

Sweet Mappy Goodness

There’s been a massive amount of cool software and web development lately involving maps.  I just want to nail down what I’ve seen in one place.  I’ll try it as a timeline…

  • For ages there were the “classic web” map websites, which reloaded the entire page for every zoom, pan or other change. 
    MapQuest was one of the first (what, 10 years ago?), and has changed little since then.  In a word, “slooow”.
  • Eventually some sites like Yahoo Maps and MSN Maps evolved some, using DHTML to dynamically swap the map image, without reloading the entire page.  This was definitely faster.
  • More recently, there was Google Maps, which actually slices the map into separate map “tiles”, so that only the changed parts of the map are downloaded for each zoom/pan/etc (which is even faster).  Definingly-cool features include satellite maps, and the ability to “grab/drop” to move the map with your mouse just like you’d grab and move a real one.  This also put AJAX (aka “Remote Scripting”) on the buzz map as a web development technique.
    Update: Don’t miss the many amazing “remixes” of Google maps with other web apps, like phone books,
    housing ads, and
    crime stats).  Just Wow.
  • Then NASA released World Wind, a desktop application which does this same trick, but leverages DirectX to provide seamless zooming/panning — a true 3D app, and very cool.  It’s mouse-enabled much like Google Maps, but adds UI features like Tilting (which gives panning the sensation of a fly-over!) The focus is more educational/scientific reference than convenience (sorry, no driving directions to Wal-mart.)
  • Google Earth is the most recent, which is basically a combination of Google Maps with World Wind.  Its UI features are very similar to World Wind’s, but it has more practical user features like Google Maps (how about Flying directions to Wal-Mart!).  (It also has some business features like demographic information overlays and the like, which puts it in the arena of Microsoft’s commercial MapPoint software).
  • Update: A9 Maps is a new one.  It’s a different interface, and sports “curb-view” photos of addresses.  …Or says it does anyway, I can’t find any around me, so I’m not sure what use that is.

All of these are free, by the way.

If you dig this kind of map stuff and/or astronomy, I recommend Celestia, a free 3D desktop app (like World Wind and Google Earth) for extra-terrestrial (as in “off Earth”) virtual exploration.  It’s a great reference and learning/teaching tool, and my 5yr old and I love it.

Microsoft Invented AJAX

Okay, I’m not really sure Microsoft invented AJAX, but I do know Internet Explorer had several asynchronous scriptable technologies and techniques long before any other browser.

To enumerate:

  • DSOs (ADC, TDC, RDS).  The TDC was pretty good, ADC was too heavy, and RDS was too much of a security issue, but they were all early ways to asynchronously data-bind elements at the browser.  They were also fully scriptable.
  • IFRAMEs – IE4/1997 or newer had IFRAMEs (Netscape 4 did have ILAYER, but Netscape 4 generally sucked).  I actually thought I invented this technique, and used it on many projects to much success.
  • Java – Meh, too bad about the JVM.  Same basic technique, though.
  • XMLHTTPRequest – Slightly more recent (circa IE5/1999 I think).  This object IS what modern AJAX code runs on.  Firefox, et al have only added similar objects in the last couple years.

“Remote Scripting” was Microsoft’s term for this technique.  (Heck, here’s an April 1999 MSDN article on the topic).

SO, I’m rather annoyed when well-known journalists say Microsoft is working “Not to be left out of any development trends…”, or better yet,
“Microsoft has decided [Ajax] is something it can’t ignore… the Redmondians have jumped on the Ajax bandwagon.”.

…Microsoft built that bandwagon.

Update: Perhaps I’m not the only one annoyed they’re not getting their due.
Scoble’s got a good laugh over AJAX, and Scott Isaacs has
thoughts on an AJAX (DHTML) framework.

my Code: wipe_commentrange

*sigh*, more comment Spam today — 150 in a few minutes, despite my nice new .Text spam filters (they were all identical).

Unfortunately, I can’t just go into blog_content and delete the range (since the comment count wouldn’t be updated), and I didn’t want to click [Delete], [Yes], [Continue] 150 times, SO: I just fired-up SQL Profiler, reverse-engineered a standard delete call, and slapped together a utility Stored Procedure to loop that call, for big cleanup jobs.

It takes IDs for the first and last comment spam which make it through, and wipes them all out with .Text’s native blog_DeletePost stored proc.  Just paste this into Query Analyzer and run to install:

CREATE PROCEDURE re_wipe_commentrange 
@p_ID int,
@p_lastID int

DECLARE @v_sql varchar(8000)
WHILE @p_ID <= @p_lastID
	SET @v_sql = 'exec blog_DeletePost @ID = ' + cast(@p_ID as varchar(5)) + ', @BlogID = 0'
	SET @p_ID = @p_ID + 1

(Note: this is for single user .Text blogs.  Multiple-user blogs will need fiddling with the embedded BlogID parameter.)

Then to use it, call like so in QA: EXEC re_wipe_commentrange 900, 1000.

Might save someone a few minutes (even with writing and posting it here, I think I'd still be clicking delete right now).

Time to consider a way to implement MT-Blacklist...

Javascript -vs- VBScript, pros and cons compared

Yes, this sounds like an all-too-familiar “Intro to Web Scripting” class or article, but I haven’t actually seen these more advanced scripting topics compared before, so I wanted to nail it down in print. 

feature Javascript VBScript
Object-Oriented: Very powerul and easy to create custom object classes Now supported with version 5+ CLASS construct, but is comparatively less powerful and syntax is much more verbose
Object-Based: More object-based, wraps core functionality in intrinsic objects like Date, Math, Number, String, and Array Less object-based, dumps functionality into global functions
Optional procedure arguments: Supported Not supported! (hence kludgy workarounds)
Getter/Setter properties: Not supported! (yet?) Supported
Dialog/User-input support: None built-in, depends on the current object model (e.g. window.alert/prompt/confirm, or WScript.Echo/popup). Has powerful native Msgbox and Inputbox functions.
Convenience tools (aka synactical sugar): Few (escape/unescape?) Plenty (Explicit Conversions, Formatting, Dates, Strings)
Date Manipulation: Difficult (hence the need for a Javascript Date library Easy (see convenience tools)
• Has ternary operator (e.g. var foo= true ? 'bar' : 'grep';
• No ternary operator and no IIF function like VB (but a custom IIF can be added).
General strength Powerful, more “nuts&bolts” Easy-to-learn, more common functionality built-in
General weakness Some common tasks are much too inconvenient Verbose, disorganized, weak OO capabilities

Yes, of course it’s my opinion, based on experience (and frustration!)  Feel free to proselytize me otherwise, but back it up!

My perspective is this: scripting languages are about convenience — quickly whipping out something that works, is readable, and is maintainable.  If you want perfect academic code, or fastest performance, get another tool!  For scripting languages, the less code and reference to accomplish a task, the better.

Interestingly, different scripting languages reach convenience by different routes.  For example, where VBScript chooses a “simple” route of a bunch of unorganized global functions, Javascript groups them as methods of intrinsic objects.  Normally I prefer simple, but Javascript’s better organization makes me more efficient: I don’t have to remember 90 or so distinct global functions — if I can simply remember the object (Date/Array/whatever), then I’m set, because’s Intellisense will help me quickly find the method I need without cracking a reference.

(Aside about Intellisense: it reminds me of the tabs -vs- spaces debate: I say tabs all the way.  Any decent code editor should be able to display tabs how you like.  Fewer characters to store/send, and less arrowing around pays for itself.  And yes, a coder should be using a decent code editor!)

To be clear, I favor neither VBScript or Javascript as a rule — each has its time and place (goal of this chart).  Ideally, I’d like to marry them for the best of both.  Both Classic ASP and WSCs can use both in the same context, which rocks.  Too bad lost this feature, but it matters less since it now runs full-fledged programming languages.

Finally, for entertainment, here’s a hilarious thread on the “JS-vs-VBS” subject.  My favorite quote: “IF JScript was a movie, it’d be Citizen Kane, or The Shining. VBScript would be the Mariah Carey movie, or possibly ‘Sgt Pepper’s Lonely Hearts Club Band’ starring Peter Frampton and the Bee Gees.”

Update: added ternary/IIF note to chart ‘leftovers’.

My Code: InputLine function for WSH (Inputbox for CScript)

Now that I’m color-coded, I may start a regular feature here where I publish smallish code bits I’ve written…

For WSH scripters out there, here’s a handy one I wrote…

To explain, for GUI-type WSH scripts (usually run under the WScript engine), VBScript has a native Inputbox function, which prompts for user input via a dialog box.  Command-line-type scripts (running under CScript) have no command-line equivalent, though — yes Inputbox works, but a GUI dialog doesn’t really fit a command-line script.

So to fill that gap, I wrote this:

' Name:		InputLine
' Desc:		like Inputbox, but for use with cscript
' Author:	Rob Eberhardt,
' Params:	prompt as string, default value as string
' Returns:	user's answer
' History:
'		2005-06-13	added default param
'		2005-02-28	created original InputLine function
FUNCTION InputLine(p_strPrompt, p_strDefault)
	call Wscript.Echo(p_strPrompt & ":")
	IF p_strDefault<>"" THEN CreateObject("WScript.Shell").SendKeys(p_strDefault)
	DIM strInput
	Do While Not WScript.StdIn.AtEndOfLine
		strInput = strInput & WScript.StdIn.Read(1)
	InputLine = strInput

Example usage:

DIM strChoice
strChoice = InputLine("Enter favorite color", "Red")
call WScript.Echo("You entered: " & strChoice)

…which would look like this from a command-line:

Enter favorite color:
You entered: Red

For bonus points, you can detect if the current engine is CScript or WScript, and use InputLine or InputBox appropriately (like if you’re note sure what engine will run your code):

DIM strChoice

'detect CSCRIPT context & use InputLine
IF Instr(lcase(wscript.FullName), "cscript")>0 THEN	
	strChoice = InputLine("Enter favorite color", "Red")

ELSE	'detect WSCRIPT context & use native InputBox
	strChoice = InputBox("Enter favorite color", "Color?", "Red")


call WScript.Echo("You entered: " & strChoice)

Hope someone can use it.

Note: I would have absorbed this engine detection logic into a single smart InputLine-like function, if only Javascript supported Inputbox, or VBScript supported optional arguments.  But, InputBox’s optional 2nd “Caption” param makes no sense with InputLine, and unfortunately the languages leave no room to gracefully work around that.

The new Windows Update v6

Trying out the new Windows Update v6 (now called “Microsoft Update”).  Cool that they’ve finally integrated Office Update and other products (SQL Server for instance).

A few observations, though:

  • It took several ActiveX installs, plus closing and restarting IE for it to actually load fully.
  • Windows Update has been slooow for me lately (before this version even). Dunno why, but it still is. 
        Update: same slowness on sparkling fresh XPSP2 and SBS 2003 installs.  It ain’t me.
  • Still a ton of French Spell Checker updates?? (2 for Office, 1 for Visio, 1 for Project) I saw this a lot with Office Update too. I have no French anything on any machines, so what’s the deal?.

About time to reboot…

IIS: “Compress Application Files” breaks DSOs and TDCs

HTTP Compression is a wonderful idea.  Unfortunately, its implementation in IIS 5 was deeply flawed

Besides the usual issues, I’ve also found that HTTP Compression breaks Data Source Objects (DSOs) and Tabular Data Controls (TDCs) in IE (wonderful features for client-side data-binding in web apps).  IE loads the data (showing “XX items remaining” counting down in the status bar, and eventually “Done”), but it never data-binds to the table template or gives any error messages, leaving an empty table.  My guess is that IE uses a different mechanism for requesting DSO data resources from a webserver than it does for normal resources (pages and their referenced files like scripts, stylesheets and images).  I’ve never seen this issue documented by anyone else, which I attribute to the relative obscurity of DSOs and TDCs (they were never marketed to devs enough).

So you can imagine it was a big pain figuring this out the first time…

When IIS 6 came out, I heard a lot of excitement that it fixed HTTP Compression, so I was excited too.  Well I’ve recently/finally moved into IIS 6, enabled HTML compression, and then just got confused all over again today because my TDCs were broken.  Grrr…

Sure enough, turning off “Compress Application Files” (and restarting IIS) fixed it.  At least IIS 6 gives separate compression settings for dynamic and static files, so now I’m just compressing static files (e.g. HTML, CSS, JS, VBS, HTC), which should still help a bit (of course those files are cached by the browser anyway…).

Apparently Jeff Atwood has also found other big issues with IIS 6’s HTTP compression.   He’s got a lot of good info, plus a handy metabase snippet to help fix those problems.  Check it out.


I’ve implemented Dean Edwards‘ Star-Light for code-formatting here.  It’s an awesome (and useful!) demonstration of the power of DHTML Behaviors.

Oh, and it’s free (just a Creative Commons license).

And it works in both IE and Firefox*.

All it takes is a linked stylesheet and a CSS class on the target code section (specifying the language of the code), and Star-Light dynamically formats and colors it in the browser. 
For example, this code:

<pre class="vbscript">
' this is a "comment"
'' so is 'this'
DIM string
string = "' string '"
call msgbox("Hello ""Dean""!")
FUNCTION getText(a, b, c)
	getText = a + b & cstr(c)

displays thusly:

' this is a "comment"
'' so is 'this'
DIM string
string = "' string '"
call msgbox("Hello ""Dean""!")
FUNCTION getText(a, b, c)
	getText = a + b & cstr(c)

The supported languages are CSS, HTML, Javascript, PHP, and XML.  (For fun, it can also enhance plaintext conversation text: emoticons into images, *bold* into bold, /italic/ to italic, _underline_ to underline, plus enhancing “>” quoted sections.)

Coolest of all, though, it’s highly extensible via language modules.  I glanced through the code to see if I could make it support VBScript.  The engine is pretty complicated, but each module is a simple HTC file.

From there, it was easy to create a new module for VBScript and plugin the appropriate keywords straight from Microsoft’s Windows Script 5.6 Documentation.  I sent my VBScript module (working above) to Dean — he made a couple improvements, and said he’ll include it with the rest soon.  (I may also create modules for VB6 or VB.Net, but there’s a lot stuff to those languages…)

I don’t mean to gush, but: Very Cool.

Unfortunately, Dean hasn’t yet documented how to do write your own module (I figured it out on my own), but it’s pretty easy for someone who knows HTCs and has a language reference to copy/paste.

* Another gee-whiz bit: despite the coolness of DHTML Behaviors, they are normally only supported by Internet Explorer.  But Dean’s done a wonder, and written a Mozilla XBL wrapper which makes Mozilla/Firefox support DHTML Behaviors too! (which is of course wrapped into Star-Light).  This situation should be the poster child for the de-facto standards camp -vs- the slow academic W3C types, but more on that another day.  Meanwhile, I’ll sit back and regret my rationale “DHTML Behaviors are IE-only anyway, so I’ll go ahead and use all this other IE-specific code.” Like, uh, VBScript….. (dough!)