I’m Binaryape

About me

Photographer, software developer, sysadmin, startup-founder, atheist Buddhist, vegan and Green. Wears a hat.

This blog reflects my personal opinions only, although most posts are so old they might not even do that anymore.

Recent public projects

Status updating…

Found on

Contact at

apetracks@binary-ape.org

What’s Not Necessarily Wrong With Ruby

- - posted in Ancient Archives

Bitwise introduces ‘What‚Äôs Wrong With Ruby?’ with

Matthew Huntbach takes a long hard look at the coolest language on the planet and is distinctly under impressed by what he sees…

That introduction has more than a slight aroma of flamebait. In the actual article Mr Huntbach concludes:

Despite what I’ve written above, I didn’t find Ruby horrible. If I needed to use a scripting language, it’s the one I would now use. It’s cleaner than Perl, and I like its syntax better than Python. Its object-based nature works for me: object-orientation is not the silver bullet, but it is a better abstraction for managing complexity and modelling things than anything else we have. It has picked up some useful aspects from functional programming as well and put them into a language whose ability to handle interaction between stateful objects makes it more practical than pure functional programming (still to me, real elegance, but of an infuriating kind). But it isn’t as revolutionary or as cool as its advocates suppose.

I can’t disagree with that at all. Ruby is generating a lot of hype because it can trigger great enthusiasm from the hordes of recently converted PHP and Java programmers. Ruby can also support trendy new paradigms like meta-programing, BDD and domain-specific languages with ease, so tends to get caught up in all the Cool New Development trends. It’s zeitgeisty!

Skip over the academic language snobbery (that’s a whole topic in itself…) and there’s nothing really objectionable about the article at all. I find the description of a conference full of programing academics quivering with confusion about the ungodly goings on the real world rather amusing. People are using scripting languages! Oh my goodness! Why won’t they listen to us?

I disagree with Matthew Huntbach’s criticism of Ruby’s array handling as unintuitive, however.

I‚Äôll give just a couple of examples. In Ruby, if a is [1,2,3] and b is [10,20,30], then a+b is [1,2,3,10,20,30]. Why not [11,22,33], which Tim Sweeney in an earlier article suggests “intuitively makes sense”? What does a[x,y] (when a is a two-dimensional array) mean in Ruby? Not what I first supposed it might mean from other languages (otherwise a[x][y]), or even what I then thought it might mean (otherwise a[x..y]).

The plus sign has this functionality for Ruby arrays (all operators are just object methods in Ruby):

[1, 2, 3] + [4, 5, 6] => [1, 2, 3, 4, 5, 6] [1, 2, 3, 4, 5, 6] - [3, 1, 6] => [2, 4, 5] [ 1, 2, 3 ] * 3 => [1, 2, 3, 1, 2, 3, 1, 2, 3] Ruby’s array is a list that can contain any mix of objects. The plus operator is a method acting on the list object, not its contents. The least surprising results of adding two lists is a longer list, hence the default, sugary behaviour of plus.

Matthew Huntbach would get the behaviour he wanted by using the correct classes, Vector and Matrix.

a = Vector[1, 2, 3] b = Vector[4, 5, 6] a + b => [5, 7, 9] If you want to apply a method to the contents of an object, use a map or collection method. Ruby excels at this. One of the reasons Ruby makes me happy is that its array handling is so much more convenient than Perl’s.

Ruby’s behaviour will not always be “intuitive” if you’ve spent years working with C based languages, but I think this more often just down to unlearning old habits than flaws in the language itself. Ruby quite deliberately dumps the non-OOP baggage of C based languages. Ruby was written as a replacement for Perl but is not conceptually descended from Perl, or from C. Its purpose was modelled on Perl, but it’s ancestry is more closely linked to Lisp and Smalltalk.

Although I think Ruby succeeded in following the principle of least surprise in most cases its fundamental differences from the C based languages do cause a few points of confusion. My own favourite is Ruby’s evaluation of “truthiness”.

In most C-based languages 0, “”, undefined are false. Anything else is true.

$result = 0; print "Hello" if $result; => In Ruby only Falseclass and Nilclass are false. Any other defined object is true, including 0 and empty strings.

result = 0 print "Hello" if result => "hello" (Both approaches are justifiable but I’m now happier with Ruby’s approach. 0 and “” are still, present valid data. In my contrived example above 0 is still a result)

Another gotcha is that every named variable is effectively containing a reference to the actual object. By default assignment copies the reference, not the object.

a = "HELLO" b = a a => "HELLO" b => "HELLO"

a.downcase! a => 'hello' b => 'hello' This is rarely a problem but occasional use of .dup is required.

Update: If you want to read more interesting responses to the Bitwise article then take a look at Why’s admission that yes, he is what’s wrong with Ruby, and make sure you read the comments.

This all coming from a guy whose current interest is the Aldwych programming language.

Ouch.

Update: Storm in teacup continues at Bitwise!

Mohammed Sheikh Khalid Stole My Socks

- - posted in Ancient Archives

Confess to everything and you’ve confessed to nothing.

Mohammed Sheikh Khalid has now, voluntarily and of his own free will, admitted he masterminded every significant event from the Norman Invasion through the bubonic plague, fall of Constantinople, and Great Fire of London, to the Battle of Little Big Horn, assassination of JFK and the Oklahoma bombing. Or he might as well have. The extraordinarily comprehensive list of terrorist outrages for which he claims responsibility would be beyond the capacity of any but the most brilliant and inspired mortal; Khalid, I fear, is a more run of the mill thug.

Khalid’s list of confessions read like something from a show trial in a stalinist state. There’s something for everyone: the authorities have caught the man responsible for all the bad things (Mission Accomplished!), Al Qaida can claim to be super-powerful, and to anyone else the whole thing is an obvious farce.

Link: Craig Murray via Blairwatch

Update: According to Jesus’ General, the key to uncovering this high-quality information is to torture a mentally ill man after kidnapping his children.

Food of the Gods

- - posted in Ancient Archives

I don’t drink tea or coffee but I’m known for eating a fair bit of Green and Blacks chocolate. I like chocolate.

We’ve recently tried three new medium-sized bars of chocolate by Organica. All are high quality Swiss dark chocolate, organic, ethically sourced, fully vegan, and not owned by Cadburys. The ‘Tangiers’ bar is orangey, similar to Green and Black’s classic ‘Maya Gold’, but with orange peel and a tangier taste. Nice, but not too exciting. The ‘Marrakesh’ bar has lots of cinnamon, nutmeg and small raisins and triggered some nostalgia for Midwestern desserts*. Pleasant, warm, Christmasy taste.

The third bar is called ‘Food of the Gods’, rather appropriately**. Imagine a dark chocolate bar full of crunchy, brittle nuts. Nuts that are actually raw cocoa nibs (the centre of a cocoa bean). This is a really good bar of chocolate if you like real chocolate. This chocolate bar is not elaborate or subtle or delicate (try Booja Booja for that), it’s hardcore. If you prefer chocolate that’s mainly milk and sugar and produced by child slaves then avoid this bar. This is the good stuff. Recommended.

I’ll post more chocolate reviews and photos soon, as I’ve been invited to take photos at a vegan chocolate tasting event next weekend. Mmmm...

I can’t find Organica on the web but there’s a news item on the new bars at Confectionary News. I bought mine at 8th Day.

* As an English person I’m always struck by how the Midwestern USA seems covered in a cloud of cinnamon/nutmeg spice mix. Airports, shopping malls, bookshops, streets, cars, restaurants, homes. It’s nice. England probably smells of last-night’s spilled lager and urine to visiting Midwesterners.

** The chocolate plant’s latin name means “food of the gods”.

Zelda Procrastination

- - posted in Ancient Archives

When I was half-way through the final dungeon in Wind Waker I suddenly realised that I was about to complete the game. No more sailing around in the rain. No more pointless rupee collection. What if I never work out what those windmill things and strange sockets do in the town? So I stopped playing. I can always finish it later.

It’s happened again - I almost beat Ganon in Twilight Princess on my first attempt, before realising that I was about to finish the game. After about 80 hours I had almost reached the end. What about the other hearts? I’ve not done everything properly - insects, poes, flight-by-chicken tricks. I’ve not raced against Yeta yet!

It’s good to know what’s left: The Twilight Calculator

So Ganondorf can wait. I’m off looking for golden bugs.

Newsflash: Guinness Marmite Review

- - posted in Ancient Archives

I’ve finally got hold of some Guinness Marmite (thanks Helen!) and we’ve tested it on some toast.

According to the polite and informative Marmite Loveline (really, it’s on 08000 323 656, waiting for all your Marmite queries) Guinness Marmite is still vegan as it’s simply a different blend of ingredients already present in Marmite. There’s just more Guinness yeast gunk in it, and less yeast gunk from other places.

According to the nutritional information on the jar it apparently contains 0.1 grams less salt than the normal Marmite.

When the jar was opened it definitely smelled different - there was a strong, slightly sour “Guinnessy” odour - but it quickly faded. Replacing the lid for five minutes allowed the odd smell to return, so Unilever aren’t just topping the jar with Eau de Guinness.

On toast it tasted almost exactly the same. Doing a taste comparison with normal Marmite I did wonder if ‘normal’ had a slightly stronger flavour, but soon discovered that trying to taste anything other than just Lots Of Marmite was impossible. Marmite is not a subtle food.

So, to summarise: Guinness Marmite is Marmite with a bit more Guinness, and as a result it has a slight Guinessiness to it. And I’ve spent ten minutes of my life alternately sniffing two jars of brewing by-product and making thoughtful faces.

Piccadilly Station Invader - Update

- - posted in Ancient Archives

I should have mentioned this ages ago:

In January I wrote to Network Rail and Manchester City Council asking if they knew what happened to the Invader mosaic outside Piccadilly Railway Station.

Manchester City Council didn’t reply (which I’ve come to expect) but I can understand that the whereabouts of a space invader mosaic are hardly a priority. If my message wasn’t actually a crank email it may well have looked like one.

Network Rail replied almost immediately and passed my query on to the contractor, Realty Estates. Realty Estates replied a few days later.

The invader was destroyed during the removal of the concrete base, but Realty Estates said that had they known about the Invader in advance they would have preserved it.

It’s a pity the mosaic was lost but not really a big deal - the Invaders are not permanent; the invasion occurred and then the invaders are gradually destroyed one by one. I appreciate the helpful replies from both companies.

If you notice work going on near an invader it might be a good idea to mention it to the company carrying out the work, just in case.

Missing Details

- - posted in Ancient Archives

On 12 February an RAF Hercules aircraft was badly damaged while making a night landing on a makeshift airstrip in Iraq. The damage was so serious that it couldn’t be repaired on site and it had to be destroyed to prevent insurgents getting their hands on it. Fortunately nobody was killed.

A couple of weeks ago, while idly reading an interesting article in Wired over lunch, I followed this link to TheyWorkForYou.com and found some details on the crash that I’d missed in the UK news.

In the most recent BBC report on the Hercules landing ‘incident’ we have these two statements:

A military spokesman in Basra said there was no evidence of hostile action during the landing in Maysan province.

The MoD stressed the aircraft had been making “a routine landing on a tactical landing zone” and the plane had not been shot down.

Contrast that explanation with the one given in the House of Lords and recorded in Hansard:

Lord Garden (Liberal Democrat)
Under what circumstances a United Kingdom Hercules C130 aircraft was destroyed on 12 February in Maysan Province, Iraq; and what was the value of the aircraft.
Lord Drayson (Parliamentary Under-Secretary (Defence Procurement), Ministry of Defence)
My Lords, a Hercules C130 on a routine mission was involved in an incident on landing in Maysan on 12 February. The initial investigation suggests that it was struck by an improvised explosive device similar to a roadside bomb. After assessment of the damage, it was concluded that the aircraft could not be recovered without undue risk to personnel so the aircraft was destroyed by UK forces. The current market value of a C130J is in the region of £45 million.

So the Hercules was not damaged by an accident during landing, it was damaged by a bomb on or near the runway. I can’t find anything in the British media mentioning this. Why? Did the MoD play it down and keep quiet, and journalists miss the reference to it in Hansard? Is there something more official in place, or are journalists just being unusually discreet and waiting for an official report to be released later?

I can understand the MoD is unhappy that a cheap bomb destroyed their ¬£45,000,000 aircraft (plus contents) but I think they should have been more open about what happened, and the media should have updated the story when more details were revealed. There’s a definite difference between an ‘landing incident’ and an aircraft lost to enemy action.

Friends of Platt Fields

- - posted in Ancient Archives

The Friends of Platt Fields have produced a new and rather good website of information about the park. Although many old features of the park have been lost (I miss the little zoo) it seems to be having something of a renaissance, with lots of improvements and community activities going on. Manchester doesn’t have enough open spaces and Platt Fields is a very welcome expanse of green in an otherwise brown and grey city.

We enjoyed the Diwali festival that was held at Platt Fields last year, and I’m rather pleased that some of my photos have been used in the new site (they are all Creative Commons licensed).