While working on a book ("PHP Web Services" from O'Reilly, not out yet but soon!) recently, I was looking for some place I could make HTTP requests to, to show off how to make different kinds of requests with different tools. On my own machine, I have a couple of scripts that chatter back giving debug information about the requests that were made, but I wanted to get the tools examples going without any additional dependencies at all. I hadn't used anything like these tools before, but I found quite a few alternatives, so I thought I'd share what I came up with. Continue reading
I work with PDF a lot, and it bothers me that I can see an outline view when I open the document, but I don't seem to be able to grab just that view. My presentations are mostly PDF and the titles and section headings show up nicely. Today I figured out how to get an outline view, so I'm putting that information here while I remember how to do it!
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.
I get a lot of emails asking me to get involved with API projects, and that means I see a lot of both implemented and planned "RESTful" APIs. Now, I absolutely love REST and for a data-driven application, it would be my first choice. A service of some other description may work better for other scenarios or skill sets, and non-RESTful services can be very, very useful. If you tell me that your service is RESTful, then I expect it to be. If you're not sure, look out for these clues:
It has a single endpoint
I don't really care what else is going on in your API, any "RESTful" API which has a statement such as "all requests are made to http://example.com/rest" is ... not RESTful. REST is all about handling representations of resources, each is represented by its own URI and we operate directly on that. If it looks like "pretty URLs", then it's probably along the right lines. Continue reading
Recently I tweeted as a #linktuesday link the 10 Worst API Practices post from ProgrammableWeb. Today, in search of some concrete examples of APIs implementing unhelpful antipatterns, I sent out a tweet for help:
In the raft of responses (and thankyou all, this was fabulous, helpful and entertaining in equal parts!), there were some definite patterns that I'd like to share with you, in no particular order. Continue reading
Recently, there was a great project on kickstarter to make a USB RGB LED. I missed it completely but thankfully my husband didn't, and recently a small package arrived containing _two_ of these lovely little blink(1) devices (very smart man, as clearly this was something I couldn't live without as soon as I saw it!).
Last week I wrote an email to a client who hasn't yet implemented source control, but who is thinking about it. It turned into rather a long email as I attempted to convey WAY too much information in one long email. After some twitter banter, I repackaged my thoughts into a whitepaper on Source Control entitled You're not using source control? Read This! (PDF, no registration needed).
The document goes on to talk about the available tools (git, Hg, SVN) and give a sales pitch for _why_ source control has benefits for an organisation. There are also some action points to follow to implement source control if you haven't already taken the leap, which I hope will help anyone looking to take that step - it's kind of awkward in this day and age to admit that your organisation doesn't have source control, but however this situation arose, hopefully this document wraps up my thoughts on how to find a good way out! Continue reading
I wrote the other day about the new datapoint API from the MetOffice (there were some great links to other weather APIs in the comments, if you like weather). I've been using it to create a detailed forecast of the weather over the next few days, mixing in some lovely weather icons by Adam Whitcroft, from The Noun Project (the same site that the icons on my own site came from) - so I have something like this for each kind of weather:
I had the weirdest problem the other day so I thought I'd write it down! I uploaded a toy script for someone, but it had images in it and they wouldn't load. The image files existed, and I could request everything around them, files in other subdirectories were okay; the same files in other subdirectories also served correctly. Yet in my error logs I just had lots of:
File does not exist: /usr/share/apache2/icons/ ...
Which was really odd, because my webroot is somewhere else completely!
Eventually I spotted a
/icons entry in the configuration for
mod_alias in apache, which intercepts all requests to /icons on any virtual host, and rewrites it. Err, thanks? Renaming the directory to "images" solved the problem in this instance, and I hope if you googled for an error message, you will find this page and be able to fix it equally quickly :)
I'm working on a little hobby project which needs to know what the weather is going to be. I had a look around and noticed that the MetOffice had released a new API called DataPoint. They have a selection of APIs, including some map overlays and some actual weather data (more on that another day) but I was especially charmed by their text APIs - this is basically the basis of weather forecasts used everywhere :)
I've been having an issue with one of my chrome extensions recently - the keyboard navigation extension that I blogged about previously. This is a huge problem for me because without this extension, I can't "click" on anything on the internet! It was working on some pages, but on others it was drawing elements but not styling them correctly. The extension doesn't seem to be actively maintained, so I realised I was going to have to dive into the extension itself to understand the problems and have any chance of fixing it. Hurrah for open source software (not that I really write any js but I figured if I could understand the problem, maybe I could ask more intelligent questions) Continue reading