My current project (BiteStats, a simple report of your google analytics data) uses a basic system where there are numbered patches, and a patch_history
table with a row for every patch that was run, showing the version number and a timestamp. When I deploy the code to production, I have a script that runs automatically to apply the patches.
Invalid Protected Resource URL in Pecl_Oauth
Fatal error: Uncaught exception 'OAuthException' with message 'Invalid protected resource url, unable to generate signature base string'
There are two things to notice about this. The first one is that I should be catching exceptions thrown by this code :) The second is that I could see nothing wrong with my url, http://api.local
. It turned out, after some experimentation, that what is missing here is a trailing slash, and if I supply http://api.local/
, everything works perfectly nicely! I’m unclear if this is intended functionality or not, but if you see this error message and you’re requesting a URL with no path info, make sure you have a trailing slash.
PDF Presenter
Getting the thing installed was a bit of a puzzle as it has many dependencies (and that’s just the compiler) but I now have it working like a dream on both my laptop and my netbook. I discovered that it didn’t work with my presenter mouse but with a bit of help from a friend, I have a patch for that and now when I’m presenting I see something like this:
You can set which screen show this, and which shows just the main slide, and you can also set what duration the countdown timer should start from. One really key feature is that the timer doesn’t start counting until you advance from the first slide … unlike in open office where I usually put up the title slide during the break before my talk, then have to stop and start the presentation to reset the clock so I’ve got some vague idea of my running time!
So in true open source form, there’s a tool out there already (thanks Jakob, and thanks for responding to my emails!), and I was able to adapt it to my use case, or rather Kevin was able to! I would love to have the presenter console packaged so I could recommend it for more users, but for now I have a great open source solution enabling me to do what I’m good at – delivering content.
Downgrading a PECL Module
Downgrading Pecl_OAuth
For me the problems were caused in the switch between default functionality in pecl_oauth 1.1.0 (this isn’t a bug, but is correct behaviour according to the OAuth 1 spec, I just had code that expected the old functionality), so I wanted to put my version back to 1.0.0
pecl install -f oauth-1.0.0
It was easy once I stopped looking for an option called “downgrade” or something like that :) In fact you can use this trick to install all kinds of pecl versions, simply refer to the package as [package name]-[version]. By default pecl won’t let you install packages that aren’t marked “stable”, but you can install beta packages by putting “beta” in place of [version].
Hopefully now I’ve written this I’ll remember next time how to do it!
Slide Markup with LaTeX: First Steps
Start at the very beginning
First of all, LaTeX templates are fussy things, start with someone else’s outline (for example the one Dave posted, which I use), or one you made earlier. There is some preamble and then the main contents of the presentation go between the \begin{document}
and \end{document}
bits.
Summer PHP Conferences
Creating Presentations with LaTeX
Getting started was a struggle, I’ve never really used anything like it before and if there’s one thing LaTeX doesn’t do well, it’s error messages! The blog post I linked above has a sample presentation in it and I used that as my starting point. The source code goes in a file with a “.tex” suffix, e.g. presentation.tex. I then installed the texlive-latex-extra
, latexmk
, vim-latexsuite
, latex-fonts-recommended
and texlive-fonts-extra
packages from aptitude, and generated a PDF by running:
latexmk -f -pdfps presentation.tex
Basement Tanking Project
Fast forward 4 years of cooking in wellies once in a while, and running down the stairs to check the basement every time it rains a lot (in Northern England, you can imagine this gets really old really fast). Actually even when it wasn’t underwater, it was a pretty nasty kitchen, always damp and it had no heating so in winter it was whatever temperature it was outdoors. This sums it up: my mother’s old dresser, standing on bricks to keep it out of the water
Getting Dates From Week Numbers in PHP
Using DateTime::setISODate
I found that the DateTime extension has a method setISODate() which accepts the year and week number, and makes a date you can then use as normal.
$week_start = new DateTime();
$week_start->setISODate($year,$week_no);
echo $week_start->format('d-M-Y');
You can also do this the other way around; if you have a date in PHP, there’s the ‘W’ flag for date() which will return you the week number – very handy!