Monday, August 27, 2012

The not so obvious fact about tag libraries

I've came across this thing today and quite frankly I feel a little bit ashamed that I didn't know it yet. The concept of tag libraries is not new in the JSP world. It's just unusual to write tags because one needs to provide a tag library description file along with it and that increases the complexity of the solution (or so it is seen).

The nice thing about tag libraries is that they don't necessarily need a TLD file to drive them - a folder is more than enough for simple cases:

File /WEB-INF/tags/hello.tag
Hello, world! from a tag
File /index.jsp
<@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>

<tags:hello />
It's really that simple!

There's obviously more to it (how to pass the tag body, how to pass parameters to the tag) - maybe next time :)

Thursday, August 23, 2012

GGTS 3.0 - first dissapointment

For the longest time I've tried and tried to use the navigation aids in STS (now GGTS) to move around between the controller and view. This feature is there in VS since forever and the buttons to do the same in STS have been around on the toolbar for a long time now. Unfortunately they don't do much..

You can torture them all you want but the navigation from within a controller action like
class HomeController {
    def index = {
        [ message: "Hello, world!" ]
doesn't seem to bother those buttons much. Same for navigation from the view - or should I rather say it's the only "true teller in the bunch" as it stays inactive forever and for always...

I know, I know... I'm complaining again about new software and guys from SpringSource have done a tremendously good job and all that and I should stop yammering and congratulate them. But what should I do when the tooltip over the "T" icon says "Open the corresponding TagLib" and when I click on it while editing a controller it opens a "Create a new TagLib" wizard? Same thing with services and the "S" button. Guys, come on! Can't you at long last fix this disaster?

Anyways, I'll give it a try and let you know what I think about the functionality that actually works.

Wednesday, August 15, 2012

Gitorious in EC2

Previously I've written a lot about how tough it is to install Gitorious. By that time the script I provided was the only automated way of installing Gitorious (for free) on the Net. I needed that script to perform a test install of Gitorious and convince management that this software is the right way to go. Now that this goal has been achieved it's not maintained anymore - and it doesn't have to!

There's a new kid on the block from BitNami stable - the BitNami Gitorious stack.

I haven't seen it in action yet but it looks very promising:

  • 3 installation options (native installer, VMware machine, Amazon EC2)
  • the automated installer has all the dependencies
  • It's based on a newer version of Gitorious - from May 2012

I'm downloading it now - will tell you more about the quality of this release soon. It it'll pan out I'm going to give it a try in Amazon EC2 to see how it performs over there.

Have a nice day!

Monday, August 13, 2012

Removing stuff from embedded arrays in MongoDB

How to remove items from embedded list "items" by regular expression /item/ ???

  { _id: ObjectId("5024d352ef2ff4c4a103db5f") }, 
  { $pull: { items: { $regex: /item/ } } }

Do the same but on all documents in collection:

db.example.update({}, { $pull: { items: { $regex: /item/ } } }, false, true)

Oh I so wish it'd be in the official docs - I spent 2 days trying to figure it out!