Wolfmans Howlings

A programmers Blog about Programming solutions and a few other issues

Turn off forgery protection when using caching

Posted by Jim Morris on 2010-12-18 01:04:06 +0000

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  |  4 comments

Upgrading a Rails 2.2.2 app to Rails 3

Posted by Jim Morris on 2010-12-17 15:27:17 +0000

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 2010-11-29 23:06:57 +0000

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 2010-11-29 23:06:41 +0000

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 2010-09-19 17:26:42 +0000

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  |  2 comments

Using Postgresql with Grails

Posted by Jim Morris on 2009-11-11 13:59:07 +0000

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 2009-10-24 14:50:02 +0000

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  |  1 comments

Fun with a PC104 board, embedded Linux and wifi

Posted by Jim Morris on 2009-10-21 01:32:16 +0000

Around 10 years ago I was playing with some home robotics, built a simple robot, with some sensors and an on-board Linux-based PC. The purpose was to experiment with Robot AI, a continuation of my PhD thesis I started on some 30 years ago, but did not complete.

The robot had a camera, a digital compass, a sonar scanner and a short range IR range detector, plus some bump detectors. I could control it over a wifi connection, that was a Orinoco PCMCIA board plugged into the PC104, 586 based Linux PC that was on-board. All powered by several batteries.

... Show more ...

Posted in Linux,Embedded  |  Tags linux,pc104,wpa_supplicant,microdrive  |  no comments

A TCP socket bridge for Javascript

Posted by Jim Morris on 2009-09-12 16:07:22 +0000

In the process of rewriting my voice server in Erlang, I decided a new web-based Javascript UI would also be welcome. One problem of course is my voice server requires a TCP connection and a UDP socket for sending voice, not to mention the whole voice capture, playback thing.

In order for this to work the voice and playback would need to be written in a Java Applet, so it made sense to put the whole TCP/UDP communications stuff in there too.

... Show more ...

Posted in Java,Javascript  |  Tags java,javascript,applet  |  no comments

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