Expression Engine Re-visit

Sometimes ago, I talked about my view towards Expression Engine.

Time rolling forward until May, 2007. I am now determining on how to setup the community site for CECID, which we expect it will be


partly a blog, partly a forum with user activity, some static pages for file downloading purposes.



The challenge is, are the a single platform that serve it all?

Can my old mate help me out?


My first reaction is to consider about Wordpress, the tools I am most familiar with. It is easy to setup, quite extensible (due to the availability of plugin and templates) but it only shines in a single perspective - Blogging. It will be difficult to integrate other features, especially on how to share a single user account across the different function.

So, a no go. Next, Drupal and Joomla comes up in mind.

Time to think alternative


I have tried Drupal quite extensively before, when I was setting up this blog. I remember how tedious it is in both configuration and content publishing. I can't even spot out the route on how to do every thing. The admin panel is messy in short.

Joomla, it has the functions required and provide rooms for the administrator to configure the look and feel. Customization can be done, yet, it's not intuitive. I don't have much interest to try out again, but might consider to take a second look at it.

Can we have a second chance?


And EE pops up in mind again. Headed over to their new homepage (http://ellislab.com/) and noticed about the new look. Gone through the 4 video tutorial in illustrating the main concept of EE (especially the templating system) and I can grasp their templating idea. Like why it is done this way and the strength of the architecture.

They provided the forum module with a single user database, too. So, it matches functionality. What I have done next is to apply for a trial account, allowing me to try out their templating system, forum module and such. Their templating system is very powerful, the content aggregation and look of the website can be designed with ease, it is a very nice MVC implementation. Imagine, you can customize the layout of the homepage in HTML, but you have provided additional tag that allows logical operation in building up the page.

A powerful templating system



For instance, I can define the homepage to show the latest forum post summary on the right hand side, and only show the summary of each blog entry in reverse chronological order. I can even pass in arguments which the tag can understand, e.g. the number of entry to show, etc.

The content of the website can be defined into groups, e.g. product group, download group, etc. For each group, we can define the look and feel individually. I have spoted a nice layout from the Open Source Web Design web page, and have it applied to the "Product" section.

Administration and installation is also a breeze, you post the article, configure the server all in one place. The layout makes much more sense and you can decide to turn on or off certain features as you see fit.

There's always a but ...



With all these features, I am sold, but there's a downside. It is not a free software.

They offered 2 types of license, basically one for commercial and one is not. I checked with them and they said we can use the non-commercial license. This license, together with the forum module, cost the centre for about HK$1200. I would say it is reasonably charged.

Now, what's left are the building of the Information Architecture, and also the templates that will be used in the forum module.

For anyone of interest, head over to Expression Engine and get a copy of Core Edition, which is for non-profit and personal use. It has provided the templating engine already.

A Web Service Client in PEAR SOAP

In the preparation of my next episode on Hermes 2, I have been struggling on how to develop a web service client in technology other than Java. My primary candidate is definitely ruby, but I have to give up on it after playing it for a while. I just don't know how to construct a MIME message in Soap4r.

So, I headed to my second lover, PHP. From there, I have a couple of choices, NuSOAP, Pear SOAP and PHP Extension. I have decided to use Pear SOAP cause NuSOAP seems to be stopped from developing and PHP Extension is not something I am familiar with. With that said, let's move forward and see how it works.

Installation, embrace beta packages


I am not drilling into the details on how to compile PHP with Pear support, google on this topic and you should get loads of responses. There are 2 things that I feel worth mentioning.


  1. Change the preferred_state to beta so that you can install the latest version of PEAR::SOAP.


  2. pear config-set preferred_state beta



  3. After that, install all the dependency for SOAP, including Mail_MIME and Mail_DIME, if NOT, you will not be able to send multipart message.

    pear install -alldeps SOAP





Hurray! Now show me some code ...


OK ok ... First of all, create a new soap client and define the endpoint that it will be connecting to.


$url='http://images.vsmile.com:8080/corvus/httpd/ebms/sender';
$soapclient = new SOAP_Client($url);



After that, prepare the parameter which you will be sending over in the SOAP message, this parameter should be those required by the web service server for program execution. You should encapsulate all the value in the class SOAP::Value and put them into an array. Notice on the last value that I am packaging, I am using the SOAP_Attachment object which is a child of the SOAP_VALUE.


$params =
array (
new SOAP_VALUE('cpaId', 'nonEmptyToken', 'cecid'),
......
new SOAP_Attachment('SWA','text/xml','./dbhelper.xml')
)
;



Along with the program parameter, you will also need to define on how the SOAP message should be delivered. This include the document type of the message, how the file should be sent over as, etc. All these settings will again be encapsulated in an array.

From the code below, notice that I am defining the attachment will be sent over as a MIME message, i.e. a multipart message.


$options=array(
'namespace' => "http://service.ebms.edi.cecid.hku.hk/",
'soapaction' => '',
'style' => 'document',
'use' => 'literal',
'trace' => 1,
'timeout' => 30000,
'Attachments'=>'Mime'
);



With these, we can initiate the call!


$resp = $soapclient->call('query', $params, $options);



Damn it! It doesn't work!


Yes, it doesn't work to me either, until I read this.

I modified my SOAP_Base::_makeMimeMessage as instructed. Notice about the double quote surrounding "text/xml"? Axis reject the SOAP request if it is un-quoted.


$params = array('content_type' => 'multipart/related;
type=text/xml');


to


$params = array('content_type' => 'multipart/related;
type="text/xml"');


Ta-da, it works ok now!

Using WordPress as the project information repository

As illustrated in my previous post, I have selected WordPress as the tool in building up my project tracking page.

Below is a recap on what I am aiming to do,

  1. Categorize the entry
  2. Allow visitor to leave comment
  3. Searchable!
  4. Can ease my documentation effort
  5. Time tracking or something like completion
  6. Can integrate with the other resources, e.g. version control, file server, etc.


Turns out I can achieve all but the 5th requirement, which I have decided in doing it separately.

 



Categorize the entry


Setting up category is a breeze but what I want to share with you is the structure I use.

Each category of functions that I need to implement will have their own category, e.g. one of the feature we will implement is called "Document Processor", I declared it as one of the primary category and for any related smaller function will become it's child.

Apart from that, I have created task related primary category, e.g. Coding, Architecture.

So when we create a new blog entry, we firstly select the related function and then the task.

 



Allow visitor to leave comment


Searchable!


These 2 are standard features from WordPress, the only thing that once bothers me is the problem in sending out email to author when new comment is posted. But I have it resolved finally.

 



Ease my documentation effort


Originally, my ultimate goal to achieve is allowing me to run a script, gather what have been put up on the repository and have a document generated. It is good but I don't know how I could do so, have thought about using DocBook but no time to look into it yet.

So, I step back and thing, if I could generate PDF for related post and have them join togehter could be something good enough. I started looking for plugin that generates PDF file and I have found Contutto.

The installation is a snap and one could even modify the CSS file used for PDF generation. I am too lazy to have it touched up and used the default for now. Maybe I will change the layout to match how the project web site is like.

 



Integrate with the other resources, e.g. version control, file server, etc.


What I have done is to integrate the RSS feeds and provide links to the web interface of the external resources from the project page. Thus, the user can use this as the entry point in looking for anything.

I have found the Sidebar plugin a very welcoming feature, especially in integrating RSS feeds. You can get a bunch of widgets from the WordPress website and manipulating them is just some drag and drop. The use of AJAX is clever.

I used SVN for version control and WevSVN provides both the RSS feeds and a web interface for user to browse around the repository.

For files browsing, I am using a little PHP script called e-Directory Index that allows user to browse around the file server and download any of them as desired.

To fulfill my last desire, i.e. time tracking, I have once thought about developing a client that integrates with Basecamp. It's doable as the API are all nicely presented but I just don't have the time. And I am now doing this in the old fashioned way - whiteboard. On each week, I will list out the tasks that has to be completed and give a tick on the item finished.

This solution is serving well and see if there are anything that I can refine.

Tools for PHP obfuscation

We have developed a PHP application and is about to be released. And we want to obfuscate our PHP source before selling it, thus, I have evaluated different product that aimed in performing this kind of activity, I have selected to check out the following products.

  • ByteRun Protector for PHP
  • PHP Thicket Obfuscator
  • PHP Encoder

ByteRun Protector for PHP


Encoding process


ByteRun Protector for PHP is first mentioned in PHPArch, a nice review is given and steps by steps procedure in illustrating on how PHP codes can be encoded are shown. It has provided a windows only GUI interface for the user to select the projects folder and where the encoded file should put into.

The encoding comes with 3 level of security and only the PHP encoded in level “weak” can be executed with the original loader. The rest of the 2 can only operate under the loader provided. The encoding process is painless and you can encode the script with different parameter, such as expiration date for execution and domain checking. All these configuration can be saved as a “project” and you can execute individual project at anytime, to ensure the deliverable will always be encoded under the same setting.

Deployment


There are very little documentaion on how the deployment should be done, upon copying the encoded scripts to the execution platform, I have added the corresponding extension as instructed and upon execution, segmentation fault is resulted.

I have sent an email to the support but no reply from them so far. The only help I can help is a single page of html indiciating I should make sure the loader is properly loaded but it just doesn’t seems to work.

PHP Thicket Obfuscator


I have high hope on this product as they critized heavily on competiting product like those by Zend, also, they declare the PHP is obfuscated (note the different between this and encoding) and could not be reverse engineered by any decompiler available. They even claimed that, the obfuscated PHP scripts can be executed in regular loader, no customized loader will be needed.

Encoding process


The encoding process is performed in command prompt, there is a bunch of argument one can (or has to) pass into the encoding command. You have to specify which of the file (or files you listed in a project file) together with what do you want to do with it, to ease the customization, a very primitive has been provided for the user to create the project file. The building process is scriptable and can easily be merged into the building process.

I have spent hours trying to figuring out on how could I obfuscate my code to no avail, maybe I am too old in typing command? The only documents I got is some html pages, which resemble very closely to a typical “how-to” document, i.e. with a lot of word but you cannot easily follow through. I have finally given up and moved on to the next product.

PHP Encoder


Encoding process


The trial version of PHP Encoder from ionCube contains a command-line encoder (again?!), the loader and a user guide (finally!). I have followed through the user guide, and fires up the encoder (they have 2 encoders, for PHP4 and PHP5 respectively) which I only need to specify the source and output folder location.

The product has 3 different level which differs in function, like the Pro version allows the generation of time limiting license while the Cerberus version can limit the execution of the script to a certain MAC address only.

Like PHP Thicket Obfuscator, the command line execution allow us to integrate the encoding process easily into our build process. The encoder can execute on various platform like linux and windows but the licesne will be bound to a particular MAC address.

Deployment


I have copied the whole set of encoded PHP, as well as those provided by the program for loader verification to my testing machine. I fired up the testing script and it shows the steps that I need to take in order to have my encoded script to operate properly.

I have modified the php.ini as instructed, and copied the loader to a particular location and reload the testing script. It reports I am fine and then, I moved on to check my program.

Ta-da, everything just works!

I logged in and start to wander around, every functions just work like before. Then, I opened the encoded script in text editor and noticed nothing that I can understand. :)

My decision is very apparent, I would propose to use ionCube PHP Encoder for our project.