Monthly Archives: August 2011

LaTeX: coloured boxes with rounded edges

At the moment, I spend a fair amount of time documenting process, code, instructions, whatever; all in LaTeX. I love it.

At some point vanity seeps in. I like to tweak the visual elements here-and-there in order to have a more professional and visually appealing document.

In this particular instance I had exhausted my \subsubparagraphs and having played with various alternatives I decided I wanted a coloured box: much like you see in books for “tip” sections or asides. So I searched and searched the web and it transpires that the best route to follow is through the murky, uncharted (at least for me) depths of tikz! Thankfully it wasn’t that difficult, and I now get a lovely rounded, grey box!

Make sure you’ve got a \usepackage{tikz} and bear in mind this is using \documentclass{article}. Your mileage may vary!


begin{tikzpicture}
\node[fill=gray,rounded corners=5pt,text width=6in] {
This is a "tip" box or similar, that gets nice rounded edges; like you'd see in a real book!
};
\end{tikzpicture}

Ant TODO gets some love

Updated: I’ve added another item to the implemented features below…

Yonks ago I spent an afternoon hacking together a TODO task for Apache Ant; the result of which was Ant TODO.

Now, I hadn’t touched it in a while until a user emailed me asking for some help and some nifty new features. Having returned home from a weekend away with a few hours spare I decided to implement the following:

  1. allow for setting of results to an Ant property, instead of to a file or so-on
  2. support a custom delimiter string for each item
  3. call Ant TODO after JAR’ing Ant TODO (chicken, meet egg)
  4. numerous housekeeping tasks, such as a little refactoring and better test data

You can download the latest version if you like. Feel free to contribute too.

Apache Ant & FTP timeout

Having spent a considerable amount of time hacking a new temporary build system together at my new workplace, we were nearing the end of our initial aim. One feature of the development processes they run here is the continuous deployment to the test servers, which is a very good place to be. Our overall goal was to decouple ourselves from the wider development team to allow for more control and flexibility over our build tools and processes.

We’re moving from Visual Build Professional to a more industry-recognisable stack: Apache Ant, Jenkins/Hudson and deployment included within the Ant build scripts via separated targets. This latter requirement was a little cumbersome using the built-in FTP task of Ant.

After writing the FTP task calls in our target, we noticed that when testing on the target build server that the FTP was timing out. To rub salt in the wound, it transpired that the Apache Ant FTP tasks do not allow for setting the timeout. If you want such functionality, you’ll need to duplicate the FTP task itself and add a simple setDataTimeout call, or use an alternative client (or fix the bug!). Whilst brainstorming ideas, a colleague and I discovered that using timeout for Ant FTP connections might not even be necessary if you use the passive=”yes” attribute; as the task’s documentation says:

selects passive-mode (“yes”) transfers, for better through-firewall connectivity, at the price of performance. Defaults to “no”

Doing so on our build made it lightening fast and we no longer suffered from timeout issues.

Basic LaTeX example

As part of my aspirations to become the best possible programmer I can be and as part of bringing new skills into my repertoire, I ventured into the land of LaTeX for documenting. Instead of writing in some made-up plain text format every time I write something down, I decided it would be sensible to use a proven interim format that’ll allow me to convert — easily, mind — into whatever format might be needed: markdown, HTML or wiki, for example.

So in steps LaTeX. On a murky Monday morning at my new job, I fire up gVim and find an example on the web. Two hours later I have documented the basics of the framework I’m coding for and can produce it in whatever format I need (and neatly, too). Suffice to say I’m hooked.

The hacker in me says “so you need a quick and easy way of producing skeleton LaTeX documents at the touch of a button or two”. In steps BaSH: I just echo this basic LaTeX document to stdout and be done with it:
\documentclass{article}
\usepackage{hyperref}
\begin{document}
\author{Alex Collins}
\title{}
\maketitle{}
\begin{abstract}
\end{abstract}
\section{Enter Section Name}
\end{document}

Now I’m always ready to go when needing the power and simplicity of LaTeX without having to remember the barebones.

CyanogenMod & AndroidScreenCast

So having finally grown enough cojones, I decided to root my HTC Desire HD and install CyanogenMod. Why didn’t I do it sooner? I was scared of bricking it. The phone that is.

Having done so, I am so pleased. It’s like I have a new device: it’s snappy, responsive, fresh-looking and exciting. I can take screenshots — yes, that wasn’t possible before — or install a firewall; I can even operate it from my desktop. How awesome is that?

Going forward, because you’re not relying on your carrier to pre-package the latest and greatest version with their bloatware, you can get updates to the Android platform almost as quick as they’re made available by Google. Furthermore, you get the ROMs listed for your device within a neat little app called ROM Manager that’ll even take care of backing up your system prior to upgrading. It’s very impressive (if a little script-kiddie-ish!).

My favourite thing — apart from having the ability to restrict apps via DroidWall — has to be what I mentioned earlier: using my phone from my desktop PC. AndroidScreenCast utilises the Android SDK to let you point-and-click on your phone from your PC, all via USB. It works really well — if a little slow at times — and means I don’t have to keep picking my phone up to reply to SMS and so-on. It’s a great little tool.

Hell, I might even start contributing to it soon. It’s all open source and in Java; perfect!

rooted Desire HD with CyanogenMod

Screenshot of my rooted Desire HD running CyanogenMod

The blog starts anew

Every bloody blog in the universe has one of these posts. It’s unavoidable.

The old domain’s been retired (blog.alexcollins.org) and I’m writing new stuff on alexcollins.org/blog. Do read, it might be of some use to you!