Thursday, June 26, 2008

Managing our Personal Expenses - The Buxfer Tool


How many of you have lived in shared apartments with friends during your graduate life? Remember the time and effort spent in managing the shared expenses with your roommates? I remember my student life, living in a shared accommodation with friends and sharing my living expenses. It was quite an effort to keep track of the finances. Who owes how much to whom? During my travels and hikes across Europe along with my friends, it would become even more cumbersome to keep track of the expenses. I remember that small notebook we had to update with our names and expenses done, later split the expenses and exchange money.

Google Docs brought us some relief. We could create a Google Doc, mark our expenses in a centralized spreadsheet and share it with our traveling group of friends. Each of us could view and edit the sheet with the expenses we had paid for. This centralization eased the process to a certain extent, but still we had to do our calculations of splitting the bills.

One such student sailing in the same boat was Ashwin, who was a PhD graduate student from Carnegie Mellon University. Our man with brains, sat down and wrote a small script to manage his expenses - to keep track of how much he owed others and how much others owed him. His simple but smart idea formed the base for Buxfer - a social money website.

Buxfer allows users to keep track of their personal finances, regulate and organize loans and IOUs to
friends. It informs you of what you owe and what is owed to you, as well as divide bills among a group of users. It has some good features like tagging your expenses, which could help you analyse your expenses in a better manner with some cool graphs and charts. Among other features are support for various currencies, support for multiple languages and integration with other online payment services like PayPal etc. With the growth in social internetworking, Buxfer has plugins and widgets with social sites like Facebook, where you can manage your expenses with your friends on your Facebook list. For all iPhone uses, the good news is that Buxfer has launched its iPhone application too. With some cool graphics its more easier to manage your expenses from your iPhone now.

Wednesday, June 18, 2008

Switch-Hitting : Improvisation in Batting

During the one-dayer against New Zealand, Pieterson provided yet another reason to define him as one of the evangelists of modern day cricket. I have always been impressed by his bold attitude towards the game. Be it the decision of switching base from South Africa to England for a better career or be it the strong-willed hitting he brings to the crease during his batting. He has shown strength of character in crunch situations. Along with Flintoff, Harmisson and Hoggard he had brought a revival in English cricket during the summer of 2005. There have been a lot many eulogies written about him and I dont intend to add one more to them.

The reason to cheer about his batting in that game was his improvisation against Scott Styris. On two occassions he changed his grip from a right-handed one to a left-handed batsman just before the ball was delivered and carted the bowler over the boundaries. I have been a great fan of improvisations in batting in the recent times. It demonstrates the skill of the batsman to play innovative shots and take risks to a higher level. Especially in the case of changing ones grip, the batsman is too close to loose his wicket while changing the gaurd. And to do it effeciently and hit it for a six proves the skills of the batsman. I myself have a tendency for playing this shot atleast once in my innings. I love to do it especially to fast bowlers who are bowling a nagging off-stump line. Changing the grip and lofting them over the square boundary with a left-handed shot is a feeling to cherish!

There has been a hue and cry about the positioning of rules in such a scenario. Many purists were calling for the shot to be made illegal. Thankfully for the spirit of the game and keeping the thrill of the game alive, MCC has decided in favor of the shot. There remains a debate on the rules for LBW and wides in such a delivery. In my opinion, the rules should be applied depending on the batsmans grip while he was playing the shot. If a right handed batsman changes the grip to a left handed one, then his off stump switches with his leg and the LBW rule and wide rule should be applied correspondingly. Agreed the umpire might have some difficulty in judging LBWs depending on where the ball had pitched, but in such a situation he can always refer to the third umpire for the decision. Thats what technology is for - help in taking right decisions.

With this shot being legalised, I am eager to see more such improvisations from batsmen in the Twenty20 matches which are ideal for such shots. MS Dhoni, Pietersen, Misbah-ul-Haq, Yuvraj Singh - these are the batsmen to watch out for more such innovative shots.

Tuesday, June 10, 2008

Tips on development with Hibernate

One of the common problems in query optimization using Hibernate is when one of your tables is associated with several other tables. This is a common problem and has a pretty straight forward solution. Consider a sample Hibernate mapping file of a table Student associated with other tables like Course, Professor



Now a simple query like

from Student where student_id := entered_id

will generate a sequence of selects from its associated tables, which will greatly effect the query performance time. To reduce this waterfall effect we have to load the associated objects in the initial query by using a "left join fetch" construction as shown below

from Student student
left join fetch student.course
left join fetch student.professor

However there are some limatations on usage of "fetch". It cannot be used on queries using iterate() or queries involving result row operations like setMaxResults(), setFirstResult() etc.

for further reading visit the detailed discussion on this site


For those of you starting up with Hibernate and would like to implement it using MyEclipse IDE, here is a good tutorial (though a slightly outdated with the versions)

Monday, June 09, 2008

LOST 4th Season review


Its thursday again and I am not yet overcome by the eventful episodes of Lost screened on last thursday. I get a void sense of feeling in my daily thursday routine from now onwards, yes I am going to miss Lost for several weeks to come. Having followed this series across 3 countries in 3 different languages over the past 4 years, Lost has become a part of my life. Many of my friends and work colleagues are big time LOSTies. The usual friday routine was to discuss the episode of the earlier evening. Well looks like these activities are going to take a back seat atleast for a while now. Coming to talk about the recently concluded 4th season, I must admit this was by far the most action packed season of the series so far. The 3rd season was kind of a let down and many people including myself were beginning to get bored with the series. The story of Others was not exciting enough to satisfy our LOST-apetite. The only interesting character addition was of Juliet, but her presence in the plot seemed to fade away gradually. There was hope of a romantic angle between her and Jack when the last season ended, but good for all of us Jate fans, Jack came back to Kate during this season. With the entry of several interesting characters like Miles (the ghost-talker) and Faraday (the phycisist) one had hoped to see some interesting sub-plots in the narrative. But owing to the writer's strike, the series had to be cut short and we only hope to see more of the freighter folks in the next season. I personally liked the geeky-physicist Faraday and am looking forward to see more of his time-travel fundas unravel in the next season. Miles would have been one of the greatest characters this season, given his ability to talk to ghosts and spirits and given the fact that many ghosts from the past were appearing frequently on the island this season. The interesting plot was the gradual death of Claire, after that bomb blew up her cabin, one could have guessed from her abnormal behaviour that she was a ghost walking among the living. Her interactions with her Dad, Christian Shephard were touching and appeared to give more logical reasoning for her transition from the living to the dead world. Another interesting concept this season was using Christian Shephard to speak on behalf of Jacob. Whenever Jacob wanted to parley with any of the Island folks he was passing his messages through the senior Shephard. That raises a question here, why Christian Shephard? and why could only a few of them could see or listen to him, why not others. And does the fact that some of those who could talk to Christian Shephard (John Locke, Hurley, Claire, Micheal) make them any special than the others? Does this mean these people are already dead and somehow their mind is empowering their bodies to carry out a specific task the Island or Jacob wants them to carry out? The shocking revelation in the end about John Locke gives more credence to this theory, but if that is the case then why did a living Hurley escape the Island? There are several questions raised by the script writers here and we only hope that they do justice to them in the next season.

The season finale had all the elements for a blockbuster. The grande stand-off between Jack and Locke again brilliantly portrayed the struggle between the man of science and the man of faith. I just love the confrontations between these two characters. It was great to see Locke following his instincts about submission to a higher authority - a power which is as elusive to him as it is to us - and being crowned as the chosen one to lead the Others. Towards the end of the episode Jack started appearing a bit fazed out and uncertain in his vision - a characteristic in complete contrast to the Jack we all know. Was leaving the island the right thing to do? From the future flashes, we see that he deeply regrets leaving the island and is trying eagerly to come back. I guess the next seasons will deal with this plot of the castaways trying to lead a normal life away from the island and not coming to terms with the realities they try to get back to the Island. I loved the manner in which Locke was explaining the magical status of the Island to Jack, but unfortunately he couldnt make his point across to the skeptic medic. Sawyers sacrficial jump from the chopper and the kiss with Kate was very touching. Later when he walks out of the sea towards a rum-drinking Juliet reminded me of the scene from Casino Royale when Mr. Bond comes out of the sea. There was a small hint dropped towards a possible romantic union between Sawyer and Juliet for the next season. But its sad to see Juliet getting such a second had treatment in terms of romance. Little is known about Faraday and his group on the boat, I only hope that they were in the Islands zone and had traveled in time along with others. Ben's appearance in the deserts of Tunisia makes sense after the season climax. There appeared a sense of vengeance in him as soon as he appeared in that desert. How far is he going to succeed in his revenge against Charles Wildmore will be an interesting watch. The resurgence in Sun's character was remarkable. The manner in which her character develops into a revenge-seeking-sharp-business-sense woman was good. I am hoping that Jin had dived away from the freighter, before it blew up and had swam towards the island. This would have made him within the island's zone and hence would also travel along with the other people left behind on the island. As per my predictions, next season onwards we will get to see Sun's quest to get back to the island and save Jin.

Talking about re-unions, it was an overwhelming moment when Desmond meets his long lost love Penny. Infact the best episode of this season in my opinion was "The Constant". The manner in which the past and present moments of Desmonds life are shown, and the fast-paced narrative switching between Penny in past and in London and Desmond in present and on the freighter (both in different time-space frames) kept me glued till the episode climax. When Desmond speaks to Penny on phone, those feelings were emoted in such an intense manner, it certainly deserves an award nomination for the actors. To continue talking about the romantic angle of the characters, the episode showing the blissful relationship between Kate and Jack was very sweet too. Another twisting revelation was the identity of Aaron as one of the survivors. Honestly it was something totally out of the blue. Great job writers!


So whats next then? Will Ben continue to play a strong role on the islands politics or will Locke take over as the undisputed leader? The shocking revelation of Locke being the man in the coffin from last years season finale was another jolt in the blue. Though he is a bit eccentric in his mannerisms, but Locke was surely one of my favourite characters, especially for his philosophies and his never-ending faith in the island's powers. The character of John Locke allows the writers to introduce many such supernatural concepts into the story plot. I hope that the factors leading to his death are as dramatic as his life on the island and are properly justified given the strength of his character. By the way did any of you notice the poster of 4th season. In this image the reflection of the island shows many high rise buildings. Does that give a hint of time travel? Does that mean the island is going to move several years ahead in future in the next season? There are plenty of questions raised all over the LOST story line to capture the fascination of its fans. We are all waiting eagerly for the next season to get our answers. Untill then, our minds will be happy building our own theories about the island's future.