/me@(voip.)?|www./ SamLown.com

Yet Another Stupid Web 2.0 Video

I wouldn’t normally post web 2.0 video on my blog, oh no, not I, but I’m making an exception. This one is too good not to watch a couple of times!

(I’m also after some embedded flash video for testing Planetaki. ;-)

Update: Seems there were some copyright issues with the last video but it should work now hopefully.

Sam Inside

Check out the cool photo! The area highlighted in red is Acute Bronchitus (as opposed to chronic), the white stuff around it, is me. Bugger.

Looks like I’ll be staying at home for a few days to come. At least I’m fortunate enough to have a job that I can do from my nice warm home without problem!

The waiting areas and general internal appearance of the “Hospital de la Paz” in Madrid leaves a lot to be desired, but the equipment they have for making these photos is very modern and seriously impressive!

Git!

Finally, I’ve given up with subversion and moved to a distributed revision control system, git. Developed initially by Linus Torvalds (who apparently named it after himself!?), git does not depend on a central location for managing changes, and instead relies on a distributed model where each “clone” of the repository is completely independent.

The reason for my move away from subversion which I’ve been using now for several years is pretty much based on frustration. I’ve found myself wanting to do more and more with revision control and subversion just started getting in the way far too much. The final straw was when I wanted to merge two separate repositories for a project with a shared base, turns out its impossible with subversion without some serious messing about.

There are several other distributed version control systems out there, some of the most popular open source versions being bizaar or Mercurial. They both look really great and have some important backers, but I decided on git on the end with its C back-end and simplicity. It really does just work and gets out your way! The only possible disadvantage is that getting it to work in Windows is complicated to say the least, but after a bit of thought I decided this is probably a benefit :-)

Shops to buy from to fill geek play areas

After reading Javier CaƱada’s interesting comments on spaces to play in (Spanish) it made me realise that having a space to chuck stuff around and invent in while you’re growing up is probably quite essential to developing those inquisitive and inventive tendencies used for the rest of your life.

I was always lucky enough while growing up to have such spaces in abundance, from huge cold garages to my father’s Motor-home factory, and large bedrooms with my first electronics do-it-yourself kits and computers. Although I don’t get to play as much any more, I still yearn to open things up and learn how they work and continue using the same inventive tendencies in my programming.

There is another factor that I think is worth mentioning, and that is culture.

I was raised in middle-class England (like most English!) where personal space is far more precious and any thoughts of living in a flat are thrown very quickly out the window. The exceptions are of course students and living in large cities where space is a premium. Spain however, is different. Here they build Russian communist style building estates in the blink of eye. I have no idea why either, its certainly not for a lack of space! I guess they’re just so used to it that its not worth building houses if the punters will buy a flat without complaining, either way, the result of this cultural difference is less-space and less independence, and it shows.

The other missing link in Spain, is the lack of what I’d call enthusiast stores. In England, we have stores like Maplin that provide for every English experimenter’s itch. Indeed, from very young I had the Maplin Catalogue close by and frequently made orders for the odd resistor or soldering iron that I need to get my project to work. I loved it.

In Spain I’ve not managed to find anything even remotely similar. There is the odd corner shop with a few bits and pieces, but nothing on the same scale, and no catalogues to flick through for the latest gadgets. Just the other week in-fact I was looking for a magnifying glass for some soldering work, Maplin of course had the perfect product, a 60W Swing Arm Magnifying Lamp, brilliant and not too expensive. My search still continues to find something similar here…

How much does a firewall rule cost?

If your answer to this question is something along the lines of “probably the time it takes to set it up, if anything” you’re probably on the same wavelength as I am. You wouldn’t however even be on the same planet as Arsys! Please allow me to explain the frustrating day I’ve had with this popular and IMHO overrated Spanish web hosting company.

At my morning job, we decided to set up our own internal Jabber server. MSN was on the blink and moving away from Microsoft is something I’m always eager to promote at any time. So, as I’ve done several times before, I began the process of configuring our dedicated server so that Ejabberd was working fine and tested using the joys of SSH port forwarding.

Arsys on all their dedicated servers provide a firewall by default, this I know, so I set the gears marching for them to open the necessary ports to allow our Jabber conversations to flow freely.

1st problem. Turns out it costs 30 euros per month for them to open these ports as they are non-standard (eh?). Its not much in relative terms, but we’re talking a single change for a few minutes of work on an already existing firewall which ends up costing a total of 324 euros over 12 months. My reaction was of course; ditch the firewall, I’ll add my own using Linux and iptables!

2nd problem. Turns out it costs 30 euros per month to deactivate the firewall! (EH?) This is really quite annoying, how is it turning something like this off has a monthly cost?! Crazy. We do have contacts in Arsys who might have been able to help us by-pass this, but for 30 euros we might look a bit silly calling the CEO. In the end we decided to swallow deeply and go with the already present firewall.

3rd problem. Turns out it costs 30 euros per month per 10 rules! (WTF!!!) Jabber needs three open ports, all incoming and outgoing, and for convenience I’d said TCP and UDP; that’s 12 rules in total. They wanted 60 euros per month for the privilege! Totally unbelievable. In the end I removed the UDP rules and stuck with 9. Clearly if we want anything else, its cheaper to ditch the firewall and as a consequence loose any slim chance of security it offers.

Poorly thought out customer support policies like this, only serve to annoy, especially when dealing with someone clue-full enough to know what a firewall really is. Lets also not forget the amount of time we spent sending emails back and forth to sort this out, and all for a few minutes of their time to make the necessary change. I feel abused.

Internationalisation is Possible!

Its official, I’m proud to announce that my talk on internationalisation in Rails has been accepted and in just under a month I’ll be on stage trying to explain some of the ways that web applications can be translated into other languages.

The approach I’m aiming for with the talk will not be too technical, and I’d like to concentrate more on the design and practical issues that need to be understood to create an internationalised application of any type. These decisions need to be made by everyone, so I’m hoping designers and developers alike will find the talk interesting.

I’m also going for a more positive approach to handling this difficult subject and convince everyone that i18n is a cause worthy of a bit of time and dedication.

Lastly, Its worth mentioning that I do not think Rails should include support for internationalisation out of the box, and I’ll explain why.

… I’d best get on and write it!

Ruby: Dates in Gettext

My contribution to supporting dates, at least half decently, in Ruby on rails using Gettext.

http://www.ruby-forum.com/topic/129944

The approach I’ve taken is designed to act as a drop-in transparent replacement for the current standard date methods. The end result is that there is no need to change any of the existing date calls as they will automatically be internationalised. There are still a few extra bits to support, such as the Rails date_select methods, which I intend to add to a GettextDate plugin as soon as possible, and after a bit more testing of this approach.

Previously, I rather naively thought that dates would be easy to support in Gettext, but it turned out that it was a bit of a black spot with no clear solution. I expect most people just ended up using Globalite, Globalize, or just used name-less strings to get around the problem.

Skypes in Trouble!

I don’t take enjoyment from other peoples missfortunes, but I’m making an exception for this one. It looks like Ebay haven’t had quite the success they’d hoped for with Skype and have admitted to paying too much,. Not much of a surprise really, and I’d like to think that having a non-globally sustainable business model (charging for calls to a legacy system, but the new being completely free) has been part of the problem.

Why am I happy? Because I’m hopeful that this is the beginning of the end of the Skype monopoly, its closed protocol, and customer lock-in. The skype outage was just a warning sign of what happens when you depend on one single provider; 220 million people left without a phone connection, and is likely to have set many an alarm bell ringing. Who’s to say how they’ll try and make up for the losses, maybe a subscription fee? That would be popular!

Of course, this begs the question, if Skype is so rubbish, why do millions of people use it everyday? Convenience. Skype was indeed one of the first VoIP services that “just-worked”. No need to worry about cheap broadband modems or tightly controlled company networks, skype’s secret language will barge its way through all but the most stubborn of networks, tunnelling its traffic through ports normally only open to normal web page traffic and by searching for other users computers to redirect the data through.

Its an impressive hack, but is certainly not a long term solution. In the end it just hinders the development of more open, standard protocols, and the real ways the world can become better connected. The way I see it, there are two possible roads for skype; everyone accepts that skype has the market control and pay-up, or it fizzles out as the open standards become easier and better.

Fixing the Rails to MySQL character set

Database character sets can be quite confusing at times. For example, if your Rails app serves up pages in UTF-8 (as it should) along with the MySQL database, but you haven’t specified in the database.yml that the database connection should be UTF-8, you’ll end up sending latin1 (the default) characters, which are stored in the database as UTF-8. Very confusing. The end effect of this, is that when you look at the raw data in the database from another app, say the console or phpmyadmin, the data will be shown incorrectly with funny sets of characters representing the originals. This also makes backups and modifications really troublesome.

In the remainder of this entry, I’ll describe a few simple steps to harmonize your Rails UTF-8 application with its database.

1. Firstly, we need to stop the web server so that no more requests and data are coming through. You might also want to make a backup at this point, just in case.

2. Modify the /config/database.yml file to set the correct encoding, something like this:

production:
  adapter: mysql
  database: database
  username: user
  password: #########
  host: localhost
  encoding: utf8

3. Dump the current database, ensuring that the default character set is latin1:

mysqldump -u user -p --default-character-set=latin1 database > database_dump.sql

4. Open the dump in your favourite editor, preferably something console based like vi as the dump is likely to be big, and edit to following line:

/*!40101 SET NAMES latin1 */;

Which should be somewhere near the top, to:

/*!40101 SET NAMES utf8 */;

Worth mentioning here, is that you should ensure that your editor is running in UTF8 mode, with vi you can force this with the following vi command:

:set encoding=UTF-8

5. We’re now ready to restore the data back to where it came from:

mysql -u user -p --default-character-set=utf8 database < database_dump.sql

Thats it! Your rails application can be started again and you can rest assured that your future backups will be protected from strange characters.