PHP pthreads extension for windows x64 system

Today, I have practiced with the multithread interface of PHP with the support of this POSIX pthreads extension. However, I cannot find a version for my development environment, which is built with VC++ 9.0 compiler in 64-bit system. Therefore, I have built this extension for myself and share it here for any one need it. I have tested and used this library successful in my environment.

You can download it here:

After download this binary, extract in a new folder and copy files to your php binary folder as normal way. Remember to add extension=php_pthreads.dll to your php.ini file to load this library.

[Barcamp slide] new things in interface design with Modern UI style applications

oday, I have a presentation in Barcamp Sai Gon 2012 about the “Modern UI” and the new things it brings to the interface designer. I have shared it in my SkyDrive and everyone who is interested in can see online now. This is its content.

  • About the name of “Modern UI” and the name of “Metro”
  • The different views of a Windows 8 Modern UI styled application: portrait view, landscape view, snapped view and fill view
  • New navigation UX with Semantic Zoom, FlipView control and Group ListView/GridView
  • New commanding UX with the Appbar and the Charms
  • New application output message system

Well, this is my slideshow. Feel free to leave any comment here to help me improve it.

Use Git DVCS to manage your project versioning on local host

I wrote a post before: Introduce to the version control system. I have used SVN and Git with some free remote VCS host like Google Code or Github to manage the versioning of my projects. For a time of using these two VCS, I decided to choose Git as my main tool. Today, I will tell you the story how I use it in my work.

Why Git, not SVN?

Both Git and SVN have their own pros and conds. In my subjective point of view, Git have plus points in these things:

  • Git use only one folder called .git in the root of you working copy when SVN create a .svn sub folders in each sub folder of your working copy. The SVN annoys me a lot when creating so many hidden stuffs like that.
  • When using Git, you can push your code to any remote repositories. If you use SVN, you have to switch the repo before commiting to it.
  • Almost operations are did locally when using Git, which saves a lot of time when merging, committing, or reverting.
  • Git have a more efficient algorithm in storing data.

You, and some others, can say that SVN have it own exelent things. That is not wrong, and this post does not tent to specify which is better as well. I wrote this post for those who loves DVCS and want to use Git with there work.Before reading more, be sure that you can use Git at a basic level and have it in you machine. Otherwise, take a look at one of Git tutorials like Git Pro Book or community-edited Git book.

Create a normal repository

Create a normal repository is so simple with Git.

$> cd ~/your_pj
$> git init

After doing this, you have a working copy named your_pj and ready for version control.

Create a local “remote” repo to push to

One of the advantages of using a VCS is you can recover you work when needed. By default, the .git folder is in you own working folder. So what can you do if you delete it by accident? – Nothing. That’s why you need a remote repo.

There are many free service to host you Git repository on the internet, but most of them force you open your source code when using. Creating “remote” repo in some trusted location like your flash disk or a portable hard drive can help you use Git and keep your code from the public.

In my example, I use a flash dish labeled TOP-SECRET to store my backup repo. I use Ubuntu, so my device folder will be in /media/TOP-SECRET. After change to this directory, I used git init with a addition option to create the back up repo.

$>git init --bare your_pj_remote

Add the “remote” repo to your active one

The last thing to do is register the “remote” repository to your working copy and push the data when you want.

$>cd ~/your_pj
$>git remote add remote-repo /media/TOP-SECRET/your_pj_remote

If you want to back up your data, mount the deive and use the normal push command

$>cd ~/your_pj
$>git push remote-repo branch_name


Now, you have had your own VCS on your local. As I tell before, using a VCS will help you a lot in coding and managing your project. I hope you like Git and use it as a good utility.

My Ubuntu 11.10

Make my Ubuntu be the 11.10!

First of all, you have to upgrade you Ubuntu to the version 11.10. To do this, you can see for the upgrade process. Of course, if you are new to Ubuntu, just install a new fresh copy from your CD.

Things I did after the upgrade

Get the GNOME 3 shell extension

I love the GNOME desktop since the very early version of Ubuntu. When you may have a big trouble with the GNOME 3 on Ubuntu 11.04, this version of Ubuntu comes with the GNOME and you can easily use the GNOME 3 shell with a simple command

sudo apt-get install gnome-shell

After re logging, you can choose GNOME 3 or GNOME 3 classic on the welcome screen beside the “traditional” Ubuntu and Ubuntu 2D shell. This is my screen shot with Ubuntu 11.10 and GNOME 3 shell.

Enable my touchpad

Again and again, my touchpad becomes unusable after upgrade Ubuntu. For those who meet this bug like me, use this command to re-enable your touchpad.

gconftool-2 --set --type boolean /desktop/gnome/peripherals/touchpad/touchpad_enabled true

I found the solution here and do not assurance that it works for you. Believe to your luck!

For a longer battery life

After reading this post, I believe that install Jupiter will help me have a better performance-power balance. To get the Jupiter, open the Terminal and enter these commands

sudo add-apt-repository ppa:webupd8team/jupiter
sudo apt-get update
sudo apt-get install jupiter

You can find the icon of Jupiter on the Bottom tray of your desktop.

Decrease the window font size

The significant bad thing of GNOME 3 on Ubuntu 11.10 for me is that the system font size is to big. I did as bellow to customize my Ubuntu font settings. First, install the GNOME tweak tool from the Terminal

sudo apt-get install gnome-tweak-tool

Open it via terminal or Ubuntu “run” dialog by entering this command


Go to this page to customize the font settings

Now, take a look at my new Ubuntu

After doing all above, let see what is interesting my Ubuntu.

The return of “show the desktop” and “run dialog” shortcut as well as the System tray (bottom tray)

In this version, my two favorite shortcut becomes available again. To minimize all windows and focus on the desktop, you can press “windows key”+”D”. You can also press “Alt”+”F2” to open Ubuntu “run dialog” and quickly run programs with just a line of command. The System tray or Bottom tray is also the “new” feature of Ubuntu 11.10 (as it disappeared in the Ubuntu 11.04). It contains the icon of the programs which run “as a service” on your machine. You can find Skype, Banshee, Jupiter, Ibus … icon here.

New design of the “dash home”

The GNOME 3 brings a new look for the “dash home” to the Ubuntu 11.10. To show this view, you can press “windows key”, click the Activities button or move your mouse to the top left screen corner. The “dash home” can be considered as the “windows 7 start menu for Ubuntu”, you can browse your applications, documents and even search them. As you can see on the first figure, the “dash home” view contains several elements: a left panel with your favorite applications; the toggle panel in the right contains your current workspaces and the main area in the middle for the windows in the selected workspace or for the application browser.

The improvement in UI and UX

In my opinion, Ubuntu 11.10 has a great improvement in its UI as well as UX. The dash home, as told above, is an example. The welcome screen and the lock screen are also re-designed and make me feel better. The notifications are moved from the right to the bottom of the screen, now, it appearance no longer annoys me! Further more, many dialogs and windows have been rearranged to make the users easily to use Ubuntu.

The last thing …

I have just tried Ubuntu 11.10 for one day, there are many nice features that I cannot or do not mention in this post. But in a general view, Ubuntu 11.10 is a good OS to try, look, and explore. If you are using Ubuntu, upgrade it. If you haven’t used Ubuntu before, feel free to give it a chance.

Introduce to the version control system

Version control (aka Revision control or Source control) is the management of changes in computer files. It tracks your files over times and help you easily get back your work to a previous version. This is extremely important with a team, when many people can edit the same file.

You used it, but you don’t know …

It’s so interesting to know that you usually use the version control in your work. Perhaps there are some files named with numbers like these in your computer:

  • report-1.doc
  • report-2.doc
  • my_current_stuff_20110912.psd
  • my_current_stuff_20111011.psd

Why these file exist and have such names? You add a number or a date string to the end of the file name because you want to have a backup of your current work. If you go wrong in the future and want to have the latest good version, you can get it easily (may be not quickly). As you can see, version control plays an important roll in your work though you are not aware of it.

A version control system, huh, why do we need it?

A good version control system (VCS) will allow you to do the following stuff easily:

  • Backup and restore: files are saved when you need. You can jump to a previous version any time. You can throw many recent change and roll back to the last good version in the database. You can all so get the code from last year and what have changed when getting a bug.
  • Synchronization: all people can have a up-to-date version easily.
  • Track changes and ownership: the VCS can store the information about changes in you files and who the person who made it, which make you easily to see how a file is evolving over time.
  • Sandboxing: as its name, you can freely make and changes in you code and test it in your own computer before “checking in” what you have done.
  • Branching and merging: you can made your own copy of the code, save it in a separate location and develop it in isolation. Later, you can merge your work back into the common area.

The common words you have to know

There are many implementation of a VCS, but all of them should involve these concepts:

The basic:

  • Repository: the database storing files
  • Server: the computer has the repository
  • Client: the computer connect to the server to use the repository. The server and the client may be the same computer.
  • Trunk/Main: the primary location for your code. It is considered as the main branch of your work.

Basic actions:

  • Add: put a file (and/or a directory) into the repository in the first time.
  • Revision: the version of a file. It can be a number-liked string as 1, 2, 3, … or 1.2, 1.3, …
  • Head: the latest revision in the repository.
  • Checkout: download files from the repo to your local computer. Some VCS allow you edit the files when they were checked out, others require a explicit option when checking out, otherwise they only give you a read only version.
  • Check in: upload files to the repository. If the file exists and have changes, it will have a greater revision number. You can leave a message when checking in.
  • Changelog/History: a list of changes to a file from the time it’s added to the repository.
  • Update/Sync: ynchronize you files to the latest version (head version) of the repository.
  • Revert: throw away your local changes and roll back to the latest verion from the repo.

Advanced actions:

  • Branch: create a separate copy of your work. It is also a noun refers to the working copy which is branched.
  • Diff/Change/Delta: find the differences between two files.
  • Merge/Patch: apply changes from a file to another, for example, aplly what you did in you branch to the common work.
  • Conflict: when there are some changes which cannot be applied in a files in the same time, you know that there is a conflict.
  • Locking: make some files not allow other people to edit it. This is usually used to prevent conflict. You can unlock it later. Some person can unlock the files on purpose when needed, which is called breaking the lock.

Thanks to Kalid Azad at for this section.

Back to the real world, which tools you can use

After reading all above, you can wonder how to use a VCS, implement your own? Feel free to try, but there are many free tool can help you. SVN (subversion and GIT ( are two of them. If you are working in Linux or some console system, just get these software to your computer and you the console! For windows users, TurtoiseSVN and TurtoiseGIT (found at and can be a great choice.

Fix yahoo messenger and windows 7 gadget display error

The error manifestation

After a period of using Windows 7 or Yahoo! Messenger (Y!M), you can catch an error like this:

  • Your desktop gadgets doesn’t work and they display incorrectly
  • In the conversation window of Y!M, you cannot see either your or your partner ‘s words.

In this post, I will introduce you some ways to fixed this annoying error.

Cause of the error

There are many reasons why this evil thing happen to you. The corruption of windows registry, sidebar files or some .dll files as well as the existence of a virus can be the main factor. As a general rule of thumb, you should try from the easiest fix.

First thing to check: your windows files

Begin with your sidebar files. You can copy these file from another computer running windows 7 (of course, it current runs normally ) and paste them to the appropriate location in your one. Here, I suppose that you installed you windows in the C drive.

C:\Program Files\Windows Sidebar\sidebar.exe
C:\Program Files\Windows Sidebar\wlsrvc.dll
C:\Program Files\Windows Sidebar\Gadgets\*

Restart your computer and hope this help.

The windows .dll files error

This is also a common error of windows, you can re-register your windows .dll files to solve this problem. Open your Start menu, click Run… (or use the shortcut key “Windows key” + “R”). In the new “Run” dialogue, enter the command regsvr32 jscript.dll and click OK button, if another dialogue appears, click OK to ignore this message. Do them same thing with the command regsvr32 vbscript.dll before restarting your computer.

Check the windows registry problem

In the case that this error haven’t been solved yet, you have to check you windows registry. First, open the Registry Editor by entering the command regedt32 to the Run windows as the previous section. After the Registry Editor windows appears, you can see that it looks like the Windows Explorer windows.

Point to the key HKEY_LOCAL_MACHINE\SOFTWARE\CLASSES\CLSID\{f414c260-6ac0-11cf-b6d1-00aa00bbbb558}\In procServer32. Look at the right panel, if the data of (Default) values is different from C:\WINDOWS\SYSTEM32\JSCRIPT.DLL, modify it to correct value.

Next, go to another key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\. Look at its sub keys in the left panel. If you see a strange sub key whose name is a character like the “L” letter above the 0 sub key, delete the strange sub key. Restart your computer.

The last thing I can help

If things still go wrong, you can download my pre-built bat file and run it on your computer.