Blogs and thoughts of cpgf library

A handy Perl script tool to synchronize folders in SVN manner

Download the source code here

To execute the script, just invoke
perl syncfolder.pl SOURCE_FOLDER DEST_FOLDER

The tool synchronizes source folder to destination folder, in SVN manner. It does,

  • Add files/folders to destination folder which only exist in source folder.
  • Delete files/folders from destination folder which only exist in destination folder.
  • Override files in destination folder which exist in both source and destination folders and the file content is different. Unlike SVN, it doesn't merge files.

I wrote this tool to copy changed files from my development SVN repository to the publish repository which is hosted on Microsoft Codeplex. If you think it's useful, feel free to use or modify it on your purpose.

2013/02/22 21:35 · Wang Qi · 7 Comments

Coming 2013 is slow but still active for cpgf library development

In the coming year 2013, I will have very little time and energy on cpgf development. The reason is after some tough hesitation, I decided to switch my daily job to a China oriented company, which culture is having a lot of overtime everyday and even weekend. Apparently I will not have much spare time and energy to work on cpgf massively. That situation will last for at least the whole year 2013.

So cpgf library development will be slow in 2013.

→ Read more...

2012/12/18 08:22 · Wang Qi · 0 Comments

API design principles in cpgf library

From the first day when I designing the API in cpgf library, I had some design principles in mind and tried to stick with them. In this blog I will show the principles and give some examples.

Please note, none of any principles are found or invented by me. I was inspired by the great book “API Design for C++” and the blog Designing Qt-Style C++ APIs

→ Read more...

2012/12/01 05:21 · Wang Qi · 0 Comments

cpgf library one year birthday -- a review of past one year

cpgf library first version was released on 2011, Nov. 05. At the time I writing this blog, 2012, Nov. 24, one year has passed. One year is not quite long time for a long term open source library project, but a lot of development had been done in the year. I will give a review on what happened on cpgf in the last year. Looking back is for better looking forward!

→ Read more...

2012/11/24 09:53 · Wang Qi · 0 Comments

cpgf library 1.5.2 was released, we have meta data for Irrlicht

Oh yeah, cpgf library version 1.5.2 was released. Only one and a half months elapsed since previous version 1.5.1, how ever, the new version is an accumulated work in half a year, seriously!

→ Read more...

2012/11/23 23:41 · Wang Qi · 0 Comments

Why I prefer NULL over 0 as null pointer in C++

Today I added a new item in cpgf FAQ documentation about why 0 can be passed as pointer in Google V8 Javascript and Python, but not in Lua.

I add that entry because I found the same problem when I convert a sample code for Irrlicht engine from Javascript to Lua. In the Irrlicht sample code, 0 is used as null pointer. I'm not familiar with Irrlicht and don't know which method parameter is pointer and which is integer, so when I was converting Irrlicht C++ sample code to Javascript, I just keep 0 as it is, but when I convert the code from JS to Lua, 0 doesn't work any more. For the reason, please read the FAQ, I won't repeat myself.

That small problem makes me confirm that it's correct that I always use NULL rather than 0 as null pointer. Below I will explain it.

→ Read more...

2012/11/10 09:21 · Wang Qi · 0 Comments

Why can't GVariant be extended with unlimited data types?

Today I created a new todo task in the task system. The task is about to add a new type to GVariant to allow GVariant holds both variant data and meta type. Suddenly I had a new idea, why not to use function traits to allow the users to add arbitrary variant types to extend GVariant?

Pseudo C++ code:

// General function to create variant with built-in types
// same as how we do now
GVariant createVariant(...);
 
// The user may extend to add new variant type for FooClass
// The returned GVariant has a new variant type, such as vtFoo
GVariant createVariant(const FooClass & fooObject);

I felt excited about the new idea and almost wanted to add a new todo task for it. But then after a while, I realized the idea is completely wrong.

The reason is simple. GVariant must be platform independent and can be transferred across shared modules (DLLs).

That's how GVariant was designed for, similar as the VARIANT type in Windows Component Object Modal (COM). If we allow the users to extend GVariant with arbitrary variant types, we can't guarantee the extended type exists in another module (DLL), and we also can't guarantee the extended type has same size and layout in another module.

Though up to now cpgf is not tested in cross modules environment and it most likely can't work due to the C++ type cast on interfaces, crossing modules is our long term goal and we will definitely implement it one day in the future. So we have to take care about the crossing module ability in the very core component such as GVariant.

Because this is so important and I don't want to forget, I write down this blog to remind myself every time I review the blog. :-)

2012/09/25 09:47 · Wang Qi · 0 Comments

Why is cpgf library delivered in zip file download than public source control repository

I've been asked several times if there is any public source control repository that the users can download from, such as git or svn. My answer was and will be always no. I would always stick to provide zip files for download.

→ Read more...

2012/09/12 00:29 · Wang Qi · 0 Comments

cpgf.org was setup and transferred

The first step to setup the new web site (cpgf.org) for cpgf library is finished now!

I've chosen the great CMS system -- Dokuwiki. Don't be confused, though Dokuwiki was a Wiki system originally, it can be customized to be a great CMS, and the customization can't be simpler.

Dokuwiki is also great for documentation. With Dokuwiki, editing documentation is just same as editing a wiki page. It's just in a breeze! So I will improve documentation more frequently. Don't forget to come back!

Also Dokuwiki can be customized to be a simple blog system. Hope I can often share ideas and thoughts on cpgf library and C++ development from now on!

Now all old cpgf stuff from kbasm.com has been transferred here. So the first step is done.

In coming several weeks, I will work on,

  1. Polish the land page. Current land page is full of text and quite boring to read.
  2. Tweak the CSS.
  3. Release cpgf new version 1.5.0, which will include significantly rewritten of the script binding engine.
  4. Disclose cpgf library to more public. I didn't announce cpgf to the public at anywhere, now since we have a dedicated web site and the library is more mature, it's time to be more visible.

Let's wait for a more promising future of cpgf library!

2012/09/09 06:24 · Wang Qi · 0 Comments