Wolfmans Howlings

A programmers Blog about Programming solutions and a few other issues

Using Cucumber to test Erlang Servers

Posted by Jim Morris on 2009-05-02 00:09:36 +0000

Background

I've been using cucumber to do all my integration testing. Usually testing over the wire to a live system, regardless of what the target system is written in (Ruby Rails, Merb, Java etc).

... Show more ...

Posted in Erlang,Cucumber  |  Tags erlang,cucumber,bdd  |  8 comments

Dealing with a TCP packet with a little endian header in Erlang gen_tcp

Posted by Jim Morris on 2009-04-13 01:11:57 +0000

In Erlang they have a very neat way of reading TCP packets that have a header that specifies how big the following packet is. So long as you send that header as a big-endian integer, you can use the built-in mechanism. Then gen_tcp, takes care of making sure the entire packet is read before passing it onto you.

Here is an example of a simple server getting packets from a client using some simple binary protocol... For instance sending this binary packet,

... Show more ...

Posted in Erlang  |  Tags erlang,gen_tcp  |  3 comments

Using Erlang with JInterface

Posted by Jim Morris on 2009-04-12 16:56:50 +0000

Background

I recently undertook a project to rewrite a voice conference server I wrote over 10 years ago. This server was written in C++ running on a Windows Server (originally NT and then win2k). The reason it was written for win2k was to use I/O Completion Ports which were not (and still are not) available on Linux.

Solaris has an equivalent AIO feature but not quite the same. I/O Completion Ports make very efficient use of multiple CPU's, and the conference server had to be very fast and handle a large number of concurrent connections.

... Show more ...

Posted in Erlang  |  Tags erlang,jinterface  |  5 comments

Using java enum for command dispatching

Posted by Jim Morris on 2009-04-12 01:26:06 +0000

I haven't blogged much about Java even though it is my primary programming language. Since I have been doing a lot of Java recently I thought I'd post something about some of the Java idioms I've used over the years.

One I have been using a lot recently is a command dispatcher where the command is text.

... Show more ...

Posted in Java  |  Tags java,enum,dispatcher  |  2 comments

Fixtures VS Factories, or how I do fixtures

Posted by Jim Morris on 2009-02-06 15:04:54 +0000

There is a raging debate in many forums about how to do fixture-like things. Basically how do you populate a database with test data so you can run your Specs/Tests/Features.

There are several libraries out there to do this like FactoryGirl, FixtureReplacement, Machinist, Fixjour etc etc. If you use Rails and ActiveRecord pick the one you like and be happy ;)

... Show more ...

Posted in Rails,Merb,Sequel  |  Tags merb,sequel,fixtures  |  1 comments

New merb based blog

Posted by Jim Morris on 2009-01-13 23:33:26 +0000

I just replaced the blog engine I was using (an older version of Typo) with a custom one I just wrote in Merb. It should look identical to the old typo based blog, as I used the same theme.

Hopefully I imported the data correctly so all old article url's that are scattered all over will still bring up the correct article and the RSS feeds should continue to work.

... Show more ...

Posted in Ruby,Merb  |  Tags merb,sequel  |  3 comments

Porting xgps to Qtopia for the Freerunner

Posted by Jim Morris on 2008-08-27 14:46:34 +0000

Background

I was getting bored waiting for Trolltech to release the next version of Qtopia for the Freerunner, so I ported the xgps client from gpsd's distribution to Qtopia.

As you may know by now, Qtopia does not have X11 so none of the existing X11 based or GTK based GPS clients work. I was exploring GPSD because I wanted to to be able to get a one time position for my sunset calculator which requires your current latitude and longitude. Although GPSD is not well suited for that (thats a whole other blog entry), I did notice you can connect to it over the ethernet, so I was playing with cgps and xgps that you find in the GPSD tar file, running on my desktop, talking to gpsd running on my Freerunner.

... Show more ...

Posted in Openmoko  |  Tags openmoko,freerunner,gps  |  32 comments

Ruby 1.8.6 on Openmoko Freerunner

Posted by Jim Morris on 2008-08-10 23:09:54 +0000

I finally got around to building ruby 1.8.6 for my FR. I modified the ruby bitbake files that I found in the Mokomakefile openembedded directory. I am not sure how one actually is meant to do this, as the OE site is down and the docs don't explain it. So I just replaced the 1.8.5 ones with the 1.8.6 ones. I also managed to fix a bug in the 1.8.5 BB recipe that was causing socket to not build.

I also got the ruby dbus library to work, although I don't know what to do with it yet :)

... Show more ...

Posted in Openmoko  |  Tags ruby,freerunner  |  3 comments

OpenMoko Freerunner after a few weeks

Posted by Jim Morris on 2008-07-22 13:20:08 +0000

Well I have had this thing for a few weeks now, and I have burned a lot of hours playing with it :) (Wish I could bill someone for those hours it would have paid for the phone 4 times over!)

I started with 2007.2 the built in image, and upgraded it initially with dfu-util, then with opkg update && opkg upgrade.

... Show more ...

Posted in Openmoko,Linux  |  Tags openmoko,freerunner  |  5 comments

Upgrading Ubuntu Gutsy to Hardy

Posted by Jim Morris on 2008-07-13 04:32:03 +0000

I did my duty and upgraded from Gutsy to Hardy, after letting Hardy settle for a while. For the most part it was painless (unlike the last upgrade to Gutsy!).

Unfortunately the sound was now broken I have a HDA-Intel AD198x Analog chip set.

... Show more ...

Posted in Linux  |  Tags ubuntu,hardy,cups  |  4 comments