Small steps towards a co-working space in East Oxford.

Gov. Glynn and Frank Tierney (LOC)

UPDATE – Go and check out this page on our main site for more info about our growing co-working space.

Some White October blog-worthiness happened yesterday. The first coworker to use our space setup his netbook on Wednesday morning and had the whole downstairs area to himself. Hope to see you back next week, Paul.

We first blogged about making our surplus office space into a coworking space a few months ago, but we recently upped the ante by putting in some desks and chairs and getting some other bits from a certain Swedish furniture emporium. We’re not approaching Philippe Starck levels of interior design just yet but we plan on gradually improving the space; the plan is to install a meeting room in the near future, and  a couple of sofas for you to hang out on too.

Eventually, we want the space (we really must think of a name for it) to be somewhere for freelancers, two-person start-ups, tele-commuters who crave human contact etc. to drop by for a day or two, do some work, and meet a varied bunch of interesting folks from a variety of fields.

We’re still interested in hearing from interested coworkers. So if you know someone, please let them know that they can register their interest with us.

Here’s some pix of what it looks like at the moment:

The photo at the top of the post is from The Library of Congress on the Flickr Commons.


A stack of twits

Here at White October towers we pride ourselves on not knowing everything. This is what the internet was made for. So when we are stumped on a problem we hit the Google. These days however our first point of call for any technical programming problems is Stack Overflow. A quick search of that site usually turns up someone else with a similar problem and if we are very lucky someone has posted up a solution. If not we post up a question and people will try their best to post an answer.

As we find it a good resource we try and answer questions on things we know about, in turn for answers you get points and sometimes badges.  The badges/points side of things is a little childish but very addictive and a more productive use of time than Youtube.

Recently Stack Overflow released an API and I thought that joining Stack Overflow and Twitter together sounded like a fun reason to play with both websites’ APIs.

So Stack of Twits was born and unleashed to the world last night. Simply it sends you a message on Twitter when a question matches your set of keywords.

I built the site using our framework of choice symfony very quickly. It only took me a few hours over the course of a week or so to get it together. While building it I have made a PHP wrapper for the Stack Overflow API and the plan is to open source this work. Any interest in it pre release please comment below.

woPad

Well, not quite, but it was good to check that our site worked without problems on Apple‘s latest offering :-)

The White October site rendered in Safari on the iPad

I took a mini-break to New York last week, and had the chance to pop into the Apple store on 5th Avenue (I love how awesome that sounds). Obviously then I had to try out the iPad first-hand. It was clearly the most popular item in-store as the gorgeous MacBook Pros and large iMac demonstration areas were practically empty, with large crowds around the iPad areas.

Crowds around the iPad demo areas

It’s a nice device, if a little large for my liking, but very responsive, particularly with regards to the keyboard. Positioning the iPad horizontally on the provided slanted stand allowed for typing on the on-screen keyboard at the same speed as you would a normal computer keyboard, and was extremely nice. I was personally quite sceptical back in January when the product was announced, but I did find myself experiencing iPad-envy after playing with the device; travelling back to our hotel on the subway, I noticed about 4 people using them for various activities including reading books and browsing the web. Suffice to say I restrained myself and didn’t purchase one sadly!

It’ll be interesting to see the UK release; by then hopefully all the little niggles will have been ironed out and we’ll have a solid product. Watch this space :-)

Oh, and I also came across a stack of paper versions of The Onion hidden in a subway corridor. Very bizarre!

Not Verified by Visa

This month, Verified by Visa (and/or 3D Secure, I still don’t really understand what the difference/relationship is there) prevented me from making two sizable online purchases.

The first was some First Great Western sleeper tickets to get me to London for a client meeting. I spent quite some time choosing the tickets (it’s a complex business anyway) then working through the checkout process. At the end, I’m pretty sure I briefly saw the Verified by Visa thing appear in a frame only to vanish to be replaced by the page hosting the frame in the frame. How recursive. I got angry then started all over again (yep, my basket was empty) with another card (one with which I’ve always managed to duck around the Verified by Visa thing by carefully clicking the tiny ‘No thanks’ button).

The second purchase was my exciting new Android phone from T-Mobile. Another lengthy checkout process (since it involves a credit check etc.) only to be presented by Verified by Visa. Everything actually appeared to go through this time, although I got no acknowledgement email from T-Mobile. Later that day, they contacted me to say the card verification on the purchase had failed. I phoned them and a nice chap took my details again and pushed everything through. I got the impression that failure at the Verified by Visa step was not uncommon.

I’m clearly not alone in my hatred for it. Plus, it seems as though it fails massively in its attempts to add any security anyway.

So what can we do? As consumers, we need to moan and whine to to the e-commerce businesses we buy from. And they need to moan and whine to the 3D Secure providers to sort out their system and provide better, bullet (and user) proof e-commerce integration. I’ve never had to implement it, but I’m  willing to bet that it’s a complete nightmare, with poor documentation and very little support so e-commerce developers rush to fit (using nasty hacky javascript and frame solutions) and forget.

It’s no good spending time and money improving e-commerce to increase sales if a third party payment system mucks it all up for users at the end.

Our weekend JailBrake

Not quite as dramatic as it sounds, but still very exciting : half of the White October office went over to Bethnal Green this weekend to take part in Social Innovation Camp‘s JailBrake weekend.  The event brought together social innovators and web development professionals, all donating their time to develop 6 ideas for online platforms that can make a difference to youth re-offending.

The White October and Nonsense team (with a few ringers) teamed up with Common Ground and Itamar Ferrer to develop FLIP.  The idea behind FLIP evolved on the day, but put simply it is a Facebook application that gives friends the confidence to begin the process of identifying and developing their skills to find employment.

With about 12 hours in total to develop the application, we had our work cut out for us, particularly since none of us had ever developed a Facebook application before.  But by 2:00pm on Sunday we had  managed to create a functional Facebook application that allows friends to tell each other what they think they are good at, posting this to their wall, and encouraging them to begin to identify other skills.

Rating your friend's skills on Facebook

Facebook notification from FLIP

The FLIP facebook profile

An idea of what a profile page available to employers might look like.

We were lucky enough to be joined by Zoltan Ray and Matteo Menapace who, under the art direction of Itamar Ferrer put together the amazing designs above.

Much like 24 hour Startup the day ended with a lot of frantic coding from Rich, and fretful pacing from Dave.  We then presented to a few hundred fellow JailBrakers and interested parties where, despite not winning the competition, we were met with overwhelming enthusiasm for our ideas, and astonishment from fellow developers at what we had achieved in such a short amount of time.

UPDATE : Here’s our presentation from the day:

The idea behind JailBrake was that the projects conceived over the weekend, would be taken forward by their owners and some might become fully fledged social enterprises in the future.  With the rest of the FLIP team we’re going to be putting serious thought into how we can do this with our project which oozes potential whichever way you look at it.

Symfony admin generator theming

From this…
old-edit-user
To this (at the click of a few generator.yml changes)!
new-edit-user

As part of one of our current Symfony projects in work, a colleague and I decided that rather than reinventing the wheel everytime we used a new admin-generated module in the application with regards to overriding partials and actions in pretty much the same way each time, it would be productive and easier in the long run to create an admin generator theme. The documentation on the Symfony site for this is sparse to say the least, and when I get some time, I’ll look at contributing back to the Symfony docs a condensed version of this blog post so that it’s a bit more straightforward for the next person. You have the ability to customise pretty much every part of the admin generator including batch actions, form actions, filters, table headers and so on, so it’s worth the work in the long run if you’re looking for quick admin-generated module deployments in line with your site’s template.

OK, so before I start, be warned this is nice and long (and hopefully explanatory)…! I’ll also say that clearing your cache upon making changes to partials is vital. I repeat, VITAL! :-)

Getting started

The first step I carried out, which is mentioned on the Symfony site, was to copy all the files from the default theme into your project. In our case, we’re using Doctrine as the ORM, so the files were found in lib/vendor/symfony/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin, and they were copied to data/generator/sfDoctrineModule/ourTheme. This directory contains 3 subdirectories – we’ll need all 3. The names should be self-explanatory – “parts” consists of all the parts needed to dynamically generate the code, “skeleton” consists of skeleton files that form the basis of the final module (generator.yml etc), and “template” consists of the template files that use the files in “parts“. Simple!

That’s the basic step out of the way. If you want to check that everything is being correctly read here, simply alter an existing generator.yml file as follows:

theme: ourTheme

Clear your cache, and reload your page. You shouldn’t see any change – this is because the files are exactly the same as the default theme. Now comes the fun part!

For the following paths, I’ll assume the prefix of data/generator/sfDoctrineModule/ourTheme/ to avoid typing it out each time.

Adding configuration options

The first change I wanted to carry out was to add some extra configuration options via the generator.yml file. One major gripe I have with the Symfony admin generator is that once you’ve added a new object, or edited one, the default destination is the edit page, rather than the list page. Personally I see returning to the list as expected behaviour, and every project I use the admin generator in, I end up overriding the processForm() action and making this change. I wanted to be able to specify this destination via a configuration option on the ‘new’ and ‘edit’ contexts, with a ‘return_to’ option. Carrying out this change involves overriding some other classes in Symfony, most notably the sfModelGeneratorConfiguration class. I copied this class from the Symfony core to lib/generator/myModelGeneratorConfiguration.class.php.

Once you’ve done this, alter parts/configuration.php so that the generated class extends from myModelGeneratorConfiguration instead of sfModelGeneratorConfiguration.

Open up this class, and you’ll see a lot of abstract methods defined near the top. These methods are created during the generation process, and are located in the parts/fieldsConfiguration.php file. You’ll see that it consists of what looks like PHP within PHP – this is a common theme throughout the development of an admin generator theme, and can get a tad confusing if you forget what context you’re in when you’re writing code! You can use the example methods to build your own. In my case, I added the following:

public function getNewReturnTo()
{
return '<?php echo $this->escapeString(isset($this->config['new']['return_to']) ? $this->config['new']['return_to'] : 'edit') ?>';
<?php unset($this->config['new']['return_to']) ?>
}


public function getEditReturnTo()
{
return '<?php echo $this->escapeString(isset($this->config['edit']['return_to']) ? $this->config['edit']['return_to'] : 'edit') ?>';
<php unset($this-&gtconfig['edit']['return_to']) ?>
}

These methods both return a configuration value if it exists in the YAML file, or the defaults of ‘new’ and ‘edit’ respectively if no configuration value is specified.

In order to make this option available in the configuration, the myModelGeneratorConfiguration->compile() method should be altered to allow this option:

// ...
'new' => array(
'fields' => array(),
'title' => $this->getNewTitle(),
'actions' => $this->getNewActions() ? $this->getNewActions() : $this->getFormActions(),
'return_to' => $this->getNewReturnTo()
),
// …

and the same for the edit option. The final change is to actually action this change in the processForm() method, conveniently found in parts/processFormAction.php. This file (along with all the other *Action.php files) are included in the generated sfActions class specific to the module you’re creating. I removed the final redirect line which redirected back to the ‘edit’ URL, and replaced it with the following changes:

// ...
if ($form->isValid())
{
$thisContext = $form->getObject()->isNew() ? 'new' : 'edit';
$notice = $form->getObject()->isNew() ? 'The item was created successfully.' : 'The item was updated successfully.';


// ...
$this->redirect('@<?php echo $this->getUrlForAction('new') ?>');
}
else
{
$route = '<?php echo $this->getSingularName(); ?>';
$returnTo = strtolower($this->configuration->getValue($thisContext . '.return_to'));
if ($returnTo != 'list')
{
$route .= '_' . $returnTo;
}


$returnArray = array('sf_route' => $route);
if ($returnTo != 'list')
{
$returnArray['sf_subject'] = $<?php echo $this->getSingularName(); ?>;
}
$this->redirect($returnArray);

That’s it! Add the configuration option into your generator.yml as follows:
new:
return_to: list

Clear your cache, reload the page and test it out. After creating a new object, you should be returned to the list. This is restricted to eg my_model_ACTION-type routes, but you can easily enhance the above code to redirect to any other route, check for an “@” symbol if needs be and so on.

New “contexts”

I wanted to implement an Ajax edit form on a “view” page for my model, so that the user wasn’t taken away. The templates I was working from had this as a pop-over box, but instead of redirecting the user afterwards, I wanted the edit and update to be seamless. In terms of the form, the ajax form was similar (but slightly different) to the normal admin-generated edit form, so I wanted the ability to be able to configure the form separately from the edit page.

I experimented with configuring it as part of my ‘view’ context but ran into problems with nested array configurations, so I decided to abstract it out and create a new “context” with which I could configure items in the same way as a normal context (‘new’, ‘edit’, ‘list’ and so on). I termed this ‘ajaxedit’; NB I’m calling them ‘contexts’ here as I’m sure I read that’s what they were called somewhere! Correct me if not ;-)

The creation of this is very similar to the above changes for adding a configuration value. In myModelGeneratorConfiguration.class.php, add the following in to the configuration array in compile():

'ajaxedit' => array(
'title' => $this->getAjaxeditTitle(),
'actions' => $this->getAjaxeditActions() ? $this->getAjaxeditActions() : $this->getFormActions(),
'fields' => array()

I added this after the ‘edit’ one currently there. If you proceed down through this method, I also duplicated the ‘edit’ line in the first foreach() loop, where the fields are configured using sfModelGeneratorConfigurationField, and altered ‘edit’ to ‘ajaxedit’ where appropriate. Same in the ‘virtual fields’ configuration, the form actions, the field configuration (duplicated from ‘list field configuration’), and the $this->parseVariables() lines.

You should also add ‘ajaxedit’ to the credentials array near the end of the compile() method, so that you can control access to the popup/context with credentials, and again into the getConfig() method at the end of the class.

You then need to create the relevant abstract methods as before, so that the context can be correctly configured. Again, I used the ‘edit’ context as an example to base my changes and additions on.

The next step is to configure the templates and partials so that they recognise this. I used the default _form.php partial so that I could re-use code where possible, but added a ‘context’ variable to the partial when calling it, eg. in my view page:


[?php include_partial('<?php echo $this->getModuleName() ?>/form', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>, 'form' => $form, 'configuration' => $configuration, 'helper' => $helper, 'context' => 'ajaxedit')) ?]

In my form partial, I then altered the getFormFields() call to the following:


[?php foreach ($configuration->getFormFields($form, $form->isNew() ? 'new' : 'edit') as $fieldset => $fields): ?]

so that I was using the correct set of fields for the form display. Don’t forget to clear your cache after making these changes.

You can handle the ajax post however you like; I used jQuery and a callback handler to adjust details and display new values etc where required. The handling of the form data was done in the same way as a normal Symfony action; details of this (and Ajax-specific stuff) are in the main Symfony documentation.

Here’s the result:
ajax-edit

Conclusion

The one major thing to remember is that clearing your cache is VITAL to a speedy admin generator theme development. If you’re running in dev mode via your front controller, then Symfony will only regenerate partials that are directly related to your generator.yml on the fly. It won’t recreate action templates if there is no need to from generator.yml changes. This means that you will need to manually call “./symfony cc” from the command line whenever you make changes to partials. I lost count of how many times I ran that task during my theme development :-)

I’d imagine there are nicer ways to do some of the above – I’m not particularly a fan of the overriding of classes and having them separate from the theme, although I know that Symfony’s autoloading can be pretty clever sometimes, so it would probably find the classes with a bit of tweaking, if I put them as part of the theme. It’s also a bit tricky to get your head around the whole PHP-creating-PHP idea, and remembering whereabouts you are, and what variables you have available to you. I lost a good few hours trying to use variables that were in the top-level PHP, in my generated partials, and wondering why they weren’t working.

However, the end result is definitely worth it and saves a lot of time in the long run if you’re looking to re-use templates and code across a number of admin-generated modules!

PHP UK Conference 2010

Last Friday (26 February 2010), myself and Ed Lucas from White October took a trip down the M40 to the PHP UK Conference 2010, hosted at the Business Design Centre in London.  The purpose of the trip was three-fold – firstly to attend some great talks, secondly to socialise and meet other members of the PHP community, and thirdly to see if we could recruit any budding new junior PHP developers (we failed on the last part but get in touch if you’re interested in working for a great web agency in Oxford).

The conference kicked off with the keynote speech delivered by Josh Holmes, on “The lost art of simplicity”.  This was a great keynote – some of the feedback I’ve read since the conference describes it as “nothing new”, or “knew this already” but regardless of whether you knew it already or not, it’s all too easy to forget about making things simple.  An example that stuck in my mind from the keynote was if a client asks for a report… and they’re delivered a report system.  Error, not what the client asked – they don’t care about a system to do it, they just want to know how many pencils they have in stock etc.  This seemed to ring true with a large majority in the room! It’s something that we at White October try and build into systems/sites we produce, so that the client has as much hands-on control as they need, without fancy technology or “cool ideas” getting in the way.

After the keynote, Ed and I split off to attend talks in our areas of interest.  My first stop was Stefan Koopmanschap‘s talk on documentation.  Another area which seems to get forgotten about! Stefan gave some great examples of how to get documentation done effectively, eg by getting your users to write the user manual (NOT the developers!).  In particular, he included “obvious” documentation methods which may be forgotten about, such as commit messages, DocBlock comments in code and unit/functional tests (we all do those, right?).  These all make for a much more maintainable system.  Great talk – extremely useful.

The lunchtime talk was given by Symfony legend Fabien Potencier, on new features in PHP 5.3 and how to solve real problems using new features.  The ubiquitous “lambda functions” came up, used as part of the example of the Symfony 2 Dependency Injection container.  Thoughts are divided in the WO camp on dependency injection, but I think once we shift to Symfony 2 and start using it in practice, it will make much more sense.  We also ambushed Fabien at lunch regarding the possibility of open-sourcing/releasing Sismo (the Symfony continuous integration server) but sadly it appears that’s not meant to be!

After lunch I attended the “hidden features” talk by Johannes Schluter which was interesting, if a little disjointed.  In particular, I discovered useful applications of streams eg for processing zip files, and  the PECL ‘inclued‘ package which shows you your require/include() calls. Handy stuff.  This talk was followed by “Regex-fu”, by Juliette Folmer – lots of sweet-throwing around the room for correct answers to questions; highly entertaining! I picked up a good few tips here, and enjoyed the explanations of how regular expressions work internally in terms of optimizing them etc.  I haven’t seen a talk with quite so many random characters being drawn on the presentation whiteboard before however…

The final talk we both attended was “Best practices for web service design” by Lorna Jane Mitchell.  This was an excellent talk, littered with real-world anecdotes from Lorna, and included again some “obvious” ideas/guidelines which I’d imagine we all forget to do from time to time! Things like stacking errors, presenting a consistent interface in terms of response codes etc, keeping as small an API as is needed for operation – all useful stuff, and a good way to end the talks of the day.

After the talks finished, Facebook kindly provided a large amount of free beverages, which we all were only to happy to partake in.  We met some interesting people during the next few hours, and tried our best to recruit budding junior developers… and failed.  Seems like everyone was recruiting at this year’s conference! We then headed back up to WO HQ in Oxford.

There were a reasonable number of stands, and varied ones at that, which was good.  The O’Reilly stand seemed to get a large amount of attention; probably due to the great discount available! It was also good to see the data.gov.uk stand in attendance, if a little sparse each time I glided past…

Anyway, a massive thanks to the PHP London guys, for putting on a great conference – definitely looking forward to next year’s!

Possible co-working space in Oxford

UPDATE – Go and check out this page on our main site for more info about our growing co-working space.

We moved offices this weekend and over an awesome post-move burger in Atomic Burger on Saturday we started talking about what we were going to do with all the space we’ve now got.

One option that we’re actively looking into is renting out desk space, but a few people have suggested that we provide more flexible desk space via a coworking model where freelancers and individuals can rent desk space by the day.

We’re not sure whether we’d be able to make enough to cover our rent this way, and there are also other legal and insurance considerations we need to look at, but the idea of a creative space for designers, geeks and anyone else to drop into really appeals to us.

The plan…

We’re going to look at the technicalities of this over the next 2 weeks, but hopefully we’ll be able to run a trial during March to see if it’s going to be sustainable.  If it’s a success, then we can keep it going.

Sign-up and register your interest please!

One big question we have is how much demand there is for desks, so it would help us if you could register your interest in desk space now.   Then of course we’ll let you know how our plan progresses and when the desks become available.