Friday, 28 December 2012

play2 deploy and config on cloudbees

I did some work recently to update a few web apps from play 1.2.3 to play 2. Some of them are running on heroku and others are on cloudbees.
One of the things I like about heroku is the Procfile that allows you to overwrite the play application.conf properties. But hold on, you can do the same on cloudbees!

Install the bees sdk and try running the following command:

bees config:list [accountname]/[appname]

you should see a list of all the configuration options for your application. Now, lets tweak them a little.
Let's set the runtime db info :

bees config:set -a myaccount/myapp db.default.driver=com.mysql.jdbc.Driver \
db.default.user=mydbuser \
db.default.password=mydbuserpass \

Now you can leave your local machine settings in the application.conf file and still pick up the right db at runtime when deployed on cloudbees, isn't that great?

Another thing you might want to change is the smtp settings for your production environment... not problem
bees config:set -a myaccount/myapp smtp.mock=false

This will tell your play2 app to use the other smtp configuration (host, user/pass)
Also if you want to change some of the runtime options (like the java version) use the -R prefix

bees config:set -a myaccount/myapp -Rjava_version=1.7

Now combine that with the play2 sbt plugin for deploying your app and you have a complete suite of tools to get you going!

Friday, 7 December 2012

Escape String literals in eclipse

If you've been using xml literals in your (hopefully only testing) code then you've gone through the pain of escaping the double quotes of all the attributes.

Scala has a great way to handle it using triple - double quotes. In scala this would work fine

val xml = """ <user type="simple"/> """

but if you are stuck with java, then eclipse can escape the string for you..

Go to Window>Preference>Java>Editor>Typing and check the “Escape text when pasting into a string literal

Check this article for some nice screenshots

Wednesday, 5 December 2012

back in town

It's been a long time since my last post, but I have a good excuse! I got married to a beautiful woman and I've been off for some time. I managed to see some foreign countries and enjoy a bit of time off.

Also I moved to London!

I enjoy living here, so far so good. There is so much going on. I'm attending as many tech meetups as I possibly can, making the most out of it. The scala group here is great, I went to a few meetups and coding dojos. I also seem to end up in skillsmatter quite often, they have great talks.

So, that being said I am recharged and ready to get back to work!
I'm planning to write some posts about software quality, concurrency and performance on the JVM.

So, don't miss out, stay tuned and follow me on twitter to get the latest updates!