Cygwin SSH just doesn’t call $HOME lately…

With the new version of Cygwin, SSH suddenly doesn’t seem to phone $HOME anymore.  Which is usually going to be set to something like c:\Users\<username>.  In general Cygwin is supposed to look at $HOME first and then use alternative home settings, such as /etc/passwd.

The quick fix is to make sure the relevant entry in /etc/passwd matches what you have in $HOME.

Open Windows Explorer to the current working directory from Cygwin

You’re sweating away deep in the bowels of some framework when suddenly you realize: “Wow, I actually kind of need to use Windows Explorer here.”

Thus begins a frantic thirty seconds of double clicking through layers of folders.

Rob has an awesome little bash shell script that will open Windows Explorer to whatever directory in which you happen to be.

I’ve named it “explore”. So now if I need to pop a gui while thirty levels deep in an app, I just issue a simple $ explore command.

Symbolic Links in Vista

This is the third time I’ve had to look this up, so into the blog it goes.

With Vista, Windows finally kind of supports symbolic links, though in general you would never know they were symbolic. Here’s a symlink you might want to set up if you do a lot of Symfony-based development:

mklink /D sf "C:\Program Files\PHP\data\symfony\web\sf"

The forward-slash “D” is for “directory”. Note that you can’t just link to a directory; you have to define what the local instance will be referred to as (in this case, also “sf”).

You can see that a link is symbolic when you do a “dir”:

10/20/2009 08:49 AM sf <SYMLINKD> [C:\Program Files\PHP\data\symfony\web\sf]

You can also add a “Link target” column to Windows Explorer. Other than this, however, there seems to be no convenient way to identify links as being symbolic.

mklink’s symbolic soft links behave more like hard links when copying and the like. Oddly, in Windows Explorer when you try to copy a symlink folder to the same directory, instead of saving the symlink folder as, for example, ”sf – Copy”, it instead copies all the files inside the folder and saves them as copies there.

I’m going to have to find something that plays a little more nicely with a large Subversion repository when doing a lot of branching and merging.  Perhaps I can get real-ish symlinking to work with Cygwin.

Remote access to a Mac from a Windows (Vista) box

If you find that you need to access a Mac from a Windows box, probably you’ll find yourself surfing the specs of a variety of Win32 X-Windows clients. Here are some that I tried:

Cygwin also has an X client, but I didn’t muck around with that.

RealVNC is (I think) the original. I’m guessing that the others are forks of Real, and that either Echo is a fork of Ultra or Ultra a fork of Echo. Tight seems to be a fork of an earlier, simpler version of RealVNC. And, according to their website, is “fully compatible with the standard RFB protocol used in VNC.”

It’s not surprising then that, out of the box, TightVNC is the only client I could get to connect to a Mac from my Vista machine at home. Tight’s refresh/rendering is plenty slow, but gets the job done.

So NOW what is Windows doing?

If you’re a Windows users, then you’re likely accustomed to your box periodically grinding to an inexplicable crawl.  And likely you’ve become accustomed to looking morosely over to the hard disk LED as Windows furiously swaps memory, or randomly formats volumes, or sends secret blinking morse code love letters rapid fire to your toaster, or Gates only knows what it’s doing.

For years I’ve looked for some kind of tool that would give me better insight into what was going on under the hood.  The guys at SysInternals have a variety of apps that are helpful (if not downright awesome), but none that would allow me to causally glance at a dashboardy widget and say “Oh, it’s the whuzawazzit again.  Guess I’ll go get some coffee.”

Enter Moo0‘s System Monitor.

moo0-system-monitor-v127

I first saw System Monitor some months back on Lifehacker.  And while it was a useful little resource monitoring tool, it wasn’t really useful enough for me to remember that it was actually installed.   That is, until last month’s update.

Version 1.27 of System Monitor includes one very important and revealing feature:  Bottleneck Reporting.  As you can see above, System Monitor tips you off to the most likely “villain” of any performance slowdown.

In my case (and certainly in the case of most everyone else) the bottleneck is typically going to be the HDD; hence our Pavlovian stare-at-HDD-LED response.   Now, however, I at least know what’s causing my disks to spin and my head to turn.

Outlook, which as always been the primary suspect, is of course guilty as sin.  And to my surprise I see both Firefox and Skype lurking around the “Main Loader” far more often than not.  And then there are the myriad of Windows sub-processes that seem to be taking industrious liberty with my hard disk behind closed doors.

But now that I finally know what the heck Windows is doing, I can finally, at long last, do something proactive to improve system performance.

Like, say, switch to a Mac.

Bulk Rename Utility: The Missing Link of Utility Software Awesomeness

The Bulk Rename Utility is a free Windows app from the makers of ViceVersa.

And it is awesome.

Of course, this is something only a true geek like myself can get excited about… but in all honesty it is the single most welcome addition to my arsenal of software tools in many years.

Every so often (or, as seems to be the case lately, every freaking day) I need to rename a large number of files from pattern X to pattern Y.  Usually this involves firing up Cygwin and working out some kind of rename script snippet.  Not rocket science this, but enough to make me groan inwardly.

I’ve tried a couple of rename utilities over the years; none powerful enough to replace script writing.

BRU is different.  You can see from the screenshot that it has intuitive (well, kind of) filters for just about any possible renaming combination.  Best of all it gives you a preview of how your files will be renamed… before you accidentally mung that entire directory tree.  BRU includes many, many more features, including exotic transformations such as renaming photos from EXIF extensions as well as renaming MP3 files using ID3 tags.

Anyway, enough gushing of the geekery.  It’s a nice tool.  Recommended.

Running the BlackBerry Simulator on Vista

BlackBerry Simulator mysteriously dying every time you try to fire it up on Vista?  Same here. It’s a good thing I’ve become a compulsive reader of release notes. From the the latest JDE 4.6.0 docs:

If you install the BlackBerry® Java® Development Environment on a computer with Windows Vista™, if Use Account Control is turned on, launching the BlackBerry® Smartphone simulator might produce error messages and the simulator might not start.

Translation:  Simulator will definitely. not. start.  And of course they mean User Access Control. How-To Geek has an easy way to kill UAC here.

Windows log file rotation

Yet another de facto Linux command that is oddly missing in Windows.

Some simple log files from a custom app were getting out of control. Google revealed that while basic rotation is possible for the standard Windows event logs, there’s no command in particular for log rotation, aside from some odd looking bat scripts that required typing output to temp directories and the like.

Tried rotatelogs.exe from the Windows distribution of Apache 2.2, but that didn’t seem to work at all.

Today, however, I stumbled across CHOMP. Works a peach, and surprisingly quick. Recommended.

(BTW, looks like the author has his own implementation of tail as well. Maybe this is the replacement for Cygwin tail that I was looking for last August..  Update:  It don’t work so well.)

Running Windows commands from PHP over IIS

In order to run Windows commands via PHP functions such as open_proc(), apparently one has to grant read/execute permissions to the account under which IIS is running (usually IUSR_<servername>) on C:\WINDOWS\System32\cmd.exe. Be sure to do this for web apps that rely on external commands.

This of course took me an eternity to figure out. I was only able to piece together WebSVN‘s bizarre Windows mis-behavior after scouring through the remnants of forum posts limboed in Google cache. PHP.net of course has no proper details on this, though I do now better understand what proc_open‘s obscure and undocumented bypass_shell parameter might be about.

Ah yes, PHP on Windows. Obscure and irritating.

Kind of like me. Not that that makes it any better.