So I’ve started to use the totally awesome Frank, a quick prototyping tool for static websites. I’m working with it now to quickly prototype my own websites with useful templating engines such as HAML and SASS. Trust me, it makes your life somewhat simpler.

One of the features Frank has is functions for quickly creating lorem ipsum text and placeholder images from placehold.it. The placeholder image URLs can be retrieved by calling the lorem.image(…) function. Here is one image from placehold.it that is 300 x 150 px large, which is generated by lorem.image('300x150'):

Placehold.it placeholder 350x150

Now that is great and all but there is a similar placeholder service that displays much more awesome kitty pictures. Placekitten can place kitty pictures as placeholders. The service works similarly to placehold.it but the url looks a bit different. To get a 300 x 150 px picture you use the url, http://placekitten.com/300/150, which will give you the following picture:

Place Kitten Placeholder 300x150

So how do we add a function that will do the same thing as Frank’s lorem.image function but produces kitten placeholders instead? Don’t fret; Frank’s got it all covered. Frank provides a Helper class for you to add your own helper functions. In there we could write a helper function that generates the kitty picture placeholders that you want. It’s simple Ruby code that you put in the FrankHelpers, in project_root/helpers.rb, written as succinctly as I could:

def kitty(width, height, isGray = true)
    g = isGray ? "g/" : ""
    "http://placekitten.com/#{g}#{width}/#{height}"
end

This code works by calling kitty(300,150,false) to get the colored kitty picture as placed above. For a gray scaled kitty picture you can remove the last parameter, kitty(300,150). In order for you to add an image in HAML you do it like this:

    %img{:src=>kitty(300,150), :width=>'300', :height=>'150'}

Bam; and there you have it! I’ll post more helpers as soon as I can think of any more useful ones.

So people at work kept telling me, in autumn 2009, that I should use Netbeans instead of Eclipse. At first I thought it wouldn’t be such big deal if I switched over. But as I had to go over to php programming Eclipse was clearly lacking in that department. This is how I first got to work with Netbeans in february.

Netbeans php package is everything you’d want it to be. It has nice navigation and refactoring tools that I clearly need and there is a Eclipse keymap which made my life easier by not relearning the shortcut keys that I need. I’m somehow dumbfounded why Eclipse doesn’t have this support yet. But there was nothing mindblowing with this until I started to use Netbeans for Java programming; and that is how my mind was blown.

Netbeans 6.8 has several features that makes Eclipse look like it is from the Stone Age. Let me iterate them for you:

Netbeans has a GUI builder

Netbeans has a fully functional GUI Swing builder… Might I point out it is a FREE GUI builder? Eclipse has an unfinished GUI builder and several commercial ones. But I like Netbeans one because it is FREE and it WORKS. However, I do like to work on my own Swing widgets so it didn’t blow my mind as much as the following feature.

Netbeans has some wickedly good default templates

Netbeans has AWESOME default templates. What I noticed first was that it creates logging for you when you autogenerate a try-catch thingy instead of Eclipse’s use of output:

try {
    // do something that'll cause the exception
} catch (IOException ex) {
    Logger.getLogger(MyClass.class.getName()).log(Level.SEVERE, null, ex);
}

Secondly, the gui builder creates localized strings. Let me repeat that, IT CREATES LOCALIZED STRINGS FOR YOU BY DEFAULT.

Thirdly the project layout uses a better convention than what Eclipse does. It creates test projects for you and put the localized resources where you’d expect them to be. Just plain AWESOME! This is something you had to do manually in Eclipse.

In the end…

Now you’d think this would be a sleazy sales pitch for Netbeans. But then again, I’m just an ordinary programmer. There are some things Netbeans still hasn’t the upper hand on:

  • As I can see it is still lacking some of the Java refactoring tools that Eclipse has.
  • Plug-ins for Netbeans are seemingly poorly maintained.

…but that won’t stop me from using Netbeans now. It’s interesting to see that Eclipse, once such a great tool for several years, really needs to ramp things up.

Follow

Get every new post delivered to your Inbox.