Monday, February 28, 2005

Tapestry and Eclipse

So first Tapestry... It's an alternative Java web application framework that is now hosted on the Jakarta Apache website. I don't know if I'm reading anything into the fact that it's an Apache project right beside Struts. It just surprised me a bit.

It's certainly a lot different than Struts and maybe that's not a bad thing. I haven't seriously gotten into it yet but one of the things I like is that you don't replace HTML tags with some proprietary tags (unlike ASP, JSP, PHP, etc.). That means that you can use whatever HTML editor you want, including WYSIWYG editors. A lot of Java people I know dismiss WYSIWYG editors but I actually like them. Anything that allows me to design (in the graphical sense) without writing code can't be all bad. So far all I've done is the requisite "Hello World", but so far so good. BTW, the next version of Tapestry includes HiveMind, one of those Dependency Injection frameworks everyone loves.

As for Eclipse I borrowed a book from the library this weekend called Contributing to Eclipse: Principles, Patterns, and Plug-Ins. One of the interesting things is that the authors are Kent Beck and Erich Gamma. Yes that Kent Beck and Erich Gamma! Big names in the geeky programmer realm. The book starts off with some background of Eclipse. When you use the Java IDE project within Eclipse it's so easy to forget that it was intended as a programming language neutral environment and that everything in Eclipse is a plug-in. Everything! Very cool. I already have some ideas for plug-ins but we'll see how the rest of the book goes.

Wednesday, February 23, 2005

Owly About RSS

If you're not using a NewsFeed Reader to read this blog then you should get yourself over to SourceForge.net and download yourself a copy of RSSOwl. It's Java based, but before you go off bitching and moaning about a crappy Java user interface you should know that it uses the Eclipse.org's Standard Widget Toolkit (SWT) which means a native UI that is responsive and good looking too.

Tuesday, February 22, 2005

iPod bling bling

I found an iPod shuffle at Best Buy last Friday. I guess their online inventory numbers are pretty accurate afterall. So I immediately cancelled my online order with the Apple store and set about trying to make it work with my Windows XP computer at work (during lunch naturally). Well I couldn't for the life of me make it work. And it wasn't just the iPod either because a friend of mine's USB flash drive didn't work either. I don't know if it was some conflict with another Windows service or if the machine was explicitly configured not to work with these devices but all I got was flashing amber lights.

After a disappointing first crack at it, I was delighted to see it work flawlessly with my PowerMac at home. Within a minute I was copying songs from iTunes to my iPod. Then I became Mr. Antisocial for the evening as I tried out my new toy. I've never messed around with any other MP3 player in the past. Perhaps if I'd used an iPod with the clickwheel and screen I'd be dissatisified with the simple interface of the shuffle, but I think Apple has a good design here. It's idiot proof. Turn it on, press play, mess with volume, skip songs and that's it. If you want to listen to music then it doesn't get much easier than this. I rather like the shuffle mode too. I have an eclectic music collection so going from Eminem to Guns 'N' Roses to the Beatles is actually pretty cool with me.

Now the only problem I have with this thing (other than connecting it to Windows XP) is how to carry it around. I tried the lanyard and although wearing it like this was no big deal (the shuffle is itty bitty and weighs next to nothing), I didn't like all the cords once I attached the headphones. It just felt messy. So then if I don't wear it around my neck where do I put it? Well I'm trying various pockets but I'm a bit afraid of snapping it in two. They need to come up some kind of clip or a combined lanyard/headphone. I dunno.. but something needs to be done.

Finally, the one-two punch of the iPod shuffle and iTunes shows just why Apple products fit people so well. I've used Macs for a number of years and I've heard Apple say that their ability to control hardware and software ("the entire widget") is one of their biggest competitive advantages. But I never really understood that statement until I bought the iPod shuffle. Apple's competitors in this space are hardware manufacturers that can only control half of the equation while Microsoft controls the other. So while MS and Bill Gates try to beat the drum of choice (choice of different hardware manufacturers using their proprietary software, Windows Media Player) I think consumers will continue to choose the vendor who gives them the best experience. Now that I've experienced a bit of this iPod phenonenon I'll hazard a guess and say that it will continue to be Apple.

Thursday, February 17, 2005

Give it up for Gates

I read an ABC interview between Peter Jennings and Bill Gates last night and just loved some of the questions and answers. Bill Gates has lost none of his competitiveness and seems to want to rewrite history in his favor... I mean c'mon Bill. You didn't create the PC industry. Let's get real here. Microsoft had an important role to play, but you were just one part of it and in the beginning you were one of many. A lot of luck made you who you are today. I'm sure the boys over at Slashdot are ripping you to shreds right now. Anyway here are some of my favorite quotes:

Gates: We're responsible for the creation of the PC industry.

Jennings: But, it isn't hard for you is it to stand back and compliment somebody else?

Jennings: I've heard some people say that if they were graduating from science or technology today, they'd rather work for [Steve] Jobs than Microsoft. Why do you think that might be true?

Jennings:
When I said to somebody the other day that you at Microsoft had always said we will continue to be the innovators of technology this person who was young and a techie said "Oh they've never innovators they buy other people's material, they expropriate other people's knowledge and adapt it into their business." I don't understand that completely, but is there some truth in that?

Gates: Well the biggest thing we did was we invented the field.

Monday, February 14, 2005

Video Editing

All my video projects are strictly amateur, home video, garden variety, family stuff so my needs aren't great. I used the software that shipped with my Mac (iMovie) for quite a while. It's pretty good and worked remarkably well even on my old G3 iMac. But I started to run into the limits of the tool and decided I needed more control and flexibility. A couple of years ago I upgraded to Final Cut Express (FCE). Now I have to tell you that for the inexperienced video editor FCE is like stepping into a race car when you're used to driving a mini van. "What do you mean I have to shift gears!?"

As a result my ramp-up has been slow and arduous. If I spent every day for weeks at a time doing it, maybe things would have been different but when you're doing it in your spare time, things tend to take a bit longer. I bought a book and went through the tutorials, etc., but just found myself crawling instead of running. The terminology was very foreign (e.g., ripple, roll, slip, slide, keyframes, bin, canvas, viewer...) When it came time to doing a school project with my daughter last year I resorted to iMovie except for the voice over part where FCE came in. In fact, I have to admit that my video output was probably approaching zero. Sure I started lots of projects but I haven't finished very many.

So along came our trip to Maui and some new raw footage. Full of new energy I decided to tackle the project. Now I don't know when the lightbulb went on, but wow FCE rocks. Here's what I like:

  • I can organize all my clips with bins (a.k.a., folders)

  • Clips stay where I put them in the sequence (manual transmission instead of an automatic)

  • Color correction! It's amazing what you can bring out of a dark shot.

  • Mutliple sequences in one project.

  • Non destructive editing. (I think iMovie supports this now too). Great when you change your mind.

  • Better titling options

  • Many available video and audio tracks (99 of each).

  • Superimposing titles and other clips is a snap with multiple tracks.

  • Real-time effects. I still have to render the odd thing or two, but this is great.

  • Short cut keys everywhere. I hardly touch the mouse.

  • Multiple windows. iMovie has one simple window. With FCE I can reorganize things for the task at hand.

  • Much better audio management.



I don't know if my repertoire as a video editor has expanded yet with all this new found flexibility but I think I'm finally into an efficient editing mode again. I'm betting this video will be out the door before the end of the week. Then I can start looking into all the motion, animation, and compositing capabilities of the tool. And if things go well maybe I'll look into the new Final Cut Express DV.

Thursday, February 10, 2005

Happy Trails To You

Trails is a project hosted on java.net that leverages Spring, Tapestry and Hibernate to generate a functional web application using just the domain objects. Some of the docs say it does no code generation... Don't know how that works or how useful this project would be in the real world but it looks cool. You should check out the demo video. He creates a simple little app in Eclipse with some help from XDoclet and Ant to create the database in MySQL (an XDoclet task creates the hibernate mappings and then a Hibernate task creates the database tables. Done that before and it works reasonably well). You need Quicktime installed to view the video.

I've taken a brief look at Spring in the past. It seems to be the dominant implemenatation of the Inversion of Control pattern. I've only heard of Tapestry. It's a Struts competitor of some sort. Everyone who uses it seems to rave about it. And Hibernate, well it just rocks! ;-)

Monday, February 07, 2005

iPod Shuffle RAID

This guy took 4 of these things, striped them and made a 3.9GB RAID Array out of them! Neat bit of hackery.

I ordered an iPod shuffle about a week ago but unfortunately Canada is a third world country to Apple and I won't see it for at least a month yet. Ugh... Still it's nice to see somebody doing something creative with them.

Update: I found an interesting article on Ars Technica that compares the performance of various flash drives on both Mac OS X and Windows. They even did the RAID trick on Mac OS X. This was in June last year. So while the above article might be the first to do it with iPod shuffles, it's been done before... In summary: reading is way faster than writing, big files are better than small files and not all drives are created equal. Be interesting to see where the iPod shuffle fits in.

Sunday, February 06, 2005

My review of C#

I finally finished learning a thing or two about C#. My original intent was expanding my knowledge of the .NET world. I used Mono and was able to make my way through an entire book about C#. The book didn't delve too far into the frameworks and concentrated mostly on the language. Following are the notes I took while working my way through the book. They're written from a Java developer's perspective (with the odd smattering of Delphi and ObjC thrown in for good measure). Next I'll probably look into things like nant, nhibernaate, and nunit, the C# equivalents of tools I commonly use in the Java world...

Overall I was pretty happy with C# as a language. It's very much like Java and the comments below only reflect the things that are different. Generally, I would say C# is a legal J++ (Microsoft's slightly mutated Java that was taken off the market after Sun sued and won). I originally thought J++ was pretty good and I think the same about C#.

Namespaces and File structure
  • Many namespaces in one file.

  • No tie between public class names and name of file or name of namespaces (packages in Java) and the directories they live in. Simpler.

  • But by convention one class or a few highly related classes are grouped in individual files, so in practice it may not be much different

Ref and Out parameters
  • ref and out parameters must be marked in the method declaration and on the calling side. Good for readability.

  • vars to be used as a ref param must be assigned before calling method.

Misc
  • Main is the name of the entry point method (one per file). Note the capital M. C# uses PascalCase vs camelCase for most names. This is a bit unusual for Java developers but makes sense once you realize Anders Hejlsberg, the primary designer of C# and .NET, was the chief architect of Delphi at Borland which used Object Pascal.

  • string is an intrisic type in C# (see more about structs later)

  • Parameter substitution in Console.WriteLine() is useful. There is also an ability to format the parameters (e.g., Console.WriteLine( "Sum of 1,2,3 is {0:N0}.", Sum(1,2,3));) Presumably there'd be a way to generate stings using this formatting functionality. I haven't run into it yet.

  • "public sealed class Plane:Flyer" sealed stops any subclasses like final in Java

  • Use colon (:) for subclassing instead of extends

  • Use colon (:) for implementing an interface instead of implements

  • Visibility identifiers are nearly the same, public, protected, private, internal. Internal is like package scope in Java. Default is private in C# as opposed to protected in Java when it isn't explicitly defined.

  • Exception handling is the same as Java except there are no checked exceptions in C#

  • Use "is" instead of "instanceof"

  • Interfaces are available in C#, like the IComparable with the int CompareTo( object o) method. Naming convention starts interfaces with I.

Inheritance

  • In Java, every method is virtual and every method call is dispatched with a dynamic lookup. In C# you must explicitly label a method as being virtual. This has the potential to create some unexpected behavior:

    1. Create a subclass and override a method using syntax like "new public void MethodName()"

    2. Create a variable declared to be the supertype.

    3. Assign this variable an instance of the subclass.

    4. Now call the overridden method.

    5. The method that gets called will actually be that of the super class and NOT the subclass.

    6. If you were to typecast it to the subclass then the subclass's method gets called. Funky.

    7. This doesn't happen if the super's method is declared virtual and the subclass is declared with override

  • You must explicitly label an overriden method with the keywords override or new. Compiler will fail otherwise.

  • Multiple constructors are supported but in order to call other constructors in the same class you have to use a strange declaration. (e.g., public Employee(): this(null, 0){...}) So why is't "this(null,0)" between the braces?

  • To call a super class's constructor use something like "public Manager():base("Joe", 100){...}".

Properties
  • In Java an instance variable with get and set methods is oftern referred to as a property. This idiom is often used by IDE's.

  • C# defines a special syntax for properties that reduces some of the code that needs to be written. Basically it comes down to declaring a private instance variable usually named with camelCase (one of the few exceptions). Then you define a property with get and set blocks:


private string name;
public string Name{
get{ return name; }
set{ name = value; }
}

  • Now the property can be referenced just like an instance variable but behind the scenes the get and set blocks of the property is being called. I think this is a much more natural syntax than calling a method. e.g.,

person.Name = "Joe";

  • Delphi had all these features too (with a different and IMHO simpler syntax). I was also suprised that I didn't see any way to simply declare indexed properties. Delphi had that one too.

Compiler
  • Mono mimics the Microsoft C# command line compiler very well:

  • multiple files compiled at once to create the exe "mcs /out:Test.exe Ape.cs Human.cs"

  • to compile just this class and create a *.netmodule file: "mcs /target:module Ape.cs"

  • to compile the exe with the *.netmodule use: "mcs /out:Test.exe Human.cs /addmodule:Ape.netmodule"

Structs
  • Supposedly a struct differs from a class by the way the memory is allocated.

  • Structs are created more like intrinsic variables within the class

  • But they look just like classes! They can implement interfaces, their members have visibility specifiers, and they can even have methods and constructors!

  • boxing and unboxing happen automatically between intrinsics and their structure brethren. e,g, int and Int32 (a struct)

  • The is operator also works on structs

Delegates
  • They're similar to function pointers and similar to Objective-C's selector concept (although objc's selector is more dynamic in that it's a message that isn't tied to any particular object instance).

  • To use delegates:

    1. declare the delegate that describes a method signature

    2. instantiate a delegate that points to the method of an object instance that has a matching method (note that the method name doesn't matter just the return type and parameter types) e.g., MessageDelegate target = new MessageDelegate( myObject.PrintSomethingOut );

    3. now invoke the method e.g., target("Hello, World!");

  • This all avoids the mess in Swing where you must create a Listener Interface, often a Listener Adapter and then implement the interface or subclass the adater with an anonymous class. For example when wiring up gui object events to methods:


button.addActionListener( new ActionListener(){
public void actionPerformed( ActionEvent e ){
//do Something like delegating to another method
}
});

  • Five lines of code vs one plus all the overhead of a new class just to delegate a method call!! Now the Java version is closer to the typical Observer pattern and is pretty well understood and is still valid but I must admit that I like the brevity and readability of the delegate implementation.

Collections
  • Collection types are LinkedList, ArrayList, Queue, Stack, Dictionary which are similar to Java's List, Map, and Set interfaces and the various implementations.

  • I like names like Queue, Stack, and Dictionary

  • Index access to the collection

Console.WriteLine(((Address)emp.Addresses[1]).City);

  • this is actually calling the get method of the class with an index value, the index doesn't have to be an int. e.g.,


class MyArray{
public String this[index]{
get{ return array[index];}
set{array[index] = value;}
}
}

  • C# uses the term IEnumerator. Enumerator was deprecated in Java in favor of the Iterator interface. but basically the same thing

  • If the class implements IEnumerable then the foreach loop can be used instead which does the typecasting automatically on each loop iteration.

Friday, February 04, 2005

Squeaky Smalltalk

I'm nearly through the C# book I borrowed from the library (I'll blog about it soon) and this morning I was relating some of my thoughts to a co-worker about the language. But somehow we got onto the topic of Smalltalk.

She was explaining to me how weird the syntax was. We found a website that outlined the differences between Java and Smalltalk. And although things looked a little odd I recognized syntax similarities to Objective-C which didn't come as too much of a surprise and I recognized closure similarities to Ruby.

So during some free time at lunch I downloaded and tried out a free version of Smalltalk called Squeak. That environment threw me for a bit of a loop but through the help of the BankAccount tutorial I was able to write a little rinky dink class, instantiate it, interact with it and inspect it. Pretty cool.

My curiosity is piqued so I'll probably give Smalltalk a bit of a spin. Not that I expect to develop anything significant with it but since it was so instrumental in the design of other languages I figure it might be interesting...

Wednesday, February 02, 2005

All In The Family

What do Java, C#, Objective-C and Smalltalk all have in common? They're all in the same family!

Tuesday, February 01, 2005

LuntBuild

Having experienced (over a year ago now) the setup of Cruise Control (to do continuous integration of Java projects) and being thoroughly underwhelmed by the quality of that software I was quite happy to discover LuntBuild today. Bonnie, another developer at our site, set it up on one of our servers so that probably contributes to my positive experience, but setting up a scheduled build complete with the CVS extract, the call to my existing Ant script, an automatic labelling of successful builds and an e-mail to notify me of build success was a point and click affair and was done in about 20 minutes. Nice!

Monday, January 31, 2005

Steve Jobs demos NeXTSTEP 3.0

...in the early 90's. Check out this video full of goodies:

  • Steve Jobs is dressed in a shirt and tie instead of his regular blue jeans and black turtleneck, but he still has his characteristic hand gestures and catch phrases (e.g., "boom, there we are", "gorgeous", "beautiful", "powerful".)

  • He's pitching to enterprise customers instead of consumers.

  • Lotus Improv, WordPerfect, and OpenDoc make cameos

  • Connects to a Sun workstation, A Mac and a Windows box

  • Steve builds a couple apps, even connecting to a Sybase database showing off NeXT's database kit, one of the first (if not the first) object relational mapping tools.

  • Uses Display Postscript instead of Mac OS X's PDF rendering technology

  • Mail looks a lot like today's mail.app

  • Next's dock is remarkably similar to Mac OS X's dock

  • This is all on a 68040! Steve mentions a port to intel 486. Amazing.

  • Drag and Drop is everywhere. This is one of the things I love about the Mac.

  • He shows frame for page layout and the demo is strikingly similar to Phil Schiller's demo of Apple's new word processing application Pages.


It's simply amazing to me how advanced NeXT was compared to what I was using back then. It really shows Mac OS X's heritage. Heck there are things in that demo that I don't think are even in OS X. Jeez I was doing DOS based Clipper applications and PowerBuilder 1.0 in Windows 3.0 in 1991 and NeXT was completely object oriented. Wow.

Wednesday, January 26, 2005

Ooey Gooey Goodness

I just came across a web site called "GUIdebook: Graphical User Unterface gallery". If you're fascinated by the history and art of the GUI from the Apple Lisa to the latest Mac OS X or Windows XP then you'll find some interesting stuff here. Highly recommended.

Monday, January 24, 2005

Back from Maui

It was only one week but we really enjoyed ourselves. We stayed at the Kaanapali Beach Hotel. It's a bit of an older hotel but the staff are fantastic. If you go with kids, be sure to sign up for the Kid's Aloha passport and do some hotel activities. The people leading the lei making, Hula dancing, etc. are great and give you the flavor of what Hawaii is all about.

Now I have some random thoughts about the trip:

  • We rented a minivan (Chevy Venture) and surprisingly I actually enjoyed it. I understand why people drive these things now. I could put kids in different rows and keep them apart when they were arguing. Visibility is quite good. Folding seats give lots of room when you need it. But there were a couple of cons too. It's pretty big, hard to park and sucks gas. The controls are in odd places and where's the tachometer? I won't be running out to buy a minivan anytime soon but I may rent one again.

  • Haleakala was impressive to see again. I forgot how twisty that drive was and it was colder at the top than I remember.

  • Went to a Mac store while I was there and planned to buy an iPod but they were completely out of them. Good for Apple, bad for me...

  • Went whale watching. The kids loved the free snacks. Oh yeah the whales were cool too. :-)

  • The kukui nut lei departure ceremony by the hotel staff was cool. They sang and we each got a lei that won't immediately wilt when we get back home.

  • Damn Calgary looks bad when the snow melts. No leaves, a bunch of gravel and a slushy mess. I'd prefer to see some snow covering all the brown.

  • Sun is good. Sunscreen is your friend.

  • Boy did I eat a lot and although I thought I was starting to gain too much weight, all I had to do was look at all the other fat tourists and I felt pretty good about myself. Maybe it has to do with the Maui resort location but I remember girls in tiny bikinis on Waikiki. These people weren't anything like that! Maybe America (me included) really are just getting fatter. ;-)

  • I have a new favorite shirt from Crazy Shirts. It's a long sleeve crew neck t-shirt (not on the website) dyed with the same Blue Curacao that tints those fun island cocktails.

  • I think I got some great video of the kids and the island. Looking forward to editing this one.

Tuesday, January 11, 2005

Apple: ALL the rumors were true

Well that's surprising! Apple rolled out everything! There's a new version of Quicktime, version 7, that will ship with Tiger. It supports much larger frame sizes at the same bitrate with the H.263 codec. There's a new version of Final Cut Express that works with HD footage and now includes Soundtrack and LiveType. iLife has new upgrades for iPhoto, iDVD, Garageband and iMovie. iMovie, like it's bigger brother Final Cut Express, also supports HD footage. Then there's the new iWork, which includes a new word processor called Pages (compatible with MS Word BTW) and an update to the presentation application Keynote (compatible with PowerPoint).

Then on the hardware front they pulled out a new low-cost Mac ($499USD) called the Mac Mini and a new Flash based iPod called the iPod Shuffle.

Now if you take into account that they lowered the price of their Cinema Displays, upgraded the Xserve and introduced Xsan last week, I have say they're definitely firing on all cylinders. It makes your head spin. Wow!

Sunday, January 09, 2005

Mono: C# Everywhere...

It's a bit difficult to understand what motivates someone to clone Microsoft technology. Bill Gates' open letter to hobbyists at the Homebrew Computer Club in 1976 clearly demonstrates the mindset of Microsoft. They are a proprietary software company and believe in making a buck off of everything they do. While there's nothing wrong with that, people should not believe that Microsoft's submission of C# to the ECMA as a standard means that they truly want anyone to create new implementations of C#. Microsoft will do what they always do. They'll move the goalposts. They'll break compatibility with every release. You can never expect to gain parity with Microsoft and you'll never be able to run .NET applications on anything but Windows.

So if you accept that fact then what are you left with? Well C#, like it's main inspiration Java, is still a very nice language. The threading model, exception-handling, and memory management all help make this a very usable object-oriented language. So if you take your sights off the idea of trying to run Windows apps on Linux and insted focus on bringing a very good set of development tools to Linux then you can understand what the Mono project is about. Novell is interested in bringing the advantages of a Java-like language to Linux software development without having to deal with Sun or Microsoft.

Now you might ask, why would a Mac-toting Java developer like me be interested in learning anything about a Microsoft technology. Well, like I've said before, I'm trying to be a pragmatist about learning computer languages. I realize that for the kind of enterprise development that I do, there are two camps: J2EE and .NET. At the very least I hope that learning something about C# may improve my overall development skills. Heck if I can look at Objective-C and Ruby and learn an appreciation for dynamic languages then why not try and pick something up from C#. And who knows, as a contractor maybe some really interesting C# work may come my way sometime and it'd be a shame to turn it down because I didn't even look over at the "other guys".

So I got a C# book from the library and I installed Mono on Mac OS X. Time to get cracking...

Thursday, January 06, 2005

Firery little Mac apps

I use a Windows PC most days at work and use a Mac at home and I have really come to appreciate some of the Mac software that I use day in and day out. So here's a list of some of my favourite downloadable apps (in no particular order):

Fire

A multi-protocol chat client. I have Yahoo, MSN, and ICQ accounts and people that I work with use all three. It's nice to have just one chat application running at once. I like Apple's iChat (even though I haven't even tried its video features) but it only talks to other iChat clients and AOL clients, neither of which I use.

NewsFire

A kick ass RSS reader. It's real pretty and cool to use. Way better than any Windows client I've come across.

VLC

A great open source media player. I haven't tried it on any other platform, but for my purposes it's pretty damn good. MPlayerOSXis good too and supports some audio codecs that VLC doesn't, but doesn't quite have the fit and finish of VLC.

Firefox

Unless you've been under a rock, I'm sure you've heard of this snappy little cross platform browser. My default browser is still Apple's Safari because it's faster and a better Mac application, but Firefox is a solid contender and is nice for validating my HTML work. Internet Explorer on Mac was pretty abysmal before Safari rained on Microsoft's parade so let's just bury it and forget it was even inflicted on the Mac community.

Fink

A fantastic way of getting thousands of ported open source software on your Mac. Think Subversion, MySQL, PostgreSQL, Ruby, KDE etc. If you want a graphical front end use Fink Commander.

Eclipse

If you do any Java development at all, definitely go download Eclipse. It rocks! Refactoring support is fantastic and its CVS integration is second to none. Also don't be afraid to pick up some plugins along the way.


And don't forget those sweet little bundled Mac OS X apps and features like Mail, Exposé, X11, and the iLife suite which containes apps like iTunes, iPhoto, iMovie, GarageBand and iDVD.

Wednesday, January 05, 2005

World Junior Hockey Champs

In the wake of Canada's Olympic and World Cup triumphs, the Canadian junior team won gold over the Russians! They were billed as the best Canadian junior team ever and last night proved that they deserve such accolades. Canadian hockey has never looked better and today I'm one proud Canuck. Congratulations to the team.

Monday, January 03, 2005

Unicode Localizations

Most Struts/JSTL developers know that in order to localize a web application for different regions and languages you must first extract the locale-sensitive messages (e.g., field labels, warning messages, etc) from your JSP and Java code and place them in an application resource .properties file. Then you create various versions of this file where the name's suffix reflects the locale and language (e.g., _fr_ca for French Canada) and the values in the file contain locale-specific messages. At runtime the application framework will use the messages from the appropriate resource file to serve messages based on the user's locale.

I had always assumed that a UTF-8 encoded properties file would allow me to use accented characters for words like français. But today I discovered that while I can encode my files in UTF-8, the Struts framework uses the java.util.Properties class which quite inconveniently doesn't understand unicode characters. From the Javadocs:

When saving properties to a stream or loading them from a stream, the ISO 8859-1 character encoding is used.

So you must use a goofy little utility that ships with the JDK called native2ascii which will convert a UTF-8 encoded properties file into an ASCII file which contains unicode escape codes to represent those characters. You then use this generated file in your Struts application. Fortunately Ant comes with an optional task to run this utility.

To me this all seems rather silly especially when you consider Java has built in support for unicode. Begs the question: Why is the Properties class built like this?

The Amazing Paper Trail

Letter is 216 × 279 mm
A4 is 210 × 297 mm

A4 is an ISO Standard Paper Size that is designed with the height-to-width ratio of the square root of two, a rather nice mathematical expression with some obvious advantages. You can read all about it here . It's also quite interesting to know that we Canadians simply adopted the rather obscure American paper sizes by rounding them to the nearest half centimeter (pretty lame) and that North Americans, in general, are the only ones not using the ISO paper sizes.

BTW: ISO A6 is toilet paper size in Europe. Imagine a world without standards.