Speaking at FrOSCon

In August I’ll be attending FrOSCon in Germany for the first time, and speaking there. It’s a mixed technology conference, with rooms set aside for separate scheduling for various projects and technologies. I’ll be speaking in the PHP room, delivering “Working With Web Services”, a talk which covers how to consume all sorts of types of web service from PHP. I’m excited about that and even more excited to hear that I’ll also be speaking in the main track, where I’ll deliver “Open Source Your Career” – stories and advice about how involvement in open source can positively influence the career path for each of us.

I haven’t visited this part of Europe before so I’m also including a couple of days to see the area, and really looking forward to the trip. Since there are technologies other than PHP, and since I’m rarely in Germany, I know I’m going to meet a lot of new people … and I can’t wait :)

Something Special from PHPWomen

Last month, while in Amsterdam to host the Dutch PHP Conference 2010, I was absolutely stunned (as in, completely speechless – that’s pretty rare for me) to have my PHPWomen friends pull me aside and present me with something:

dscf1843.jpg

The inscription reads:

Lorna Mitchell
In recognition of your extraordinary efforts
PHPWomen

Although I took the photos of this outside, this item now has pride of place on my mantlepiece, where I can look at it and reflect on what a huge influence the PHPWomen have been, and continue to be, for me and so many others.

PHPNW10: Call for Papers

It’s official, PHP North West 2010 is definitely happening … and for that we’ll need some people to pop along and give a talk! As in previous years, we’ll first of all deal with selecting the papers for our main conference day, 9th October. Talks can be 60 minutes or 30 minutes, can be on any subject if you can persuade us it’s relevant to PHP developers, and speakers anywhere on the spectrum from expert to newbie are welcome.

So what are you waiting for? Go submit your talk at our call for papers page. If you need more assistance then you should check out these resources (and yes, some of them are mine but I feel strongly about this topic and want all you interesting and hesitant people to start speaking!)

Are you submitting? What tips would you offer to those thinking of doing so? Already we’re at over 50 submissions, more than last year, so competition is tough but oh my goodness, I’m so excited :)

Working with Branches in Git

Recently I’ve been doing more git than I ever intended to, working with the Joind.in codebase, contributing and managing contributions to that. I quickly realised that I needed to make changes on branches, and since I’m new to git, it took a while to figure some of this out. I’m pretty confident now* so I thought I’d share how I work with branches in git.

Available Branches and The Current Branch

This is the easy bit:

$ git branch
* api
  master
$

The entry with the star next to it is the current branch, so here you can see that I have branches “master” and “api” and I’m currently working on the “api” branch. If you only have one branch it will usually be called “master”.

Creating and Changing Branches

My experience is with Subversion until now, and branching is really different in git (because it actually has branches rather than just copies, this is definitely a feature, but it is a different approach from how I had used them before). So you can switch your working copy around to look at different branches, which threw me a bit to begin with. To change branches, just checkout the one you want:

$ git checkout master
Switched to branch 'master'
$

If you actually wanted a new branch simply name it and ask checkout to create it if it doesn’t exist, by using the -b switch:

$ git checkout -b demo
Switched to a new branch 'demo'
$

So now my branch command shows me this:

$ git branch
  api
* demo
  master
$

Pushing Branches

This is very much an optional step. Many of my branches are private branches – meaning that I branch on the development server, finish the feature at hand, and then merge the changes into my master branch without pushing the branch to anywhere else. To share changes with others though, I sometimes like to push my changes up to github – which is my “origin” remote on my repo. So to push the demo branch we just made, I would simply do:

$git push origin demo
Total 0 (delta 0), reused 0 (delta 0)
To [email protected]:lornajane/joind.in.git
 * [new branch]      demo -> demo
$

If you use “git push” on its own, it will push all branches which exist on both the local repo and the origin – but will not push any private branches unless you specify that it should.

Resources

The http://help.github.com site, Github’s own documentation, is actually brilliant and has really helped me to get up to speed with working with my own code and contributions from others.

* The only problem I’ve had with code on github recently is that I merged totally the wrong changeset into the main project root. Which really isn’t the fault of the source control system :)

Accessing the Magento V2 API

Recently I’ve been working with Magento at work, and in particular with integrating with their API. Now, before I say anything more, I must say that I am always pleased when I see that these products do include some kind of API. The Magento one is a bit interesting, although there is some half-decent API documentation for the original API.

However they have then released a new version of the API, with very little documentation. So here are two calls – one to the v1 API and one to the v2 – which I hope will help illustrate the differences. The example I’ll give is the customer list functionality, including filtering the result set – because this was a total mystery when I started working with the v2 API!

    $options = array(
        "location" => 'http://magentoinstall.local/index.php/api/index/index/',
        "uri" => 'http://magentoinstall.local/api/'
        );
    $client = new SoapClient(NULL, $options);

    $session = $client->login('user', 'pass');
    $list = $client->call($session, 'customer.list', array(array("customer_id" => "42")));

To make the same call with API version 2, we need to address the method in a different way, using the structure in the underlying code as the method name that we call, and CamelCasing those, like this:

   $client = new SoapClient('http:/magentoinstall.local/api/v2_soap?wsdl=1');

   $session = $client->login('user', 'pass');

    $filter = new StdClass();
    $filter->filter = array(array("key" => "customer_id", "value" => "42"));
    $list = $client->customerCustomerList($session, $filter);

I haven’t used either of the APIs a lot but once I was able to call the same method via both available services, I wanted to share the approach here in the hope that this would help someone else trying to solve the same problem. It is certainly not obvious from the documentation how to interact with the v2 API and I had some real puzzles getting the filtering working. These snippets are from my working code so I hope they are helpful to someone!

Your Open Source Stories

In this post, I am asking for your help and input, although it might seem like a post about nothing in particular to begin with. Please keep reading!

Last month, I gave a talk at TEK-X entitled “Open Source Your Career”. Personally I think that a lot of the high fliers in this profession use their community activities as a boost to their professional development, and I know that this has been true for me too. So in my talk I told stories about situations I’d met in my professional life and how I’d either achieved or made new opportunities by building on skills and experience (and network) that I’ve come across in my community activities.

For example I said to my CTO, Ivo Jansch that I was giving this talk and he asked what it was about. I said that, in a nutshell, I didn’t think Ibuildings would have trusted any of their developers to host the Dutch PHP Conference unless they’d seen that person hosting events elsewhere – as a volunteer co-host of PHPNW, I gained some experience doing this sort of thing. His response really brought home how true it is that getting out there can reap rewards in ways we don’t expect – or in my case don’t even recognise. He simply said “one reason you have the job you have now is the fact that you did an oracle podcast for zend once which I heard when I received your CV”. It hadn’t occurred to me that activities like that would have helped when I was changing jobs.

What I Need From You

I’m giving this talk again, at FrOSCon in Germany in August. It was a huge amount of fun to deliver last time but I’d really like to pull in more stories from other people to include in my talk. So … have you ever got involved with something outside of your day job, only to realise later that it was a good career move? And would you let me tell your story?

Answers on a postcard, by email, or in the comments field below. Any and all input is very gratefully received :)

Text Commands for Skype

I use Skype on linux and the client is quite limited in terms of buttons etc, which doesn’t bother me at all since I don’t use a mouse unless I must (answering skype calls forms a lot of the “must”!). In group chats however, its annoying to have the alerts popping up all the time and I don’t have a menu option to stop them. To disable them I discovered I can just use:

/alertsoff

The / lets skype know its a command – much like IRC! There’s a full list I found on Skype’s support site, very handy :)

DPC Retrospective

I spent most of last week and the weekend in (rather rainy) Amsterdam for the Dutch PHP Conference. This is an event that is in its 4th year, although I was attending for only the 3rd time. Two years ago, I spoke at DPC – my first conference talk. This year, I hosted the event, which was quite a different experience. The event is organised by my employers, Ibuildings, and I was astonished to be asked late last year if I would like to be its host. Hosting an event is quite a different set of anxieties from speaking at one, and although there were a few minor emergencies along the way (lost speakers, really “interesting” CfP submissions, a moment where only half the venue would have wifi and some sessions failing to run to time), nothing worth getting stressed over!

The event was great (can I say that myself?) and with a world-class schedule, excellent speakers who all delivered on the day, sponsors who supported the venture and of course the attendees who showed up, took part, joined in with the uncon and generally made the whole thing into the fun it was – I could not have asked for more. As for the community friends who kept on sneaking up on me with a hug or a word of encouragement … I can’t ever thank any of you enough. On a very personal level it was fanstastic – I’ve enjoyed DPC for a few years and although the weather in Amsterdam was not so kind this year, the friends at the event (both the people I had already met and the friends I made while I was there) made it more than worth it.

Poor Man’s Caching

Describing something as a “poor man’s” version of the thing is to say its a bit of a cheap or short-cutting version. I thought I’d share some VERY poor man’s caching that I came up with the other day.

To set the scene – I’m hosting the Dutch PHP Conference this week and there’s a LOT of information to keep track of. Between tweets using the hashtag, people tweeting either my username or any of the conference twitter accounts, the schedule itself which will change as we’re having a no-prior-scheduling uncon, and the event and talk-related comments coming in via joind.in itself, its quite a bit of stuff to track. Add into the mix the fact that my iphone’s data package will be too expensive to use in NL and although I will have a phone with a data package it wont’ be mine and there’s no guarantee exactly what it will be. Oh and conference wireless, which last year wasn’t bad at DPC but you have to assume there’s a bottleneck.

So I figured that since I have a fast production server with lots of spare resource, it can do the hard work on processing the feeds, and just serve me a basic page with everything on and some internal hyperlinks to get around. So I wrote this monster, which runs a bunch of twitter searches and pulls in schedule and comments from joind.in, and that was good.

Except, it does take quite a long time to run (well, a few seconds, but that’s too long in my book) so I thought about caching each result set in memcache, and writing a cron job to repopulate those regularly, so every time I hit the script, the cache would be warm. Then I realised I was overcomplicating the matter, and simply wrote a cron job to run my php script and pipe the output to a static HTML file every minute! Whenever I hit the page, I’ll get the latest version. It doesn’t scale but it doesn’t need to, its only for me to use for a few days! Here’s the cron job:

* * * * * php -f /path/to/generate.php > /path/to/index.html

Job done! (the actual page I made is/ here if anyone is inquisitive)

Magic Methods on Think Vitamin

I’m happy to announce that my new post 9 Magic Methods for PHP is live on Think Vitamin this morning. I’ve written a series of posts about OOP for the site, with a few more to come, and these “underscore-underscore” methods make for some very neat tricks with PHP, which I’ve tried to show in the post. Hope you like it :)