Wednesday, December 7, 2011

Things I installed after fresh Fedora 16 installation

Gnome Tweak Tool
Gnome Shell Extensions
  • gnome-shell-extension-common-3.2.0-2.fc16.noarch
  • gnome-shell-extension-apps-menu-3.2.0-2.fc16.noarch
  • gnome-shell-extension-icon-manager-0-0.4.gitc34779c.fc16.noarch
Google Chrome , Flash plugin, Talk plugin
Adobe Reader
Libre Office
Different JDKs
Thunderbird and lightning
icedtea-web for java webstart
MySQL and Administrator
Eclipse EE, m2eclipse and its extras

Tuesday, November 8, 2011

One of a kind immigration and visa story !!

The saga started way back in 2009 and I paid off the price of minor lapse in 2011. Now that I have your attention, here is the details.

My mom, a Nepali citizen, came to visit us in Texas for a period of six months in 2009. Six months is the most you can stay in USA if you are on a tourist visa without applying for extension. We knew this rule and certainly wanted to follow it. A glitch came when the person who was supposed to go back with her had to cancel his plan. I prefer to have somebody accompany my mom who speaks English so I started looking for a person who could match her itinerary. Probabilistically, chances of finding a person who you know and has the same itinerary is very low and that's what happened. We could not find one who was traveling along the route within the six month limit but we did have a person flying back to Nepal after one week of that period. So I changed the itinerary and at the same time filed an application for extension of six months stay hoping that there should not be a problem of extending the say since we were only asking for couple of extra weeks in the worst case.

As you might have guessed, the extension was denied. Now what? Re-booking the ticket was going to cost me couple of hundred of dollars so I thought it may not be too "risky" to overstay for a week and that's what we decided. There was no problem going back to Nepal so it turned out to be a well calculated risk.

Come 2011, my mom came back again to attend my sister's graduation. At Boston airport, officials wont let her pass the immigration because her visa had expired. She had got a 5-year multiple entry visa starting 2009 so visa was valid at least 2014. It turns out that if you overstay, your visa is automatically canceled and you will be sent back to your country if you manage to land in US. Obviously we did not know that, did you? Thankfully immigration officials understood that it was not done on purpose and they let my mom in for a period of six months with constraints that we would not be able to apply for extension and she would have to leave USA before six month period. That's totally fair and we all appreciated the generosity of officials. The six month period is still valid as of this writing and will be over on Nov 10.

Today is Nov 8 and also when my mom has her flight back to Nepal through London. My mom was not allowed to board the flight at Boston airport. Before you read further, I would like you to think why that could be the case. It defies logic and I don't know how general folks like me is supposed to know these things!!

There is no problem leaving USA but there is a problem with transit at London airport. It turns out that if your USA visa has expired/canceled then you can not transit at London airport without having a visa. If we had known that we obviously would have applied for a transit visa but it was too late again. Did you know that? :-(  This only happens at London airport, not at other airports. On top of that I have only 2 days to sort this mess out.

After debating many options, I decided to get a new one way ticket that did not include a transit at London and let go off previous return ticket. I not only lost good chunk of money on return ticket but new one way ticket for NY-Dubai-KTM cost me almost a thousand dollar. My sister drives my mom to NY tomorrow and she departs from NY on 10th morning. I hope that even after this, she gets back home on time and without much hassle. I will keep my fingers crossed and will definitely think twice about flying through London.

BTW, what's so special about London that they have special rule that no other airport has about transit?

Thursday, August 25, 2011

Java EE6, JBoss AS7 and OpenShift talk at Austin JUG

For August 2011 Austin JUG meeting, Red Hat is sponsoring a talk on Java EE6, JBoss AS 7 and OpenShift. I will be covering JBoss AS7 and EE6 while my colleague David Blado will do a presentation and demo using OpenShift, Red Hat's PAAS offering. I hope to see you Austinites and their neighbors at the meeting. JBoss AS7 landing page talks about 7 reasons to love it but I will give you a very compelling 8th reason and probably more. ;-) In case this all is not appealing enough, there are free pizza and drinks as well. More details at

Monday, May 16, 2011

My small contribution to RESTEasy project

I am working on some example to play with Infinispan and in this example, I wanted to store a YAML blob in the cache and play with Infinispan's different cache configuration options. To consume a YAML blob, I developed a REST interface using RESTEasy. RESTEasy's YAML provider worked pretty well but for the case when blob did not comply with YAML syntax. As expected, it would throw error but error message was far from helpful:

Caused by: java.lang.NullPointerException
at org.ho.yaml.JYamlParserEvent.getBean(Unknown Source)
at org.ho.yaml.YamlDecoder.readObject(Unknown Source)
at org.ho.yaml.YamlConfig.load(Unknown Source)
at org.ho.yaml.YamlConfig.load(Unknown Source)
at org.ho.yaml.Yaml.load(Unknown Source)

As of 2.0.1 RESTEasy version, YAML support was provided using JYAML which is not under development anymore. So I gave a shot at integrating SnakeYaml which is a very active project with good community around it. It was not a whole lot of work and it did not cause any regression in my local testing so I went ahead and committed to trunk after discussing with Bill. Thanks Bill. More details are at . I updated the RESTEasy's doc as well..isn't that nice? ;-)

Tuesday, May 10, 2011

Tips when using curl to do an HTTP POST !

I have been playing with RestEasy stuff a bit lately and to test my RESTful webservices, I was using curl to do a HTTP GET and POST. To add to the fun, I wanted to use a YAML file as POST payload. I will talk about YAML and RestEasy in a separate blog post, but when you do a POST as

curl -X POST -d @/home/prabhat/house.yaml -H "Content-type: text/x-yaml" http://localhost:8080/eejot-rest/rest/houses

curl strips all newline which is what a browser does. YAML depends on new line and white spaces so that would result into all sort of deserialization issues on server side. The correct way to do instead is

curl -X POST --data-binary @/home/prabhat/payload.yaml -H "Content-type: text/x-yaml" http://localhost:8080/eejot-rest/rest/houses

Curl man page is very clear on this but sometimes we tend to have false assumption. RTFM Prabhat!

Tuesday, May 3, 2011

How to delete a svn repo and recover it

I woke up this morning and before I had my coffee, I did something like following:

svn delete .
svn commit -m "some clean up"

As I said I did this before I had my coffee. ;-) But why would I do such thing? SVN showed M for . because I was playing with some svnignore stuff. The above command completely wiped out the branch I was working on. When I realized what I did, I did not need coffee anymore.

After little googling, I did following

svn cp -m "restore.."

where 110 is x-1 with x being the revision number which nuked the branch I was working on.

Sunday, April 17, 2011

Winning changes everything !!

India won 2011 World Cup Cricket and I am really really happy for Indian team specially Sachin Tendulkar. I am from Nepal but I grew up following Indian cricket since cricket was not very popular in Nepal back then and Nepali team is not good enough yet to qualify for the world cup.

I would like to think that I played a part in India's victory. Whenever I watched a crucial match, India lost most of the time. It used to hurt a lot; 1996 semi final against Sri Lanka, 2003 world cup final against Australia and 2007 world cup in West Indies come to my mind. So I made a decision this time that I would not watch any live match involving India. This was obviously very difficult but I really wanted Sachin to have his hands on the trophy like millions of Indian people as well as many non Indian avid cricket fans. I am no longer going to do this stupid thing anymore and will just try to enjoy the game. Here is wishing Nepali cricket team to shine so that I have my own country to root for.

When India was loosing many crucial matches and some regular matches abroad, several pundits would sing in chorus on bad infrastructures in India, Indian team lacking self belief, Australian team being mentally tougher, Australian team having good bench strength etc etc. I do believe some of them to be partly correct but I never agreed that they were to the extreme these pundits thought they were. Now that India has won, same pundits are singing the chorus other way around.

I believe teams go through cycle. Some naturally gifted players emerge and they form the core of a team which help them win more matches than they would have otherwise. Of course having good infrastructures and bench strength help but they don't disappear all of sudden when you loose. Australia loosing its dominance has more to do with its core team members (Waugh, Warne, McGrath) retiring in quick succession which is analogous to what happened to West Indies team and which is likely going to be the case for Indian team (primarily in Test cricket) when Tendulkar, Dravid, Laxman retire.

Monday, March 28, 2011

Richfaces showcase on Cloudbees

To continue with my experiments with different PAAS providers, I took Run@Cloud provided by Cloudbees for a ride this time. Overall its web interface is very straightforward and intuitive and similar to what I mentioned about AWS Elastic Beanstalk . I was able to deploy Richfaces 4 Showcase application in couple of minutes and you can see in action at  Once your app is running, besides application logs, you can monitor different operational parameters such as system load, number of request, session etc as evident in following screen shot:

Keep in mind that I did not try its SDK  which allows you to deploy your webapp from command line on your local box.

I found it a bit odd that when you add a new application, the wizard asks you for app name only and not the actual deployable. The advantage of this approach is that you get a running URL immediately to which you can upload your .war. I would have merged these two steps into one.

I also would have liked to have a shell access to actual server as well as ability to specify different JVM parameters. May be it's a work in progress? ;-)

Sunday, March 20, 2011

Richfaces showcase on Amazon's Elastic Beanstalk

Richfaces 4 is around the corner and it runs pretty much same in both Tomcat and JBoss. The major difference is that with Tomcat, you have to bundle in your .war a JSF implementation which could be Mojarra or MyFaces. I don't have a preference on JSF implementation at this stage.  Given that Richfaces runs without problem on Tomcat, I thought I should take AWS Elastic Beanstalk for a ride. As it turns out deploying is as simple as deploying it to your local tomcat instance which is a good thing but it also differs a bit.

In following screen shot, you can see that  I have chosen Richfaces showcase application (showcase.war) which I want to deploy on a 32-bit Linux OS running Tomcat 6. Once app is deployed, it should be deployed on (I have shut down my instance so link wont work).

When I deployed my app, I expected my app to be available at in line with what I get when I deploy the app locally which is http://localhost:8080/showcase . But Beanstalk renames the .war and deploys it as /usr/share/tomcat6/webapps/ROOT which is why it's available under root context . This is important to know because in the next step of configuration, you would  need to supply the URL which can be used for health check. I initially provided /showcase and I ran into problem. Following is what should be:

Other noteworthy differences or rather limitations are that currently Beanstalk configuration does not give you options to edit JVM parameters initially. Once you have instance up and running, it does give you an option to edit JVM configurations as well pass five application specific parameters but the name of parameters has to be PARAM1, PARAM2 ... May be this will be fixed in future versions or it's already available and I don't know. The latter is likely given that I did not spend a whole lot of time on it.  Anyway, here is screen shot of app running on Beanstalk.

Tuesday, March 8, 2011

Quick tip on hibernate batch operation

You can find the details of what batch operation with respect to DB is and related Hibernate guide at . Any time you need to do bulk inserts/updates, it's better to do in batch to get a better performance. Recently I was developing a small app and followed Hibernate guide to make sure that my configurations were correct. Even after trying several things, I kept seeing following in log generated by Hibernate:

Hibernate: insert into Member (name, id) values (?, ?)
Hibernate: insert into Member (name, id) values (?, ?)
Hibernate: insert into Member (name, id) values (?, ?)
Hibernate: insert into Member (name, id) values (?, ?)
Hibernate: insert into Member (name, id) values (?, ?) 

But batch operation is supposed to generate statements like

insert into Member (name, id) values ('name0', 1),('name1', 2),('name2', 3),('name3', 4),('name4', 5),('name5', 6),('name6', 7),('name7', 8),('name8', 9),('name9', 10),('name10', 11),('name11', 12),('name12', 13),('name13', 14),('name14',
15),('name15', 16),('name16', 17),('name17', 18),('name18', 19),('name19', 20)

It turns out that even when batch operation is in progress, hibernate log shows individual operation. If you don't know this, you might be up for a ride figuring out what the heck is going on. The best way to make sure is to turn on the query logs in DB itself. For MySQL5 installed on Fedora, you do it by adding log parameter at /etc/my.conf


You should see statements like following at /var/log/mysqld.log :

2 Query insert into Member (name, id) values ('name0', 1),('name1', 2),('name2', 3),('name3', 4),('name4', 5),('name5', 6),('name6', 7),('name7', 8),('name8', 9),('name9', 10),('name10', 11),('name11', 12),('name12', 13),('name13', 14),('name14',
15),('name15', 16),('name16', 17),('name17', 18),('name18', 19),('name19', 20)
2 Query    commit

The complete test project is at . The relevant hibernate configuration is at . If you are letting hibernate generate the primary key then don't use GenerationType.Identity in your  model otherwise batch insert will not take place.

Wednesday, March 2, 2011

New guide, tips and tricks for GateIn

Recently my team members published several how-to docs and guides on customizing GateIn Portal which applies to Enterprise Portal Platform (EPP) in most cases as well. Here is a compilation of those docs in one place:

The first two articles use extension mechanism which means that there is no or very very minimal change to OOB GateIn. I believe these docs should help you do an efficient customization of GateIn for your use.

Wednesday, February 16, 2011

JBoss PortletBridge talk at Austin JUG

Come hear yours truly talk about JBoss Portletbridge at this month's Austin JUG meeting on Feb 22. The details of talk is at There will be free pizza and thanks to Red Hat for sponsoring my talk.

On personal note, as part of my Eejot ( effort, pls bring any old laptop you have that you are not using too much. You can tax deduct your contribution.