February 2007

21
Feb

MySpace have just spammed me

I received an unsolicited e-mail from MySpace this morning. Looks like it’s one of their usual circular newsletters. What makes this very strange is that I do not have a MySpace.

Okay, granted, I did have one once upon a time, but I never actually used it, and in the end I cancelled it. I was actually quite forthright in the comment box on the cancel my account option: I said that I have no time for an ad-ridden monstrosity that violates every accessibility guideline in the book and encourages you to parade a total absence of web design skills while encumbering your blog with search engine hostile URLs. They also have a fiendishly complex system for cancelling your account. You have to click through about seventeen “Are you sure?” links, and then they send you an e-mail message, after which you have to click through another “are you sure?” link, then they tell you it will still take 48 hours.

The newsletter very helpfully gives you some instructions on how to stop receiving further e-newsletters from them:

At MySpace we care about your privacy. If you don’t want to receive future MySpace newsletters, change your Account Settings to “Do not send me MySpace newsletters.” Click here to change your Account Settings. You can also contact us with any questions or concerns regarding your privacy at: privacy@myspace.com or write: MySpace.com, 6060 Center Drive, Suite 300, Los Angeles, CA 90045.

Very helpful, I don’t think, given the fact that in theory I no longer have an account at the e-mail address that they sent it to and therefore I can’t log in to change my Account Settings to “Do not send me MySpace newsletters.” I’ve sent an e-mail to privacy@myspace.com asking what they think they are playing at and I await a response. If it mentions viagra, cheap mortgages, OEM software or Britney Spears, I shall be rather upset.

Update 23 Feb: It appears that I am not the only person who has been spammed by MySpace recently. A report by someone else hit the front page of digg.com a couple of days ago.

16
Feb

Dave 2.0

We had the first meet-up of our new local geek-out group here at the EurekaStep offices last night. We meet together from time to time to socialise, chat about all things Web 2.0 and swap ideas. Dan White gave us a talk and presentation on rich internet applications. Some of the things that he showed us that people do with Ajax these days are truly jaw-dropping. There are a lot of frameworks out there that make it fairly easy too, such as script.aculo.us, jQuery, and so on.

For better or worse, the group has been christened “Dave 2.0″. (One person suggested that could stand for “Developers Are Very Expensive”.) I will be giving a short five minute presentation on Ruby on Rails at our next meet-up, which is in six weeks’ time. Better get my skates on — I only started learning it a week ago…

12
Feb

Learning Rails

Historically, I have often adopted something of an ad-hoc approach to learning new programming languages. I tend to sit down with a specific project in mind, thrash around the documentation till I find what I’m looking for, and take it from there. It tends to be pretty tough going at first, but I tend to find I can pick up the basics of the language pretty quickly that way.

The only problem with this approach is that you end up with a patchy knowledge of the capabilities of the language and platform. I noticed this to quite a striking effect when I took my certification exam in ASP.NET. I discovered that there were facets of the framework, such as data binding, that I had previously completely overlooked, as well as a raft of best practices and principles to tap into. It’s also easy when you adopt an ad-hoc approach to learning a framework to miss out on some of the gotchas and pitfalls of a platform, as anyone who has encountered and attempted to eliminate the side effects of PHP\\\\\\\\’s notorious magic quotes will testify.

With Rails I’m trying a different, much more systematic approach. I bought myself a copy of Agile Web Development with Rails, which is more or less the official Rails manual (some people reckon the online documentation is a bit obtuse precisely to help sell the book) and I’m working my way through it. My intention is to work my way right through it before writing any serious code, by which time I should know what the framework has to offer and what it doesn’t, as well as what I need to look out for.

Developing Rails applications with Eclipse using RadRails

I’ve recently taken to using Eclipse for my work in languages other than .net (for which I still use Visual Studio). If you’ve never heard of it before, Eclipse is an open source integrated development environment written in Java. I’d never made a lot of use of it before — I always thought of it as a purely Java thing, and as I haven’t done a great deal of Java in the past, I never fully explored its capabilities. However, when I stumbled on a PHP plugin for Eclipse last week, it roused my curiosity, so I looked around to see what else was available. Sure enough, there are plugins for a whole raft of other programming languages such as Python, Scheme, Fortran or even OCaml (does anyone other than academics actually use OCaml?), and, as you would expect, Ruby on Rails.

The Rails plugins for Eclipse (there are two that you need to install) are the Ruby Development Tools and RadRails. It seems it’s the way to go for Rails development: you can start and stop your WEBrick servers, and access and run all your generators and Rake tasks from within the IDE without having to launch a separate command line window. And of course, it has all the other features you’d expect of an integrated development environment: syntax highlighting, source folding, document outlining, breakpoints and stepping through your code, and Subclipse to allow you to integrate it with your Subversion repository. Some of the Eclipse terminology took a little bit of getting used to at first, and getting RadRails up and running took a little bit of tweaking to get the settings right, but once you get it sorted out, it’s fairly straightforward.

10
Feb

On the rails

Ruby on RailsI’ve finally decided to take the plunge and get into Ruby on Rails properly.

I must admit there have been a couple of things about Rails that put me off a bit. One of these was the amount of hype surrounding it. I have always been very wary of hype, for the simple reason that it can cloud your judgment and lead you into making rash decisions that you later regret. Another thing that put me off learning Rails was the lack of decent, downloadable documentation — though this is less of an issue now that we have broadband at home. A third thing is that the business case for Rails is still fairly embryonic at present: there are fewer Rails jobs knocking around than .net jobs or PHP jobs, for instance. And on top of that, Joel Spolsky doesn’t like it.

Having said that, Rails is rapidly becoming mainstream. Tiobe Software noted that it was the programming language with the fastest growing community in 2006 (seems it took a massive leap round about November). Besides, the off-the-chart-smart people at ThoughtWorks have thrown their weight behind Rails, and you need to bear in mind that these are some of the people at the cutting edge of research into software development and design patterns, so it must be worth serious consideration. And on top of this, the chief technical architect for one of our most important clients is seriously into Rails, so it looks like it could come in pretty useful.

And what of Joel’s railing against it? Personally, I can’t help but get the impression that it cost him a lot of credibility. (David Heinemeier Hansson described it as “one of the purest forms of FUD I’ve ever seen”.) And when he ended his article by saying that he has his own in-house programming language called Wasabi, a lot of people thought that he had gone off the rails in more ways than one — or at the very least, that he was joking. Unfortunately, he wasn’t.

So I took delivery of the book from Amazon.com yesterday and I’ll be working my way through it over the next couple of weeks or so. Stay tuned.

08
Feb

Yes, it’s been snowing

Ever noticed how, whenever it snows, you get a whole lot of people whingeing on the BBC News forums about how the country has ground to a standstill? Just as predictable, some American pops up and says something like this:

As for the snow…some of you guys should come experience a Chicago winter. :D

or this:

I live in Minneapolis and currently it is -32 C outside and it was even colder yesterday.

Happens every time. It’s as predictable as clockwork.

07
Feb

Bitten by PHP 4’s pass by value semantics

For those of you who know a bit about PHP and WordPress internals and are interested, here is a brief technical overview of the details behind the bug in the original version of Comment Timeout.

I was originally tweaking the comment status of the posts at the start of the loop. The way I was doing it was admittedly a hack, but it worked — in PHP 5 at any rate, which has pass-by-reference semantics. However, it fell over in PHP 4, where variables are all passed by value rather than by reference.

It actually turns out that there is a non-hack way of achieving this. This evening I discovered that WordPress provides a filter, the_posts, which gives you a much better way of doing it. It passes an array containing all the posts returned by a query to your filter; your plugin modifies the array as appropriate — in this case, setting the comment status on some of the posts to “closed” — and returns it. The latest version (1.3 alpha 2) now adopts this approach.

Unfortunately, a lot of the WordPress API documentation is somewhat incomplete and sketchy, especially on the more technical side, which is probably why I missed this the first time round. Perhaps as plugin authors we ought to chip in and spend a bit of time polishing it up as we go? It is a wiki after all, so we’ve only ourselves to blame if it’s not up to scratch.

04
Feb

Stopping the spam flood

Following a recent flood of comment spam last week, I’ve decided to tighten up on my blog commenting policy. I’m now limiting comments to two hyperlinks each, which must not be in BBCode format. WordPress doesn’t use BBCode anyway, and I’ve never seen a genuine comment on anybody’s blog which contains more than one hyperlink, so I don’t think this is going to be a problem.

I’m also going to close comments and trackbacks right across the board to any IP address which has three comments pending moderation in my spam queue or which gets trapped by Bad Behavior three times in a week. In practice, it’s not likely to affect you unless you are running a spam bot on your computer or network.

If you want to do something similar on your own blog, it’s handled by the the latest version (1.3) of Comment Timeout. Note that this is still in alpha, so use it at your own risk. It’s configurable as before, so you can set it to allow three — or more — hyperlinks if you prefer.