Archive for category ICT
Embedding a MP3 in a Drupal Site
So, after many many hours of searching the web to find a way to embed a MP3 player in a Drupal content item, I have finally found the answer. It’s much more straight forward than I thought as it doesn’t rely on Modules at all.
You simply add the following text to your content item:
<object type="application/x-shockwave-flash">
<param name="movie" value="/modules/audio/players/1pixelout.swf" />
<param name="wmode" value="transparent" />
<param name="menu" value="false" />
<param name="quality" value="high" />
<embed src="/modules/audio/players/1pixelout.swf" flashvars="soundFile=http://yourfile.mp3" width="290" height="24" />
</embed></object>
You will need to have your content format set to “Full HTML” to do this (or “PHP code” I suppose).
I actually found the answer here and thought it was worth reproducing.
World Bank Data
The World Bank has decided to make its development data freely and publicly available.
You can see it all at http://data.worldbank.org/.
The World Bank has always been public enemy number one for me (maybe number 2, the IMF is in hot contention). However, it must be applauded for this initiative.
The data is provided in a range of formats and even has an API so that developers can easily interact with it.
The World Bank have pointed to the work of Random Hack of Kindness as their inspiration for the initative.
Now all I need is a project that utilises this data. Any suggestions?
LAMP installation on Ubuntu with Mod_Rewrite
So there is plenty of information out there about installing a standard LAMP server out there.
I’ve had a LAMP server on my Ubuntu laptop for quite some time. But i ran into troubles when I wanted to have a CakePHP installation on my local machine because I couldn’t get Apache’s mod_rewrite to work.
I’ve finally figured it out, and, given the difficulty I had finding the information I thought I should probably share my experience with the world.
So, firstly, installing LAMP. In case you’d missed it, LAMP stands for Linux, Apache, MySQL, PHP.
You’ve already got the Linux part, so I just went through the Synaptic Package Manager and installed the following repositories (you can find a much more detailed description here and here):
- apache2
- php5
- mysql-server
- php5-mysql (may be installed by default with the mysql-server package – sorry, can’t remember)
- phpmyadmin
- webmin (a very helpful program
Read what others have written on this topic as well though.
Next, in order to give yourself permissions to the /var/www/ directory, you need to run the following command in your terminal:
sudo chown -R $USER:$USER /var/www/
It’s not a secure thing to do (I don’t think) but it will make your life much easier (no permissions to worry about, no need to “sudo nautilus”).
Finally, getting mod_rewrite to work.
First, initiate it with the following command:
a2enmod rewrite
Then edit the file /etc/apache2/sites-enabled/000-default. You can do this with the following command:
nano /etc/apache2/sites-enabled/000-default
Then change the “AllowOverride None” to “AllowOverride All” in the “
In other words, when you run the nano command above you see the following in amongst some other stuff:
Options Indexes FollowSymLinks MultiViews
AllowOverride none
Order allow,deny
allow from all
Change the AllowOverride to ‘All’.
Then restart your server with the following command:
sudo /etc/init.d/apache2 restart
And you’re done!
Disclaimer: I’m a terrible systems admin and make no guarantee for the above. However, it did work for me which makes me happy.
Why I choose Linux (part 382)
My laptop is now reaching old age. It’s over 3 years old and it’s starting to get a bit clunky. Time for a new one this year sometime.
I want a 13″ laptop as portability is an issue. So I started to look at the usual laptop vendors, Toshiba (which I currently have) and HP* were the two I checked out. As well as Mac.
You can get some reasonable 15″ laptops for around $1,200 which would suit my needs… if they were 13″. But as soon as you go with the smaller model it adds at least $1,000 to the price (often $2,000) and the processor significantly deteriorates in speed (almost halves in some cases).
Which leaves me with the MacBook. 13″ at around $1,200 with an Education discount.
There’s no denying the quality of the Mac hardware. The screens are nicer, they have the multi-touch touch pad, they are thin etc. But I just don’t was to run the MacOS. I prefer Linux.
There are a range of reasons but the primary one is that Mac locks you into Mac stuff, Linux just doesn’t. I hate iTunes and I hate iPhoto. If you want to take full advantage of the MacOS then you need to use these two programs and once you’ve done that you’re locked into them. You can’t reclaim your music (without significant hassle) once it’s in the iTunes library. Anything else just feels like a perpetual workaround.
I’ve got a huge personal commitment to Open Source Software and data longevity is a big reason for this.
So i’m going to buy a MacBook in the next 12 months, and I’m going to install Linux on it so that all my data is free forever, not locked into am over-hyped OS that could well go out of fashion one day and leave you with a bunch of music you’ll never be able to listen to again.
(Cue Mac Fanboys who are the second biggest reason I hate Macs. Actually, I don’t hate Macs (I use one at work) I just prefer Linux.)
*If you know of a laptop brand that matches a 13″ MacBook please let me know.
Why my site is blacked out
As you may have noticed, the first time you visit my site this week you will get a blanked out page with a message about the proposed internet filter.
It’s just a little protest and hopefully an awareness raising campaign. It’s run by the Electronic Frontiers Foundation who I recommend throwing a few dollars to.
We’ll resume normal service next week.
CakePHP and JQuery
A few months back I had the good fortune to come across JQuery. It change my life and made AJAX a breeze. In fact I simply don’t use straight Javascript any more, I only use JQuery.
About a month or two ago I also discovered the CakePHP development framework. Similarly, it seems to have changed my life (watch this space for my first CakePHP-based website).
Can you see where I’m going with this?
I wanted to be able to add JQuery to the CakePHP site that I am working on. It’s quite simple to do but I couldn’t really find anywhere that told me how to do it explicitly and I thought it might be worth explaining what I did here.
The first step is to have a functioning installation of CakePHP and a copy of JQuery.
You’ll need to put your JQuery file somewhere that CakePHP will be able to find it. As it turns out the best place would be /app/webroot/js/
Incidentally, this is also where you should include any external Javascript files. In the first instance I usually create a file called ‘javascript.js’ which includes all my Javascript calls.
So this leaves us with a directory structure that looks something like:
app/webroot/js/
jquery.js/
javascript.js/
Next, we need to include this file in the appropriate layout. If you haven’t done so already, it is most likely that this file will be called default.ctp and will live in app/views/layouts/. Now all you need to do is include the $javascript::link() method in your layout file.
In this case I’ve included the following line in my head tag:
< ?php echo $javascript->link(array('jquery.js', 'javascript.js')); ?>
And you’re done (of course it wouldn’t hurt you to go and read about the CakePHP Javascript Helper here). You can now proceed as usual and with the help of the HTML helper things might get easier yet.
Karmic Koala
Ubuntu 9.10 is out, Karmic Koala, and I love it.
I got back from a trip away, created a USB stick launcher (VERY easy – hadn’t done that before), booted off the USB and away I went. The installation process has always been very easy with Ubuntu and continues to be. It’s always been a LOT easy than Windows to install but of course Windows always comes pre-installed so most people wouldn’t realise that.
So, what’s new and what do I like about it:
It just works
More so than previous versions of Ubuntu, this one ‘just works’. I haven’t had to use the command line once. I realise that a few people had a few hicups, and I don’t think that 9.04 ever resolved the video driver issue it had with the Intel Cards, but this time, it was all seamless for me.
Improved Power Management
Suspend, Hibernate, Sleep etc. They all work beautifully. This has been a weak area until now. It probably still has some way to go before it catches up with Mac on this one but Mac will always have the advantage of building an operating system that is built for a very specific set of hardware.
New Look
Long overdue and much improved. They are obviously making headway here and I suspect that 10.04 will be better still. It feels a little inconsistent at the moment with the boot up bit having a very different look and feel to the main desktop but, as I say, getting better. The new icons are an important improvement.
New Login Screen
Prettier, easier. Boot times still seem very good as well. Not sure how much quicker it is than previous editions, seems about the same to me, but I’m assured that it is the quickest boot time yet.
There’s probably more and I’ll update this post when I think of it but all in all I’m really impressed. Just the ease of use improves more an more every time.
Update:
Dual Screen monitor support has regressed for me – at least in terms of going sVideo into my TV. It really only seems to work when I Mirror screens which means both resolutions suffer. Hopefully this will work a bit better after a couple of updates.
RiP Trailer
Just in case the post below doesn’t entice you to come along to the Australian Centre for Democracy and Justice’s screening of RiP, hopefully the trailer will:
