RSS Feed Subscribe to RSS Feed


Using Butler shortcuts to enter commonly used text

Is there a piece of text that you find yourself typing again and again? Want a keyboard shortcut to enter it? For example, pressing Alt-E to enter your email address anywhere.

The solution I use is Butler. It is an extremely versatile tool.

  • With Butler running, go to Configuration
  • Right click on Hidden Items
  • Smart Item -> Text
  • Under Triggers, specify your ‘Hot Key’ keyboard shortcut
  • Under Text, specify your frequently entered text e.g. email address

Done! The next time you press Alt-E anywhere, your email address will show up.


  • You are probably wise to choose a more obscure shortcut the Alt-E to avoid clashes with other apps, but the principle remains.
  • I use LastPass to automate filling in entire forms (name, address, email), but the approach I describe here can be used anywhere (in a document, IM window, whatever).


Tags: , , ,

alternative to tail -f that allows scrolling: less +F

You can use less +F to start less in its “forward forever” mode. In this mode, less will behave like tail -f, ignoring the ends of files and providing a steady stream of text.

When you want to scroll, press Ctrl-c. To re-enter forward forever mode, press F.


Tags: , , ,

Rest and Microservices talk at the Las Vegas .Net Group

Thanks to Richard Rosenheim for inviting me to talk on REST and Microservice at the Las Vegas .Net Group today.

If you came along, thanks for attending!

You can find my slides here.

You can also check out my blog posts that the talk is based on:

Tags: , , , , , , , ,


sed (stream editor) is an simple but incredibly versatile command line tool that parses and transforms text. It is line-oriented in that it reads the text line by line, transforms it, and outputs the result.

For example, this sed command would replace all occurrences of the text “white” with “black”:

sed s/white/black/g

sed reads text on a line by line basis and performs an operation on it, usually extracting or replacing text snippets. In this case, the s prefix means substitute, and the g suffix means global. Other example usages include:


Tags: , , ,


“find” is a unix command-line tool for locating files (and directories). The results can be displayed, passed to another command (e.g. grep, ls etc, see more below), or the find command has its own limited set of actions that can be performed too, such as delete.

Find allows you to specify all manner of search criteria such as name, location, size, permissions, modify date etc. Using regex expressions with those criteria makes it more flexible still.

See the full find manual here.


Tags: , , , ,


I think of awk as a tool for searching, manipulating and reporting on text files, but it is in fact an entire programming language. Its basic function is to search files for lines that contain certain patterns, and perform specified actions on that line.

The name awk comes simply from the initials of its designers Aho, Weinberger and Kernighan.

The basic format of an awk command is:

awk pattern { action } file

Every line in ‘file’ matching the ‘pattern’ will have the ‘action’ performed.  Either the pattern or action are optional, but not both.
No pattern means every line is actioned.
No action defaults to print.


Tags: , , , ,


“grep” is a unix command line tool to search a file (or files) for lines containing a match to the given pattern (often a regular expression). Its name comes from the ed command g/re/p for globally search a regular expression and print (1). See the grep manual.

The basic syntax is:

grep [options] pattern [files]


grep -rl --include=*.java "MySearchString" .


Tags: , , ,

An intro to Microservices and REST: SoCal Code Camp 2014

If you came along to my session at the SoCal Code Camp, thanks for attending! Any feedback always appreciated.

You can find the slides on slideshare.

You can also check out my blog posts that the talk is based on:




Tags: , , , , , , , , , ,

An introduction to REST

REST, or Representational State Transfer is an architectural style, or more simply, a set of constraints.

We will look at the constraints REST imposes for web apps, but some highlights are:

  • Uniform interfaces: all resources are identified by URIs (think: links)
  • It relies on a stateless, client-server, cacheable communications protocol (think: HTTP).
  • Interaction with resources is via a set of standard methods (think: HTTP verbs)


REST can be viewed as a lightweight alternative to mechanisms like RPC (Remote Procedure Calls) and Web Services protocols (SOAP, WSDL, etc)., but it is much more than that too! It is not an exaggeration to say that REST has been used to guide the design and development of the architecture for the modern Web.

The term REST was defined in 2000 by Roy Fielding in his doctoral dissertation at UC Irvine.


Tags: , , , , ,

Getting rid of IntelliJ warning: Value ‘yourVariable’ is always ‘null’

IntelliJ was giving me a warning message like this:

Value ‘yourVariable’ is always ‘null’

I often set values to be null for tests (e.g. checking a method can deal with a null parameter), so I wanted to disable this warning.

To do so, deselect the following:

Preferences -> Editor -> Inspections -> Probable bugs -> Constant conditions and exceptions -> Warn when reading a value guaranteed to be constant.

Or you can setup custom handling for tests (e.g. weak warnings) under Severity by Scope.

(Based on IntelliJ 14)


AssertJ > Fest > Hamcrest

I have previously blogged about Hamcrest, and using its assertThat methods in preference to JUnit’s Assert.

However, I quickly after discovered FEST Assertions, and happily switched to it. It provides the same improved test readability and failure messages as Hamcrest, but has the extra benefit of enabling IDE auto completion, rather than having to search through package and class docs to find the right matcher.

Unfortunately, Fest seems to not longer be actively developed. The last stable release of the 1.x branch, 1.4, was released way back in 2011, and the new 2.x branch never made it to a stable release and hasn’t had a commit since June 2013.

Enter AssertJ


Tags: , , , ,


A microservice is a small, focused piece of software that can be developed, deployed and upgraded independently. Commonly, it exposes functionality via a synchronous protocol such as HTTP/REST.

That is my understanding of microservices, at least. There is no hard definition of what they are, but they currently seem to be the cool kid on the block, attracting increasing attention and becoming a mainstream approach to avoiding the problems often associated with monolithic architectures. Like any architectural solution, they are not without their downsides too, such as increased deployment and monitoring complexity. This post will have a look at some of the common characteristics of microservices and contrast them with monolithic architectures.


Tags: , ,

Keyboard shortcuts in Mac finder

Following on from my IntelliJ shortcuts, here are some useful Mac finder shortcuts…


Tags: , , ,

Keyboard shortcuts in IntelliJ

I attended a talk by Hadi Hariri at JavaOne last week. He introduced a whole bunch of IntelliJ keyboard shortcuts I was not aware of. Very useful talk. I have listed some of the most useful ones below. Or see the official reference card.


Tags: ,

Web frameworks

There is no right answer to the question of what is the best Java web framework. Still I end up asking it to myself every time a new project crops up.  I did a post on a related talk I saw at JavaOne last year, which provoked a lot of debate and some really interesting responses. More recently, this report from Zero Turnaround is useful and this comparison from Matt Raible is also well written.

I have also been swayed in the past by the Thoughtworks technology radar in which component based frameworks (which, I think, in the Java world includes JSF, Wicket and Tapestry) get a thumbs down e.g. see the May 2013 radar.  GWT has also in the past (see July 2011 radar) been singled out as something to avoid.  Presumably Vaadin falls in to the same ‘hold’ category.  Full disclosure, I’ve had limited exposure to these types of frameworks personally though.

My own preference remains Spring MVC. It is relatively easy to setup (especially with Spring Boot), provides decent testing support, and obviously integrates well with the rest of the Spring ecosystem.  I am admittedly biased due to already knowing Spring core, but so be it.

My recent, albeit limited, experience with Struts2 is that I have been fairly pleasantly surprised.  It wasn’t as bad I was expecting! The Action classes, which are instantiated for each request, and hence threadsafe, are fairly easy to use and test.  I am not so fond of the xml mappings and the variable passing that gets done there though.  It seems kind of clunky, although there may be a better way I am not aware off.

Still, I am not likely to start using Struts by choice on my own projects anytime soon. Spring MVC remains my go-to web framework.




Tags: , , ,