back after a Loong Break

Hiii  Guys!!!  I m back to the blogging world . .  after a long break .
                             Last month I brought a new Dell  n series laptop and installed Ubuntu Lucid Lynx 10.04 on it . To tell about my experience with it (Lucid Lynx) so far.  .  . hmm. . .  . nothing but.. ‘GREAT’. I found it easy to use and for the first time in  my experience with linux systems I found a fully featured and a complete no-hassle desktop .With boot time improved noticeably from the previous versions of the same….. Lucid Lynx seems to give other linux distros a tough competetion .
            This time this blog promises of bringing more geeky technical stuff …hope that everyone finds it interesting .

Advertisements

Leave a comment

Scheme to Python Compiler for Android OS

                 My B.tech major project was to implement a ‘Scheme-to-Python Compiler for Android’ where the language used was Scheme (a variant of lisp ).The project aimed at developing a compiler which would translate application program written in Scheme to Python which in turn can be run on Android platform.  Here I used the concept of ‘Meta-circular Evaluator’  from SICP (Structure and Interpretation of Computer Program )  the ‘wizard book’,  to recognize each expression and then ,instead of evaluating it, my program generated the corresponding the Python expression.
                   The Python program generated was stored in the SDcard of Android SDK.
Now for Python programs to be supported on Android platform, SL4A was to be installed on Android SDK . This platform enabled python generated program to be run on the SDK providing many of the API’s provided to a full-fledged Android applications . I demonstrated my project by using a “text-to-speech” API available to Python which would process the text message to generate the corresponding speech.

     The Graphical User Interface for the compiler was designed with GTK(Gnome Tool KIt) programming tool named ‘Glade’ 

As seen above,there are two text columns.  The scheme code to be compiled is to be written in the first column.  There are four buttons to this interface. 
  1. The first button when pressed invokes the ‘DrScheme’ with the Scheme code in it.The code in scheme can be checked for correctness and run with it.
  2. The second button when pressed invokes the ‘Compiler code‘,proceeses the input scheme program and generates the correspoding python program.
  3. The third button when pressed invokes ‘IDLE’ ( a python IDE) for validating the generated python code.
  4. The fourth button with an icon of ‘Android’ copies the generated python code into the SDCard s(memory card) and starts the Android SDK. 

The source code for the above project can be downloaded from my git hub => git@github.com:rohitnjan88/S-T-A.git

  The application in Android SDK can be invoked by clicking on the SL4A  icon in the menu.  

Leave a comment

Compiz in linux

Since the time, I’ve started using linux I always believed that ,one of the most attractive feature in linux desktop , 3d – desktop effects (compiz) are only meant for PC’s having only Intel micro-proceesor with high graphics-capability card.
Earlier in Ubuntu 8.04, whenever I tried to enable the visual effects it showed message like “3-d acceleration not supported”.

Thanks to Pramode sir, i realized that  the  graphics driver in debian (‘nv driver’) distro packages does not support my graphics chip.So I downloaded the required driver from the official site of the chip and installed it.

The first step to be taken for compiz installation is to identify whether compiz is supported on your system. This can be checked by executing  ‘compiz-check’ .It  can be downloaded from

http://forlong.blogage.de/entries/pages/Compiz-Check 

the information about your graphics card can accesed by command “lspci”,which  is  a  utility for displaying information about PCI buses in the system and devices connected to them.

lspci | grep ‘VGA’

will provide details  about graphics card in the pc like

00:0d.0 VGA compatible controller: XXXXXXXXXX

the graphics driver for the graphics chip can be downloaded from its official website

after that compiz can be installed by

apt-get install compiz

Configuring Compiz

The compiz can be configured by accesing CompizConfig Setting Manager from System->Preferences->CompizConfig Settings Manager
which opens like

One of the most attractive feature of the linux desktop is the 3d-desktop feature which if enabled helps to change the desktop into a cube,or a sphere or a cylinder according to the user needs.
Apart from this,the desktop can configured into a big cube or cylinder of water with fishes,sharks ,dolphins and tidal waves in it.Every thing in this in the configurable mode the frequency of the waves,height of the water,number of fishes and even the size of the fishes..
Some pics :

 

3 Comments

Programming a "PARALLEL PORT" in C using "inb " and "outb()"

   
                           For programming a parallel port in C,the user program is supposed to get the permission for accesing  the I/O port using the call

iopl(permission value)

which changes the previlege of the calling process.
By default the user program has a permission value of 0.So for accessing the parallel port,the user program  is supposed to have a permission value of 3

iopl(3);

  • outb()

For porting a value onto the parallel – port,the function outb() is used .

outb(value,0x378); 


parallel port the out pins are from 2 to 9 pin.


outb(value,portaddr);

will port a byte to the portaddr address.
the port address is to be selected as follows 

for 
/dev/lp0     ——    0x378 
/dev/lp1     ——–   0x3bc

 
a simple program in C to port a value to the parallel port


inb(portaddr)

parallel port register set


there are three main registers for a parallel port

  • status register
  • controll register
  • status  register

so these registers are used to read  the values of specific pins

the address of the status register
/dev/lp0 — >  0x378
/dev/lp1 — >  0x

4 Comments

Erlo-sapien at foss.in 2009

    Foss.in 2009 is going to be one of the most unforgottable experience for me. For this meet, a group of 10 students from my college including me tried to prepare a robot .The robot aimed to work on a linux-kernel-2.6.26-*  based system and process the language  ERLANG  (best known for it’s concurrency-handling capability). We started the work about 3 weeks ago.
Initially we had a plan to use a beagle board ,which is 3 inch * 3 inch in size and is usb bootable.But it was too costly for us to afford so we requested an old computer from our college lab.The college permitted us to use an old computer (which did’nt  support booting from USB) .The Computer is required to be returned to the collge on or before december 9,2009.Finally our robot had a structure having a motherboard,a smps, and a hard-disk on it’s body.Apart from from this , there were five I-R sensors and a web-cam on it’s body .The IR-sensors were prepared by two students from Electronics group in our group –  Achu wilson and Aronin  .Apart from this the whole structure of the robot was prepared by them which had 2   motors connected to wheels . A circuit named H-bridge was also there ,so as to control the motor’s direction in either way.

Robot used it’s IR-sensors to detect any obstracle in front of it and tracks a path avoiding collision and the checks for any symbol through the web-cam and moved correspondingly .The I-R sensors and the motor were connected to motherboard via a parallel port.The web-cam is interfaced with the motherboard through the usb interface.

The link-in drivers to communicate with the ir-sensors, and the motors were written in C. Erlang code used these drivers(Erlang-C interface) through an interface and controlled the movement of the robot. The robot was named as ERLO-SAPIEN by our group.We were able to complete the almost every section except the web-cam part .

The “Erlo-Sapien” was demonstrated at foss.in 2009 project expo and got a lot of attention with lots people coming in with their valuable suggestions to improve. The harware and software details of the robot will be published soon.

Leave a comment

Programming a webcam in C using ‘OpenCv library’

 OpenCv library is  really a great help in programing a web-cam.I  tried to access a web-cam through a C code and was succesfull in doing it.Before the code can be executed and the web-cam can be accesed ,a library named ‘opencv’ is to be installed .
                          OpenCV (Open Source Computer Vision) is a library of programming functions for real time computer vision . OpenCV is released under a BSD license, it is free .

The library is available in debian distro cd’s and can be installed by issuing the commands

apt-get install opencv*

apt-get install libhighgui*

apt-get install libaux-dev

  •   Program in C to access web-cam, Capturing and Saving image

The web-cam can be accessed in C and the images  saved is in .jpg format

A simple program to see the video accessed by the webcam.

 My Cheese app in C.

cheese.c

#include
#include <  opencv/cv.h  >
int main(int argc,char **argv)
{
        cvNamedWindow(“rohit”,CV_WINDOW_AUTOSIZE);
        CvCapture* cap = cvCreateCameraCapture(0);
        IplImage *image1,*image2;
        while(1){
                image1  = cvQueryFrame(cap);
                if(!image1)
                        break;

                cvShowImage(“rohit”,image1);

//waiting 33 milliseconds for a key to be pressed

                char c = cvWaitKey(33);

//if the key pressed is esc
//ascii of esc is 27

                if(c==27)
                        break;
//if the key pressed is an up-arrow key
                else if(c ==’82’)
                {
                        image2 = image1;
                        cvNamedWindow(“rohit photo”,CV_WINDOW_AUTOSIZE);
                        cvShowImage(“rohit photo”,image2);
                        cvSaveImage(“my-photo.jpg”,image2);
                }
        }
        cvReleaseCapture(&cap);
        cvDestroyWindow(“rohit”);
        cvDestroyWindow(“rohit photo”);
}

Compile the above code by executing the command:

gcc -o cheese_in_c cheese.c `pkg-config opencv --cflags --libs `

 this command creates an executable named “cheese_in_c”.
Execute the executable as

 
./cheese_in_c

this program displays a window named “rohit”showing the pictures taken from the webcam,then it waits for 33 milliseconds for the user to press a key.If key pressed is ‘up-arrow’ the picture from the camera is captured and saved in the same directory in the name “my-photo.jpg”.


			

1 Comment

Internet connection through WLL BSNL in linux

I ‘m using a wireless Internet connection (BSNL WLL connction).This post may be of use to newbies in linux ,trying to connect to internet through a dial up connection.The first step to be done is

  • To install ‘wvdial’ 

In debian distro, the package is available in their distribution cd.For installation try the command

apt-get install wvdial

 the package can be downloaded from the link below

http://packages.ubuntu.com/hardy/i386/wvdial/download

the package can then be installed as

dpkg -i wvdial-xx.deb 

  •  configuring the file /etc/wvdial.conf

 now the file /etc/wvdial.conf has to be configured according to connection requirements ,the overall structure of the /etc/wvdial.conf can be obtained from link
http://ranjeethpt.wordpress.com/2009/08/27/working-with-arm-7/

my wvdial.conf file looks like the one below

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = at+crm=1;+cmux=1;+cps=33;+cta=0
Stupid Mode = yes
ISDN = 0
Modem Type = USB Modem
New PPPD = yes
Phone = #777
Modem = /dev/ttyUSB0
Username = xxxxxxx
Password  = xxxxxxx
Baud = 460800

 here in the file for the users using BSNL – WLL  connection have to replace
username  and password provided to them by the service provider
Username = xxxxxxxx
Password = xxxxxxxx

now to be able to use the connection ,first we have to register the dial-up modem to their kernel.as provided in the link

 http://ranjeethpt.wordpress.com/2009/08/27/working-with-arm-7/

then the user can browse onto internet by just dialing

wvdial

in the terminal.

Leave a comment