No Fluff Just Stuff 2011, Madison, WI

I attended the No Fluff Just Stuff conference in Madison, WI this weekend. It was a great chance to learn the newest Java trends and share struggles in programming with people much like myself, even if most of them were cheeseheads. Here are some of my reflections on the state of Java tech post-conference:

-Java 7 is underwhelming, mostly because it will not have closures. It will however introduce enhancements to speed up Groovy, JRuby, and Scala

-If I read between the lines what features are in HTML and any of them are supported by Chrome, then I think that HTML5+Chrome could easily turn into a gaming platform!

-There is no question that Groovy is the “next big thing” for Java. Get on board.

-A java developer could easily add Hadoop to his resume (and dollars to his pocket), by learning Hadoop with Cascading. Hadoop-worthy scale data sets are available for free from amazon:

Grails is really cool. I wish there was a hosting platform available that was anything close to Heroku for Rails. I think it is unlikely that we will hear any good Startup stories with Grails for that reason.

Sprite Club

UPDATE: Sprite Club’s code has been open-sourced :


I have been working on a Facebook application in my spare time for quite a while now and I think that it is finally interesting enough to start telling people about.

Sprite Club banner

The application is a game called Sprite Club; it is a place where you can judge kids (sprites) on the basis of cuteness, and upload a photo of your own sprite to have them compete for internet fame.  The application is accessible from

or from the friendly url:

The idea was conceived by my uncle, Matthew Deutch, while looking for an outlet to prove that his daughter is the cutest kid on the internet (We think she’s pretty great).  I am in the project to learn how to do Facebook and social media development.  The application is written in Rails and uses the Facebooker library to interface with Facebook.


Facebooker – converting from FBML to iFrame

In my free time I dabble in Ruby on Rails development and Facebook application development.   Last year I picked up Mike Mangino’s book, Developing Facebook Platform Applications with Rails, which gives great step-by-step instructions for creating a facebook FBML application using the facebooker gem.

FBML is not the only type of Facebook application, however.  There is also the iframe method, which Lead Facebook Engineer Charlie Cheever has been endorsing for a while.  His blog post gives a good comparison of the two methods: .  In addition to this, the Facebook developer roadmap ( ) shows that soon you will not be able to create new FBML applications, and is recommending that existing FBML applications be migrated to iframe.  The message is clear: time to switch to iframe people!

Unfortunately the tutorials performing this kind of switch are hard to come by.  Mike Mangino has created a new RoR gem named facebooker2 to support iframe and facebook connect development but documentation is limited.

This blog post includes some documentation on how to convert a facebooker FBML app to a facebooker2 iframe app.  Read Charlie Cheever’s blog post to understand the architectural differences between the FBML and iframe approach, especially the bit about server-side FBML.  More details here:

Remove the facebooker gem

Get Facebooker2 and mogli

$gem install facebooker2
$gem install mogli

Reccomended: unpack gems to /vendor (

Update environment.rb, set


Create an initializers/load_facebook_yaml.rb file to read from facebook.yml.  It should include a single line:


Inside your facebook.yml file add the following two parameters to each environment config:
app_id: 131336175362
secret: f7b15a925058e7be60f0a4d56294e938

Application controller

Rename application.rb to application_controller.rb. Add the following command to your application_controller.rb

Include Facebooker2::Rails::Controller

Comment out the set_current_user method

Paste in this method:

def current_user
if session[:user_id]
@current_user ||= User.find(session[:user_id])
elsif current_facebook_user and @current_user.nil?
@current_user = User.find_by_facebook_id(
session[:user_id] =

Add a ‘ensure_authenticated_to_facebook’ method to keep making sure that the user has a facebook session when accessing your site.  In my case my sessions/login page just displays “please login to facebook”, and since we’re in an iframe in the context of, there is a facebook login prompt displayed immediately above my page.

before_filter :ensure_authenticated_to_facebook
def ensure_authenticated_to_facebook
if current_user == nil "current user is nil"
redirect_to :controller=>'sessions', :action=>'login'

With Facebook Connect it is not required that your application runs inside the context of  Your login page could technically detect if it is running in and only display “please login”, otherwise if you are running it as a standalone page present the user with a facebook connect login button.

Enable oauth 2.0.  This will facebook cause to send a “signed_request” request parameter to your application once the user has authenticated.  Mogli will use this token to authenticate the user and create the current_facebook_user object.

Copy/Rename your .rhtml.erb files to .html.erb.  You will no longer have a canvas and will never render rhtml files again.

Remove  <%= facebook_messages %> in your erb files or replace them with <%= flash[:error]  %> or <%= flash[:error]  %>

Put the facebook connect javascript initializer in your layouts file so that it gets executed during each page load

<% fb_connect_async_js do %>
<%= yield :fb_connect%>
<% end %>

This should always be the first snippet of javascript to be executed as it will instantiate the FB global variable that the rest of your page will probably use.

Start going through your erb files and replace FBML code with <fb:serverFBML /> and their javascript SDK equivalents. This is pretty much the final step and will require the most effort. Use the documentation and test console found here:

-facebooker2 reference project:

-images for stream publisher popups need to be accessible by facebook servers.  You used to use a reverse tunnel so facebook could read them directly from your local server.  If you have images that fall into this category you may still need to use a reverse tunnel.

Facebook Javascript SDKs – Old vs. New

There are two ways to handle initializing your fb:serverFBML tags

1 – using the New Javascript SDK

(identified by the js library

2 – Using the Old Javascript SDK
which is what our friends at StackOverflow have done. I reference this thread because it kept coming up while I was solving this problem, and the solution they give is outdated.

(identified by the js library and xd_receiver.html)

Setting the Default Version of Java in Windows

You’re a java programmer on a Windows development environment.  You fire up the command prompt and run “java -version”.  It’s some JRE and its not even the version you want!  Eclipse is throwing a fit.  There’s no good way to figure out what path the “java.exe” you are executing lives in.

The most surefire way to solve this problem is take the java bin path (ex: C:\program files\Java\jdk1.6.0_07\bin)  you want and prepend it to your System level PATH environment variable, as highlighted below.  This will ensure that you are executing the java.exe from the expected java installation every time.

Vnc4server on Ubuntu 10.04

After several hours wasted trying to setup an automated vnc server on Ubuntu 10.04 I’ve finally got it working.  Here’s how:

-install vnc4server via package manager.  “sudo apt-get install vnc4server” should also work

execute “vnc4server” as my local user.  This prompts me to set a password and ~/.vnc directory for the first time.

modify ~/.vnc/xstartup to start gnome, and not startup x-window-manager.  My xstartup file now looks like this:

# Uncomment the following two lines for normal desktop:
# exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
#x-window-manager &
gnome-session &

# Uncomment the following two lines for normal desktop:# unset SESSION_MANAGER# exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresourcesxsetroot -solid greyvncconfig -iconic &x-terminal-emulator -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &#x-window-manager &gnome-session &

Next, I created a /etc/init.d/vnc4server file.  It look like this:

#!/bin/sh -e

# Provides:          vncserver
# Required-Start:    networking
# Default-Start:     S
# Default-Stop:      0 6


# The Username:Group that will run VNC
export USER=”chris” #<– my local user

# The display that VNC will use

# Color depth (between 8 and 32)

# The Desktop geometry to use.

# The name that the VNC Desktop will have.

OPTIONS=”-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}”
. /lib/lsb/init-functions

case “$1” in

log_action_begin_msg “Starting vncserver for user ‘${USER}’ on localhost:${DISPLAY}”
su ${USER} -c “/usr/bin/vnc4server ${OPTIONS}”

log_action_begin_msg “Stoping vncserver for user ‘${USER}’ on localhost:${DISPLAY}”
su ${USER} -c “/usr/bin/vnc4server -kill :${DISPLAY}”

$0 stop
$0 start


exit 0

Finally, I installed and ran “sysv-rc-conf” to make the vnc4server process start when the machine boots (runlevel 2,3,4,5)

after rebooting the machine you should be able to access it via vnc.  Try it locally with a vnc viewer by using host: localhost:1

JPA Annotation Cheatsheet

Whenever I need need help configuring JPA annotations I turn to google, and I always find it difficult to find a good cheatsheet.

Well here is my favorite JPA annotation cheatsheet.  Even though it says Oracle and Toplink it applies to any Spring/JPA/Hibernate technology stack:

Oh yeah, and here’s my tip on using cascades: Never use CascadeType.ALL!  Use MERGE, PERSIST, and maybe REMOVE if you want to cascade your deletes.  CascadeType.ALL will result in poor performance and unintended consequences.

Configuring Jetty, Maven, and Eclipse together with Hot Swap

For over a year I’ve been developing a Java webapp in Hibernate with maven and Jetty.  Recently I’ve figure out how to make them all play nice with each other.  For too long I had to restart my application server, which takes upwards of 45 seconds, for any code changes to make it to my development server.  This tutorial will show you how to setup Jetty in embedded mode, and using Eclipse, attach a debugger to enable True Hot Swap of code onto your Jetty server.

Environment Information:

JDK 1.5+
Eclipse 3.4.0
maven 2.0.10
m2eclipse 0.9.7 (maven plugin for eclipse)
Jetty 6.1.10

Continue reading “Configuring Jetty, Maven, and Eclipse together with Hot Swap”