Tablet problems

I got a mini heart attack today.
I got a new tablet somewhat recently. It’s an Ainol Novo 7 Venus. Today as I left work, I checked my e-mails on the tablet, it was working fine. As I got home the screen didn’t turn on, it remained dark. A little googling showed that others have seen the same problem. Which is nice, I only have to hard reset the tablet. The problem is that I couldn’t find it anywhere on the internet how to do that. So in case somebody else is looking for that too (or in the case I forget it):

To reset the Ainol Venus one must press the power and the volume up buttons together and hold them for a few seconds.

May it help to you too!

Setting up PHP CodeSniffer with NetBeans

I’m setting up phpMD / CodeSniffer into my NetBeans 7.3 on Xubuntu 12.10 again, so that I don’t have to look all the stuff up again.

First I install the plugin.

Then it complains that the underlying stuff isn’t properly configured. (Of course it isn’t as I haven’t installed anything else yet.)

Let’s start with Mess Detector, as its webpage suggests.

sudo pear channel-discover
sudo pear remote-list -c phpmd
sudo pear install phpmd/PHP_PMD

Now NetBeans’s options dialog can detect Mess Detector and it says it works fine.
The next one will be CodeSniffer.

sudo pear install PHP_CodeSniffer

And after NetBeans detects it, I set the ‘standard’ field to ‘Zend’ instead of ‘PEAR’.

The only one that remains is Copy Paste Detector. Installing it as its webpage suggests. Note: php-unit should not be installed through apt or it would cause some problems.

sudo pear config-set auto_discover 1
sudo pear install

Setting up my Apache with Zend Framework on Xubuntu 12.10

This is just a slight modification of my other post for achieving the same thing on Debian Wheezy.
I have a fresh install of Xubuntu 12.10. (Since it is based on Ubuntu, this should work just fine with Ubuntu 12.10 as well.) I use the official repositories. I’m configuring it for Zend Framework development. Other tutorials on the web describe all this a little bit differently but I am trying to set up Zend Framework for my own needs, so if this works to you then fine, if not then just look for another tutorial.

First I install Zend Framework itself.

sudo apt-get install zend-framework zend-framework-bin

I’ll also need MySQL support and xdebug.

sudo apt-get install php5-mysql php5-xdebug

Let’s see if Zend works, and create a test project.

zf create project ~/workspace/testproject testproject

It also suggest that I should create my VHOST file. Let’s add the suggested lines to the file:


The file needs to be enabled in Apache:

sudo a2ensite testproject

I’ll also need to add the testproject domain to my /etc/hosts file.

Zend will also need mod_rewrite, so I enable it too:

sudo a2enmod rewrite

For xdebug I’ll also need the necessary settings in the php.ini file. I’ll just use the settings from this xdebug tutorial. Except that I didn’t install xdebug through PECL, so I’ll use


And then finally I restart Apache.

sudo service apache2 restart

And while on Debian this worked just fine at this point, on Ubuntu I also have to create a symbolic link for the Zend library to use all my projects that I work on:

sudo ln -s /usr/share/php/libzend-framework-php/Zend/ /usr/share/php/Zend

(I don’t know if this is due to the projects’ settings, or a Zend thing, but I’m not interested in finding it out, because changing the project settings could break things on other team members’ computers.)

Debugging ‘No writers were added’ error

Recently I got some

PHP Fatal error: Uncaught exception 'Zend_Log_Exception' with message 'No writers were added'

messages in the Apache error log file. The reason is most of the time (at least in my projects) is that the Zend_Log_Writer_Stream constructor returns null. Just a reminder to myself how to solve the problem:

  1. make sure the path to the file exists
  2. if that didn’t help, make sure the file exists
  3. if that didn’t help, make sure the file is writeable by www-data.
    sudo chown www-data file.log and sudo chmod u+w file.log should do the trick.
  4. if that didn’t help, make sure the file is writeable by others.
    sudo chmod o+w file.log should do the trick.
    (No. This one should not be done. It’s bad practice, insecure, and everything. It can be used only to test that after so many hours of debugging I’m still sane, and file permissions aren’t the issue here. Or to figure out that in this particular case it isn’t www-data who wants to write the file, but some other user, for example because it’s a command line PHP script running as another user.)
  5. if that didn’t help, make sure the file isn’t open anywhere else. In my case the problem was that there was a Zend_Log descendant singleton which held a static copy of the Zend_Log_Writer_Stream which never got closed. (As an irrelevant note, we should do code reviews more often.)