Archive for category Uncategorized
Python On Android SDK
Following steps will lead to the installation of python interpreter on Android SDK.
Step 1: Add the path of tools directory to the environment
Add the path of the directory ‘andoid-sdk/tools’ to the path variable by executing the command
$PATH = $PATH:path_of_android-sdk/tools/
Step 2: Create a SDCARD for storing application on Android.
As Andoid API 2,.2 allows the user to save applications in sdcard insted of using the phone’s memory .So for that purpose a SDCARD of apprpriate size has to be created by executing the command
mksdcard ‘size’M ‘ sdcardname’
This creates a sdcard of size of ‘size’ MB with name as ‘sdcardname’ .
Step 3: Download the package from the following link
Download the SL4A from http://code.google.com/p/android-scripting/downloads/list .
Step 4: Start the Android SDK and install the SL4A
Open the terminal and Start the Android-SDK by executing a command like
emulator @’avd-name’ -sdcard ‘sdcardname’
now without closing this start a NEW terminal and install the sl4a package downloaded earlier by executing the command .
adb install ‘sl4a_rx.apk’
now the icon for sl4a can be seen in the menu of SDK .
Step 5: Installing python from SL4A.
Now the python interpreter is to be selected in Sl4A . After clicking on the SL4A icon , click on the menu button on the SDK and then click on ‘View’ button on screen .
then among the list displayed under the ‘View’ button click on the ‘Interpreter’
then among the list of Interpreter’s select Python.
it will download python interpreter and install it.
finally the interactive python shell can be seen on the ‘Android SDK’.
This was helpful to me as my B.tech major project was to develop a Scheme to Python compiler for Android Simulator. So for that purpose it was necessary to get an environment setup where python code can be run for Android OS.
Although Euler Project questions are designed to be solved sequentially. I wasn’t able to hold myself from giving it a try when I saw some of my roommates trying out this problem.
The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, …
Let us list the factors of the first seven triangle numbers:
We can see that 28 is the first triangle number to have over five divisors.
What is the value of the first triangle number to have over five hundred divisors?
I tried out the above problem and got myself a solution using two basic rules from mathematics.
- The nth triangular number can easily be obtained as : (n * n-1) / 2
- If a number ” n ” can be written as a multiple of two consecutive numbers “p” and “q” ie: if n = p * q then number of factors of n = number of factors of p * number of factors of q – 1
My Solution is available at my git-hub id:
My solution clocked below 1 seconds.( 0.244 seconds to be exact ) .
Image manipulation of image stills taken from live camera has always fascinated me. For the beginners, it is best to use the library ‘OpenCV’ . In my earlier post about OpenCV ,I was able to get image frames from the webcam at a rate of about 30 images per second and then displayed it onto a window.
Object detection with OpenCV
A cascade of classifiers is degenerated decision tree where at each stage a classifier is trained to detect almost all objects of interest while rejecting a certain fraction of the non-object patterns. Each stage was trained using the Discrete Adaboost algorithm .Discrete Adaboost is a powerful machine learning algorithm. It can learn a strong classifier based on a large set of weak classifiers by re-weighting the training samples.
For this (haar training procedure) a large set of positive samples and negative samples are needed. Positive samples are those image set containing the object of interest and negative samples don’t have features of object of interest. For example if object of interest is face, then about 5000 image samples containing (the frontal face) and about 5000 negative image set(not having face) is needed. OpenCV provide utilities to train the haar classifiers from the image samples collected (both positive and negative) .Finally , when a haar-classifies is trained, a xml file is created containing the features of object of interest. This ‘xml’ file can be used as per our needs for detecting the object from an image.I tried to detect faces from the images taken from the webcam and drew a circle on them.The haarcascade xml file was available with OpenCV documentation which is available in the standard linux distribution.So finally ,when the piece of code is executed, a window appears which displays the video taken from the webcam and draw a circle on the faces present in it. Some images are
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 .
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
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
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 :
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.
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.
For mounting a disk partition in linux formatted as NTFS file system in read/write mode or any other file system in debian, NTFS-3g can be of a great use.For using this to be used the packages are supposed to be installed onto the operating system by first adding all the debian distribution CD’s to the synaptic manager followed by using the command.
apt-get install ntfs-3g
The package ‘NTFS-3G’ can be installed either from debian lenny distribution CD’s .by first
Root previledge is needed for the below commands.
- first make the destination folder anywhere you want (as i made my destination folder as /media/disk1)
- if you are having a sata hard-disk then try the command
mount -t ntfs-3g /dev/sda5 /media/disk1
if you are having an IDE hard disk then try the command
mount -t ntfs-3g /dev/hda5 /media/disk-1
- Mounting disk drives at the startup
For mounting disk drives at boot-up time. The file /etc/fstab has to be configured .In the file ,under the type bar the file system for ntfs is to mounted under ntfs-3g system.