A better RDP client: Royal TS

Microsoft currently has two official RDP clients:  Remote Desktop Client (built-in to Windows XP Pro, and downloadable for nearly anything else), and the Remote Desktops MMC snapin (from the Windows 2003 Administration Tools Pack).

They have all the right features between them, but neither has all of them in one place.  The Remote Desktop Client has the most options, but can’t connect to console session (aka “session 0”) and is meant for one remote connection at a time.  The Remote Desktops Snap-in can do these two things, but is missing tons of other options, plus one especially dumb limitation:  It can’t connect to a port other than standard 3389.  (It gives an error “The server name cannot contain the following characters: spaces, tabs , ;  :  ” < > * + = \ | ? ,”  — Another over-zealous coder under-thinking his validation logic!)


Microsoft says the Remote Desktop Client can connect to the console session, via a command-line switch.  Not sure why it’s not a checkbox on the options dialog , but it doesn’t work for me anyway.  It removes the %sessionname% environment variable, but Terminal Services Manager still shows the session is a “RDP-TCP#” name.  Oh well. (turns out the console session has to already be logged in). 

Something else I found: you can’t connect to the console remotely with a non-admin account — it gives you an error that “To log on to this remote console session, you must have administrative permissions on this computer.”

The standalone Client is best when you’re working in-depth on one remote machine.  The Snap-in is better for when you’re working lightly on several machines, and don’t need the extra options.  In daily use, I usually find myself switching between the Snap-in and the Client.  It’s a small but constant pain.

This is all to say that I just found Royal TS from code4ward, which is a free, open-source (C#) app, which attempts to combine the best of both programs.  (It’s like the Snap-in interface, but on steroids.) 

I’ve been using it for a few days, and it’s very good.  I only wish it could do a better full-screen, or use less screen real-estate with the embedded view.  I may try my hand at C# just to hack it up.

Hm, the author’s site is down now.  Hopefully it’s temporary.  Meanwhile, here is is on Snapfiles: http://www.snapfiles.com/get/royalts.html


Enable concurrent Remote Desktop sessions on Windows XP

It’s possible after all.  XP Pro’s Remote Desktop can be hacked to give concurrent sessions.

To explain:  Windows XP’s Remote Desktop rocks, as does its ability to give me my console session later (with my work uninterrupted) from another machine.  Glaring in its absence, though, is the ability to remotely-rock while someone is locally-rocking the machine.  This can stink in a big way. 

For example, too often I’ve remotely logged in for something quick, only to see this nuisance:

Logon Message
The user --- is currently logged on to this computer. If you continue this user's Windows Session will end and any un-saved data will be lost. Do you want to continue?
Yes   No

Rather inconvenient.  Even worse, though, I’ve often been logged in and working remotely, when someone locally logs in.  No warnings or explanations, just *bam* disconnected!  (At least the first situation confirms the handover with both people.)

For history:  Remote Desktop’s daddy was Windows 2000 Server’s Terminal Services in Remote Administration Mode, which did allow (limited) concurrent sessions.  Microsoft added the console-session flexibility to XP’s Remote Desktop, but dropped the concurrent sessions.  Then 2003 Server’s (renamed) Remote Administration wrapped in XP’s console flexibility.  Later, XP’s SP1 promised concurrent access, then SP2 did.  Two strikes.  It did make an SP2 beta though, before being yanked later…

The silver lining:  Thanks to the termsrv.dll from that SP2 beta, it’s possible to hack XP for concurrent Remote Desktop sessions in a few minutes.  Just change a registry setting, reboot to Safe Mode, replace the DLL, and boot back into homebrewed XP Remote Administration goodness.

For the do-it-yourselfers:  Don’t wait for Longhorn (or whenever-they-may-get-to-it): here’s the how-to article, and here’s the needed termsrv.dll file.

I just stumbled on sala source’s Terminal Server Patch, which wraps up the whole process in a single convenient patch.  Very cool.


My first 10 random songs

Hm.. mixed feelings about participating in a meme, and moreso since the last few posts have been borderline shirking.

(But wait, how can I shirk?  Did I made an regular-original-content-creation-committment?!)

Anyway, it’s a fun one via Ed Bott: load your entire music collection, randomize, and list the first 10 songs, uncensored. 

Here’s what I got:

Porcupine Tree – Every Home Is Wired
Spin Doctors – Someday All This Will Be Road
Blind Guardian & Iced Earth – The Whistler
Flower Kings – Rumble Fish Twist
Earth Wind and Fire – Shining Star
The Fixx – Red Skies
Andy Grube – I Surrender
Audio Adrenaline – I’m Not The King
King’s X – Mississippi Moon
Galactic Cowboys – Kaptain Krude

(Wow, rand()/fate was kind — nary a Raffie or bubblegum pop song in the lot!)

SBS2003 VPN: What were they thinking?!

I thought I’d share some Small Business Server 2003 security silliness.  Following is a series of Internet Explorer dialogs when you setup VPN via the Remote Web Workplace:

Microsoft Internet Explorer
After you install Connection Manager, ensure that all users of this computer have strong passwords to protect the security of your Windows Small Business Server network.

File Download - Security Warning
Do you want to run or save this file?
    Name: sbspackage.exe
    Type: Application, 503 KB
    From: ---
Run   Save   Cancel
While files from the Internet can be useful, this file type can potentially harm your computer. If you do not trust the source, do not run or save this software. What's the risk?

Internet Explorer
The publisher could not be verified.  Are you sure you want to run this software?
         Name: sbspackage.exe
    Publisher: Unknown Publisher
Run   Don't Run
This file does not have a valid digital signature that verifies its publisher. You should only run software from publishers you trust. How can I decide what software to run?

Connect to Small Business Server
Do you wish to install the connection to Small Business Server?
Yes   No   

Notice the Big Red Flag??  Microsoft’s SBS team never signed the VPN installer (sbspackage.exe), so IE on XPSP2 (and presumably 2003SP1 now) does its scary “don’t take candy from strangers” warning.  (How long has Microsoft been touting executable signing now?!?) 



Getter/Setter Properties in OO Javascript

I just asked a guru of advanced Object-Oriented Javascript, Douglas Crockford the following question.  For posterity, and for other possible takers, I’m posting it here too.

Also, for the record, this has nothing to do with IE’s proprietary — but wonderful — setExpression method or CSS expression capabilities.  Those dynamic properties only apply to DOM objects, not custom Javascript objects.

Do you know of a way to define dynamic object properties in Javascript?

For example, VBScript lets us define classes such as this:

CLASS myClass
PUBLIC phrase
PUBLIC PROPERTY GET firstword ‘get first word from phrase
firstword = left(phrase, instr(phrase, ” “))
PUBLIC PROPERTY LET firstword(v) ‘set phrase’s new first word
phrase = v & ” ” & phrase

This demonstrates two important features:
1. the firstword property can return dynamic results (depending on the current value of the phrase property). 
2. setting the firstword property can run other code (which dynamically prepends to the phrase property).

We can fully accomplish #1 (Property Get) in Javascript, by reassigning the toString method/property to a function like so:

function myConstructor(){
var self = this; //preserve object’s context
this.phrase = ”;
this.firstword = function(v){
if(v){self.phrase = v + ‘ ‘ + self.phrase}; //LET
return self.phrase.substring(0, self.phrase.indexOf(‘ ‘)); //GET
this.firstword.toString = this.firstword;

…But I’ve found no way to achieve #2 (Property Let or Set) in Javascript.  I can set firstword as a method, but setting the property value overwrites the method definition (and all subsequent GETs return that static value).

I’ve extensively searched, but found no answer (at least not before Javascript 2.0, which doesn’t yet exist).  Any ideas from the experts?

Update: Douglas Crockford responded that he doesn’t care for getter/setter properties, since “it allows simple assignment to have side effects, which I think works against reliability.”  (I take that as a “No, it’s not possible.”)
    My current need is that I’m patterning my custom object after part of the DOM, whose objects certainly do have getter/setters.  I agree with Douglas that getter/setter side effects can be dangerous (esp. in the hands of a poor coder, as with any powerful code construct), but I think the use of methods -vs- getter/setter properties should be in the realm of “best practice” rather than a language limitation. 

Answered: line-breaks in VBScript constants

I’ve run into this often: the need to have a VBScript constant containing a line-break character.  Today I finally got a definitive answer on whether it’s possible (for the impatient, the answer is NO).

If you’re interested in history…

Of course this is right out:

CONST blah = “hello

…It’s just bad syntax.  The closing string quote has to be on the same line as the opening one.

The normal approach I’ve tried was this:

CONST blah = “hello ” & vbCRLF & ” there”

..But the ampersand (concatenation operator) automatically makes it an expression to the VBScript compiler, and therefore it assumes “not constant.” This is of course despite the fact that both parts are known at the time of compilation (which is the main criterion for a constant — value is known at compile time).  Anyway, the ampersand is right out.

Now in JScript/Javascript/ECMAScript, you can do this:

var blah = “hello \r\n there”

…The \r\n switches define the line-break character, they go inside the string, and they are only interpreted when it’s read. 

Unfortunately, there’s no similar switch in VBScript.  While HTML does honor ASCII codes like &#10; or &#13;, and web browsers honor hexadecimal codes in URLs, VBScript does neither.  So these also don’t work:

CONST blah =“hello &#10;&#13; there”
CONST blah = “hello %0A%0D there”
CONST blah = “hello 0x0A0x0D there”

So I was reading a blog entry by Eric Lippert (who I believe wrote most of VBScript) today, and he mentioned Constant Folding, and proceeded to outline the mechanics behind this VBScript constant problem.  It rung a bell, I asked about line-breaks in VBScript constants in his comments, and Eric responded:
“Sorry, you are correct — there’s no way to do that. Sub-optimal, I know. “
…Straight from the dev’s mouth.

SO, if you need a line-break in a VBScript constant, just use a variable instead:

DIM blah
blah = “hello ” & vbCRLF & ” there”

…Yes, there may be some slight performance penalty compared to a constant, but it is script after all — racing performance ain’t the point.

25 And Over / Passing Lane Squatters

25 And Over – Playtime’s Over, Kiddies

Hilarious and disturbing in how much it has needed to be said.  My favorite bit:

4. Develop a physical awareness of your surroundings. As children, we live in our own heads, bonking into things, gnawing on twigs, emitting random squawks because we don’t know how to talk yet. Then, we enter nursery school. You, having graduated college or reached a similar age to that of the college graduate, need to learn to sense others and get out of their way. Walk single file. Don’t blather loudly in public spaces. Give up your seat to those with disabilities or who are struggling with small children. Take your headphones off while interacting with clerks and passersby. Do not walk along and then stop suddenly. It is not just you on the street; account for that fact.”

My own contribution to this is the boring “keep right except to pass.”   I’m usually just bothered by two things when driving:

  • Passing Lane Squatters (as I’ve dubbed them, except the term sometimes follows a less-descriptive, more emotional adjective), and…
  • Failure to Indicate (as in turns or lane-changes).

Unfortunately, the entire Passing Lane situation is complicated by two other things:

  • My Lovely State‘s lack of any laws related to the Passing Lane, and…
  • My Larvaly State‘s perverse plethora of Left-side Exit Lanes!  (pardon the alliteration)

Hence the righteous indignation (which might otherwise lead me to shoot cars with paintball guns) must remain at bay. 

Laws can be changed, but Exit Lanes are forever.