I had this problem when I’m trying to connect my Macbook Pro to an external monitor or projector: the Macbook wouldn’t recognise the new device until I issued a restart while connected. The fact that I had to do that gave some Windows fanboys the perfect opportunity to make fun of me and tell me that Macs don’t “just work”.

To avoid having this conversation in the future, I did some research, and, as it turns out, this problem is caused by the fact that the Macbook has two GPUs and switches dynamically between them to preserve battery life and the problem is caused by the batery friendly integrated GPU. Luckily I have found an app – gfx.io – that allows me to pick which GPU I want to use. If you’re experiencing the same problem, just install the app and select the “discrete” setting and the external projector / monitor will work as expected.

Few weeks ago I was asked to review Zend Framework 2.0 by example – beginner’s guide from Packt. While I’m not a beginner anymore – and haven’t been one for a while – I do hold from time to time training sessions on the various technologies used in web development so I can easily put myself into a beginner’s shoes and asses how useful a resource is.

Target audience

While it has “beginner’s guide” written on the cover, the book is not for the absolute beginner. It assumes the reader has basic knowledge about PHP, classes, objects and (a bit) design patterns. I would say it’s for students in uni who want to start a career in PHP development or young professionals. Can be interesting for a more seasoned professional who wants to get a quick start with ZF2, but sometimes all those beginner level explanations can get boring.


Like with all Packt releases, the book is available in multiple formats, from paperback to pdf, kindle and so on. This makes it easier to read it in the format of choice. Personally I prefer books in paper format – although the electronic versions are cheaper.

The book is divided in 10 chapters and one appendix and buyers can register on Packtpub.com and download the source code for all the examples in the book. It describes some common scenarios and provides solutions to day to day problems people encounter when using 3rd party APIs.


Long story short, the book delivers what it says, nothing more, nothing less.

  • simple, concise language – somewhat of an exception, because writing code differs greatly from writing a book and usually books written by developers aren’t the most enjoyable reads
  • uses Ubuntu and CLI tools for all the examples – I’m sick of PHP developers using Windows and not knowing anything about Linux although most of the web runs on it
  • gives example using popular APIs and 3rd party integrations: Paypal, Google data APIs, phpCloud, phoneGap and so on – this is very good for a beginner, because it shows how to solve real life problems rather than abstract artificially created problems


As always, there are some minuses:

  • inconsistent naming in the SQL tables – some tables use the singular form “user” while others use the plural “uploads”. I see this as a bad practice which decreases code readability and should be strongly discouraged. Also, some of the foreign keys are signed and they reference unsigned columns (id in user table vs user_id in uploads)
  • missing licence information for the source code. Some beginners might be tempted to use code from the repository in their own applications and I haven’t found any information on whether that’s possible. Also, the phpdoc comments in the code are missing virtually everywhere
  • sometimes it gets too verbose although that might be considered a plus for beginners

Value for money

As I said in the second paragraph, I see the book as being targeted for students / young professionals so I’ll use terms that they’re familiar with: the eBook with access to the code is priced at £16.14 (€19.04) which buys you 4 pints of ale (3 if you’re in London) or 2 steins Paulaner if you’re in Munich at Oktoberfest (lucky bastard :) ) and while this might sound like something your granpa’ would say, those money are far better invested in your education.

I do recommend the book!

21 Sep

Getting back to blogging

Posted by Tudor. Tags:

After yet another really long break, I have decided to return to blogging on this site. I’ll keep it with tech articles and reviews and hopefully will get some of my old readers back.

This post was sitting in my Drafts folder for quite some time. It’s about setting the application environment in Zend Framework applications. As you might already know, ZF applications can run in different environments – usually dev / staging / production – and the environment is set in the vhost. In most examples, you’ll find something like:

SetEnv APPLICATION_ENV development

I really don’t agree with this approach. I think that the application environment should be set in a configuration file. This way, it’s available application wide – not only to pages dispatched under Apache. For example, if the application has a cron job that runs daily and sends emails to the users – such as birthday cards or daily digests – the CLI application won’t be able to access the information stored in the vhost file and this will create all sort of problems. How I do it:

In index.php, in the first part, before bootstrapping the application:

// Load the application environment
$environmentPath = APPLICATION_PATH . '/configs/environment.php';
if (!file_exists($environmentPath)) {
	require_once 'Zend/Exception.php';
    throw new Zend_Exception(
            'Configuration file %1$s is not found. To create one, please read the comments in %1$s.example!',

require_once $environmentPath;

…then I create a simple application/configs/environment.php file:

define('APPLICATION_ENV', 'development');

…and, in order to avoid conflicts, I add the following entry in Git’s .gitignore file:


And voila! A much better way of setting the application environment!


* {
    text-transform: uppercase;


From time to time I post articles & reviews about products, services and events I like or support. This is one of those times, when I’m going to talk about two events scheduled to take place later this year:

PoolPlay Summer Academy

While not directed strictly to developers but to creatives from different industries – of course, programmers are also welcomed, in the end code is poetry, right? – PoolPlay Summer Academy is a 2 weeks camp in South Tyrol, where they improvise theatre in an empty pool. Might be worth it to go there just to turn on the water while everybody else is in the pool :P .

You can check out the PoolPlay website and / or read their flyer.

PS: they also look like they need a web designer :P

Oxygen Accelerator

Oxygen Accelerator – the programme in which I enrolled last year – is starting again, so if you have a business idea and looking for funding, mentorship and help developing your business, consider applying for Oxygen 2.0.

Now the accelerator offers a much better deal than it did last year, with up to €40,000 cash investment and 26 weeks of incubation. Check out their blog post.

19 Jun

Linus Torvalds is the MAN

Posted by Tudor. Tags:

…I remember how hard is was to get the drivers working for an Nvidia card!

16 Apr

Validate URLs in Zend Framework

Posted by Tudor. Tags: ,

I was doing some dev work, as usual in ZF, and I was surprised to find out that there’s no Zend_Validate_Url or Zend_Validate_Uri class among the framework’s default validators. Which is a bit weird, as validating URLs in a very common task in web development, much more common than, let’s say, validating a barcode or an IBAN.

But validating a URI is easy using a combination of Zend_Validate_Callback and Zend_Uri. Check it out:

$url = new Zend_Form_Element_Text('url');
		'label'      => 'Enter the URL',
		'filters'    => array(
		'validators' => array(
									'callback' => function($value) {
										return Zend_Uri::check($value);
								'messages' => array(
									Zend_Validate_Callback::INVALID_VALUE => 'Please enter a valid URL',

It still puzzles me why there’s not a standard URI validator…

13 Mar

Open .ai files in Gimp under MacOS

Posted by Tudor. Tags:

Do you know what a web designer is? A guy that wasn’t man enough to become a software developer yet not gay enough to become a fashion designer. Leaving the joke aside, design is an important part of web development. As with everything, looks do matter.

And you truly see the value of a designer when you don’t have one on the team. Like me now. I needed some graphical changes and didn’t have anyone to do them. Big problem. But I’m quite good at solving problems, and I’m not scared to try new things, so I dove in. I had some Photoshop and Illustrator files from the previous the previous designer and I thought it shouldn’t be too hard to change some colors.

The only problem was that I didn’t have Photoshop installed on my laptop. Given that Photoshop is quite pricey and I don’t want to spend money on a piece of software I use once every 6 months, I started looking for alternatives to Photoshop that work under MacOS. And the first one that popped into my mind was GIMP. Which is a good piece of software, but it comes with X11, so all MacOS shortcuts don’t work – CMD + C / CMD + V have to be replaced with CTRL + C / CTRL + V and so on, which is a bit annoying, but hey, it’s free and it does the job. Or not.

I had to open an .ai file – Adobe Illustrator – which GIMP does not support. I know that this might sound stupid, but I never used image editing software. After some googling around, I found out that GIMP is not supposed to open .ai images as these are vectorial. So I needed something that can open vectorial image formats, was free or extremely cheap. And I did: Inkscape.

So, for all developers out there, if you want to open an .ai file and don’t have Photoshop / Illustrator, install GIMP and Inkscape, open the file in Inkscape and then import it in GIMP. Maybe it will save you several hours of googling around.

23 Feb

Cisco VPN blocking other connections

Posted by Tudor. Tags: ,

I had a weird problem today with my VPN connection: when I was connected, my Cisco VPN client seemed to block all other HTTP connections. Skype & Yahoo! Messenger were working but all HTTP(S) connections on both browsers (Chrome & FF) were down. Which is extremely weird and I couldn’t pinpoint to the core of the problem.

So I did what any responsible IT person would do: googled. But I couldn’t find anything relevant. One article suggested going to “Modify » Transport” and check the “Allow Local LAN Access”. Which I did but didn’t work.

So I started playing with the network settings and at some point I got it working by changing the DNS servers to – Google’s DNS. While I’m not sure what cause the problem or if this is the right solution, I’m posting it here so maybe it will work for somebody else.