Generating HTML from Markdown with Pandoc

I'm writing more and more things that are not code these days, and my content-managing toolchains are becoming more developed all the time. I've written in REstructured Text, Asciidoc, and LaTeX, and today I'm working on an article which eventually wants to be HTML but I'm creating in Markdown because it's much easier.

My swiss army knife of document formats is a program called pandoc. It's absolutely fabulous, powerful, and not too complicated if you don't need to do anything too complicated. It will guess input and output formats from file extensions, or you can be more specific if you need to. Today's command looks like this:

pandoc article.md -o article.html

You won't be surprised to hear that this command takes a file called article.md which contains my markdown, and outputs a file called article.html containing the HTML. I also use this to convert between all the various text markups, HTML, but also PDF and office document formats - it's a very comprehensive tool!

Screencasting in Ubuntu: Kazam

If you've ever seen a live demo, you will know that these things are fraught with danger. Even if the wifi works, the presenter knows what they are doing, and nothing crashes, you'll often end up watching someone explaining something to their laptop in detail, or clearly demonstrating their inability to type. Either way, it doesn't make good, informative content, which is why I never ever demo in a conference talk - I'm there to entertain and time is always of the essence. At this point, you can probably guess why I'm writing a blog post about my screencasting toolchain - I simply pre-record whatever it is that I want to show in the talk.

On an ubuntu platform, I've had a few false starts with video over the years, and mostly avoided it. But now my "Debugging HTTP" talk really does make more sense if you can see the process of something broken, what the tools show, and how to understand that information and fix the problem.

Kazam

kazam-close Continue reading

Homemade Kitchen Shelves

For the last ... really long time ... I've been working on a place to put the cookery books in the "new" kitchen. Since the kitchen was finished early in 2011, that's been quite a long-running project! It's finally finished though and I thought I'd share a bit about how I made it (not least because I get nagged about the lack of non-geeky posts on this site - you know who you are!) Continue reading

Accurate Ubuntu Window Sizing with Wmctrl

I'm working on a bunch of screencasts at the moment (more posts to come) and one of the things that tripped me up the most was getting all the windows the same size, so that the resulting videos are the same size and can easily be put back together. Enter wmctrl, a very nice linux tool that can do all of this for me.

I'm aiming to have a series of windows all sized at 800x600, and the first step is to look at a list of windows in wmctrl:

wmctrl -lG

wmctrl-lg

The -l switch provides a list, and the -G switch shows the geometry of the windows. This is especially useful if you want to place something on a second monitor, you can look where a correctly-placed window would go and then use those co-ordinates! Also beware that windows positioned at the origin of a desktop space rarely end up where you expect them to go.

To set a new geometry for a window, we use the -e switch to specify what that should be. The format is:

"gravity, X, Y, width, height"

For gravity, try zero. X and Y are the co-ordinates of the top left hand corner of the window, and width and height hopefully you can guess. It's also acceptable to pass -1 for any of these values for the window to retain its current setting.

To specify a window, we use the -r switch to indicate to wmctrl which window wants the resize. You can give the title of the window, or the identifier shown in the list output, but I found it most useful to use the special value ":SELECT:" and then just click on the window I wanted to affect. Therefore the command I used the most became:

wmctrl -r ":SELECT:" -e "0, -1, -1, 800, 600"

As a final tip, make sure (by resizing the window to something definitely smaller than the desktop it is on) that the window is not maximised - if it is, it will stay that way and you will wonder what you are doing wrong.

Using Composer in an Existing Project

I've got an application (okay, scratty PHP script) which glues together some API things and shows them onto a dashboard for me. Recently, I updated it to use Guzzle as the consuming client, since twitter now needs me to authenticate (I wrote about that if you're interested), and I used Composer to bring the new library in. It was very simple so I thought I'd share it as it's quite minimal example, and those are my favourite kind. Continue reading

Tips for Addressing a Virtual Audience

As a conference speaker, I've read the books on how to be a good conference speaker, and coached quite a few people to raise their skills in this area too. However recently I've been meeting more virtual audiences, both delivering virtual training and doing virtual events such as DayCamp4Developers, and I thought I'd share my take on what works well in a setting where people can see your slides, and hear your voice ... and nothing more. Continue reading

Using Charles To Debug PHP SOAP

I used this trick to solve a particularly sticky problem last week, so I thought I'd share. I had a 3rd party SOAP service (except it was actually a .NET WCF service, which is almost SOAP but not quite) which didn't behave in accordance with the way its documentation said it would. PHP's SoapClient has the ability to enable tracing and give information about the request/response headers/body, which is useful, but I needed to store the outputs and also rewrite a particular request header during the course of debugging this. Enter: Charles Proxy. Continue reading

PSR-What?

There's been some cool things happening in the PHP world over the last few years, but with the least helpful names ever ... yes, those PSR-somethings which all do totally different things (apart from two of them which are the same). They're actually all superb things, and done for a good reason, so I thought I'd try to translate them into normal speak.

PSR

Let's begin at the beginning. Once upon a time, at a conference, the lead developers from a selection of frameworks sat down in the same room (they are better at it nowadays, at the time I might not have believed it had I not been there) and agreed some standards for all their projects to use. The aim is to make PHP frameworks and libraries easier to combine for users, and so it was that php-fig: the PHP Framework Interop Group was born. This group of awesome individuals oversee the PHP Standards Recommendations (PSRs). Continue reading

Twitter Search API Using PHP and Guzzle

In case you missed it, Twitter updated their APIs recently, so that you have to authenticate to use even their search APIs to return publicly-available results. This is an increasing trend for API providers, to provide either very limited or nonexistent access for unauthenticated users, I think so they can rate limit consumers that swamp them. To cut a long story short, that meant I needed to update my dashboards that keep an eye on twitter searches to do more than just call file_get_contents in the general direction of the right URL. Continue reading

Ttytter: Command Line Twitter Tweaks

I've been using ttytter for quite a while, it's a superbly inoffensive twitter client - and it's console-based. This makes it easy to use from the keyboard, fast, and also makes it look a bit less like twitter if that's not something people should be seeing over your shoulder!

I have customised a few settings which I find superhelpful, so I thought I'd share my config file and say a bit about some of the entries in there. The config for ttytter is held in a file called .ttytterrc in my home directory. Mine looks like this: Continue reading