Getting result of render() as a string in Play Framework

May 2nd, 2012

If you are using Groovy template with Play Framework 1.x, here is an easy way to get the result of render() function in the controller. You can use the output of the function in calling another WS or replying to an AJAX call with the HTML to be put in somewhere on the web page.

// create a map for arguments to be passed to the template
Map<String, Object> args = new HashMap<String, Object>();
args.put("params", params);   // including the params in case it has arguments to be used in the template
Template template = TemplateLoader.load("app/views/Admin/users.html");    // set this to your actual template path
String renderOutput = template.render(args);   // voila!

Java , , ,

Tired of iPhone hitting CPU usage to 100% on Ubuntu 10.04

December 29th, 2011

If you are one of those that plugs his iPhone or iPod Touch to the Ubuntu box and experiencing an overall slow down, try disabling the gvfs-afc-volume-monitor volume monitor. It will not affect the charging but definitely help keeping your nerve ;)

sudo chmod -x /lib/udev/iphone-set-info /usr/lib/gvfs/gvfs-afc-volume-monitor

Linux , , ,

Bing sitemaps are pending forever

December 9th, 2011

Recently I realized that Bing also has started to offer Sitemap functionality to let webmasters easily give a heads up to the search engine. Apparently Yahoo also has started to redirect webmasters to Bing Webmaster Tools after the transition to use Bing services. I got excited and submitted the whole list of my sitemaps via Bing Webmaster Tools, but.. After a week the statuses of all files were still “Pending”. Thinking that it should not take that long and googling around a while, this forum page says it all. There is a problem with Bing sitemap functionality and there is still no ETA for a fix. Come on Microsoft guys, it should not be that hard to overcome such a problem. Put the files in a queue, download’em, parse’em and use that valuable data. Is it that hard to implement a fix in the next release? Does anybody know what is the average release cycle duration at Microsoft?

Programming , , ,

Clash of the Classes: Using ActiveMQ with Play Framework

November 29th, 2011

Recently I have my hands on Play Framework and I am quite happy with all the features such as change the code and refresh the page attitude, stateless model for REST applications and easy method for unit and functional testing. In one of the projects I needed to access one of ActiveMQ instances I have, to this end I have included the required Java libraries (activemq-all-5.5.0.jar and javax.jms.jar), deployed the code to my test environment, clicked refresh.. and saw that pretty error page of Play Framework.

Oops: NoSuchMethodError
An unexpected error occured caused by exception NoSuchMethodError:

Checking the Play console output below, apparently the problem was that Play Framework is using slf4j library for logging and ActiveMQ 5.5.0 jar file includes a newer version of it as well.

SLF4J: The requested version 1.6 by your slf4j binding is not compatible with [1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9, 1.5.10, 1.5.11]
SLF4J: See for further details.

The solution here is to step back and use one of ActiveMQ 5.4.x libraries that do not include the SLF4J library in it. I have used activemq-all-5.4.1.jar in this case successfully. It would be great if ActiveMQ guys could strip SLF4J from the package and let the developers add the library externally.

Java , , ,

Viewbeat at Sencha Touch Spotlight

November 29th, 2011

My article about Sencha Touch usage within Viewbeat is published at Sencha Touch Spotlight blog. Thanks to the Sencha folks for creating such a powerful framework. You can read the article here.


So Long, and Thanks for All the Fish

October 6th, 2011

Today is a very sad day for all those who had the opportunity to use inventions of one of the most brilliant inventors, Steve Jobs. Slapped in the face while checking the news on my morning train ride, it is so heartbreaking to know that we won’t be able to see that man with turtleneck and a smile on his face on the stage again. You have made our lives easier by thinking ahead of most of the people, happier by creating thousands of new jobs and showed us that one can change the way people live by just hanging on and never giving up, even without so many resources.

I wish you find peace whereever you have gone, we all miss you.

Tech , ,

My first iPhone App has arrived at the AppStore

August 12th, 2011

This is my personal project which is meant to let people have a community where they can ask questions and get useful answers.

It is the result of an idea I had a few months ago after struggling to find a way to ask all my friends about something that I was planning to buy. But in the end I have given up because there was no medium that I can easily ask and get answers fast that has most basic privacy options and notification abilities. Although that cost me many sleepless nights, I believe that this will be useful to people having the same problems.

Here is the very first version, which may include some obscure bugs. In a few weeks I’ll be pushing a more robust release. It can be downloaded from AppStore, just search for “Viewbeat”. Enjoy!

Viewbeat – Simple way to ask questions and get useful answers

Viewbeat - Simple way to ask questions and get useful answers

iPhone , , , ,

Automatically starting Cassandra at boot time

August 6th, 2011

For those that installed Cassandra from the tar package found at Cassandra website, here is a very basic script to start it at boot time and stop it later if needed.

Create cassandra boot script in /etc/init.d and make it executable.

sudo nano /etc/init.d/cassandra
# chkconfig: - 80 45
# description: Starts and stops Cassandra
# update deamon path to point to the cassandra executable


start() {
        echo -n "Starting Cassandra... "
        $DEAMON -p /var/run/
        echo "OK"
        return 0

stop() {
        echo -n "Stopping Cassandra... "
        kill $(cat /var/run/
        echo "OK"
        return 0

case "$1" in
        echo $"Usage: $0 {start|stop|restart}"
        exit 1

exit $?
sudo chmod +x /etc/init.d/cassandra

For Ubuntu, add it to the startup by executing

sudo update-rc.d cassandra defaults

That’s it! Next time you bootup, it will be automatically and you can stop it by:

sudo /etc/init.d/cassandra stop

Cassandra , , ,

Get Mac OS X Lion Style Reverse Scrolling On Ubuntu

July 27th, 2011

Just switched to new Mac OS X Lion and adjusting to the reverse scrolling feature, I have started to have problems with the Ubuntu I am using at work. Although it is kind of a mind exercise, I realized that having 2 different scrolling directions at home and at work is not for me. So here is the thing that you should do to have Mac OS X Lion style scrolling at Ubuntu as well.

Just add this command to your startup (System -> Preferences -> Startup Apps):

xmodmap -e "pointer = 1 2 3 5 4"

Linux, MacOS , , ,

New back button of Gmail and its possible affects on advertisers

July 8th, 2011

Now Google has strengthened his hand with Google+ and switching the looks of all products it offers to new slick design, it also affected how Gmail looks. There are 2 new themes that make your Gmail be in conform with other Google products, but whether you use these new themes or not, there is a change in the interface which will make Adwords advertiser’s money go down the hole, at least for some time. The old classic “Back to inbox’ link is replaced with a back button with an arrow on it. It looks cool and it suits the whole other button set but there is a problem with it. After years of clicking on a link to go back to inbox, now it will take some time to adjust to the new back button, as I keep clicking on the Adwords ad above the back button at least twice a day. Here I send my apologies to that Tango studio in Amsterdam, Forbes, VectoneMobile, and many others…

Internet , ,