Category Archives: Uncategorized

Zendcon 2009 report

After participating in Zendcon 2007 and having to cancel my visit to Zendcon 2008 due to a torn achilles tendon, I was determined to make it to this year’s edition.

The venue had again changed, this time moving to the San Jose Convention Center. This is one of the only items I can critize : it’s nowhere near the quality of the 2007 venue at the Hyatt Burlingame. The exhibit hall was too unpersonal and empty and, honestly, the food was not even close to what was served at the Hyatt. To me, that location was nice because it packed hotel, conference and extra-curricular activities all in one location (while there were still plenty of bars closeby and San Francisco was a 25min drive instead of a 1h drive now). But I can imagine there were reasons for moving to a different location (cost, no. of people, …).

When I arrived, I received my free netbook (everyone who previously came to Zendcon and registered before a certain date got one)… a nice little thing called Intellibook that has Ubuntu preinstalled. I haven’t tested it well yet, but I sure will in the coming weeks.

The tutorials

I signed up for the tutorial day, mainly to get some last minute refreshing for the Zend Framework Certification that I planned on taking. First I was in the ‘Quality Assurance in PHP Projects’ session (Sebastian Bergmann and Stefan Priebsch), which was a nice refresher on unit testing and other quality assurance tools. In the afternoon, I took the ‘Zend Framework Certification Refresher’, presented by Rob Allen… quite useful and wonderfully presented (and I like people with a British accent).

The sessions

I followed a variety of sessions in the next few days. A quick summary :

– Planning for Synchronization with Browser-Local Databases : not bad, focused a lot on the challenges that you will face and how to implement workarounds for them (among them distributed unique primary keys)

– Continuous integration and release management for PHP developers : this was probably the biggest disappointment for everyone, because the speakers focused on their product too much and it basically turned into one big commercial. However, I think they got the message when an unconference titled ‘CI without Atlassian’ was presented.

– Getting a website out of the door (aka Managing a website project) : not exactly what I expected, but maybe that was my fault. I expected to gain insight in managing very large projects, but sadly it was about very small Websites… didn’t learn a lot.

– Cool PHP Objects Sleep on the Couch : interesting and something I will definitely experiment with in the next few weeks.

– Taming the Deployment Beast : a sponsored talk that had less than 5 minutes about the product… that’s the way it should always be (I did ask before the start of the session, just to make sure I wouldn’t be in another Atlassian-like situation). Overal an interesting session too, with a few new things.

– It works on dev : sketchy at times, but for people who are new to multiple environments, it was probably an eye-opener. I did learn a few tricks though.

– How to run an enterprise PHP shop : although this presentation was fast-paced, I found it to be one of the most interesting, maybe because it was about something completely different for a change. Well-presented, lots of content… my favourite for the conference !

– Automated Deployment Techniques With Phing : probably the shortest of the conference and too bad we didn’t really get to see Phing in action. Some more practical examples would have been nice too. But it did touch on the basics of Phing and provided a nice intro.

The certification

I did skip a few of the sessions on Wednesday because I took about 2 hours to read the Zend Framework Certification Study Guide… as far as you can read 210 pages in 2 hours 😉

In the afternoon I did the certification and passed. Not sure how many I got wrong and that’s actually not the point either… I can add the certificate to my growing list and, given the fact that the company I work for as a PHP architect is using ZF for all new projects, it’s almost a must-have for me.


To summarize

A few items on which Zendcon can improve :

– The venue : see above

– Wireless connection : 802.11b… seriously, b ? Now that 802.11n is finalized, 802.11g is really the minimum. But I wouldn’t mind using 802.11b if the connection was fast, which it sometimes was and sometimes wasn’t. Not sure what was causing it… maybe some people download huge files, but there were times when I couldn’t even check my mail or write a simple tweet.

– Power plugs : plenty of them in the session rooms, but sadly only 4 in the hallway. With my aging Dell only lasting about 25 min on batteries, that was a bit of a problem…

Other than that, Zendcon09 was great. Good sessions overall, nice chats with famous and not-so-famous people, lots of humour, lots of tweets (Twitter crashed a few times during the conference… was that us ? :p), etc.

Look forward to Zendcon 2010… can’t wait to be there !

Pictures I took can be found at Flickr.

.

Finally, the rush begins…

Somewhere in december, I promised to publish articles and other interesting things on a regular basis. So far, not much of that has happened.

Not that I was short of ideas, but due to time-contraints, I never got around to doing that.

In the past few weeks, I finally found the time to put some of those ideas into practice. So starting this week, you’ll regularly see some articles and smaller tidbits posted here.

A small preview of what’s the come :

  • An extension to PHPUnit, which allows you to verify the types of variables on several levels during the test run
  • How to build a dynamic, cacheable, reflection-based ACL system in Zend Framework
  • Parents are bad (or : how to build a proper tree)
  • How to analyze SQL queries in MySQL – how to get the most out of your database by writing the right queries
  • How to detect and block request floods
  • and a lot more 😉

For those of you who want to know when a new article is added, you can subscribe to the feed or follow me on Twitter (@wimgtr)

Getting uniques from an array (with speed in mind)

Important : the following technique doesn’t work for any arrays where the values are :

  • boolean (true/false)
  • null
  • objects
  • resources

Suppose you get data from some source (an XML file, a CSV file, …) and you put it into an array. Now suppose this data is full of duplicates. For example, you have :

array(
0 => 'horse',
1 => 'pig',
2 => 'pig',
3 => 'cow',
4 => 'horse',
...

How can you get the unique values from this array ?

The standard way would be to do :

$a = array_uniques($a);

Works fine, except that it’s extremely slow for large arrays.

A better way would be :

$a = array_keys(array_flip($a));

But marginally faster is :

$a = array_flip(array_flip($a));

So how big is the speed difference ? For large arrays, a double array_flip can easily be 20 times faster.

For reference, here’s a small benchmark :

$a = array();
for ($x=0; $x < 1000000; $x++) { $a[] = rand(0,1000); } $starttime = microtime(true); $b = array_unique($a); echo (microtime(true) - $starttime) . "\n"; $starttime = microtime(true); $b = array_keys(array_flip($a)); echo (microtime(true) - $starttime) . "\n"; $starttime = microtime(true); $b = array_flip(array_flip($a)); echo (microtime(true) - $starttime) . "\n";

The result :

2.06489086151
0.101167201996
0.0999970436096

Just another blog ?

So I finally got around to writing a professional blog. I’ve been planning on starting one for a long time, but never got around to actually doing it, mostly due to time constraints.

This blog serves just one purpose : to publish the ideas that sometimes pop into my head, often while working on a technical solution, sometimes while thinking about a business idea or just while browsing the Web.

It will be a collection of long, technical or business oriented articles, often mixed with short and succinct items… mostly thoughts about IT, business or anything else that I may find interesting.

My main goal is for this blog to serve as a historical record for myself… if by any chance someone else enjoys reading it, it’ll have served more than its purpose !