Wolfmans Howlings

A programmers Blog about Programming solutions and a few other issues

Groovy bean dialogs

Posted by Jim Morris on Tue Feb 21 16:36:46 -0800 2012

I really wanted to share this one as it is so cool.

I have been writing some database GUI admin tools using Groovy and I use SwingBuilder to build the UI as it tends to be easier than using Swing directly.

... Show more ...

Posted in Java,Groovy,SwingBuilder  |  Tags groovy,swingbuilder  |  no comments

How to implement Polymorphic protocol buffers in Java

Posted by Jim Morris on Wed Nov 23 00:08:34 -0800 2011

I decided to use Googles Protocol Buffers for a new server. I have been writing custom binary protocols for over 15 years for my various servers, as well as using XML and JSON on occasions.

I prefer binary protocols as they tend to be lean and mean when it comes to bandwidth.

... Show more ...

Posted in Java  |  Tags netty,protocolbuffers  |  1 comments

How to setup SyntaxHighlighter in Rails 3.1.1

Posted by Jim Morris on Sat Nov 12 01:36:29 -0800 2011

Or how to get Rails 3.1.1 assets in vendor/assets to work in production.

... Show more ...

Posted in Rails  |  Tags rails,syntaxhighlighter,assets  |  2 comments

Turn off forgery protection when using caching

Posted by Jim Morris on Sat Dec 18 01:04:06 -0800 2010

This one does not seem to be documented, and I just got bit.

After porting my blog engine to Rails 3, I noticed that after a while comments were being rejected with an ActionController::InvalidAuthenticityToken error.

... Show more ...

Posted in Rails  |  Tags rails,authenticity  |  3 comments

Upgrading a Rails 2.2.2 app to Rails 3

Posted by Jim Morris on Fri Dec 17 15:27:17 -0800 2010

After porting my blog engine from Merb to Rails3 code here I thought I'd upgrade my Snow Dogs R Us Site (aka dogz.us) to Rails 3.

It was written in Rails 2.2.2 so I figured it would not be too hard, well it was easier to port my Merb App than it was my Rails app!

... Show more ...

Posted in Rails  |  Tags upgrade,rails3  |  3 comments

Upgrading a Ubuntu Dapper 6.06 server to Lucid 10.06 with software RAID 1

Posted by Jim Morris on Mon Nov 29 23:06:57 -0800 2010

I needed to upgrade a remote server that was running Dapper to Lucid, as Dapper is no longer supported (or will soon be EOL'd). This server uses a software RAID 1, and that seems to be the problem.

I tried to do this over the network via ssh in a screen, however after it upgraded to Hardy it failed to boot.

... Show more ...

Posted in Linux  |  Tags ubuntu,dapper,lucid,upgrade,raid  |  no comments

A Simple Challenge Response authentication scheme for Rails3

Posted by Jim Morris on Mon Nov 29 23:06:41 -0800 2010

UPDATE the following is for pre rails 3.1, there is an addendum at the end for rails 3.1+

I have ported my blog engine (that hosts this site), from Merb to Rails 3. You would expect it to be fairly simple as Rails 3 is meant to be the next version of Merb.

... Show more ...

Posted in Rails  |  Tags authentication,javascript  |  no comments

Running Erlang OTP applications as Daemons on Ubuntu Servers

Posted by Jim Morris on Sun Sep 19 17:26:42 -0700 2010

Recently I needed to deploy an Erlang OTP application to a production server, and was surprised at the lack of official documentation on how to do that. My requirements are to have the application run on system startup, and if the application crashes to have it automatically be restarted, some optional requirements are to have rotated logs and to get email notifications if the application does crash.

Erlang itself has several layers of supervision to keep its processes running, however on occasion the VM itself may crash, if it runs out of memory for instance. I would want the entire appliction to be restarted in that case.

... Show more ...

Posted in Erlang  |  Tags erlang,OTP,daemon  |  1 comments

Using Postgresql with Grails

Posted by Jim Morris on Wed Nov 11 13:59:07 -0800 2009

I started playing with Grails, and I am planning to rewrite the blog engine I use for this blog in Grails. As noted earlier I wrote it in Merb originally. Although Merb is nice and lite it seems to be having difficulty keeping up with the gems it is dependent on. A case in point is Cucumber which it says is its recommended way of doing integration tests. The current version of Cucumber is very difficult to get working with Merb. See the Git source to see how I finally did it.

While I was learning Grails, I hooked up Postgresql 8.2 to Grails using the Datasource.groovy file. I turned on SQL logging, and to my horror saw how it was handling the id's. I have been using Postgresql for quite a while now, and used to run into problems with the creation and retrieval of the automatically generated IDs. It seems a lot of people run into these hard to describe problems, as it appears to happen rarely and is probably a race condition. With version >= 8.2 Postgresql introduced a way of inserting a new record and returning the automatically generated id in one atomic statement. This solves all the problems and is more efficient as it does not require two queries for each insert.

... Show more ...

Posted in Grails  |  Tags grails,hibernate,postgresql  |  11 comments

Converting a Sidewinder 3D pro joystick to USB

Posted by Jim Morris on Sat Oct 24 14:50:02 -0700 2009

In playing with my new Rovio I decided that my Old MS Sidewinder 3D Pro Joystick would be an excellent way to control it, as it has the twist which can rotate the Rovio, and the joystick up/left/down/right can move the Rovio in those directions while still facing forward.

The problem is that the joystick has a game port connector, and my Linux workstation does not have a game-port. After doing the obligatory Googling I found this Exactly what I needed, except this was for Windows not Linux. Thinking I would have to modify the code I contacted Grendel who graciously sent me the source code for the project, however it turns out the code he wrote was so good it works as is on Linux, I just needed to modprobe sidewinder and it worked.

... Show more ...

Posted in Linux,Embedded,Robotics  |  Tags joystick,usb,soldering  |  no comments