Thursday, November 29, 2007

Freeciv 2.1.1 Available for Tiger & Leopard

I have re-built my Tiger machine running 10.4.11 to the point where I can resume the publishing of my Freeciv package. Version 2.1.1 is available for download now.


Wednesday, November 28, 2007

Freeciv 2.1.1 GTK on Quartz, No Go!

As mentioned in the previous post, my Tiger installation got corrupted, and I had to start over. This gave me a chance to do a fresh install of MacPorts. When I saw this post, I decided to give it a go with Freeciv 2.1.1 to see if the GTK game client can also live without X11. I was half-expecting it work. But, it didn't work, which surprised me a bit. I mean, how can Freeciv be more complicated than Gimp?

In any case, I hope to publish the PowerPC version of Freeciv 2.1.1 soon.

Freeciv 2.1.0 on My iMac

So I finally sat down and built Freeciv on my iMac. MacPorts folks have made it even easier, as there are now ports for both the SDL version and GTK+ version of the game.

I built the SDL version just to see what it is like. I played with it for a while, until it crashed. I also realized that there is no sound support. The user-interface is a bit funky. It feels less mature than the GTK+ version. On the up side, it runs natively on my Intel iMac, without X11, and it feels snappier.

I think I will try the GTK+ version next.

As for the longstanding wish to have a universal binary version, it is possible, but I don't know how to do it. My Tiger machine's hard disk crashed, and my backups are out of date, so I lost a bunch of stuff, including the latest source code for my launcher. :-( I guess that is why Apple came up with Time Machine.

P.S. - Yes, I know that 2.1.1 just came out. I am obviously behind. I will catch up, eventually.

Wednesday, November 21, 2007

Using Xcode for Ruby/Rails Development

Now that I have my iMac pretty much all set up, I asked myself what I would now use as a development environment for Ruby on Rails.
On my old machine, I settled on vim with a few plug-ins. Since my new machine has got CPU cycles to spare, I have a few options:
  1. Eclipse
  2. Komodo
  3. vim + plugins
  4. Xcode
The last option, using Xcode, turned out to be surprisingly pleasant for me. Since the new version of the IDE supports Cocoa-Ruby programming, it means the text editor understands Ruby as a language. So syntax highlighting, dropdown for jumping between methods of a class/module, and even the folding indicator (which is visually awesome) all work. Integration with subversion is another bonus.

I did find one bug with the folding indicator, which I've filed with Apple. For example, let's say you have a class (database migration) as follows:
class MigrationTest < ActiveRecord::Migration
def self.up
def self.down
If you open up the file in Xcode's editor, and pay attention to the folding indicator, you will see that it thinks the class ended when the method self.up ended. Basically, it is confused.

A workaround would be to change the word self to MigrationTest.

Other than that, I find Xcode to be sufficient for my Rails development needs, for now.

Tuesday, November 20, 2007

jQuery and FireBug Rock

So I was going to write a test page to check out the re-branded ASP.NET AJAX framework.  Well, that didn't happen.

Instead, I downloaded the source code to Ajax.NET Professional, put in the fix, re-compiled, and went to work on my project.

All was well in my world, until I hit brick wall.  When I attempted to serialize a large DataTable down to the browser as part of an Ajax response, something went wrong.  I think the generated JavaScript code that is part of Ajax.NET Professional croaked.  Yikes!

Well, since my project is a mashup of a few JavaScript libraries, I thought that perhaps one of them conflicts with Ajax.NET Professional.  So then I wrote another test page, which disproved my theory.  Doh!

At this point, I gave up on Ajax.NET Professional.  I was an inch away from rolling my own JSON serializer.  The rules are pretty simple, after all.   But some Googling led me to Json.NET, which is a simple JSON serializer/deserializer.  Except it's got some issues, too.  So I wrote a custom DataTable serializer using the JsonWriter class instead.  To keep things simple, every column value gets serialized as a string for me, an this worked beautifully.

On the client-side, I use jQuery to perform the Ajax requests as well as some fancy UI manipulation.  I think this is an awesome JavaScript library.

And FireBug is definitely worth mentioning, too.  I just don't know how JavaScript developers (myself included) coped for so long without it anymore.

Monday, November 12, 2007

Which AJAX?

Here I am, sitting in my workspace, pondering the pros and cons of AJAX frameworks.

In the past, Microsoft's Atlas left a bad taste in my mouth. Then, I found Ajax.NET Professional, which I loved for its simplicity and integration with the .NET framework. The only downside is that it doesn't do anything for the user-interface. That's where jQuery (or another library) comes in.

A few months ago, I took a class on Microsoft's re-branded ASP.NET AJAX framework. Even though it is also very convoluted, they've cleaned up things quite a bit.

More recently, I upgraded my installation of Ajax.NET Professional to, and to my dismay, DataSet/DataTable serialization broke. I found an open ticket that talks about the problem I am having, plus a workaround, which involves me downloading the source code, making a small change, and re-compile and use the now unofficial assembly. The ticket was opened in June, but the most recent release was in July with no official fix available, and not a word from the developer on this that I can find since the July release. This troubles me, and a bad taste is forming in my mouth.

Furthermore, something the instructor from my ASP.NET AJAX class began echoing in my head: "If you want to do something fast, UpdatePanel is the way to go." Well, that is exactly what I've been asked to do.

Putting it all together, whereas I started out consciously wanting to avoid Microsoft's ASP.NET AJAX framework, I now find myself re-thinking...

I've already written a quick test page using Ajax.NET Professional and jQuery. Perhaps it's time to write another test page, but use ASP.NET AJAX instead.

Programmatically Determine Mac OS X Version Number

So when I decided to modify my Freeciv launcher to behave according to the version of Mac OS X it is running on top of, I needed a programmatic way to get at the OS version at run-time.

I read in Xcode 2.x's documentation that the best way seems to get it out of the file /System/Library/CoreServices/SystemVersion.plist. Even though it is a plain-text XML file, I didn't just parse it via brute-force and get at the number. So I had to parse it properly. It turns out to be pretty easy.

NSString * text = [NSString stringWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"];
NSDictionary * plist = [text propertyListFromStringsFileFormat];
NSString * productVersion = [plist valueForKey:@"ProductVersion"];

Three lines of code, and I can get at the strings such as 10.4.9 for Tiger and 10.5 for Leopard. Simple. I like it.

Sunday, November 11, 2007

Freeciv 2.1.0 Now Launches Properly Under Leopard

Even with reader j's suggestion, my launcher still didn't work properly under Leopard.

Nonetheless, I modified my launcher such that when it is running on Tiger, it used the pre-existing way of starting the game.  When running anything newer than Tiger (Leopard and beyond), it would launch X11 first, and then launch the game client.

The question then is how the launcher figures out whether it is running on Tiger or Leopard.  I'll save that for another post.

I tested the modified launcher on both my Tiger and Leopard machines, and the results are satisfactory.

You can download the modified disk image here.


Friday, November 9, 2007

Leopard's X11 is Funky

From reading Ars Technica's review of Leopard, I knew something Leopard's X11 is different, but I didn't understand enough of the details to know how different until I looked into why my launcher is not working.

See, when you run my Freeciv launcher application and click on Run Freeciv, it ultimately executes the following command:

open -a X11 ~/Library/Application\

Under Tiger, this command launches X11 if it is not running, and causes the script to run, which in turns launches the GTK game client.

However, under Leopard, the same command launches X11 if it is not running, brings up an xterm window (with the strange title of "-xterm"), but the Python script does not run.  This is why my earlier post for the workaround works, because what you are doing is picking up where X11 left off.

I have filed this as a bug with Apple.  In the meantime, I will look into an alternate way to kick off the game client from within my launcher.

Heroes Season 2, No Place To Go But Down

That's what a co-worker said after he watched through the season 1 DVDs in a series of evening marathon sessions. But as we discussed the future of the show, we agreed that the creative team behind Heroes has a tall order to fill in trying to live up to or out do the first season.

And sure enough, season 2 thus far as been a yawn, until Peter's trip to the future and Adam Monroe's face set the stage for the rest of the season.

A fellow bloggerette said it well in her post here. Hopefully the remaining 15 or so episodes will pump the adrenaline back into our veins the way season 1 did.

Wednesday, November 7, 2007

Getting Freeciv 2.1.0 to work on Leopard

Reader "j" commented that he is unable to get Freeciv 2.1.0 to run on Leopard. I concur. There is an issue. Until I get around to address it, here's a workaround.

First of all, if you haven't yet done so, run the Freeciv application, set your options as you like it, and click Run Freeciv. An xterm window will open, but not much else.

Then, click on the xterm window to bring it to the foreground, and execute the following command:

~/Library/Application\ Support/Freeciv/2.1.0/

This should launch the actual game client. This workaround is working on my 24" iMac running Leopard, and sound support is functional.

Let me know how it turns out for you.

Leopard Landing

So I received my copy of Leopard two days ago via Apple's up-to-date program for this big cat via FedEx Ground. I was expecting a retail box with the fancy hologram graphic. Instead, I get a plain, padded envelope containing the DVD and a small manual. A bit disappointing, but oh well.

It is my habit to always perform a clean install whenever I upgrade. This time is no different. I just had to make sure I can re-install iLife '08 on top afterwards. A co-worker did it, except he had to run Software Update after installing the application suite to get the Leopard-compatible versions.

Having read in Ars Technica's review its scathing criticism of Leopard's Finder, I was curious as to how it would be like for me. Having used it for the past two days, I must concur.

Nonetheless, I was impressed by the overall speed of Leopard's user interface. I am glad I opted for an iMac over a Mac mini for the more powerful graphics capabilities Leopard is offloading to the GPU. I am betting my iMac will run future versions of Mac OS X better than a mini. If you are running Leopard on a mini, I would like to hear about your experience with Leopard.

Moving along, the lack of support for Time Machine over a networked volume is rather disappointing. I read/hear a lot of complaints about its inability to backup large files (Entourage databases, virtual machine disk images, etc.) efficiently. But my experience with other backup mechanisms tells this is an issue with them, too, no? Maybe ZFS will help. But I am not holding my breath for it to happen within the 10.5.x timeframe. It seems like too big a change to put into a point release. I do, however, believe Apple should be responsible for trying its hardest to get Time Machine to work withe networked volumes, if what everyone says about it being pulled late in the beta process is true. Technically Apple isn't obligate, unless someone wants to take some class action along the lines of Mac OS X's failure to fully support G3 machines (see here and here). It's more of a goodwill, thing.

Cover Flow within the Finder is interesting, although it frustrated me at first. I downloaded several desktop backgrounds from, which rendered nicely when viewed using Cover Flow. But when I copied some family photos from my old Mac (which was stored outside of iPhoto), the Cover Flow images looked pixelated and ugly. Then I found out from this forum
that I needed to remove the custom icons from these files. This worked, but it also modified the modification timestamp on my pictures, which many programs use to track when the picture was taken. Hmm. Maybe I'll try iPhoto. More on this in a future post.

Lastly, I installed Xcode 3.0 and did some brief reading on Objective-C 2.0. Sounds interesting.

There is a lot more to do to get my digital life onto the new Mac. Heck, I haven't even gotten E-mail set up yet. So much to do, so little time...


Saturday, November 3, 2007

Freeciv 2.1.0 Released

Freeciv 2.1.0 was released on the 27th of October. I finally got my act together and put up my Mac OS X package. You can download it here.

Even though I am writing this entry from my new 24" Core 2 Duo iMac, I am not planning on releasing an Intel version running on Tiger. My copy of Leopard is on its way, and I plan to start work on a Intel Leopard version once I have 10.5 installed.

My work on Freeciv relies heavily on MacPorts and requires X11. However, reports of compatibility issues between MacPorts and Leopard may trip things up for me. Furthermore, I also came across reports of changes in Leopard's X11 implementation that aren't backwards compatible with Tiger.

If these two things turn out to be showstoppers, I might looking into the SDL client as an alternative, since someone was able to build it on Tiger without MacPorts nor X11.

We will see...