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.

At no time is freedom of speech more precious than when a man hits his thumb with a hammer.

~Marshall Lumsden

This is an experiment in designing an internationalization feature which I’ve been thinking about for a while. The idea is for people to come up with designs and implementations for the described requirements, and get a healthy discussion going on how to get a feature like this implemented in the best way. I’ve came up with some features and requirements which should make the design somewhat interesting.

Wanna play? If so, continue reading.

Now, let’s consider a website, which is to be deployed for several markets (in several countries), and serve both residential and corporate customers.

Requirements

A “tag” is an identifier for any given text that may be translated. The “tag” can be the text itself in the source language, or an identifier such as LABEL_CLICK_HERE, all depending on the implementation.

A tag’s content can be translated to any given language

This is the most basic feature, and does not need any explanation.

Any given market should be able to use the application in any given language

Customers in the French market should be able to view the application in German and so on. Does not sound tricky, but see next point.

A tag’s content *may* have different meaning in different markets

For example, in the US a zipCode validation error will differ from the zipCode validation error used in Spain, but surname validation errors will be the same. This also goes for descriptive texts for features and services which might differ. However, for 90%+ of the translated texts, the English translation in Spain would be the same as the english translation in the US.

A tag’s content *may* differ based on the context of the user

Imagine the front-page when a used is logged in. A text is presented here with information about available features, instructions on how to use them etc. Now, some of these features are not available for residential customers, while some are exclusive to residential customers. The usage/instructions of the features may be different for corporate customers. In addition, both residential and corporate customers have roles in the application (admin users and regular users), and the content may differ based on the role. Most of the tags will just have one content, but some may have several. The available contexts could be visualized as a tree structure, with ‘ALL’ at the top, which forks out to corporate and residential, which in turn forks out to admin / user:

Contexts

Contexts

When retrieving content for a tag the system should first look for the user’s context, for example “Residential Admin”, and if no content is present it shall select the parent etc.

Any changes to a tags’s content should be kept in a history log

Every time a tag’s content is changed, the old version should be kept for historical purposes. A nice bonus would be to be able to change a tag’s content ahead of time , that is, setting an effective date.

These are the basic requirements I’ve made up for this experiment. Now, I’d like to hear how you tackle internationalization in your application, and how you would design a implementation which would sastisfy the requriements described here. I’m working on my own implementation for this which I’d like to share after I’ve seen what other people come up with. If you have suggestions for more requirements which would make this even more interesting, please send a comment!

[tags]PHP,Internationalization[/tags]

I’ve been dormant for quite some time, mainly due to a major project going on at work. This week I’m starting my vacation, and its time to get back to all things fun. Today I got offered a spot on the Prado Developer Team, which I hope will prove to be both a challenge and a great opportunity to improve my knowledge on both the framework and PHP.

As a part-time project I’ve started building a multi-touch display surface inspired by Microsoft Surface. I’ve completed a *very* basic edition (tutorial here, and I’ve just started planning a more complicated setup along the lines of this project.

I’ll do some posts on the process as soon as I get some pictures.

[tags]PHP, Prado, Multi-touch[/tags]   

Aug 262008


After receiving quite some feedback on my post “Why Delphi for PHP should have used Prado instead of VCL” I decided to do a follow up to that post. Some of the feedback was quite interesting, hence this post was born.

First and foremost I’d like to address the feedback I got regarding the class name prefixing in VCL/PHP. I argued that the lack of class prefixes could create problems in the future, and used Prado’s T notation as as sample of something that would at least be a bit better. Let’s take a look at two VCL/PHP classes named Collection and Object. These two names are often reserved in programming langues (atleast object oriented ones). If PHP decides to introduce these two classes the VCL/PHP guys would be pretty screwed. It would involve refactoring the framework as well as applications which uses those classes. Prado on the other hand has a prefix (TCollection etc. minor, but it’s a world of difference). I assume that the VCL/PHP authors will introduce namespace support with PHP 5.3, so this issue will hopefully be a thing of the past when 5.3 ships. That said, I’m a bit curious to see how the migration / backwards compability would turn out if VCL/PHP adopt namespaces.

What I miss in the feedback I got from my previous post was people acually using VCL/PHP for enterprise applications and how that is working. From what I can tell the usage of Exceptions is still limited to the 3rd party libs such as Zend Framework which are included with VCL/PHP. That’s a bit interesting.

I’d like to touch on the comment made by Pieter Viljoen for my original post. I agree that Codegear pushed quite a toolset for the PHP community in a short time, but the underlying code is not enterprise quality. One can argue that PHP is ugly and flawed (not sure I agree on that part), but that does not mean that one should not strive for good architecture and methodology when developing frameworks on top of PHP. I see the point that VCL/PJP offers features that are interesting for starting PHP developers, but for large scale applications I just don’t see it. I’d be pretty cautious pulling in a framework without exception support if I was to create an application.

Again, I’m really interested in some feedback from someone that actually has built applications with VCL/PHP.

I’ve also noticed that there is not much activity in the VCL/PHP SVN repository. Anyone know what’s going on there?

[tags]PHP, Prado, VCL4PHP[/tags]  

If some of you recently got email saying you just made a comment here, it’s most likely due to that I moved some comments over from my old blog (http://eirikhoem.wordpress.com/). I’ll get around to answering any questions later today. Thanks for commenting!

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]


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]


My favorite PHP framework just got a new release, adding several new components and fixing 30-ish bugs. The bundled JavaScript libs (Prototype / script.aculo.us) have also been upgraded, so that should help lots of people struggling with the old versions. Head on over to PradoSoft.com to download the new version. If you are new to Prado, I recommend checking out the Prado QuickStart tutorial.

[tags]PHP,Prado,Frameworks[/tags]