2021/05/06

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.

2017/11/29

Tips (Short cut)

Tips on MS Word

Title1
Ctrl+Alt+1
Title2
Ctrl+Alt+2
Title3
Ctrl+Alt+3
Default
Ctrl+Shift+N
On Word, styles can set a short cut key through the style dialog.

Tips on OOo Writer

Title1
Ctrl+1
Title2
Ctrl+2
Title3
Ctrl+3
Default
Ctrl+0
On OOo Writer, styles can set a short kut key through the option menu.
[F11] key is the short cut of style list

Multi-character Literals

Multicharacter Literal is defined at 2.13.2 Character Literals of ISO/IEC14882:2003. The multicharacter literal contains more than one c-char, for example, 'BM'.
C++ says that the literal's type is 'int'. and its value is implementation-defined.
Most of compilers support the multicharacter literal. However, the value may differ more than Wide-character Literals on some points such as byte order, length, or character encoding between each other compilers.

HTHEME

Windows XP or later have Luna-style desktop theme.
If you want control to owner drow, deal with HTHEME handle and APIs to drow the theme. On the style, GetSysColor can not use because surface colors of controls are not a single.
Note: If you use HTHEME and APIs for it, your program is for only XP or later. If you need backward compatibility against 2K or 9x, you should need dynamic load with LoadLibrary.

Do Programs Dream of Source Code?

Do Programs Dream of Source Code?

This title is a parody of "Do Androids Dream of Electric Sheep?", which is short story of mine.

God Does Not Write Spec.

On the other hand, it is a parody of Einstein's word, "God does not play dice".

"The Prince" for children

"Kanzen Hado Manual - Hajimete no Machiavellism"(means "Perfect Kingcraft Manual - Let's study Machiavellism") is a book on "The Prince" of Machiavelli for children.
The book was revised as "Yoiko no Kunsyuron"(means "'The Prince' for good children") some days ago.
The book explains "The Prince" by examples on children of primary school. The examples are so good.

Console User Interface by Default on Linux

I changed run level to 3, which is means console user interface

Memo

"The contrary of justice is not evil vice but also another justice."
by Nohara, Hiroshi of Crayon Shin-chan.
"You play with the cards you're dealt...whatever that means"
by Snoopy of Peanuts.
"Nur ein Idiot glaubt, aus den eigenen Erfahrungen zu lernen. Ich ziehe es vor, aus den Erfahrungen anderer zu lernen, um von vorneherein eigene Fehler zu vermeiden."
(fool believes only their experiences they learned. I prefer to also learn from experiences of others, to avoid mistakes my experience causes.)
by Otto von Bismarck, "The Iron Chancellor"

Machiavelli's "The Art of War"

I bought Machiavelli's "The Art of War" in Japanese, as I found it at book store. I am going to read this starting today.
I like Machiavelli as classic politics. I have read "The Prince" over and over. Although I cannot read original text in Italian, to understand his opinions more I have different three version of "The Prince", which were translated by Ikeda Kiyoshi, Sasaki Takashi, and Kawashima Hideaki. Furthermore, I have also some primers and commentaries.

Footprint and Resources

top
Easy command line tool to see changes during execution.
size
Take footprint of each section.
getrusage
Take details of resource usage.

Performance of Smart Pointer

As parsing takes too long time, I changed the implementation of PEG parser, which was dynamic polymorphism using smart pointers, to static variables with template. Then, the parsing is ten-times faster than old version, although its compile time becomes triple.
I am going to use this version because more optimization loses readability of generated source code although even current implementation is not the most efficient. I will consider more the tuning again.

This blog is ...

This blog is mainly ...
  • design notes on my system
  • miscellaneous thoughts on development tools, methods, and languages

Svk and TortoiseSVN

Usage of Svk

Initialization
  1. $ svk depotmap --init
Mirroring from Remote Repository
  1. $ svk mirror //mirror/foo svn://bar.sample.org/svn/foo
  2. $ svk sync //mirror/foo
  3. $ svk cp -p //mirror/foo //work/foo
You SHOULD NOT commit to the local mirror, "//mirror/foo".
You SHOULD commit to the local branch, "//work/foo",
and synchronizes with svk's push and pull commands.
Check out
  1. $ svk co //work/foo foo
Synchronization from local depot to remote repository
  1. $ svk sync //mirror/foo
Synchrosization from local mirror to local branch
  1. $ svk pull //work/foo
Synchronization from local branch to local mirror and remote repository
  1. $ svk push --verbatim //foo
If the option "--verbatim" exists, comments of local branches is also used to remote repository.
If the option "lump" exists, the commitment deals with revisions in the local depot as a revision in the remote repository.

Tips -- svk with TortoiseSVN

svk makes local depots at following path in Windows by default;
C:/Documents and Settings/user/.svk/local/
You can check out a working copy from the path with TortoiseSVN without svk's check out.
For example, this URL is "file:///C:/Documents and Settings/user/.svk/local".
References (in Japanese)
"Ki no Muku Mama ni" means "I do as I likes freely" in English.

Subversion repository backup

I kept my subversion repository neat and tidy.
Memo on backup of Subversion
svnadmin dump c:/svn > backupfile

TortoiseSVN and Removable Drive

TortoiseSVN settings on removable drive is disable by default. Thus, in virtual removable drive by TrueCrypt, working directory does not overlays its icons.
[TortoiseSVN]->[settings]->[Look and Feel]->[Icon Overlays]->[Device Types]->[Removable drives]

Locale for Subversion

As newest svn use locale information, set LANGUAGE at first.

Svk setup memo

I setup svk deput in the new note PC of mine.
Initializing.
$>svk depotmap --init
Repository C:\Documents and Settings\[[local-win-user]]\.svk\local does not exist, create?
(y/n)y
$> svk mirror //mirror/[[local-project]] svn://[[remote-pc]]/[[remote-project]]
Authentication realm: <svn://[[remote-pc]]:3690> [[XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX]]
Password for '[[remote-svn-user]]':
Mirror initialized. Run svk sync //mirror/[[local-project]] to start mirroring.
checking.
$>svk mirror --list
Path Source
=============================
//mirror/[[local-project]] svn://[[remote-pc]]/svn
syncing.
$>svk sync //mirror/[[local-project]]
Syncing svn://[[remote-pc]]/[[remote-project]]
Retrieving log information from 1 to NNNN
$>svk cp -p //mirror/[[local-project]] //work//[[local-project]]
Waiting for editor...
Committed revision XXX.
Then, I backup the master repository.

Memo: Svnserve Service

sc create svnserve binpath= "\"C:\Program Files\subversion\bin\svnserve.exe\" --service --root c:\svn" displayname= "Subversion" depend= tcpip start= auto
  • svnserve.conf
    anon-access
    none
    auth-access
    write

Memo : Svnserve Service for Windows

sc create svnserve binPath= "\"C:\Program Files\subversion\bin\svnserve.exe\" --service --listen-host=0.0.0.0 --root c:\svnrootpath" DisplayName= "Subversion" depend= tcpip
If there would not be the option--listen-host=0.0.0.0, svnserve listens on IPv6 address only. Then, Tortoise SVN failed to connect the service. (IPv6 address [::] was failed...)

Svk tells "XXX is not a mirrored path" when I use no XXX

I got the error, xxx is not a mirrored path", from svk, when I try to create other new mirror depot. Although xxx is one of svk work depot, I did not use the xxx at that time.
  • #>svk mirror //mirror/zzz svn://yyy/xvn/zzz
  • XXX is not a mirrored path.
I googled such problem and its solutions. Then, I found that I have committed the xxx into not work depot but mirror depot of svk by mistake. It may cause the error on xxx.
To recover it, I tried to detach the xxx from the mirror once, but the detachment failed, too. Furthermore, svk has --recover option but it is not supported yet. I gave up recovery and rebuilt svk depot again...
Svk's source code written in Perl contains this error message at several places, which I do not recommend because I was hard to find out the code that caused the error. I think that error messages for engineer should be unique.

Svk 2.0.2

On svk version up, svk-win32 2.2.0 causes following errors at a computer of mine
Use of uninitialized value in concatenation (.) or string at
"Transaction is out of date:" svk sync
Under such condition, as svk cannot work well, new revision is added into dept whenever svl sync.
Then, I uninstalled 2.2.0 and have used svk 2.0.2 without problems.
Furthermore, the old version 2.0.0 causes access violation.

Subversion and Svk

Subversion

I use Subversion in my house, since I replaced from CVS to the Subversion. So, a private Subversion server is running on my main PC in my house, and repository is in the PC. Recently, I become to use mainly the Subversion with TortoiseSVN as version control system on work. The Subversion is useful for me.

Repository Synchronization on Offline Updates

I use Panasonic Let'sNote, the B4-size mobile PC of mine, outside of my home. My development environments, for example Visual Studio .NET 2003 SP1 and 2005, Eclipse 3.2, Python, and so on, are installed to the notebook. And, I write some codes and documents during moving.
Although I have narrow-band line over AirH, I do not want to synchronize repository through the slow line. However, no-control state is daingerous. In addition, my main PC is not open any global ports. I made other repository in the notebook and synchronized between the repositories of the notebook and the main PC manually. These operations are troublesome.

Local Dept of Destributed Svk

Then, I know Svk, the destributed versioning system on Subversion, I try to use the Svk...

Aggregates initialization in C++

Aggregates initialization

Are the extra elements always initialized, when the number of initializers is less than the number of aggregate's elements?
If brace-enclosed initializer, ISO/IEC14882:2003 $8.5.1 specifies the extra elements are value-initialized as aggregates initialization, and ISO/IEC9899:1999 specifies, too.
Otherwise, if the initialization of character arrays by string literal, ISO/IEC14882:2003 does not specify this initialization against the extra elements. $8.5.1 does not apply with the string-literal initialization by &8.5.1.
On the other hand, ISO/IEC9899:1999 specifies the initialization is same as the way of static duration storage, which means zero-initialization.
I do not know why C++ does not specify the initialization of the extra elements.
C++ may say that character arrays initialized by string-literal should be used as only strings. If a programmer want to use an array as non-string storage, the programmer should initialize the array with brace.

GNU Aspell

I am interested in GNU Aspell, the spell checker licensed under the GNU LGPL ver.2.1.
I have downloaded the Aspell for Win32, aspell-0.50.4.1-vc++-src.zip, to create my spell checker from official site.
At the first time, VC7.1 could not compile the original Aspell's source codes, because the codes were for the ancient compiler, VC6.
Then, I modified the project and source codes for VC7.1.
Next, I have derived special Tokenizer which have the following parsing rules;
[A-Z]{2,} [A-Za-z][a-z]*
"word" consists of only alphabets and is punctuated by a separator.
[^A-Za-z]
The letters excluding all the alphabets are separators.
The tokenizer skips multi-byte characters such as Japanese.

[a-z][A-Z]
An uppercase letter following a lowercase letter is a separator, too.
[A-Z]{2,}
Sequential uppercase letters are an abbreviation, which is one of words.

If the lowercase letter follows after an abbreviation, the abbreviation is punctuated before the last letter of sequential uppercase letters. In the other words, the last uppercase letter means the capital letter of a next word.
ex)SAMLuncher -> "SAM" "launcher"
These rules are for C++ or other programming language source codes. The tokenizer can check identifiers chained with underscores in C++ Standard style, and the identifiers in camel style such as Jave Standard or the Hungarian naming rules.
The new spell checker for CUI has created, and I am creating GUI version. I of course make spell checker for source codes. but, as other purpose, I want to make add-in module for Enterprise Architect (EA), because EA's spell checker does not support multi-byte characters like Japanese, although EA has already contained the spell checker, Wspell. Therefore, I am writing the GUI in ATL, because of suitability to COM.

Embedded Technology 2006 (ET2006)

Embedded Technology 2006

I went to the exhibition show "Embedded Technology 2006 (ET2006)" in Yokohama, Japan.
I am a visitor at this time of ET2006, although I was a exhibitor in EA2005 of the last year.

Mr. Kouno, the president of SSJ

I had gone to a SSJ booth, which is small section among three white walls. Though Mr. Kouno and I keep contact as each a tool vender and a customer by mail and BBS, we met directly for the first time. My first impression was that Mr. Kouno was a slim and tall man.
He showed me demonstrations of EA and its add-in product, MDG Link. I had been misunderstanding about the function which generates sequence diagram by debug trace; I had thought that not EA but the MDG Link provided the function. But Mr. Kouno taught to me that is wrong. Actually, EA without MDG Link can use the function in Java 1.4 or Java 5.

Enterprice Architect 7.0

Then, I saw two new functions of EA7.0, which is special prereleased version of EA for Japanese ET2006 show only. Mr. Kouno said that SS in Australia built the special version for Japanese users because its market is strong. I will introduce a brief of the functions to you following.
The first is renewal of Timing Diagram. The diagram can edit timings by dragging mouse. And, the diagram can also swap each timing lane by mouse operations. These are powerful on Timing design.
The next is conversion between Statement Diagram and statement matrix. The diagram can convert to statement matrix such as other matrix of EA. The matrix can make check leaks of design on statement changes and event triggers be easier.
Hence he asked me issues or problems on the two functions, thus, I proposed the matrix can convert to Excel's object (or CSV), because most of Japanese clients require documents written by Microsoft Word or Excel only. The clients, who perhaps do not know UML, will want to modify the matrix in Word documents.
However, the current EA7.0 generates the matrix into Word documents as bitmap objects. I said that it is not good, and Mr. Kouno agreed with my opinions. He said that he will tell the opinion as one of requirement to developers of SS.

Java5

My native language is international standard C++. But, I often use also other languages, for example Java. I think the Java5 becomes simple and useful language. I am going to write the servers of a new system in Java5, as I am interesting to generic of Java5.
In principle, I dislike C-style casts of C++. I think the casts are just a necessary evil. But old Java was filling with casts like C-style.The generic has removed most of explicit casts from the old Java.
The Java5 provides enum, which becomes better. I wish Java to implement const aftertime.

C++/CLI with VC++ 2005 EE

I think that C++/CLI is lovely a little. Although I am using Visual C++ 2005 Express Edition (VC++2005EE) with Windows Platform SDK, to be sure, GUI programming on the .NET framework is easier than the programming with the MFC.
It is fine that C++/CLI has most compatibility with C++. Because I disliked Managed C++, which is odd and is not beautiful, I little used the .NET framework. But, C++/CLI is not Managed C++.
Although C++/CLI did not become ISO international standards, the C++/CLI was standardized as ECMA-372 of ECMA.
For the time being, Microsoft will recommend C++/CLI on .NET framework, which is more than Managed C++ and less than C#.
C++/CLI is actually dependent on the .NET of Microsoft until the Mono Project ripens, and until other C++/CLI compilers come out, but this state of the C++/CLI may also be improved in the future.
I shall write frontend of a system on Windows in C++/CLI, which is a practical trial on the C++/CLI.

UML 2.1

Enterprise Architect(EA) is a UML tool by SSJ, which supports UML 2.1 since EA version 6.5. Now, I use the tool for UML 2.0 and does not check the newest version 2.1. But, SSJ toucht me "some words such as occurence have renamed" on BBS, then I am reading the new specification, "Unified Modeling Language: Superstructure version 2.1ptc/2006-04-02", since yesterday... I will study English more, because the reading of the specification spends more time. I am tired.
For the moment, I do not have a development plan by MDA. I think UML is effective with a sketch more than MDA.

2011/12/02

VC7.1Sp1 causes faital error C1001 internal error at L.2708 of msc1.cpp

If a narrow-string-literal parser is set for grammar with wide-character-string iterator, VC7.1SP1 causes fatal error C1001 internal error at L.2708 of msc1.cpp on compiling boost.spirit (boost v1.48).
It is a clear bug, but the error message does not explain its reason.

  • /boost_1_48_0/boost/spirit/home/qi/meta_compiler.hpp(77) : fatal error C1001: internal error ('msc1.cpp', line 2708)

Spirit's lit<> can solve the error.

2011/05/14

Heap Memory Is Not Enough to Compile Spirit - Separate Definitions

VC's fatal error yields on compiling Spirit because its grammar is too large.

Fatal Error C1076

compiler limit : internal heap limit reached; use /Zm to specify a higher limit

I had already set large heap-memory size to the compile option /Zm. Then, I moved all the grammar-rules definition from a constructor to several member functions and separated them to different translation unit. It may not be the best solution, but it resolves the heap memory problem.

// Before
class grammar_t ...
{
    ...

    grammar_t() ... {
       rule1 = ...
       rule2 = ...
       ...  // heap memory is over
    }

    rule_t  rule1;
    rule_t  rule2;
    ...
}
// After
class grammar_t ...
{
    ...

    grammar_t() ... {
       def_rule1();
       def_rule2();
       ...
    }
    void def_rule1();
    void def_rule2();
    ...

    rule_t  rule1;
    rule_t  rule2;
    ...
}

// in each translation unit (different source file)
void grammar_t::def_rule1() { rule1 = ...; }
// in each translation unit (different source file)
void grammar_t::def_rule2() { rule2 = ...; }
...

2011/04/21

Boost.Spirit Comple Error Memo Using VC7.1

The following fatal errors occurs in Boost.Spirit.Qi using VC7.1.
The same source code can be compiled using VC10.

boost_1_46_1/boost/spirit/home/qi/meta_compiler.hpp(77) : fatal error C1001: internal compiler error
(compiler file 'msc1.cpp', line 2708)

qi/meta_compiler.hpp

    // Qi primitive meta-compiler
    template <>
    struct make_component
    {
        template 
        struct result;

        template 
        struct result
        {
            typedef typename qi::make_primitive<
                typename remove_const::type,
                typename remove_reference::type>::result_type
            type; // fatal error C1001 occurs here
        };

2011/01/03

cppcheck & understand

I am searching useful static code analyzer.

Firstly, I evaluated Understand that can check the MISRA's list automatically. Although I have MISRA-C++ pdf, manual check is not effective and not efficient. I think the Understand is so nice.
But, it is too expensive to buy it for personal programming!

Next, I tried to use the cppcheck. It can check less than the Understand; however, it is free. Cppcheck could not check several codes ... progress was freezed on its way. But, it found some mistakes. When finding more useful checker, I use cppcheck now. Inexpensive checkers that support C++ is few.

Thus, I do not buy the Understand and use cppcheck.

XPEG & Hyphen(-) at the Left Bound in a Class of PEG

develog - C++: Hyphen(-) should be put at the Left Bound in a Class of PEG

I caused such error again ... So, I wrote the class, sign as "[+-]".
In this case, my XPEG reported with non-straightforward message. Then I had to find the error by reading dumped trace log.

As I got burned at the error, I changed PEG format of XPEG and made XPEG allow it.

Range <- Char '-' !']' Char / Char

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. ...