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.
Category Archives: tech
Accurate Ubuntu Window Sizing with Wmctrl
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 800×600, and the first step is to look at a list of windows in wmctrl:
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.
Ttytter: Command Line Twitter Tweaks
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
DC4D 6: Not-Programming for Programmers
Day Camp 4 Developers is a virtual conference, and it’s $40 (about 25 quid for UK people). If you can’t make it on the day, just get the video ticket and download the recorded sessions later. What I’m trying to say in this paragraph is that there are quite literally no excuses for missing out on this :)
Continue reading
Are Subqueries RESTful?
@lornajane sory for getting on your nervs with #rest,but are subquerys (like couchDB does) restfull to? is there a rule? like …/?type=bla
— Maximilian ‘Berghoff (@ElectricMaxxx) June 12, 2013
The blog seems like a good place, as I can put examples and all kinds other things here, and waffle at length (which is really why I like it!). Because when condensed to tweet form, the answer is really “it depends”.
The Problem(s)
REST is all about representations of resources. They might come in different formats, and they might appear at their own URI as well as in one or more collections, but essentially you just get a representation of a thing. This is great, apart from when it isn’t.
- What if you want a smaller result set with only a limited number of fields?
- What if you want related data? For every resource in a collection?
What Goes in Source Control?
Pretty-Printing JSON with Python’s JSON Tool
curl http://api.joind.in | python -mjson.tool
You need python installed, but the JSON extension is probably included, and that’s all you need for this tool. The result is something like:
You can also use this approach to present JSON data that has been captured to another file, for example, it’s a handy trick that I use often when developing something with JSON as a data format.
Installing XHGui
Dependencies
XHGui needs version numbers or fluffy animal names, because this is a really major release and quite different to what went before in both technology and in looks. In particular, it now uses MongoDB. If you’re not familiar with MongoDB, it’s a super-friendly NoSQL database that makes a really handy backend for this kind of unstructured data – because every run of every page will look different. Therefore you will need:
- MongoDB itself
- The pecl extension for mongo
- The xhprof pecl extension (
read on if you’re using PHP 5.4, there’s a gotcha)
Endpoints for HTTP Testing
Printing PDF Bookmarks List
I used a tool called pdftk which is excellent, I’ve used it before for doing various other PDF-related things. To grab metadata such as bookmarks, use the dump-data command, like this:
pdftk myfile.pdf dump_data | grep BookmarkTitle > outline.txt
The above line takes all the bookmarks from the PDF (this was a slide deck created using powerdot and LaTeX, the section and slide titles nest appropriately), and outputs a bunch of information about the document and the various PDFs. The grep
command just gets the lines containing “BookmarkTitle”, then the whole thing gets written to a file. I cleaned that up and now I have the outline of my course, so I can add timings, notes for the exercises and so on.