Archive for July, 2010

Enabling mod rewrite on Apache

Monday, July 26th, 2010

To see if mod rewrite is enabled just create a simple php page with the following content

<?php
echo phpinfo();
?>

When you browse to this page you should see mod_rewrite listed as a loaded module.

If not, then you gotta enable mod_rewrite for Apache

sudo a2enmod rewrite
sudo /etc/init.d/apache2 restart

Now you can create a .htaccess file into the root of your site and start adding rewrite rules. Here’s a simple example to make sure rewrites are working

RewriteEngine On
RewriteRule (.*) http://www.google.com/

When you browse to your site, you should now be redirected to Google – if not, don’t fret! There’s one other gotcha you should know about! Look in the configuration file for your site under Apache (eg. /etc/apache2/sites-available/default) and you will see a <directory> element for your site (careful, there could be a few different <directory> elements floating around, be sure to pick the right one). This will have an AllowOverride attribute which is likely set to None. This is the problem – if you want rewrite rules to take effect then AllowOverride should not be set to None. Try changing it to All. And hey presto, you should be good to go!

This thread on Ubuntu’s forums proved invaluable in explaining this.

Awesome Linux Media Center using XBMC

Sunday, July 25th, 2010

One of things I have been doing lately is rediscovering my music – inspired by talking to the some of the Amarok guys at Akademy this year! So I decided to go on a search for an Open Source Media Center solution and up popped XBMC. Now this project isn’t related to Amarok but that doesn’t stop it being way too cool for school! I’ve being tinkering with it for just a few days and it just works like a dream.

Installation on Kubuntu is simple

  • I just following the Install XBMC on Ubuntu HOWTO
  • In (KDE’s) System Settings -> Autostart, added XBMC Media Center to startup automatically on computer startup
  • From within XBMC itself, went to System -> Settings -> System -> Video Output and set the Resolution to be Windowed (as I usually want to be able to access my KDE desktop at any time)
  • Initially you will have no music library. Instead you will add a directory location containing your music via Add Source. Then you can browse the added location and choose to Scan Item to Library to build up your music library
  • By visiting System -> Settings -> Network -> Services you can Allow control of XBMC via HTTP by setting Port, Username and Password. If you know the IP address of the machine you are running XBMC on then you can simply browse to http://YOUR_MACHINE_IP_ADDRESS:PORT from any web browser enabled device to control your media center (for example http://192.168.1.7:6666). Note: XBMC must be running on the machine for this to work
  • Once you have your music library set up, you will notice that you cannot access it through the web interface. To enable this, simply edit ~/.xbmc/userdata/sources.xml by adding the following to the <music> element

    <source>
    <name>Library</name>
    <path>musicdb://</path>
    </source>

Of course, when I don’t need to a complete Media Center solution and just want to rediscover my music I fire up my beloved Amarok :-)

Simply adding a Linux Partition via fstab

Sunday, July 25th, 2010

Just add something like the following to /etc/fstab…

UUID=1208c5dc-d4a6-a7a2-8352-ab12ecd64412 /media/disk-1 ext4 relatime,errors=remount-ro 0 2

… where

  • UUID uniquely identifies the partition you wish to add (you can get the UUID for you drive using ls -l /dev/disk/by-uuid)
  • /media/disk-1/ can be changed to be location on your system – it’s where the partition will be added
  • I don’t really have a monkeys of what the other settings do, but I think they are more or less the usual defaults. Works for me!

Bang! Short blog post! Goodnight!

Hello Planet KDE! Ruby makes an appearance in Grantlee

Thursday, July 8th, 2010

So this will be the first time theirishpenguin makes it onto Planet KDE! And no better time – blogging straight from the KDE community feast that is Akademy! It’s been a superb week, in the stunning city of Tampere in Finland. It’s Day 6 of the event, a day which has been quite a Ruby-tinted one. First up, I had the pleasure of hacking on Grantlee, a Django-inspired string templating engine in Qt, with Stephen Kelly; adding Ruby support to the code generator example it ships with. Also, after talking to Cornelius Schumacher from OpenSUSE I learned that Ruby’s splashed all over the place – even helping power the OpenSUSE Build Service which allows packages to be easily built for any distro. Cool, eh?

Grantlee’s an interesting project already in use in Akonadi integration and KJots, providing an elegant templating solution. It’s available on gitorious.org in the Grantlee repo. It was good fun hacking on it, particularly useful picking up on some of Stephen’s Ninja skills with git! At least it gives a couple of Irish lads something to do while all the Germans and Spaniards are talking about the World Cup!

The organisation of Akademy 2010 has been top notch, from the welcome packs with all the details you need to get oriented – to the big screen for the footie in the hacker room. This was matched by the friendliness of everyone who turned up to the event and the local Finnish. Even these two fellows had a great time coding…

Duck typing at Akademy
I feel a duck typing joke coming on. Me too!

There’s been some interesting BoF (Birds of a Feather) sessions, in particular the KDE Bioinformatics session with Luca Beltrame and KDE for Scientists session, again with Luca and also Stuart Jarvis. Some of the ideas raised pushed me to start working on getting ActiveResource support into Qt on Rails, to make hitting remote APIs possible from a Qt client app.

Well it’s 15 minutes to kick off in tonight’s semi-final. If anyone out there wants to talk about anything Ruby, or get a quick demo of Qt on Rails, then feel free to ping me. You can comment to this post or find me on twitter (theirishpenguin).

Last night we went Dutch… Tonight who knows…