Moved to self-hosted WordPress

September 23, 2008

For anyone who has subscribed to this blog or follows it regularly, please come on over to my new self-hosted blog, where I’ll continure the thread and maybe add some more.  I haven’t found a way to redirect my RSS readers automatically to the new site.

Here it is:

Objective-J – huh?

September 5, 2008

As an old Objective-C fan, I was surprised and amused to read about Objective-J, an object-oriented enhancement to javascript including the old OpenStep (well, GNUstep) API’s.  It’s for a similar purpose as GWT, I suppose.

Cappuccino is built on top of standard web technologies like JavaScript, and it implements most of the familiar APIs from GNUstep and Apple’s Cocoa frameworks.

Not sure what to think of this, but hey, Objective-C was cool so why not Objective-J?

Google Chrome makes GWT apps Zoom!

September 5, 2008

When I first heard about Google Chrome my reaction was “Huh?  Another browser to support?”  However, now that the browser has been released I’ve realized why they bothered.  It’s simply the fastest and best looking browser for Windows right now.  I love the look of it, but even more so I love the speed of it!

I am the developer and user of online accounting software for small businesses written using the Google Web Toolkit (GWT).  When I tried our software in Chrome out of curiousity I was astounded to see how fast it was – first, it loads regular web pages as fast or faster than Opera, my old favorite browser.  Second, it loads and runs my accounting application much faster than I’ve ever seen before!

I was quite intrigued by this so I went and actually read the comic Google released about Chrome to find out more.  Apparently they contracted a company to write a new javascript JIT engine to run javascript, which they’ve apparently done a great job of!  And, it’s open source.

Hopefully Safari, Firefox, Opera, and (if we’re really lucky) Internet Explorer will take advantage of their Javascript engine so we can all enjoy faster Web 2.0 DHTML applications.

SSH config file to the rescue

August 31, 2008

I’ve recently switched my hosting from single self-managed dedicated server at 1and1 to a managed virtual private data center on “the cloud” with ENKI consulting.  The benefits of the grid computing technology they are using are numerous, including improved security, automatic redundant failover, and great mangement and monitoring tools.

As part the improved security, each component of the system (webserver, database) runs in its own virtual machine, and only has the bare minimum access to files and other services that it needs.  When setting these up, I have to ssh to each component individually.  Access is provided to the seperate components by having a different ssh port on one externally available IP address.

Typing in “ssh -p 7543 dobes@543.32.54.32″ with varying port numbers, usernames, and IP addresses can be a pain.  Today I found out that you can specify aliases in your ssh configuration that set up connection options, hostnames, and IP addresses.

Simply edit ~/.ssh/config and put sections like:

Host glassfish-live

HostName 543.32.54.32

Port 7543

User dobes

Compression on

IndentityFile  ~/.ssh/id_rsa_live

Each time ssh finds “Host” it treats the settings that follow as specific to that host, and “HostName” tells it the “real” host to connect to.  These aliases are a great shortcut and I was so pleased to discover them I couldn’t wait to share them.

Hope you make good use of this one …

GWT to lighttpd/apache to glassfish 502 proxy or 500 internal errors fix

August 22, 2008

I’ve been dealing with this for a while now trying to figure out why, when using my online accounting software, users sporadically get a StatusCodeException when sending requests to the server.  I finally this week figured out what was going on; glassfish was dropping the connection or sending bad responses occasionally because it doesn’t behave in the was that the mod_proxy modules of these webservers expect it to.

Originally I was running lighttpd and I was thinking this might be a bug in lighttpd, so I eventually switched to apache.  Once I was running apache I got a much more verbose error – instead of just a plan 500 or 502 status code I got a message.  I googled that error message plus glassfish and found the solution.

I thought I’d share it here so that future searchers who are using lighttpd or apache will have more places to find the answer.

To fix the issue, add:

SetEnv force-proxy-request-1.0 1

SetEnv proxy-nokeepalive 1

To your apache httpd.conf.  I don’t know what the equivalent fix for lighttpd is, if there is any.

From this fix, it appears that glassfish is misbehaving in some way in relation to being behind a proxy, but I don’t what way that is and I’m just glad I fixed this mysterious problem!

If any of you readers have more information about this issue, please comment!

GWT: Using source-path to create your own JRE emulation classes

August 15, 2008

I recently ran into an issue where a class I share between GWT and server-side java code would really, really benefit from being able to accept or return a Calendar object.  However, GWT doesn’t come with a Calendar class, so the appeared to be impossible.  Or, is it?

After some digging around in the documentation I discovered that GWT provides a directive in their module XML called “super-path”.  By adding something like:

<super-path path=”gwtonly”/>

To my *.gwt.xml file, I can tell GWT to load my own emulation classes when compiling javascript; when running in hosted mode, it will use the Java implementation of these classes.

Here’s an example source tree structure for this:

  • myapp/
  • myapp/MyApp.gwt.xml
  • myapp/client/*.java
  • myapp/gwtonly/java/lang/
  • myapp/gwtonly/java/lang/

In my Calendar and GregorianCalendar I just define exactly the methods and constants that I need for the code to *compile*.  Note that I’m not planning to actually use these classes;  I could, but the implementation is so minimal it would cause confusion for future programmers who wouldn’t understand why the calendar class behaved so weirdly in client-side code.

However, now I discovered that I have errors in my code when I compile.  Huh?  In eclipse it’s happy but in GWT it says something like “package declaration should be java.lang, but it should be”.  Oh, I see, it’s really using that package as a source folder, not as a package.  So, I fix it by changing the “package” declaration at the top to “java.lang”.  Guess who is unhappy now?  eclipse!  The two compilers can’t see eye-to-eye any more.

There is a solution – eclipse has a feature called “exclusion filters”.  I open the “Java Build Path” panel for the project, find the source folder that has all of this in it, and add an “exclude” filter for myapp/gwtonly/.  Now eclipse just ignores those files; I’ve lost a lot of eclipse java features as a result, but at least it works.

All this is part of my work on simple online accounting software, if you’re a consultant, entrepreneur, virtual assistant, bookkeeper, or freelancer go check it out.

Getting an SSL private key into glassfish

July 2, 2008

After much frustration I finally figured out how to get my existing private key and certificate into glassfish’ keystore so that it worked.  You see, I did something that the makers of java keytool never thought of – I didn’t use keytool to generate my private key!  Unfortunately, keytool doesn’t allow you to import an existing private key, you can only import the certificates (e.g. the public keys).  It took me a few hours to figure out this bit of idiocy, and kudos to this blog post for enlightening me:

Import private key and certificate into Java Key Store (JKS)

I followed his steps to convert the keys into DER format and generate a keystore file from that.  Then I used keytool’s -importkeystore command to merge that new keystore into glassfish’ keystore, and used keytool to change the key’s password to match the keystore’s password.  Fixed!


Get every new post delivered to your Inbox.