Archive for the 'Software' Category

Reading Malayalam Websites in Ubuntu (non unicode ones)

Unicode fonts are the best for publishing Malayalam (my native language) content on the web. But many of the popular regional sites such as Malayala Manorama and Deepika still use custom fonts which works on ISO encoding.

In Windows, these fonts are automatically supported. When it comes to Ubuntu, what you see is a jumbled set of characters. Following set of instructions will help you reading Deepika in firefox. Follow a similar procedure for other sites.

1. Install the custom font. For Deekipa, Malayalam font can be downloaded from http://www.deepika.com/font.htm. Download this to a folder and then using terminal go to the folder. Now copy the font to /usr/share/fonts,

sudo cp mlkr0ntt_TTF.ttf /usr/share/fonts

2. Refresh the Ubuntu font cache. For that run the following command,

sudo fc-cache -fv

3. Close all firefox sessions and reopen firefox. Go to www.deepika.com. Now from the firefox menu select the following,

View => Character Encoding => Western (ISO-8859-1)

Now you should be able to see some Malayalam characters!

Installing Adobe flash player on Ubuntu 7.10

These days flash player is a must have plugin for browsers. Without it you cannot a lot of video sharing sites such as YouTube. By default Ubuntu doesn’t come with flash player since the Adobe flash player is proprietary. So I did,

jayson@jayson-desktop:~$ sudo apt-get install flashplugin-nonfree

Everything went smooth till the last step where I got,

Download done.
md5sum mismatch install_flash_player_9_linux.tar.gz
The Flash plugin is NOT installed.

It turns out that Ubuntu does a MD5 checksum check on the packages it install. Unfortunately Adobe changed the flash player installer sometime in December. So what to do?

The solution is to manually install flash player. Ensure that you close all the browser windows before doing this.

# get the flash player tar
wget http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player_9_linux.tar.gz

# extract the tar file
tar xvf install_flash_player_9_linux.tar.gz

# run the installer
cd install_flash_player_9_linux
./flashplayer-installer

# specify the firefox folder during installation
/usr/lib/firefox

Thatz it. Now you can watch flash videos on Ubuntu!
This also shows why it may be better for your grandma to stick with Windows! :-)

Migrating from Windows to Ubuntu

I recently uninstalled Windows from all my machines and installed Ubuntu on them. There are two reasons for this,

1. I don’t want to buy a new Windows license whenever I buy a new machine. I already have spent over Rs. 10K on Windows licenses and is not ready to pay again!

2. Ubuntu supports all my hardware out of the box! Even WiFi cards(NetGear) and WiFi adaptors (Dlink DWL-G122)  are supported when you boot Ubuntu.

It has been a smooth transition. One of the things that I enjoy a lot is the Pidgin IM client. Now I can login to all my IM accounts at once. Hence I got in touch with old friends on some of my old IM accounts!

Here is quick re-cap of what I did,

  • Booted using the latest ubuntu release - 7.10.
  • Deleted all existing partitions on my 80GB disk.
  • Created a root partition of 6.5GB and a swap partition of 1GB. I kept these partitions below 8GB since on M2N-MX motherboard, grub is having problems booting from a partition over 8GB!
  • Installed the following software using apt-get - Java 1.6, Aptana IDE, unrar, Lyx, Ruby1.8.6 and Rails2.

Enabling single sign on - Web applications in WebSphere 6.0

Recently I came across a requirement to enable single sign on between two different Web applications running on different machines but on the same domain. WebSphere does provide out of the box support of single sign on, but figuring it out took a lot of time for me. So I have written this step by step guide so that you don’t have to go through the torture again!

All the screenshots in this guide are taking from Rational Application Developer (RAD). I could configure everything except “roles to groups mapping” directly from RAD’s console. For configuring “roles to group mapping” I had to export and deploy the application from an EAR file.

1. Enabling WebSphere security

Check out the following screenshot which shows the settings I have selected under Security->Global Security.

Global security settings

a) LTPA is required when the Web applications are on the different machines but on same domain.

b) I used a custom user registry which checked the users against a database. A more common approach is to use LDAP.

2. Click on the “custom” link under user registries in Security->Global Security. Following settings were selected on this page.

a) userid and password given is a valid user id in the database.

b) MyUserRegistry implements com.ibm.websphere.security.UserRegistry interface and is copied to the “classes” folder inside WAS home folder.

3. Click on “LTPA” under authentication mechanisms. Single sign on can be enabled by clicking on the “Single Sign On” link on the right.

The above three steps completes the “Global Security” setup on WAS. Now we will configure JAAS for applying this security at the Web application level.

1. Configure web.xml of the application. This involves protecting Web resources using security-constraint entry. Following is a sample entry,

    <security-constraint>
        <web-resource-collection>
            <web-resource-name>Protected Area</web-resource-name>
            <url-pattern>*.do</url-pattern>
            <http-method>DELETE</http-method>
            <http-method>GET</http-method>
            <http-method>POST</http-method>
            <http-method>PUT</http-method>
        </web-resource-collection>
        <auth-constraint>
            <role-name>operator</role-name>
        </auth-constraint>
        <user-data-constraint>
            <transport-guarantee>CONFIDENTIAL</transport-guarantee>
        </user-data-constraint>
    </security-constraint>     
    <login-config>
        <auth-method>FORM</auth-method>
        <realm-name>MyApp</realm-name>
        <form-login-config>
            <form-login-page>/logon.jsp</form-login-page>
            <form-error-page>/logonError.jsp</form-error-page>
        </form-login-config>
    </login-config>

2. Implement a login page for application which conforms to WAS standards. Following is a sample page,

<html>
  <title>Login</title>
  <body>
  <form method=”post” action=”j_security_check”>
     Enter user ID and password:
     User ID: <input type=”text” size=”20″ name=”j_username”>
     Password: <input type=”password” size=”20″ name=”j_password”>
     <input type=”submit” name=”login” value=”Login”>
    </form>
</body>
</html>

3. While deploying bind web.xml roles with groups from UserRegistry. For simplicity you could also attach the entire role to “any authenticated user”.

Some common errors and their solution,

1. When I start RAD after enabling Global Security, it is in “starting” mode forever!

Open soap.client.props in base_v6\profiles\default\properties folder and add the userid and password fields as shown below. The userid/password must be the same as the one given on “custom user registry” page.

com.ibm.SOAP.loginUserid=test
com.ibm.SOAP.loginPassword=test

Run the following command on the command as shown. Replace the cell name and node name with the values on your machine. This reconfigures FileTransfer application with authentication.

D:\Rational\runtimes\base_v6\bin>wsadmin wsadmin.bat -profile redeployFileTransf
er.jacl -c “fileTransferAuthenticationOn machine97622Node01Cell machine97622Node01
 server1″ -user test -password test

2. I am getting the following error,

Authentication failed for user: com.ibm.ws.console.security.ConnectToRuntimeException: null nested exception is com.ibm.websphere.security.CustomRegistryException

This means that custom user registry is not loaded. Ensure that you restart RAD after copying custom user registry class. Also ensure that custom user registry class is under classes folder (base_v6\classes on RAD)

3. I have an error which is not listed above?

Check the trace.log inside base_v6\profiles\default\logs\server1 folder. This should give a lot of information about the underlying problem. If you are still unable to resolve the issue, contact me!

Running Debian on your Windows PC

In this article I will show you how you can convert your Windows XP machine to run linux distributions such as Debian without risking your partition table! You would be wondering what I mean by “risking your partition table!”. Well, last week I had installed Ubuntu on my Windows PC and it had replaced Windows boot loader with Grub. After a while I decided to remove Ubuntu. I opened up the disk administration tool in Windows and re-partitioned the disk to free up the space used by Ubuntu. Then I realized that my Windows system won’t boot anymore! I had use the “Windows recovery disk” and then issue a “fixmbr” to fix my system.

This week I decided to try out Debian and this time I decided to install it on a virtual PC running on top of Windows. This has many advantages. First, there is no risk of corrupting your partition table. Secondly, you can easily add or remove more distributions. Thirdly, your WiFi may not be recognized by Debian net-install, but NAT translation by VMware ensures that WiFi is accessible as ethernet! Another advantage is that you can easily switch to Windows if you want to watch TV on your “Windows only” TV tuner card! :-)

There two leading virtual pc softwares in the market. Microsoft virtual pc and VMware server. Both these are free! I prefer VMware since almost any OS works on it.

Download Debian

You can download Debian ISOs which range from 30MB to 12GB! I decided to download 30MB network install ISO, which is a very minimal ISO.  If you use this, the components required for a base system will be downloaded during installation through an ethernet network available for your virtual machine. Also ensure that you download an ISO suitable for your hardware. For me it was an amd64 version(64 bit AMD processor).

Installing VMware

You can download latest version of VMware server from here (about 150MB).  You would also need to register to get your free serial key.  VMware asks for this key at the last step of configuring a new OS!

When you startup VMware, first you get “connect to host screen”. Select “localhost” since you are not trying out remote hosts.

From the File->New Click on “Virtual Machine”. This is used to configure a new virtual machine to run a different operating system.

1. Select “custom” for virtual machine configuration.

2. Select “Other linux 2.6.x kernel 64-bit” as the guest operating system. If you are not using a 64-bit system,use “Other linux 2.6.x kernel”.

3. Now select the file and directory for the new OS. Ensure that you select a disk which has enough space for the new OS.

4. For access rights, you can decide to make it private (accessible only for your userid) and accept defaults for the startup/shutdown options. You will need to change it if your account doesn’t have administrator privileges.

5. Allocate 50% of your total RAM for the new OS. I have 2GB total RAM and allocated 1GB for Debian.

6. Use NAT for networking and create a new virtual disk and accept defaults (SCSI). Allocate enough space of the virtual disk. I have 8GB for Debian.

Now you need to configure the downloaded Debian ISO as a CD Drive so that Debian installer will start when you boot up your new virtual PC. For this edit the new virtual PC and change the CD configuration as shown below,

vmware-new-pc3.png

Now start your new virtual PC from VMware. Now you should see the following Debian boot console.

 VMware and Debian

Follow the prompts and complete the Debian installation. Debian will download the required components by connecting to internet. If you don’t want this, you can use the complete Debian ISOs (instead of the 30MB business card version).

After installation, the first package I installed was the command line internet browser “lynx” by issuing the command,

apt-get install lynx
 

Restarting my linux love - the debian way

I have dabbled in linux long time back but never took it seriously. But this week something triggered inside me and I have decided to give it another try. My cousin sunil is a linux guru and with his blessings I have restarted my linux love! :-)

But hey, I have no intention to chuck Windows out. After all I have paid over Rs.6000 for it! So instead I decided to use Vmware (which is a virtual pc server and is now free!) as my new machine and install Debian on it.  Check out the Debian social contract to see why I am interested in Debian.

Earlier when you run linux on Vmware it used to be slow. But not anymore! With my machine (amd64 with 2GB RAM) speed difference is hardly noticeable!  Another advantage is that with NAT networking on Vmware, your Wifi network will appear as an ethernet network for the virtual pc!  (Configuring WiFi on Debian business card ISO seems to be almost impossible).

So I downloaded business card version of Debian (33MB) and I am currently running the net-install from it.

Debian on Vmware

Software to manage personal finance - acemoney lite

One  of the simplest software to manage personal finance is the Acemoney lite from MechCAD. If you don’t want all the fancy stuff offered by Microsoft money or similar tools, Acemoney is the ideal choice.

My basic need is to track all the expenses over a period of time and then analyze it to see where my money is going. For this purpose I found Acemoney extremely useful. You can also export your expense/income details as a csv file or XML file.

The installer itself is less than 2MB and there are no adware or spyware with Acemoney lite. Only limitation is that only one account can be created on the lite version. For me, that is not a limitation at all!

AceMoney Lite screenshot

My new photo blog and pixelpost

Some of you would have already noticed the new photo blog link on this site. This photo blog is powered by PixelPost, a CMS exclusively for photo bloggers. It is pretty easy to setup and like WordPress, you can customize it using themes. For my blog, I have taken the “simple” theme and modified it a bit to have comments on the same page. I have named the changed theme as “simple reloaded for PixelPost” and it is released under the license  Creative Commons Attribution 2.5.

Photos are a very powerful medium. Every photo tells a story and for the photographer it is a very intimate story! These photographs will give a glimpse of my life.

My first lesson in PHP/Wordpress plugin development

Recently I had released a WordPress plugin - Google Blog Search Preview. I had tested it over two webhosting providers and everything seemed perfect. But within a week of release, I was getting reports of this plugin failing on certain installations. Well, it turns out that I had coded my plugins in PHP5.

The error was,

Parse error: syntax error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or ‘}’ in /home/brodopr/public_html/brodo/wp-content/plugins/jj_gblogsearch.php on line 15

Unfortunately many sites still run WordPress on PHP4. The biggest problem is that object oriented features in PHP is very different between version 4 and 5. For example, the static keyword is not available in PHP 4 which I was using in my plugins!

So the first lesson in WordPress plugin development - Test your plugins in both PHP 4 and PHP 5 installations! WAMP server even has a plugin which allows you to switch between PHP4 and PHP5. So that was easy!

I have released version 1.1 of Google Blog Search Preview  which works on PHP4 and PHP5. You can download it here. Many thanks to Carlo and Len for reporting this problem.

Timeline of linux

Checkout this interesting timeline of linux evolution. You can see that debian based distributions are getting pretty strong!

Evolution of linux

New machine, ubuntu and a cool torrent client

AMD64Today I assembled a brand new computer! The idea is to use it exclusively for programming. Since the new one is not intended for gaming or for any high end stuff I kept its configuration minimum. Here are the basic specs,

1. AMD Athlon 64 X2 3800+ processor
2. Asus M2N-MX motherboard
3. 2GB DDR2 533 RAM
4. Seagate 160GB SATA
5. Wireless mouse and keyboard

UbuntuTotal price for the components was below Rs.20,000 ($450) and I have decided to keep it free of Windows. So right now I am downloading the latest stable version of Ubuntu, the hot new linux distribution! The server edition has LAMP builtin and hence I can straight away jump into some PHP coding.

The fastest way to download anything is to use a torrent distribution. Fortunately ubuntu also has files on torrent network. Today I tried out a new bittorrent client - utorrent. This is free of any adware or spyware and the download is just below 200K! It is hard to believe that people still produce optimised code! :-) Give it a try, you may decide to use it instead of your current bittorrent client!

Releasing Google Page Rank plugin 1.0 for Wordpress

Google Page Rank Today I am releasing my second plugin for WordPress - The WP Google Page Rank Display 1.0.  You can use this to show off your Google Page Rank in the WordPress blog. This is superior to other plugins out there due to two major reasons,

1. Page Rank value is cached for 24 hours and hence means minimum load on Google servers and on your blog.

2. There are no external dependencies for this plugin.

Google Page Rank indicates the value of your site assigned by Google search engine. It varies from 0 to 10. For example, http://www.google.com has a Page Rank of 10. Higher page rank means higher traffic from Google search engine.

For more details on the Google Page Rank Plugin and for downloads please visit the plugin page. If you have any comments, suggestions or bug reports please contact me.

Wordpress Plugin - Google Blog Search Preview

I do most of my programming during weekends. This weekend I decided to write a WordPress plugin. I also wanted to improve my recently acquired PHP skills.

WordPress dashboard displays incoming links from Technorati. This is very useful since it lets you know who are discussing about your blog (not all have trackbacks enabled). But sometimes not all links are visible on Technorati. So I supplement it by doing a “link search” on Google Blog Search.

What if I display the Google Blog Search incoming links also on the WordPress dashboard? Hence this plugin! This plugin uses rss library of WordPress. I wanted to do Ajax, but there isn’t any “native” support for Ajax in WordPress :(

Do checkout Google Blog Search Preview Plugin!

Software developers are idiots when it comes to usability - the SSL saga

I have 3 broadband networks at home. I use BSNL 900+UL, Asianet WOW 199 and Reliance Netconnect. My main network is BSNL which is quite stable at 256kbps. Asianet is the backup which gives speeds upto 2MBPS. Reliance netconnect using USB modem is the final backup and I use it whenever I am on train or bus or on the beach thinking about hot babes like maria sharapova (don’t worry, it is a gimmick to get more traffic!).

As I have posted earlier, I recently upgraded IE 6.0 to IE 7.0. Also Firefox was upgraded to 2.0.0.3. Everything looked smooth until today.

Today being the last day of the month, I wanted to check the Asianet WOW 199 usage. The maximum I can use is 700MB/month and I just wanted to see what is left and download something (paris hilton photos perhaps?)

So I switched my Wifi connection to Asianet and clicked on the account usage link. The login screen came and I typed in user/password and clicked go. Following is the screen I got on IE 7.0.

IE 7.0 SSL error screen

As you can see the error is quite informative. It is as useful as a britney spears album is to a seminary (oops I did it again, the traffic bait!).

The error looked suspicious since login page and account page were served from the same server. Anyway I called up customer care and they sweared that the server is infact working!

Ok, probably IE 7.0 has some bug. So I tried the Firefox 2.0 to login, and here is what I got,

SSL error on Firefox 2

Thank god! Atleast it says there is something wrong with SSL! This error is much more useful than the IE 7.0 error. But still I have no clue what is happening. The idiots who coded this error decided that I don’t want to know how to access the site.

But I want to. Otherwise I have no other way of getting my account info. So turned to the ultimate saviour of tech problems. The Google!

Ok. Here is the true picture. IE 7.0 and Firefox 2.0 decided to support only SSL version 3.0 onwards since previous versions of SSL (1.0 and 2.0) are insecure. But luckily in IE 7.0 there is an easy way to enable SSL 2.0 (which Asianet account page is using).

1. Click on Internet Options -> Advanced.

2. Under security, check the use SSL 2.0 checkbox.

The firefox 2.0 hack to enable SSL 2.0 is bit complicated. If you are itching to know about it, search in Google!

Now this incident clearly demonstrates why many Software developers are idiots when it comes to usability. Be it microsoft or the open source community, there are many who fail to understand simple user interface/communication principles.

I guess this also explains why geeks are incapable of getting girl friends like aishwarya rai!

Linking to localhost?

Ever wondered how many people are linking to localhost files from their websites or blogs? Today, I found out an easy way to get the latest localhost linkers!

I installed wordpress locally and was testing it using the URL http://localhost/. The incoming links section of the Wordpress dashboard showed the following blogs which are linking to localhost. Very funny!

Localhost linking!

If you check your localhost installation, you might find my blog as well! Pretty neat way to get more traffic - eh?

Internet Explorer 7 rocks!

Internet Explorer 7.0Today I upgraded Internet Explorer from version 6 to the latest version 7. The download requires genuine windows validation 3 times! Apart from that that 20MB download went smooth.

This review is based on my experience of using IE for just one hour! IE 7.0 simply rocks! The interface is sleek and the performance is unbelievable (for a microsoft product, that is  :-)) . Here are some of the interesting features of Internet Explorer 7.0,

1. Improved screen rendering. Now reading a webpage seems easier probably due to enhanced anti-aliasing.

2. Minimal, but effective UI - The UI is similar to Windows media player and is quite intuitive. All the frequently used features are easily accessible.

3. The tabbed browsing - This was probably the only reason I was using Firefox. IE 7.0 contains this feature and is better than Firefox when it comes to opening new tabs (new tab appears just near the old tab)!

IE 7.0 tabs

4. Reduced startup time - I have a 1GB, 1.8GHZ machine and IE 7.0 starts in a flash!

Another noticeable feature is the Live search which appears on the right of URL field. It is quite tempting to use it instead of Google, nice try Microsoft! :)

So overall, I am very much pleased with IE 7.0. If you are using IE 6.0, I recommend immediately upgrading it to IE 7.0 (If you have genuine windows  :-))

Hiding sub categories in Wordpress - a quick hack

Here is a quick hack to hide sub categories in Wordpress. This has the added advantage that even though sub categories are not visible, they will still get crawled by search engines. For example, the categories you see on the right are only the root categories.

All you have to do is to add the following line to the Wordpress stylesheet.

.children { display: none; }

This works because the secondary level categories have “children” as the style class.

Backing up your Wordpress installation on Dreamhost

I did a complete backup of this Wordpress blog yesterday. There isn’t much written, but loosing my blog entries is not something I am looking forward to! It is very important to backup your blog. I will give some reasons if you are not convinced.

First, this blog is hosted on Dreamhost. Recently many problems have been cropping up with dreamhost such as router disaster or network disaster or something like that. You never know when they will have a disk failure and it turns out that their backup tape/disk is unusable!

Secondly, Wordpress is not very secure if the recent events are any indication. The Wordpress 2.1.1 was modified by some deranged cracker. So it is quite possible that there are problems in Wordpress 2.1.2 also and if some nutcase decides to hack your site? Boom!!! - all your posts are gone..

How to backup my Wordpress blog hosted on Dreamhost?

The backup process involves two things. Backing up your blog database and backing Wordpress files which includes theme files modified by you. You must backup both.

Backing up Wordpress database - Backing up Wordpress database is very simple in Wordpress 2.1+. In earlier versions you need to install backup plugin. In Wordpress 2.1+ you can find export option under manage as shown below,

Backing up Wordpress 2.1+

Backing up Wordpress files including customized theme files - My host is dreamhost and I will explain how the Wordpress file backup can be done very quickly. If you use Windows explorer and try to copy everything, it can even take hours! This is because the dreamhost installation contains hundreds of themes you don’t use and also transferring thousands of files over FTP is very slow.

Here is a quick backup solution. Connect to the Dreamhost shell using Putty (A secure shell client). Go to your Wordpress installation folder and type the following command.

zip -r backupall.zip *

This will create a single zip named backupall.zip which contains everything. Now this can be quickly copied to your system!

Fighting comment spam in a Wordpress blog

We all are used to email spam. I get around 100 spam mails daily in my Gmail account. Thankfully most of these are identified as spam by Gmail and gets moved to spam folder automatically.

When I started this blog, I never thought that spam would be a major issue. Initially I haven’t added any comment moderation. Within a week, I started seeing spam comments mostly related to pharmacy and drugs. I started manually deleting spam and soon I realized it is not going to work.

In Wordpress, under options->discussion, there are a couple of spam fighting measures available. I enabled comment moderation which automatically puts a comment in moderation queue if it contains 2 or more links. I have also enabled common spam word protection. This means that any comment which contains words in this list will be automatically put into moderation queue.

The solved the problem for a few more days. Then I noticed that I have over 100 comments to moderate. Now sorting through 100 comments to find a genuine comment is not something you would cherish!

Wordpress provides something called comment blacklist. If any of the words in this list is part of the comment, the comment will be nuked. It will not appear in moderation queue. So I analyzed few spam comments and added the common words into the comment black list.

I had hoped that these measures would solve the spam problem. Soon I realized that I was too optimistic. I started getting a lot of comments and it contained black listed words with spelling mistakes! For example, the word viagra will appear as viegra or something similar.

Looking at the spam comments I noticed that all of them are coming from a set of specific IP addresses. So what I needed was a way to blacklist IP addresses.

In Wordpress, under manage->files you can see the .htaccess file. This can be used to block a specific set of IP addresses. So I added the following entries in this file (Substitute the actual IP address instead of 127.0.0.1)

order allow,deny
deny from 127.0.0.1
allow from all

So today, I have no comments to moderate. Thank god! :)

Notes

1. There are sophisticated spam fighting tools such as the Akismet which is distributed. I am yet to use it.
2. It is better to disable trackbacks. Tools such as trackback submitter is widely used by spammers.

Wordpress 2.1 upgradation and theme compatibility

This blog is powered by Wordpress blogging software installed on a dreamhost machine. Dreamhost is an employee owned Web hosting service and is popular with bloggers. Dreamhost offers “one click installs” for a lot of Web applications and Wordpress is one of them.

Within a week of Wordpress 2.1 release, Dreamhost has enabled an auto upgrade link! With a single click I could upgrade my existing Wordpress 2.0.5 installation to Wordpress 2.1. Before upgrading, I did take a backup of my blog (there was nothing much in it :)), but the upgrade went through without any issues.

But then I noticed that there were some database errors under the category link. First I thought it was due to some error in the upgrade script. But looking closer, I found that the problem was with theme I was using! Interestingly, Wordpress 2.1 release broke a lot of themes out there and mine was one of them. It was to be expected since 2.1 release had major changes.

And hence I switched to the typoxp theme. It appears to be an ideal 3 column theme for a “text heavy” blog.