Code Dreamer

3/20/2014

I've used yajl, which is very attractive library for json in C.
Although, in package including a doc, 'BUILDING.win32', when I followed the guide, I've got some error.

First of all, I have no experience about CMake, and 'CMakeLists.txt' for window build, seems to have a little mistake.

For solving, let's say the path of 'yajl' package is 'D:\yajl_2_0_4_test'.(My environment is CMake 2.6 and VS2010 for visual studio command prompt.)In 'D:\yajl_2_0_4_test\CMakeLists.txt', below code have to append on line 14,

3/14/2014

Firstly, through using #pragma once directive and #ifdef guard.
Although, #pragma once is not standard, it can be recognized in MS VC++ compiler. Furthermore, it does not try to open itself, whereas #ifdef guard opens header file once, and then, if the symbol is defined, not load.
However, when I apply #pragma once in my project, I couldn't find distinct different result.
Before applying #pragma once, I was using #ifdef guard only, the build time was approximately 3 minute more.
After applying that, although the build time was shortened about several seconds, I'm not sure if there was any chance.

Second method is forwarding declaration. It means, if you just use pointer or reference of class as a class member in your header file, you don't need to include the header file which is declared the class.

And using 'impl' pattern is another well-known method, but if goal is just decreasing compile time, it may be cumbersome work in terms of additional writing code.

First of all, to turn of '/MP' switch is the most fastest and simplest method to improve build speed. '/MP' means 'build with multiple processes. In vs2010, the MP switch is turn off in default because it conflicts /Gm(Enable Minimum Rebuild).
When I turned on /MP switch, my project's compile time was shortened over 3 minutes to under one minute.

For reference a C# object in luainterface, the namespace of the reference object should be different with program main interface. For example, if I address the name of project as 'DrwaDesk', the main namespsce will be 'DrawDesk'. If I want to reference 'Book' class in luainterface, the 'Book' class should have different

Lastly, there is no sleep function in lua. So using os.time() or os.clock(), we normaly make sleep function. However, if the function call in several processes, it will throw exception. A possible solution for this, just wrap function which use the sleep function of C# and call this wrap function in Luainterface.

7/17/2013

Probably, when many people write C++ code for their own project at home, they don't seem like to follow specific guide line. So they write code according to habit or experience. However, as the length of the code is getting longer, various styles are appeared.This is why many developers try to follow Google C++ Style Guide consiciously.

cpplint.py is a python file for identifying whether follow Google C++ Style Guide. For using, just install Python 2.7(2013-07-17 currently, it doesn't work in higher version.)

The direction is simple.

Also, you can use filter option for reducing unimportant style checking.

7/07/2013

This pattern is used with polymorphism and template which are representative feature of C++ language. The main advantage of factory method is that when making new object or extending previous object, define new sublayer class and then just overriding member function which is defined as a factory method. Therefore, we don't need to analyze existing source code detaily.

7/06/2013

The simplest way is to set 'single expand' style on tree ctrl. Without 'single expand', if you just use Expand() function, you will not receive notify such as TVN_ITEMEXPANDED, TVN_ITEMEXPANDING.

However, setting 'single expand' style has also a drawback. It is that expanded item once will be collapsed again when it is unselected. This behaviour is different with usual applications' behaviour. Therefore, if remaining unselected item, you should write code like below.