VelociPeek

Eric’s weblog on tech

Thursday, November 29th, 2007

The Spring Framework: MVC At Its Best - Part 1

Song of The Day: Spring 2001 - Artist: Lila



Recently, I rewrote a significant part of a Tomcat/JSP/JDBC application using the Spring Framework 2.x and Hibernate 3.x. Although Hibernate has its niceties and nuances, the Spring Framework integration alone reduced the code complexity, made the code more readable and maintainable, and reinforced good coding practices.

Those in the Java space likely already know the advantages of an MVC framework, possibly having used Struts or Spring previously, but today I thought I’d write a few thoughts about it.

So What is Spring

Spring is a component framework introduced by Rod Johnson back in 2002. The latest version has a plethora of features, but probably one of the best known, and best publicized for some time now, is the IOC (inversion of control) implementation, which may be more correctly be termed with certain concepts as dependency injection (DI). Another facet, considered positive by most I think, is that Spring emphasizes POJO-based development, which may keep architectures simpler compared to EJB-based frameworks. Moreover, the brief example below takes advantage of Spring’s Web MVC Framework as well, which can dramatically reduce effort on forms.

Read the rest of this entry »

Wednesday, November 28th, 2007

AOLserver/Joggame on iPod Touch

Song Of The Day: Clown Artist: Korn

Just a short note to let folks know that the distribution WILL work on the iPod Touch without a recompile. I released the source and package a while back, but thought people may find the iPod Touch capability nice as well.

I’ve been pretty busy with stuff lately, but do plan a broader update on overall progress in the future.

As always, you can check for updates on this blog or on the Joggame webpage for Joggame Server.



compliments of snap

BTW thanks to Erica for the snap utility at her site.

Of course, you will have to jailbreak your iPod Touch first, which may have various unknown side-effects, so proceed cautiously.

Tags: ,

Monday, November 12th, 2007

OS X Leopard Startup Script for MySQL

Song of The Day: Secret Crowds - Artist: AVA

Okay, so today I decided to fix the fact that my MySQL server doesn’t auto-load upon boot on OS X Leopard.

To be honest I’ve been doing the whole “mysqld_safe &”-thing for a while (i.e., pre-Leopard) and grew tired of that. So there is a simple way to do this right? Well, of course there is, but it’s surprising to find myriad articles on the Net explaining how to accomplish this in slightly different ways! You gotta love the Internet for access but not always for its uniformity :).

Most of the reason for the lack of uniformity on the subject concerns older versions of OS X and older versions of MySQL on OS X. However, as I learned all too well from my iPhone third-party application experience, the new–well somewhat new–direction for loading items during startup is with OS X’s system wide and per-user daemon and agent manager: launchd and launchctl. That service, launchd, replaces init.d and “rc” scripts of which most Unix-based users are familiar. Why? Well, you can read more about that here. The nutshell synopsis is that Apple merged the launch capabilities of init, inetd, and cron into “a single, standardized, interface to any and all programs started automatically by the system.”

As such, launchd is the preferred way for loading daemons from OS X Tiger (10.4) and beyond. There is a small learning curve, but not too bad after the first experience.

There are numerous articles that reference the older, but still widely used, mechanism of using OS X and MySQL /Library/StartupItems, good for pre-Tiger versions of OS X and for daemons not designed to run with launchd, but this entry focuses upon the newer launchd mechanism. Here’s another StartupItems how-to referenced from an older Apple document.

So here it is:

  • Check out “man launchd,” “man launchd.plist,” and “man launchctl.” Reading about its history isn’t bad either.
  • Add the following plist contents to a file, with your specific directories and option values, called org.mysql.launchd.mysql.plist:


    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>org.mysql.launchd.mysql</string>
    <key>ProgramArguments</key>
    <array>
    <string>/usr/local/mysql-max-5.0.24-osx10.4-i686/bin/mysqld_safe</string>
    </array>
    <key>KeepAlive</key>
    <true/>
    <key>SuccessfulExit</key>
    <true/>
    <key>RunAtLoad</key>
    <true/>
    <UserName>
    <string>_mysql</string>
    <GroupName>
    <string>_mysql</string>
    </dict>
    </plist>

  • Issue the following in launchctl or reboot:

    sudo launchctl
    launchd% load /System/Library/LaunchDaemons/org.mysql.launchd.mysql.plist
    launchd% exit

Interestingly, after writing a quick solution based upon my Joggame Server plist for the iPhone, I found this older blog entry on the net. It still appears mostly valid, but the author doesn’t mention the OnDemand key as a part of the service. The OnDemand option, deprecated by the KeepAlive option in Leopard, allows one to either allow a daemon to keep running continuously or to allow the launchd service to launch the daemon once needed.

Read the rest of this entry »

Monday, November 5th, 2007

OS X Leopard Test Drive - Part 3 - Time Machine

Song of The Day: 3 Strange Days - Artist: School of Fish



So the last couple of blog posts were about OS X Leopard’s installation and 64-bit support. This entry delves into Time Machine.

Although I had a few initial challenges setting up Time Machine to work, the new feature of Leopard truly, I think, brings backups to the Apple masses.

For my backup device I already had previously purchased a Western Digitial 320GB My Book with a FireWire connection for video. Since it had an extra 200GB available, I figured it would work (i.e., have enough capacity and be fast enough).



Time Machine required a reformat of my My Book

I expected to be able to connect it up to my Macs, then configure, and then copy way. However, that wasn’t the case. The Time Machine configuration required a reformat of my WD HD with the Mac OS Extended filesystem or HFS+. Since I already had about 100 GBs of data on the disc, which was using the default FAT32 filesystem, the reformatting process was a BIG pain. So much so, that I would recommend buying a new drive for backups if you can do that!

Although I consider the Mac’s filesystem to be far better than FAT32, I still would have preferred the FAT32 for my backups to spare me the problems of transferring those files.

However, after transferring the data off of the hard drive, I was able to configure Time Machine and start the backup process without a hitch. The backup process took about 5 to 6 hours for approximately 120GBs of data.



I started my iMac G5 in the morning before work and it completed by the time I came home. My laptop worked the same way, but I watched while it backed up the data one evening while comet gazing.

Afterwards, the typical MyBook orange icon turned into a Time Machine green icon.



New Time Machine icon for My Book drive

Furthermore, as a note, I could still place spurious files onto the drive with the remaining space available.

The only other issue I had during the entire process for both computers was an error dialog box when I clicked the Time Machine icon on my MacBook Pro.



One issue when configuring Time Machine

Upon investigation it looked to be related to the way I initially set up Time Machine on my laptop. I had previously configured Time Machine to use the My Book, but then disconnected the drive before the backup could start and complete due to the reformatting requirement. The reformatting never happened, and the backup, but Time Machine was still enabled. Somehow it got into a broken state.

After hitting System Preferences, disabling Time Machine, and then reconfiguring it again with the reformatted My Book, it worked correctly.




The UI, once everything is set up, is very slick. Apple lately just seems to get the user interface for applications right. :) Overall, a couple of challenges, but now both of my Macs are backed up, which were infrequently, and never entirely, backed up before.

Tags: , ,

Sunday, November 4th, 2007

Comet Holmes - Take 2

Song of The Day: Ziggy Stardust - Artist: David Bowie

Got a few more pictures of Comet Holmes last night, so here’s a composite of 3 images. Also, posted on Flickr. Better detail this time with longer exposures and clearer skies.




Photo information:

- Taken in Aldie, VA on 11/03/2007 between approximately 8-8:30PM
- Telescope: Meade 10” LX200GPS SCT
- Camera: Nikon D100 - Prime Focal
- ISO 800
- Composite of 3 images: 46s, 65s, (69s w/ Broadband Nebulae Filter)
- Photoshop Elements 4.0 (OS X)
- Weather: clear skies

Tags: , ,

Saturday, November 3rd, 2007

Comet Holmes - Take 1

Song of The Day: Ziggy Stardust - Artist: David Bowie

Last couple of nights I’ve been viewing clear skies and the Comet Holmes, which is easily viewed with binoculars and lower powered telescopes. Some may even be able to view it unaided.

I snapped a couple of pictures of the comet last night with semi-clear skies and uploaded one picture to Flickr, included in today’s blog entry.




Photo information:

- Taken in Aldie, VA on 11/02/2007 at 6:38PM
- Telescope: Meade 10” LX200GPS SCT
- Camera: Nikon D100 - Prime Focal
- ISO 1600 - 30s exposure
- Photoshop Elements 4.0 (OS X)
- Weather: semi-clear

If I get any other decent ones I’ll post them.

Tags: , ,

|