Nazly's BLOG

Welcome 2009

Posted by Nazly on Thursday, 1st January 2009 13:16:58 (GMT +0530)

"Before the sun sets in this year, before the memories fade, before the networks get jammed, I didn't wish, because my wishes come with the new sun and new day.I Wish u and ur family Happy Sparkling New Year 2009"

The New Year has dawn and had a tough time going through all the text messages and trying to reply to them. But I didn't manage to reply to them all but picked the message above to publish here which was bit different from the standard way of wishing. So a Happy New Year to you all. Let the dawning year bring you Peace and Prosperity.

I just can't imagine how the last year flew away leaving a lot of good memories, a year that brought lot of new things into my life. I started 2008 by getting married, which was a 180° turn in my life. My life style changed a lot after that but I managed to keep my geekhood alive. If you didn't see my blog being updated much, now you know why. But I still managed to post in between my busy work schedule. The last few months was more a restructuring period of my life both work and personal, so that's the reason why my last post it dated back to September. This year I vow that I will do my level best to keep the blog alive with loads of information in time to come.

The tough decision came somewhere in the middle of last year when I had to quit my previous workplace and take up a new challenge. It was a tough decision but I took it. I was at Cenango for almost four years and I do miss all the colleagues I used to work with and the great moments at Cenango. Thanks to all the guys who supported me throughout specially during the tough times and made me what I'm now.

Switching from a two wheel ride to a four wheel drive was the best thing that could happen to me at the end of the year for me. I don't want to erase my past memories I had with my hoodless ride as I used to call it, specially the days I used to get wet like nothing by the time I get home. :D[BigGrin] It served me well for more than three years and still serving for short rides since I have no plans of selling it.

So all and all it has been a great last year and ready to face the challenges that are awaiting this year. I wish you all the very best in what ever you do.

Thanks to all!!!
Comments (0)

CHMOD recursively

Posted by Nazly on Monday, 29th September 2008 14:04:58 (GMT +0530)

Time to time I come across this problem when I have to move large portions of directories and files from one location to another. Mostly after extracting from tar archives. The directory/file permissions are often messed up depending on the source I copied them or based on the way I copied/archived them. So I used to use this technique to CHMOD directories and files recursively. Today when I was using this I thought of blogging it for my own future reference. If there is a better way feel free to comment.

CHMOD directories only
find . -type d -exec chmod 755 {} \;


CHMOD files only
find . -type f -exec chmod 644 {} \;

Comments (2)

Ubiquity - Connecting the Web with language

Posted by Nazly on Wednesday, 3rd September 2008 16:54:42 (GMT +0530)

http://www.nazly.net/imgs/ubiquity_side.png

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..
Comments (2)

Getting LAMP to work in Ubuntu Hardy

Posted by Nazly on Monday, 21st July 2008 16:44:05 (GMT +0530)

http://www.nazly.net/imgs/ulamp.jpg

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.

<?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 userdir

Restart 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 myweb

Restart 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 rewrite

Restart 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...
Comments (3)

Cheat Sheets for Web Developers

Posted by Nazly on Wednesday, 9th July 2008 14:56:09 (GMT +0530)

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.

Comments (1)

lkgeeks.org - A blog aggregator for Sri Lankan FOSS/geek Blogs

Posted by Nazly on Tuesday, 8th July 2008 13:24:59 (GMT +0530)

http://www.nazly.net/imgs/lkgeeks.jpg

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.
Comments (3)

My new ASUS X51R laptop and Ubuntu 8.04

Posted by Nazly on Saturday, 21st June 2008 15:31:19 (GMT +0530)

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.

http://www.nazly.net/imgs/x51r.jpg

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 http://snapshots.madwifi.org/special/madwifi-ng-r2756+ar5007.tar.gz

Untar the file
tar xvf madwifi-ng-r2756+ar5007.tar.gz

Move inside the directory
cd madwifi-ng-r2756+ar5007

You 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
Desktop 3D Cube

Desktop with new look theme
New notebook new theme
Comments (10)

Firefox3 downloads hit 8 million mark

Posted by Nazly on Thursday, 19th June 2008 11:11:22 (GMT +0530)

http://www.nazly.net/imgs/ff3dd.jpg

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.
Comments (0)

KPs modified reverse sweep

Posted by Nazly on Wednesday, 18th June 2008 12:24:03 (GMT +0530)

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






Comments (1)

Make history with Firefox3

Posted by Nazly on Wednesday, 18th June 2008 11:06:22 (GMT +0530)

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
Comments (0)