My first open source contribution

I’ve made my first contribution to the world of open source.

There is a bug in Action Web Service preventing it from marshalling booleans.

Change casting.rb to the following:

Line 40:

def cast(value, signature_type) # :nodoc:

return value if signature_type.nil? # signature.length != params.length

return nil if value.nil?

unless signature_type.array? || signature_type.structured?
return value if canonical_type(value.class) == signature_type.type
end

if signature_type.array?

unless value.respond_to?(:entries) && !value.is_a?(String)

raise CastingError, "Don't know how to cast #{value.class} into #{signature_type.type.inspect}"

end

value.entries.map do |entry|

cast(entry, signature_type.element_type)

end

elsif value == true || value == false

cast_base_type(value, :bool)

elsif signature_type.structured?

cast_to_structured_type(value, signature_type)

elsif !signature_type.custom?

cast_base_type(value, signature_type)

end

end

and things are OK

Posted in General

Testing in Rails

Go to $RAILS_APP_ROOT/test/test_helper.rb and add the following line:

ActiveRecord::Base.connection.update('SET FOREIGN_KEY_CHECKS = 0')

This switches off foreign key constraints (on MySQL anyway) meaning that your tests can load and reload fixtures to their heart’s content, without getting hung up on the order of inserts and deletes.

Posted in General

Pride

I was very proud of Nottingham Forest over the weekend.

Marlon Harewood carving open premiership defences.

Daws holding his own against Wayne Rooney (one foul excepted).

JJ nicking two points off Manchester United.

But of course, the real Forest lose 3-0 to Yeovil. Worse than lose. They give up. Can’t be arsed. Spit on the fans.

Megson says it is unacceptable. But they are his players, working with his methods.

What’s the answer? Should Megson go? Who will replace him? Who on earth would want the job?

Should the players go? They are not earning their substantial wages. They are letting us all down. But they are good enough. They are a good mix of youth and experience. They even have some, Krissy, Wes and Perch, who are Nottingham through and through. Yet it’s still down to Gaz to show any commitment (even if the idiot gets himself sent off stupidly). And no, I don’t blame Gaz for being pissed off with the fans. I think it shows a level of dignity to ignore the fans, who constantly boo him, that the other players are sorely lacking.

Again, it strikes me that it doesn’t matter who the manager is, who the players are. It’s nearly fifteen years since Mr Clough retired and we’re still in decline. Is it the weight of expectation? Probably. Is it going to change any time soon? I don’t think so. Sometime soon the “you’re not famous anymore” chants will stop. And then, just like some of our own ignorant fans sing at the likes of Blackpool and Wolves, we’ll be on the receiving end of “you’ve never won fuck all”. And it’s only then that we will have any chance of any sort of recovery.

Posted in General

BBFC

My life has been rated:
Click to find out your rating!
See what your rating is!

Posted in General

Rish’s tribute to Ronnie Barker

There’s nothing more to add …

Ronnie Barker
1929-2005

I have never before felt compelled to write a tribute piece, but was curiously moved by yesterday’s announcement of the passing of Ronnie Barker. The only other time I can remember feeling so upset about the passing of a public figure, it was last year when Sir Brian moved upstairs to give God some tips on man-management (incidentally, it does make me feel proud when I drive past the “Brian Clough Way” signs on the A52 every day).

Anyway, I digress. My parents loved watching comedy. When I was little, the two programmes I remember us all watching were Kenny Everett and the Two Ronnies. And while Kenny Everett’s Spider-Man sketch remains one of the funniest jokes of all time, and more recently, Father Ted has had my Mum in stitches, there is a warmth and depth to the work of the Two Ronnies that has rarely been seen elsewhere.

Ronnie Barker was not a reclusive man, but he was private. He was eager not to upstage his colleagues, nor to put pressure on them, which was how the alter-ego of Gerald Wiley was born; if his colleagues saw that the sketches were written by him, they may have been scared of voicing any critical opinion of him. And so the comedy he produced was pure and genuine.

Ronnie Barker was also a brilliant actor. Aside from the Two Ronnies, he is most famous for Porridge and Open All Hours, in which he played vastly different characters (albeit both loveable rogues), but made them both utterly believable. Both Fletcher and Arkwright were superficially driven by power (in prison and over Granville), but both did have hidden depths (especially Fletch; Arkwright’s main objective in life was to breach Nurse Gladys’ defences).

So a writer, and an actor. Watching some of the Two Ronnies’ work, it is apparent how much both Corbett and Barker were enjoying their performances. It is always heart-warming to see Ronnie C struggling to maintain a straight face when presented with a brilliant character performance from Ronnie B. However, I suppose the reasons that the Two Ronnies’ were so memorable were just the sheer playfulness and comic genius behind their sketches; often saucy but never smutty, brilliantly written and equally well performed. Some of my personal favourites include (and apologies, as I don’t know the proper names of all the sketches):

? Nose at Ton – Ronnie B, as the newsreader, finds his autocue broken, so can only read “o”s instead of “e”s. My favourite is a reference to the “Primo Monostor, Sir Aloc Douglas-Homo”.

? Morris Dancing – especially the song about “Bold Sir John”, allowing Ronnies B and C to express a thinly-veiled rivalry (“sod off, sod off, sod off, sod off, so doff your hat…”)

? Automated Doctor – Ronnie C goes to the surgery to find that due to automation, Doctor Barker actually appears upon a television screen with multiple choice answers (“Is your problem: (a) Nose bleeds; (b) Getting up in the morning; (c) Terry Wogan; or (a), (b) and (c), Terry Wogan getting up your nose every bleeding morning?”)

? Then there were the news items (thanks to the BBC News website for these):

o “On a packed show tonight, we’ll be talking to an out-of-work contortionist who can no longer make ends meet”
o “The toilets at a local police station have been stolen. Police say they have nothing to go on”
o “The man who invented the zip fastener was today honoured with a lifetime peerage. He will now be known as the Lord of the Flies”

I am sure there are many more that could be added – everyone is bound to have their own personal favourites. All I would like to add is that on the 4th October 2005, the world lost a great man and a true comic genius.

A final word of advice from the Hieroglyphics sketch for you all to remember: “A bird in the hand is worth two in Shepherd’s Bush”. And with that, it is goodnight from me, and it is goodnight from him. Goodnight Ronnie.

Posted in General

SOAP clients in Ruby

I ran into some problems getting my Rails prototype to talk to an ASP.NET web service the other day. It turns out that the Rails Web Service client isn’t really designed to talk to anything other than a Rails application, so instead I had to use the inbuilt Ruby SOAP client, as designed by Hiroshi Nakamura.

However, that resulted in even more confusion. So, in the interests of clarity (and so I don’t forget) here is what I did.

First off, save the service’s WSDL locally (”http://myserver.com/folder/service.asmx?wsdl” to access the WSDL). Then download the latest patch release of Soap4R – from http://dev.ctor.org/download/soap4r-20050928.tar.gz. Unpack the tarball and run a “sudo ruby install.rb“. Then move to the bin folder and run a “ruby wsdl2ruby.rb --wsdl myfile.wsdl --type client“. Soap4R reads the WSDL and generates Ruby stub objects for you.

However, that’s not all. Your client code needs to “require” the generated “service.rb” file and then create an instance of the stub client. However, passing complex parameters to your service is slightly more involved. wsdl2ruby generates a class that encapsulates the parameters – create one of them and pass that to the service.


service = MyService.new(url)
# include this line to show the raw XML packets
service.wiredump_dev = STDOUT
# call a simple method taking a single integer
puts service.SimpleMethod(some_int)
# call a complex method taking mutiple parameters
parameters = ComplexMethod.new(some_int, some_string)
response = service.ComplexMethod(parameters)

Structs come back via the response object and are a map of the XML response object. So, assuming ComplexMethod returns an array of ComplexTypes, you would access it via response.ComplexMethodResult.size to get the number of elements in the results.

I’ve not figured out how to pass structs in to the service yet.

Posted in General