Shorten links to be Twitter-friendly with j.mp

Any Twitter users out there will know that URLs and 140 characters don't really mix that well, especially if you actually want to talk about the link as well!  Typically you would use a URL shortening service such as the original tinyurl.com or one of the newer, shorter versions such as bit.ly.

Well there is a new kid on the block who's even shorter: j.mp

J.mp is another member of the bit.ly family just with two less letters, but it's going to be perfect for Twitter.  I use the bit.ly bookmarklet to generate my links but it appears that there is not a version for j.mp yet, so I created my own:

Drag this link to your browser toolbar to get started:    Shorten with j.mp

Technorati Tags: , , , ,

Summary of December's Manchester Spring User Group Meeting

The December Spring meeting was held on Tuesday 1st December at the same venue as previous meetings. Two talks were lined up: one on Grails by Adam Evans and one on Spring 3.0 by Rick Evans.

Guy Remond of Cake Solutions started the evening off with introductions and explained that the Spring User Group was going to be expanding to become the 'Open Source Central User Group' so as to attract a more diverse audience. He also discussed the Open Source Central website which has plans to become the 'Hub for successful Open Source Enterprise Application Development'. It's going to pull various blogs together into one central place as well as offering video and podcasts of open source technologies. We were also some of the first people to get a physical copy of the Open Source Journal, a 5,000-copy print run (sponsored by Hays IT).

Practical Grails Demonstration by Adam Evans of CTI

Adam started his presentation with a brief run through of what is Grails, what is Groovy and showed that Groovy 'can' be just standard Java code. Grails applications compile cleanly down to a WAR file so deployment in your favourite appserver is easy. It uses GSPs and Sitemesh for the view layer, GORM for the database layer and supports a plugin-based architecture allowing you to 'plugin' views, controllers, domain objects, sessions and scripts.

He then went on to demo building a Grails application on the fly using SpringSource Tool Suite (STS). Unfortunately Adam's laptop wasn't up to the job of running STS (basically Eclipse) and Powerpoint at the same time and so he had major 'not responding' issues. Despite these technical difficulties Adam battled on filling the gaps with details of Grails (Grails 1.2 supports annotated Spring beans) and had the foresight to have a slide-based version of the demo to hand (major kudos to Adam!)

Then he 'built' a demo application which uses the Twitter API to perform a search on whatever you type into the input box. An interesting point was that the Twitter results were returned in JSON and the GSP expression language allows you to parse that data as if it was a first-class object, doing things like tweet.username.

Adam has also kindly posted a copy of his slides to SlideShare.net.

Guy then stepped back in to thank the sponsors of the event: Cake Solutions, OpenCredo, Skills Matter, FDM Group, Hays IT.

Spring 3.0 :: Weapons for the war on Java complexity by Rick Evans of QFI

Rick has been working with Spring since 2004 and has delivered loads of training courses on it as well. He started his presentation with a humorous youtube clip of a mega-beast of a shotgun, and his theme was whether various Spring 3 features were potato guns or super shotguns...

He started off with a brief overview of the changes made in Spring 2.5 ('ease of use') and then moved on to the new things in Spring 3.0 - key points: embrace Java 5 and heavy use of annotations as 'declarations of intent'. Spring 3 introduces SPEL - the Spring Expression Language as the default expression language across all the modules (Webflow, Batch, etc.).

REST is nicely supported now with both server-side support in the form of additional annotations for controllers: @PathVariable & the enhanced @RequestMapping, and client-side with the use of RestTemplates. Rick also mentioned the use of HiddenHttpMethodFilter to ensure that your standard browser forms could correctly call the right type of REST operation, silently mapping POSTs to DELETEs if required.

There are some new annotations in the Controller world: @RequestParam now has a 'defaultValue' attribute and @CookieValue and @RequestHeader allow you to extract data from cookies and HTTP headers accordingly. Validation has been revisited with a smattering of new annotations to ensure objects are @NotNull, have @Max and @Min values, etc. This is all activated via a Validator - either javax.validation.Validator or the old-skool org.springframework.validation.Validator.

Rick's final words were to do with the fact that there is no 'all encompassing' spring.jar anymore, it's split up into it's component parts and you pull in what you want - if you are using Maven or Ivy then I suppose this isn't a problem, but how do you deal with it if not? He also said that loads of stuff had been deleted, cleaned up or deprecated which is always a good thing - no point carrying cruft around.

Rick has also kindly posted a copy of his slides to Box.net

Then it was over the road to The Bowling Green pub for a pint on Cake Solutions (cheers Cake!) and a catch up with some old colleagues and meet some new north west developers...

Technorati Tags: , , , , , ,

Don't miss the December Manchester Spring User Group on Tuesday 1st December

There was a little doubt recently if this event was going to take place as the main speaker had to pull out at the last minute.  We now have a new and excellent speaker Rick Evans talking about Spring 3.0 - Weapons for the War on Java Complexity".

Doors open at 6pm and the main keynote normally starts around 6:30 (a chance for coffee and a chat before hand).It's in the usual place, just don't forget to register if you plan on going!

Technorati Tags: , , , ,

Paste Email Plus - perfect for multiple text snippets in Firefox

I've found recently when commenting on various blogs that I want to add a little footer to the comment with my name and blog address. For one or two comments typing it out by hand is fine but after a while I decided to try and find an automated way to deal with this issue.

So I was looking for something that allows me to enter multiple lines of text and then very easily insert this text wherever I choose. Well I quickly found the perfect solution - a Firefox add-on called Paste Email Plus by Chuck Baker.

You simply open the Paste Email Plus options window, enter a 'Label' to help identify this text, then enter the multi-line text in the 'Pastetext' field and click 'Save changes':




You are now set up and ready to start pasting that text snippet, in any area where you would normally type text just right-click and select 'Paste Email Plus' (below 'Paste' on my system) and then choose your labelled snippet:




You will now see your text chunk pasted into the text area wherever your cursor was at the time of the right-click!

Technorati Tags: , ,

JavaScript splits & matches with regular expressions (regex)

I had been developing some client-side validation code in jQuery/JavaScript and using Firefox (and the excellent Firebug) to test and debug it. I was then asked to ensure that it worked in IE6 & IE7 and that's when the problems started.

Apart from the usual "which file does that line number equate to, and why does it not tie up?" issues I found that IE doesn't like taking a regular expression as it's parameter to the JavaScript split function. Firefox will happily accept this and works fine but IE doesn't. After some searching it appears that Firefox might be the odd one out and that it's non-standard to pass in a regex.

So what do you do if you want to split up a string based on a regular expression or rather a rule that can't be simply expressed in the way that the split function wants it? Wouldn't it be nice if you could ask if a string matches a regex but then use certain matched bits of the string in your next few lines of code?

Well you can, simply use the match method, surrounding the bits of the regex that you want to use later in parenthesis '(' and ')' and then you can use the global JavaScript variable RegEx to pull them out.

So if 1234-ABC is your text, and you want the numbers as one part and the characters as another then you would use this regular expression to match on: ^([0-9]*)-([A-Z]*)$. You can then get hold of the matched numbers bit with RegEx.$1 and the letters bit with RegEx.$2.

var productCode = "1234-ABC";
productCode.match(/^([0-9]*)-([A-Z]*)$/);
var numbers = RegEx.$1;
var letters = RegEx.$2;
Technorati Tags: , ,

How to disable the auto-completion 'bell' in Cygwin (using RXVT)

If you have ever hit TAB a few times in bash (via RXVT) you will probably be greeted with the loudest 'bell' your PC can muster. After a while this gets pretty annoying so here's how to disable it if you are using RXVT inside Cygwin (this might work for other Cygwin terminals, I've just not checked)

Navigate to your home directory (normally just by typing cd and either edit or create a file called .inputrc

Add the following lines to the .inputrc file:

# Disable the annoying bell
set bell-style none
Save the file, close the terminal and reopen - you should now be bell-less!

Technorati Tags: , ,

How to get Scala working with the RXVT terminal on Cygwin

Out of the box Scala support Cygwin, but this is only with the Windows command prompt-based bash terminal. If you have opted for the more UNIX-like terminal of RXVT then you will find that although the interactive Scala interpreter runs, you can't get it to do anything!

This has been raised as a bug (Ticket #2097) against the Scala project and graehl even posted a patch to changed the generation of the scala runtime scripts.  As my Scala install was based on the downloaded Windows binaries (scala-2.7.6.final.zip) I couldn't directly use this patch, but I could examine it to see what graehl's fix was.

It appears that the key bit was to add the following Java command line option to the java statement that starts the scala interactive interpreter:

-Djline.terminal=jline.UnixTerminal
So the last line of my bin/scala file is:
exec "${JAVACMD:=java}" $JAVA_OPTS -cp "$TOOL_CLASSPATH" -Dscala.home="$SCALA_HOME" -Denv.classpath="$CLASSPATH" -Denv.emacs="$EMACS" -Djline.terminal=jline.UnixTerminal scala.tools.nsc.MainGenericRunner  "$@"
This appears to work, my interactive environment is now interactive!

Technorati Tags: , , ,

Tommy Emmanuel being VERY creative with an acoustic guitar and some clever delay

I don't often post about guitar stuff as I really want to keep this blog focused on the tech side of my life but I couldn't help but pass this YouTube link on:

Delay (& Creative Uses for It)

I started to watch it and was soon completely captivated by it, hope you like it too!

Technorati Tags: , ,