Short story: Open up /lib/udev/rules.d/70-hid2hci.rules and find the following line:

KERNEL==”hiddraw*”, ATTRS{idVendor}==”046d”, ATTRS{idProduct}==”c70[345abce]|c71[34bc]“,
RUN+=”hid2hci –method=logitech-hid –devpath=%p”

Comment those lines out as follows:

# KERNEL==”hiddraw*”, ATTRS{idVendor}==”046d”, ATTRS{idProduct}==”c70[345abce]|c71[34bc]“,
# RUN+=”hid2hci –method=logitech-hid –devpath=%p”

Save, relog. Did the charm for me. If it does not work, read up on the link from above. There are other methods involving some changes to those lines.

Somewhat longer story: I installed Ubuntu 10.04 on my desktop PC this weekend. Everything went pretty smooth, that was up to the login screen. To my amazement my Logitech MX5500 keyboard refused to work. I managed to log in using the onscreen keyboard, but when i got inside Gnome I could not get it back up. After some pretty intensive copy-and-paste action from the FireFox homepage I was able to search for “onboard” and get that back up running. Google lead me to a Ubuntu Bug Report detailing this issue,

Book review: Expert PHP 5 Tools
ISBN: 1847198384
ISBN 13: 978-1-847198-38-9
Publisher:Packt Publishing
Author:Dirk Merkel

Book cover: Expert PHP 5 Tools

Book cover: Expert PHP 5 Tools

Short version: If you are working with PHP you’ll want to read this book. Covering topics like continuous integration, documentation and unit testing thoroughly it gives an insight of great value to any PHP developer.

Slightly longer version: This book is aimed at developers already working with PHP on a daily basis, or developers which are picking up PHP. It’s main focus is the environment of the PHP developer. Areas like unit testing, continuous integration, application deployment, proper documentation and version control might already be very familiar if you have been working with PHP for a while, but this book covers each of these important areas in detail and with prime examples on do and dont’s. Even if you feel like you are doing quite well I’m sure this book will give you a few “aha!” moments. If you are coming from a hobby-background these areas might not be your strongest suit, and this book will help you get a firm grasp on what a professional PHP setup is all about. The chapter on continous integration is based around phpUnderControl, which is a nice piece of software for this purpouse. However, I would have liked to see other alternatives like for example Hudson. Luckily, moving over to a different CI app is fairly easy after having set up a phpUC installation with the phing/ant configuration.

The book is available both as paperback and eBook from Packt. I’ve been reading the eBook, which worked quite well for me. PS: Convering the PDF to ePub will destroy some of the formatting.

Check out the sample chapter Documentation with phpDocumentor

Book cover: Expert PHP 5 Tools

Book cover: Expert PHP 5 Tools

While I am currently reading PHP5 eCommerce Development I’ve also got lined up a copy of Expert PHP 5 Tools from Packt.

This book will enable you to take your PHP development skills to an enterprise level by teaching you the skills and tools necessary to write maintainable and efficient code. You will learn how to perform activities such as unit testing, enforcing coding standards, automating deployment, and interactive debugging using tools created for PHP developers – all the information in one place. Your code will be more maintainable, efficient, and self-documented.

Check out the sample chapter Documentation with phpDocumentor

I just finished the initial trial migration of a Discus v4.x based board over to vBulletin.

Now, I’d like to write a few words on Discus. I cannot see why anyone looking to set up a new board would choose this software. It’s actually file based (!). Yes, you heard me. The posts, users and threads are stored in (plain) text files. I was quite surprised the first time I got around to checking out what I was supposed to migrate. If you head over to their site and check out a demo-site or two you’ll notice that the whole board seems a bit … unprofessional. It currently sells for 149 USD, which is quite amazing when you can get vBulletin for 180USD, or even phpBB for free. I went with vBulletin because they supported (at least partial) import from Discus, as well as the email based service in case I got stuck.

Now, the data migration. Upon purchasing vBulletin I got a migration utility called ImpEx which supports quite a number of boards to import from. Discus is listed as a tier 3 board, meaning it’s not actively supported anymore.. not a good sign, but still worth a shot.

Here is a quick recap of the required actions:

1. Download vBulletin and ImpEx from vBulletin.com
2. Create a new database for vBulletin
3. Install vBulletin as described here.
4. Install the ImpEx tool as described here.
5. Configure ImpEx as described here.
6. Run the ImpEx tool for Discus

Now, in step 6 there are some modules to import. Some of them runs in a matter of seconds, while others takes up to 10 minutes in my case. I’m not sure if the script actually refreshes, so one might want to up maximum execution time for PHP to be safe.

To my surprise everything went absolutely fine. Not a single hickup in the migration scripts. After the data was imported I followed the post-migrate instructions and did some data verification. Everything seemed to be present, but I was not able to see any threads in the forums. I could find them with searching, and when I opened a thread it clearly stated that it was belonging in the correct forum. After looking around for some time I discovered that the forums from Discus was now configured to act as categories. I solved this by going to Edit Forum -> Act as Forum and set it to Yes for each forum. When I got back to the forum listing everything was in order.

The only things left is to move the forums around some, get a proper language pack and some other minor adjustments. All in I’m quite satisfied with the whole process. Kudos to vBulletin.

Some time ago a friend of mine tipped me about this article series called “What every programmer should know about memory” written by Ulrich Drepper (lead contributor and maintainer of glib). I just recently came around to start reading it. This is a 100 page long text which covers computer memory in detail, with focus on how software interacts with memory. From RAM to CPU caches the text moves on to tips on how we as programmers can improve our code when it comes to memory management and performance. A really good read which I suggest every programmer should check out.

[tags]Hardware, Memory, Unix/Linux[/tags]

When doing complex applications it’s often nice to have some sort of system for handling settings. PHP has a nice function called parse_ini_file which can be used to create a basic but still usable setting file feature. A simple class which loads the configuration file and offers some methods to retrieve the values for a given key is all that’s needed. The example I’m providing is pretty basic, but it’s still very usable and can be added to almost any application.

First, we need to create a file to hold the settings. It’s ordinary plaintext and follows the INI format.

Here is a quick sample of some key / value pairs:

[general]
locale = no_NO
company.name = MyCompany

datasource.host = localhost
datasource.database = mydb
datasource.username = user
datasource.password = 1234

The class for accessing the file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class MyConfigClass{
  protected $config;
 
    public function __construct()
    {
      $this->config = parse_ini_file('../conf/myapp.ini');
 
    }
 
    public function getConfig($key = null)
    {
      if($key !== null)
      {
        if(isset($this->config[$key]))
        {
          return $this->config[$key];
        }
        else
        {
          throw new Exception("Unknown key '$key' in configuration");
        }
      }
      else
      {
        return $this->config;
      }
    }
 
    public function setConfig($config)
    {
 
      $this->config = $config;
    }
}
 
?>

Usage:

1
2
3
$configManager = new MyConfigClass();
 
$value = $configManager->getConfig['datasource.host'];

Now, when working on larger application one usually have a application like class, and that’s a nice place to put this code. When using Prado I usually place the config code in the TApplication class.

[tags]PHP[/tags]

I’ve been struggling with lava support for Firefox after upgrading from Ubuntu 7.10 to 8.04. All I had to do was to remove the package called icedtea-gcjwebplugin. Now, I don’t know my way around Java anymore, but at least it did the trick. Worth a shot if you have problems.

Update:

John has some more information on this issue if the above didn’t do the trick:

I also needed to link to the new plugin….

cd /usr/lib/firefox-3.0/plugins$
sudo ln -s /usr/lib/jvm/java-6-sun/jre/plugin/i386/ns7/libjavaplugin_oji.so

Thanks John!

[tags]Java,Firefox,Ubuntu[/tags]


A coworker of mine has been working on a ajax enabled regex tool which lets you evaluate regex expressions in several languages (including PHP PCRE and PHP POSIX) with instant results. You can choose which functions to use, such as match, match all, replace, split etc. It also offers some basic help and hints. It’s really handy when working on those painful expressions.

You can check it out at http://regex.larsolavtorvik.com/. Stop by his blog as well.

[tags]PHP,Perl,JavaScript,Python[/tags]


Ever wanted to generated PDF documents on the fly with PHP? Perhaps populate a standard contract with a customers name and address? FPDF and FPDI are two neat libraries which greatly helps when working with PDF files. FPDF is the main library for handling PDF files, while FPDI lets your import existing PDF documents into the FPDF documents. In the code sample I’ve prepared here I’m importing a PDF template document, writing some information to the document, then sending it to the “customer”. FPDF offers several neat ways to expose the generated document, such as a stream to the browser, a string, or just storing it to file. You can download PDF Sample code to test it.

Be sure to head on over to the FPDF site and FPDI site for more information on these two libs.

Related posts:
Generated PDFs over HTTPS with Internet Explorer

[tags]PHP,PDF,Frameworks[/tags]


I just came across this post by Mike Henke, where he writes about a presentation from the Google Automating Testing Conference. Google is working on a framework based on Selenium which they use internally. The post contains some interesting slides in addition to a presentation video. I’ve embedded the video in this post for your convenience, but I suggest you give Mike a visit.

Update: Video removed, please check the links above.

[tags]PHP,Testing,Frameworks[/tags]