Sunday, June 26, 2005

Refitting with Core Data

I have a project InCDius 2 with which I demonstrate my coding skills, and update my Cocoa skills. I know I have some users out there, and I'm thankful for them, but it's mainly about me, about either getting me jobs or educating myself.

One of the big new technologies in Mac OS X 10.4 Tiger is Core Data. Core Data is gives you two things: it makes it very easy to create a document or a database for your your Cocoa applications, and it allows you to add functionality without writing code. I'm mostly interested in moving to an Apple maintained database framework; I've used Sleepy Cat's Berkeley DB libraries for the back store of InCDius and I have never been satisfied with the result. I do not have the time to learn the libraries complicated and obscure API well enough to give a rock solid and efficient user experience. I cobbled a usage together once, and it works OK and is quite fast, but people report occasional corruptions. I'd rather use a database with a pre-existing Cocoa API which Apple is actively developing, and I don't have to worry about getting a static library to link properly with a x86/PPC universal binary.


Anyway, I want to refit the database in my pre-existing application. This would be a lot easier if I were writing this from scratch or there wasn't an installed base of people with their carefully filled databases, or if some users weren't still on Panther. So I need to support both databases for a while.

So my needs are:

  • Code to translate from an old database to a new one.

  • Abstracted records where most of the application does not need to know how they were created or how they are stored

  • GUI to let the user know I'm switching the database over.

  • If I'm running under Panther or Jaguar, I have to be using the old database.

  • If I'm running under Tiger, I could be using either database.

  • If I'm running on x86, I need to be using only the new database, because I don't want to deal with endian issues or keeping two versions of the Berkeley static library compiled and linked in. It was painful enough to get it compiled in the first place on one platform.



As in most such things, the first and most important step is increasing the level of abstraction. The first rule of programming says that all problems can be solved with a high enough level of abstraction. We'll see.


BTW, if you are an InCDius user who's come across this entry. You can often fix database problems by opening up a terminal window and pasting in the following two commands (assumes that InCDius is installed in the Applications directory):


cd /Library/Application\ Support/Generally\ Helpful\ Software/InCDius


/Applications/InCDius\ /InCDius\ GH\ 2.app/Contents/Resources/ db_recover -c

Saturday, June 11, 2005

WWDC - Some Impressions

I'm in the Detroit airport on a 3.5 hour layover awaiting the flight to Manchester after a week at Apple's World Wide Developer Conference. As a "rank and file" developer, I've a few observations of the conference as a whole.



Firstly, the big news was the announcement of the Intel transition. When it comes down to it, I just don't care very much. I've never done any Altivec programming, and I've never written a line of PowerPC assembly. If Apple thinks they can make future Powerbooks which are both cooler and faster than staying with PPC, well that would be very nice. I was already going to have to put in a huge amount of modernization/refactoring on my next project and this will just force the issue. I know there are people out there who've warred for years with PC bigots about which is better PPC or X86, and to them this is a premature surrender; luckily I don't have that kind of baggage. I also don't think it will affect my near term hardware buying decisions, I always knew that if I bought a new Powerbook, there would be one 30% faster within 6 months, and it's going to be a long while before Apple ships a 64-bit Intel PowerMac.



Secondly, there was no second biggest announcement. I was hoping for the release of dual core Powerbooks or some other improvement which would have some immediate affect on my computing experience. The keynote was a bit too short for my taste. No, "one more thing."



Thirdly, I am always impressed by the joyful professionalism of the Apple engineering staff. They love their jobs and are always friendly and helpful even when I'm struggling to even know what words to use in a question. I spent some time talking to the maintainer of the AppleUSBAudio driver, and he is a great young guy, who actually seemed enthusiastic about my little Turtle Beach project.



Fourthly, I think the developers who need to write in C++, and by extension have to use Carbon are getting tired of their second class status. I would love to use Cocoa and Objective C for everything too, thus the name of this blog, but sometimes on cross-platform projects, or where there is a huge amount of legacy code, that is just not possible. It would be helpful if Apple devoted more engineering time to keeping Carbon and Core Foundation on par with Cocoa. For example, the Core Data classes in Cocoa are fantastic, but they won't do a cross-platform developer a lick of good. On the other hand, people who don't use Cocoa just because the Objective-C message calling syntax makes them queazy should suck it up and just learn it.



Fifthly, the new generation of developers are so amazingly young. I talked to the Delicious Library guys and I don't know if they can legally drink yet. I feel so old.

Friday, June 03, 2005

The Thinkpad X23 and the Dell 2005FPW LCD Monitor

I own a Dell 2005FPW LCD monitor, which has a native resolution of 1680x1050. My wife owns a Thinkpad X23 model 2662. The Thinkpad uses an integrated ATI Mobility Radeon 7000 as it's graphics engine. I thought, "Hey it would be nice if I could plug my nice widescreen monitor into my wife's little Thinkpad." So I tried, and it didn't work because there was no 1680x1050 available in the Windows XP display panel.


Then I thought, that perhaps there was a more modern driver available, so I went to ATI's web site and it turns out that they do not provide drivers for integrated notebook video cards. So I went to IBM's web site which a lot of searching ended me up at Lenovo's driver page for the X23. I had some trouble actually downloading from the site from the Thinkpad, due to some Java problem, and ended up using my 12" PowerBook 867 Mhz to download the driver, and move it over to the Thinkpad with a thumb drive.


Installation was quick and easy, and successful. My wife can now surf the web in beautiful widescreen if she so chooses.


I also have a USB hub available which I can plug into the desktop PC, my PowerBook or the ThinkPad which with a single plug gives printing, external keyboard, trackball, and audio out. It's a pretty sweet setup.