Monday, March 14, 2011

confessions of a lost mind

Its been 3 days now. I have been sitting in the same place I was put 3 days ago. I should not be bothered about that because my life was like this 4 months ago. My owner lived not 100 steps away from the office so "work from home" became "work from office" and moreover he had a Dell dude to take care of his needs. I used to be left in the corner, forgotten and I never complained. But something happened 4 months ago. My ownership changed hands. I was taken in by a cute little girl since her laptop had broken down. I had doubts at first, I was little scared and fearful. But then I started to like her. She took good care of me, atleast I was in use everyday. Her little fingers running over my keyboard gave me tickles. And she would go to sleep under my watchful eyes. I would be on, the whole night and I would wake her up on gtalk pings. I would be sad when she would leave for work in the morning and like an obedient housewife I would be all ears for her footsteps in the evening. I have never felt more happy than when I would see her enter through that door and she would smile at me. In few seconds I am up and running and boy, is she leading a very complicated life or what! There would be 3-4 word documents open, 2 video files running, tons of websites (mostly shopping sites), gtalk, facebook bla bla. I never complained. This is nothing for me and I was just happy to be able to serve. We were best friends in no time. For sometime I forgot what I am and where I am. The occasional car rides, the smell of delicious dinner, were but for few days untill this "hp" dude showed up at the door one day. My whole world was upside down. I remembered her checking out that dude over internet but I never paid attention. But I accepted my fate. After all I am old now. Hp has got this fancy webcam, stylish keyboard, drop-dead looks. She decided to move on, like everyone else and here I am, back to where it all started. In few days, I'll be returned to the company from where I came and may be I'll be dismembered, disintegrated, thrown away...I don't know, but I'll always cherish my days with the girl.

Stumble Upon Toolbar

Sunday, March 6, 2011

Why do I always end up with morons as roommates

Some people could be so insensitive to others I can never imagine. I wonder if some people are left out of the evolution race.

Its 3 in the morning and I am up. Any normal person would be sleeping now and I would be sleeping now if for any other normal day. But this day isn't like any normal day. This day my bloody dumbass roommate decides to talk to his some bloody friend or family I do not care back in India. And when he is talking over phone he decides not to budge from his bed. Thats good things except that his bed is right next to mine. So he doesn't know when he is speaking, he is not only speaking to the microphone, he is yelling at my ears also. Bloody hell. My sleep is ruined. My day is starting up with I am super irritated and mighty pissed of at my roommate. He is truly a stupid guy. He is from some crappy university, which has 5 words in it and one word happens to be Purdue so he goes on telling everyone "I am from Purdue". Recently he met another proper Purdue university guy and when that guy asked which side of the university you stay, or your department etc and to which yours truly replies "Oh I am from actually so and so university" and the other guy tells him on his face "Dude, thats not Purdue".
One time he goes to the university to sort out his training thing and finish all the paper formalities and guess what he forgets to bring along to the university, his documents folder. The next morning he calls me from the university and tells me to scan his passport, I-20 and other documents. I am like what the hell man!!!! Who goes to a bar and forgets to bring along his Id (Yes, he has done that also).
Sometimes I really believe people cannot be this stupid but every time I look at my roommate and I get my proof. He is such a shame on human evolution. Moreover I am not talking about some guy from the shanties, some uneducated asshole who has not be told about manners etc because those can be stupid but if you are properly educated, had a family when growing up, were told about manners and common sense, and you applied to some US university (no matter how crappy the university is), one can atleast expect some sane thoughts and actions from you. Even after all these you still act dumb, well, you are an asshole and you rightly deserve to be someone's asshole.
At this time I remember one quote from Calvin&Hobbes because it so much suits the situation.

--The most difficult part of being a genius is that you have to put up with millions of morons around you.


Stumble Upon Toolbar

Monday, February 21, 2011

Music....simply music

I have been a big music buff but still lot less than others who are like crazy after it. I am not like many of those music fanatics who put up huge posters of their idol and revere their each voice, neither a fanatic to spend couple thousand bucks to see their idol play it live somewhere.
I am basically a traveler personality when it comes to music. Yes, I am a finder, I am an explorer. I keep looking for good music, the one that speaks to me and listening to which I feel my souls' just been touched by that voice, that music, that lyrics.
I am not aver to listening to rock, metal, or rap etc but I find that country songs are the one that I best relate to.
I am a very very big fan of bollywood music. As much as I hate Hindi movies, I love more their music. Thats the music I have grown up with. During my undergraduate days at Rourkela I came across people listening to western bands like Backstreet Boys, Jennifer Lopez etc and I liked their music also. With time I came across lot of other artists and bands. Linkin Park, Bryan Adams etc. Listening and loving the music is lot different than being lost in music. And the hindi songs are the one that have those effects on me. May be because I am better able to understand Hindi lyrics than English. It usually happens to me that while listening to English songs I couldn't make out some of their lyrics and its when I explicitly look at their lyrics I get to understand what he/she meant to say. This would take away some charm of the music experience for me.
Also when I would love some song, I would like to sing it myself more often, try to get the feel again and again inside me and I would completely fail in that respect with English songs. Its hard to remember their lyrics and add the accent to that. Its totally not the same to listen the same song in Indian accent. Ruined.

Coming to Hindi songs then. As I said I enjoy the experience of listening to hindi songs as if I am a traveler, an explorer. Moving from one song to another and trying to see how that songs speaks to me. Discard the songs that evoke a feeling of irritation, anger, disgust. And there are many of these, with crappy lyrics, mixing English, Arabic and all sorts of language with Hindi, and some songs here the lyrics is so out of rhythm, poetry, flow, some songs where music doesn't do justice to the underlying voice and lyrics and thats why remixes are totally not of my taste. They completely ruin the feeling. Although any music instrument is fine with me, violin and flute are in particular, evoke a strong urge from my inside. They are the instruments that straightaway touch the soul without even trying. So simple, so fine, so strong, speaking thousand vibes.
I am always in the hunto for good music. Thats why when I am listening on grooveshark or Youtube I jump from one to another. Sometimes I would simply discard the song and sometimes I would simply stop on something, stuck ion it forever for it seems, as if I have been to one of the wonders and I am spellbound. Thats when I feel like listening to this song for thousand times and still not feel bored. The beauty is everytime I would hear the song, it would bring out a stronger emotion. After listening to atleast 10-15 times I am like totally immersed in its effect. I feel like I am lost. I feel like I am standing in front of a vista, to which I can simply stare for my lifetime, silence, no words, so peaceful. Yes peaceful. Oly the winds blowing, water rushing through the stream, clouds covering the mountains, foliage everywhere, green, white, blue. Anybody can get lost in front of a view like this. The passion for music blends well with my traveling enthusiasm. I love to travel and I have been to many beautiful places. And I just get lost in those places, totally oblivious of the fact how much time has passed since I have been watching this view. And whenever I listen to some of my favorite songs, I could close my eyes and all those memories would come crashing in front my vision. I relive those moments all over again, and again and again and everytime I feel more and more connected, more and more close to reality, as if I can touch the snow, feel the cold wind, hear the water drops, see those mountain peaks, breathe that air.
My songs speak to me. They know what I am going through and like a faithful lover, a caressing mother, a responsible elder brother, an understanding friend they embrace me in their arms. I feel lost, lost of all thoughts, lost of worries, lost of happiness and sadness, lost of family and friends, lost of the world, lost of luxury, lost of religion, money, work, lost of myself. Sometimes I would virtually feel my soul coming out of my body, as if the music punched a hole in my chest and took out my soul. Thats the power of music I am talkig about. If a find a music that speaks to me, when listening to it, it feels like I am connected like the pieces of a jigsaw puzzle, yes, exactly like that, as if there are rows of pieces and I would just go and my body would connect with every single incomplete piece. I feel complete. The music feels complete. My body would shake automatically with every beat of that song, my lips would speak out the words with the artist, my skin hair will rise in appreciation, goosebumps all over the body, feets and head in sync with the beats.
I cannot imagine without music. They bring out so much emotions out of me that I cannot express. The lyrics make me go crazy, literally speechless. I cannot admire enough, the lyricist, the musician to be able to do justice to that, the voice blowing life into it and whoa, you got a mysterious mistress. Music is like beauty. The speechless power it contains, you would never be able to appreciate until you feel something inside thats just inexplicable.
Its incredible how much energy each song contains yet how much calmness they infuse in you. There is no better alternative when you want to remember someone, relive some moments of the past, or just to forget everything around you, than to listen to your favorite music, earphones, loud volume, laid back in the couch or bed, eyes closed. Darkness. Total darkness. Stop. Feel.

--Goldy

Stumble Upon Toolbar

Wednesday, October 6, 2010

Adding new contact fields in Funambol

Another 2 weeks into Funambol and this time the work is little different, more interesting and more challenging. The task at hand is to add a new field under new contacts in Funambol. Previously I had mentioned how to enable the already supported fields of Funambol in the web demo and I was able to enable the Nickname under new contacts. This time we doing something similar. When we create a new contact in BlackBerry, henceforth to be called as client or BB, we see an extra field called PIN which is specific to BB only. Funambol doesn't know about this. In this post we will see how we can create a PIN support in our locally installed funambol server, henceforth to be called server. In other words, I should be able to send and receive contacts including the PIN field from client to sever and vice-versa.

We will assume that we have a working funambol server installed in the PC and Funambol source code in local hard drive. There are three things through which we can accomplish the addition of new field. First, we need to create a new attribute in the contact class structure called Pin. Second, we need to add an additional column in the database for storing PIN against all contacts. Third, we need to change the webdemo front end to expose the PIN field to user and send/receive PIN from user to backend and vice versa.

Module -1: Adding PIN attribute. The java files are in \funambol\common\pim-framework\src\main\java\com\funambol\common\pim

Step-1: In file PersonalDetail.java, add a new attribute "private String rim_pin;" going by the same format as other fields there, like gender. You'd add getPin(), setPin() etc.
Step-2: we'll edit SIFC.java, SIFCParser.java and ContactToSIFC.java to enable PIN field in incoming/outgoing SIFC, going by the same format as other fields in there like NICKNAME, ANNIVERSARY etc.
Step-3: We'll edit ContactToVcard.java going by the same format as other PersonalDetail attributes. So, we'll add a method "composeFieldPin" which should be like this,

/**
*
* @return a representation of the vCard field X-RIM-PIN
*/
private String composeFieldPin(String pin) {
if (pin != null) {
return "X-RIM-PIN:" + escapeSeparator(pin) + newLine;
}
return "";
}

This is because the tag name standard for PIN in Vcard is X-RIM-PIN so when we are converting contacts in server to vcard for sending it to client, the pin data must be against X-RIM-PIN tag. This will enable the client which will know that it has received a PIN value and so when you see the corressponding contact in client, the PIN field will contain the value that you had set in the server.
Next we will edit VCardSyntaxParserListenerImpl.java and add code for pin going by the same format as there are codes for other fields in there. Now all the X-* fields in the vcard that the server receives from the client, they are added to a XTag list through "addExtension" method in this file. For interpreting the PIN, we will intercept this method. Add the following at the end of this method,

if(tagName.equalsIgnoreCase("X-RIM-PIN")|| tagName.equalsIgnoreCase("RIM-PIN")){
contact.getPersonalDetail().setPin(text);
}
Next we edit the VCardSyntaxParserListener.java in the same format as other fields.
Step-4: Build the changes. Go to pim-framework directory and run mvn package. One may need to modify test files as well if build fails. When its done, run mvn install so that the changes are reflected to other packages later.

Module -2: Adding PIN in database. Corresponding java files are in \funambol\modules\foundation\foundation-core-8.X.Y\src\main\java\com\funambol\foundation\items\dao

Step-5: Modify the PIMContactDAO.java changing the select and insert SQL query, adding the extra rim_pin field at the end. Just go by the same format as Gender field is handled in the file and add similar codes for rim_pin. One may also want to add rim_pin in the create table query in PIMContactDAOTest.java for checking including sql files in test folder.
Step-6: Edit the funambol.script file in hypersonic\data and in the query CREATE MEMORY TABLE FNBL_PIM_CONTACT( ... ) add RIM_PIN column at the end.
Step-7: Build this module, mvn package and then mvn install.

Module -3: Adding PIN in webdemo. Source files are in \funambol\modules\webdemo-module\webdemo-webapp

Step-8: Edit the PDIServlet.java adding rim_pin just like the way other fields are mentioned. Build this module.Edit the add.jsp and view.jsp in \tomcat\webapps to show an extra text box field named rim_pin. Follow the other fields mentioned in the files and rim_pin can be added in the same way.
Step-9: Replace all the libraries that were created from build into corresponding places in local server directory. Replace the class files in webdemo module with that generated after the build like PDIServlet.class.
Step-10: Restart the server and try creating a new contact in webdemo, give some value in pin field. Sync with client. open the same contact in client the see the pin field populated. Similarly create a new contact in BB and sync, then see the contact in webdemo(server side) and find the pin field as given in BB.

Helpful references:
https://core.forge.funambol.org/ds/viewMessage.do?dsForumId=405&dsMessageId=126575
https://core.forge.funambol.org/ds/viewMessage.do?dsForumId=405&dsMessageId=125104
https://core.forge.funambol.org/wiki/HowToHackWebdemo?highlight=%28CategoryHowTo%29

Stumble Upon Toolbar

Monday, September 27, 2010

Playing around with Funambol web demo app

I was involved working with asset management database for the first 2 weeks and it was very educational. I was given a lookup feature to be included in the database front end which I completed in 1 week. I also tested the same by adding up more than 40 devices into the database through the lookup feature. I hope my lead was impressed by this feat. He seemed satisfied. When delivering him the final package I asked if he wants me to look into something else. There was not much to do in the database part so he included me into the blackberry apps group which is also handled by him.
It was then that I came to know about Funambol, my first assignment.
Funambol is an open source mobile sync feature for various mobile devices. The concept is simple. Users can download and install it in their mobile. Then specify the email address from which you want to sync your device with. If I give my yahoo mail address, it copies the contacts, calender etc from that account and the Funambol-Email will also display(sync) the inbox into your device. This helps people access their account on the go. Just open the application, choose the server sync option, when its done, you can see the new changes (if any) like new mails, new tasks etc that has been added into your email account. Through Funambol you can also set new task, contact, send email to others, upload pictures into facebook on the go etc.
How does it work? I haven't researched it well but I believe the funambol data server communicates with regularly with your yahoo account and stores the email, contacts etc from their and when u select the device sync option, it actually loads data from the funambol server. The same happens when you want something to go out from your device, like uploading a picture.
More detail information can be found at Funambol site, http://www.funambol.com/
I installed the funambol data server application (free!). Through this you can make your own PC act as the Funambol data server, and the device will contact your PC for updates. Once it is installed, start the funambol data server (start->all programs->funambol->funambol data server->start server). It will take some time to be up. The open the browser and type http://localhost:8080/funambol/ds and you can see the web demo client. By default the admin username is included (username: admin password: sa). You can also open the funambol administration tool. Play around with funambol for a while. Get yourself comfortable about its working. The settings for web demo is in the C:\Program Files\Funambol\tools\tomcat\conf\server.xml file. You can change the default port 8080 to something else like 8181, which I did. The documentatio for funambol can be downloaded from this site, https://www.forge.funambol.org/download/documentation.html#runserver

My Task: When we login into the web demo client (say using admin account), and create a new account, the common fields are First Name, Last Name etc. What if I want to add more fields like (Nickname) on top of the exisiting ones. This is necessary because in a blackberry when we create a new account, we have all sorts of extra fields and we need to map Funambol's server contact fields with BlackBerry's so that when sync-ing, all fields in BB gets populated. Investigate.


Initial Approach: I could see that the web demo client front end is bunch of jsp pages. When I populate the contact fields and click Add, some jsp page is called passing the values. The jsp pages are in C:\Program Files\Funambol\tools\tomcat\webapps\webdemo and main.jsp, add.jsp, view.jsp and list.jsp handles the contact part. Looking into the source code isn't much of a help. But I know that parameters are being sent/received from somewhere, parameters like operation=ADD, type=contact etc.
Next approach is to find the source code. Browsing in the Funambol folder, there is no .java files, only .class files (in C:\Program Files\Funambol\tools\tomcat\webapps\webdemo\WEB-INF\classes). If its open source application, where is it?
As it turns out, the source code doesn't come with the installation package. One can download the source code separately, modify, rebuild the package the replace the .class files with the one thats in the installation package and you get your new modified funambol.
Okay. Next thing to do is download the source code, from https://core.forge.funambol.org/source/browse/core/ using the command "svn checkout https://core.forge.funambol.org/svn/core/trunk encore --username kundan " in the command prompt(win)/terminal(linux). I recommend one should register at the funambol site. One can also use the anonymous username (no password) to download the source. This will copy the source code into the encore folder. Next step, how to build it?
I followed the instruction mentioned in https://core.forge.funambol.org/wiki/BuildingFunambolV8?highlight=%28CategoryDeveloper%29 to build the whole funambol bundle. I did all the package settings as it asked me to. Building the whole package is a feat in itself. When I tried "ant forge-bundle-win", I faced lots of errors. These may arise because of fault in settings etc. Bottom line is, debugging the build error is out of my reach.

On further reading the how to build wiki page(above), I could see that we can build individual sections separately. I am concerned with webdemo part only, why not build webdemo only? So, I went into "encore\funambol\modules\webdemo-module\webdemo-webapp" and ran "mvn package". result: BUILD SUCCESSFUL. A target folder is created containing the new class files. Now its time to edit the souce code.
Open the encore\funambol\modules\webdemo-module\webdemo-webapp\src\main\java location and edit the PDIServlet.java file. Study the source code. You have to add parameters for nickname going by the same format as name, surname etc in the java file. The main contact class is in https://core.forge.f​unambol.org/source/b​rowse/core/trunk/fun​ambol/common/pim-fra​mework/src/main/java​/com/funambol/common​/pim/contact/ and the servlet file calls functions of this file to read/write contact properties. One can see that Name.Java file indeed has fields for nickname, suffix, initials etc. These are the fields that are already supported by Funambol but for some reason they do not show up in the web demo. We are closer on our way to displaying them. Build the package again after modifying. target folder is created. Copy the .class files into the funambol install dir i.e at C:\Program Files\Funambol\tools\tomcat\webapps\webdemo\WEB-INF\classes.
Finally we need to modify the corresponding jsp files to display text boxes for those fields. Modify the view.jsp and add.jsp to display field for Nickname in the same manner as Name and Surname etc are being displayed there.
We are done!

Open the web demo portal(you might need to restart server for changes to take effect), login using any (admin/guest/user) account. Click on new contact and see the Nickname field. Test the modification by adding a new contact and then displaying the same. The nickname field is saved.
Through this we are now able to write nickname field into database whose value previously being written was null.
Another interesting thing to check. One can confirm that the nickname field is being written into the database by looking into the funambol.log file.Since I have used the default db i.e hypersonic, so if I open \hyper​sonic\data\funambo​l.log file, at the bottom I can see the sql script being invoked to insert data into db and there is one less NULL data being written because we have now enabled the nickname field. :)

That summarizes my first funambol experience. A further look into Name.java, Address.java etc will tell us what are the funambol supported contact fields.
Next task I think is to know how to add a new field, the one that is not even supported by funambol. May be next time I'll reflect on this.

Useful reads:
https://core.forge.funambol.org/ds/viewMessage.do?dsForumId=405&dsMessageId=125526
https://core.forge.funambol.org/ds/viewMessage.do?dsForumId=405&dsMessageId=125104

--

Stumble Upon Toolbar

Saturday, September 11, 2010

2 weeks into Chicago

I am in Chicago right now, dreading the oncoming winter. Yeah, I hate winter. Boo You. I hate it because it makes me lazy. I don't like to be in bed till 11 am and still not in mood of coming out of the blanket because you worked so hard over night to make the interior this warm, cozy. In the midst of this paradise, who would like to think that you have a class starting in 30 mins or the project manager waiting for you. Less spoken the better about the everything turning stone cold, literally. Water is cold, kitchen utensils are cold, damn it the toilet seats are cold. You would hate to come out of the hot shower for the same reason. Why go out and say hello to cold air, invite them to touch you, give you a tingling shiver.

I can go on for more but in the midst of my harangue I forgot the main thing.

I am in Chicago for my internship, at RIM, the creator of BlackBerry, in case you didn't know that. Its been 2 weeks here. The place is nice, people are nice, facilities are awesome (I meant free unlimited coffee of course), work i seven more interesting and the best part, no fixed committment when to be in office and when to come out etc. If one may remember the one thing I used to hate the most while employed at Samsung is the punch-in punch-out system. One has to be in office at best by 10am and one canno tleave office before 4pm with maximum of 1 hr break in betwen. What is this, a jail?

Anyways, that being said I'll try to put in some things that I learned during these 2 weeks. In simple words, my work pertains to developing application in VBA (Visual Basic for Applications) for a database in MS Access. What does the database contain? Well, nothin but which guy has which device with him, who is responsible for the device etc etc.

My first order of business was to resolve the size difference between the front end and back end. It is a common observation that when you open the modules, forms etc for changing in their codes and close the application after the updates you'd notice that the size of the front end has increased. My thought process was to separate each of the forms, macros, queries etc from the application and analyze their size individually. This didn't work. After some research on the web, I found out the solution.

The automatic compaction feature of Access is not enabled by default. If not done so, Access front end would incorporate the back end wholly which is unnecessary. The checkbox to enable the automatic compaction can be found in the Access Options. Initial side effects would involve slowing down of opening or closing of application but that would settl edown soon. One doesn't even need to tell the Access to compact everytime the application is closed. It can be invoked periodically at a predefined time stamp or you can set the size beyond which Access will automatically compact and repair the database.

Among many other itsy bitsy things I learned this was something I thought worth putting into a blog. May be in my next post after 2 weeks I'll have something more interesting than this.

Goldy Blank

Stumble Upon Toolbar

Sunday, June 6, 2010

Algorithms for 8 queens problem

The 8 queens problem is a very popular puzzle especially for a Computer Science engineer. From the point of view of algorithms, there can be many approaches towards its solution. The problem statement and various solution approaches are mentioned below.


Problem: Arrange 8 queen pieces in the standard chess board so that none of the queens can take any other queens, i.e, there is no conflict in their positions.

Solution:
Approach 1: The common and straightforward solutions for the beginners is the brute force technique. Take all the arrangements of 8 pieces that can be possible and discard those that are in conflicts. It is not at all a suggested approach as its exponential if the problem is generalized to n-queens on an nxn board problem.

Approach-2: Backtracking is a common AI approach of solving problems. In this problem, we start arranging the queens column wise such that the current queens position is not in conflict with any of the previous ones. If there is a conflict in the column, we try to place it in the next available(conflict-free) column. If we run out of columns, we backtrack to the last stable arrangement and continue process from there and so on. This is actually accomplished through recursive backtracking technique.

Approach-3: Permutation Method. First a solution is found out for 8 rooks on a chess board which has only 8!=40320 possibilities. Then take each permutation and replace the pieces by queens and discard those arrangement where the queen is attacked diagonal-wise.

All solutions mentioned above produce guaranteed results. There are other heuristic based approaches which may get stuck midway.

Reference:

Stumble Upon Toolbar