Tuesday, September 27, 2011

Let's make web faster

http://code.google.com/speed/

Spdy: http://www.chromium.org/spdy

Other techniques

Thursday, September 8, 2011

Medical Image Visualization

http://www.vismd.de/doku.php?id=publications:paperall
* MevisLab: http://www.mevislab.de/fileadmin/docs/current/MeVisLab/Resources/Documentation/Publish/index.html
* Medical Imaging Toolkit: http://www.metk.net/help.html

Coding guidelines

Taken from ACCU mailing list:

 * Applied Informatics (2008). /C++ Coding Style Guide, Rules and
   Recommendations/. Retrieved on 20 August 2008.
   http://www.appinf.com/download/CppCodingStyleGuide.pdf

 * Construx (2008). /CxOne General Coding Standard/. Retrieved on 29 August 2008.
   http://www.construx.com/File.ashx?cid=787

 * Gabryelski, Keith (1997). /Wildfire C++ Programming Style, With Rationale/.
   Retrieved on 20 August 2008.
   http://www.chris-lott.org/resources/cstyle/Wildfire-C++Style.html

 * Geotechnical Software Services (April 2007). /C++ Programming Style
   Guidelines/. Retrieved on 20 August 2008.
   http://geosoft.no/development/cppstyle.html

 * Google (2008). /Google C++ Style Guide/. Retrieved on 26 August 2008.

 * Henricson, Mats , Erik Nyquist and Ellemtel Utvecklings AB (1997).
   /Industrial Strength C++/. Retrieved on 20 August 2008.
   http://hem.passagen.se/erinyq/industrial/

 * Hoff, Todd (1 March 2008). /C++ Coding Standard/. Retrieved on 20 August 2008.
   http://www.possibility.com/Cpp/CppCodingStandard.html

 * Lockheed Martin Corporation (December 2005). /Joint Strike Fighter Air
   Vehicle C++ Coding Standards/. Retrieved on 20 August 2008.
   http://www.research.att.com/%7Ebs/JSF-AV-rules.pdf

 * Philips Medical Systems (19 May 2005). Coding Standard: C#". Retrieved on
   20 August 2008.
   http://www.tiobe.com/standards/gemrcsharpcs.pdf

 * Stroustrup, Bjarne (2 May 2008). /C++ Style and Technique FAQ/. Retrieved
   on 20 August 2008.
   http://www.research.att.com/%7Ebs/bs_faq2.html

 * Sutter, Herb and Andrei Alexandrescu (November 2004). C++ Coding Standards.
   Addison–Wesley. ISBN-10 0321113586, ISBN-13 978-0321113580.
   http://www.gotw.ca/publications/c++cs.htm

 * The Programming Research Group (May 2004). /High-integrity C++ Coding
   Standard Manual, Version 2.2/. Requested from
   http://www.codingstandard.com/.

Tuesday, September 6, 2011

How to kill a process tree on Windows

Option 1: Query the system to generate the process tree, then kill each process in the tree as noted below.


http://stackoverflow.com/questions/3235218/how-terminate-child-processes-when-parent-process-terminated-in-c/5680096#5680096

However, there is a corner case that if some of the processes in the tree invokes some other processes between the step collect process <=> create tree, then we will miss the newly created process.

Option 2: Use Job Objects mechanism provided by Windows

On the topmost parent, create a Job Object and assign the current process to it. This way, the later invoked descendant processes are automatically added into the Job Object. Then we can kill the Job Object to kill the entire tree.

http://msdn.microsoft.com/en-us/library/ms684161%28VS.85%29.aspx

This option avoid the corner case on Option 1, however, we need to program the code into the parent process in order to do this. 


Example of using Job Objects from C#

http://stackoverflow.com/questions/3342941/kill-child-process-when-parent-process-is-killed


DLL Init/Cleanup sequence

See ctrdll.c 
- crtdll.c: BOOL WINAPI _CRT_INIT()
- crtdll.c: BOOL __cdecl __DllMainCRTStartup()
  ... this call _CRT_INIT()
- crtexe.c: int __tmainCRTStartup()
  ... similar to __DllMainCRTStartup()


Basic sequence for DLL_PROCESS_ATTACH
for each DLL
 - Call __CRT_INIT() -> invoke C initializers then C++ constructors
 - Call DllMain hook


Basic sequence for DLL_PROCESS_DETACH
for each DLL
 - Call DllMain hook
 - Call __CRT_INIT() -> invoke C+_ destructors and C atexit()/_onexit() ... reverse order of initialization


Basic sequence for DLL_THREAD_ATTACH and DLL_THREAD_DETACH
for each DLL
 - Call DllMain hook


CWinApp::InitInstance and CWinApp::ExitInstance are called as part of DllMain hook (they are only called for DLL_PROCESS_ATTACH and DLL_PROCESS_DETACH).


Article regarding the order of DLL loading:
http://blogs.msdn.com/b/oleglv/archive/2003/10/28/56142.aspx

"Well, turns out that the loader seems to be preserving the order in which the imported DLLs are listed in the Imports Section of the loading executable."