I Got a Mac!

On Tuesday of this week, I traded my no-longer-used Dell Axim PDA for an iBook G4. I owned a Mac Toaster Model back in 1988, but that was a completely different beast. Even though this new Mac is a few years old, and only 800Mhz, it’s amazingly snappy. I have a desktop machine with an Athlon 1.4Ghz chip running XP, and this little Mac feels faster than that. Maybe it’s just because it’s different, but it really does feel that way. I’m very happy with it so far. I have installed a ton of software and have gotten it configured just so. I have my full Java development environment setup (Eclipse, Ant, SmartCVS and SQuirrelSQL) and I can build my company’s software, which is very cool.

Tonight I had a little spare time and started looking into Cocoa development. I knew that the Mac used Objective-C as it’s main development language, but I had never before had the desire to probe Objective-C. As I started looking into it, what do I find? Smalltalk-style calling semantics. I was shocked. I never knew that Obj-C had essentially grafted Smalltalk-style message passing onto the C language. What a surprise. This may end up being quite a bit of fun!

I’m currently just looking online, but I will very shortly want a dead tree to delve further into Cocoa. Any recommendations?

IE7 Beta Still Can’t Handle Port Numbers

I discovered today that Microsoft had released a public beta of IE7 so I decided to have a look. It only runs on XPsp2, so I applied sp2 to an XP image running under VMWare, which only took an hour and 400 reboots. Anyway, once I got the OS to the proper level, I installed the IE7 beta. The first thing you have to do is prove to Microsoft that you are running “genuine” Windows software. I have no idea what got transmitted to Microsoft when I agreed to do this, but apparently it was enough to convince them.

The thing installed in about 10 minutes and then ended with… wait for it… a required reboot! Who would have guessed? Not me… So after rebooting again, I see a nice shiny new IE icon in my quick launch area. Running it brought up the new IE, fairly quickly. I don’t like the new interface at all, and I’ve found a few quirks (just try adding a new search provider by clicking on the “Settings” button next to the description that says “Add or remove search providers” for an example). But the thing that really stuck out for me is that IE still forces you to enter the http:// protocol when the website you want to visit needs a port number. In other words, instead of being able to just type this

www.mymachine.net:8080

I instead must type

http://www.mymachine.net:8080

which is insanely annoying since I never type that anymore. (Nor do I ever type “www” unless I absolutely have to because the site in question hasn’t bothered to setup their DNS properly.)

Could someone please explain to me why IE still can’t handle this properly? Firefox can. Opera can. Even Konqueror and Safari can. Heck, even Lynx understands it for Pete’s sake. Why on Earth, with all of the development resources that MS has, can’t they fix this?

Strange Obi-Wan Error

I was doing some JDBC today and I forgot that column indexes are 1-based instead of 0-based. It took me a while to figure out what was wrong since the exception message I kept getting was

java.sql.SQLException: Column Index out of range, 0 > 11.

Despite the fact that zero is not, in fact, greater than 11, I checked to make sure I had used < and not <= in my loop because I thought I was going beyond the maximum index… but I wasn’t. The problem was that I wasn’t even getting to the first index! Then I remembered that I started my loop at 0 and that JDBC ResultSets start indexing at 1. Changing it to 1 fixed the problem, but the error message is wrong. It should have told me that 0 was less than 1 or, more helpfully, that ResultSet indexes start at 1…

I Need JavaScript Obfuscator Recommendations

Can anyone recommend a decent JavaScript obfuscator? I don’t really care about free vs. payware as I’ll gladly pay for a quality product, so don’t limit yourselves to free products only. My only real requirement is that is must, must, must run from the command line on both Windows and Linux. It can be Java or C or Python or Ruby or anything else that is cross-platform. I have found a few, but they all seemed to run as a GUI, which violates my one requirement.

Why is the command line so important? I need to be able to have this program run as a part of my Ant build script, so no GUI’s allowed. I did actually find one obfuscator that was written in Java and ran dandily from the command line, but I didn’t find its obfuscation compelling. IOW, I didn’t think it did that much to make the scripts hard(er) to decipher. I’m currently using JSMin which, while not an obfuscator (it’s an uglifier), was better than the obfuscator I mentioned.

Anyway, leave a comment or send me email if you have a suggestion.

GTK+ Eating Ctrl-Shift…

I’ve been using Eclipse for a long time now, but almost exclusively on Windows. I’m now using it on a SuSE Linux box quite a bit, and I’m using the GTK+ version instead of the Motif version. While the thing works nicely, some of the key bindings are different from those on Windows, so I decided to change them. The first was changing Source>Format from the horrible Esc Ctrl-F back to Ctrl-Shift-F. Imagine my surprise when I could not map it to Ctrl-Shift-F as it is on Windows. As it turns out, it’s not Eclipse’s fault (though that key editor is pretty bad). No, the fault lies with the GTK toolkit which eats Ctrl-Shift-x sequences, because it assumes you are wanting to enter special Unicode characters. That’s fine and good, but it should be configurable, and from everything that I’ve read, it isn’t.

Does anyone know how to tell GTK to stop eating Ctrl-Shift sequences, or am I stuck with this?

Streaming MP3 Files With Edna

I discovered ApacheMP3 the other day, and since I’ve been wanting to be able to stream my music collection inside my house, I decided to give it a go. So now I’ve been fighting with ApacheMP3, and mod_perl and the various other pieces of software that were needed, for a few days now. It’s been a fight because my Apache server happens to live on Windows. I’ve been happily using Apache 1.3x for some time now but when I discovered ApacheMP3, I decided to upgrade to Apache2, which no longer had the stability warnings for Windows. That part of the upgrade went well. It was trying to get mod_perl installed and working that I hit problems. And the Ogg support. I tried building these against Apache2 and after failing several times with that, tried again with Apache1. I installed the ActiveState-compiled mod_perl, but still got errors. It’s too long a tale to go into here. Suffice to say that I downgraded to what I originally had and just said “screw it, I just won’t stream my MP3’s.”

So, just as I was prepared to give up, I did one more Google and discovered Edna. I had it installed, configured and running inside of 10 minutes. And that was as a Windows service! I can now stream my music anywhere in the house effortlessly. I specifically wanted to be able to access the music from my laptop, and now I can. The only wrinkle is that it seems to only support MP3 and Ogg, but I also have files in SHN, FLAC and Monkey formats. I haven’t actually investigated yet, so there may be installable support for those formats as well.

I’m very happy.

Ruby + MySQL + Windows = SUCCESS! (Finally)

If you do a Google for “ruby mysql windows” you will find, among other things, lots of people trying to use Ruby to access MySQL on a Windows system. I’ve been trying for some time, and have finally gotten things going.

About a year ago I found this article in which he fought the same fight. He was able to get a working .so file, using the .Net C++ compiler, and offered his binary, but that won’t work for everyone. Specifically, a file compiled with VC7 isn’t usable by VC6 (at least not that I could see).

Anyway, I followed his advice to a point, and then started experimenting. I opened up irb and started poking MKMF to see what I could accomplish. What I finally ended up with is a hacked extconf.rb that can be edited easily to get the library built on your own system. It will work with both VC6 and VC7, by changing one line in the file. Assuming that you have MySQL 4.1 installed in the default location, and you are using VC6, and Ruby 1.8.2 is installed in the default location, you should be able to do this

    ruby extconf.rb
    nmake
    nmake install

and have everything compile and install. Notice that I said should. You should still take a look at the file, near the top, to see if the settings are appropriate for your system.

Once installed, you can use this module directly, or install DBI for that “standard” interface. DBI will use the library you just built and installed, so all you have to do is download the DBI module, then do this

    cd ruby-dbi-all
    ruby setup.rb config --with=dbi,dbd_mysql
    ruby setup.rb setup
    ruby setup.rb install

If you want to install other DBD drivers, add them after dbd_mysql. That should be it.

Here’s the hacked extconf.rb file.

There are only two lines you might need to change, and they are at the top of the file with comments around them.

I have tested this slightly using the binary I built with VC6 and it seems to work fine. I have not tested the VC7-compiled binary, because I don’t have a Ruby distro that was compiled with VC7. Let me know if these directions don’t work for you. Not that I can do anything about it, but I could put a note here for others.

Also, notice that I used 8.3 pathnames, which is really ugly. I would have been happy to use the pathnames with spaces, but VC6 doesn’t like spaces in pathnames. VC7 can grok them fine, but not 6. Both understand the 8.3, so it was just easier to use that.

One more thing. I don’t believe that installing Visual Studio.Net installs the necessary header and library files for building non-.Net binaries. IOW, you might not have windows.h which will cause things not to work. If you download and install the Platform SDK, then you’ll be fine. My extconf.rb will add the default Platform SDK directory to the necessary paths, so if you have that installed, and try to do a VC7 build, you should be ok.

TortoiseCVS Rocks!

I’ve been using CVS for a very long time now for version control. I used the command line tools happily for years, then some good GUI tools appeared. I never really liked some of them, but SmartCVS really stood out. I ended up buying a license for SmartCVS and was quite happy with it. Then I discovered TortoiseCVS. Not that SmartCVS is bad; on the contrary, it’s quite excellent. But for some reason TortoiseCVS just grabbed me. I have been using it ever since. (Of course, TortoiseCVS won’t help you if you’re not on a Windows box.)

Anyway, I was just working on some code, and I removed five files, by pressing <del> in Eclipse. When I went back over to my explorer Window and did a Commit, it showed me that those files had been removed, and would be committed thusly. That’s very nice. Using the command line tools, you have to do a “cvs remove foo.txt” on each file. I can’t remember if SmartCVS handles this properly (it probably does) but it was just nice to see that it understood what was going on. This tool has lots of nice little features like this that keep me happy.

Now, I will say that I’m not doing any sort of rocket science version control. It’s just middle of the road stuff. But this is a really nice tool. And they have a cute mascot. I may have to get one of those t-shirts.

Adding Other Extensions to Google Desktop Search

I asked the question a while back of how Google Desktop Search determines what is and is not a text file. I was distraught because it seemed to find my Java, Perl and Python files without breaking a sweat, but was ignoring all my Ruby, SQL and C# files. It turns out that they do indeed have an “approved extensions” list for determining what is a text file. Enter GDSPlus. This extension/patch for GDS gives you the ability to add whatever extensions you want for indexing. I downloaded it, followed the directions (some of them belatedly…) and now all the aforementioned ignored files are being indexed alongside those that the Google folks decided were search-worthy. I’m very happy.

The only real drawbacks are that in order to add a new extension, you have to whack the cache that has already been created. In my case it was close to 700 Mb. It wasn’t hard to whack it, and the directions with GDSPlus tell you exactly what to do, but I don’t like the fact that it has to start over again from scratch. The other drawback is that as soon as the Google folks release a new version, it will have to be patched again. Unless, of course, they fix this deficiency before the next release. Let’s hope they do.