Happy Birthday to Dreamhost!

Best wishes to DreamHost on it’s birthday. The hosting provider recently turned into 16 years old. Its impressive! Personally I have been using DreamHost (DH) for 9 months. Performance of the servers are good overall, although it was down once for few hours. DH has quite a lot interesting features for it’s shared hosting. Few outstanding features in my view would be SSH access, Easy integration of Cloud Front. There are also few features I wish DH would had, like PostgreSQL, MongoDB, easy deploy for python. DH is costly compared to average hosting providers; however I guess it’s worth it.

Wish DH would keep their standard high on its coming years and try to reduce the overall cost of shared hosting.

A bookmarklet to extract photos from facebook album

Few days back I wanted to download all photos of a facebook album. Unfortunately that album was a personal public album can’t easily use facebook’s graph api to extract image links. In web when all else fails you still can do some magic with javascript. 🙂

I used the following bookmarklet to extract image links of thumbnails. It opens a separate window where it prints all the links, next use wget or any other downloading software to download images.

javascript:x=document.getElementsByClassName('uiMediaThumbImg');w=window.open('','','width=1024,height=768');for(i=0;i<x.length;i++){w.document.write(x.item(i).getAttribute('style').replace(');','').replace('background-image: url(', '').replace('p206x206/',''));w.document.write("<br/>");}w.focus();

wget command to download images

wget --no-check-certificate -i files.txt

Be aware: Quite a few assumptions are made!

Sitemesh 2 with Spring MVC 3 – multiple layout for multiple controller

Recently I had bitter experience setting up different layout in sitemesh for different controller of Spring. In general as a developer my expectation is for different controller I setup different url and for each url I add a decorator with unique name and different layout page.

For instance, I have two controllers – AdminController and UserController as follows.

public class AdminController {

    @RequestMapping(value = "/index", method = RequestMethod.GET)
    public String index() {
        return "admin/index";
public class UserController {

    @RequestMapping(value = "/index", method = RequestMethod.GET)
    public String index() {
        return "user/index";

So, url project/admin/index – points to admin controller’s index page
and url project/user/index points to user controller’s index page.

Now I want to decorate two urls with two different sitemesh layout. decorator.xml looks like –

<?xml version="1.0" encoding="UTF-8"?>
<decorators defaultdir="/WEB-INF/layouts">
    <decorator name="admin" page="admin.jsp">

    <decorator name="user" page="user.jsp">

However, it wasn’t behaving as I expected. I wasted a lot of time trying different combination in pattern like /projects/admin*, */admin/* etc.
Continue reading

Double Brace Initialization in Java

It is a subtle use of two basic java conceptions. First, we can create an anonymous inner class in time of class instantiation, syntax for which is usual

new Person(){};

Remember we are not exactly creating an object of Person rather we are creating an object of anonyms subclass.

Then we can define any number of initializer block in a class [Official Doc]. Syntax for that is

class Person {
        System.out.println("In an initializer block");

Bingo! Lets combine them both we get the double brace initialization

new Person(){{
    //do anything with this subclass of person

Continue reading

Bookmarklet Link Extractor

For a while I was wondering how could I write a button like google bookmark. Few days ago I came to know this technology’s name is bookmarklet. The word bookmarklet came from bookmark + applet, is just a bookmark having a javascript function in its URL. Javascript function in URL is possible, as modern browser supports javascript: prefix like http:, ftp:, or https:. It offers a lot of advanced feature in browsing. Wikipedia have good details, take a look, BOOKMARKLET on Wikipedia.

Then i gave a try to write one. this typical bookmarklet firstly ask for few predefined options then extract all the link of matching types. And options are optimized for google filetype : *** search result.

To use copy following lines and then create a bookmark with this text in url. Continue reading

Epiphany: Smart Bookmark (Address Bar as Search Bar)

For long days I was using FireFox, was very happy with this browser but only problem it is a very resource hungry browser. In some case it just crashes, probably because I add lot’s of add-ons. I was bit desperate to find a fast browser at least with search bars like in FireFox. As a result download near about 9 to 10 browsers. But got the solution in Epiphany.

Epiphany is very light weight browser, built on Gecko engine, never takes time to start. No customization supported by default. There is only one address bar, no default search bar. But the interesting point is this address bar could be used as the replacement of FireFox’s search bar. Continue reading