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
Wednesday, October 6, 2010
Adding new contact fields in Funambol
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.funambol.org/source/browse/core/trunk/funambol/common/pim-framework/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
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
--
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
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.
Saturday, June 5, 2010
Everything about Bottleneck Spanning Tree
Friday, June 4, 2010
Algorithm: Determine the element that occurs more than n/2 times in an array of size n
Problem: An array of size n contains integers between 1 to n. You have to determine if there exists an integer which occurs more than n/2 times in the array. Also, find the element. This is also called the majority problem. One more thing, the solution has to be done in linear time and using constant extra space.
Monday, May 31, 2010
Prelude to the Blog makeover
I felt like writing something. Its been a long time and moreover this blog is nothing but my nonsense thoughts. I mean, yes, it is exactly so. Take for instance some blogs where people discuss technical matters, this error occurred and I did this and that and poof!! the errors' gone. Some people write blogs on technical gadgets, giving their views, some people put up their photography skills on display, some people put up tutorial pages in their blogs and those are the ones that really help others. Yes, its true. I have myself got many of my computer bugs fixed through posts in one blog or the other. I have bookmarked many such websites where there are useful links, posts, images, directions, helps etc. And compare those blogs to this one. Sheer waste of google's space. Its just to feed my fantasies. Its just a consolation. Just a time-pass when I think I am a good writer and I had to vent out something somewhere to prove that I am a good writer. Trust me, I read my own articles many times and I like it but I am afraid if other would think so. Moreover I don't expect to show off my writing skills even if I have any. There are some people who publish their blogs to friends in the hope to garner some appreciations for their writing skills, show off. I ain't like that at all. I can live my life writing anonymous posts no matter how good they are.
Thursday, April 22, 2010
part time = party time
Its been 9 months since coming to US and I haven't had a part time. Not any more!
Sunday, February 14, 2010
The friends I have been with
One type of people we treasure the most are our friends. Atleast for me, my friends have always been special for me. So I thought to take a moment's time from my life and cherish the memories of some of the fascinating people I have crossed roads with.