Friday, 11 November 2011

New Blogger ate my blog post

I had written a blog about Ubuntu's decline and posted it about 8 hours ago. I wanted to edit it to put some lines in unordered list format. I selected the lines and clicked on the bullet button and it took an additional line under the bullet format. So I pressed Ctrl+Z to undo it. However, to my surprise, the whole blog post was deleted. The contents are gone and not recoverable any more. I also checked Google cache; but it was not there obviously as it was only some hours old.

Speeding up KDM

For some time, I have been noticing that KDE Display Manager (KDM) slows down after every version bump. I was of the idea that this was because KDE was becoming bloated. However, CPU usage of KDE had started declining after version 4.4. So, I was sure that KDE was actually not getting hung up in the background any more. However, till 4.7 the KDM load time kept increasing. As a matter of fact, after the recent update, KDM became so slow that I had to restart my system twice before actually getting to KDM. In fact, during the first two restarts, I was thinking that my installation was broken after the update.


I sometimes browse through the bugzilla to check over recent bugs to find if any of them are related to me. After the update, I decided to look up bugzilla to check if I am encountering a common problem. And, Bingo! The very first bug was about KDM slowing down. There was a suggestion about updating font cache to avoid slow startup of KDM. It can be done using the following command:


fc-cache -fv


I tried it and the next time KDM was loaded very fast indeed. The bug was closed by the Arch linux maintainer with the following comment: "Some font package (maybe unofficial) doesn't run fc-cache after its installation or its removal." However, I think a deeper investigation should be made before closing the bug. I have been a number of instances in Arch linux bugzilla when the bug is closed without sufficient investigation. Arch developers pass the buck to upstream developers very fast.

Sunday, 30 October 2011

Funny Windows

I am using Windows 7 Service Pack 1. Windows might have got a bit more secure and flashy than Windows XP; but it continues to be funny. Today morning only, I encountered the following queer incidents.

1. In the (My)Computer window, I wanted to see Properties for each drive. So, I directly right clicked on them. However, each time it took me to System Properties. To get to Properties of a drive, I had to first select the drive and then right click on it again and select Properties.

2. While cleaning up my C: it showed 730mb will be cleared. Before cleaning, my C: had 6.77gb free and after cleaning it had 8.33gb free. Strange calculation indeed.

3. Last night, I had just put the lid of my system down and slept. According to my Settings, the system should have gone to Sleep mode too and most likely it did. In the morning, I was unable to connect to my wireless network. After banging my head for being forced to use such a system that does not offer any clue as to what the error was, I decided to try a restart. During restart, I found some disk corruption was causing the trouble. [Using Linux on the same machine for years, never gave me a disk corruption.] Also interestingly after recovering from corruption, I found that my wireless card was set to configure to IP address 192.168.190.1 with subnet mask 255.255.255.0 though I had set it to obtain the IP address automatically.

Sunday, 18 September 2011

Using Emacs for development

When I started working with linux, I had the choice of the following text editors:
  • KEdit
  • Vim
  • Emacs

I decided to try all of them. After initial try, I was certain I would not use vi. It just did not suit my tastes. KEdit turned out to be limited in functionality. So, Emacs became my editor of choice. Initially, I was using it for trivial tasks only. Gradually as I knew more about it, I started using it more.

Compiling and debugging in emacs was fine. However, I was missing code navigation features which really come in handy during code reading phases. Searching through the world wide web, I found this blog explaining the use of etags with emacs for code navigation. I gave it a shot and it surely is fast. While working with python, I found emacs' support for python is not that good; but I am sure it will improve soon.

Arch linux: my perspective

When I finally found an article covering Arch linux, I thought its time I write about the distribution I have been using for over two years. I switched to it from openSUSE. I have been a KDE user all along; seen transitions from stable 3.x to current 4.7.

I am a minimalist and Arch fits right in. It sure is "bleeding edge". Today only Chromium 14 was released and it was available in Arch repositories. In contrast in Gentoo, another rolling release distribution, the policy is they stabilize a package after a month without any bug reports about it. Due to this policy, Gentoo is still at Firefox 3.6.x while Arch provides me latest Firefox. Even when Firefox released an update after the DigiNotar issue, Arch also pushed the update to its repositories. With Gentoo's policy, it certainly is more stable. As Arch provides, bleeding edge software, you need to understand how to act/react when there are inconsistencies. Only yesterday, hit three bugs: filed one in KDE directly, another in Arch and another in Enlightenment. Another time, I was getting a bug related to valgrind because I had an updated version of it as Arch had pushed the update much before any other distribution. I should probably also mention that Arch released a patched version the following day.

Arch is really simple in the sense at the system level. I was able to create init scripts for Arch far more easily than on Gentoo for the same package. Arch however is not as configurable as Gentoo is. No distribution can match or even come close to Gentoo in this regard. It uses a unique system for this called USE flags. With Arch I can not have a custom KDE; but with Gentoo I have a large number of options as to what I want to have and what not. This flexibility of configuration in Gentoo comes at a price: every package is compiled on your system.

I have provided comparisions with Gentoo because it is the only distribution that has comparable features. Both of these distributions are in a way close to me. On my home desktop, I have Gentoo installed; but on my laptop where I do most of my development tasks, I use Arch linux and I do not see a distribution switch in near future.

For me, Arch surely is a base platform to do what I want to do. I have so to say three distributions in one: a distribution that provides nice command line environment, another that provides nice and stable KDE. I have even stopped akonadi and nepomuk search from starting up at all as they started mysql instances and I was not using any of them. The third one provides latest Enlightenment desktop. I compile it instead of using the packages in the repositories so that I am up to date and also to get debug symbols compiled in.

There have been some issues with Arch from time to time though. For example, the Ricoh card reader on my laptop works fine for some kernel versions; but does not work with others. Arch surely is not for the beginners. However, for advanced users, it provides a lean system which can be tweaked to taste.

Monday, 12 September 2011

Recovering Gentoo linux after changing hard disk channel

On my system I have two hard drives a 40 gb old one [reminiscent of the times when that much was enough] and a new one of 1tb. Initially both of them where on channel 2: the new one was the master disk while the old one was the slave disk. When I installed Gentoo, I tried

fdisk -l

and found the new one to be /dev/sda while the old one was /dev/sdb. So while installing grub, I assumed the following mapping:
hd0 --> sda --> 1tb hdd
hd1 --> sdb --> 40gb hdd

Grub was installed successfully and dual boot was working fine. [For those readers who are curious about getting a dual boot system, the best place is to look at the handbook.] However, when I got a new DVD writer, the old hard disk was connected at channel 0 as slave and the new one was connected at channel 2 as master. My BIOS was set to boot from the new one and Windows booted fine but I could not boot into Gentoo. So, I decided to fix it and chrooted into my Gentoo installation from the minimal install iso that I had put on to a usb stick using unetbootin. [Recently there have been questions about the performance of unetbootin. I would just like to add that when I tried unetbootin from Windows it failed me thrice with different distributions. However, when I tried it from linux, it worked just fine.]

From within the chrooted environment, I ran

fdisk -l

and found the old hard disk was now sda and the new one was sdb. So, I assumed the following mapping while reinstalling grub:
hd0 --> sda --> 40gb hdd
hd1 --> sdb --> 1tb hdd

However, when I rebooted, grub showed error 17. A quick look at Grub error collection shows that I had somehow got root(hdX, Y) wrong. While talking about the issue on #gentoo, I found that hd0 is actually the drive the BIOS is set to boot from. So, my assumed mapping was incorrect and it turned out that hd0 was being mapped to 11tb hard drive. So, I went into the BIOS and changed it so that the correct mapping was followed.

P.S. To know more about grub read this article.

Tuesday, 6 September 2011

Office not working in Archlinux



After dropping of OpenOffice.org, Archlinux switched to LibreOffice from the Document foundation. As this was pushed through a regular update, I went on with it. However, after some time when I tried opening Office files, I was having trouble opening them at all.
I used to get stuck at this filter selection every time I opened a file. When I opened up LibreOffice, the various files options were grayed out.



I thought of checking the wiki for the procedure of installation. I reinstalled it using the following command:

pacman -S libreoffice-common libreoffice-{base,
calc,draw,impress,math,writer,kde4}


pacman -S libreoffice-extension-{pdfimport,presentation-minimizer,presenter-screen,report-builder,wiki-publisher,ct2n,hunart,numbertext,oooblogger,typo,watch-window,diagram}


After that, I was able to get things working again. However, interestingly, each time I had upgraded my system after the switch to LibreOffice, using

pacman -Syu

I had seen these packages were installed. Now there is only one issue, tooltips are just black rectangles.


Friday, 2 September 2011

Firefox responds to fake certificate issue

Recently, we have seen false SSL/TLS certificate issued by DigiNotar causing trouble to a lot of people. The Tor project's blog describes it at length. Details of such vulnerabilities are detailed here. Firefox has been fast in responding to this. They have released an update which basically prevents its users from becoming a victim.


Wednesday, 24 August 2011

Broadcom wireless on Arch linux

My wireless card is Broadcom Corporation BCM4311 802.11b/g. When Broadcom had not released open source drivers, I was using b43 drivers according to Archlinux wiki. These drivers worked fine till kernel version 2.6.37. From the next kernel version, it started trouble me as described in this bug. I switched to broadcom-wl and things worked fine once again. However, starting from kernel 3.0.x, each time I update my kernel, I have to recompile my drivers using

makepkg -f

and reinstall them using

pacman -U ./<package name>.xz

Now I can successfully connect to WPA networks; but not to WEP networks.

Wednesday, 10 August 2011

Micromax USB Modem in Archlinux

Using Micromax 3G USB modem in linux is quite simple. You can use usb_modeswitch as suggested in this wiki article. However, I think only wvdial shall suffice. Start out with dmesg output or look in /var/log/dmesg.log.

dmesg

OR

cat /var/log/dmesg.log

I got the following lines as I inserted the USB modem.

[21003.558081] usb 1-1: new high speed USB device number 6 using ehci_hcd
[21004.356112] option 1-1:1.0: GSM modem (1-port) converter detected
[21004.356269] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB0
[21004.356381] option 1-1:1.1: GSM modem (1-port) converter detected
[21004.356470] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB1
[21004.356576] option 1-1:1.2: GSM modem (1-port) converter detected
[21004.356658] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB2
[21004.356766] option 1-1:1.3: GSM modem (1-port) converter detected
[21004.356874] usb 1-1: GSM modem (1-port) converter now attached to ttyUSB3
[21004.359305] scsi10 : usb-storage 1-1:1.4
[21005.364898] scsi 10:0:0:0: Direct-Access     USBModem Disk             2.31 PQ: 0 ANSI: 2
[21005.365401] sd 10:0:0:0: Attached scsi generic sg2 type 0
[21005.367980] sd 10:0:0:0: [sdb] Attached SCSI removable disk


I spotted the modem as /dev/ttyUSB3. So, I promptly modified my wvdial configuration to recognise this device.

Modem = /dev/ttyUSB3

The rest of the configuration of wvdial depends upon your ISP. You can look into my previous post for configuration for BSNL.

Thursday, 7 July 2011

GridFTP on Archlinux

After having globus-gridftp-server and myproxy-server work on Gentoo linux, it was easy to convert the scripts to work on Arch linux. Following their guide, I tried myproxy-server at first and it worked nicely. Actually in their guide they should mention about ensuring that the executable is in PATH.

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

GLOBUS_LOCATION=/home/phoenix/gt
DAEMON=myproxy-server
ARGS=

[ -r /etc/conf.d/$DAEMON ] && . /etc/conf.d/$DAEMON

PID=$(pidof -o %PPID $DAEMON)

case "$1" in
 start)
   stat_busy "Starting $DAEMON"
   [ -z "$PID" ] && $GLOBUS_LOCATION/sbin/$DAEMON $ARGS &>/dev/null
   if [ $? = 0 ]; then
     add_daemon $DAEMON
     stat_done
   else
     stat_fail
     exit 1
   fi
   ;;
 stop)
   stat_busy "Stopping $DAEMON"
   [ -n "$PID" ] && kill $PID &>/dev/null
   if [ $? = 0 ]; then
     rm_daemon $DAEMON
     stat_done
   else
     stat_fail
     exit 1
   fi
   ;;
 restart)
   $0 stop
   sleep 1
   $0 start
   ;;
 *)
   echo "usage: $0 {start|stop|restart}" 
esac


Now, getting the script for the gridftp-server working was a bit tricky as I had to pass the parameter for the port number and also to get it work as a daemon. I tried to provide the parameters from /etc/conf.d/gridftp-server; but somehow it was not reading the parameters from that file so I had to provide it in the rc script itself.

#!/bin/bash

. /etc/rc.conf
. /etc/rc.d/functions

export GLOBUS_LOCATION=/homephoenix/gt
export LD_LIBRARY_PATH=$GLOBUS_LOCATION/lib
source $GLOBUS_LOCATION/etc/globus-user-env.sh
DAEMON=globus-gridftp-server
ARGS="-S -f -p 2811"

[ -r /etc/conf.d/$DAEMON ] && . /etc/conf.d/$DAEMON

PID=$(pidof -o %PPID $DAEMON)

case "$1" in
 start)
   stat_busy "Starting $DAEMON"
   [ -z "$PID" ] && $GLOBUS_LOCATION/sbin/$DAEMON $ARGS &>/dev/null
   if [ $? = 0 ]; then
     add_daemon $DAEMON
     stat_done
   else
     stat_fail
     exit 1
   fi
   ;;
 stop)
   stat_busy "Stopping $DAEMON"
   [ -n "$PID" ] && kill $PID &>/dev/null
   if [ $? = 0 ]; then
     rm_daemon $DAEMON
     stat_done
   else
     stat_fail
     exit 1
   fi
   ;;
 restart)
   $0 stop
   sleep 1
   $0 start
   ;;
 *)
   echo "usage: $0 {start|stop|restart}" 
esac

Tuesday, 5 July 2011

GridFTP on Gentoo

The Globus Project provides gridftp as one of the modules of its toolkit. I got the source and followed the quickstart guide to start the installation. However, the guide tells you how to run myproxy-server and globus-gridftp-server as xinet daemons. Although Gentoo provides xinetd package, that is not their preferred way of handling daemons. They use their own init scripts. So, I have tried to do it their way. My first script was for myproxy-server.

#!/sbin/runscript

start() {
    ebegin "Starting myproxy-server"
    start-stop-daemon --start --exec /home/titu/soc/gt/sbin/myproxy-server    eend $?
}

stop() {
    ebegin "Stopping myproxy-server"
    start-stop-daemon --stop --exec /home/titu/soc/gt/sbin/myproxy-server
    eend $?
}


My next script was for starting globus-gridftp-server as a daemon; however this process has having problems when I tried it the way I did for myproxy-server. Sometimes start-stop-daemon was not returning and sometimes start-stop-daemon was unable to stop. I tried to store PID values in a pid file by asking start-stop-daemon to create the pidfile by using -m option. However, it turned out that the PID in the pidfile was always slightly less than the actual PID. It was most likely because of forking. So, I modified the script using killall.

#!/sbin/runscript

start() {
    ebegin "Starting globus-gridftp-server"
    start-stop-daemon --start -b -e GLOBUS_LOCATION=/home/titu/soc/gt -e LD_LIBRARY_PATH=/home/titu/soc/gt/lib --exec /home/titu/soc/gt/sbin/globus-gridftp-server -- -S -f -p 2811
    eend $?
}

stop() {
    ebegin "Stopping globus-gridftp-server"
    killall globus-gridftp-server
    eend $?
}


It is essential to set environment variables for the gridftp server.

Sunday, 3 July 2011

Automounting NTFS flash drives in Gentoo

Recently, I noticed flash drives with ntfs file systems on them were nicely automounted on my KDE on Archlinux. However, when I tried it in GNOME on Gentoo, it showed me an error message. Initially I thought if it is a desktop environment issue; but automounting is usually done by udev. So I decided to check for udev and ntfs-3g driver.

emerge -pv udev ntfs3g

I found that the ntfs3g package had "udev" USE flag disabled. I douted this might be the reason. To verify I ran a quick check using the following command.

equery u ntfs3g

I found "udev" USE flag installs udev rule to make udisks use ntfs-3g instead of the kernel NTFS driver. So, I
enabled it by adding the following line to /etc/portage/package.use

sys-fs/ntfs3g udev

Re-emerging the package solved the issue and I can nicely automount flash drives with ntfs filesystems.

Friday, 1 July 2011

What happened to Thunderbird 4?

I have been using Mozilla Thunderbird since version 2.0. Recently I saw a version bump directly from 3.x to 5.0. This is because Mozilla wanted to keep the version numbering same as Firefox. From the release notes, the main reason for such a bump seems to be the new Gecko 5 engine.

Recently Firefox versions have come up very fast. By the time add-ons became compatible with Firefox 4.x, Firefox 5.0 was out and some add-ons are incompatible with it. Mozilla should slow down the release cycle, decide what it wants to implement as part of its next release cycle and provide a feature rich and stable browser.

Wednesday, 29 June 2011

Removing slotted libpng in Gentoo

While upgrading my Gentoo system, I upgraded gentoolkit package and I got a message saying asking me to run the following command.

glsa-check -p affected

Running it told me that there are no upgrades available for libpng-1.2.44. I found out that there were multiple versions of libpng installed on my system:
  • libpng-1.4.5 and;
  • a slotted version, i.e. libpng-1.2.44.

The solution was to remove all versions of libpng and freshly install it. This can be achieved using the following command.

emerge -C libpng && emerge -1 libpng:0

Friday, 24 June 2011

Mouse vs keyboard


Over the years, we have had a conflict between two groups of users: GUI-friendly and CLI-friendly. Mostly the CLI-friendly people think that the keyboard is faster than mouse while the GUI-friendly people think that the mouse is faster. A research by Apple shows that actually it is the mouse that is faster in most cases although people think the keyboard to be. However, it is not the metrics that matter; but the mentality that is developed.

A programmer typing in full flow is very unlikely to break his flow and hold the mouse. He probably would prefer the whole window to be controllable from the keyboard. That way the interface is letting the programmer do his job without being distracted towards using a mouse. Emacs is a classic example of this.

However, people who work primarily with the mouse like desktop users who are copying files or playing music can use the mouse with ease letting the other hand rest.

Apple and Microsoft provide a nice GUI interface and are doing good business because most of their users are GUI-friendly. However, linux allows choice. There are great GUI windows managers like Enlightenment and there are also tiling window managers like awesome.

Wednesday, 22 June 2011

Commandos II: Men of Courage multiplayer mode glitch

Recently I have been playing Commandos II: Men of Courage, with my brother, in multiplayer mode. We have played the game in single player mode numerous times; but this was out first multiplayer experience. We found synchronizing glitches in the game.
In the following image you can see two views: one on my screen and one on my brother’s. The same enemy soldier has different positions on the two screens.
comd1
Moreover, when I killed the enemy soldier using the Green Beret my brother’s system would show that a fellow Commando has died and mission failed. The same was shown to me if he took the soldier down with the Sapper. We tried to let the game recover by continuing the game trying to get the Green Beret meet with the Sapper. Interestingly as the Green Beret was alive on my system, he showed up with the Sapper and Lupin while on my brother’s system it was only the Sapper and Lupin.
comd2
When we had encountered a similar error within a closed room, I thought it was a glitch in coordinate calculation. However, I was wrong as proved by this incident. Clearly there is a concurrency issue here.

In the mission "Is Paris Burning?", there was another glitch where an enemy soldier picks up a cigarette from a distance. Look for the 14th second and the 57th second in the video.


Monday, 20 June 2011

Installing Google Talk plugin in Gentoo linux

Google provides Google Talk plugin as rpm or deb packages for 32-bit and 64-bit architectures. To get it on Gentoo when you try

emerge -pv google-talkplugin

you can see that it is masked by license. It means you have to accept the license before installing. You can find all licenses at /usr/portage/licenses. To get a specific license try

ls /usr/portage/licenses | grep google

You can read the license and if you accept it then add a line to /etc/portage/package.license to reflect it. In this case, the line would be

www-plugins/google-talkplugin google-talkplugin

and in general it is:

<full package name> <license name>

Now when you try emerging it you get a message saying that the license does not allow mirroring. This is why the fetch restriction is in place. The message also tells you to download the .deb package suitable to your architecture and put it in /usr/portage/distfiles. The problem is Google provides you current version and not the version considered stable by Gentoo. Moreover, the version 1.8 which is considered stable by Gentoo is not available according a Gentoo bug [I wish I had found that out earlier].

So the 1.8 version ebuild is for those who have a copy of the older Google Talk plugin. All others have to unmask the newer version according to their architectures. I had to add the following line to /etc/portage/package.keywords.

=www-plugins/google-talkplugin-2.1.6.0 ~amd64

Now portage can fetch it for you. However, if you have already downloaded latest version of the plugin then you can use the command as root to copy it to you distfiles folder and portage will not have any checksum error either if the versions have not changed.

cp -v Downloads/google-talkplugin_current_amd64.deb /usr/portage/distfiles/google-talkplugin_2.1.6.0-1_amd64.deb

Now portage will not have to redownload the package.

Saturday, 18 June 2011

Bootcharting Gentoo baselayout 2

In this post I shall share my experience of yet another Gentoo installation. I keep coming back to this distribution for its stability, wonderful package management and the experiencing fine grained control.

I have been using KDE for over six years now. I wanted to try GNOME 3. However, as I found out GNOME 3 is not yet stabilized in Gentoo so I had to be content with GNOME 2. They are stabilization by the next release. I believe that it for good reason. Well GNOME 3 does not support Compiz. There are no multiple timezone clocks.

Having prior experience in installing Gentoo linux, I knew that following the handbook strictly you have to wait for downloads while there is compilation going on and vice versa. So this time I chrooted not from a single terminal but from multiple terminals. I could run package downloads separately using

emerge -f <package name>

and compile concurrently on a different terminal using

emerge <different package>

After installation, when I booted the system hung up.

Hung up Gentoo bootscreen

I read a line saying

Ext3-fs: couldn't mount because of unsupported optional features(240)

Adding the following to the kernel line solved the issue.

rootfstype=ext4

However, I was still getting a hung up system. If I inserted or removed USB drives, I was getting appropriate messages printed on screen; but the system was not responding to any keystrokes or mouse, neither was it loading X. Only the error line was gone. So, I understood that it was not the filesystem issue that was causing it. Asking on #gentoo I found that it was a common issue caused by the switch to baselayout 2. Instead of old init scripts Gentoo had started using openRC. Last time  heard about it was about a couple of years ago. It was a nice project started by Roy Marples. However, now it was stable and I was happy to be using it. My issue was solved following Alex's suggestions for the issue.

I wanted to see the boot time with baselayout 2 and openRC so after I had other installations I did a boot chart to find much faster boot than my previous installation on the same machine.
Also noteworthy was the fact that X worked out of the box and I was surprised to see Firefox 3.6.17 in stable tree. I was expecting Firefox 4.0. Well I hope it is stabilized soon.

Tuesday, 7 June 2011

Reading extended file system partitions in Windows

Ext2 and Ext3 partitions can be read in Windows using the open source driver available at sourceforge. However, windows does not treat files in a case sensitive manner as does linux. So if you have two files "data.txt" and "DATA.txt" on your linux partition, Windows will only be able to show you the contents of "data.txt".

Monday, 6 June 2011

Getting nice fonts embedded in Blogger

Recently I have been hearing and reading a lot about typekit. So, I decided to find out how it can be useful to me. It basically is about getting nice fonts across browsers. It is a web service that provides font. The idea is really cool.

So I decided to try it out. They offer 25000 page-views per month and two fonts per site. I don't like either of these restrictions, especially the second one. So, I looked for alternatives and I found Google Web Fonts.

Using Google web fonts is very easy. You just need to select a font and then click on the Use this font tab and you have the instructions about how you can use it in your web page.

Font-face backed out because Google entered this market. However, you still have other alternatives like WebINK.

Friday, 29 April 2011

AWS Signature mismatch with python-boto

With python-boto 1.9b4, connecting to Amazon Cloud services using the following commands

>>>from boto.ec2.connection import EC2Connection
>>>conn = EC2Connection(<your AWS key>, <your secret key>
>>>conn.get_all_instances()


failed an error message as follows:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/site-packages/boto/ec2/connection.py", line 119, in get_all_images
return self.get_list('DescribeImages', params, [('item', Image)])
File "/usr/lib/python2.7/site-packages/boto/connection.py", line 615, in get_list
raise self.ResponseError(response.status, response.reason, body)
boto.exception.EC2ResponseError: EC2ResponseError: 403 Forbidden
<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.</Message></Error></Errors><RequestID>kept-out-of-post</RequestID></Response>


The issue disappears when you update to python-boto 2.0b4.

Altering django models

I wanted to add a column to an existing django model; but django does not support modifications to existing models so when I added a line to models.py and ran syncdb, I found no change. The workaround was to manually edit the schema in mysql (or your preferred database backend).

alter table <table name> add column <column name> varchar(512);

Sunday, 24 April 2011

Using CSS files in Django

In Django, cascading style sheets are served as static content. To begin with create the following URL mapping in your urls.py


from django.conf import settings


urlpatters = patterns (
   #other patterns
   (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
)


In settings.py set the following variables.

MEDIA_ROOT = '/home/user/site/static'
STATIC_URL = '/css/'

All css files are put in the css folder and can be referred to in templates as /static/css/filename.css.

Generating public and private keys

Asymmetric keys are often used so I shall describe two ways of generating them. Using openssl we can generate them as follows:

openssl genrsa -out key.priv 1024
openssl rsa -in key.priv -out key.pub -pubout


The key pair generated above can be used as follows:
- distribute the public key so that messages can be encrypted using the public key
- use the private key to decrypt them

Whenever there is the need for a password, the ssh format for RSA and DSA keys can be used. An ssh key-pair can be generated in the following way.

ssh-keygen -t rsa -b 2048

Thursday, 24 March 2011

Interesting CAPTCHA

We easily overlook obvious and simple solutions. Many websites use CAPTCHA to authenticate users and differentiate them from programs. However, programs are evolving and they are cracking the CAPTCHA visual test for authentication.

Recently, I came across a website that uses CAPTCHA to fool programs. Here is a screenshot explaining how.

Tuesday, 8 March 2011

The Beauty of a Gentoo installation

I have installed various linux distributions so far but Gentoo installation has an unmatched beauty to it. It is special because you can stop the installation and resume it at will. You just need to chroot back in if you have not completed the base system installation. Once the base system is installed, you can keep adding features at your pace and suiting your internet speed.

Unlike other distributions, Gentoo offers very fine-grained control over the packages you install and what features those packages have enabled. This is done using USE flags.

If you are looking a graphical installer that does its job without asking you much, this is not for you; but if you want robust control with proper dependency checking and stability, Gentoo is the right choice for you.

While other distributions have trouble connecting to the internet from their install environments, Gentoo minimal install environment had Intel Wireless microcode (iwl3945-ucode) and I could connect to a WPA network and do the installation.

Support on #gentoo sets Gentoo apart from every other distribution. I have solved problems of other distributions on this channel. Every time you have an issue, you can find someone here to help you out.

The beauty of the installation process lies in the freedom and the host of options that it allows you.

Sunday, 6 March 2011

Connecting to WPA networks

Wireless networks using WEP keys are not very secure. WPA keys should be preferred over WEP keys. To connect to a wireless network on linux, first store the passphrase in a configuration file with the following command:

wpa_passphrase "<your essid>" "<your passphrase>" > /etc/wpa_supplicant.conf

Set up WPA handshaking using

wpa_supplicant -Dwext -iwlan0 -B -c/etc/wpa_supplicant.conf

The option -Dwext specifies that generic linux wireless drivers should be used. The -B flag tells wpa_supplicant to work in the background. The -iwlan0 option specifies wlan0 as the interface for communication. Now set up dhcp client on wlan0 using

dhcpcd wlan0

Thursday, 3 March 2011

Robust Firefox

Today an interesting incident occurred which reassured by trust in Firefox's robustness. Well I was downloading gentoo minimal install image in Google Chrome and after 80mb, the download speed had gone down to some bytes per second. When I started a parallel fresh download, I was getting a speed of about 60 kbps. So, I decided to try and get Chrome download the rest of the original file at about 50 - 60 kbps. I tried the following procedure:

- copy the install*.chrdownload file (i.e. the temporary file into which the file was being downloaded) into some other folder
- cancel the download
- start a fresh download
- pause it
- overwrite the new .chrdowload file with the old one

However, this trick did not work with Chrome. It was still downloading more than 100 mb as if it were the fresh download.

I opened up Firefox and applied the same procedure except for renaming the .chrdownload file to .part file and Firefox intelligently downloaded only what remained of the file completing the download in minutes.

Thursday, 10 February 2011

Removal of hal improves boot time

I upgraded my kernel to 2.6.37, removed hal and KDE to 4.6 and experience improved boot times now.

Monday, 7 February 2011

Chromium and Firefox: a comparision

Well I have been a hard-core firefox fan for a long time. However, recently I have found some improvements on the chromium front, that are worthy of notice.

The battle started when Chromium started using Webkit and V8, one is a fast web page rendering engine and the other is a fast javascript engine. Firefox fell behind for some time; but those are old days. I shall just brief on some points of comparision between Firefox 3.6.13 and Chromium 9.0 on Arch linux x86_64.

Firefox:
- It is very stable. I have not seen it crash for over a year now.
- With AdBlock Plus by Wladimir Palant, I can easily get rid of ads as well as unwanted iframes, images etc.
- With Ghostery, I can easily get rid of tracking sited too.

Chromium:
- Its is stable for use but not as stable as Firefox.
- It does not work with a number of sites. I have been posting such sites since when it was in version 4. Even in recent versions (8.0 and 9.0) there still are sites that don't work well with it.
- It however works fine with those sites that are tailored to work with Internet Explorer and not on Mozilla Firefox.
- AdBlock or Ghostery are not completely supported on Chromium yet.

Saturday, 5 February 2011

KDE 4.6 review

I was eagerly awaiting for kde 4.6 because I would be able to remove hal from my system after installeing it. So, as soon as kde 4.6 was available on Arch linux repositories, I got it installed. I was thrilled by some features and disappointed by some others. This review is about those.

Pros:
- The first thing I noticed was faster response. It spurred my interest in finding other improvements in kde 4.6 over previous versions. I do not know the reason why I am experiencing faster response; yet it is the best feature for me.

- Finally, KDE guys have done away with HAL. My other desktop environment, Enlightenment had switched to udisks, upower etc. So, I have been waiting for KDE to get rid of it.

- ksnapshot is improved. It is allowing two nice options:
     * hide mouse; and
     * hide window decoration.
KSnapshot

- KDE 4.6 has some delights in terms of graphics. The new wallpaper by Nuno is really cool. There are icons for compiled html files (chm) and also for portable compiled format(pcf) files. There is a new pointing cursor too.

Cons:
- I found a funny problem with knotes. I had saved a note as "typing <td>"; but it was transformed to "typing ".

- There are no icons for jpeg files yet. Neither are there any icons for deja vu(djvu) files.

Thursday, 27 January 2011

Improvement for Google Instant

Today, while using Google Instant, I noted that if the query included "site" specification, Instant does not work. Any query of the following form fails with Google Instant.

<search text> site:<site where the search text is to be looked up>

Increased spam in my gmail inbox

For about a month, I had been noticing increased spam in my gmail account. Gmail used to be known  for its spam filters. People used to advise to redirect other mails to gmail so that spam is filtered out well. However, things seem to be changing. I am posting a few spam email ids.
From Reply-to
mabanks@ic.sunysb.edu inf22@msn.com
elcytchandy@hotmail.com jdetwiler1@comcast.net
info@winner.com instantclaims@live.co.uk
ibgranny@sbcglobal.net marutisuzukijobs2011@live.com
g-karen@sbcglobal.net g-karen@sbcglobal.net
jilani@pasteur.fr cox16@live.co.uk
hana.jilani@pasteur.fr mic_04@live.com
jilani@pasteur.fr cox16@live.co.uk
info@videocon.com info@video-con.co.cc
rallahiq@insurebc.ca mic_04@live.com
osirodjohnson@gmail.com inf44@live.com
info@live.in marutisuzuki.recruit2011@gmail.com

It is interesting to note the high frequency of "inf" and "live.com" terms in the email addresses. It is also interesting to note how most of them have their "to" email addresses pointing to "undisclosed-recipients:;" and talk about lotteries worth £500,000,00 in the United Kingdom. They also include phone numbers from United Kingdom.

Saturday, 22 January 2011

Setting up a software project

Recently, I have started a software project with a few of my friends. I shall speak about how I set up communication media for the project. We started with creating a secret group in facebook. That way we are able to discuss the project even when we are at our homes. Facebook also has functionalities of creating documents for the group. However, facebook chat is not quite reliable as a group chat and it does not support voice. [It reminds me of good old yahoo chat days. :) ] Document creation feature is in no way an alternative to attachments and code sharing. So, the next step was to create a mailing list.

With a mailing list, now we can have interleaved replies, no need to refer to the line we are replying to. Moreover, with a mailing list we can share documents easily as attachments and everyone can look into the other's progress at his/her convenience. For group chat, we started an IRC channel on freenode and used skype for voice chat in group.

Now, we were all set for discussing any ideas we had at any time. We only lacked in a tool for sharing code efficiently. We opted for a code hosting site. I preferred a distributed version control system over a centralised one because we expect a lot of code merges. Moreover, due to fluctuating internet, having the ability to commit locally would be an advantage. So, we opted for mercurial(hg) hosting at www.bitbucket.org. Mercurial is a mature distributed version control system and bitbucket has a feature rich user interface. Now, we are all set for the project and hope it turns successful.

Monday, 3 January 2011

Search Engine Blacklisting extension

Recently, Jason Chen released an Chrome extension to blacklist spam websites in search engine results.
The extension is under active development and is for testers now. As far as I remember, there have been tools for this by McAfee and AVG. However, I believe that such blacklisting should be done at the server side. It is funny sometimes how search engines like Google have fake sites topping their results.