Friday, May 26, 2006

Tech: Open HTML Help via Network

May 26, 2006

I used doxygen to generate HTML help files from MS Visual Studio by using Kings' tool download from Code Project website, but when I put the outputs to the network and opened the help file, it said "Action Cancelled". This happened because Windows does not allow opening a network HTML help file, unless we specifically allow the file.

To solve the problem, we need to register the help file. This can be done intuitively by HHReg software, which is freely available at http://www.freedownloadmanager.org/downloads/make_chm_files_info/.

References:
http://www.codeproject.com/macro/KingsTools.asp, Kings' tool download page.

Monday, May 22, 2006

Pending Note: May 22-31

May22:
Matlab plotting capability:
We can now set aspect ratio, and when we want to export sth., Matlab 7.1 will capture the screen to reflect the current aspect ratio for us.
http://www.csc.fi/visualization/intensk99/matlab/

Linking problem in C++:
I got weird linking problem from template functions today. When I moved those functions from one class to another, linker did not work properly. Justin told me that we need to move its implementation to header files. Yeah, his suggestion did work.

Programming:: King's Tool--Doxygen for MS Visual Studio

I works nicely and can generate both WinHelp and HTML docs. Class hierarchy diagrams can also be generated. I highly recommend this tool.

More info and download link are available at:
http://www.codeproject.com/macro/KingsTools.asp

Matlab:: Matlab Links

For graphics:
http://www.csc.fi/visualization/intensk99/matlab/

For Reference:
Quick Ref: http://web.cz3.nus.edu.sg/~bao/teach/cz2105/matqkref.pdf

Sunday, May 21, 2006

Where are my files?

รู้สึกสับสนว่าเก็บสำรองไฟล์ไว้ที่ไหนบ้าง ดังนั้นต้องมาบันทึกและคอนเฟิร์มให้เต็มที่เลยว่าจะเก็บไว้ที่ไหน
1. Massive Backup เช่น Drive MAIN_MAXTOR หรือว่า output จาก master thesis ให้เก็บไว้ที่ Clemente W
2. Active Work (Esp. src code) ให้เก็บไว้ที่ Hornsby Z
3. Active Outputs ให้เก็บไว้ที่ไดร์ฟเราเองเพื่อใ้ห้โหลดได้เร็วๆ จะมีปัญหาเล็กน้อยตรงที่อักษรไดร์ฟอาจจะเปลี่ยนได้ระหว่างเครื่อง ดังนั้นเราอาจจะต้องทำฟังก์ชันไว้ให้เปลี่ยนไดร์ฟได้ง่ายๆ

Sunday, May 14, 2006

Pending Note: May 1 - 15, 2006

May 8, 2006
extern function to organize global function highly related to a specific class
(http://www.accu.org/begincpp/public/disc_topics/extern.html)
1. Declare a function as an extern in .h class
2. Implement it in .cpp class

May 9, 2006
Memory leakage due to CWinThread.
Memory leakage due to newVolume method in perform method.
Circular heading file when organizing the code is very hard to find.
Constructor inheritance ( : super_class_name() ) -> http://www.ugrad.cs.ubc.ca/~cs260/chnotes/ch4/Ch4Cov02.html.

Elusive memory leakage is now known. It is from NVVolume. Its destructor does not work properly.
However, I don't know what the if structure in NVVolume.h shown below for.
After I commented it out, every thing is still okay.

for (k=0; k \lessthan m_nslices; m_pdata = 0) delete k=

May 14
Default setting for inline expansion in debug mode is disabled in VS.Net 2003. To enable it, do as follows

1. right click and invoke project properties
2Go to c++ :: General
3. Change 'Debug Information Format' to 'Program Database (/Zi)'. We cannot use 'Program Database Edit & Continue (/ZI)' because it is incompatible with inline expansion feature.
4. Go to 'C/C++ :: Optimization'.
5. Change 'Inline Function Expansion' to 'Only __inline (/Ob1)'.

May 15, 2006
A. Mysterious subnet mask problem with CSE servers.
B. Mysterious rebuild and memory leak stuff. If you found memory leak in NVKernel, perhaps, you need to rebuild each project one by one. I think it is a linking problem. Oh, maybe, I actaully need to rebuild the release version of it. :: No, just rebuild each project, except the NVKernel itself.
C. virtaul inline function: if an inline function is inherited, it's must also the virtaul function, or its implementation in a subclass will not exist and linking problem occurs.

May 16, 2006
A. OpenOffice can export large poster to PDF accurately. Even better than Adobe Acrobat!!!
B. Project dependency may not be saved in a project file. Namely, if we remove a project and add it again to our solution, dependency information will lose and we need to configure it again.

May 17, 2006
A. Do what is correct and consistent with your style, although it may not the fastest. Consistency is very important to build a reliable multi-processing software. If Big-O complexity is the same, choose straightforward and consistent style.
B. A large, tall male subject :: we do not use ' large and tall' since it means two subjects, one is tall and another is large.

Saturday, May 13, 2006

คำอวยพรเนื่องในวันวิสาขบูชา

ไปอ่านบล็อกของพี่เทพมา http://thep.blogspot.com/2006/05/blog-post.html
คิดว่าเราน่าจะหาคำอวยพรเนื่องในวันวิสาขบูชามั่ง ก็คิดได้ดังนี้
ขอให้ความสงบใจจงเกิด ขอให้ศีลธรรมจงงอกงาม ขอให้ปัญญาจงสว่างไสว :)

Saturday, April 29, 2006

Prog: CPP Sensitivity

April 28, 2006:

I learned that sometimes we just can't transfer our C++ VS solution to a new machine and use it. For some unknown reason, function calls were messed up in my case. I called wrong functions; for example, my code called the function A(), but when I ran and debugged, it called B() instead. If we encounter the similar case, just try recompiling each project one by one.

Wednesday, April 12, 2006

This Week: April 10 - 16, 2006

Monday: Learn parameter-passing method for dynamic array. We need to force casting in some way, but the function signature is always float* arInput, const int SIZE.

Tuesday: Learn how to read data from binary file and learn how to save binary data to file. In reading, we cannot flush the buffer, just read again and overwrite the old data. In writing, it is much faster to perform large write (write multiple bytes). Moreover, we don't need to flush data. See Convolver class (xConvolve function).

I also learn that casting is a time consuming task. If we can provide compatible variable types, we might want to consider provide one as much as we can. It reduces running time significantly.

Wednesday: I encountered a strange problem. I cannot promote a protected member function to a public one. It causes linking problem in other projects using a library with the promoted function. I have to avoid the problem by deriving the class and build an interface to provide a way to call the protected member as a public one. I did it in VesselTreeUtilities by providing the same function name and signature. To create the function we can do it as follows:

float***
VesselTreeUtilities::init3DArrayFloat( int nNumSlc, int nNumRow, int nNumCol ) {
return CommonCore::init3DArrayFloat( nNumSlc, nNumRow, nNumCol );
}

Tuesday, April 04, 2006

Tech: Shear Transformation in Illustrator

April 4, 2006

I tried to use draw an isometric grid with some text in it. Kun-Chang suggested me to use Illustrator to draw a grid, but he did not know how to call shear transformation feature in it. In short, we want to draw a rectangular grid and shear transform it to an isometric one.

To draw a rectangular grid:
  1. Show a grid (in top menu bar)
  2. Snap to grid (in top menu bar as well)
  3. Draw a grid easily as you want
To call the feature, do not use the top menu bar, but right click on objects you want to transform, instead. We can do multiple transform by dragging an area of interest as usual. Then, choose Transform -> Shear. Next, select shear angle. The good one is 20 degree.

When export it for later use with other document, we'd better use somewhat high resolution to do that job.

Monday, April 03, 2006

Latex: \left\{ and \right.

ตามปรกติแล้วเวลาใช้ \left\{ มันจะต้องไปกับ \right\} แต่ว่าบางทีเราก็ต้องการจะเขียนแค่ \left\{ จริงๆ

ปัญหาแบบนี้แก้ได้ด้วยการใช้คำสั่ง \right. เพื่อเป็นการแจ้งกับ LaTex ว่าเราไม่ได้ลืมปิด แต่เราไม่ต้องการใส่มันเข้าไปจริงๆ

Thursday, March 23, 2006

Latex: {\tiny ... } and \begin{spacing}{1.0}

(Mar 23, 2006)
Today, I learned two new LaTex command: {\tiny ... } and \begin{spacing}{1.0} \end{spacing}

\tiny is used to make the font in the bracket specifically small.
spacing environment specifies line spacing within the environment. 1.0 is actually the default line spacing. If you want double space, say {2.0} instead.

Saturday, March 18, 2006

Latex: align and equation environments

ในตอนที่เราต้องการที่จะทำให้สมการเดียวที่ยาวต่อๆกันหลายบรรทัดจัดเรียงกันสวยๆ พร้อมกับใส่หมายเลขให้มันเป็นสมการเดียว เราอาจจะต้องใช้สอง environment ควบคู่กันไป คือ
1. ใช้ \begin{equation} \end{equation} นำ
2. ตามด้วยการใช้ \begin{aligned} \end{aligned} ไว้ที่ด้านใน
3. ใส่สมการไว้ภายใน aligned environmentg

\begin{equation}
\begin{aligned}

%Your equation is here

\end{aligned}
\end{equation}

น่าจะใช้ gather ได้แต่ไม่รู้่ว่าใช้ไงกันแน่ ถ้าใครรู้แล้วบังเอิญผ่านมาบล็อกนี้พอดีก็บอกด้วยนะ

Sunday, February 05, 2006

Computer: Picasa Test

Photo by Puvas Nandakwang Posted by Picasa

This is for testing Picasa 2's blogging capability only.

Friday, February 03, 2006

Study: Curve Fitting in Matlab

Matlab has a curve fitting toolbox that can make most of curve fitting tasks handy. If we know a formal form of a target function and perhaps can arrange it properly, curve fitting process should converge fast enough.

However, one of the major problems even when we know the formal form is that we can't arrange our term properly. In such a situation, many people try to use the generalized curve fitting capability in Matlab instead. However, it converges slower than it should be. For example, if we are going to fit hyperbolic function: y = a/(x-b), if we do not notice that this is actually a simplified version of rational form (http://www.mathworks.com/access/helpdesk/help/toolbox/curvefit/ch_fit10.html), we may resort to use general equation (http://www.mathworks.com/access/helpdesk/help/toolbox/curvefit/ch_fitt7.html#69221) . Although it is easier, it tends to converges slowly.

In case that we do not have the curve fitting toolbox, we may use an optimization toolbox instead. In fact, general equations defined in the curve fitting toolbox relies on the optimization toolbox. However, using the optimization toolbox requires more complicated management of data array.

Document on the optimization toolbox can be found at
http://www.mathworks.com/access/helpdesk/help/toolbox/optim/optim.html?BB=1.

And the most relevant page in the document is at
http://www.mathworks.com/access/helpdesk/help/toolbox/optim/ug/f3204.html#f1974

In summary, if we have a curve fitting toolbox, our curve fitting tasks will be very easy. But only optimization toolbox is sufficient. Please note that the curve fitting toolbox do not work independently; you need to have statistics and optimization toolboxes as well.

FYI:
http://www.mathworks.com/access/helpdesk/help/toolbox/curvefit/
http://www.mathworks.com/access/helpdesk/help/toolbox/optim/ug/
http://eng.usna.navy.mil/~mecheng/DESIGN/CAD/MATLAB/matlab/matlabl8.html
http://www.mathworks.com/access/helpdesk/help/toolbox/curvefit/ch_fit10.html
http://www.zoo.ufl.edu/bolker/emd-2000/lect4.html

Thursday, February 02, 2006

English: What I learned from the first draft

  1. Don't mention a thing that we will not talk about it later. Although it may look good for an introduction, it actually not good for reader at all. Try to find a new way for introduction is a better choice.
  2. When we say "the problem" for the first time, it is better to include a good adjective representing "the problem'. For example, "to alleviate the computational complexity problem". Plus, it is generally better if we show an example of a problem in the first time we mention that problem (show the computation complexity).
  3. There may be parts that are off-topic due to the scope of our article. Try to get rid of them as much as possible. Always remind ourselves that we have a specific goal, not a general goal, in every writing.

Saturday, January 14, 2006

Computer: Batch Conversion of Legacy Docs to OOo

ตามลิงค์นั่นแหละ
http://www.xml.com/pub/a/2006/01/11/from-microsoft-to-openoffice.html