MOHA Geo, Geo-IP web service

I started a geo-ip web service, MOHA Geo because I was disappointed with inaccuracies in HostIp, and the time they took to correct them after submitting corrections.

I’m using MaxMind geo-ip data for my service. Currently there is only a JSON API and a HTML widget making use of the JSON API. The service is in a public beta right now. I want to see whether the geo-ip data is accurate and how much stress the server could take. Everyone is invited to use the web service and report any issues.

However there are plans to implement a XML API and also making more information available through the service. Best part is all this comes free of charge and without advertisements, forever. Only thing I would request is a link back; Not compulsory. You can see the HTML widget in action right here in the blog as well, see the right column block “You are from…”.

All the code behind the web service is also available under the open source license GNU GPL v3. You could also start your own web service with the code, ;).

Right now all the hosting expense is from my own account, I would hope I will receive some donations when I have to move to better hosting plan because I’m getting a lot of traffic.

Cool parodies, White and Nerdy, eBay

Couple of days back I was just browsing around searching for funny videos; I stumble upon doogtoons.com. There I got to watch couple of animated interviews and music videos of Weird Al Yankovic (Then at doogtoons they used YouTube, I probably was able to watch related videos as well). Most interesting of them all was White and Nerdy.

Then I thought I would dig it more and did a google to see whether there are any Wikipedia articles, to my surprise Weird Al was a real person, writing and performing parodies. I started to search and watch more and more videos of songs he had created. I thought of sharing the songs I found it interesting.

  1. White and Nerdy [2006] (parody of Ridin’ by Chamillionaire) – Video
  2. eBay [2003] (parody of I Want It That Way by The Backstreet Boys) – Video
  3. Like a Surgeon [1984] (parody of Like a Virgin by Madonna) – Video

While you are there at YouTube don’t forget to checkout other cool Weird Al videos as well, I just listed the coolest three out of the many. Also remember to check Wikipedia to see whether a particular song is really Weird Al’s because some of the videos are wrongly atributed to Weird Al.

Weid Al’s parodies are so cool, I was immediately converted to a fan. He knows how to make a mark in pop culture.

MakeNSIS on Linux

I was supposed to create a Windows installer recently, but I just hate using Windows. NSIS was the chosen installer creator. I was lucky to be able to compile the NSIS installer on Linux.

The installer just ran without any glitches on wine. So testing the installer as not an issue as well.

Let me guide you through installing NSIS on Linux and how to use it on Linux.

Requires

  1. Python
  2. SCons

Steps

  1. Download both the release and the source of x.xx.
  2. nsis-x.xx.zip nsis-x-xx-src.tar.gz

  3. Extract both into one parent parent directory
  4. <parent>
    |
    +-- nsis-x.xx
    +-- nsis-x.xx-src

  5. Change to the source directory
  6. $ cd nsis-x.xx-src

  7. Compile makensis using scon
  8. $ scons SKIPSTUBS=all SKIPPLUGINS=all SKIPUTILS=all SKIPMISC=all

  9. Copy makensis to the release
  10. $ cp build/release/makensis/makensis ../nsis-x.xx/makensis

  11. Change to the <parent>
  12. $ cd ..

  13. Install – Copy makensis to the install location
  14. $ sudo cp -r nsis-x.xx/* /usr/local/share/nsis/

  15. Create the link from the bin directory to the makensis such that
    makensis is accessible from the command line.
  16. $ sudo link /usr/local/share/nsis/makensis /usr/bin/makensis

Adding color to subversion

If you love the command line and svn but would like to add some color as well, you could try colorsvn.
colorsvn is identical to svn when it comes to commands, but the results are shown in color.

colorsvn is particularly handy if there are any conflicts created during an update.

See http://colorsvn.tigris.org/ for more.

svnserve Init script

I was annoyed to have to start the svnserve as a daemon everytime I restarted the machine. I also wanted to use service configuration(GNOME) to deal with the service.

I looked all over the web and failed to find the a good one. So I thought of writing it my self. Last weekend I sat down and wrote the script. Here is the result.

This was tested on fc6 running kernel 2.6.20-1.2962.fc6. Subversion 1.4.2 (subversion-1.4.2-2.fc6). It should work in any distro with init.

To make service configuration aware of svn serve you will have to first copy the script to /etc/init.d and then run the following.

$ /sbin/chkconfig ---add svnserve

Also remember to create the configuration(/etc/sysconfig/subversion) file with the following lines in it to enable threading.

OPTIONS="--threads"

You can put any options you could send to svnserve in the configuration file.

PS: here is the Init script it self for your viewing before downloading

#!/bin/bash
#
# /etc/rc.d/init.d/subversion
#
# Starts the Subversion Daemon
#
# chkconfig: 2345 90 10
# description: Subversion Daemon
# processname: svnserve
# pidfile: /var/lock/subsys/svnserve

source /etc/rc.d/init.d/functions

[ -x /usr/bin/svnserve ] || exit 1

### Default variables
SYSCONFIG="/etc/sysconfig/subversion"

### Read configuration
[ -r "$SYSCONFIG" ] && source "$SYSCONFIG"

RETVAL=0
prog="svnserve"
desc="Subversion Daemon"
pidfile="/var/run/$prog.pid"

start() {
echo -n $"Starting $desc ($prog): "
daemon $prog -d $OPTIONS --pid-file $pidfile
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
touch /var/lock/subsys/$prog
fi
echo
}

obtainpid() {
pidstr=`pgrep $prog`
pidcount=`awk -v name="$pidstr" 'BEGIN{split(name,a," "); print length(a)}'`
if [ ! -r "$pidfile" ] &&amp;amp; [ $pidcount -ge 2 ]; then
pid=`awk -v name="$pidstr" 'BEGIN{split(name,a," "); print a[1]}'`
echo $prog is already running and it was not started by the init script.
fi
}

stop() {
echo -n $"Shutting down $desc ($prog): "
if [ -r "$pidfile" ]; then
pid=`cat $pidfile`
kill -s 3 $pid
RETVAL=$?
else
RETVAL=1
fi
[ $RETVAL -eq 0 ] && success || failure
echo
if [ $RETVAL -eq 0 ]; then
rm -f /var/lock/subsys/$prog
rm -f $pidfile
fi
return $RETVAL
}

restart() {
stop
start
}

forcestop() {
echo -n $"Shutting down $desc ($prog): "

kill -s 3 $pid
RETVAL=$?
[ $RETVAL -eq 0 ] && success || failure
echo
if [ $RETVAL -eq 0 ]; then
rm -f /var/lock/subsys/$prog
rm -f $pidfile
fi

return $RETVAL
}

status() {
if [ -r "$pidfile" ]; then
pid=`cat $pidfile`
fi
if [ $pid ]; then
echo "$prog (pid $pid) is running..."
else
echo "$prog is stopped"
fi
}

obtainpid

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
RETVAL=$?
;;
condrestart)
[ -e /var/lock/subsys/$prog ] && restart
RETVAL=$?
;;
status)
status
;;
forcestop)
forcestop
;;
*)
echo $"Usage: $0 {start|stop|forcestop|restart|condrestart|status}"
RETVAL=1
esac

exit $RETVAL

Installing Huawei ETS1000 on Linux

*** Update for Ubuntu 8.10 ***

You will have to copy the driver files to the correct location. Please run the following command.

sudo cp /lib/firmware/$(uname -r)/ti_3410.fw /lib/firmware/ti_usb-3410.bin

***

I managed to install my ETS1000 Series Fixed Wireless Terminal on Linux and go online. I thought of sharing the steps I took to install the modem on Linux such that you might be able to help someone with the same problem. This should work for any of the CDMA modems that will be using TI USB 3410 cable (the cable you get when you pay for Bell Net) as the problem is with the USB/Serial Cable not the HUAWEI modem.

System Requirements

* Linux with kernel above 2.6.** (Check it by command in console uname -a).
(Personally Tested on FC6, should work on any Linux Distribution)

Let’s Start

It is well assumed that Linux is up on your system and your USB/Serial cable is plugged in.
Now in console type command dmesg -c search for the following lines

ti_usb_3410_5052 1-1:2.0 : TI USB 3410 1 port adapter converter detected
usb 1-1: TI USB 3410 1 port adapter converter now attached to /dev/ttyUSB0

If u even see ttyUSB0 in the kernel message then also your modem is detected and you are ready to start,now just configure your wvdial.conf in /etc and start your dialup.

If not then possibly u will be seeing the following error messages in bundle but i will paste only two lines here.

ti_usb_3410_5052 1-1:1.0: TI USB 3410 1 port adapter converter detected

ti_usb_3410_5052: probe of 1-1:1.0 failed with error -5

Note that the problem is only the USB/Serial Cable not the HUAEWI modem.

Now we have to make one rule file in /etc/udev/rules.d/026_ti_usb_3410.rules

The file may not exist, but don’t worry.

In console login as a root

su

password *****

cd /etc/udev/rules.d/

vi 026_ti_usb_3410.rules (Now Paste the following lines in it)

SUBSYSTEM=="usb_device" ACTION=="add"
SYSFS{idVendor}=="0451",SYSFS{idProduct}=="3410" \
SYSFS{bNumConfigurations}=="2" \
SYSFS{bConfigurationValue}=="1" \
RUN+="/bin/sh -c 'echo 2 > /sys%p/device/bConfigurationValue'"

SAVE AND EXIT (:wq)

Now once again plug out ur USB/Serial cable and then plugin.

Again type dmesg -c in console

Check the kernel message and find the following line

ti_usb_3410_5052 1-1:2.0: TI USB 3410 1 port adapter converter detected
usb 1-1: TI USB 3410 1 port adapter converter now attached to /dev/ttyUSB0

CONGRATULATIONS it is finally done.

Now edit your /etc/wvdial.conf (Mine as a Sample below working fine)

My /etc/wvdial.conf

[Dialer ptcl]

Modem = /dev/ttyUSB0

Baud = 230400

Phone = #777

Init1 = ATZ

Stupid Mode = 1

Dial Command = ATDT

Username = YourUsername

Password = YourPassword

PPPD Options = crtcts multilink usepeerdns lock defaultroute

Important Note: Stupid Mode should be set to 1 otherwise the hash sign # with Dialing phone number will not be treated by wvdial.

LAST PROBLEM

When u will connect to ptcl with wvdial ptcl command as a root , it will not browse any page and will disconnect.

You have to set the nameserver in the /etc/resolv.conf .You can get the nameserver IPs from the terminal window when wvdial is trying to connect to your ISP.

Put those two nameserver in /etc/reslov.conf.

Now again as a root in console wvdial ptcl.

FINALLY YOU ARE DONE.

DVD movies on mplayer – Excellent

I bought my self a Shrek2 (know it is old, but didn’t want to spend too much) DVD and wanted to check how well mplayer will handle it. To my surprise, there wasn’t a glitch. The movie was crystal clear. It’s as good as watching on a DVD player.

So I thought I would do more research and find out how mplayer decode the DVD so well without even loading the processor so much. To much of my surprise player does support hardware decoding of DVDs via graphic card (I have a nVidia GeForce with nVidia proprietary drivers). This is only supported in one of nVidia’s own media player when it comes to Windows, but mplayer did it.

Thanks allot for the mplayer project for a such a feature rich application.

Installing Lexmark X1100 series on fc6

I unfortunately bought a Lexmark X1170 all in one two years back, it was cheap and got both printer and scanner. It worked fine on Windows. It was just paper weight ever since I moved to Linux.

I struck luck yesterday, when I stumbled upon a forum posting on Ubuntu forum.

So I started out straightaway, but had trouble getting the correct drivers from Lexmark site, as instructed in the forum (Got 404). So I went and searched in opendrivers.com and fortunately found it. To help all the poor soles to get the drivers easily I have hosted the rpms. If you download these rpms you can skip the part upto converting the rpms with alien if you are using a debian based system, or install the rpms and continue from restarting CUPS.

Here are the links:
http://www.mohanjith.net/downloads/d…1.0-1.i386.rpm
http://www.mohanjith.net/downloads/drivers/printers/lexmark/z600llpddk-2.0-1.i386.rpm

The instructions worked like a charm, and now I’m making use of my printer finally. From my point of view X1100 series is a repackage of Z600 series with a scanner.

Even though the scanner was correctly detected by SANE, I was unable to scan. But the version of sane that comes with Fedora Core 6 (Zod) is old.

Grinding your web application

Have you ever wondered how your web application/site would behave under heavy load? You can easily check that if you have enough bandwidth. You can use a stress testing automation tool.

I got the oppertunity to load test open source application OrangeHRM. I used Grinder, java load testing framework with JWebUnit, automated navigation and content verification framework for testing web applications/sites. Both tools are open source.

Only references that I used are that of the two tools. I managed to create the test and learn (J)Python as well within 8-12 hours.

Unfortunately I was unable to overload the server and get any errors because my machine was incapable of making enough concurrent requests to the web server running on the same machine. The Grinder was unable to run more than 250 requests, because the web server also requires resources.