Wednesday, April 22, 2009

JCR - a myth?

Recently, I was looking into implementing Jackrabbit, a java content repository for a project. Based on few days of research ( alrite, I will call it googling next time), I found the concept of JCR very interesting. In a nutshell, when the JCR spec was written a few years ago, it was viewed as a technical solution that will radically change the existing way of application development.

In a typical development environment, we have few major components or layers. One layer is the application layer which has the user interface code and business logic. The second important one is the database layer where we have relational databases which stores data created by the application. In recent years, we also have a third layer sometimes known as framework layer which separates user interface and the business logic, providing the business logic as service.

JCR spec views content repository as an alternative to the database layer in application development. So the developers, instead of thinking in terms of tables, columns and data-type, they are forced to model the application based on content hierarchy in their domain. No more thinking interms of tables, normalisation, columns and more importantly id columns in tables. You design an application, just think interms of content that application deals with and their hierarchy. Thats it. If you need versioning, locking, referencing or access control, dont worry it is provided by the spec. Ok, how about querying. In JCR you can query either via SQL or Xpath. Even better. Alrite, how about deploying? Too easy, you can bundle JCR within your application, deploy it as a resource in your J2EE app server and access it as a resource or deploy it as a server similar to DB server and access it. Too good? One other cool feature is that you can expose the repository as a Web DAV location and user can add content by mapping the location as a folder in their computer. Very good indeed.

Most of the examples I found, points out how easy is to model a blog or a wiki application using a content repository. Inside JCR, the content that is persisted can be stored in file system, XML store, Web DAV repository or a database. I testdrived Jackrabbit by deploying it onto JBoss. The whole process of deploying was so easy and accessing the repository programmatically or via Web DAV was very easy. Fabulous!

Given the cool features of JCR, one would expect that many people adapted it by now. However, I couldn't find that many articles or tutorials or samples on the web. Take hibernate for instance which is a ORM for databases has become very popular since its inception. Its not alone hibernate but the whole ORM paradigm was widely accepted and used in many places. So, why JCR is not as popular as it should be? Based on my few days of experience with JCR, I think lack of ability to access and change the data ( similar to command line access to execute SQL query on a database), browsing tools to view repository data and change in the way to model an application are few of the reasons why Jackrabbit/JCR has not become popular. Or is there any other reason for this? The search begins..

Tuesday, April 7, 2009

Double Command - For Mac Newbies

I recently tried installing Double Command in Mac OS X to remap some of my key-board keys. The reason I needed this is because I was using a PC style keyboard (dont ask me why, its a very long story :-) ) on Mac and I want Home and End keys to work as it used to be in Windows. Enough of the back ground, now the technical stuff..

I initially assumed it as an application and happily installed it by double clicking the package inside the .dmg file. After successful installation, I searched for Double Command shortcut inside Applications and Dock. Well.. couldn't find it. Repeated the process , same result. I did a bit of googling and couldn't find anything. Then I went to the help section of http://doublecommand.sourceforge.net/help.html and there it was..

Double Command is not an application.. it is a kernel extension.. This is one thing that new Mac users from windows background must get used to. Kernel extensions are dynamic piece of code you add to OS to change the way it behaves. I think we can compare this to device drivers in Windows (I am purely guessing here). Double Command adds a preference pane ( a nice user interface) to System Preferences. All you have to do is to open up System Preferences and you can now see a Double Command icon. Double click on the icon to open up Preference Pane. You can tick/untick the mappings you want and it works straight away..

Few things worth noting: The preference pane has fixed set of mappings that lets you remap certain key to certain other keys. You cannot specify a key and remap to some-other one. For example, Double Command does not allow you to map the key A to B and B to A. Their help page suggests to have a look at http://developer.apple.com/technotes/tn2002/tn2056.html for doing such things

I hope to spend some time today remapping the Windows key to Command key. At the moment Alt Key is mapped with Command key. Lets see how it goes. Hopefully I wont spend too much time on this.

Saturday, April 4, 2009

Being Good is just not enough

Its blog time again..

It was poker day here for me. I was so close in winning few sit n go tournaments. I felt bad when I got out in a multi-table tournament just before the money. Anyway, more experience you get the better your game improves..

It takes a lot of patience, concentration and thinking to win a game of poker. And , yes of course you need the luck element as well which you need in any other sports. Unlike other games, Poker got too many variables in just one hand and a good player should take all these into consideration before making a move. Its not just the cards you dealt with. Its about how you played the hand before, the one before that and the one before that. This is just one variable that a poker player had to consider. Another important one is that how the other player in the hand thinks about you and your hand. Is he thinking that you are playing the cards you are supposed to play in that position or playing loose? Or is he making you think that he thinks what you think?

Bet size is another variable you just can't ignore. It defines the hand you having or you representing.. It also tells others what they want to do.. I like the bets that make the opponent think. If your bet just makes them fold or flat call, then you may want to rethink your betting strategy. However, sometimes you just want your opponent to just fold and go away or flat call to your nuts.

And in all the cases above, if you make your opponent do mistakes and you avoid making too many mistakes, you win in poker. Alright I need to justify why I named this post as being good is not just enough. Here it comes..

The good cards you dealt with is just not enough in winning a tournament or even winning that hand. There are more to it. I never regretted folding good hole cards, trips on the flop or straight on the turn or river, if I know for sure that I am beaten. However I never folded a Ace high flush and high full house. I think i should, if the right situation arises. As they say in trading shares not to fall in love with your stocks, in poker you should not fall in love with your hand. Here is one hand that illustrates the scenario explained here

I am under the gun having AQ suited. Its a nine handed sit n go tournament with 6 players remaining running for around 30 hands. This is the time when people usually play tight and want others to take on each other so that they can get closer to the money. I am the biggest stack in the table. Given the fact the table is playing tight, I just called to get as much action as I can. Player 2 folded and Player 3 having 1300 chips raised 320 (blinds 40 -80). Everybody folded to the player before button who re-raised to 620. He himself had around 1400 in chips. Everybody else folded to me. The action is now on me.

Its not a tough decision to take but there are few things to consider. Given the fact that the table should play generally tight at this moment and seeing too many actions is not a good sign. People are serious about this hand and will really go real hard after the flop. Eventhough they could hurt me only 1400 which is less than one-third of my chips but still I am now in my comfort zone. Do I really need to take the risk now? Also, it seems that they didnt care that the big stack, who can knock them out of the tournament is still involved in the hand. But me myself have a strong hand which will justify my call. But we need to put a bit of common sense here. The guy who is to act after me, the actual raiser, if he calls the raise, then he is most likely pot committed and go until showdown. So, if i call and win against two monster hands, then i eliminate two players. If i fold, the outcome will either be Player 1 get eliminated or Player 2 has very minimal chips he will not last long. And I want to maintain the big lead in chips.. And I folded.

As I expect Player 1 called and flop came out 2 5 10. Player 1 went all in for the rest of his chips. Player 2 called. Player 1 showed pocket 9's and Player 2 AJ offsuit. Player 1's 9 holded up to win the pot. Player 2 got eliminated in a couple of hands after that.

Aah well.. I am also bit superstitious playing AQ. 75% of the time I lost on this.. Thats one reason I folded the hand anyway. :-)..

Adios! Good Night!

Thursday, April 2, 2009

I am a blogger now!

I have been thinking of blogging for sometime now. But never really got into it. But today here i am writing my first blog.

I am thinking of blogging on mostly technical stuff. Recently I am into interesting areas of computing which motivated me to create this blog so that I can keep track of my research and findings. Some of the topics I will be posting on

  • IT Security
  • Java J2EE tips and techniques that I used
  • MySQL experience
  • Cloud computing
  • Apple Iphone Development
  • Quantum computing
I am also into playing poker. So you would see poker pages once a while.