Wednesday, December 29, 2010

Hibernate - Reading a datasource from a jndi

I was writing this utility that read the data produced by the main application, but presented it in a different way - basically sliced and diced the information such that it was more meaningful to the user.
My goal for this utility was simple - provide as little configurations as possible - make it work more like a plug-and-play utility.
To achieve this, the first goal was to read the same jndi’s the main application was reading to fetch data. I didnt want the user to have to re-enter the connection params. Fairly simple request right?
Here’s what i had to do to achieve this:
Step1 - The JNDI was already defined - in the tomcat server.xml in this case. So make a note of the jndi name
   
      
 auth=”Container”
        type=”javax.sql.DataSource”
….
Step2 - Update your Spring application context to include the datasource bean as follows,
 
          class=”org.springframework.jndi.JndiObjectFactoryBean”>
      /jdbc/unity”/>  
     
   

Step2 - Last step - update your Context.xml (if you dont have one, create one under META-INF)
  
         jdbc/unity”
                       type=”javax.sql.DataSource”
                       global=”jdbc/unity”/>
  


Thats it!

Tuesday, December 28, 2010

Formatting Struts 2 s:checkboxlist tag

I recently had the need to format the struts 2 tag. By default it appears as a horizontal formatted list (checkBox1[] checkBox2[] checkBox3[] etc) but since the number of checkboxes were large, i wanted them to appear in a tabular format.

Here's what i did:
- After doing a quick Google search i figured that i needed to overwrite the default Freemarker template.
- All the templates are located in the struts-core.jar

1. Create a new directory structure at the root of my application called template/myapp and template/myapp_simple
2. The template we're looking for is checkboxlist.ftl. This is located in the struts-core.jar under templates/xhtml folder. We want to override that, so lets create our own version of it. To start with lets copy the existing freemarker templates (located in struts-core.jar templates/xhtml) into your new template/myapp folder.
3. Now edit the filer checkboxlist.ftl. As you can see its referring to the template stored under the simple folder.
<#include "/${parameters.templateDir}/simple/checkboxlist.ftl" />
Lets change that so that it points to your directory structure
<#include "/${parameters.templateDir}/myapp_simple/checkboxlist.ftl" />
4. Now lets copy the checkboxlist.ftl located in the template/simple folder (from the struts-core.jar) into your template/myapp_simple folder.
5. Lets override this file now. What i want to do is make all the checkboxes appear in a 4 column table. So here's what my checkboxlist.ftl looks like.


<#assign itemCount = 0/>
<#if parameters.list?exists>
<@s.iterator value="parameters.list">
<#assign itemCount = itemCount + 1/>
<#if parameters.listKey?exists>
<#assign itemKey = stack.findValue(parameters.listKey)/>
<#else>
<#assign itemKey = stack.findValue('top')/>

<#if parameters.listValue?exists>
<#assign itemValue = stack.findString(parameters.listValue)/>
<#else>
<#assign itemValue = stack.findString('top')/>

<#assign itemKeyStr=itemKey.toString() />
<#if itemCount%4=0>

<#elseif itemCount%4=2>

<#elseif itemCount%4=3>

<#else>


<#rt/>
<#if tag.contains(parameters.nameValue, itemKey)>
checked="checked"<#rt/>

<#if parameters.disabled?default(false)>
disabled="disabled"<#rt/>

<#if parameters.title?exists>
title="${parameters.title?html}"<#rt/>

<#include "/${parameters.templateDir}/simple/scripting-events.ftl" />
<#include "/${parameters.templateDir}/simple/common-attributes.ftl" />
/>

<#if itemCount%4=0>

<#else>



<#rt/>

<#else>


Thats it

Monday, July 12, 2010

I love my Grill!

Its the 4th of July weekend and so i thought its about time i got myself a Grill.

My budget was limited, and so even tho the webers looked very appealing i had to stick within my $200 limit (self imposed ofcourse).

I ended up going for the Nexgrill (http://www.homedepot.com/h_d1/N-5yc1vZ1xg1Zbwo59/R-202326969/h_d2/ProductDisplay?langId=-1&storeId=10051&catalogId=10053)
My first BBQ turned out to be pretty good. Here are few recipes that went down well with the peeps.

1. Pork Chops (http://www.foodnetwork.com/recipes/paulas-home-cooking/grilled-pork-chops-recipe/index.html)
2. Chicken Tikka Masala (http://allrecipes.com//Recipe/chicken-tikka-masala/Detail.aspx)
3. Grilled Shrimp (http://www.foodnetwork.com/recipes/ina-garten/grilled-herb-shrimp-recipe/index.html)

Installing GWT on Ubuntu 10.04

When trying to run GWT in hosted mode i got the following,

** Unable to find a usable Mozilla install **
You may specify one in mozilla-hosted-browser.conf, see comments in the file for details.

To overcome this i downloaded mozilla-1.7.13 from the following location,
http://google-web-toolkit.googlecode.com/svn/tools/redist/mozilla/mozilla-1.7.13.tar.gz

I then updated the mozilla-hosted-browser.conf to point to my newly unziped mozilla dist.

When i retried to launch the GWT hosted browser i now got the following,

** Unable to load Mozilla for hosted mode **
java.lang.UnsatisfiedLinkError: /
/mozilla-1.7.13/libxpcom.so: libstdc++.so.5:
cannot open shared object file: No such file or directory

source: http://whatwouldnickdo.com/wordpress/99/unable-to-load-mozilla-for-hosted-mode-gwt-ubuntu-810-linux/

The key to troubleshooting the problem is in the second line, libstdc++.so.5 to be exact. It can’t find this C++ library. Turns out the hosted browser needs libstdc++5, but the version currently installed on my 8.10 system is libstdc++6. So you can either:

I had trouble installing the libstdc++5 using sudo apt-get install libstdc++5


So instead i did the following,
# wget http://ftp.egr.msu.edu/debian/pool/main/g/gcc-3.3/libstdc%2b%2b5_3.3.6-20_i386.deb
# dpkg-deb -x libstdc++5_3.3.6-20_i386.deb libstdc++5
# cp -p libstdc++5/usr/lib/libstdc++.so.5.0.7 /usr/lib
# cp -p libstdc++5/usr/lib/libstdc++.so.5 /usr/lib

This solved the problem!

Saturday, June 12, 2010

Remotely accessing my Ubuntu server via Windows

- Install cygwin with x11 packages (see cygwin X)
- start cygwin
- /usr/bin/startxwin.exe

In the Xwindows window type in,
- ssh -Y rpaiva@

- you can launch xterm&
- you can launch eclipse&

Wavin Flag - K'naan

Thursday, June 10, 2010

How to make the most of the World Cup: Apps, Web sites, podcasts and more!

My thoughts exactly!!!

Excerpt from Techcrunch (original post: http://bit.ly/dCvAJz)

Let’s get down to business. The World Cup begins tomorrow, June 11, 2010. The tournament kicks off with hosts South Africa against Mexico at 9:30am ET/6:30am PT on ESPN in the U.S. (International readers: you’ll have to consult your local listings.) Consider this post a general how-to on making the most of the tournament. Mobile Apps, helpful Web sites, podcasts, etc. Woo~!
TV
This section only covers the U.S. ESPN/ABC has the rights to the World Cup, and all of the matches will air on the ESPN cable channels and on the ABC network. The first game is South Africa v. Mexico at 9:30am ET on ESPN. It’s in HD, of course, but also in 3D if you have access to ESPN 3D. I’m not rich and I don’t have a 3D TV so whatever. All the games are spread across all of the ESPN/ABC networks, so be sure to check either your digital cable/satellite program guide or ESPN’s Web site. The big game this weekend, England v. USA, is at 1:30pm ET on ABC. Well, at least that’s when coverage starts.
Helpful Web site
There’s an extraordinary number of Web sites devoted to World Cup coverage. The ones I will be checking every two seconds include The BBC (UK), The Guardian (UK), The Times (UK),Marca (Spain), AS (Spain), SPORT (Spain), El Mundo Deportivo (Spain), A Bola (Portugal),Record (Portugal), O Jogo (Portugal), La Gazzetta Dello Sport (Italy), Corriere Dello Sport(Italy), O Globo (Brazil), Clarín (Argentina), France Football (France) ESPN (USA), andGoal.com (USA). Another cool site? Zonal Marking. It discuses tactics and whatnot. Highly recommended for the soccer wonk in your life.
Two ProTips:Try Roja Directa and Iraq Goals. If you’re stuck in the office when a big game is going on, go to either of those sites and you’ll find links to live-streams of all the games. Are these sites legal? I don’t know and I don’t care, and neither should you.
Mobile Apps
Just like there’s a number of Web sites out there, there’s a whole hell of a lot of Apps out there for your phone. Seeing as though I’ll be at E3 next week I will be checking my phone every 23 seconds.
Goal.com’s App [iTunes link, but also available for Android]. It’s basically all of Goal.com (which I believe is the largest soccer site out there) on your phone. Live scores, post-game reports, etc. Totally free, so go crazy. This is the one I’ll be using at E3, I imagine.
World Cup Game Finder. This App goes live a little bit later, but it will point New York City residents in the direction of places (bars and the like) that are showing the games. It only works for the iPhone. And not for nothing, but Nevada Smiths is still the premiere bar in New York to watch the sport. It’ll probably be crowded so get their early if you plan on going. Also: make sure you are, in fact, 21 or older. It’s not like the old days (World Cup 2006) when I could waltz in at noon and buy Stella after Stella at the ripe old age of 19/20. The Man now cards for real, so fair warning.
I only picked out two here because, you know, I don’t have all day to list 8 million Apps. Just search “world cup” on the App Store and the Android Market and you should be cool. I looked at a bunch of them are they’re all sorta the same: live scores and the like.
Radio/Podcasts
Sirius XM has all the games of the World Cup live. I will also be using the Android App during E3 to listen to games live. Ron and Fez (11am-3pm, weekdays) are also all over the World Cup, so do yourself a favor and tune in. I will~! (Also: Join their World Cup bracket.)
The Guardian has a podcast, World Cup Daily, that will absolutely be worth downloading. It’s free.
World Football Daily is another great podcast that will be bringing the thunder during the tournament. It’s not free, but it’s only $5 per month: just buy one less fancy drink at Starbucks this month and you’ll be all set.
Conclusion
I am freaking out. It’s finally here! AAAHHH~!

Tuesday, June 1, 2010

Yosemite 2010

This memorial weekend i decided to spend some quality time with my camera, and what better place to do that than Yosemite.

Here's what i did to make the most of my trip.
1. Rented a couple of lenses from http://www.borrowLenses.com
Nikon 12-24mm f/4G AF-S DX IF-ED
Nikon 50mm f/1.4G AF-S
I also posses a Nikon 18-200mm f/3.5-5.6 G ED-IF AF-S VR DX


Out of these two lenses, I thought the the 50mm was fantastic. The pictures taken from that were crystal clear. It's also a very fun lens to have. I'm definitely going to purchase one for myself soon. 
I liked the idea of borrowing the lenses. It gives you a chance to play with the lens and see if this works for you before you spend good money and buy one. There's another lens rental place (http://www.lensrentals.com/), however, since borrowlenses had an office in San Mateo this was a no brainer.


2. I decided on the trip pretty late, and so was unable to find decent accommodation within the park. The best place i could find was YosemiteBug.

This place turned out to be perfect for what i wanted. True, it was not the most luxurious. But it definitely was rustic and completed my camping experience. Finding it was a little tough but when i did it was well worth it.
However, the next time i do visit Yosemite I am definitely going to be staying at Curry Village. Its right inside the park and it has some excellent reviews. 

3. Equip myself with the necessary camping/hiking stuff which i picked up from REI.

Well no biggie. The stuff i got was the bug spray (which i didnt need) and a first aid kit. The other stuff was the usual -> tons of water for all the hikes, gatorade, home made sandwiches to take on the hike (although you can buy them at Degnan's Deli in Yosemite valley). 

4. Plan out my hikes and things i want to check out.

I did a few excellent hikes. Here are the places i visited:
- Foot of Yosemite Falls
- El Capitan - This 3000 foot granite rock is a favorite amongst rock climbers. It takes some climbers 2 days to climb this and its fascinating to see little lights scattered around the rock in the night where climbers have taken shelter in some ledge. 
- Sentinel Rock
- Mirror Lake (around a 4 mile hike)
- Glacier Point (this was quite a strenuous hike: albeit it was just 4.25 miles each way) - The views from this 7000 odd feet above sea level (3200 feet above curry village and the valley) was spectacular. It provides some stunning views of Yosemite Falls, Half dome and Nevada falls. My timing here was perfect as i got there close to sunset. One of the rangers provided us with an informative and entertaining talk about its history. Even though it was a tough hike - it was well worth it.
- Then drove to Bridalveil Falls ( a really fun waterfall - i was completely drenched trying to get close to the foot of it ). Btw - i just loved all the waterfalls. 
- Hetch Hetchy - this glacial valley is completely flooded by the O'Shaughnessy Dam. This area is very picturesque and not that popular among the tourists. So it was a perfect place to try out all my camera settings. 

Photograph links to follow soon....

Overall a really good experience and i'm def going back again. Next time i'm going to conquer Half Dome!

Tuesday, May 18, 2010

Hosting at home...

Some notes i captured while i was experimenting hosting my website at home.

Setting up hosting on your home computer
source: http://www.boutell.com/newfaq/creating/hostmyown.html

Free DNS Hosting:
There are many options, i went with ZoneEdit.com

- Sign up for ZoneEdit.com (also check out dyndns - not free tho)
- Add Zones
- Provide your zone (domain you want to use)
- Provide the ip address - your current home ip address
- Copy the nameserver addresses
- Contact your registrar (example: www.godaddy.com) and tell them to change the nameservers for your domain, or use these nameservers when you buy a new domain.
- You can do this on your own.
- log into godaddy
- domain manager
- manage domain
- update nameservers


Getting Apache server on your linux
source: https://help.ubuntu.com/6.06/ubuntu/serverguide/C/httpd.html

sudo apt-get install apache2
- configurations : /etc/apache2/apache2.conf
- The default page is taken from /var/www/

sudo /etc/init.d/apache2 start

Setting up dynamic DNS on your home computer
Why? Cause your home computer IP will keep changing each time to login to the network
- I'm using http://sourceforge.net/apps/trac/ddclient
- check out the code

svn co https://ddclient.svn.sourceforge.net/svnroot/ddclient/trunk ddclient

- go through the README file once downloaded
- follow the steps
- to start
/etc/init.d/ddclient start

/usr/sbin# ddclient -daemon=0 -noquiet -debug -ip=71.198.38.193


Getting your home router to give you a static IP
- log into netgear (or your router)
- Attached Devices (see whats attached already)
- Lan IP Setup
- Address reservation
- Provide the IP and the devices mac address and you're all set.

Notes:
- To check your current IP I used http://www.ipchicken.com/

Monday, May 10, 2010

Smart Grid IPOs and Trilliant...


Here's an excerpt about the company i work for...:

Enter Trilliant, a prime candidate for a 2010 smart grid initial public offering (IPO).
The company makes wireless devices that attach to existing meters and devices at each tier of the electricity distribution system, allowing for the real-time relay of information about substations, outages, and the energy usage patterns of neighborhoods and schools.
For the tech savvy out there, Trilliant's products are better than their competitors because they support multiple modes of data transfer, including static IP, dynamic IP, and circuit-switched.
What's more, the company is in bed with the big boys. Their products are compatible with a number of branded meters, including models from GE, Landis+Gyr, and Obama's darling, Itron.
Consumers can even get the data on their cell phones. Trilliant's feed is compatible with Verizon, Sprint, AT&T, Telus, Rogers, and a number of other wireless service providers.
And Trilliant is allowing things to be done in the electricity industry that have never been done before...
  • Real-time pricing based on usage profiles of homes and neighborhoods
  • Remote connect/disconnect
  • Voltage reporting
  • Automated power outage reporting
Further down the line, Trilliant's systems will be used to optimize energy efficiency, enable demand response, help integrate distributed sources like wind and solar, and help with the adoption of charge-at-home vehicles.
What we're about to witness is the networking of the grid — the Internet for energy.
This was the aim of the $3.4 billion: to bring smart grid solutions to the table.

Thursday, April 29, 2010

Thursday, April 15, 2010

Opinions and Viewpoints

Thats just what they are, opinions and viewpoints.

Everyone has them. But its up to you to take them in context, customize them, and make them work for you.

I've seen people go through life listening to others, sometimes doing what they say just to make them happy, maybe even hoping that they would be more likeable. In my opinion this does not work. You have to ask the question, ok you're making the other person happy, but are YOU Happy? Is this what you really want?

My take on this is the following,

In giving advice, seek to help, not please, your friend - Solon

- Some people like to share their opinions (i'm one of them :) ). Listen to them. They are sharing their opinions because they want to help and they care.

- However, it doesn't mean they are right. Maybe what they said worked for them, but there are many things that factor into it. What was the context? What was their thought process, their personality, what was their desired outcome? Do all of these match what you want? Most often not. People are different.
- So take into consideration what they say. Think about it. Filter out the noise and do what feels right. Very often your gut is right :)

So in conclusion, everyone will have their own opinion or viewpoint on the things you say and do. But remember,
thats just what they are, opinions and viewpoints.

Miluwakee memories...

Ok, so its been a good 4 months since I moved from MKE to SFO. Having settled down, here are a few things i miss most from MKE.

1. My group of friends: I had an incredible set of friends over in MKE and I miss them the most. The mix includes a best friend I've known for around 17 years, football enthusiasts, throw in a crazy bunch of party animals! yes animals haha.. mixed together with my work buddies make a wonderful recipe for 'trouble': always resulting in good memories!

2. The end of summer camping trip: For the last 2 years we've been doing this camping trip just before the end of summer. Ironically, its been on the exact same days as the previous year. The trip has always been fun: pitch up the tent, spike the bbq, get drunk, sing till you drop, play some games, take plenty of pics, good laughs and memories

3. Summer soccer: I'm sure I'll sign up for soccer here as well, but its not going to be the same. We started it just last year, and it was interesting to see our fitness levels rise. Initially we could just survive 5 mins a half lol and towards the end we managed to make it through the entire hour. 

4. Sri Lankaness!: Yes I said it. It was nice to spend time with the Sri Lankans. Enjoying a home cooked rice and curry over conversations about how much our work sucks! Getting tangled up in other people's domestic issues. Typically Sri Lankan! Lol... (well... on second thoughts maybe I dont miss this one that much)

5. Street races - Our Sunday morning street races on the 794. A stretch of road that is pretty much a deserted bridge. We've hit almost 150mph+ on that 1 mile stretch. Although that adrenalin rush does tend to live on in you, which resulted in me getting a couple of speeding tickets, I have no regrets.

6.  Suite, Whiskey Bar, Notte and the gang: Our local watering holes. Good friends, good drinks, plenty of forgetful memories.
http://www.suitemilwaukee.com/
http://www.nottemilwaukee.com/

7. Ghost Recon: Our many online gaming nights: Maybe we can continue that here as well. I just need to get myself an XBox360

8. Pizza hut, Chinese and Thai take away : I'm not sure why I have it here 'cause you get plenty of that here as well. These were my fall back options whenever i was too lazy to cook.. and that happened a lot so i guess it fittingly is on my list.

There you go. The top 8 things I miss most about Milwaukee! 

Start up ideas...

Some interesting blog posts i came across:

The best way to come up with startup ideas is to ask yourself the question: what do you wish someone would make for you?
http://www.paulgraham.com/organic.html

Another related article
http://fbindie.posterous.com/start-up-ideas-its-not-what-you-know-its-who

Tuesday, March 30, 2010

A secret to making money online

Very very cool presentation.

<div><a href='http://www.omnisio.com'>Share and annotate your videos</a> with Omnisio!</div>

Friday, March 26, 2010

Saturday, January 2, 2010

2009 Review: Tech Products I Love And Use Every Day

After reading Michael Arrington's blog post: 2010: My Fifth Annual List Of The Tech Products I Love And Use Every Day I thought I should compile my own list. So here goes,

1. Gmail (www.gmail.com)
I've been using Gmail since 2005. Its no fuss interface, quick mail search and its integration with other google labs products (Gtalk, google talk and tasks) have made it my de facto personal email client. Dont forget about the fact that you dont ever have to delete mails to keep your storage limit in tact. Its probably the most popular email client.

2. Google Docs (www.google.com/docs)
Google docs has been my replacement for sharing office documents for a while now. The ability to create a doc/spreadsheet and be able to access it anywhere (from home, office, your phone etc) is so convenient. I use it for almost anything now and hardly ever create office documents on my machine - means no more paying big bucks to install Office on my computer. I'm pretty sure MS Office will come up with an Office online suite pretty soon so we'll have to wait for that to see how it stacks up. I need to try out Dropbox this year too.

3. Picnik (www.picnik.com)
One of the most creative and easy to use online tools out there. Its my one stop shop for image manipulation, and uploading of pics to flickr and Picasa. Its the secret my photograph's look so good ;)

4. Delicious (http://delicious.com/)
Again, the answer to keeping everything online. One of the best social bookmarking tools out there. I especially like the Popular bookmarks feature - you do find some gems in there.

5. Xmarks
Similar to Delicious, but different. This tool syncs up my bookmarks on my various browsers - Firefox and Chrome.

6. Google Notes
Whenever I need to jot down something I feel is important, Google notes has been my answer. I haven't really tried out Evernote yet, thats something I need to do this year.

7. Twitter (www.twitter.com)
I was a little late to try out twitter, but since I did, I simply love it. Its amazing how much you can learn from your twitter feed. People share some pretty amazing stuff - interesting articles, hot news, inside info on your favorite sportsmen etc. Its helps me keep up to date with whats going on in the world. The world is definitely a much smaller place because of twitter and facebook.

8. Facebook (www.facebook.com)
One of the best inventions this decade. It also won best overall start up at the Crunchies this year. I've reconnected and kept in touch with soo many people I wouldn't have, had it not been for facebook.

9. Mint.com (www.mint.com)
One of my favorites! There's a lot of personal finance management software out there, but in my opinion, this is the best. It helps saving easier by suggesting ways to save money by integrating with financial institutions and providing the most suitable option based on my lifestyle. Pretty cool concept and is a former techcrunch50 winner.

10. iPhone and Macbook pro (www.apple.com)
I love Apple!! Ever since I got my iPhone I've been sold, and have wanted a Mac ever since. The UI is soo slick. It defines a new meaning to software applications. Everything is soo solid. Coming from a PC background you certainly feel the difference.

11. Pandora (www.pandora.com)
I love my pandora :) Haha.. yes yea, I love everything on this list. I use pandora a lot and now my playlist plays the music I love.

Search This Blog