Feb 28 2008

Malayalam Newspaper and blog fonts for Linux

Whenever we spread the message of Gnu/Linux and Malayalam computing in Gnu/Linux, the most redundant thing that we have to perform is to search for the fonts and install it for each Malayalam newspapers and blogs.
I found it quite irritating to repeat the same steps for downloading and installing the fonts. So I decided to script it ..

This is the “malayalam.sh”

Run it as

sh malayalam.sh

Then close all the instances of firefox/konqueror and start them again.. Now watch the Malayalam News Papers in Style Cool

########### Malayalam Font support in Linux ###############

# Shell script for Malayalam Newspaper and blog support in Fedora Core x.

# Hoping that you will have the minimal installation of Linux

# applications like wget should be present and you should have root righs

# It’s quick and dirty ….. but it works as it is simple… :)

# For malayalam manorama new paper

wget http://www.manoramaonline.com/mmfont/Manorama.ttf

cp ./Manorama.ttf /usr/share/fonts/


# For Mathrubhumi news paper

wget http://www.mathrubhumi.com/php/downloadFont.php

cp ./downloadFont.php /usr/share/fonts/Matweb.ttf


#For Kaumudi news paper

wget http://www.kaumudi.com/font/thoolika.ttf

cp ./thoolika.ttf /usr/share/fonts/


# For Deepika news paper

wget http://www.deepika.com/mlkr0ntt_TTF.ttf

cp ./mlkr0ntt_TTF.ttf /usr/share/fonts/


#for Rachana

wget http://download.savannah.nongnu.org/releases/smc/Rachana_w01.zip

unzip Rachana_w01.zip

cp ./Rachana_w01/Rachana_w01.ttf /usr/share/fonts/

####################################################

Enjoy…….


Feb 27 2008

Netbeans blogs of the week

Oh my god…  My blog got second place in the sun’s blog rating page  Cool 

NetBeans blogs of the week (http://planets.sun.com/SMB/group/SunBlogs/).. 

Now please let me celebrate this Innocent


Feb 26 2008

Python and Cairo – There will be blood…

What will a huge Hollywood fan do after Daniel Day Lewis won Best actor award for “There will be Blood” beating legendary actor like George Cluny..? Well, he will definitely watch “There will be blood”. But as that film hasn’t yet released in India, I decided to do something which is no way related to that movie..  Learn to do something interesting with Cairo in Python…

As I was thrilled about the movie- “there will be blood”, I decided to create a simple GTK animation which shows the spreading of blood in the floor.. obviously insipired from the name of the movie :)

Python code

#########################################################################
#
#PyCairo Demo:- There will be blood ..
#By Maxin B. John
#An animation to show the capabilites of PyCairo
#
# About Cairo
# Cairo is a software library used to provide a vector graphics based,
# device-independent API for software developers. It is designed to provide
# primitives for 2-dimensional drawing across a number of different backends.
#Cairo is designed to use hardware acceleration when available.
# #########################################################################
#!/usr/bin/env python

import sys
import gobject
import pygtk
pygtk.require(’2.0′)
import gtk
from gtk import gdk
import cairo

if gtk.pygtk_version < (2,10,0):
print “PyGtk 2.10.0 or later required”
raise SystemExit

win = None

#The blood is a circle filled with red color whose radius grows with time :)

def expose(widget, event):
global radius
cr= widget.window.cairo_create()
cr.set_source_rgba(1.0, 0, 0, 0.7)
cr.arc(float(radius)/2, float(radius)/2, radius, 0, 2.0*3.14)
cr.fill()
cr.stroke()
return True

# this keeps the blood flowing…

def update_clock():
global win
global radius
radius = radius +1
win.queue_draw()
return True

# the ‘main’ function

def main(args):
global win
global radius
radius =0
win = gtk.Window()
win.set_app_paintable(True)
win.set_title(‘PyCairo Demo’)
win.connect(‘delete-event’, gtk.main_quit)
win.connect(‘expose-event’, expose)
gobject.timeout_add(100, update_clock)

win.show_all()
gtk.main()
return True

# The pythonic way to start the animation
if __name__ == ‘__main__’:
     sys.exit(main(sys.argv))

And the output Cool

Don’t you feel the smell of blood…  ??? Undecided


Feb 22 2008

Sony Ericsson K300i AT commands in Linux

I am always interested in using unconventional methods to control the mobile phone using linux. I found that the AT commands has immense potential to control the functioning of my K300i mobile. We can make phone calls, invoke apps and java applications in the phone, change the profile , enable or disable certain features like silent mode, read & send sms…… I have downloaded the AT commands list from http://developer.sonyericsson.com/getDocument.do?docId=65054 Now to send the AT commands, I need a terminal connection to phone. I love minicom, best terminal emulator in Linux. After connecting the k300i phone to the usb of the system using it’s usb cable, dmesg : usb 2-2: new full speed USB device using uhci_hcd and address 2 usb 2-2: configuration #1 chosen from 1 choice usbcore: registered new driver usbserial drivers/usb/serial/usb-serial.c: USB Serial support registered for generic usbcore: registered new driver usbserial_generic drivers/usb/serial/usb-serial.c: USB Serial Driver core drivers/usb/serial/usb-serial.c: USB Serial support registered for pl2303 pl2303 2-2:1.0: pl2303 converter detected usb 2-2: pl2303 converter now attached to ttyUSB0 usbcore: registered new driver pl2303 drivers/usb/serial/pl2303.c: Prolific PL2303 USB to serial adaptor driver Hmm .. the serial device is ttyUSB0… Then this should be the serial port setup in minicom : /dev/ttyUSB0 57600 8N1 Ok then I have configured minicom and logged on to K300i.. to check whether it is success or not , ATI K300 series OK It is OK.. or more than ok :) .. the AT commads are working :) Then some more AT commands to test know more about it… Modifying the profile to enable alerts : AT+CVIB? +CVIB: 16 OK AT+CVIB=? +CVIB: (0-1,16) OK AT+CVIB=1 OK Profile Updated: HOME Modified … splashed on screen :) Showing the default language AT*ELAN? *ELAN: “en” Executing Java Apps T*EJAVA=? *EJAVA: 1 *EJAVA: 2,(1-4294967295) *EJAVA: 3,120 *EJAVA: 4,(1-4294967295) 0 Run a java application. The search path to the application must be provided in . 1 List installed java applications. No value on needed. 2 Delete a java application. The object id of the application must be provided in . 3 Install a java application. The search path to the application must be provided in . 4 Run an installed java application. The object id of the application must be provided in . *EJAVA: “Alert”,”Sun Microsystems, Inc.”,”1.0″,524298,10 *EJAVA: “Audio Player”,”Sun Microsystems, Inc.”,”2.0″,65542,6 *EJAVA: “Bouncing Ball”,”Sun Microsystems, Inc.”,”2.0″,196614,6 *EJAVA: “ChoiceGroup”,”Sun Microsystems, Inc.”,”1.0″,458762,10 *EJAVA: “Colors”,”Sun Microsystems, Inc.”,”2.0″,65541,5 *EJAVA: “Converter”,”Sony Ericsson”,”2.1.6″,65537,1 *EJAVA: “CustomItem”,”Sun Microsystems, Inc.”,”1.0″,65546,10 *EJAVA: “Darts”,”Sony Ericsson”,”0.0.3″,65538,2 *EJAVA: “Datagram Demo”,”Sun Microsystems, Inc.”,”1.0″,131083,11 *EJAVA: “DateField”,”Sun Microsystems, Inc.”,”1.0″,196618,10 *EJAVA: “FiveStones”,”Sony Ericsson Mobile Communications AB”,”1.2″,65539,3 *EJAVA: “FontTestlet”,”Sun Microsystems, Inc.”,”2.0″,327685,5 *EJAVA: “Gauge”,”Sun Microsystems, Inc.”,”1.0″,589834,10 *EJAVA: “HelloMIDlet”,”Vendor”,”1.0″,65548,12 *EJAVA: “Http”,”Sun Microsystems, Inc.”,”2.0″,393221,5 *EJAVA: “List”,”Sun Microsystems, Inc.”,”1.0″,393226,10 *EJAVA: “ManyBalls”,”Sun Microsystems, Inc.”,”2.0″,131077,5 *EJAVA: “Mascot Capsule V3 Demo”,”Hi Corp.”,”2.0″,65543,7 *EJAVA: “Mix Demo”,”Sun Microsystems, Inc.”,”2.0″,131078,6 *EJAVA: “PhotoAlbum”,”Sun Microsystems, Inc.”,”2.0″,65545,9 *EJAVA: “Properties”,”Sun Microsystems, Inc.”,”2.0″,458757,5 *EJAVA: “PushPuzzle”,”Sun Microsystems, Inc.”,”2.0″,131076,4 *EJAVA: “Socket Demo”,”Sun Microsystems, Inc.”,”1.0″,65547,11 *EJAVA: “Start”,”Sony Ericsson Mobile Communications AB”,”2.1.4″,65544,8 *EJAVA: “Stock”,”Sun Microsystems, Inc.”,”2.0″,262149,5 *EJAVA: “StringItem”,”Sun Microsystems, Inc.”,”1.0″,655370,10 *EJAVA: “TextBox”,”Sun Microsystems, Inc.”,”1.0″,327690,10 *EJAVA: “TextField”,”Sun Microsystems, Inc.”,”1.0″,262154,10 *EJAVA: “Ticker”,”Sun Microsystems, Inc.”,”1.0″,131082,10 *EJAVA: “Tickets”,”Sun Microsystems, Inc.”,”2.0″,196613,5 *EJAVA: “TilePuzzle”,”Sun Microsystems, Inc.”,”2.0″,65540,4 *EJAVA: “WormGame”,”Sun Microsystems, Inc.”,”2.0″,196612,4 To execute the Darts game in the mobile , type: AT*EJAVA=4,65538 and viola, I got to see the Darts game start executing in the phone :)

Feb 19 2008

using gtalk to create a “Non Malicious” Trojan Horse

The Trojan Horse s a piece of software which appears to perform a certain action but in fact performs another activity. Here the Non Malicious trojan horse is a chat program which logs into gtalk using your given user name and password. Whenever you type commands on the chat window, it executes them in your machine and returns the results to you.  This program can also be used for :

*) Using gtalk to control the hardwares in your home which are interfaced to your computer
*) Replacement for the famous telnet/ssh program (can’t use programs like vi , top .. though :( )
*) Lets you know the status of the programs running in your home computer like download status …. etc

and leaving others for your imagination

This program uses the command module in python to execute the commands that you type into the chat window. Be careful that if you start the program as root, then you can possibly do “anything” in your machine. Be careful.

 gtalk_trojan.py

import xmpp
import time
import commands

def execute_command(command):
    return commands.getoutput(command)

def messageCB(sess,mess):
    nick=mess.getFrom().getResource()
    text=mess.getBody()
    reply = execute_command(text)
    sess.send(xmpp.Message(mess.getFrom(),reply))

roster=[]
def presenceCB(sess,pres):
    nick=pres.getFrom().getResource()
    text=”
    if pres.getType()==’unavailable’:
        if nick in roster:
            text=nick
            roster.remove(nick)
    else:
        if nick not in roster:
            text=nick
            roster.append(nick)

def StepOn(conn):
    try:
        conn.Process(1)
    except KeyboardInterrupt: return 0
    return 1

def Cont(conn):
    while StepOn(conn): pass
   
def main_process():
    jid = xmpp.protocol.JID(‘maxin.john@gmail.com’)
    cl = xmpp.Client(‘gmail.com’)
    cl.connect((‘talk.google.com’,5223))
    cl.RegisterHandler(‘message’,messageCB)
    cl.RegisterHandler(‘presence’,presenceCB)
    cl.auth(jid.getNode(), ‘my_secret_password’)
    cl.sendInitPresence()
    Cont(cl)
if __name__ == ‘__main__’:
    main_process()


Feb 18 2008

knowing your printer’s ink level with libinklevel

Well, do you think that you should know the ink level in your printer, please don’t open the catridge Laughing .. there is another way to know it.. you can use the libinklevel .. But it works only if your printer is by Canon, Epson or HP.
First get the libinklevel library from http://libinklevel.sourceforge.net/. It depends on the libieee1284 library. So install it before making the library in your machine…
For a Fedora core * machine,
yum install libieee1284
will perform the necessary installation. Then untar it and make it
tar xzf libinklevel-0.7.2.tar.gz
cd libinklevel-0.7.2
make
make install

Well then you have the library installed in your machine.. Then you need to have a frontend to actually use this library and view the ink level. I prefer the Inkblot(http://www.gnomefiles.org/app.php/Inkblot) a gtk based program which uses the libinklevel and displays the inklevel in the printer catridge. Me, Dhanan and Jayakumar tried it for 3 different HP printers and it worked very well.


Feb 8 2008

Completing the circle of J2SE, J2ME and J2EE..

   I am happy to inform you all that my Sony Ericsson K300i now contains an application written by Me …. It is just a simple application created using the Netbeans with Mobility Pack. My gui application (FirstGUI) contains some text labels, one picture of a car and a blinking text part … Just like a hello world application just tell the whole world that I have got another computer to run my applications (or in technical words, J2ME application which runs on the MIDP 1.0 and CLDP 1.0 based JVM which runs on my  K300i mobile phone).
 Those who wish to run custom mobile applications in their mobiles can mail their requests to me from now onwards ….  The only sorrow that I have at present is that I had do all the development in the Windows XP. Presently if I want to run the Sony Ericsson Development suite on Linux, I need to use wine, which is again a dependency on Windows. So I have developed this application in Windows itself.  The  JAD s and JARs created by the Netbeans were transferred to the mobile using the Sony Ericsson USB adapter cable and software running Windows OS Cry

But I don’t wish to be depended on Windows…  My Mobile application development and deployment will be in Linux .. very soon …. This seems to be a promising link in that direction (http://developer.sonyericsson.com/thread.jspa?threadID=24249).


Feb 6 2008

Aiming Small — An embedded Java program for my K300i mobile

When I spent money to correct the long privailing display problem of my Sony Ericsson K300i mobile phone, only aim in my mind was to use it as a programmer’s toy :) … write my own programs (Here they restricted me to Java alone) for my small device that I own.

I still remember that rainy day in Mumbai. Then I was working with HCL infosystems, Andheri East office, Mumbai. It was raining slowly when we left the office. From Chandivili to RahejaVihar (Where I work and live respectively) there was about 1.5 km distance. So we decided to walk. I was keeping my newly owned K300i on my pant’s pocket to keep it from water. Almost on the middle of the journey, the rain became heavy. So we decided to find refuge in the nearby bar ( Titanic bar near Chandivili studio which “sank” in fire almost six months later, anyway me and Sreekumar frequently visited there on Saturdays and Sundays). Standing under the safety of the roofs of Titanic, I felt like I should sneeze.. As I was(?) a gentleman , I decided to cover my face during sneezing to help others :) …… As the urge to sneeze was high, I went for the handkerchief which was in my pants pocket . I got a touch of it and I went for it very fast…. too fast….

Then I saw something raising in the air… That was my mobile phone which I kept in my pants pocket along with handkerchief. On the hurry , I took the handkerchief in a hurry but forget to keep the mobile in the pocket itself. It flew in the air and landed on the road. I felt a shiver in my body.. my devil…. what did I do with my Rs. 5500 /- :(
After that , the same mobile served me loyally for about an year without display .. My friends used to advise me to change the mobile. But I thought as it is doing the basic functions even without the display, why bother to change it ?

But later I have changed my decision and repaired it by spending near to a cool thousand rupees. My only aim was to use the JVM in that phone .. Yes , the K300i has a JVM installation in it. I have installed the necessary packages, J2SE implemenation for Linux. the sun_java_wireless_toolkit-2_5_2-linux.bin , the J2ME implementation … etc and used the Sun’s sample program available at http://developers.sun.com/mobility/midp/articles/wtoolkit/src/HelloMIDlet.java.

Now the screenshot of that emulator running that program in Fedora core 6 is available with me :) I need to check the newly developed jad and jar on my mobile phone today itself :)


Get Adobe Flash playerPlugin by wpburn.com wordpress themes