GGTS: Clean up Grails 2.0 output

GGTS logoHave you ever had in Groovy/Grails Tool Suite (GGTS) that console output, by a running Grails application, which is exactly the same as the previous output, just isn’t displayed?

This can often be seen with println statements for debug-purposes e.g. in a Controller, which you think should output some line to the console every time, but simply doesn’t.

class TestController {
	def index() { 
		println "index called"
	}
}

When http://localhost:8080/test/test/index is invoked repeatedly in the browser, you just keep seeing only the first occurence.

....index called

When the same message repeatedly is sent to the console a certain convenience feature of GGTS swallows some output – if it looks the same. It has to do with the – since Grails 2.0 introduced – ANSI codes to make some output to the console coloured or re-appear on the same line.

Kris de Volder gives a nice example in JIRA issue STS-3499 about how multiple lines such as

Resolving Dependencies.
Resolving Dependencies..
Resolving Dependencies...
Resolving Dependencies....

are supposed to ‘rewrite over themselves’ on ANSI-supported consoles, so you’d only see

Resolving Dependencies...<increasing periods>

on the same line.

Output in the GGTS non-ANSI-enabled console is stripped from these codes – which would result in additional output which some people find unpleasant. So GGTS uses a workaround – which is enabled by default – and strips the beginning of the output which matches previous output and only print the remainder.

So if you were wondering why

class BootStrap {
	def init = { servletContext ->
		['A', 'B', 'B'].each { println it }
	}
}

would only print

|Running Grails application
A
B
|Server running. Browse to http://localhost:8080/test

instead of

|Running Grails application
A
B
B
|Server running. Browse to http://localhost:8080/test

you know now this is not a bug 🙂

You have to disable the option ‘Clean Grails 2.0 output‘ in the GGTS preferences under Groovy > Grails > Grails Launch to prevent this swallowing-behaviour.

Now your output appears in GGTS when you want it to appear 🙂

Starting a video blog: Grails in the First8Friday series

I recently recorded the first Grails video in my company’s newest video-blog: the First8Friday-series.

A videoblog?

We already wrote “regular” blog articles, but sometimes you’ve got to try different things as a company, so why not a video blog — for now in Dutch only. Since we know Java, the first few episodes are planned to be about Grails, one of the more powerful, full-stack web application frameworks I’d love to use.

This opening episode shows how easy it is to create a CRUD application for managing spaceships using the scaffolding ability of the framework. It’s pretty low-level to begin with, so Grails-beginners can see what Grails can do for them.

Creating a video blog

For the first time we didn’t want to set the bar too high too handle. Even though it’s only a few minutes long, it cost quite some time to produce! Getting the content as if one was writing a regular blog post with code snippets and images was the easy part 🙂

The bulk of the time was taken by a few things.

The script!

It’s not just like a blog post, it’s like a movie. You have to have script or a story-board. Going from just “content” to a story to tell is quite different: figuring out how to start, what’s in the middle and how to end. When should I be talking to the viewer on screen and when would a voice-over suffice?

Some parts were still images or screen casts I had to record before or afterwards on my laptop, where I not only had to deal with recording the actual action (command-line operations, viewing/editing of some code in the editor), but also revising the story itself as I was making image snapshots and screen captures. Why doesn’t have GGTS (or Eclipse) a presentation-mode, is a regular text-editor with syntax-highlighting maybe better? Why introducing all kinds of fluff in examples when it’s not about thát fluff.

ScriptImage: indiegogo.com

The green screen

The hardware, such as lights, camera and microphone, was easily acquired, but then using it is another story.

The lighting was initially flawed, unwanted shadows, distance between myself and the camera vs the microphone, positioning of myself (somewhat right from centre, visible from the waist up) etc.

The Green Screen at First8Image: The Green Screen at First8

The spoken lines of text

Re-runs of the same introduction and paragraphs with different pronunciations, rhythm, etc. What seems like a well-crafted sentence on paper, is a real tongue twister on camera 🙂

It also doesn’t look great if a sentence takes 1 minute to complete, because the version on paper reads nice and poetic like that, but you can’t memorise it completely without an auto-cue. So yes, long lines without an auto-cue is hard (for any non-actor, like me), and the video-editor-person can’t keep trying to fade me out and in real quickly whenever I had to look sideways to my speaker notes.

The first-time technicalities

Seems that my screencasts were recorded by default as .avi files encodes as H264 and MP3 audio. Reviewing my video snippets with the media player caused no worries, but somehow integrating these in Adobe Premiere in the real production – you know, in the green part of the green screen – caused either a black edge, or flickering pixels, or, or… Since we couldn’t figure out all the causes (or even more, solutions), even after playing with some interlace-settings, I re-recorded screencasts as MP4 which could be handled more easily.

Better figured this out before recording anything at all 🙂

Suffice to say, producing the real thing and integrating a kinds of screenshots, screencasts and other Powerpoint-like slides I could think of, made my video-producer also need to Google for a quite a few quirks and “features” of the his video-editing software himself.

All kinds of videos

Even though it seems we’ve encountered nothing but hardship by the looks of it, it’s been quite a fun experience and a lot of these things can be categorised as first-time start-up issues. While we’re busy now with video’s 2 and beyond, we’ve already gathered some valuable insights of things to do differently.

If you’re Dutch you can actually understand what’s going on, so if you haven’t done so, head over to First8Friday edition 1 about Grails on the company blog.

I welcome any comments or feedback or just any thoughts on video blogs (or regular screencasts) you might have seen, create or use in your daily life.