Miles to go …

November 27, 2010

JavaOne Brazil Twitter, LinkedIn, Facebook, Promo Images, Websites, etc.

Filed under: General — arungupta @ 2:09 pm

JavaOne Brazil is right around the corner and here is some useful information for you …

The exhibition hall and demos are FREE for all and you can save by registering before Dec 3rd. Register now!

Here is the complete list of Java EE 6 & GlassFish sessions.

Don’t miss the first JavaOne Latin America. I’ll be there … will you ?

Technorati: conf javaone brazil

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

November 22, 2010

Screencast #35: JDK 7 Project Coin Features in NetBeans IDE 7.0 Beta

Filed under: General — arungupta @ 6:00 am

NetBeans IDE 7.0 Beta was released last week – download here. JDK 7 build 118 was released last week as well – download here. The New and Noteworthy page of NetBeans 7.0 highlights the support for some of the Project Coin features. This screencast highlights how to get started with JDK 7 in NetBeans IDE and use some of the Project Coin features, specifically:

  • Strings in switch
  • Binary integer literals and underscores in numeric literals
  • Multi-catch
  • Improved type inference for generic instance creation (diamond operator)
  • Automatic resource management

Enjoy!

Share feedback about Project Coin at coin-dev and about NetBeans at NetBeans Forums.

Technorati: screencast netbeans jdk7 project coin

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

November 21, 2010

TOTD #151: Transactional Interceptors using CDI – Extensible Java EE 6

Filed under: General — arungupta @ 10:00 pm

One of the questions often asked in recently, and I’ve been wondering too, is how to enable transactions using CDI Interceptors. This Tip Of The Day (TOTD) will share some basic piece of code on how to author a CDI interceptor that enable transactions. TOTD #134 provide more details about interceptors. Weld documentation certainly provide good details about how all the pieces fit together.

Lets jump to the code straight away. Lets look at the transaction interceptor binding code:

package org.glassfish.samples;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import javax.interceptor.InterceptorBinding;
@Inherited
@InterceptorBinding
@Retention(RUNTIME)
@Target({METHOD, TYPE})
public @interface TxInterceptorBinding {
}

And the actual interceptor:

package org.glassfish.samples;
import javax.annotation.Resource;
import javax.interceptor.AroundInvoke;
import javax.interceptor.Interceptor;
import javax.interceptor.InvocationContext;
import javax.transaction.UserTransaction;
@TxInterceptorBinding @Interceptor
public class TxInterceptor {
@Resource UserTransaction tx;
@AroundInvoke
public Object manageTransaction(InvocationContext context) throws Exception {
tx.begin();
System.out.println("Starting transaction");
Object result = context.proceed();
tx.commit();
System.out.println("Committing transaction");
return result;
}
}

This interceptor is injecting a "UserTransaction" and sandwiching the business method invocation between start and end of trnasaction. This interceptor is not dealing with any rollback scenarios or exception handling and so will need to be modified for a real-life scenario.

"beans.xml" looks like:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
<interceptors>
<class>org.glassfish.samples.TxInterceptor</class>
</interceptors>
</beans>

This basically enables the interceptor.

With all the plumbing code now ready, lets use this interceptor on our application code as:

package org.glassfish.samples;
@TxInterceptorBinding
public class ShoppingCart {
public void checkOut() {
System.out.println("Checking out");
}
}

The important part is "@TxInterceptorBinding" as a class-level annotation. Now this ShoppingCart can be injected in any Java EE resource such as:

@Inject ShoppingCart shoppingCart;

such as in a Servlet. Now invoking the servlet shows the following sequence of code in the server log:

INFO: Starting transaction
INFO: Checking out
INFO: Committing transaction

That’s it folks!

The code for this sample application can be downloaded from here. Just download and unzip the code, open the project in NetBeans (tried with 7.0 beta) and run it on GlassFish or any other Java EE 6-compliant container.

If you are using EJBs in a WAR, which is now allowed per Java EE 6, then you can certainly leverage all the annotation-driven transactions within your web application instead of maintaining your own interceptor-driven transactions. A similar approach can be used for security as well.

How are you dealing with transactions in your web application – using CDI-based interceptors or let the container manage it all for you ?

Technorati: totd cdi javaee6 glassfish interceptors transactions

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

November 19, 2010

Java EE 6 & GlassFish @ JavaOne Brazil & CEJUG

Filed under: General — arungupta @ 10:53 am

The first ever JavaOne outside (well almost, the last one was a while ago :) the USA is going to be in Brazeeeeel from Dec 7-9th … yeeeee haw! Java EE 6 & GlassFish will have a strong presence there in terms of technical sessions, general session, exhibitor floor, hands-on labs, and of course you’ll find us all around the hallways.

Here is a quick summary of different Java EE 6 related sessions …

When ? Where ? What ? Speaker ?
Tuesday
11:45 – 12:30pm
Salon 2 S319438
HK2: Oracle WebLogic Serve, Oracle GlassFish Server, and Beyond
Jerome Dochez

Wednesday
10:15 – 11am

Salon 1 S313557
The Java EE 6 Programming Model Explained: How to Write Better Applications
Jerome Dochez
Wednesday
10:15 – 11am
Salon 2 S313431
Java Persistence API 2.0: An Overview
Ludovic Champenois
Wednesday
11:15 – 12pm
Salon 1 S314168
What’s New in Enterprise JavaBean Technology
Arun Gupta
Wednesday
1:30 – 2:15pm
Salon 3 S313265
Advanced Java API for RESTful Web Services (JAX-RS)
Chuk-Munn Lee
Wednesday
2:30 – 3:15pm
Salon 3 S320002
Creating RESTful Web Services using JAX-RS
Ludovic Champenois
Thursday
10:10:45
Salon 1 S313189
Complete Tools Coverage for the Java EE 6 Platform
Ludovic Champenois
Thursday
11:15 – 12:00pm
Salon 1 S320004
Hyperproductive JavaServer Faces 2.0
Arun Gupta
Thursday
2:00 – 2:45pm
Salon 1 S313937
Using Contexts and Dependency Injection (CDI) in the Java EE Ecosystem
Jerome Dochez
Thursday
4:15 – 5:00
Salon 1 S320003
Servlet 3.0 Extensible, Asynchronous and Easy to Use
Arun Gupta
Thursday
4:15 – 6:00pm
Salon 4 S314285
Using Oauth with RESTful Web Services (Hands-on Lab)
Chuk-Munn Lee
Thursday
4:15 – 6:00pm
Salon 6 S313277
Beginning with the Java EE 6 Platform (Hands-on Lab)
Ludovic Champenois
& Gang

And prior to JavaOne, I’ll also be speaking at CEJUG on Java EE 6.

Looking forward to enjoy Caipirinha, Churrascaria, Guarana, Brazilian coffee, beautiful beaches, and my first summer time visit to Brazil :-) Where will I see you ?

For the first time travelers to Brazil, here are some travel tips and 4 things not to miss in Brazil.

Technorati: conf javaone brazil javaee6 glassfish brazil cejug

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

November 18, 2010

TOTD #150: Collection of GlassFish, NetBeans, JPA, JSF, JAX-WS, EJB, Jersey, MySQL, Rails, Eclipse, and OSGi tips

Filed under: General — arungupta @ 6:00 am

This is the 150th tip published on this blog so decided to make it a collection of all the previous ones. Here is a tag cloud (created from wordle.net/create) from title of all the tips:

As expected GlassFish is the most prominent topic. And then there are several entries on NetBeans, JRuby/Rails, several Java EE 6 technologies like JPA, JAX-WS, JAX-RS, EJB, and JSF, and more entries on Eclipse, OSGi and some other tecnhologies too. Here is a complete collection of all the tips published so far:

Just for fun, here is another tag cloud:

You can access all the tips here. And keep those suggestions coming!

Technorati: totd glassfish netbeans jpa jsf jaxws jersey mysql rails osgi eclipse

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

November 17, 2010

Screencast #34: GlassFish 3.1 Clustering, High Availability and Centralized Administration

Filed under: General — arungupta @ 12:48 pm

Two main themes of GlassFish 3.1 are: High Availability and Centralized Administration. This screencast demonstrates how to create a 2-instance cluster on a single machine using web-based Administration Console, deploy the canonical clusterjsp application, and show session fail-over capabilities in GlassFish 3.1.

From download to testing an application with high availability … all in under 10 minutes … enjoy!

A future screencast will show how to create multiple nodes on different machines, with 1 or more instance on each node, and all of them front-ended with a load balancer.

Technorati: screencast glassfish clustering highavailability

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

November 10, 2010

Oredev 2010 Trip Report

Filed under: General — arungupta @ 2:11 pm

Oracle is a silver sponsor sponsor of Oredev 2010 and there were several talks by Oracle speakers. There are about 1300 attendees so its a fairly big conference, probably the biggest developer gathering in the Nordic countries. The conference had a pretty wide variety of topics from Java, .NET, Agile, Smart Phones, Web Development, and others. The conference venue itself used to be a slaughterhouse and you can imagine it easily accommodated 1300 attendees :)

I gave a hands-on workshop on "Deep Dive Hands-on in Java EE 6" and the slides are now available:

There were about 15 participants and most of them were very interactive which is the real fun part! As part of the lab we coded samples for most of the Java EE 6 new/updated technologies such as:

  • Managed Beans 1.0
  • Interceptors 1.1
  • Servlets 3.0
  • Enterprise Java Beans 3.1
  • Contexts & Dependency Injection 1.0
  • Java Server Faces 2.0
  • Java Persistence API 2.0
  • Bean Validation 1.0
  • Java API for RESTful Web services 1.1

The fun part that most of the attendees got their code working along with me. Anyway, the sample code built during the lab is also available here.

I also gave a presentation on "Using the latest Java Persistence API 2.0 Features" and the slide deck is available below:

There were about 50 attendees in this talk. It basically explained the new features in JPA 2 such as improved O/R mapping in Java, expanded JPQL, Metamodel, type-safe Criteria API, support for Bean Validation, standard configuration options, and many other options. And then showed how NetBeans can easily generate JPA entities from a database and also generate canonical metamodel classes. As in the workshop, the audience was very interactive and gave some good suggestions for JPA 2.

Day 1 keynote was by Dr Jeff Norris (JPL, Pasadena) who talked about three pillars of Mission Critical Agility – Vision, Risk, and Commitment. His presentation showed how Alexander Graham Bell had a great vision and risked everything he had to meet that vision. He showed a great demo using augmented reality, probably one of the finest ones I’ve seen in recent conferences. The keynotes are conducted in a big theater-style hall, that probably makes it fourth conference in Europe (along with Devoxx, Jazoon, and JavaZone) to be conducted in a theater. I wonder if this is a European thing cause I’ve yet to see a conference in the US going that way ;-)

One of the cool tracks in the conference is Xtra(ck) which has topics like Undesrtanding Hypnosis, Photographic Composition and Creativity, Effective public speaking skills, and some other good ones. I attended the hypnosis session earlier today and Lina Esa (the instructor) talked about unconsious, sub-conscious, and conscious mind and how they can be controlled with hypnosis. She is going to have a practice session on Friday but I’m flying out earlier :(

The closing keynote on Day 1 was by Henrik Kniberg where he talked about how visualizing software, by means of pictures,  diagrams, and otherwise, can drive collaboration and process improvement. He is also linked it very nicely with personal life as a means to release stress and keep the work-life balance.

Other than that there were lots of fun activities planned …

  • Skinny dipping in the close-to-freezing ocean after sitting in the 85 degrees sauna was quite a unique and cultural experience.
  • Dinner at Ribersborgs Kallabdhus after the hot-and-cold-bath was definitely very welcome.
  • The meet-and-greet at at Magnus’s house before the speakers’ dinner was very welcoming. Enjoyed Glögg, with traditional raisins and almonds, in this freaking cold weather.
  • The speakers’ dinner in a formal setup at Malmo city hall with opening speech by deputy mayor of Malmo was quite an overwhelming experience. I tried black soup (made out of boiled pigs’ blood) there and not sure if I really liked it but the ambience was superb ;-)

There are other fun activities planned over the next couple of days. Here are some pics from the event:

="" src="http://lh5.ggpht.com/_wIoV5EX5M-0/TNo-AkQgQxI/AAAAAAAAZFU/i0dMSgYHT7Y/s288/DSCN0449.JPG" />

And the complete album:

I would’ve loved to stay longer and engage with the wonderful attendees but fever, cough, and cold is making me pre-pone my flight by a day.

I plan to come back again next year, see ya in 2011!

Technorati: conf oredev sweden glassfish javaee6 jpa2 netbeans 2010

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

November 4, 2010

OTN Developer Days 2010, New York City Trip Report

Filed under: General — arungupta @ 7:38 pm

OTN Developer Days kicked off this morning in the heart of New York City in the Millennium Broadway hotel. About 200 developers attended 20 sessions + hands-on labs divided in four tracks – Server, Desktop, Mobile, and Embedded. I think that was a pretty good turnout knowing that this was a weekday and kept raining all day.

I delivered 2 sessions + 3 hands-on labs (yes, back-to-back) in the Server track. There were about approximately 80 attendees through out the day in the Server track. It was tiring speaking for pretty much the entire day but totally enjoyed the super interactive audience. The attendees were not aware to bring their own laptops so most could not try hands-on lab on their own. This will be fixed for subsequent events by including a reminder in the registration email. As a consequence I converted the hands-on lab sessions to code walk through where I built the entire sample and explained the code in detail. After initial hiccups the three hands-on workshops went smoothly. The workshops covered some of the key Java EE 6 technologies by building mini applications and combination of technologies was:

  • EJB 3.1 + JAX-RS 1.1
  • JSF 2 + CDI 1.0
  • Servlets 3.0 + JPA 2

The slides from the two sessions are available below:

Here is some feedback from the audience on the delivered sessions + workshops:

Arun Gupta puts on a fine presentation. The man has been doing this for a while; and he knows the technology and related material quite well. Good Job Arun!

I thought Arun Gupta did an excellent job with his presentations. He was very prepared with his examples and was able to offer supplemental materials for the content.

Mr Arun Gupta is knowledgeable and thorough presenter. Pace of the presentation is good.

Excellent presentation with audience involvement.

Arun is obviously very knowledgeable. He gives good intro level of detail to understand concepts, and can answer detailed questions as well. Arun is well spoken and open for question of all types.

Demo were well done and the walk through were helpful especially since I did not bring a laptop.

Arun Gupta = Excellent and Knowledgeable

Excellent presentation, hats up!

Great seminar, great instructor! Exceeded my expectation by a lot!

For fun, one of the feedback was …

Just do this kind of FREE seminars on WEEKEND.

As always there is always is room for improvement so I take that feedback close to my heart as well. Thank you everybody for attending the session and providing the feedback!

And as always, some pictures …

And the complete photo album:

If you are interested in attending in one of these workshops, check out the locations of OTN Developer Days worldwide.

2 down (Cloud Expo and OTN Dev Days) and 5 more to go (Oredev, Rich Web Expo, DegIgnition, CEJUG, JavaOne Brazil) in the next 5 weeks.

Where will I see you ?

Technorati: conf oracletechnet otn devdays newyorkcity javaee6 glassfish

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

November 2, 2010

Silicon Valley Marathon 2010 Results – Personal Record!

Filed under: Running — arungupta @ 5:17 am

I ran Dean Karnazes Silicon Valley Marathon 2010 over the weekend and here are the results:

This amounts to an average page of 8:35 min/mile.

A total of 2100 runners registered for the entire event, 652 were marathon finishers (464 males and 188 females) and rest were half-marathoners, 5k runners, and kids races. The marathon male winner completed the course in 2:35:25 and the female winner in 3:12:44. The complete results are available here.

A split of finish times for males and females is given below:

As evident, most of the marathoners finished within the 3:30 – 4:00 hour range. The average finish time was 4:17:03. A complete route of the map is available below (click on the map for an interactive version):

My last long run before the marathon was almost 7 weeks before the race. After that I ran a practice half marathon and all my other runs were single digits. I did log lots of miles but they were on airlines traveling internationally for different conferences so was focusing primarily on cross-training. It helped but lack of long runs showed up in poor performance during the last few miles as evident in the mile splits below:

Guess, I hit the wall at mile 23 :(

Even though this was a PR for me and I improved timings by over 15 minutes from the last full marathon but I did not like the performance during the last few miles. Stronger and faster running with several hill runs are certainly the key and I need to put more emphasis on them!

There were significant differences from other local and much bigger races like Rock-n-Roll and San Francisco Marathon such as one mass start instead of wave starts, relatively less number of spectators, and much smaller expo. But the huge advantage was that the start time was 7am and there is ample free parking in the San Jose downtown on weekends.

Anyway here is the cumulative result of all the marathons so far:

Marathon / Half Marathon Total Time Pace
Silicon Valley Marathon 2010 3:49:17 8:35
San Francisco 1/2 Marathon 2010 1:35:42 7:18
San Jose Rock-n-Roll 2009 1:30:59 6:57
San Francicsco 1/2 Marathon 2009 1:38:21 7:31
Kaiser Permanente San Francicsco 1/2 2009 1:41:30 7:45
Silicon Valley 1/2 2008 1:45:42 8:04
San Francisco 1/2 2008 1:52:44 8:25
San Francisco Full 2007 4:04:33 9:20
Silicon Valley Full 2006 4:06:57 9:25
San Francisco 1/2 2005 1:48:50 8:18

Technorati: running marathon results siliconvalley svmarathon

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

November 1, 2010

TOTD #149: How to clean IntelliJ cache, preferences, etc on Mac OS X ?

Filed under: General — arungupta @ 11:00 pm

I’ve installed, un-installed, re-installed, re-un-installed, re-re-installed and so on IntelliJ IDEA multiple times on my MacBook. However the uninstall leaves a few remnants in different directories all over the system. These directories need to be manually removed in order for a clean install next time. This TOTD (Tip Of The Day) provide the list of directories which need to be removed explicitly:

~/Library/Caches/IntelliJIdea90
~/Library/Logs/IntelliJIdea90
~/Library/Preferences/IntelliJIdea90
~//Library/Application Support/IntelliJIdea90

And IntelliJ IDEA is installed in the directory "/Application/IntelliJIdea90" which gets deleted if the application is deleted. And you’ll need to get rid of this directory if the mystical plugin configuration is not configured right the first time.

Also read IDEA-43039 for more details on invalidating caches. Read more on stackoverflow.com on how to clear out global settings.

That’s it, just a short one this time!

Is there a better way to deal with this mess ?

Technorati: totd intellij idea cache osxtips

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.
Powered by WordPress