Ubiquity – Connecting the Web with language

Couple of days back I heard about Ubiquity, an experiment by Mozilla Labs to connect the Web with language that would make Web tasks much more easy and fun to deal with for an average user. I installed Ubiquity and I'm already fascinated by how certain painful day to day tasks can be done easily by combining few commands. The initial version, Ubiquity 0.1 comes with loads of features including working with maps and insert maps to anywhere you want, translate on-page, search google, search wikipedia, digg, twitter, lookup and insert yelp review, get the weather, syntax highlight any code you find, convert a URL to tinyurl and the list goes on. Its definietly a worther try.
Make sure you go through the Introduction to Ubiquity which has most of the information you need to know about Ubiquity. Don't forget to watch the video which explains how easy it is to do certain Web tasks using Ubiquity.
Also read the Ubiquity 0.1 User Tutorial which has some nice tips on how to use Ubiquity and also has some valuable information about how to extend Ubiquity by adding new commands.
Have fun..
Getting LAMP to work in Ubuntu Hardy

Few of my friends who switched to Ubuntu lately, asked me how to get LAMP (Linux, Apache, MySQL, PHP) working in their desktops. Most of them have installed Ubuntu 8.04 (Hardy Heron) so I planned to write a small guide on how to setup a LAMP development environment. This will require to have an Internet Connection since the installation will download the necessary packages from the repositories. I will also explain how to add Virtual Hosts so that we can setup different environments to each website we create. I will also explain on how to enable Apache modules such as Userdir and Rewrite. I would normally enable Userdir module on development environments because it allows me to quickly test my code in my home directory. Rewrite module will enable features like having Search Engine Friendly URLs if we can write few Rewrite rules in the .htacess file.
Getting LAMP installed is quite easy in Ubuntu 8.04. I will be using the command-line in this small guide.
Open command-line terminal by going to Applications -> Accessories -> Terminal
First Update the repositories
sudo apt-get update
Install Apache2 – PHP5 – MySQL5 in one go
sudo apt-get install apache2 php5 mysql-server-5.0
Installation will take a while depending on your Internet Connection speed to download the necessary packages. You will be prompted to enter the MySQL Server root password. Enter the password and that's it. Apache2, PHP5 and MySQL5 will now be installed in your computer.
Now open a Browser Window, most probably Firefox and in the address bar type http://localhost. You will get a message like It Works! in the browser which means Apache is successfully installed. The default webroot directory will be /var/www/ where you can place a phpinfo page to check whether PHP is installed successfully as well. But this directory is not writable by the user. So we might need to sudo and write to this directory. Later in this guide I will explain how to test files that resides in my home directory.
Create PHP info page to check whether the PHP installation was successful
sudo gedit /var/www/info.php
Copy the blow code in the editor.
1 2 3 | <?php phpinfo(); ?> |
Save the file and close the editor.
Now goto http://localhost/info.php. If you see the PHP Info page then PHP is also successfully installed.
Now we need to check whether MySQL is installed successfully as well. In the terminal type
mysql -h localhost -u root -p
Enter the root password you entered during the installation process. If you are able to successfully login and see the welcome massage and the MySQL command prompt, MySQL is also installed successfully.
I would then install PHPMyAdmin, a web based GUI to handle MySQL Databases.
Install PHPMyAdmin
sudo apt-get install phpmyadmin
You will be prompted to select the server type, select apache2.
We will then restart Apache to make the changes in effect
sudo /etc/init.d/apache2 restart
Now goto http://localhost/phpmyadmin/. If you see the PHPMyAdmin login page then it is also installed successfully.
Though we now have everything in place, saving files into /var/www/ can be an issue during the development coz the user doesn't have permissions to write to this directory. We can overcome this by setting permissions to the user to write to this directory. But I always prefer having Userdir module enabled. If I assume my username is spider, I can save my files in a folder called 'public_html' under my home directory (/home/spider/public_html) and call it from the browser using the following address in my browser http://localhost/~spider/. But for this to work UserDir module should be enabled in Apache.
Enable UserDir module in Apache
sudo a2enmod userdirRestart Apache to make the changes in effect
sudo /etc/init.d/apache2 restart
Userdir module is now installed and working, so now we can save files in the public_html folder which you need to create in your home directory. But this method is good for testing small scripts. Its always advisable to create a Virtual Host for each project so that we can use a hostname for a website and have a directory apart from the default webroot associated with it. We can change certain behaviours while setting up a Virtual Host which allows us a better testing environment.
Setting up a Virtual Host
First we need to create a hostname associated with our local IP address. To do that we need to edit the hosts file
sudo gedit /etc/hosts
Add the following in a new line after the entry for localhost
127.0.0.1 myweb.local
Save the file and close the editor window.
myweb.local is our hostname where it can be any name except localhost
Now we need to setup a Virtual Host in Apache for myweb.local
We need to add a new file for the sites available for Apache
cd /etc/apache2/sites-available sudo touch myweb sudo gedit myweb
In the editor add the following lines.
<virtualHost *> ServerName myweb.local ServerAdmin webmaster@localhost DocumentRoot /home/spider/public_html/myweb/ <directory /home/spider/public_html/myweb/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </directory> </virtualHost>
Save the file and close the editor window.
Make sure you have created this directory /home/spider/public_html/myweb/
Now we need to enable this site which is available in Apache. To enable the site simply run this command
sudo a2ensite mywebRestart Apache to make the changes in effect
sudo /etc/init.d/apache2 restart
Thats it. We have our new website running. In your browser goto http://myweb.local. You will see the new website which is located in the directory we assigned to this Virtual Host.
If you need more websites such as this, you can repeat this process.
If you didn't notice, in the Directory settings I set 'AllowOverride All' because I need mod_rewrite to work in this site. But we need to enable Rewrite module for this to work. If you don't need to override these settings set it to 'AllowOverride None'
Enable Rewrite module in Apache
sudo a2enmod rewriteRestart Apache to make the changes in effect
sudo /etc/init.d/apache2 restart
We now have mod_rewrite working as well. A .htaccess file with rewrite rules has to be placed in the root directory of this site to have Search Engine Friendly URLs working.
I hope this guide will help you to setup a LAMP development environment in Ubuntu 8.04. If you come across any issues please feel free to write to me using the comment box.
Happy Coding…
Cheat Sheets for Web Developers
I found this excellent list of cheat sheets for Web Developers. It even includes a cheat sheet for SEO. It will be really valuable for Web Developers to keep these cheat sheets in hand.
Cheat Sheets for Front-end Web Developers
Cheat sheets are helpful to have around because they allow you to quickly remember code syntax and see related concepts visually. Additionally, they're nice decorative pieces for your office.
In this article, you'll find 23 excellent, print-ready cheat sheets for HTML/HTML, CSS, and JavaScript (including MooTools and jQuery).
So go ahead – print out your favorites and pepper your workspace with these wonderful references.
lkgeeks.org – A blog aggregator for Sri Lankan FOSS/geek Blogs

Early this month I put up lkgeeks.org a Blog Aggregator for Sri Lankan FOSS/geek Blogs. This site is not intended to compete with other Sri Lankan Blog Aggregators but its goal is to let everyone read Blog posts only from the Blogs of FOSS/geek Bloggers. I'm a fan of Kottu, but it consists of Blogs from various categories and its too crowded. Its difficult to filter out Blogs that sounds more technical. So that kinda influenced me to start this site.
If you fall into the category of a SriLankan FOSS/geek Blogger send me the URL of your blog to nazly dot ahmed at gmail dot com. There is a review process and once its approved it will be added to lkgeeks.org.
My new ASUS X51R laptop and Ubuntu 8.04
After giving up my IBM Thinkpad laptop sometime back, I got used to working on Desktops for a while. But it didn't help me a great deal in organizing things when shifting my work from home to office and vice versa. So again I started hunting for a laptop that will fulfill all my needs. Finally I settled with an ASUS X51R notebook that comes with a Dual Core 2Ghz processor, 1GB RAM, 256MB ATI VGA Card, 120GB Hard disk, DVD Writer, Wireless etc.. It turned out to be good deal at the end so I went for it.

I loaded my OS of choice Ubuntu 8.04 Hardy Heron on this and everything went very smoothly except that I couldn't get the wireless working. By running lspci the wireless card was shown as Atheros Communications Inc. AR242x 802.11abg Wireless PCI Express Adapter which is an Atheros AR5007EG wireless card. The proprietary driver for Atheros was installed by Hardy but when I ran iwconfig this is what I got.
lo no wireless extensions. eth0 no wireless extensions.
Few google searches resulted me about madwifi. Madwifi is a team of volunteer developers working on Linux kernel drivers for Wireless LAN devices with Atheros chipsets. I got madwifi installed and got my wireless card working. Here is how I did it.
First I disabled both proprietary drivers in System -> Administration -> Hardware drivers.
Then in the command prompt I did the following
Get this version of madwifi
wget -c <a href="http://snapshots.madwifi.org/special/madwifi-ng-r2756+ar5007.tar.gz" target="_blank">http://snapshots.madwifi.org/special/madwifi-ng-r2756+ar5007.tar.gz</a>
Untar the file
tar xvf madwifi-ng-r2756+ar5007.tar.gzMove inside the directory
cd madwifi-ng-r2756+ar5007You might need build-essential if you haven't compiled anything before
sudo apt-get update && sudo aptitude install build-essential
Building madwifi and installing the modules
make sudo make install sudo modprobe ath_pci sudo modprobe wlan_scan_sta
Loading module at boot
sudo gedit /etc/modules
Enter the line below in the last line of the file and save.
ath_pci
Thats it. I restarted the machine and ran iwconfig again to check
lo no wireless extensions. eth0 no wireless extensions. wifi0 no wireless extensions. ath0 IEEE 802.11g ESSID:"" Nickname:"" Mode:Managed Frequency:2.437 GHz Access Point: Not-Associated Bit Rate:0 kb/s Tx-Power:17 dBm Sensitivity=1/1 Retry:off RTS thr:off Fragment thr:off Power Management:off Link Quality=0/70 Signal level=0 dBm Noise level=0 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0
As you can see its now showing that the wireless card is working properly. Thanks to madwifi.
When it came to my graphic card I had to use the ATI propriety driver to make full use of it. Since Hardy comes with compiz out of the box I managed to get the 3D desktop working without much hassle.
To get compiz working in Hardy there are two things to be done.
1. Goto System -> Preferences – Appearance and click Visual Effects tab. Then tick Extra to get the effects working.
2. Install the Compiz Settings Manager.
sudo apt-get install compizconfig-settings-manager
After installing you can goto System -> Preferences – Advanced Desktop Effects Settings to add/configure/remove effects related to compiz.
I also enabled Emerald themes to get out of the standard Gnome look. Here is how got emerald working.
sudo apt-get install emerald
Now if you goto System -> Preferences – Emerald Theme Manager you can configure an Emerald theme of your choice. By default it doesn't come with any themes so you need to download themes from Gnome-Look.
However you need to tell compiz to use Emerald as its Window Decorator. To do that goto System -> Preferences – Advanced Desktop Effects Settings and under Effects category click on the Window Decoration icon which will take you to its settings. In the 'Command' field delete whatever is in there and add this value to that field
emerald --replace.
Have fun..
I found a nice Emerald theme which kinda reflects the one used by Matt Farrell in the movie Die Hard 4.0. Here are few screeshots of my desktop.
3D desktop with compiz on Hardy

Firefox3 downloads hit 8 million mark

What a day it was, helping Firefox to set a new Guinness World Record. The Download Day is an awesome success I guess reaching more than 8 million downloads in 24 hours. It was supposed to begin at 10:00 a.m. Pacific Daylight Time on Tuesday, June 17th. It was 10.30p.m. here in Sri Lanka at that time when I tried to login to getfirefox.com but the site was down and all Firefox related sites were hit hardly by the massive crowd login in at that time. I tried couple of times but no response. Then my Internet connection got dropped may be due to a failure from the ISPs end for some reason. I couldn't login yesterday morning even but checked the progress at SpreadFirefox's Download Day page. Finally around mid-day I was able to download Firefox3 as I pledged. What a feeling it was. The people of Guinness will review the World Record attempt, so it will take a few days to know whether this made it to the Records.
KPs modified reverse sweep
England are on a roll after winning the Test Series against New Zealand. After that they have won the Twenty20 match as well the first One Day match as well. Keven Pietersen’s solid batting performances have been a major factor to England’s success. KP’s century in the first ODI was a highlight of the series. The reason being his modified reverse sweep hit for six creating some controversy. This is not the first instance that he has reverse swept for six. He became famous after his reverse sweep for six against Muralitharan in a Test match. But his unique style of reverse sweeping is the key. He in fact switches the hands before the ball being delivered making him almost like a left handed batsman. This created some controversy but he has been cleared by the MCC, the guardian of the laws of cricket. Hope he will regain the No.1 spot of the ODI batsmen list soon.
KP’s modified reverse sweep for six against Scott Styris
KP’s famous reverse sweep for six against Muralitharan
Make history with Firefox3
Are you ready to make history? Are you ready to set a World Record? Today is Download Day. To become part of the official Guinness World Record you must download Firefox 3 by 17:00 UTC on June 18, 2008, or roughly 24 hours from now.
-Email from SpreadFirefox
The Firefox3 Download Day has officially begun. For Sri Lankan's the cutoff time will be 10.30pm today. So go download Firefox3 by this time. Don't forget to spread the word as well.
http://www.spreadfirefox.com/en-US/worldrecord
Here comes Firefox 3
Upto now1,375,759 people have pledged to download Firefox 3 to set a Guinness World Record for the most no of downloads for a software when its released on 17th June 2008 which is today. 1,711 Sri Lankans are in that list so make sure you download Firefox 3 when its released.
The date/time for the Firefox 3 Lauch Party here in Sri Lanka will be announced soon. So be ready for that as well
do yuo hvae a sgtrane mnid?
When I open my mailbox 50% of them are forwarded emails. My junks are filtered with 99.9% accuracy so I don't worry about them. Most of forwarders I ignore and don't fall into the trap of being asked to forward it to more and more people. There are times I read them for the fun of it, some are useless where some I find it interesting. This email I got today has been circulating for a while now I mean for a good 2-3 years if I remember correctly but I felt that I have a strange mind too after reading it ![]()
Finally as usual it asks you to forward the email. But what did I do? I posted in on my blog instead. How stupid am I? ![]()
This is weird, but interesting!
fi yuo cna raed tihs, yuo hvae a sgtrane mnid too
Cna yuo raed tihs? Olny 55 plepoe out of 100 can.
i cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg. The phaonmneal pweor of the hmuan mnid, aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it dseno't mtaetr in waht oerdr the ltteres in a wrod are, the olny iproamtnt tihng is taht the frsit and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it whotuit a pboerlm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Azanmig huh? yaeh and I awlyas tghuhot slpeling was ipmorantt! if you can raed tihs forwrad it










