Replacement Form Item For Grails to-Many Relationships

By default, grails just gives users a multi-select box when dealing with to-Many relationships in views. It’s damn ugly and incredibly ineffective if an end user is dealing with tons of things to select from. After tolerating it for a while I completely gave up and decided to write my own replacement for it using autocomplete from the richui plugin and prototype which is included with grails.

So, the first thing you’re going to want to do is install the richui plugin, you can do this by running:

grails install-plugin richui

In the directory of your project.

Now, for the example that I’m going to use, there are two classes, Author and Book, an author hasMany Books. So that’s what we’re going to work with. I wrote a little TagLib that you can use, so I’m not going to explain that code, but I’ll show it to you below.

So basically, you need to write a controller for the autoComplete which you can find here, and you use my tag lib, below: Continue reading

Posted in Howto/Tutorial, Programming, Scripts | Tagged , , , , , , , | Leave a comment

sventon – An Alternative to FishEye and ViewVC

I was recently looking for an alternative to ViewVC for my tomcat application server and I thought I was in luck with FishEye by Atlassian, but it wasn’t right for the job because it was proprietary. So, looking for an open source solution, I came across sventon. It’s loaded with features and relatively easy to configure which is great. If you’re looking for a source control browser this might be a good bet for you. Next up, I need to find a Java EE system monitor I can run on tomcat.

Posted in Rants, Reviews | Tagged , , , , , , , , , | Leave a comment

Google Caffeine Is AMAZING.

Google recently rolled out caffeine, their new search index which allows finding of new content more efficiently. I figured it wouldn’t be that noticeable a change, but I was dead wrong. After making a post on LinuxQuestions.org I began to search for other posts online about my topic and what did I find? Within two minutes of posting, my new post was at the top of google. I did another search, for a blog post I had posted that morning and there it was, again, right at the top of the search. According to google, this is a step by them to keep up with the evolution of the web and the rapidly expanding content. I think this is a huge step in the right direction because it’s not only keeping pace with the speed of the web, but it gives chances to content of all areas, regardless of the ranking of the site it’s coming from. As a user this benefits you because when it comes to finding something, you are presented with the newest, most up-to-date, and most relevant information. If you’d like to read more about this check it out on google’s blog.

Posted in Other, Rants | Tagged , , , , , , , | Leave a comment

Awesome WM Screenshot Hot Key/Shortcut in Linux

So I recently had the need for quick screenshots, at first I was thinking, a tray icon would be the best solution for my problem, but then I realized it doesn’t get better than a key press, a system wide shortcut. So what did I do? I looked to my window manager for answers, in this case Awesome WM.

First I needed a screenshot program, preferably one that could take shots from the command line. Most people use scrot, but since I had imagemagick installed, I decided to go with “import” a built-in part of imagemagick. Now, the other thing I thought about was that I needed to create a unique identifier when saving the screenshots, so if I take multiple, they don’t overwrite each other. The best way to do this would be to append the UNIX timestamp to the filename so that they all have unique filenames (this assumes you take >1 shot per second).

Now that that’s all figured out, we just have to write the functionality, so first, let’s work out the screenshot command. The parameter for “import” we’ll be needing is, -window, for the window to take the screenshot of, in this case the root window. So our command would look like this:

import -window root /home/hkothari/pictures/screens/shot-$TIME.jpg

Since Awesome is written in LUA, we’ll need to use the “os.time()” function to fetch the time, and to add the key we’re going to use awful.key, adding it in the globalkeys variable, below the comment “– Standard Programs”. So go ahead and open your “.config/awesome/rc.lua” and add the following:

-- Standard Programs
awful.key({ }, "F10", function () awful.util.spawn("import -window root /home/hkothari/pictures/screens/pic-" .. os.time() .. ".jpg") end),

Continue reading

Posted in Howto/Tutorial, Programming | Tagged , , , , , , , , | Leave a comment

No-Eclipse Android Hello World

Despite my earlier post on IDE’s I’m not really a fan of them, they’re far too bulky and complex for me, so it shouldn’t come to surprise you when I say that I got to playing with Android today and I refused to use the Eclipse of Netbeans plugin for it. So for all of you who are with me and against IDE’s, I’ll show you how it’s done. Before we start, make sure you have the android sdk installed from your local repository or from the google website.

So, first thing’s first, let’s create a directory for our project, so run:

mkdir HelloAndroid
cd HelloAndroid

Now that we’re in the project directory, let’s run the following command to create our project:

android create project \
--name HelloAndroid \
--target 2 \
--package com.android.helloandroid \
--path ./ \
--activity HelloAndroid

Continue reading

Posted in Howto/Tutorial, Programming | Tagged , , , , , , , , , , , , , , | Leave a comment