Tuesday, March 22, 2005

SSH

Although I haven't written anything here about SSH before I have written e-mail to friends about the usefulness of this great Unix command line utility. Basically SSH stands for Secure SHell. It differs from your normal shell in that it uses encryption. Now while in and of itself encrypted communications is a good thing, the thing that has made SSH so fantastic is it's ability to tunnel TCP/IP ports over the SSH connection. What does that mean? Well I have access to my work computer via Citrix. From that machine, through a cygwin initiated SSH session back to my home computer I can tunnel traffic to various services around the network. Like what you ask? How about Oracle, SQL Server, Tomcat, IMAP Mail, CVS, etc. anything with a TCP/IP port.

Now finally I'd like to point out that you can do all this with Mac OS X out of the box by simply clicking a checkbox. But you can do a few more things to make things more secure. One of those things is to use public-key based encryption which relies on not just a password but a encrypted public key as well (i.e., something you have and something you know). Checkout this series of articles for more information. They're Mac-centric but the content is fairly generic.

Monday, March 21, 2005

Scripting

One of the Pragmatic Programmers' rules is
Don't Use Manual Procedures.

A shell script or batch file will execute the same instructions, in the same order, time after time.

The most common way I use scripting is to use Ant to create build scripts for my Java projects. Any IDE will do a lot of the things an Ant script typically does, but an Ant script is far more portable and can be scheduled to execute without a GUI (e.g., automated nightly builds).

After using Ant, I looked at languages like Ruby and Groovy. In the beginning I was mostly interested in them from a bit of an acedemic perspective (i.e., dynamic languages vs strongly typed languages) but I've also used them for automating the occasional non-visual tasks.

Lately I've come to realize that there are also plenty of tasks that could benefit from scripting GUI applications. Afterall there is plenty of functionality in GUI apps that I may want to leverage in a routine way. Enter Applescript. Somewhat surprisingly, Mac OS X's user interface and most Mac applications are pervasively scriptable. In fact just drop into XCode to build a native Mac OS X Cocoa application and your application will be Applescriptable out of the box. You can call command line scripts from Applescripts and you can call Applescripts from command line scripts. The best of both worlds.

Applescript first shipped with Mac System 7.5 in 1994. Having done some HyperCard development back in University in the late 80's I can say that Applescript seems to share a syntactical heritage with Hypertalk. For you non-Apple folks that means that Applescript attempts to be English like in its syntax in an effort to improve readability. So for example a simple script to get the Mac to move a file around might look like this:
move file "Bob" of startup disk to folder "Joe" of startup disk

I'm just starting to get into Applescript and while it's unfortunately one of those technologies that's platform dependent, I figure I should probably get somewhat comfortable with it since it's everywhere in my current OS of choice. I'll write up another entry if I discover anything particularly interesting.

[Update] Here's an article espousing the goodness of Scripting/Dynamic Languages.

Friday, March 11, 2005

Eclipse Icons

I was building a web application yesterday and decided I needed some icons to replace some buttons on one of the pages. So I started googling without much success. Although I could find the odd icon or two that would work, they were different sizes, had different colour palettes etc. They just didn't come across as being part of a coherent design.

Then I was looking at Eclipse thinking I want something like that. After a little investigation I discovered where Eclipse stores its icons. Take a look in any of the plugin subdirectories that have "ui" in their names and you'll frequently find icons in a web-friendly GIF format ready for pillaging. (e.g., [ECLIPSE_HOME]/plugins/org.eclipse.jdt.ui_3.0.1/icons/full/etool16). With some of the basic icons and some of the overlay images (e.g., [ECLIPSE_HOME]/plugins/org.eclipse.jdt.ui_3.0.1/icons/full/ovr16) and a little bit of photoshopping you can create some nice consistent icons for your web application.

Tuesday, March 08, 2005

Writing "Software"

I think part of being a good father is helping your kids understand what you do for a living. Well I write software but despite my best efforts to explain that to my six year old son he didn't quite get it. A couple of weeks ago he said something like "I can't believe someone pays Daddy for writing software". Of course my mother in law chimed in with "I can't believe it either". Nice. So I let that one go.

But yesterday, he said something like "I don't think I'd like writing software all day. I think I'd get bored." Then at supper I was trying to explain that it's not so bad and that I try to learn something new everyday to make it interesting. And he said "Well I guess you'd learn how to spell 'software'".... Wait a sec.... He thought I was writing the word "software" over and over again, like I was in some kind of permanent high school detention. LOL. From his perspective that's what writing is so it made sense (sorta). Well now I 'll have to try and sit him down and show him what I really meant. I don't think my mother-in-law would sit still for it. I'll save that conversation for another day.

Friday, March 04, 2005

Internet Explorer Sucks

I'm trying to put together a little HTML page with some Javascript to hopefully give my users a slightly better experience and I am brutally reminded why I hate using Javascript and the HTML-DOM, it just doesn't work.

Okay it works, but it only works in Firefox right now. Following good development practices I started with the browser that best supports the standards and that's Firefox. After messing around for a couple hours and getting a half-assed simulation of a popup menu, I tried it in Microsoft's crappy Internet Explorer to discover it does nothing. I don't know why yet, but I'd wager it has something to do with IE's lack of standards support. I'm no Javascript guru so this is frustrating enough already but to have IE flip me the middle finger is just infuriating. FOR THE LOVE OF GOD!! IE SUCKS!