Category Archives: Hacking

GetGNULinux.org gets a facelift

For the past two weeks I’ve been working on a new design for the website. I have just published the result – www.getgnulinux.org

The old design has been bugging me for a while now, and these days you see so many websites with beautiful designs, that I thought that getgnulinux.org couldn’t stay behind. In addition to that, viewing the website on a mobile devices with a small screen was absolutely horrible. The typeface was just not suitable for small screens, making it almost impossible to read the text (one would have to zoom in to read). Not to mention that desktops these days have bigger screens, and you want to fill those wide screens up nicely too.

So I’m hoping that this new layout will solve the above issues. It is far from perfect, I realize that. Designing has never really been up my alley (I prefer coding and back-end stuff), and I had to learn from existing websites to get an idea of how things should be done. But to my surprise, working on this new design has actually been a lot of fun (and a little addictive, I must say).

Recent advances in web technology allow you to do very neat things, with very little effort. And so I haven’t been shy to use these technologies to the fullest. For starters, I made the transition from XHTML to HTML5, which is supposed to be friendlier with mobile devices. I used HTML5 Boilerplate to implement what are considered to be best practices when building websites with HTML5 and CSS3. JQuery and several jQuery plug-ins were used to make the website more interactive. What’s also exciting is that modern web browsers have excellent support for Scalable Vector Graphics (SVG) now, so I’ve replaced some of the PNG images on the website with SVG images. These images can scale to any size, and as a result they will look sharp no matter the size of the screen. Some older web browsers don’t support SVG, however, so I used Modernizr and SVGeezy to provide PNG fallbacks.

Fixing the layout was the first step to get to the next milestone, getgnulinux 2.0. There are some open bug reports that still need to be taken care of. I’ve been postponing them because they require that the content of the website be updated, and I don’t think my writing skills are so great.  But now that I’ve taken care of the layout, I feel like working on the content too.

I am considering the new layout a work-in-progress. I’m still not 100% satisfied with it, but I feel I’ve kind of reached a maximum of my capabilities with this layout. If anyone wants to help out with improving the layout or the content, don’t hesitate to get in touch! I could really use the extra help. And of course I would like to hear from you, the reader, what you think of the new layout (positive or negative).

Order GNU/Linux!

A few days ago I stumbled upon OSDisc.com where you can order CDs and DVDs for as many as 195 GNU/Linux distributions. They even sell flavors of BSD and Solaris. The prices are low, the CDs are professionally labeled, and you can order from almost any location in the world. Even the website looks very professional, so I thought this would be the perfect website to send newcomers to GNU/Linux to (as an alternative to downloading).

Today I released an update (commit 562e490e59) for the Try or install page which adds links to OSDisc.com for ordering the Linux distribution of choice. The instructions on this page were improved as well, with links to the official installation instructions for each distribution.

Before
After
After the update

This update meant that some translations needed to be updated as well, so that completed translations remain complete after releasing this update. The translators responded very fast to my request to update the translations. Thank you Xuacu Saturio, Jason Lau, AstroFloyd, mauron, Yaron Shahrabani, Manuel Meixide, Bastián Núñez, and Alissa for updating the translations!

I can imagine that for some people it might be difficult to download a 700+ MB ISO file and burn it to a CD/DVD themselves, as not everybody has access to high speed internet, blank CDs, and a CD burner. So hopefully this update helps more people get access to GNU/Linux.

Project moved to GitHub

The GetGNULinux project source code has been moved to a different version control system and code hosting service. When I started managing this project I used Bazaar for version control and Launchpad for project hosting. During my internship last summer I started using Git for version control because I heard good things about it. It didn’t take long before I was sold, partly because the book Pro Git by Scott Chacon was a delight to read and easy to understand. I soon started converting my personal Bazaar repositories to Git (see Convert bzr to git by AstroFloyd for instructions).

I later converted getgnulinux’ repository to Git as well. You can check out the new project page at GitHub. From now on this is where you can find the source code, report bugs, and make suggestions for the website. Patches, suggestions, and comments are welcome.

Language negotiation implemented

Two posts back I was writing about my plans to implement language negotiation for getgnulinux.org. I’m happy to announce that its implementation was completed today.

“Language negotiation is a function of the HTTP protocol which lets a server choose among several language versions of a page, based on the URL and on preference information sent by the browser (specifically in the Accept-Language header).” – http://www.w3.org/International/questions/qa-when-lang-neg

Before language negotiation was implemented, http://getgnulinux.org/ would always bring the visitor to the website in its default language (i.e. English). Now, when the language preferences are properly set in the visitor’s web browser and the website is available in one of the preferred languages, the website will automatically display the page in the visitor’s preferred language. It will only do this for languages for which the translation is complete (at the time of writing this, these are Hebrew and Asturian). This was a conscious design decision – it wouldn’t be very nice to display a page which is only partly translated.

Other changes came along with the implementation of language negotiation. The language menu on the top of each page now only shows the languages for which the translation is complete. Incomplete translations are still accessible from the “More languages” item in the language menu. This link brings the user to the new language selection page which gives an overview of all translations and their status.

The implementation of language negotiation was actually very simple. Language negotiation is a common feature for websites which means that there is a good chance that someone has already written freely available code for it. And indeed, someone has. There is HTTP::negotiateLanguage from PEAR, PHP’s own structured library of code. However, I used a modified version of that function which I got from Matthew Somerville’s website. The reason I chose Somerville’s version is because apparently PEAR’s version fails on one criterion (see Somerville’s page for details). This also allowed me to adapt some code to GGL’s code which made implementation even easier.

Flag as a symbol of language – not a good idea

While working on the GetGNULinux.org project in June 2011, I decided to update the look of the website as I wasn’t very satisfied with it. It just wasn’t very nice on the eye and I’m not easily satisfied. One of the things I thought definitely needed a face-lift was the language menu. One of the changes I made was anchoring images of country flags to the language links in the language menu. I mainly did this because I thought it looked nice and because it could make it easier for someone to select the preferred language (the flag of your own country is very recognizable). But I recently realized that this wasn’t such a good idea.

This decision has given some issues. For example, GetGNULinux.org is written in English, American English to be more specific. But from the start I’ve been using the flag of the United Kingdom for the English language. This obviously doesn’t make sense. I later changed this to the flag of the United States. This however doesn’t solve the problem, as I later found out.

Last week I got an email from a translator who explained that I was using the wrong flag for the Catalan language. Fact is that I was using the flag for Andorra for the Catalan language. According to Wikipedia, “Catalan [is] the national and only official language of Andorra and a co-official language in the Spanish autonomous communities of Catalonia.” So which flag should be used to link to the Catalan language: the flag for Andorra or the Catalonian flag? I was later told by a Catalan translator that the Catalonian flag should be used to refer to the Catalan language, for historical reasons and because it was used more often. So I changed it.

To get back to the issue with the “English flag”. I still wasn’t sure whether this use of the UK or USA flag for the English language was correct. So I googled “flags language” and the first result read: “Why you should not use a flag as a symbol of language”. This of course drew my attention, so I clicked on that link which brought me to an article with the title “Flag as a symbol of language – stupidity or insult?“. It is a very well written article which explains the issue very clearly. To keep things short: a flag is a symbol of a country, not a language. And there is no reason to bind the country and the language strictly together.

“Why should, for example, a Brasilian select the flag of Portugal to select his native language? It’s quite possible that a Brasilian does not even know the flag of Portugal.” – http://www.cs.tut.fi/~jkorpela/flags.html

Hence the use of flags to refer to languages doesn’t make sense. So today I followed the advice from that article and I removed all flags from the language menu of GetGNULinux.org.

But it doesn’t stop there. On that same website I found a section “Techniques for multilingual Web sites” with more useful documents from the same author. I took more advice from those documents in order to optimize GetGNULinux.org. For example, the language menu has been moved to the bottom of the documents in order to emphasize the content at the beginning of a page in indexing. And language negotiation is something I wanted to make use of for some time now, and this is something those documents also cover. So this is something I’ll work on in the near future.

Server downtime

The server behind getgnulinux.org experienced some troubles today. For some reason the server had rebooted and the GRUB configuration file was gone, welcoming me with the message,

error: file not found
grub rescue>

So it was no longer able to boot into the operating system. Not knowing how to use the grub command-line, I used the rescue mode of the Ubuntu server CD to re-generate the GRUB configuration file. After rebooting the system it seems that everything is working again. All data still seems to be intact and the websites are back up. I have not found any indications of the server being cracked, so I have no idea what caused this.

Update 2012/03/13: I found the cause of the problem. This issue was caused by an external hard disk drive that is permanently connected to the server via USB. Backups are automatically written to this external hard drive. The server’s BIOS was setup to boot from USB devices first and so the server tries to boot from this external drive. However, the boot fails because GRUB was looking in this drive for a GRUB configuration file (which isn’t there). What was GRUB doing on that external drive? Well, that is a leftover from a previous Ubuntu installation (GRUB was installed on the MBR). So I deleted GRUB from the MBR with,

dd if=/dev/zero of=/dev/sdb bs=446 count=1

Of course “/dev/sdb” is the external drive. But after this the server still tried booting from the external drive, leaving me with a black screen and a blinking underscore at boot time. *sigh* Why is the BIOS still trying to boot from this external drive when GRUB is removed from the MBR?

Ultimately I had to solve work around this issue by just setting in the BIOS to not boot from USB devices.

I18n with gettext

The getgnulinux.org website was put for download as an archive containing static HTML pages. The HTML pages were automatically generated from source files and it would help if I had access to those source files, but unfortunately I don’t. Before I can start focusing on implementing the new translation system I need to get rid of those static HTML pages.

So I’ve started to convert all HTML pages to PHP pages. At the same time I was looking around for a translation solution;  that’s when I found GNU gettext. It turns out that PHP has support for GNU `gettext’. This means that translation files (*.po) can easily be extracted from the PHP pages. The translation files can then be translated with translation systems like Pootle or Launchpad Translate (not yet tested), and best of all, the same PHP pages can load the translation files of different languages (all using tools from the same `gettext’ package). I did some quick hacks to test this (I converted all pages to PHP with `gettext’ support), and it works like a charm!

I’ll be working hard on fully implementing `gettext’ support. This means that all English text strings in the PHP files need to be marked as translatable, and this is a lot of work.