Launching Links in Opera from Command Line

I’m an Opera user but I use a number of applications from the command line, and often I want to launch links from those applications into my web browser. I’ve just switched over to reading my feeds using canto (web applications are becoming decreasingly accessible these days, although I’m saving that rant for another day) which is a console-based application. This, like many other applications, allows you to specify a URL handler to use when you want to visit links.

To launch a link into a new tab in an existing Opera window, I simply used this:
opera --remote 'openURL(<url>, new-page)'

Where the <url> is the address to access; the same trick works in other programs too. For example I use irssi for IRC, with the openURL plugin, and this can do the same trick. To launch the link I simply set the http handler like this:
/set openurl_app_http opera --remote 'openURL($1, new-page)'

Since I have to look these settings up every time I want them, I thought I’d blog them for next time – and of course for anyone else who finds this useful between now and then!

Speaking at DIBI

In June 2011 I’ll be speaking at a rather awesome event called DIBI at the Sage in Gateshead (if you’re a southerner, then Gateshead is near Newcastle, which is “up north”). DIBI stands for “Design It, Build It” and has two tracks, one focussing on development and one focussing on design. Last year was their first event and although I didn’t attend, I have only heard good things about both the conference and the socials!

I love it when really fantastic events happen in the north, especially because I’m based in Leeds and have ties to the North East, so I’m very excited to be speaking. Tickets go on sale in the New Year and I hope I’ll see lots of you at the Sage on 8th June!

OAuth Google API for Unregistered Applications

It is pretty common when using OAuth for there to be a relationship between the provider and consumer; as a consumer you usually register with the provider to obtain a consumer key and consumer secret. Google’s APIs however do not require this. It is recommended that you register your application, however it is also possible to use OAuth without registering.

To make this work, when you sign your OAuth request Google will accept some default values for consumer key and secret – see their documentation on signing oauth requests. To do this, set both consumer key and secret to the value “anonymous”, and proceed as you normally would. The only difference so far as I can see is that the user will be shown a more cautious message when they are prompted to grant access to your application. Personally I think this is a great approach, particularly when prototyping ideas. Registering the applications though is simple and quick so I’d recommend registering for most applications once they get beyond concept stage.

Skills Analysis for Teams

When I spoke at PHPNW10 in October, I talked about teams, skills and the importance of benchmarking things in order to illustrate improvements. If you didn’t see the talk, the video and slides are linked off the conference site. In particular I talked about the importance of analysing skills in a team, then improving them, then analysing again to see how things had changed. This post is about that process, some techniques that might apply, and what to do with the results when you get them.

Continue reading

256 Colours in Vim

Recently I’ve been looking at different vim colorschemes, after using vimdiff and finding I couldn’t see half of the code. I’ve been using relaxedgreen for ages, and it is excellent but I find the blue really hard to see on my black background so I was in the market for an alternative.

Touring Colours in Vim

Please excuse the all-over-the-place spelling in this post, I’m British so “colour” is a word and “color” is a vim command. Confused? Me too

I grabbed two fantastic scripts – the Vim Color Sampler Pack and the rather awesome ScrollColors plugin which allows you to cycle through all your colorschemes and try them out.

Continue reading

Curl and Cookies

I noticed the other day that the cheat sheet I have on this site for curl doesn’t show how to use cookies, so I thought I’d remedy that omission, and quickly! Being able to use the command line to authenticate and then go on and use part of a site behind a login box can be really handy, and it is also super-simple.

-c to Save a Cookie

Pass the -c switch followed by a filename and curl will write the cookies to a file. This is the “cookie jar” and you can dip into it whenever you want to send the cookies back with a future request. For example:
curl -c cookies.txt http://www.lornajane.net
This writes a file named cookies.txt to the local directory. When I look in it, it contains:

# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk.

www.lornajane.net FALSE / FALSE 0 s9y_4e071c5ccc553288993faf0369cb076c 539e01676501366ea0f04e2646b1a31d

-b to Send Cookies

All I do when I want to use the cookie on future requests is pass exactly the same command but with a -b switch; this will read the named file and send the cookies along. You can edit the cookies as you wish, at your own risk of course, and this makes the use of cookies and curl an absolutely invaluable technique for testing! It’s also common to use it on sites where you want to download a file directly to the server but the site requires login first.

Is Enum Evil?

When I work on database designs, either on my own projects or as advisor to others, I often find people very reluctant to use an enum type for any columns. Now, I’m not about to advocate the gratuitous use of an enum column, they definitely have some pitfalls, but I think it is important to understand these rather than just shouting “enum evil!” if anyone should mention them.

There are cases where an enum is the correct choice for a particular type of data, so let’s look at what an enum type actually is and does.

Continue reading

Return on Investment: Example

I gave a talk at the weekend which talked in outline terms about Return on Investment or ROI. It was a keynote so I skated over the details, but I wanted to include a specific example to illustrate what I meant.

Imagine the scenario where, given 3 days to work on it, a developer can get the deployment time for their code down from 3 hours to 20 minutes. This company does, on average, 42 deployments per year (you can guess these numbers are totally imaginary).

So 3 days at 7.5 hours per day means we are investing 22.5 hours on this.

The return is the difference between the deployments, multiplied by the number of deployments that are needed. So 3 hours is 180 minutes – so we save (180 – 20) = 160 minutes with each deploy. We do that 42 times in a year so we’ve saved 6720 minutes (per year) which is 112 hours or 14.9 days.

Project managers might not like to lose 3 days from their schedule but how do they feel about having a spare 3 weeks each year?

My Three Favourite Opera Features

I’m an Opera user, and one of the reasons I am is that I can control my browser entirely from the keyboard. I think everyone uses browser keyboard shortcuts, and in a lot of ways Opera has similar functionality to other browsers, but it also has keyboard spatial navigation, meaning I can jump to the next element in whichever direction I choose. Opera also has per-site preferences, which actually make the web usable for me.

Continue reading

Missing pcre.h when installing pecl_oauth

I was playing with pecl_oauth last week (more about that in a later post) and when I tried to install from PECL, it grabbed the files, ran the configure step but stopped with an error status during make. This is bad news for those of us who are ubuntu users rather than compile-happy linux users! Closer inspection showed this line around the point things started to go wrong:

Error: /usr/include/php5/ext/pcre/php_pcre.h:29:18: error: pcre.h: No such file or directory

I didn’t have the header files for pcre installed – in ubuntu the headers are in the -dev packages so I just installed what I needed:

sudo aptitude install libpcre3-dev

Re-attempting the pecl install, everything worked as expected. This is on Ubuntu 10.04 Lucid Lynx, and from reading around you’d want to install the same package in response to this error message, regardless of what you were doing to cause it. Hope this helps someone.