Friday, December 24, 2010

New domain

Life of a tech addict is now TechBite! Please update your bookmarks.

The address of Facebook page is now

A new venture has been started by me
The Facebook page for TechBeat is
Like it to have the latest technology news coming in the news feed of your facebook profile.
On twitter

The site will have the most important tech news of the day, delivered to you directly aggregated at one cool place. It is like a technology news magazine with short news stories.

Sunday, December 12, 2010

An airtel trick

I have an Airtel UP East sim and today I accidently discovered a cool feature. Using this trick you can keep your phone turned on and whoever calls your number will be intimated that your number is switched off. And you will even get an SMS with the number of caller so you will get to know who is calling you. This feature can come handy sometimes when you want to use your phone for outgoing or internet browsing without letting anyone disturb you. Also in situations when you have a fight with your significant other and you want to see them trying to call you madly, without turning your phone off. The trick is to go into your phone settings and inside that navigate to call settings then call forwarding or call diverting. Set your phone to divert all calls to the number 9935044567 and viola! Whoever calls you will now be informed that either your phone is switched off or not reachable. Also, you will receive an SMS in a few moments from the caller's number. If you are an Airtel customer of some other circle then too this trick will work but you have to change the number. The number can be obtained easily by going to call divert or forwarding settings and seeing the preset number for the field Divert when not reachable. Set that same number to Divert always and you are done! I tested with my Reliance GSM number of UP east and set its divert to that Airtel number 9935044567 and w00t!! When anyone calls my Reliance number he/she is told that This airtel number is not reachable! ROFL! Its fun and useful at times! Do try it.

Saturday, November 20, 2010

Importing MS Access database into Oracle 10g or MySQL

While working on a data mining project I came across an issue in which I had to dump all the data from an MS Access mdb file into Oracle and MySQL database tables. Actually, to test your implementations of various data mining algorithms you need huge real life data sets, and they are mostly available on the internet in CSV formats or MS Access mdb files. One great place to download such data sets is the Machine Learning repository of University of California. Here is the link:

Now lets get back to the point of this post. Yesterday I got an mdb file and I needed to put all the data into my Oracle 10g XE installation for developing and testing an implementation of CTU-Tree data mining algorithm. The table had 1 lakh records. The first column was the ID, for serial number or transaction ID and next 19 were labelled as A to S. It was a transactional dataset. I would like to point that here transactional doesn't mean the ACID property following database, but actual data pertaining to transactions in supermarkets.
I personally hate MS Access as a database and I am a big fan of Oracle (although they're doing nasty things with Android now a days :P).
First attempt
I fiddled with some options in MS Access and exported the whole data set into XML format. For that, in the left column just right click the table name and see the Export menu option. Then I went to application express in 10g XE and tried the Load XML data option. Unfortunately it didn't work. Probably Oracle's Load XML Data couldn't parse Access's exported XML well.
Second Attempt
Next, I tried to export the Access file into TXT format delimited by commas. The export was successful except with an issue that I got warnings because some of the cells in the Access DB were null. I tried Load Text Data, in Oracle.This time Oracle's importer crashed, dunno why. I tried the same thing again but in vain. The application didn't crash but it showed me the status as
Succeeded: 0
Failed: 100000
Third attempt with MySQL
I thought, let me dump all of it to MySQL as MySQL is more flexible in many trivial things. The text export had one lakh lines like these two:


I created a table in a MySQL database with 20 columns all of type INT. Then I used this command in the mysql client command line utility:


I pressed the enter and within a second the output came. But it showed some warning. I ignored and straight away launched PHPMyAdmin to have a glance at the data. Alas! Only the first column had data! Rest all were set to NULL! Then I noticed the double quotes enclosed values in the rest 19 columns except the first. In the text editor(I use jEdit) I did a find and replace for " and tried to replace it with nothing. But it crashed. Same thing happened with Notepad++. This was due to the high volume of data.
I straight away went to MS Access and in the export wizard I removed the TEXT QUALIFIER as " and set it to {none} in the third dialog of the wizard. This time all the data in the export was without double quotes. I ran the MySQL's LOAD DATA command as written earlier, again and still I got warnings.
Then I modified the command a bit as follows to indicate the comma delimitation:
and executed it. Voila! The first success! It all went well and within a second, 1 lakh entries were inside MySQL. And this time without any errors and warnings.
Attempt 4: Oracle
Now after a fortune with MySQL I had to get the data anyhow into Oracle. I created a table in Oracle with the requisite number of columns all with NUMBER data type. Then I wrote a PHP program to automate the task, and in 1 minutes 47 seconds it did the job! Here is the program:

// Connect to the Oracle 10g XE database
$conn = oci_connect('user', 'pass', '');

if (!$conn){
   $e = oci_error();
   trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
   $blah2="INSERT INTO transactions VALUES(".$blah1[$i].")";
   //use the below line instead of above if you need to dump a file that has field values enclosed with double quotes
   //$blah2="INSERT INTO transactions VALUES(".str_replace('"','',$blah1[$i]).")";
   //echo $blah2;
   $stid = oci_parse($conn, $blah2);
echo "Done!";
The latest update is that I successfully dumped the file that I had dumped in MySQL(i.e. the one without double quotes enclosed field values), into Oracle using the built in Load Text Data technique. The errors earlier were due to the double quotes which made the data as string but the column types were NUMBERs in the table.

Sunday, November 7, 2010

Android 2.1 on X10 Mini

I recently got Android 2.1 up and running on my X10 Mini. Although it isn't yet available for Indian X10 Mini owners but through the instructions at XDA-Developers forums, I became one lucky Indian to have the Eclair on my phone!
If you are still running the old 1.6 firmware, you can upgrade to 2.1 easily. There are two techniques. One is to directly flash a firmware into your phone, and other is to make SE Update Service believe that your phone belongs to a place where 2.1 has already been rolled out and then SE Update Service application will put new firmware onto your phone.

The first method

The second method

For the first method to work, you must have Java(at least JRE) installed in your system. To check, just open a command prompt and type java and press enter. If you get some large output, that means java is installed and working. If you get "Java is not recognized as a.........." that means Java isn't installed. Go here and get Java for your OS and install it.

In the second method, you need a rooted phone. Rooting a phone can be done by two techniques. I'll tell you the second one because thats the easiest and even non-engineerig background people will be able to do it without ease! You just need to install an application called UniversalAndRoot on your phone, launch it and tap Root!!!! Thats all!!! After the rooting, you need to install RootExplorer on your phone. Then overwrite the build.prop file in your phone's system directory with the one downloaded from here . After that turn off your phone and turn it on. You will get an error that some application has crashed. Now again turn it off. Launch SE Update Service on your computer and follow the instructions. Your computer must be connected to a high speed internet. In the step when it instructs you to release the back key, don't release it. You will see the New Software Available prompt, release the back button and install the software.

Whats new in the new firmware?

The social phonebook
This is my favourite feature in the new firmware. Your contacts' profile photos from their facebook profiles are displayed when they call you or when you call them. Also, you can see their twitter and facebook status updates right in the contacts. To link any of your phone contacts with his/her facebook/twitter profile go here otherwise if the contact has same first name and last name on facebook, his/her profile will be automatically linked to your phonebook's contact entry.

Double tap to zoom
In the browser now you can zoom to a specific part of the webpage by double tapping. Also its nice when you double tap and the text columns adjust automatically to make reading easier. You can download Dolphin Browser HD from the Android Market to have an still better experience. Dolphin Browser HD has a plugins API and several plugins have been developed for it. For example web2pdf plugin can convert whole webpage to a pdf file.

Live wallpapers
Now you can have animated wallpapers on your phone. I installed the Aquarium live wallpaper and it is very beautiful. There are several more good live wallpapers available for free download from the market to spice up your phone.

Video recording with continuous autofocus
The new firmware makes your phone capable of VGA@30fps video recording with continuous autofocus, which is a big plus.

Skype is available for Android 2.1 but it isn't supported on X10 Mini. I installed it but it used to crash whenever I tapped any contact's name to call.

Minor changes in interface
There are several minor changes in the interface. The blue ambience has gone deeper blue. The lock screen has changed. The call receive/reject screen slider has changed. It looked confusing for me at first when I got the first call. I was confused which way should I drag the slider to receive the call. Finally I went with my intuition and dragged the slider to the right to receive the call. Dragging to the left rejects the call.
The settings menu entries have got icons beside them. The wakeup key has changed. The middle key should now be used to wake the phone up, instead of any of the three keys.

Album issue
The album has gone damn slow at initial launch. You need to wait patiently till all the thumbnails are generated. Anyways, after loading the thumbnails it regains its elegance and is fast as ever.

I have discovered some more great apps that you should try:
PowerAmp: The best music player for Android
RockPlayer: Play all video formats on your phone
TapaTalk: It can let you browse and post in any TapaTalk enabled forum.
iReader: It can view chm files(the compiled help manuals of windows)
Call Recorder: You can record any calls
Android Notifier: Get notified on your pc about any incoming calls or SMSes when your phone isn't in your direct sight.
goChat: Facebook chat on your phone
Recordoid: Record voices
Wyse Pocket Cloud: A VNC client. You can control your Windows or Linux or even Mac computer from your phone directly as if you are using your PC, on your phone
Camera Zoom FX: Its a good replacement for the inbuilt camera

For downloading more and more apps visit this page To be able to download anything you must be registered there. You should also register and keep visiting xda-developers forums x10 mini zone

Wednesday, November 3, 2010

Grid & Cluster computing

Both grid computing and cluster computing are high performance computing techniques that are interchangeably confused between each other by people not involved in any one or both of these. There are some very fundamental differences between these which I'm going to enlist below:

Salient characteristics of grids
Grids are collections of heterogeneous systems. The underlying OS, as well as hardware may vary among the computers participating in the grids. The computers that are part of a grid use their spare computational power to perform the tasks assigned to the grid. They are very loosely coupled and inherently distributed in nature may be over LAN, MAN or even WAN. In a grid infrastructure, every computer behaves as a single entity and each entity has its own resource manager that manages the computing resources. Grids are of two types: computational grids and data grids. The former are used for computationally intensive operations and the latter are used for large scale data base management systems like Oracle 10g/11g.

Salient characteristics of clusters
Clusters are collections of homogeneous systems. The operating system as well as hardware in the participating computers of a cluster are same. The computers in the cluster use their full computational power to solve a problem together, contrasting to the spare computational power usage of grid entities. In a cluster all nodes behave like a single system and there is a single centralized resource manager.

Hope, this clears the confusion between grids and clusters. Both of these technologies are trending research topics for scholars.

Thursday, October 21, 2010

Realtek ALC888 sound issues in Ubuntu 10.10

I own a Fujitsu Siemens Amilo Si 3655 laptop computer which has Realtek ALC 888 audio mixer. Everything was working fine until one on 10/10/10 at 10:10 GMT I downloaded Ubuntu 10.10 and installed it in 10 minutes 10 seconds on my notebook. I encountered an strange issue. I couldn't hear any sound from the notebook's built in speakers, but when I plugged in earphones into the stereo jack, the sound worked perfectly in the earphones. I never had this kind of issue when I was using Ubuntu 10.04. I searched through Ubuntu Forums but none of the tricks worked. I ran the command ubuntu-bug audio and reported the bug to launchpad. While browsing the bugs with the same sound card on launchpad I came across a comment that advised me to edit the /etc/modprobe.d/alsa-base.conf file and append two lines given below, to it.
alias snd-card-0 snd-hda-intel
options snd-hda-intel model=auto
I did the same by running sudo gedit /etc/modprobe.d/alsa-base.conf in a terminal and adding those two lines at the end of the file and saving it.
As soon as I restarted the computer, I heard the Ubuntu Login sound that pops on the login screen!!! So if you have a Fujitsu Siemens Amilo Si3655 or any other notebook that uses Realtek ALC888, just follow the step above and get your internal speakers working.

Thursday, October 14, 2010

scanf() is nasty!! Is it?

If you have begun C programming, chances are you have already faced or you will very soon face the nasty behaviour of scanf while inputting characters. If you have faced this problem and didn't get a solution yet, read on. If you haven't faced this problem, you'll do very soon, so read on :P

The problem
Consider the following C program:

#include <stdio.h>
int main(){
    char ch[10];
    int i[10], j=0;
      printf("Please enter a character: ");
      printf("Please enter an integer: ");
    return 0;

The program is very simple. It takes a character and a number as input, 10 times and then outputs them neatly in a table format. Is it so? The program code looks like that. Now compile the program with gcc and run it. The behaviour you'll see is unexpected! Then what went wrong?

The cause
We have used the format specifier %c with the first scanf. That is the root of the problem! What happens is that, when you enter a character, for example a and press enter, actually two characters go into the standard input stream. First is the a and second is the \n i.e. the newline character corresponding to your enter press. %c reads the single character i.e. a and stores it in the variable. Next you enter anything as integer, say 1. The second scanf skips the \n that was left after the because it doesn't look like an integer. Then it encounters 1 which is followed by a \n so it stores the 1 into the integer variable. In the next iteration of the loop the %c in the scanf directly takes the \n from the stdin that was entered after the 1 and you don't even get a chance to enter a character. This process goes on and on and you never get a chance to enter any character. You are prompted to enter integer only, during each iteration of the loop. Hope you got it ;-) To confirm, just enter %d as the format specifier of printf instead of %c for the character variable in line 16. You'll get the ASCII value of newline character i.e. 10 printed neatly in the table in place of characters in the output.

The solution
There are several solutions to this problem.
The first one I saw in a forum was to clean the stdin. A funcion proposed to do that was as follows:
void clean_stdin(void)
int c;

c = fgetc(stdin);
while (c != '\n' && c != EOF);
and you're supposed to call this after every time you scanf a characer with the %c format specifier. I tried it, and it worked.
Another solution is the put a getchar() line after every scanf. It will take the trailing newline character and put into oblivion :P
Yet another solution, that I loved was to put a trailing space before the %c like this:
scanf(" %c",&ch[j]);
What the space before %c do, is that, it makes the scanf skip any kind of trailing whitespaces and then reads any non-whitespace character and puts into the character variable.
In fact, as you now know the reason of the issue you can develop as many solutions as you want.

Sunday, September 26, 2010

Hone your algorithmic and programming skills

Efficient and clever programming is one quality which every to-be IT professional should possess. Most people misunderstand programming as 'knowing full syntax and semantics set of your favourite programming language(s)'. Programming languages are mere tools to implement your algorithms. The real power lies in devising the algorithm to solve real world problems and this ability needs a solid foundation of mathematics and aptitude. Converting your algorithm into a program in any programming language is the last step.
Most students who learn how to find factorial, fibonacci sequence, palindrome etc. start thinking themselves as great programmers. If you are such a student, you are on a wrong track. I was also one among the same, when I was in 2nd Semester of B.Tech, way back in 2007. Until and unless you train yourself to program for real world problem situations, your programming capabilities are for nothing.
If you want to bear that special quality, then you should hone your programming skills. Just like everything we have on internet, there is a service dedicated to this thing too, on the internet. It is called SPOJ that stands for SPhere Online Judge. The address is . Register there. Once you login, you can click "Problems" in the left pane to see a list of programming problems. Click anyone in the list. Read the problem and try to solve. If you are a first timer, pay attention to their input and output constraints and example. Since your program will be evaluated by a computer, not a human being, you need to accept inputs and present output in the way defined in the problem. You can see the example input and output set t understand the issue. Once you solve and test on your computer, you should upload and check whether it gets accepted. Most beginners have problems following the input and output constraints. Once you get used to, SPOJ is very addictive if you are a guy serious about sharpening your skills.
The problems are generally tough mathematical issues. You need to think with open and calm mind to arrive at a solution. If you are a B.E./B.Tech CS/IT guy I would really like to encourage you to continue this as a hobby through out the course. At the end you will be an outstanding guy in your group.
And, if you wish to earn some cash then go to and participate in their competitions. There are cash prizes for the winners.

Friday, September 17, 2010

Solution to Android's Ad-Hoc WiFi issue

I own a Sony Ericsson XPERIA X10 Mini(Also known as E10i). It runs Android OS 1.6 Donut. Android doesn't let you connect your phone to an ad-hoc(i.e. computer to computer) WiFi network for browsing internet. Only infrastructure networks are supported. So, if you have a wired internet connection in your laptop or desktop PC, you can't share that to your Android phone through WiFi. You need to purchase a WiFi router/access point to do so. But now, you can do that at absolutely no cost!!! Without purchasing any hardware!!!! Read on...

Today I came across a freeware application for Windows 7, that turns your Windows 7 computer into a WiFi Access Point!!!! It emulates a WiFi router through Software!!!! And my problem is solved!!!! Now I can share my laptop's wired internet connection to my Android phone. Here is a 2-step guide to setting up everything.

Step 1
Download the application Connectify from here and install it. It will prompt you to install a driver, twice. Press Ok, for each prompt.

Step 2
After the installation, you'll see an icon in the system tray which looks like . Click the icon. You'll see a pop up dialog as shown below.
Turn on your laptop's WiFi card if your laptop has a dedicated button to turn it on. Then fill the WiFi Name as anything you like. I filled it MAX. Check the box that says Share Internet. Then in the Mode drop down list, select Access Point, WPA2-PSK. Oh wait!!! Do you see only Ad-hoc open and Ad-hoc WEP? If you see Access Point, WPA2-PSK or you don't see a drop down list at all, means you're lucky. Just click Start Hotspot button, and you're done! For those who aren't lucky, just like me, read on...
What happened to me was that I didn't see the Access Point mode. I thought, my WiFi card doesn't support Access Point mode. I went to the supported card's list at and I could see my card Intel 5100/5300, WiFi Link 1000 BGN listed there. "Then what's the catch?", thought the frustrated me! I noted that the driver version supported was I checked my card's driver version in Device Manager and saw that it was 11.x.x.x. I went to my laptop's manufacturer support site and saw that the latest WiFi driver for my machine was available and it was I also noticed that all other components(like Chipset, Audio, Graphics, Ethernet card etc...) had updated drivers for them. I Downed 'em all and installed.(What's the morale??? Always keep your drivers updated.)
After the re-boot, I could see a Virtual WiFi MiniPort adaptor installed in Network Connections with the name Wireless Network Connection 2.

Then I launched connectify, I didn't see any drop down list in the mode box(screenshot. below). I entered a 8-character WPA2 key and clicked the Start Hotspot button.

It took a while(about 15-20 seconds) to configure and my WiFi hotspot was up and running! My Connectify popup was now with the Status: Running MAX, Mode: Access Point WPA2-PSK. I was a happy man! I turned on my phone's WiFi and connected my phone to MAX easily. I saw my phone's MAC and IP addresses in the Connected Clients list. Even a Sony Ericsson logo was shown there!!!
Using DHCP my phone was assigned the IP address The computer's Software based WiFi router was assigned the IP address as In the system tray, the red mark from Connectify icon was now removed and it was like this

Everything was up and runing, still I couldn't browse the web. In he phone, I checked the gateway address and it was fine i.e., that I had already cnfigured in WiFi static.
I went to Network Connections, in my laptop. That can be reached through Network and Sharing Center > Change Adaptor Settings. I right clicked my wired ethernet icon and clicked properties. In the sharing tab Wireless Network Connection was listed as the Home Netowrking Connection. I understood that it must be set to Wireless Network Connection 2 which was the name of the connection that WiFi Miniport Adaptor had. I unchecked the box that said Allow other network users to connect through..... then clicked Ok, and closed the properties window. Then again right clicked my wired internet connection icon, clicked properties and in the Sharing tab checked the box Allow other.... In the Home Networking dropdown I selected Wireless Networking Cnnection 2 and clicked Ok and closed the properties window.

I restarted the hotspot and my phone got connected and I could successfully browse the web on my phone!!!
One of the major issues with the phone that I had pointed in one of my previous posts i.e. , has been solved!!! Go Android go!!!

Friday, August 27, 2010

Download Managers on LINUX

My college provides me an awesome fast internet. Actually it is a 1Gbps link which is shared among all the users in the institute. Using download managers(like FDM) I easily achive speeds within 2MB/s to 3.5MB/s on Windows. But on Linux I was never be able to cross 1200KB/s. That was because most DMs don't support fragmented downloading. Then I went on to review all the download managers on Linux and find one best among them all.

1. MultiGet
MultiGet has issues with the proxy implementation in my college. I tried hard but it didn't let me download anything so it was out.

2. KGet
It gets across my institute's proxy server but doesn't do fragmented downloading.

3. GWget
It is essentially a graphical front end to wget, which too doesn't support fragmented downloads.
4. FatRat
It is a featureful download manager for Linux. It supports BitTorrents and rapidshare downloads but I couldn't find no. of fragments in configuration. So, I've to look elsewhere.
5. Downloader 4 X
It supports fragmented downloads! And I easily crossed the 2MB/s mark!!!! That was where I stopped. To achieve this, I went to Options>General and there in the left pane chose Limits. There I could adjust the number of parts to split the file. I set the value to 10 and started enjoying the speed.
6. Aria2c
Happy with D4X, I thought I should stop my hunt. But then I thought I should try the well known Aria downloader. It is a command line based download manager and very popular. I tried that and it supports fragmented downloads.
The following command made me download Fedora 13 into 12 segments. Note that the command line parameter -s is used to specify the number of segments for the download and the parameter --http-proxy allows me to cross my college's proxy cum firewall. xxxxx is the proxy password and ise2010012 is the username.

aria2c -s 12 --http-proxy=http://ise2010012:xxxxx@

If you love command line, this is for you. I do love it!
Please note that any of these download managers can be easily downloaded using your Linux distribution's built-in package manager by searching the name.

Monday, August 16, 2010

Sony Ericsson XPERIA X10 Mini

As my old P1i was giving up, behaving somewhat weird, I thought I should get a new phone. I zeroed in on two phones. The SE Elm which would cost me Rs.10800 and the SE XPERIA X10 Mini Pro which was around Rs.16000. As I have to remain connected on the go and should always be ready to read PDFs and PPTs after getting myself admitted to PG, I ruled out Elm which isn't an smartphone and thought of getting an X10 Mini Pro. I hunted 10 shops in Allahabad but didn't find my phone of choice anywhere. Finally I settled onto the hardware keyboard sans version of Mini Pro i.e. Mini. It was available for Rs.14600 in Big Bazar, Rs.15300 in The Mobile Store and Rs.16600 in a local shop. Obviously, I opted for the Big Bazar.

The phone is little cute wonderful sweeeeeetie in my arsenal now. I was non-plussed at its speed. A 600MHz and an onboard 128MB RAM are enough to run the phone perfectly smooth without any apparent lag in UI, unlike the Nokia Symbians which run quite lethargic. The Android is an awesome development in the mobile OS world. Although it is missing some basic functionality at this point of time but still it is the best way to throw your crappy Nokia sluggish Symbian.
I'll start with the negative points first and afterwards move towards the positive points, then I'll provide you some tips(and apps) for the X10 mini and then off course will provide links to download few of the mentioned apps.

Ok, negative points start first.
1. You can't connect to an ad-hoc WiFi network with android! What a shame!!!! Its not SE's fault, but a missing feature from Android.
2. You can't access internet on a WiFi network that requires you to specify a proxy address and username/password to surf the internet. Again! What a shame!!!! My college's each and every single inch falls in the marvellous WiFi connectivity of the campus but I can't browse the internet through my phone as, a freaking squid proxy server sits between us and the internet, at Anyways, later I found a workaround and was able to surf on my X10 Mini's browser!!! I'll post the thing later.
3. Coming to music player, the music in the bundled earphone is unlistenable. It is bassless and treble full. This is very bad from SE's part, really really bad. SE has been always a leader in mobile music industry with the W550i breaking the records once and others following the similar path. I hadn't expected this level of quality in SE's earphones. Anyways, I pushed in my Walkman's earphone and the quality was perfect. So, the phone isn't the culprit, the bundled earphone is. Actually they have given a 3.5mm jack which apart from earphones, also has an embedded microphone. This is something different from others.
4. You can't create playlists in the music player. Again, this is a no no!!! But well, there are workarounds, especially if you install third party apps.
5. The music player has no equalizer, nor presets for the equalizer settings. So you can't fine tune your music listening experience. Getting Astro Player circumvents this demerit as it has a very good equalizer.
6. The phone doesn't support bluetooth file transfer out of the box, however SE has promised that they will bundle the bluetooth file transfer app in the next firmware update. But you can download the Bluetooth File Transfer app from the Android Market for free and it works very perfectly.
7.  You can't install third party apps on the memory card. Everything goes to the 160MB internal memory. So, you're sure to fall short of some silicon if you are an application/game junkie. I installed 65 third party apps and I am left with around 40MB on my phone memory. Enough for me :)
8. You must have a google account to do many things for example downloading and installing apps from the market.
9. The screen has a low resolution i.e. 240x320
10. The onscreen keyboard is a multitap one instead of QWERTY so typing is slow. But there are third party apps for using onscreen keyboard and the typing becomes perfectly fast with them. SlideKeyboard is one such thing.
11. The battery isn't user replaceable. It is hard coded/wired/embedded under the hood.

Ok ok, lots of criticism by now. So we should now start with the positives and then move to tips and tricks and then continue to some app downloads and then some other relevant info.
1. The User Interface is a marvel. Especially I love the Timescape and the very very fast and responsive interface
2. Most of the android system has been designed very logically and you will love it.
3. The phone has a magnetometer(digital compass) which works perfectly well, although you need a third party app to use it.
4. The phone has location services like geotagging, thanks to the perfect GPS receiver.
5. At 88 grams it is the lightest and smallest smartphone on the planet.
6. Battery backup is good in comparison to the smart phones. Works for two days of normal use for me. Warning: My normal use seems to be heavy use for many people. So if you are someone whose metric for normal use is smaller than mine the you can get your phone to work for 3 days on a single charge with ease.
7. The camera is one of the best 5.0 megapixel cameras in the market. It snaps near digicam pictures in day in good lighting conditions.
8. Although some people say that due to small screen resolution many android apps don't run on it. But this is  false. I've been able to run all android apps from the market, except two.
9. In october the phone's OS will be upgraded to Android 2.1 Eclair

A list of useful apps follows, that you may download from the market.
Some apps can be downloaded from here. Download the archives in your computer and extract them to get the apk files. The password for the archives is blahblah

1. DocumentsToGo(Must-Have)
This cool thing lets you view and edit DOC, PPT, XLS, DOCX, PPTX, XLSX and PDF files very perfectly. This is a must. Download it here, along with the unlocker.
How to install???? Open the menu, tap Settings, then tap Applications. Then tick mark Unknown Sources. Now transfer the .apk files you extracted from the downloaded archive to the memory card's other folder using a data cable. Now disconnect the phone from the computer and in its main menu tap Application Installer. It will search for the .apk file in the card and prompt you to install it.
2. Astro File Manager(Must-have)
Its a very good file manager for android phones.
3. Gesture search(Must-have)
It lets you search for contacts using handwriting recognition. You swipe you finger as if drawing a character with pen, and it will search the contacts list for you
4. Compass
It utilizes your phone's built-in digital magnetometer and shows directions.
5. Photoshop
Wonderful tool for editing images
6. Facebook location updater
It posts your GPS location on facebookwith a link to google map for that location
7. PicSay Pro
Its a wonderful photo editor
8. Seesmic
Its the best twitter client for android.
9. WiFi Analyzer
Its of no use for me ;-( But may be some people will find it very helpful.
10. Yahoo Droid
Yahoo messenger for android
11. Meebo IM
Perfect multiprotocol IM client for Android. You may also try Slick. It is very good.
12. Merriam Webster's Dictionary(Must-have)
Lookup any word meaning. You may also download voice pack for it, the download link for which will be shown to you after you launch it for the first time. The voice pack works perfectly and pronounces the words as you wish.
13. WiFi Static(Must-have)
You can create several WiFi profiles, for example office, home etc. if you are in a non-DHCP network always. Then connect to any network conveniently. Very useful tool for me.
14. Qik
The live video streaming app. For more details visit
15. Latitude
The google latitude service to find your nearby friends
16. Goggles
The photo search app from google. You can snap pictures of some known items and google will try to identify the image and come up with the info. Good for tourists. They can click monuments and know about them
17. Handcent SMS
It shows nicely your sms messages.
18. AndroZip(Must-have)
The muti format archiver.
19. Barcode scanner(Must-have)
Scan any barcode with your phone's camera and know about the product.
20. Apache file server
WiFi File explorer
essentially let you do the same thing. They make your phone a file server and give you a browser interface so that you can download and upload files from and to the sd card from a computer
21. OfficeSuite
Its an alternatice for Docs2Go but I prefer Docs2Go
22. SMS Speak(Must-have)
It will read out your SMS messages!
23. ES File Explorer, Security Manager and Task Manager
Good phone management applications. Security manager can protect your phone if it is stolen.
24. Google Translate
No need to mention.
25. GPS Status
It tells your latitude and longitude as well as uses your magnetometer to show directions.
26. Accu Weather
Weather report of your city on your X10 Mini
27. K-9 Mail(Must-have)
Excellent mail client. Its a must have app!!!
28. MSN Droid
The MSN messenger for your Android
29. Neoreader
This will let you scan QR codes.
30. Android VNC
The VNC viewer for your android. I didn't test it yet.
31. Net Tools
Basic network tools like ping, IP to host, host to IP lookups etc.
32. Chess
The chess game on your android
33. Infinity
Its a browser that uses smart fit and gets you out of the hassle of scrolling right-left on websites.
34. Logmein
It lets you log in to your PC. I didn't test it yet.
35. Setting Profile(Must-have)
It lets you change profile with just a touch! You can create profiles for meeting, home, office, browsing, college etc and set the values for ringer, vibrator, backlight etc and then when entering one of those areas, change the profile instead of individually changing the settings.
36. Vignette
It lets you frame your camera pictures
37. Blogger Droid
For photo blogging from your phone.
38. System
It lets you view essential system info, like free RAM and processor speed
39. Google Sky(Must-have)
It lets you view the location of astronomical bodies. Its a very good app for astronomical fun.
40. ThickButtons(Must-have)
or SlideItKeyboard
The onscreen QWERTY keyboard instead of the built-in multitap keuboard. They both are good, but I prefer ThickButtons ;)
41. Pixelpipe
One touch multiplatform blogging app
42. Connect Bot
Use SSH from your phone
43. Bluetooth file transfer(Must-have)
Transfer files to and from you phone via bluetooth.
44. Advance lie detector
I don't believe it works! But still you can try it for some fun
45. Search plus
Search content on Bing, Google, WikiPedia, Twitter etc.

Some handy tips
1. How to transfer contacts from your old phone into your android?

Use your old phone's contact backup feature to create a VCF file for your contacts. For example, in SE phones in Contacts>More>Advanced there is an option Backup To MS. Use that. Then copy the vcf file from the memory card to your computer. Now open up on your PC browser. Click the Import link on the extreme right. Now upload the VCF file.
Next, on your X10 mini. Choose Settings. Scroll down and click Contacts. Wait, you'll see all your contacts soon on the phone.
You must have an active GPRS/EDGE/3G/WiFi connection for this feature to work.

2. How to configure GPRS access?
Menu>Setings>Wireless Controls>Mobile Networks>Access Point Names
Now press the first key, i.e. the first of the three keys on the phone below the touch screen. Tab New APN.
Put the name of APN, for example Virgin Mobile
Put APN as the APN of your service provider, like
If your service provider requires a proxy, then fill it up. Leave other fields blank.

3. Troubleshoot GPRS
Sometimes you may notice that you aren't able to see the E or G signal. Go to the APN setting, scroll down to the bottom and check the APN Type field. If its blank, then its fine else blank it.

4. How to lock your phone from unauthorised use?
Menu>Settings>Security & Location and turn on the Require Pattern field. Now you can create a locking pattern for unlocking your phone sceen when required, instead of typing a secret number as you might have used inyour old phones.

5. How to enable third party on screen keyboard like ThickButtons?
Menu>Settings>Locale and Text. There tick mark ThickButtons. Now come back to messaging or browser or any app that has a text field. There long tap the text field. Long tapping means keep your finger on the field for a few seconds. You'll get a menu, just choose ThickButtons there.

6. Secret codes?

First: Press *#*#4636#*#*  on the dial pad to reveal a secret menu.

Second: When phone is in locked state, press a key. You will see the prompt to push the option key to unlock but do NOT unlock the phone.
Next, press the key sequence below in the order provided when the "unlock now" screen is still visible: 


7. Android Versions
1.5 -> Cupcake
1.6 -> Donut(In X10 Mini)
2.1 -> Eclair
2.2 -> FroYo(Frozen Yoghurt)

Monday, June 21, 2010

10 constructive ways to spend time on internet

Internet has infested our life to an unseparable extent. Most of the people feel they waste their precious time on the internet on social networks(read Facebook). For all such people I'm suggesting some constructive ways to INVEST(not spend or waste :P) their time. Constructive in the sense that these actions will lead to your personality/knowledge/IQ/skills growth. :)
1. Yahoo! Answers
Man, what a wonderful platform they've created for knowledge sharing!! You can ask questions and provide answers. The questions are available in myriads of categories, from Arts to Sciences, from Humanity to Relationships, from Cooking to Religions etcetera etcetera... In fact, any question you can think off can be put to a suitable category. Especially for students they have Science and Mathematics, Computers & Internet, Arts and several other fields. So you're stuck at an assignment or homework? Just ask! Or, you think you are one among the intellectual force of your country? Then answer others' questions according to your interest in relevant categories. This not only improves your knowledge but also gives self satisfaction as well as entertainment. When someone rates your answer as the best answer, you feel proud :) Click here to visit Yahoo! Answers. You need a Yahoo! ID to access Yahoo! Answers.
2. Are you a programmer?
Well yeah, if you are and you think you are one of those rare programmers with all the fundamental concepts of programming then a perfect place for you is The site doesn't require registration. You just need an account with any OpenID provider. A GMail account is perfect :) Once you get in, you can answer questions from fellow programmers/students all over the world from all kinds of languages. As you answer perfect replies, your reputation increases and you earn badges. Its such a fun!!! Click here to check it out.
3. Read blogs
Blogging is a boon to the Web 2.0! People got a way to express themselves, with a true freedom of expression. You can just go to Google blog search and find blogs of your interest. You may also search good blogs from popular blog directories like TechnoRati, BlogCatalog, BlogHub and BestBlogs. If you are a technology lover here are some must read blogs:
4. Research
Did you get stuck at something some day and left midway? Then start researching on the topic using the web and complete your venture! It happens sometimes with all of us. We start doing something and due to a problem encountered midway we are unable to accomplish the task and leave it incomplete. For me, not finishing an in-progress work is sin!!! So, I just use te web, search for solutions and finish the work.
5. Contribute to an OpenSource project
So you are that self-proclaimed great programmer? Go and give a chance for your skills to come outta your brain! You can contribute to any open sopurce project for the betterment of mankind at sites like Google Code or SourceForge
6. Edit a WikiPedia article
WikiPedia makes our life easier. Any thing new pops up, we just get to its WikiPedia page and find extremely high quality information on the topic. But who makes this possible? Yeah, we the users. WikiPedia is driven by the community of people who add and edit articles on it. If you have a flare for writing good quality, precise and clear english then start or edit an article on WikiPedia. For this you need to create an account with them. The account creation link can be found at top right corner of their main page.
7. Start a blog
If you already have a blog then skip this paragraph. Most people think they can't write and thats why they don't start blogs. Everyone can write!!! If you've an year or more experience of using internet then chances are pretty high that you can endup writing good quality original content on your blog. Choose any particular motto of your blog and start. Once you start, you will have several ideas for posts that you can create. Just don't be lazy, thats the only condition. Try this at least once! For blogging, Blogger, Wordpress and Posterous are awesome and free platforms. Just give it a try and jump into the blogging arena!
8. Translate facebook into your language
Facebook has a pretty good translation application through which you can easily translate it into your language. The users themselves can translate and help facebook be available in their language. I actively translated it in Hindi for a few weeks but currently due to being away from broadband access, I'm on a halt and resume it once I get hold of fast internet access. The translation application can be accessed at For inputting text in Hindi you can use Google Transliterate where you can write phonetic spelling of a non-english word in english and it will display the word in your language for you! Or even fast is the desktop application for transliteration which can be downloaded from through which you can directly input in your language by typing its phonetic spelling in English. Go, give it a try!
9. How about some entertainment?
Entertainment energizes the mind. So, isn't it a catalyst for being constructive? Go and read You won't be able to stop your laughter!
10. Be nostalgic
So, everything failed? Be nostalgic! How? Go to your GMail inbox and start reading the mails from the last page!!!! This really works(provided you have a fairly old account). Or you may also start reading last page of your orkut scrapbook or facebook wall.

Thursday, June 10, 2010

Wind powered cellphone charger

While travelling with Indian Railways, sometimes especially during long journeys I experience my phone's battery falling short of electron flow. Although in AC boggies they provide charging points near every berth but not everyone always travels in AC boggies. In sleeper boggies, in most trains they do provide 4 charging points in every boggy but they aren't enough and occupied most of the time by rogues who keep listening to music in full volume with their phones' speakers while charging, hence not letting others charge their phones.
One such situation at hand, and the inquisitive me started thinking of something cool that would work perfectly. I stood at the gate of my boggy feeling the wind at 100KM/hr(that was train's direction in east, so wind's velocity for me was 100KM/hr in the west) with my palm, and then came the EUREKA moment!!!! A smile spread throughout my face. Yeah, I had got the idea! Why not someone build a portable wind powered mobile charger?
How will it work? There can be a wheel with blades which will rotate fast when wind strikes it. The wheel and axle machanism should be connected to a dynamo, a small one used in bicycles for lighting. A 12V/3W will work perfectly. Now the passenger can take his/her hands out of the window or may even stand at the exit gate holding the whole thing in his/her hand. When wind falls on the wheel, it rotates, in turn rotating the dynamo axle which produces an alternating current. Using a rectifier it can be converted to DC. A capacitor with appropriate specifications can be used to smoothen the waveforms produced by the rectifier. This output can be fed to a IC7805 which stabilises the voltage at 5V DC which is required by most mobile phones for charging. Take this output, connect it to a multi-model pin connector which can be used to charge any brand's phone. Now pack this whole makeup in a cool looking case, label it and sell it!!!! Done! Earn loads of money.
It will be very helpful for the travellers who can very practically stay online during long journeys keeping their cellphones charged :)

Sunday, June 6, 2010

IIIT-Allahabad M.Tech selection process

With this article, I'll acquaint the reader with the full interview process of IIIT-Allahabad M.Tech Course in Software Engineering, linking with my own experience of my selection.

If you are just preparing for GATE, you should solve more and more questions. And for that I would recommend GKP Publisher's Question Bank. Although there are some mistakes in the book for solutions to some problems, but I recommend this book solely for the huge collection of problems it has.

After an initial shortlisting based on GATE scores, names of 148 students were posted on their site who were called for the Written Test + Coding Test to be held on 1st of June and Interview of qualified students on 2nd. I received my admit card 7 days before the test. Kudos to Bharatiya Daak for their crappy service, a friend of me had received 15 days ago.

I reached Allahabad on 31st May night, and stayed at a relative's residence. On 1st June I reached IIIT-A campus at around 8:30. The auto-fare from station is just Rs.5 so don't think that being in the outskirts of the city it is very far as mentioned in Admit Card that the fare would be Rs.70-100. I guess, it is around 7-8 kilometers from railway station.
I was greeted by the guards, who were very co-operative. I was directed towards the boys hostel. I entered the mess. To my surprise, it was completely Air Conditioned and very well maintained and clean. I drank some water and cooled myself, as the North Indian heat had struck me on the way hard! Yes, at 8:30AM it was very hot in Allahabad! I believe, the temperature was 42+ at that time! In the mess itself I met my net friend Shailesh Sharma who too was shortlisted and had arrived for the admission process. We had got introduced to each other through this blog itself through my post GATE-2010 Solutions. I got introduced to his friend Vipin and we were now a group of three! At 9:30 we headed out towards the academic campus. Our written test started at 10.
The paper consisted of 100 objective questions to be solved in three hours. There were tricky questions from C, followed by Java, some very easy questions from data structures, some easy ones from SQL, and then from software engineering. Overall, the paper was deviating 80% from the provided syllabus. In first 20 minutes, C questions had trapped me and I had solved only 10 of them. Later I changed my gear and by the end of 50 minutes, I had marked all 100 questions. There was no negative marking so there was no fear of wrong answers. Marking the answers on the answer sheet took me another 40 minutes because of bigger bubbles and use of ball point pen for filling the bubbles. The question paper lacked quality standards. There were inconsistent questions, and weird ones too. Some seemed to have wrong options too. Anyways, we finished. I believe, I must have got around 70 questions right. We headed out for lunch.

At 2PM we went for the coding test. The lab had computers running Windows and Linux(Ubuntu 9.04). Student was free to choose his/her environment. I chose windows thinking that they may put me on vi editor if I chose Linux and as I am not much comfortable with vi, as well as touch typing. I saw that there was no CUI, but a GUI environment had been provided on Linux systems so I switched to a Linux system thinking about the added advantage of synatx highlighting of gedit. Windows people had option to use Turbo C++, or Microsoft Visual C++ or Dev C++. Linux users had good old GCC.
All the computers were on LAN and we had to open a URL in our browsers where Online Judge software was running. The software was coded in PHP. We had to upload the source file after coding. The compilation and evaluation on random inputs was to be done by the software itself. If the software was satisfied with our code it would give us points. But there was a catch. The way of giving input was pre-specified and exactly the program was required to receive input that way only. And the required output too was given in a pre-specified manner. This was because the code was run by a script, not a human being. Being dumb, a script can't accept anything deviating even slightly from the specified standards.

There were three questions in the paper. First was of 20 marks. Second one of 35 and third one of 45 marks. The time alotted was 3 hours. The questions were easy but I felt that I'll have problems in designing the input module because the language to be used were C or C++. I thought, if I were allowed to use PHP, I would churn out these questions within 5 minutes each. explode() function in PHP would easily let me process the input, the way I wanted. But I had to work with C and there was no explode. I was unable to take the input in required form and put it into a data structure for further processing and output. I coded the processing and output modules for 1st and 3rd questions but couldn't code the input module. Then I attacked the 2nd question and cracked it easily. I was sweating heavily in the Air Conditioned lab. As soon as my 2nd question's answer was accepted by the script I took a sigh of relief.

I checked the time and 2 and half hours had passed already. I checked the current results. This facility was provided by the Online Judge software. We could see which student had submitted correct answers. There was one girl at rank 1 who had solved 2 questions i.e. 1 and 3. She had 65 points. I was at rank 2 with 35 marks because 2nd question was worth 35 marks. There were 15 students behind me, each with 20 marks, who had solved the first question. Out of the rest, noone else could solve any program!!!
I re-attacked the 3rd question to process the input anyhow. I cursed myself for forgetting the strtok() function's syntax which would easily let me solve the 1st and 3rd questions. Strtok() works a bit similar to the explode() function in PHP. I thought I should code my own explode() function in C and I started off for the same. I reached very near but the time was up, by then! I checked current rankings. I was still at rank 2, behind that girl.
The authorities announced that those whose programs were running manually but were not accepted by the Online Judge software could get their programs verified by invigilators and get some marks. Many students who were not in Online Judge's ranking list raised their hands and were getting their programs verified. Some claimed that they have solved all three but none was accepted by online judge. I thought in my mind, even if they get more marks and I get rejected I'm still a better programmer than them because my program followed the standard defined in the problem. Anyways, the process ended after sometime. We were advised to wait for an hour for the declaration of result. We roamed through the college. At around 7PM the result was declared. Out of 148 appeared, 56 were shortlisted for the interview to be carried out next day. I was there in the list!

Shailesh and Vipin too were there. We bid good night and parted away happily thinking about the next day.
On 2nd day, we reached for the judgement day! Everyone was in formals. We were made to sit in the auditorium from where we were called for the interview one by one based on the roll number. My roll no. was 142 so I was relaxed that my interview will take time. First Vipin was called, being early in the sequence, followed by Shailesh. Finally my turn came. My interview went very pathetic. When I was asked 'tell me about yourself', I mentioned about IndiFun. Then I was asked 5 questions from the theory of social networking each going well above my head.
Then I was caught by another interviewer who was a guest lecturer from IIT Khargapur. He asked me my favourite subject. I said - databases! He asked me to define functional dependency. I spoke: an attribute B is said to be functionally dependent on an attribute A if for each unique value of A there exists a unique value in B. Then he asked, what is the mathematical term for that. Within a fraction of second I recalled about functions and two obvious answers came to my mind - one one, and one one onto. I was also frustrated due to the early 5 questions that had gone beyond me. I spoke one one onto and felt that I've made a blunder!!! He asked, where did you read this? I said Elmasri and Navathe. Then after a pause of a second, I continued, I read about functional dependencies in Elmasri and Navathe but not the fact that this is one one onto function. Then he asked, considering functional dependency define 3NF. I got confused over 3NF and BCNF. I started speaking about BCNF then stopped, beg pardon and said a table is in 3NF if it is in 2NF and every non-key attribute is non-transitively dependent on all the candidate keys. He said go.
I went out thinking about those 5 questions that hit me in a row. I thought I don't need to see the result, as I won't be selected. But a hope kept me on. The result was declared at 7. Out of 56, there were 15 selected in General category! My name was there at 9th position in the alphabetically sorted list!

I had a sigh of relief! Finally I got into an India level institution. Shailesh and Vipin too made into the 15 lucky people list. I believe the final result was made up based on GATE score, written test score, coding test score and interview, where interview had a lesser weightage. If it had higher weightage, I would have definitely been ousted!
Our classes are going to start from July 9th. That was my experience with IIIT-A selection process :) Will keep you posted with the further developments in my life/career.

For Indian Railways

This is to draw the kind attention of competent authorities in Indian Railways.
I, on behalf of student community, and as a proud and aware citizen of India, want to draw the attention of proper and competent authorities towards the fraud and corruption looming large in IRCTC catered service which is leading to the plight of passengers, especially those travelling in Sleeper Class. I'm also incorporating some suggestions, which if implemented will result in better customer satisfaction.

1. Water: As far as I know, it was made mandatory that IRCTC would sell only Rail Neer branded mineral water bottles in the train. May be I'm wrong about this fact, I've experienced personally that the water/drink vendors are selling all brand waters except Rail Neer. I ask for Rail Neer and they say, it's not available, take Bailey or IceLing or Yes. I won't mind if the quality of water is good for the same price of Rs.12. But, the striking thing I saw that those small kids, powered by a racket of anti-social people, who collect thrown water bottles from railway track on stations, fill water from anywhere they like, get it sealed and pass to the IRCTC approved vendors. The vendors as well as the racket involved in this share half of the revenues. What the customer is getting? Unhygienic water in unhygienic bottles paying Rs.12. The mistake is from customer side also. As mentioned on the bottles please DO CRUSH THE BOTTLE AFTER USE IF YOU AREN"T CARRYING IT HOME. This is for your own good dear common man!

2. Tatkal Seva: Your tatkal reservation scheme is completely wtf!!! The first and foremost thing is that, at 8AM IST stops responding so internet reservation is next to impossible for the stupid common man. What I see is 503 SERVICE UNAVAILABLE. Now, you railway guys would say that you can get the reservation on the station. Ok, I agree. But see what happens. When I reach the station at 7:00 AM and stand in the queue, I see at least 20 people ahead of me. I repeated the same experiment next day at 6:00AM. Then too I had at least 15 people ahead of me. So, I thought let me be a good citizen and wait for my turn. Finally I reached to the front of the queue at about 8:10 and the teller told me the status is W/L 60. What the -? A man roaming like a pig in the vicinity came to me and offered the ticket for Rs.1200. I identified him and was surprised that he was in the queue when I had reached there at 6AM. I refused and headed towards exit without getting a ticket. During the next 20 meters of walking I was offered ticket for prices ranging from Rs.900 to Rs.1200. And they were all those who were in the queue at 6AM. To sum up, there is a racket which keeps its agents at stations from time varying between 4AM and 6AM to be in the queue for tatakal tickets for most sought for destinations. How can you control this blackmarketing?? Can't you get your IRCTC server right, so that people may get tatkal e-tickets? And then it will be very difficult to black e-tickets because the traveller has to present his/her ID card with name matching with the name on the e-ticket and reservation chart. This step will put a check on those ticket blackmarketer rackets. All the crap in your tatkal seva is especially frustrating students and other people who get to travel urgently very often.

3. Recently you've introduced the fares in front of each train in the list of trains that come up when anyone queries for Availability of seats(in case you don't know station codes) on One suggestion from me, can't you show the availability as well along with the fair? If you can't, then freaking upgrade your servers and start doing right away you public money looters!!!

4. On, any action I perform, even clicking a text box to put the cursor into it, results into opening up of an ad from Have you designed the site for public convenience or public harassment??? You earn from our ticket fares and you the greedy lot want to earn more and more by giving us inconvenience in the form of those nasty popups??? And who the freaking fool gave you WebRatna-2009 award for public service? 'sab ek hee thaili ke chatte batte hain'. Cut this crap in good faith right away!!!

5. This is for Mrs. Mamta Banerjee, honourable Rail Minister. Lalu uncle did only one good reform during his tenure, and that was putting up a middle berth between side upper and side lower berths in sleeper class. It was itching you at the back, and you got all those removed saying that this causes inconvenience to passengers. Have you ever travelled in sleeper class? The people in the waiting list travel by sleeping in front of lavatory doors and in the space between the entry gates of every boggy. Thats not inconvenience according to you. Right? And sleeping on the side middle berth is inconvenience according to you. Very good IQ you have ma'm! Salutes to you! If there had been this, side middle berth thingy, per boggy 8 passengers and per train more than 100 waitlisted passengers would get a confirmed berth to sleep in the night, instead of laying their bedsheets below water basin between the two gates in every boggy.

6. This mobile charging point thing, at the gates of every boggy in sleeper class has become a menace. Rogues only charge their mobiles. They start the travel with their mobile's batteries discharged thinking 'Bhartiya rail hamari sampatti hai'. This is total inconvenience to the needy passengers who don't want to talk to those rogues. Can't you get those charging points in every compartment, just like they are in AC boggies?

7. This one is for Amul. Have you guys ever thought that why Pepsi/Coke/Thumsup/Sprite sell 100 times more than your lassi, in trains even though your lassi is tastier and nourisher than those MNC carbonated water? Give a thought! Lower your prices. You are selling them at Rs.20 for 200ml. They sell for Rs.10 for 200ml. Can't you lower your prices? Don't say that it won't be affordable for you. Nandini lassi in Karnataka is available for Rs.5 for 200ml. Instead of trying to earn more by higher margins per unit, you should keep lower margins and sell more units instead. This will give you better returns. I hate those cola companies who are drawing Indian water and selling to Indians for high prices.

I'll keep coming up with more whenever I feel like finding something new with Railways.

Wednesday, May 19, 2010

How to use <conio.h> with GCC

This article will teach you how to use <conio.h> header file while programming in C under linux environment with GCC, and getting unbuffered input from the user.

Most of the students are taught C/C++ with Turbo C/C++ IDE in schools. Turbo C has a header file(unspecified in ANSI standard) <conio.h> with which programmer can program for unbuffered input using functions like getch(). Also there are other functions like gotoxy() etc. which work perfect in DOS environment with Turbo C.
After they learn about linux, and then GCC they start practicing in linux. If you are such an student, read on. This will be handy for you.
At some point of time you will write a program in which you want interactive user input from the user. Interactive in the sense that you want an action to be performed as soon as a key is pressed. But since standard library function getchar() buffers the input until ENTER key is pressed, it will be quite irritating for you. So, you'll miss your <conio.h> header file that you used in Turbo. Don't worry. I faced the same problem and I ran around like everything to find a soluion. And finally, I found a solution!!!

Just download the libconioh from this link
Install it. Here are the steps(I'm considering Ubuntu as the example):
1. Copy the downloaded archive to your home folder
2. Open the terminal, by pressing Alt+F2 and typing xterm and pressing enter.
3. Become root by typing
sudo -s
and supplying your password.
4. Type

tar -zxvf libconio-1.0.0.tar.gz
and press enter to extract the archive. To make the typing easy you may press the <tab> key on your keyboard after typing l of libconio-1.0.0.tar.gz for autocompletion of filename.
5. Now enter into the extracted directory by typing
cd libconio-1.0.0
and pressing enter.
6. Install the library by typing these commands one after another's execution.


make install 
 Now the library has been installed. How to use it for programming?
Just #include <conio.h> in your program. And when compiling your program(eg. myprogram.c in current working directory) using gcc give the library's detail to the linker like this:
gcc myprogram.c -lconio
You will get the a.out file if your program doesn't have any errors.
Execute it and enjoy!
But what did that -lconio did? See, in gcc the source files and object library files can be linked by specifying them back to back. Like:
gcc file1.c file2.c lib1.a lib2.a
In linux the library files are with .a extension and they are stored in /usr/lib/ directory with the name format lib<library_name>.a . So when you installed libconioh it copied a file, named to the /usr/lib directory. Now you can compile and link your program that uses conio.h by this command
gcc myprogram.c /usr/lib/libconio.a
The -l switch has been provided as a shortcut for your convenience. This -l makes conio to be read as /usr/lib/libconio.a hence when yo typed gcc myprogram.c -lconio it was interpreted as gcc myprogram.c /usr/lib/libconio.a . Now thats sweet! Isn't it?
Here is a sample program that reads characters from the keyboard, displays the character just next to it(for example, if u enter b it will display c)  and exits only when you press the small a key.

#include <conio.h>
int main(){
char c;
return 0;

Sunday, May 16, 2010

Implementing a list data structure using an array, in C

Long time since I interacted with C. I thought IIIT-A interviews are coming closer and they also have a coding test in which they ask to write programs, so I went off to revise data structures with C. I planned to study lists, linked lists, stacks, queues, trees and graphs and implement them all using C.
The first one on the target was lists. So I started off and wrote a lists demo program. I'm posting the program below. It may come handy to you if you are a student searching something for your assignment.
Compile it in GCC. You may also compile on Windoze but I haven't tested on Windoze.
The program allows to:
  1. Print all the values stored
  2. Insert a new value at specified position
  3. Insert a value at the end of the list(append)
  4. Delete a value at specified position
  5. Delete all occurences of a value from the list
  6. Find all occurences of an item
  7. Empty the list
I've also made the text colourful using the escape sequences for colours. Those \33[31m things are for colouring the text displayed while executing the program.

Here's the program.

#include <stdio.h>
#define SIZE 65536
#define ENDMARKER -65535

int data[SIZE];

int print_all();
int add(int pos, int datum);
int delete(int pos);
int append(int datum);
int delall(int datum);
int find(int datum);
int print(int pos);
int empty();

int main(){
int pos, datum;
int option;
printf("\n\33[36mWelcome to the list data structure demonstration program! The program starts with a list of integers(initially empty). Through this program's interface, you can insert items into the list at desired positions, or at the end; delete an item from the list from an specific position, or all occurences of an item from the list; find the position(s) of an item in the list; view all the items of the list; view an item stored at a particular position; or you may also empty the list.\n");
printf("1. View all the items");
printf("\n2. Add an item at a given position");
printf("\n3. Add an item at the end of the list");
printf("\n4. Delete an item at a given position");
printf("\n5. Delete all occurences of an item value");
printf("\n6. Print an item at the given position");
printf("\n7. Find all the occurances of an item");
printf("\n8. Empty the list.");
printf("\n9. Exit\nEnter your choice and hit the enter key:");
case 1:
case 2:
printf("\n\33[33mPlease enter the position where item should be inserted: ");
printf("Please enter the item value to be inserted: ");
add(pos, datum);
case 3:
printf("\n\33[33mPlease enter the item value to be inserted at the end of the list: ");

case 4:
printf("\n\33[33mPlease enter the position of the item to be deleted: ");
case 5:
printf("\n\33[33mPlease enter the item to be deleted from the list: ");
case 6:
printf("\n\33[33mPlease enter the position of the item whose value is to be printed: ");
case 7:
printf("\n\33[33mPlease enter the item value whose position is to be found: ");
case 8:
case 9:
printf("\n\33[34mThank you for using this program. Have a nice time!\n\33[37m");
printf("\n\33[31mInvalid use. Please retry.\n");
return (0);

int num_items(){
int num=0;
int i;
return i;

int print_all(){
printf("\n\33[31mNo items could be found in the list.\nYou may insert some data first, before experimenting.\n");
return 0;
printf("\nFollowing items were found in the list:\n\n");
int i;
return 1;

int add(int pos, int datum){
if((pos>num_items()) || pos<0){
printf("\n\33[31mYou can't enter an item at this location because the list is full upto %d position. You can enter items from 0th position upto %dth position.\n",num_items(),num_items());
return (0);
int i;
printf("\nThe item %d has been successfully inserted at the position %d.\nThe modified list is as follows.\n\n",datum,pos);
return 1;

int append(int datum){
printf("\nThe item %d has been successfully appended to the list.\n The modified list is as follows.\n\n",datum);
int i;
return 1;

int delete(int pos){
if((pos>num_items()) || pos<0){
printf("\n\33[31mThat location doesn't hold any data value. Please enter a location that contains a value. Locations from 0 up to %d hold data values.\n",num_items());
return (0);
printf("\n\33[31mThe list is empty. No deletion possible.\n");
return 0;
int i;
printf("\nThe item stored at the position %d has been successfully deleted.\n The modified list is as follows.\n\n",pos);
return 1;

int delall(int datum){
int i;
printf("\n\33[31mThe list is empty. No deletion possible.\n");
return 0;
int found=0;
printf("\n\33[31mThe requested item wasn't found in the list. Deletion not possible.\n");
return (0);
int j;
printf("\nAll the occurences of %d have been deleted from the list. The modified list is as follows:\n\n",datum); 
return 1;

int find(int datum){
int i;
printf("\n\33[31mThe list is empty.\n");
return 0;
int found=0;
printf("\n\33[31mThe requested item wasn't found in the list.\n");
return (0);
return 1;

int print(int pos){
printf("\n\33[31mThe list is empty.\n");
return 0;
if(pos<0 || pos>=num_items()){
printf("\n\33[31mThats an invalid location.\n");
return 0;
return 1;

int empty(){
printf("\n\33[31mThe list is already empty.\n");
return 0;
printf("\nThe list has been successfully emptied.\n");
return 1;