Open Flash Chart
June 18, 2009
Today I found this website Open Flash Chart project.
It’s a FREE flash chart component and they are very beautiful! They have line, pie, and bar charts and more. I am going to try this today later, but I am just make a quick post so I can review back again.

This image is not actual flash, by the way. I just don’t have time to set it up yet.
Here is the authors comments why this beautiful commercial quality flash component is FREE.
And it’s really free?!
Yes. Once upon a time I had to deal with a company who sell flash charting components, their component had a bug that I needed fixing, so I emailed them about it asking when it’d be fixed. (Remember that I had paid real money for this software.) They were so incompetent, rude and obnoxious that after three or four weeks of emails I thought to myself “I could learn Flash and Actionscript and write my own charting component, release it as Open Source, host it on sourceforge and build up a community of helpful coders faster than they can fix a single bug.” And that is what I did. And that is why it is free. I guess the moral of the lesson is: don’t piss off your customers.
Only if I had that passion , knowledge, and the time to do this kind work. I envy him. I would like to create my own version of flash movie player, you know. But I am too lazy.
Website: Open Flash Chart project.
Open Flash Chart version 2
Thank you for visiting Remember the code?
Eclipse PDT Code Completion and Zend Framework
March 10, 2009

Hello, Thank you for visiting my remember the code blog.
I am currently trying to learn how to use Zend Framework. It is a very good and flexible framework and easier to understand compared to CakePHP or Symfony frameworks. Well I was trying some example codes with the Eclipse 3.4 & PDT 2.0 package and found some issues that code completion does not work as I want it to.
One of the biggest problem was that the code completion does not work with Zend_Regsitry. When you retrieve a object from the registry and try to execute the code completion (you can force it by Ctrl + Space), it doesn’t work, since Eclipse doesn’t know what type of data it is.
I really like Eclipse but with partially working code completion, it is very annoying and I was really hoping for the better working code completion function.
So I was searching for the various website for any quick solutions and here they are. I spent the whole day yesterday, and it was very difficult for me to gather all these information. So please enjoy and leave some comments if you can. Thanks.
1. Use PHPDoc Style definition to define data type of your custom functions arguments and return value.
//Here is the PHPDoc defined by myself right above the custom function /** * * @param mixed $config Some configuration information for the DB connection * @param CustomClass $object Special Custom Class * @return Zend_Db_Adapter_Abstract * @throws Zend_Db_Exception */ function getDbAdapter($config,$object) { //In the below line, Code Completion will work since Eclipse knows the type from the //PHPDoc @param entry. $object-> return $db; } $db=getDbAdapter($config,$object); //Code Completion will also work with $db variable below since the return type was defined // in the getDbAdapter function's PHPDoc. $db->
2. Providing code completion hints for the Class member variable.
Still PHPDoc is the answer for the code completion to work with class member variables.
class HelloClass { /** * @var Zend_Db_Adapter_Abstract */ public $db2; public function __construct() { $this->db2 = Zend_Registry::get('dbAdapter'); //Code Completion will work since @var PHPDoc was defined with the necessary class type // in the class member definition above. $this->db2-> } }
3. Make code completion working with any variable
In this case, use standard comment format with @var. This method should be used only when the code completion does not automatically work.
/* @var $variable_name ClassName */
Working Example
$registry = Zend_Registry::getInstance(); /* @var $db3 Zend_Db_Adapter_Abstract */ $db3=$registry->dbAdapter; //before using the variable for the code completion, the variable must be initialized. $db3->
One thing to be careful with the third convention is that you need to initialize the variable first before testing code completion. Most of the time, it works wonderfully, but I found that it is not working with the direct call of Zend_Registry’s get method.
/* @var $db3 Zend_Db_Adapter_Abstract */ $db3 = Zend_Registry::get('dbadapter'); $db3-> //code completion would not work because...
The reason is that the the method called had PHPDoc with @return value ‘mixed’ or ‘unknown_type’. Here is the get method from the Registry.php. As you can see, the @return value is ‘mixed’.
/** * getter method, basically same as offsetGet(). * * This method can be called from an object of type Zend_Registry, or it * can be called statically. In the latter case, it uses the default * static instance stored in the class. * * @param string $index - get the value associated with $index * @return mixed * @throws Zend_Exception if no entry is registerd for $index. */ public static function get($index) { $instance = self::getInstance(); if (!$instance->offsetExists($index)) { require_once 'Zend/Exception.php'; throw new Zend_Exception("No entry is registered for key '$index'"); } return $instance->offsetGet($index); }
Another non-working case is when the variable is assigned again after the first assignment.
/* @var $db3 Zend_Db_Adapter_Abstract */ $db3 = $abc; $dbx-> //Code completion is working here. $db3 = $def; $db3-> //code completion is not working here because $db3 was assigned more than once
Then what do you do if you want to use Zend_Registry::get() without @var comment?
You can create a custom function or class method with PHPDoc with proper @return type defined. Inside the function, the Zend_Registry::get() is called .
class GlobalUtil { /** * @return Zend_Db_Adapter_Abstract */ public static function getDbAdapter($index='') { if ($index == '') $index='dbadapter'; return Zend_Registry::get($index); } } $db=GlobalUtil::getDbAdapter(); $db-> //Code completion is working here.
There will not be much cases of using the third convention since most cases, the Eclipse will be able to handle the code completion automatically. However it’s good to know how to make it work.
Here is my last comment on the code completion. In order for the code completion to work properly, you have to have the Zend Framework files inside the project folder.
Zend Framework data files are about 20MB and I didn’t want to make duplicated copies for different php project, so I made a central location folder to store Zend library data and shared it with other PHP project by adding this folder to each project’s include path.
This idea seemed OK at first, but I realized that for some cases, the code completion didn’t work even if it was working OK when the Zend Library was located within the project folder!
The solution is very simple. You can just create a new folder within the project folder and use the advanced button to enable the ‘Link to folder in the file system’ option. Then you can browse and set the actual library folder where the actual Zend framework files are located. This will result the same effect as if the external folder is located within the project folder. Now we can have the desired code completion fully working.
So if you follow my above code completion guide , I believe that you will be able to enjoy the code completion for the most of the time. If you find the cases that the code completion is still not working , leave me a comment! I will gladly help you to resolve the problem.
Recently I moved to a new hosting provider . It’s much better than the previous one. I used to use a dedicated server but I have no time to take care the server and softwares and it was much expensive anyway. This new server provides cpanel and I like it . Its easy to use and provides powerful functions.
But there was no function to migrate or import existing mails into the newly created email account.
So I have searched the Internet and found mb2md.pl . Mbox to Maildir migration perl utility. You can download and save it into PATH registered folder and rename it to mb2md and chmod 755 mb2md to execute it.
Inbox import : Importing source_mbox_file into current maildir account. Note that /home/userid/target_dir is the root folder of your maildir account. You will need to use full path for both source file and target dir.
mb2md -s /home/userid/source_mbox_file -d /home/userid/target_dir
Multi files in a folder : multi mbox files are located in /home/userid/source_dir and the /home/userid/target_dir is the root of your maildir account. Also you need to use full path for source and target dir.
mb2md -s /home/userid/source_dir -R -d /home/userid/target_dir
After importing mutliple mboxes , you want to login to your Squirrelmail or Roundcube webmail and subscribe mailboxes to make them showing in the mailbox list.










