2007/12/11

Principles of War

  • Objective
  • Offensive
  • Mass
  • Economy of Force
  • Maneuver
  • Unity of Command
  • Security
  • Surprise
  • Simplicity

2007/11/16

Maxim

History is a simple piece of paper covered with print.
The main thing is still to make history, not to write it.
Otto von Bismarck, the Iron Chanceller,
who is the first chanceller of German Empire
Fools say they learn from experience;
I prefer to learn from the experience of others
Otto von Bismarck, the Iron Chanceller

2007/07/22

wxPython

I use wxPython 2.8 to use GUI in Python2.5.
I write MDI application with the wxPython. I have used Python, but I used wxPython for the first time. wxPython is more useful than what I guessed.

2007/07/17

PCs' Python Upgrades from 2.4 to 2.5

Python 2.5

Python for Windows requires not environment variables but registry keys

  • [HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.5]
  • [HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.5\InstallPath]
    =c:/Python25/
  • [HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.5\InstallPath\InstallGroup]
    =Python 2.5
  • [HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.5\Modules]
  • [HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.5\PythonPath]
    ="c:/Python25/Lib;c:/Python25/DLLs;c:/Python25/Lib/lib-tk

At first, I had insalled the Python 2.5 form msi. Then, I I installed py2exe and wxPython, which require Python 2.5, by installer execution files.

2007/07/14

Enterprise Architect 7J Released

I will try to use mainly two functions;

  • Statement Table, which is compatible with Statement Chart in UML
  • Native C++ Debug for Sequence Chart in UML.

2007/07/01

Boost 1.34 installatoin memo

1.33 -> 1.34

Old Boost1.33 requires -sTOOLS parameter.
But on new Boost 1.34, this parameter is replaced with --toolset.

On Boost 1.33, "-sTOOLS=msvc" means only VC6. if you want to build with VC7.1(.NET 2003), you have to set "-sTOOLS=VC-7_1".
But now, "--toolset=msvc" means latest available VC of 6, 7.1, 8.0.
For example, if "bjam --toolset=msvc" runs on a PC installed both VC7.1 and 8.0, the bjam build Boost with the VC8.0. If you want forcely to use VC7.1 on the PC, you should set specified version explicitly, so "bjam --toolset=msvc-7_1".

VC(newest)
--toolset=msvc
VC7.1
--toolset=msvc-7_1
VC8
--toolset=msvc-8_0

2007/01/29

Conversion Between "char*" And "unsigned char*"

C++ says that one of the function of reinterpret_cast is

A pointer to an object can be explicitly converted to
a pointer to an object of different type.
and
Plain char, signed char, and unsigned char are three distinct types.
in ISO/IEC14882:2003.

Hence, as the type of string literal is const char*, following code can not be compiled in C++.

unsigned char* message = "Hello, the World.";
In this case, the code requires reinterpret_cast<unsigned char*>(foo) or static_cast<unsigned char*>(static_cast<void*>(foo)) to convert from unsigned char* to char*.

In addition, the code requires const_cast because standard conversion from const char* to char* does not apply with this case from const unsigned char* to unsigned char*.

Such casts are so dirty.

Some compilers such as VC7.1 have the option which makes literals to unsigned. But that is not standard C++ but implementation-extension.

C++ also says

A char, a signed char, and an unsigned char occupy the same
amount of storage and have the same alignment requirements.
So the conversion between unsigned char* and char* are normally safe. Hence, I think that double static_cast are well-formed. But, I wraps the casts as string_cast, because the double static_cast are too long.

string_cast sample excepted const_cast is following


template<typename OUT> OUT* string_cast(unsigned char* str);
template<typename OUT> OUT* string_cast(char* str);
template<> inline unsigned char* string_cast(char* str)
{ return static_cast<unsigned char*>(static_cast<void*>(str)); }
template<> inline char* string_cast(unsigned char* str)
{ return static_cast<char*>(static_cast<void*>(str)); }

For example, char* str and unsigned char* ustr are defined previously,
str = string_cast<char>(ustr);
or ustr = string_cast<unsinged char>(str); are fine.

How to set parameters to debugging program on Visual Studio 2019 with CMake

Solution: MSDN Sometimes the "Debug and Launch Settings for CMake" bottun is disabled. In this case, change to the target view. ...