Blog Posts

Deprecation! That's what you need!

So, I’m quietly beavering away at Typo with an eye to slimming down our somewhat monolithic ArticlesController class, tweaking our routing to use the new datestamped_resources plugin that I’ve developed to help dry up our routes, making a couple of new resourceful controllers for comments and trackbacks and generally tidying the place up. Hopefully Typo’s code is going to be much more habitable when I’m done. The problem is themes. Typo has an awful lot of ’em.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

The pleasures of baking

You know, I’m sure, how good fresh baked bread smells. But, good as that smell is, the real pleasure for me is the way it sounds. I’ve just pulled a loaf of sourdough bread out of the oven and it’s sat in front of me, scenting the air and rustling gently - it shrinks as it cools and that stresses the crust which occasionally gives up the battle with an audible crack.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

The sky is not evil

Joss Whedon writes strong female characters, he’s the mind behind some of my favourite TV ever and he’s a wise man. Here he is reacting to seeing camera phone footage of the murder of Dua Khalil Aswad on CNN almost alongside the trailer for Captivity:

The trailer resembles nothing so much as the CNN story on Dua Khalil. Pretty much all you learn is that Elisha Cuthbert is beautiful, then kidnapped, inventively, repeatedly and horrifically tortured, and that the first thing she screams is “I’m sorry”.

“I’m sorry.”

What is wrong with women?

I mean wrong. Physically. Spiritually. Something unnatural, something destructive, something that needs to be corrected.

How did more than half the people in the world come out incorrectly? I have spent a good part of my life trying to do that math, and I’m no closer to a viable equation. And I have yet to find a culture that doesn’t buy into it. Women’s inferiority - in fact, their malevolence - is as ingrained in American popular culture as it is anywhere they’re sporting burkhas. I find it in movies, I hear it in the jokes of colleagues, I see it plastered on billboards, and not just the ones for horror movies. Women are weak. Women are manipulative. Women are somehow morally unfinished. (Objectification: another tangential rant avoided.) And the logical extension of this line of thinking is that women are, at the very least, expendable.

You should read the whole thing. Seriously.

Dress for success: wear a white penis

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Metaprogramming == Programming

While I’m tilting a windmills, I should just like to tell all those people who bang on about ‘metaprogramming’. It’s all just programming. That is all.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Domain Agnostic Languages

Windmill tilting time again I’m afraid. Blame chromatic and David A. Black. What is it that characterizes domain specific languages? Before you trot out something like “Programs written in them read like domain experts talk”, take a look at some examples of code written in domain specific languages: /(?ms)"((?>[^\"]+)?(?>\.[^\"]))/ S3 R$* $: < $1 > R$+ < $* > < $2 > R< $* > $+ < $1 > R<> $@ < @ > R< $+ > $: $1 R@ $+ , $+ @ $1 : $2 R@ $+ : $+ $@ <@ $1> : $2 R$+ @ $+ $: $1 <@ $2> R$+ < $+ @ $+ > $1 $2 <@ $3> R$+ <@ $+ > $@ $1 <@ $2> >gi|2501594|sp|Q57997|Y577_METJA PROTEIN MJ0577 MSVMYKKILYPTDFSETAEIALKHVKAFKTLKAEEVILLHVIDEREIKKRDIFSLLLGVAGLNKSVEEFE NELKNKLTEEAKNKMENIKKELEDVGFKVKDIIVVGIPHEEIVKIAEDEGVDIIIMGSHGKTNLKEILLG SVTENVIKKSNKPVLVVKRKNS If you’re reading this on the front page, try and work out what the ones you recognise do before you dip below the fold.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Woohoo! Live comment previews are live.

Control.TextArea.ToolBar.Textile.js is currently rocking my world and, if you wish to comment on anything in this blog, will shortly be rocking yours I hope. I might need to fix up some of the feedback on commenting, but it’s nearly 1 in the morning and I’m going to bed.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Finally learning JavaScript

For years I’ve managed to dodge learning JavaScript. People have told me it’s a fine language with some dodge implementations. Friends have built an entire business model in the language, and I’ve continued to treat as if it were The Sound of Music (I’m 39 now and I have managed to completely avoid watching that film). Except, today I finally had a technical need that I couldn’t dodge by writing another .

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

What the?

Wow: $ rake spec … 156 examples, no failures $ ./script/spec spec … 156 examples, 2 failures $ rake [unit tests, all pass] [functional tests, all pass] [specs…] 156 examples, 2 failures For extra points, the 2 failures from running the plain rake are not the same as the failures from running ./script/spec spec. And if I run ./script/spec spec after a full rake run, I get a host of extra failures.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Things which are fun

It’s definitely fun to commit a major rework of something that’s been bugging you to SVN. It’s slightly less fun to check it out in your production server and have it fall over until you remember you to retweak the environment.rb file. Anyhow, we’re now running on Typo 4.1.1+r1438. Typo 4.1.1 got released last night and, pretty much as soon as it had cleared the gates I checked in a major rework of the Article and Feedback state mechanisms.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Other things which aren't fun

Last year, you would have been forgiven for thinking that Typo was pretty much dead in the water as an ongoing project. Typosphere was a placeholder, changes were few and far between, the app was a bloated monster. So, people switched, in droves, to Mephisto the new, (and excellent) kid on the block. Heck, even Tobi, the original author of Typo, has switched. Mephisto’s a great piece of software, and I’m as sure as I can be (without taking a closer look) that its underpinning code is cleaner than typo’s.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Things which aren't fun

Let’s say you’re running tests against your rails application and a test fails. “Hmm…” you think, “I wonder what could be causing that, let’s run that test file by itself.” The test passes. “Okay… I wonder if it’s the rake test loader, let’s run that test file using that.” The test passes “Right, it’s only the third test file on the list that’s failing, let’s try running just the first 3 test files.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Why don't more books work like this?

When you read Christopher Alexander’s ??A Pattern Language, the patterns within the language are interdependent and ordered from big patterns down to small ones. Each pattern has a number and wherever one pattern refers to another it’s referenced with both the pattern’s name and its number. Beck, Fowler and the Gang of Four (if memory serves) go one better, wherever they reference a pattern, they give the pattern’s page number (ah, the joys of computer typesetting).

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Why I love Smalltalk

From Extreme UI Testing: Method wrappers. Easily possible in VW and Squeak since you can subclass CompiledMethod and much with the method dictionaries […] Niall uses a strategy pattern to automatically wrap threads that get forked off by looking up the stack to see if the code is under test (and if it is, make sure to install a wrapper) So what if the language doesn’t give me the callbacks I need, I’ll just rejig the system classes until it does.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Routing Speed

So, since I couldn’t sleep, I’ve been hacking on the routing drop in replacement. I’ve reached the point where things are mostly working and I can at least run the benchmark tests. On this machine, Rails recognizes routes at a rate of around 22K url/s. At the start of the night, with the recognizer rparsec, to do the recognition, my new routing system was running at around 5K url/s, which isn’t exactly great.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

What happened to the routing rework?

Those of you who’ve been reading attentively will be aware that I’ve been working on a drop in replacemen for a chunk of Rails’ routing subsystem. You will also be aware that things have gone a bit quiet on that front. I got a job. Which is lovely, and fabulous, and safeguards my mortgage payments and all that good stuff. But it has rather put dampeners on any non paying work.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

That was fun

On Monday I was down in Brighton for a Brighton Coding Dojo where I had a crack at doing Kata four in Smalltalk. It took a while to find the balance, but once we got going I think it went well. We stuck in what seemed like the strangest places though. At one point, I had a method that did almost exactly what I wanted for a new method I was writing so I called up the method in the browser, changed the selector and the few bits that needed fixing up and accepted the changes.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Rails, CRUD, REST and the importance of adjectives

Consider a web request: GET /articles/2007/04/17/adjectives-rule;edit “What does it mean?” If we pass it through the prism of Rails routing, it breaks apart as follows: GET The :method, sometimes called the verb. /articles The :controller, the thing that’s going to handle this request /2007/04/17/adjectives-rule Parameters, passed to the controller method that handles this request ;edit The :action, some way of specifying what this request does It’s certainly one way of looking at it, but if you do I think you’re limiting your understanding of what it means to program in a RESTful fashion.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Soundbite

An argument for peace and love is always an argument for self-preservation. Go Giles Bowkett, you speak truth. You also speak it way better than I managed a couple of years ago.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Mmm... parsers

So, in my quest to get Rails routes to accept routes like: articles/:comment[article]/comments/:comment[id] I’ve been playing with parsers for the first time in my programming career. Quite how I’ve managed to get this far without them I leave as an exercise for the interested reader. At the moment I have a parser that will parse articles/2007/05/12/slug and give back an ActionSelector that yamlizes as — !ruby/object:ActionSelector controller: articles action: show params: :article: :year: 2007 :month: 05 :mday: 12 :slug: slug Which can be easily turned into the kind of params hash that rails wants from its routing system in order to dispatch the request to the right place.

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions

Wanted: module/starter.rb

I sometimes think that one of the reasons that CPAN is such a huge advantage for Perl is the ease with which you can contribute to it. It’s all very well having a tool for installing libraries from the archive, any fool can do that, but CPAN has tools for getting started with a new library too. If I want to start a new Perl project, I do: module-starter –module=AuthenticationFairy

  • 0 likes
  • 0 reposts
  • 0 replies
  • 0 mentions