<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4435940641816407781</id><updated>2011-11-27T16:51:02.118-08:00</updated><category term='script tricks'/><category term='C++'/><category term='I recommend'/><category term='I create'/><category term='OS hacks'/><category term='Publications'/><category term='X86 secrets'/><category term='finance related'/><category term='math fun'/><category term='Java'/><category term='CV'/><category term='C51 stuff'/><category term='hardware'/><title type='text'>Always remember, you are at most yourself; and, you are at least yourself.</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>56</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-2011294791957455654</id><published>2011-07-24T19:59:00.000-07:00</published><updated>2011-07-27T01:12:25.305-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CV'/><title type='text'>Selected software projects 2005-2011</title><content type='html'>&lt;i&gt;&lt;b&gt; 0. EMC/EMI simulator IDE, 2005&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;&lt;div&gt;&lt;i&gt;&lt;b&gt;&lt;a href="http://kkshichao.blogspot.com/2007/03/minicad-stand-alone-module-i-created-to.html"&gt;&lt;span class="Apple-style-span"&gt;http://kkshichao.blogspot.com/2007/03/minicad-stand-alo&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;b&gt;&lt;a href="http://kkshichao.blogspot.com/2007/03/minicad-stand-alone-module-i-created-to.html"&gt;&lt;span class="Apple-style-span"&gt;ne-module-i-created-to.html&lt;/span&gt;&lt;/a&gt;&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;i&gt;Role: &lt;/i&gt;&lt;i&gt;Integrator and sole contributor for miniCAD module&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;i&gt;Language &amp;amp; &lt;/i&gt;&lt;i&gt;technology&lt;/i&gt;&lt;i&gt;: core Java, SWING, Java 3D, &lt;/i&gt;&lt;span class="Apple-style-span" style="border-collapse: collapse; color: rgb(51, 51, 51); font-size: 13px; line-height: 18px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "&gt;Jakarta Commons&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;i&gt;Tools &amp;amp; &lt;/i&gt;&lt;i&gt;Environment: &lt;/i&gt;&lt;/span&gt;&lt;span class="Apple-style-span"&gt;&lt;i&gt;JBuilder, Visual Studio 6, &lt;/i&gt;&lt;/span&gt;&lt;i&gt;Visual Source Safe,&lt;/i&gt;&lt;i&gt; &lt;/i&gt;&lt;i&gt;winXP/Unix&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;The whole project is a simulation studio which allows user to create/import geometry, applying surface meshing, setting up simulation parameters and submit remote simulation task over network and monitor the simulation progress and plotting simulation results in curves with xy coordinates.&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;The miniCAD is more than a scientific toy which allows researcher to create user defined geometry by keying shape and vertex information. The resulted geometry can be displayed, mouse manipulated, and surface meshed.&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;div&gt;&lt;a href="http://bp0.blogger.com/_mWsL8abaYZk/RgvB3WrKuRI/AAAAAAAAACk/1tiipQmLmvA/s1600-h/EMC0_user_input.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5047340964122376466" style="CURSOR: hand" alt="" src="http://bp0.blogger.com/_mWsL8abaYZk/RgvB3WrKuRI/AAAAAAAAACk/1tiipQmLmvA/s200/EMC0_user_input.JPG" border="0" /&gt;&lt;/a&gt; &lt;a href="http://bp0.blogger.com/_mWsL8abaYZk/RgvB3WrKuSI/AAAAAAAAACs/XfL6wcSqeIE/s1600-h/EMC1_miniCAD.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5047340964122376482" height="193" alt="" src="http://bp0.blogger.com/_mWsL8abaYZk/RgvB3WrKuSI/AAAAAAAAACs/XfL6wcSqeIE/s200/EMC1_miniCAD.JPG" width="192" border="0" style="width: 201px; cursor: pointer; height: 193px; " /&gt;&lt;/a&gt; &lt;img src="http://bp3.blogger.com/_mWsL8abaYZk/RgvDDGrKuTI/AAAAAAAAAC0/Q5J3nCzXPus/s200/EMC1_miniCAD_meshed.JPG" id="BLOGGER_PHOTO_ID_5047342265497467186" style="WIDTH: 201px; CURSOR: hand; HEIGHT: 193px" height="200" alt="" width="199" border="0" /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;b&gt;&lt;i&gt;1. ProgramManager, 2006&lt;/i&gt;&lt;/b&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;&lt;a href="http://kkshichao.blogspot.com/2007/03/programmanager-first-project-i-designed.html"&gt;&lt;span class="Apple-style-span"&gt;http://kkshichao.blogspot.com/2007/03/programmanager-first-project-i-designed.html&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;div&gt;&lt;div&gt;&lt;i&gt;Role: &lt;/i&gt;&lt;i&gt;sole contributor&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;Language &amp;amp; &lt;/i&gt;&lt;i&gt;technology&lt;/i&gt;&lt;i&gt;: core Java, SWING, JDOM&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;Tools &amp;amp; &lt;/i&gt;&lt;i&gt;Environment&lt;/i&gt;&lt;i&gt;: &lt;/i&gt;&lt;i&gt;JBuilder,&lt;/i&gt;&lt;i&gt; &lt;/i&gt;&lt;i&gt;winXP&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://bp2.blogger.com/_mWsL8abaYZk/Rgp4oGrKuLI/AAAAAAAAAB0/v6jpAScPRa0/s1600-h/pm0_login.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5046978962803833010" style="CURSOR: hand" alt="" src="http://bp2.blogger.com/_mWsL8abaYZk/Rgp4oGrKuLI/AAAAAAAAAB0/v6jpAScPRa0/s320/pm0_login.JPG" border="0" /&gt;&lt;/a&gt;&lt;img src="http://bp2.blogger.com/_mWsL8abaYZk/Rgp4yGrKuMI/AAAAAAAAAB8/LOJmRGOeMDM/s320/pm1_main.JPG" id="BLOGGER_PHOTO_ID_5046979134602524866" style="CURSOR: hand" alt="" border="0" /&gt; &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;2. FlowViewer&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;-- project leader, main contributor, 2006&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;&lt;a href="http://kkshichao.blogspot.com/2007/03/flowviewer-by-engineer-for-engineer.html"&gt;&lt;span class="Apple-style-span"&gt;http://kkshichao.blogspot.com/2007/03/flowviewer-by-engineer-for-engineer.html&lt;/span&gt;&lt;/a&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;i&gt;Role: &lt;/i&gt;&lt;i&gt;project leader, main contributor&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;Language &amp;amp; &lt;/i&gt;&lt;i&gt;technology&lt;/i&gt;&lt;i&gt;: &lt;/i&gt;&lt;i&gt;core Java, SWT, JDOM&lt;/i&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;Tools &amp;amp; &lt;/i&gt;&lt;i&gt;Environment&lt;/i&gt;&lt;i&gt;: &lt;/i&gt;&lt;i&gt;Eclipse&lt;/i&gt;&lt;i&gt;,&lt;/i&gt;&lt;i&gt; &lt;/i&gt;&lt;i&gt;winXP&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://bp2.blogger.com/_mWsL8abaYZk/Rgp8PGrKuOI/AAAAAAAAACM/Q6uw0hPivTs/s1600-h/FV0.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5046982931353614562" style="CURSOR: hand" alt="" src="http://bp2.blogger.com/_mWsL8abaYZk/Rgp8PGrKuOI/AAAAAAAAACM/Q6uw0hPivTs/s320/FV0.JPG" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;3. CPU CoreChecker &lt;/i&gt;&lt;/b&gt;&lt;b&gt;&lt;i&gt;(BIOS), 2007&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;i&gt;Role: &lt;/i&gt;&lt;i&gt;sole contributor&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;Language &amp;amp; &lt;/i&gt;&lt;i&gt;technology&lt;/i&gt;&lt;i&gt;:&lt;/i&gt;&lt;i&gt; Assembly, MASM&lt;/i&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;Tools &amp;amp; &lt;/i&gt;&lt;i&gt;Environment&lt;/i&gt;&lt;i&gt;:&lt;/i&gt;&lt;i&gt; &lt;/i&gt;&lt;i&gt;AMD x86, Microsoft Visual Studio 2005 with &lt;/i&gt;&lt;i&gt;Phenix&lt;/i&gt;&lt;i&gt; PCA, CVS&lt;/i&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;A bare bone Phenix BIOS which initializes the AMD CPU to the point just enough to detect the number of cores inside the node, and displays the information to the hardware LED port. The CoreChecker serves as a convenient daily utility tool for product engineers to check the number of cpu cores and help to identify the cpu types.&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;4. Bios Vending Machine, 2008&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;i&gt;Role: &lt;/i&gt;&lt;i&gt;key contributor for perl script&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;Language &amp;amp; &lt;/i&gt;&lt;i&gt;technology&lt;/i&gt;&lt;i&gt;: &lt;/i&gt;&lt;i&gt;Perl, HTML, JavaScript,  Assembly&lt;/i&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;Tools &amp;amp; &lt;/i&gt;&lt;i&gt;Environment&lt;/i&gt;&lt;i&gt;: &lt;/i&gt;&lt;i&gt;AMD x86, SVN&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;img src="http://1.bp.blogspot.com/-3QOUzc4k_nY/Ti0wWZ5sinI/AAAAAAAABPw/9VkpPllUpSI/s320/BIOSvendingMachine_web.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5633211870378494578" style="float: left; margin-top: 0px; margin-right: 10px; margin-bottom: 10px; margin-left: 0px; cursor: pointer; width: 320px; height: 217px; " /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;img src="http://4.bp.blogspot.com/-Mz6NHKr48rA/Ti0w2g8uB-I/AAAAAAAABP4/RAgul4SiW10/s320/BIOSvendingMachine_diagram.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5633212422026037218" style="cursor: pointer; width: 320px; height: 182px; " /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;The bios assembly code for microprocessor (CPU) from various batches and with various specs is stored in code version servers by branches and tags. The bios vending machine is actually a convenient bios binary builder with user friendly webpage front end. Selecting the  proper cpu types and features from a web form, the background scripting engine will work to download the source code to the server memory and make necessary tweak  in the source code to enable/disable certain features and invoke the corresponding bios build make files; upon successful build, the bios rom file will be provided to user through url link.&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;The background scripting is in Perl, and it is the first module I ever program using script.&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;5. Demo test solution for Pxxxxxxxc power device, 2008-2010&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;i&gt;Role: &lt;/i&gt;&lt;i&gt;sole contributor for NI PCI digitizer integration solution and dsp algorithm&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;Language &amp;amp; &lt;/i&gt;&lt;i&gt;technology&lt;/i&gt;&lt;i&gt;:&lt;/i&gt;&lt;i&gt; Visual ATE, Microsoft Visual Studio 2005&lt;/i&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;Tools &amp;amp; &lt;/i&gt;&lt;i&gt;Environment&lt;/i&gt;&lt;i&gt;: &lt;/i&gt;&lt;i&gt;winXP, &lt;/i&gt;&lt;i&gt;National Instrument IDE, SVN&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://1.bp.blogspot.com/-FlvKuJpK140/Ti0x7xIW15I/AAAAAAAABQA/7UTFb0K_MFk/s1600/NI%2B5122_plot1.JPG" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img src="http://1.bp.blogspot.com/-FlvKuJpK140/Ti0x7xIW15I/AAAAAAAABQA/7UTFb0K_MFk/s320/NI%2B5122_plot1.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5633213611780790162" style="cursor: pointer; width: 320px; height: 179px; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;In ATE testing, digitizing is usually achieved by ATE instrument inside the test head. In this project, the insufficient digitizing capability of ATE instrument is complemented by NI PCI digitizer installed inside the workstation. The digitizing function is carefully placed inside the test program and fine tuned by the aide of graphical plotting module. The digital data is processed by simple dsp algorithms to get accurate para metrics.&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;The DSP algorithm was pre-developed in Matlab and characterized by empirical testing data before it is translated into C++ functions.&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;6. Rasco handler driver with temperature control capability, 2010&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;i&gt;Role: &lt;/i&gt;&lt;i&gt;sole contributor&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;Language &amp;amp; &lt;/i&gt;&lt;i&gt;technology&lt;/i&gt;&lt;i&gt;:&lt;/i&gt;&lt;i&gt; Visual ATE, RS232, MFC&lt;/i&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;Tools &amp;amp; &lt;/i&gt;&lt;i&gt;Environment&lt;/i&gt;&lt;i&gt;: &lt;/i&gt;&lt;i&gt;Microsoft Visual Studio 6, &lt;/i&gt;&lt;i&gt;winNT&lt;/i&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;The RS232 driver is developed to empower the Rasco handler with temperature monitoring and feedback control capability, which are absent from our standard Rasco drivers.&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;i&gt;&lt;b&gt;7. Real time binning monitoring system for CX tester, 2011&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;i&gt;Role: &lt;/i&gt;&lt;i&gt;technical adviser&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;Language &amp;amp; &lt;/i&gt;&lt;i&gt;technology&lt;/i&gt;&lt;i&gt;:&lt;/i&gt;&lt;i&gt; enVision, C++, Cron Job, UDP socket&lt;/i&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;Tools &amp;amp; &lt;/i&gt;&lt;i&gt;Environment&lt;/i&gt;&lt;i&gt;:&lt;/i&gt;&lt;i&gt; g++, &lt;/i&gt;&lt;i&gt;Solaris/CentOS&lt;/i&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;The customer wishes to develop a real time binning monitoring and data logging utility during lot testing. Our testing executable engine provides such capability through a complex call back interface. Customer has to develop their software module based on good understanding of the call back mechanism. &lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;I reluctant resumed the architect and consult role knowing that several approaches has been adopted and failed after more than half a year efforts. After analyzed the failed data, I risked to discard all previous versions and re-created the skeleton of the program. I spent time to review and correct every version of customer code and managed to arrive at first workable version after 3 weeks of debugging. &lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;8. Customized front end and data-logging solution for iXXXX, 2011&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;i&gt;Role: &lt;/i&gt;&lt;i&gt;sole contributor&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;Language &amp;amp; &lt;/i&gt;&lt;i&gt;technology&lt;/i&gt;&lt;i&gt;:&lt;/i&gt;&lt;i&gt; Visual ATE, MFC, DLL&lt;/i&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;Tools &amp;amp; &lt;/i&gt;&lt;i&gt;Environment&lt;/i&gt;&lt;i&gt;:&lt;/i&gt;&lt;i&gt; &lt;/i&gt;&lt;i&gt;Microsoft Visual Studio 6, &lt;/i&gt;&lt;i&gt;winNT&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://1.bp.blogspot.com/-idYntbPJjV8/Ti0yiNJ5_kI/AAAAAAAABQI/yR8_q33wRg0/s1600/iWatt_gui1.JPG" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img src="http://1.bp.blogspot.com/-idYntbPJjV8/Ti0yiNJ5_kI/AAAAAAAABQI/yR8_q33wRg0/s320/iWatt_gui1.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5633214272138509890" style="cursor: pointer; width: 318px; height: 320px; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;This is the first project written extensively in MFC after I learned MFC programming 6, 7 years ago and after it has substantially lost its popularity on windows platform. The choice was made because of winNT restriction. (I tried to implement the module in vs2005 first, but failed to port it to winNT after few hours of tweaking.)&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;What the module does is no more than spawning a MFC-based dialog form for operator to enter misc lot setup information, validating the string entries according to customer specs and formulating those strings into proper text and returning it to client for data logging purpose.&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;I later decided to write the module in MFC in Microsoft Visual Studio 6 (winNT) and packaged it in static MFC dll. I also developed a standalone C++ executable as test driver for module testing. A minimum set of API is exported for client programming.&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-2011294791957455654?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/2011294791957455654/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2011/07/selected-software-projects.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/2011294791957455654'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/2011294791957455654'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2011/07/selected-software-projects.html' title='Selected software projects 2005-2011'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp0.blogger.com/_mWsL8abaYZk/RgvB3WrKuRI/AAAAAAAAACk/1tiipQmLmvA/s72-c/EMC0_user_input.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-7882367189651095095</id><published>2011-02-16T05:31:00.000-08:00</published><updated>2011-05-16T06:24:29.660-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Design Pattern (JAVA) : Singleton Pattern -- multithreaded</title><content type='html'>&lt;span class="Apple-style-span" style="line-height: 19px; font-family: sans-serif; "&gt;"In &lt;a href="http://en.wikipedia.org/wiki/Computer_programming" title="Computer programming" style="text-decoration: none; color: rgb(6, 69, 173); background-image: none; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: initial; "&gt;computer programming&lt;/a&gt;, &lt;b&gt;lazy initialization&lt;/b&gt; is the tactic of delaying the creation of an object, the calculation of a value, or some other expensive process until the first time it is needed."  -- wiki&lt;/span&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px; font-family: sans-serif; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="line-height: 19px; font-family: sans-serif; "&gt;The general idea behind lazy initialization is to preserve memory in a resource constrained runtime environment; however, in some cases, lazy initialization puts system stability at risk due to failed initialization at runtime.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 19px; font-family: sans-serif; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;In a multi-threaded Java program, making class constructor private and check for singularity in getInstance() method is &lt;b&gt;insufficient&lt;/b&gt;. When two threads invoke the getInstance() method simultaneously, there is still possibility of double instances being created due to interleaving. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;1) using early initialization is one option to tackle the problem here. Object is created immediately when class is loaded in JVM. Thus, there is no interleaving issues. However, this could sacrifice some system performance.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;2) making &lt;i&gt;getInstance()&lt;/i&gt; method synchronized is another option; however, this is not absolutely necessary as the real problem here is that we wish to make the singularity checking portion synchronized &lt;i&gt;only&lt;/i&gt;. Creating a synchronized method is an overkill.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;3) Since JDK 1.5, we can use the 'enum' keyword to achieve this:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;&lt;span class="Apple-style-span" style="color: rgb(32, 64, 99); font-family: Helvetica, Arial, Verdana, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: normal; "&gt;&lt;pre class="prettyprint" style="padding-top: 2px; padding-right: 2px; padding-bottom: 2px; padding-left: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(136, 136, 136); border-right-color: rgb(136, 136, 136); border-bottom-color: rgb(136, 136, 136); border-left-color: rgb(136, 136, 136); overflow-x: auto; overflow-y: auto; "&gt;public enum Singleton {&lt;br /&gt;&lt;br /&gt;INSTANCE;&lt;br /&gt;&lt;br /&gt;//Singleton method&lt;br /&gt;public void someMethod( ) {...}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;Accessing the enum singleton :&lt;br /&gt;&lt;pre class="prettyprint" style="padding-top: 2px; padding-right: 2px; padding-bottom: 2px; padding-left: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(136, 136, 136); border-right-color: rgb(136, 136, 136); border-bottom-color: rgb(136, 136, 136); border-left-color: rgb(136, 136, 136); overflow-x: auto; overflow-y: auto; "&gt;Singleton.INSTANCE.someMethod( );&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;&lt;span class="Apple-style-span" style="color: rgb(32, 64, 99); font-family: Helvetica, Arial, Verdana, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: normal; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;&lt;span class="Apple-style-span" style="color: rgb(32, 64, 99); font-family: Helvetica, Arial, Verdana, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: normal; "&gt;4) Finally the so called 'double checked locking' method:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;&lt;span class="Apple-style-span" style="color: rgb(32, 64, 99); font-family: Helvetica, Arial, Verdana, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: normal; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;&lt;span class="Apple-style-span" style="color: rgb(32, 64, 99); font-family: Helvetica, Arial, Verdana, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: normal; "&gt;&lt;pre class="prettyprint" style="padding-top: 2px; padding-right: 2px; padding-bottom: 2px; padding-left: 2px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-top-color: rgb(136, 136, 136); border-right-color: rgb(136, 136, 136); border-bottom-color: rgb(136, 136, 136); border-left-color: rgb(136, 136, 136); overflow-x: auto; overflow-y: auto; "&gt;public class Singleton {&lt;br /&gt;&lt;br /&gt; /** The unique instance **/&lt;br /&gt; private &lt;b&gt;volatile&lt;/b&gt; static Singleton instance;&lt;br /&gt;&lt;br /&gt; /** The private constructor **/&lt;br /&gt; private Singleton() {}&lt;br /&gt;&lt;br /&gt; public static Singleton getInstance() {&lt;br /&gt;   &lt;b&gt;if (instance == null) {&lt;br /&gt;       synchronized(Singleton.class) {&lt;br /&gt;          if (instance == null) {&lt;br /&gt;             instance = new Singleton();&lt;br /&gt;          }&lt;br /&gt;       }&lt;br /&gt;    }&lt;/b&gt;&lt;br /&gt;    return instance;&lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;&lt;span class="Apple-style-span" style="color: rgb(32, 64, 99); font-family: Helvetica, Arial, Verdana, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: normal; "&gt;[note, the getInstance() method is &lt;i&gt;static &lt;/i&gt;method, thus we can not use synchronized(&lt;i&gt;this&lt;/i&gt;) statement.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;&lt;span class="Apple-style-span" style="color: rgb(32, 64, 99); font-family: Helvetica, Arial, Verdana, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: normal; "&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="line-height: 19px;"&gt;&lt;span class="Apple-style-span" style="color: rgb(32, 64, 99); font-family: Helvetica, Arial, Verdana, 'Trebuchet MS', sans-serif; font-size: 13px; line-height: normal; "&gt;&lt;span class="Apple-style-span" style="font-family: Georgia, serif; font-size: 16px; color: rgb(0, 0, 0); "&gt;According to the JLS, variables declared &lt;code&gt;volatile&lt;/code&gt; are supposed to be sequentially consistent, and therefore, not reordered.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-7882367189651095095?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/7882367189651095095/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2011/02/design-pattern-java-singleton-pattern.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/7882367189651095095'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/7882367189651095095'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2011/02/design-pattern-java-singleton-pattern.html' title='Design Pattern (JAVA) : Singleton Pattern -- multithreaded'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-7126144098427029686</id><published>2010-01-20T22:50:00.000-08:00</published><updated>2010-01-20T23:53:07.730-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='finance related'/><title type='text'>Study notes 4 - lognormal distribution</title><content type='html'>&lt;span style="font-family: times new roman;"&gt;Random variable &lt;/span&gt;&lt;span style="font-family: times new roman;font-size:130%;" &gt;x&lt;/span&gt;&lt;span style="font-family: times new roman;font-size:78%;" &gt;L&lt;/span&gt;&lt;span style="font-family: times new roman;"&gt; that is continuously distributed in interval is said to have lognormal distribution described by probability density function &lt;/span&gt;&lt;span style="font-family: times new roman;font-size:130%;" &gt;f&lt;/span&gt;&lt;span style="font-family: times new roman;font-size:78%;" &gt;L&lt;/span&gt;&lt;span style="font-family: times new roman;"&gt;(&lt;/span&gt;&lt;span style="font-family: times new roman;font-size:130%;" &gt;x&lt;/span&gt;&lt;span style="font-family: times new roman;font-size:78%;" &gt;L&lt;/span&gt;&lt;span style="font-family: times new roman;"&gt;) &lt;/span&gt;&lt;span style="color: rgb(204, 0, 0); font-family: times new roman;"&gt;if&lt;/span&gt;&lt;span style="font-family: times new roman;"&gt; variable &lt;/span&gt;&lt;span style="font-family: times new roman;font-size:130%;" &gt;x&lt;/span&gt;&lt;span style="font-family: times new roman;font-size:78%;" &gt;N&lt;/span&gt;&lt;span style="font-family: times new roman;"&gt;, that is defined as &lt;/span&gt;&lt;span style="font-family: times new roman;font-size:130%;" &gt;x&lt;/span&gt;&lt;span style="font-family: times new roman;font-size:78%;" &gt;N&lt;/span&gt;&lt;span style="font-family: times new roman;"&gt;=ln&lt;/span&gt;&lt;span style="font-family: times new roman;font-size:130%;" &gt;x&lt;/span&gt;&lt;span style="font-family: times new roman;font-size:78%;" &gt;L&lt;/span&gt;&lt;span style="font-family: times new roman;"&gt;, has normal distribution described by probability density function &lt;/span&gt;&lt;span style="font-family: times new roman;font-size:130%;" &gt;f&lt;/span&gt;&lt;span style="font-family: times new roman;font-size:78%;" &gt;N&lt;/span&gt;&lt;span style="font-family: times new roman;"&gt;(&lt;/span&gt;&lt;span style="font-family: times new roman;font-size:130%;" &gt;x&lt;/span&gt;&lt;span style="font-family: times new roman;font-size:78%;" &gt;N&lt;/span&gt;&lt;span style="font-family: times new roman;"&gt;) in interval -∞ to ∞.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;Denote the mean and variance of normally distributed variable as μ and &lt;/span&gt;&lt;span style="font-family: times new roman;font-size:130%;" &gt;σ&lt;/span&gt;&lt;span style="font-family: times new roman;"&gt;2 respectively, then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: times new roman;"&gt;mean of X&lt;/span&gt;&lt;span style="font-family: times new roman;font-size:78%;" &gt;L&lt;/span&gt;&lt;span style="font-family: times new roman;"&gt; will be&lt;/span&gt;&lt;br /&gt;&lt;a style="font-family: times new roman;" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_mWsL8abaYZk/S1f9ok8lJ6I/AAAAAAAABKM/YsAOprHxdwI/s1600-h/note4_mean.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 157px;" src="http://1.bp.blogspot.com/_mWsL8abaYZk/S1f9ok8lJ6I/AAAAAAAABKM/YsAOprHxdwI/s320/note4_mean.JPG" alt="" id="BLOGGER_PHOTO_ID_5429086749372786594" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div style="font-family: times new roman;" id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div style="font-family: times new roman;" id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div style="font-family: times new roman;" id="refHTML"&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-7126144098427029686?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/7126144098427029686/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2010/01/study-notes-4-lognormal-distribution.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/7126144098427029686'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/7126144098427029686'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2010/01/study-notes-4-lognormal-distribution.html' title='Study notes 4 - lognormal distribution'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_mWsL8abaYZk/S1f9ok8lJ6I/AAAAAAAABKM/YsAOprHxdwI/s72-c/note4_mean.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-6542788820040310821</id><published>2010-01-20T00:05:00.000-08:00</published><updated>2010-01-20T23:55:34.036-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='finance related'/><title type='text'>Study notes 3 - Assumptions made by Black Scholes theory</title><content type='html'>&lt;h4  style="font-weight: bold;font-family:times new roman;"&gt;&lt;span style="font-weight: bold;font-size:78%;" &gt;&lt;span style="font-weight: normal;"&gt;The following is quoted from site &lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 153); font-weight: normal;font-size:78%;" &gt;http://hilltop.bradley.edu/~arr/bsm/pg04.html&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-weight: normal;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h4&gt;&lt;h3  style="font-weight: normal;font-family:times new roman;"&gt;&lt;span style="font-size:78%;"&gt;The Black and Scholes Option Pricing Model didn't appear overnight, in fact, Fisher Black started out working to create a  valuation model for stock warrants.  This work involved calculating a derivative to measure how the discount rate of a warrant  varies with time and stock price.  The result of this calculation held a striking resemblance to a well-known heat transfer  equation.  Soon after this discovery, Myron Scholes joined Black and the result of their work is a startlingly accurate option  pricing model.  Black and Scholes can't take all credit for their work, in fact their model is actually an improved version of a previous model developed by A. James Boness in his Ph.D. dissertation at the University of Chicago.  Black and Scholes'  improvements on the Boness model come in the form of a proof that the risk-free interest rate is the correct discount factor,  and with the absence of assumptions regarding investor's risk preferences. &lt;/span&gt;&lt;/h3&gt;  &lt;span style=";font-family:times new roman;font-size:85%;"  &gt;&lt;/span&gt;&lt;h1  style="font-weight: normal;font-family:times new roman;" align="CENTER"&gt;&lt;span style="font-size:85%;"&gt;&lt;img src="http://hilltop.bradley.edu/%7Earr/bsm/images/model.gif" alt="[Black and Scholes Model]" border="0" height="356" width="293" /&gt;&lt;/span&gt;&lt;/h1&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;&lt;br /&gt;In order to understand the model itself, we divide it into two parts. The first part, SN(d1), derives the expected benefit from acquiring a stock outright. This is found by multiplying stock price [S] by the change in the call premium with respect to a change in the underlying stock price [N(d1)]. The second part of the model, Ke(-rt)N(d2), gives the present value of paying the exercise price on the expiration day. The fair market value of the call option is then calculated by taking the difference between these two parts.&lt;br /&gt;&lt;/span&gt;&lt;h3  style="font-weight: normal;font-family:times new roman;"&gt;&lt;span style="font-size:85%;"&gt;Assumptions of the Black and Scholes Model:&lt;/span&gt;&lt;/h3&gt; &lt;p style="font-family: times new roman;"&gt; &lt;/p&gt;&lt;h4  style="font-weight: normal;font-family:times new roman;"&gt;&lt;span style="font-size:85%;"&gt;1) The stock pays no dividends during the option's life&lt;/span&gt;&lt;/h4&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;Most companies pay dividends to their share holders, so this might seem a serious limitation to the model considering the observation that higher dividend yields elicit lower call premiums. A common way of adjusting the model for this situation is to subtract the discounted value of a future dividend from the stock price.&lt;br /&gt;&lt;/span&gt;&lt;h4  style="font-weight: normal;font-family:times new roman;"&gt;&lt;span style="font-size:85%;"&gt;2) European exercise terms are used&lt;/span&gt;&lt;/h4&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;European exercise terms dictate that the option can only be exercised on the expiration date. American exercise term allow the option to be exercised at any time during the life of the option, making american options more valuable due to their greater flexibility. This limitation is not a major concern because very few calls are ever exercised before the last few days of their life. This is true because when you exercise a call early, you forfeit the remaining time value on the call and collect the intrinsic value. Towards the end of the life of a call, the remaining time value is very small, but the intrinsic value is the same.&lt;br /&gt;&lt;/span&gt;&lt;h4  style="font-weight: normal;font-family:times new roman;"&gt;&lt;span style="font-size:85%;"&gt;3) Markets are efficient&lt;/span&gt;&lt;/h4&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;This assumption suggests that people cannot consistently predict the direction of the market or an individual stock. The market operates continuously with share prices following a continuous Itô process. To understand what a continuous Itô process is, you must first know that a Markov process is "one where the observation in time period t depends only on the preceding observation." An Itô process is simply a Markov process in continuous time. If you were to draw a continuous process you would do so without picking the pen up from the piece of paper.&lt;br /&gt;&lt;/span&gt;&lt;h4  style="font-weight: normal;font-family:times new roman;"&gt;&lt;span style="font-size:85%;"&gt;4) No commissions are charged&lt;/span&gt;&lt;/h4&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;Usually market participants do have to pay a commission to buy or sell options. Even floor traders pay some kind of fee, but it is usually very small. The fees that Individual investor's pay is more substantial and can often distort the output of the model.&lt;br /&gt;&lt;/span&gt;&lt;h4  style="font-weight: normal;font-family:times new roman;"&gt;&lt;span style="font-size:85%;"&gt;5) Interest rates remain constant and known&lt;/span&gt;&lt;/h4&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;The Black and Scholes model uses the risk-free rate to represent this constant and known rate. In reality there is no such thing as the risk-free rate, but the discount rate on U.S. Government Treasury Bills with 30 days left until maturity is usually used to represent it. During periods of rapidly changing interest rates, these 30 day rates are often subject to change, thereby violating one of the assumptions of the model.&lt;br /&gt;&lt;/span&gt;&lt;h4  style="font-weight: normal;font-family:times new roman;"&gt;&lt;span style="font-size:85%;"&gt;6) Returns are lognormally distributed&lt;/span&gt;&lt;/h4&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;This assumption suggests, returns on the underlying stock are normally distributed, which is reasonable for most assets that offer opt&lt;/span&gt;&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;ions.&lt;/span&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div style="font-weight: bold; font-family: times new roman;" id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div style="font-weight: bold; font-family: times new roman;" id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div style="font-weight: bold; font-family: times new roman;" id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div style="font-family: times new roman; font-weight: bold;" id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div style="font-family: times new roman; font-weight: bold;" id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-6542788820040310821?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/6542788820040310821/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2010/01/study-notes-3-assumptions-made-by-black.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/6542788820040310821'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/6542788820040310821'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2010/01/study-notes-3-assumptions-made-by-black.html' title='Study notes 3 - Assumptions made by Black Scholes theory'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-2345619553384523433</id><published>2010-01-18T23:36:00.000-08:00</published><updated>2010-01-20T22:54:09.213-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='finance related'/><title type='text'>Study notes 2 - time value of money</title><content type='html'>This continues from my last post. I will write down some notes on Black-Scholes theory.&lt;br /&gt;&lt;br /&gt;1. time value of money.&lt;br /&gt;Basically this is about interest and it represents the 'opportunity cost'. If you choose not to invest money in options, you can receive interest with relatively low or no risk.&lt;br /&gt;&lt;br /&gt;Bearing this in mind, it will be different to receive some amount of money today as compared to receive equal amount a year later. Assuming an annual interest of i%, the amount of $Y to be received a year later will be deemed equivalent to the amount $&lt;span style="color: rgb(102, 0, 204);"&gt;Y/(1+i%) &lt;/span&gt;received today. Over here, we have introduced the concept of &lt;span style="color: rgb(102, 0, 204);"&gt;'discount factor' (1/(1+i%)) &lt;/span&gt;to help to define the effect of time value of the money.&lt;br /&gt;&lt;br /&gt;In Black-Scholes theory, with a few important mathematical assumptions made, the discount factor is calculated to be &lt;span style="color: rgb(102, 0, 204);"&gt;exp(-rT).&lt;/span&gt; It is more accurately called &lt;span style="color: rgb(102, 0, 204);"&gt;'continuously compound interest'&lt;/span&gt;. Although it looked obscured, it does ring a bell for those with engineering background, exponential decay with respect to a period of time &lt;span style="color: rgb(102, 0, 204);"&gt;T&lt;/span&gt; at a factor of &lt;span style="color: rgb(102, 0, 204);"&gt;r&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Forget about mathematics, let's climb on the giant's shoulders first.&lt;br /&gt;&lt;br /&gt;2. when you deposit your money with continuously compound interest r at t&lt;span style="font-size:85%;"&gt;0&lt;/span&gt;, then at time (t&lt;span style="font-size:85%;"&gt;0&lt;/span&gt;+t), your money plus interest will be exp(rt).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-2345619553384523433?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/2345619553384523433/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2010/01/study-notes-2-designpatternsandderivati.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/2345619553384523433'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/2345619553384523433'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2010/01/study-notes-2-designpatternsandderivati.html' title='Study notes 2 - time value of money'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-7812591886404787521</id><published>2010-01-17T22:23:00.000-08:00</published><updated>2010-01-20T22:50:12.045-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='finance related'/><title type='text'>Study notes 1 - terminology and concepts about options</title><content type='html'>I am reading the book &lt;span id=":xu"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;Design.Patterns.and.Derivatives.Pricing&lt;/span&gt; by Mark S. Joshi.  Since I am from Computer science and electronic engineering background, I have difficulty in understanding some of the financial terminologies.&lt;br /&gt;&lt;br /&gt;I had some basic financial accounting knowledge from university general electives and some stock trading experience, so I venture to do some self studying through internet searching.&lt;br /&gt;&lt;br /&gt;On chapter 1, a simple Monte Carlo model.&lt;b&gt; &lt;/b&gt;A simple Monte Carlo simulation requires five parameters input, (expiry, strike, spot, vol, r, and NumberOfPaths).&lt;b&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;The wikipedia page (http://en.wikipedia.org/wiki/Call_option) provides a very nice introduction about call options.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;1. What is an option?&lt;/span&gt;&lt;br /&gt;A call option is a contract formed between '&lt;span style="color: rgb(0, 0, 102);"&gt;caller&lt;/span&gt;' and '&lt;span style="color: rgb(0, 0, 102);"&gt;writer&lt;/span&gt;'. The caller predicts that the stock price (&lt;span style="color: rgb(0, 0, 102);"&gt;spot price&lt;/span&gt;) will rise beyond an agreed limit (i.e., the &lt;span style="color: rgb(0, 0, 102);"&gt;strike price&lt;/span&gt;) on a defined future date (&lt;span style="color: rgb(0, 0, 102);"&gt;Expiry date&lt;/span&gt;), thus he pays a premium to the writer to enter into a contract which entitles him(the 'caller') the right to &lt;span style="color: rgb(0, 0, 102);"&gt;exercise &lt;/span&gt;the option by purchasing the underlying stock from the writer at the strike price on this defined future date.&lt;br /&gt;&lt;br /&gt;The caller has the right to exercise the option at his discretion, and if he chooses to do so, the writer must agree to sell the stock.&lt;b&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;In essence, the buyer is paying for a chance to buy a stock at certain price (hopefully a discounted price), rather than to buy the real stock.&lt;br /&gt;&lt;br /&gt;In the above explanation, stock is used just for illustrative purpose; in real world, the underlying financial instrument could be different.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;2. how does an option differs from &lt;/span&gt;&lt;span style="color: rgb(0, 0, 102); font-weight: bold;"&gt;warrant&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;?&lt;/span&gt;&lt;b&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;To my understanding, from a mathematics point of view, the key difference is that warrants are &lt;span style="color: rgb(0, 0, 102);"&gt;dilutive&lt;/span&gt;, which means the company has to issue new shares when the warrants are exercised. Options is only about changing ownership of the underlying financial instruments.&lt;b&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-weight: bold;"&gt;3. how much does the buyer earn or lose?&lt;/span&gt;&lt;br /&gt;=&gt;&gt; if spot price is higher than the strike price, and yes, that is what the buyer (caller) expected, his earnings amounts to&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;S=P-(Q+R)&lt;/span&gt;&lt;br /&gt;(S) Trader A's total earnings .&lt;br /&gt;(P) Sale of stock at spot price&lt;br /&gt;(Q) Amount paid to purchase the stock at strike price upon exerise&lt;br /&gt;(R) Contract commissions (the premium paid)&lt;br /&gt;&lt;br /&gt;==&gt; or, if the spot price is lower than the strike price, obviously, it does not make sense for the buyer(caller) to exercise the option (paying higher than market price to purchase the stock), thus his total loss will be equal to -R.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;4. what is &lt;/span&gt;&lt;span style="color: rgb(0, 0, 102); font-weight: bold;"&gt;'in-the-money'&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; and &lt;/span&gt;&lt;span style="color: rgb(0, 0, 102); font-weight: bold;"&gt;payoff&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;?&lt;/span&gt;&lt;br /&gt;When the spot price is higher than the strike price, the option is said to be 'in-the-money', which means the option has monetary value to the buyer(caller).&lt;br /&gt;&lt;br /&gt;The earnings for the buyer(caller) resulting from exercising the option is called 'payoff'.&lt;br /&gt;When the option is 'in-the-money', the payoff is (spot price - strike price). Otherwise, the payoff is zero.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;5. what is &lt;/span&gt;&lt;span style="color: rgb(0, 0, 102); font-weight: bold;"&gt;over-the-counter&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; instrument?&lt;/span&gt;&lt;br /&gt;This is a bit side track. Warrants are often called over-the-counter instruments, which means it is normally traded between financial institutions without exchange facilities, as opposed to &lt;span style="color: rgb(0, 0, 102);"&gt;exchange trading&lt;/span&gt; (like you trade stock in HKSE or SGX).&lt;b&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;6. what are &lt;span style="color: rgb(0, 0, 153);"&gt;European &lt;/span&gt;call option and &lt;span style="color: rgb(0, 0, 102);"&gt;American &lt;/span&gt;call option?&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;A &lt;a href="http://en.wikipedia.org/wiki/European_option" title="European option" class="mw-redirect"&gt;European call option&lt;/a&gt; allows the holder to exercise the option (i.e., to buy) only on the option expiration date. An &lt;a href="http://en.wikipedia.org/wiki/American_option" title="American option" class="mw-redirect"&gt;American call option&lt;/a&gt; allows exercise at any time during the life of the option.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;7. Call option vs put option&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;What we have discussed above is termed call option; in layman terms, if the contract is modified to entitle the buyer to sell the underlying stock at certain price, then the option is termed put option. Here of course the buyer is taking a 'short' position towards the underlying instrument.&lt;br /&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-7812591886404787521?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/7812591886404787521/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2010/01/study-notes-1-designpatternsandderivati.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/7812591886404787521'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/7812591886404787521'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2010/01/study-notes-1-designpatternsandderivati.html' title='Study notes 1 - terminology and concepts about options'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-1903531341960634023</id><published>2009-06-30T20:28:00.000-07:00</published><updated>2009-06-30T20:35:13.673-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>Two funny types of deadlock</title><content type='html'>case 1: two mutex are used: the 1st mutex is applied, and second mutex fails, and because of the poor design, the 1st mutex is not unlocked, and this causes all other threads (including the thread which holds the 2nd mutex) to halt. Thus, the 2nd mutex is locked perpetually, and so does the 1st mutex.&lt;br /&gt;&lt;br /&gt;case 2: two mutex are used; the order of applying the mutex matters.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;   void *function1()&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;       ...&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;       pthread_mutex_lock(&amp;amp;lock1);           &lt;/span&gt;&lt;b style="color: rgb(0, 0, 102);"&gt;&lt;i&gt;- Execution step 1&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;       pthread_mutex_lock(&amp;amp;lock2);           &lt;/span&gt;&lt;b style="color: rgb(0, 0, 102);"&gt;&lt;i&gt;- Execution step 3 DEADLOCK!!!&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;       ...&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;       ...&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;       pthread_mutex_lock(&amp;amp;lock2);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;       pthread_mutex_lock(&amp;amp;lock1);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;       ...&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    } &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    void *function2()&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;       ...&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;       pthread_mutex_lock(&amp;amp;lock2);           &lt;/span&gt;&lt;b style="color: rgb(0, 0, 102);"&gt;&lt;i&gt;- Execution step 2&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;       pthread_mutex_lock(&amp;amp;lock1);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;       ...&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;       ...&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;       pthread_mutex_lock(&amp;amp;lock1);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;       pthread_mutex_lock(&amp;amp;lock2);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;       ...&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    } &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;  &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    main()&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;       ...&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;       pthread_create(&amp;amp;thread1, NULL, function1, NULL);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;       pthread_create(&amp;amp;thread2, NULL, function1, NULL);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;       ...&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-1903531341960634023?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/1903531341960634023/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2009/06/two-funny-types-of-deadlock.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/1903531341960634023'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/1903531341960634023'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2009/06/two-funny-types-of-deadlock.html' title='Two funny types of deadlock'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-3861298394230940934</id><published>2009-06-30T02:06:00.000-07:00</published><updated>2009-06-30T20:13:08.194-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>strtok_r vs. strtok</title><content type='html'>This is to demonstrate the dirty implementation of the strtok(). Try to replace strtok_r() with strtok() and observe the effect.&lt;br /&gt;===============================================================&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;int getNumberBeforeDecimal(char *decimalNumber)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;      char numBeforeDecimal[6]="";&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;      char *token, *p; &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;      strcpy(numBeforeDecimal,decimalNumber);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;      strtok_r(numBeforeDecimal, ".", &amp;amp;p);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;      token = strtok_r(NULL, ".", &amp;amp;p);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;      return atoi(token);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;int main(int argc, char *argv[])&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    char s[] = "14.23:23.41", *p;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;  &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    char *tok = strtok_r(s,":", &amp;amp;p);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    while(tok!=NULL) {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;                   int num = getNumberBeforeDecimal(tok);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;             tok = strtok_r(NULL, ":", &amp;amp;p);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;                   printf("pre-decimal: %d\n", num); &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;  &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    return 0;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;}&lt;/span&gt;&lt;br /&gt;=========================================================&lt;br /&gt;&lt;br /&gt;Basically, strtok() modifies your string and creates surprise sometimes; and, it is thread unsafe.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;This also pops to my mind that: we should always remember to declare variables to be constant if we do not intend to modify them.&lt;/span&gt;&lt;br /&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-3861298394230940934?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/3861298394230940934/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2009/06/strtokr-vs-strtok.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/3861298394230940934'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/3861298394230940934'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2009/06/strtokr-vs-strtok.html' title='strtok_r vs. strtok'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-759676701642585323</id><published>2009-06-28T20:10:00.000-07:00</published><updated>2009-06-28T20:13:28.592-07:00</updated><title type='text'>database modeling vs. database design</title><content type='html'>&lt;h1 style="color: rgb(0, 0, 102);"&gt;&lt;span style="font-size:100%;"&gt;UML for Database Design&lt;/span&gt;&lt;/h1&gt;(http://www.ibm.com/developerworks/rational/library/302.html)&lt;br /&gt;&lt;br /&gt;While database modeling focuses mostly on depicting the database, database&lt;br /&gt;design encompasses the entire process from the creation of requirements, business&lt;br /&gt;processes, logical analysis, and physical database constructs to the deployment&lt;br /&gt;of the database.&lt;br /&gt;&lt;br /&gt;to be continued...&lt;br /&gt;&lt;input id="gwProxy" type="hidden"&gt;&lt;!--Session data--&gt;&lt;input onclick="jsCall();" id="jsProxy" type="hidden"&gt;&lt;div id="refHTML"&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-759676701642585323?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/759676701642585323/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2009/06/database-modeling-vs-database-design.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/759676701642585323'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/759676701642585323'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2009/06/database-modeling-vs-database-design.html' title='database modeling vs. database design'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-8269055428680280168</id><published>2009-03-12T20:51:00.000-07:00</published><updated>2009-03-13T00:37:52.486-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='I create'/><title type='text'>Design Pattern (JAVA) : Singleton Pattern (2)</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Singleton with lazy initialization implementation&lt;/span&gt;:&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;final &lt;/span&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;class Singleton {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;  &lt;span style="color: rgb(102, 0, 0);"&gt;private &lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;static &lt;/span&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;Singleton s;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;  &lt;span style="color: rgb(102, 0, 0);"&gt;private &lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;static &lt;/span&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;int i;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;  &lt;span style="color: rgb(102, 0, 0);"&gt;private &lt;/span&gt;Singleton(int x) { i = x; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;  public static Singleton getReference() {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;    s = new Singleton(47);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;    return s;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;  public int getValue() { return i; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;  public void setValue(int x) { i = x; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;without lazy initialization:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;final &lt;/span&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;class Singleton {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;  &lt;span style="color: rgb(102, 0, 0);"&gt;private &lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;&lt;span style="color: rgb(102, 0, 0);"&gt;static&lt;/span&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;Singleton s = new Singleton(47);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;  &lt;span style="color: rgb(102, 0, 0);"&gt;private &lt;/span&gt;int i;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;  &lt;span style="color: rgb(102, 0, 0);"&gt;private &lt;/span&gt;Singleton(int x) { i = x; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;  public static Singleton getReference() {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;    return s;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;  public int getValue() { return i; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;  public void setValue(int x) { i = x; }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;So points to note about the singleton pattern:&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;1) we have to create our own &lt;span style="color: rgb(102, 0, 0);"&gt;private &lt;/span&gt;version of the constructor in order to suppress the default constructor which will be spawn by the compiler.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;2) we will create a &lt;span style="color: rgb(102, 0, 0);"&gt;public &lt;/span&gt;getReference() or getInstance() method for client to access the class.&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;3) we will take extra caution about ensuring class members are static if we wish to implement lazy initialization.&lt;br /&gt;4) we will make the class &lt;span style="color: rgb(102, 0, 0);"&gt;final &lt;/span&gt;in order to prevent client to extend this class and make it clone able accidentally.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-8269055428680280168?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/8269055428680280168/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2009/03/design-pattern-java-singleton-pattern-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/8269055428680280168'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/8269055428680280168'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2009/03/design-pattern-java-singleton-pattern-2.html' title='Design Pattern (JAVA) : Singleton Pattern (2)'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-4396715662822400189</id><published>2009-03-11T23:23:00.000-07:00</published><updated>2009-03-13T00:39:25.818-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='I create'/><title type='text'>Design Pattern (JAVA) : Singleton Pattern</title><content type='html'>Design patterns summarize proven solutions for typical object oriented programming problems and help to minimize the design effort and eliminate the common mistakes. To understand the necessity of design patterns, we can always look at the problems and begin by tackling it with alternative  or brutal force methods, and learn to appreciate the beauty and implications of design patterns.&lt;br /&gt;&lt;br /&gt;In many cases, we wish to maintain a single instance of certain class at run time, e.g., we may wish to keep one single connection to a specific database, or we wish to a have  a single sequential number generator to avoid duplication.&lt;br /&gt;&lt;br /&gt;We can approach the problem in a few ways, and let's analyze them one by one:&lt;br /&gt;a) We can create a 'global' instance of the class, and let all clients use this instance for activities associated with the class. This is fine provided that every client knows about such arrangement and follow it rigidly and diligently. In other words, we are delegating part of the class design responsibility to the 'customers' of the class. This is a sub-optimal solution.&lt;br /&gt;&lt;br /&gt;b) We can monitor and control the class instantiation inside the class definition; we could create a static class member which might be boolean or int, and let the class constructor check it before class creation; no class will be created if the check fails. Yes, this sounds logical and feasible. The next thing we need to consider is: what to do if the check fails? How does the client know about the class instantiation failure? Remember that constructor method does &lt;span style="color: rgb(0, 0, 153);"&gt;NOT &lt;/span&gt;return anything as normal method does. A simple solution would be to let the constructor method throw out an exception, and let the client check and handle the exceptions.&lt;br /&gt;&lt;br /&gt;Okay, this looks better, but still a little bit troublesome, right?&lt;br /&gt;&lt;br /&gt;c) Using static methods.&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;class PrintSpooler&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;    &lt;span style="color: rgb(102, 0, 0);"&gt;static &lt;/span&gt;String str;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;    //a static class implementation of Singleton pattern&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;    &lt;span style="color: rgb(102, 0, 0);"&gt;static &lt;/span&gt;public void set(String s)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;          str = s;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;    &lt;span style="color: rgb(102, 0, 0);"&gt;static &lt;/span&gt;public void print()&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;         System.out.println(str);&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;//==============================&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;public class staticPrint&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;    public static void main(String argv[])&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;        PrintSpooler ps = new PrintSpooler();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;        ps.set("orginal?");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;        PrintSpooler ps2 = new PrintSpooler();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;        ps2.set("different?");&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;        ps.print();&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;d) How about we make the constructor &lt;span style="color: rgb(0, 0, 153);"&gt;private&lt;/span&gt;, and force user to create an instance of the class using another normal member method? Yes, that is the deal.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;class iSpooler&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;      &lt;span style="color: rgb(51, 0, 0);"&gt;static &lt;/span&gt;boolean instance_flag = false; //true if 1 instance&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;      &lt;span style="color: rgb(102, 0, 0);"&gt;private &lt;/span&gt;iSpooler() { }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;      &lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;      //static Instance method returns one instance or null&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;      &lt;span style="color: rgb(51, 0, 0);"&gt;static &lt;/span&gt;public iSpooler Instance()&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;     {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;         if (! instance_flag)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;         {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;           instance_flag = true;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;           return new iSpooler(); //only callable from within&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;          }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;         else&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;         return &lt;span style="color: rgb(51, 0, 0);"&gt;null&lt;/span&gt;; //return no further instances&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;    public void finalize()&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;   {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;        instance_flag = false;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;   }&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-4396715662822400189?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/4396715662822400189/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2009/03/design-pattern-java-singleton-pattern.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/4396715662822400189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/4396715662822400189'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2009/03/design-pattern-java-singleton-pattern.html' title='Design Pattern (JAVA) : Singleton Pattern'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-1844696143979034512</id><published>2009-02-03T05:38:00.001-08:00</published><updated>2009-02-03T06:17:32.887-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Publications'/><title type='text'>Feature dimension reduction for microarray data analysis using Locally Linear Embedding</title><content type='html'>&lt;span style=";font-family:times new roman;font-size:85%;"  &gt;Shi Chao, Chen Lihui, in Proceedings of the 3&lt;sup&gt;rd&lt;/sup&gt; Asia-Pacific Bioinformatics Conference, Advances in Bioinformatics and Computational Biology, vol. 1, 2005.&lt;/span&gt; &lt;a style="font-weight: bold; font-style: italic;" href="http://scholar.google.com/scholar?hl=en&amp;amp;rlz=1B3GGIC_enUS275US275&amp;amp;pwst=1&amp;amp;q=author:%22Chao%22+intitle:%22Feature+dimension+reduction+for+microarray+data+analysis+...%22+&amp;amp;um=1&amp;amp;ie=UTF-8&amp;amp;oi=scholarr"&gt;download!&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b style="color: rgb(0, 0, 0);"&gt;&lt;i&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;Abstract&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;div style="text-align: justify; color: rgb(0, 0, 0);"&gt;&lt;i&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;Cancer classification is one major application of microarray data analysis. Due to the ultra high dimensionality nature of microarray data, data dimension reduction has drawn special attention for such type of data analysis. The currently available data dimension reduction methods are either supervised, where data need to be labeled, or computational complex. In this paper, we proposed to use a revise&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;d locally linear embedding(LLE) method, which is purely unsupervised and fast as the feature extraction&lt;/span&gt;&lt;/i&gt;&lt;i&gt;&lt;span style="color: rgb(0, 0, 153);"&gt; strategy for microarray data analysis. Three public available microarray datasets have been used to test the proposed method. The effectiveness of LLE is evaluated by the classification accuracy of a SVM classifier. Generally, the results are promising.&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-1844696143979034512?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/1844696143979034512/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2009/02/hiiojijojoj.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/1844696143979034512'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/1844696143979034512'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2009/02/hiiojijojoj.html' title='Feature dimension reduction for microarray data analysis using Locally Linear Embedding'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-7713465270743546049</id><published>2009-02-02T01:06:00.000-08:00</published><updated>2009-02-03T06:18:12.998-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Publications'/><title type='text'>High dimensional gene expression data dimension reduction</title><content type='html'>&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;    &lt;w:usefelayout/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face  {font-family:SimSun;  panose-1:2 1 6 0 3 1 1 1 1 1;  mso-font-alt:宋体;  mso-font-charset:134;  mso-generic-font-family:auto;  mso-font-pitch:variable;  mso-font-signature:3 135135232 16 0 262145 0;} @font-face  {font-family:"\@SimSun";  panose-1:2 1 6 0 3 1 1 1 1 1;  mso-font-charset:134;  mso-generic-font-family:auto;  mso-font-pitch:variable;  mso-font-signature:3 135135232 16 0 262145 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal  {mso-style-parent:"";  margin:0in;  margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:12.0pt;  font-family:"Times New Roman";  mso-fareast-font-family:SimSun;} a:link, span.MsoHyperlink  {color:blue;  text-decoration:underline;  text-underline:single;} a:visited, span.MsoHyperlinkFollowed  {color:purple;  text-decoration:underline;  text-underline:single;} p  {mso-margin-top-alt:auto;  margin-right:0in;  mso-margin-bottom-alt:auto;  margin-left:0in;  mso-pagination:widow-orphan;  font-size:12.0pt;  font-family:"Times New Roman";  mso-fareast-font-family:SimSun;} @page Section1  {size:8.5in 11.0in;  margin:1.0in 1.25in 1.0in 1.25in;  mso-header-margin:.5in;  mso-footer-margin:.5in;  mso-paper-source:0;} div.Section1  {page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable  {mso-style-name:"Table Normal";  mso-tstyle-rowband-size:0;  mso-tstyle-colband-size:0;  mso-style-noshow:yes;  mso-style-parent:"";  mso-padding-alt:0in 5.4pt 0in 5.4pt;  mso-para-margin:0in;  mso-para-margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:10.0pt;  font-family:"Times New Roman";  mso-fareast-font-family:"Times New Roman";  mso-ansi-language:#0400;  mso-fareast-language:#0400;  mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p  style="color: rgb(0, 0, 0); font-family: times new roman;font-family:times new roman;"&gt;&lt;span style="font-size:85%;"&gt;Shi Chao, Chen Lihui, in Proceedings of IEEE Conference on Cybernetics and Intelligent Systems (CIS), Dec 2004.&lt;span style="font-style: italic;"&gt;  &lt;/span&gt;&lt;a style="font-weight: bold;" href="http://ieeexplore.ieee.org/xpl/freeabs_all.jsp?tp=&amp;amp;arnumber=1460457&amp;amp;isnumber=31387"&gt;&lt;span style="font-style: italic;"&gt;download!&lt;/span&gt;&lt;/a&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p style="color: rgb(0, 0, 0);" class="MsoNormal"&gt;&lt;b&gt;&lt;i&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;Abstract&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="text-align: justify;"&gt;&lt;i&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;Gene expression data analysis is a new approach in cancer diagnosis. Feature selection is an important preprocessing step in gene expression data clustering. In this paper, we demonstrate the effectiveness of feature grouping approach in feature dimension reduction. In our proposed framework, large number of features is grouped to form several feature subsets. By criteria of clustering accuracy, one feature subset is chosen as the candidate subset for further processing by PCA or entropy ranking, and the final feature subset are formed by selecting the features from top ranked ones. Advantage of the framework is that it considers both subset and individual feature's discrimination power, also it requires little information about the class label. A prototype of the proposed framework has been implemented and tested on the leukemia data set. The results have given positive support to the framework.&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;    &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-7713465270743546049?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/7713465270743546049/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2009/02/my-publications-during-master-studies.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/7713465270743546049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/7713465270743546049'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2009/02/my-publications-during-master-studies.html' title='High dimensional gene expression data dimension reduction'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-9214835924234566610</id><published>2008-09-23T01:57:00.000-07:00</published><updated>2008-09-23T02:03:30.093-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>Quickly Find/Open a File in Visual Studio</title><content type='html'>&lt;h2&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(0, 0, 153); font-weight: normal;font-size:78%;" &gt;The following content is from site: (http://www.alteridem.net/2007/09/11/quickly-findopen-a-file-in-visual-studio/)&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;  &lt;h2&gt;&lt;span style="font-size: 10pt; font-weight: normal;"&gt;Here is a cool Visual Studio feature that almost nobody knows about. If you want to open up a file in your solution, but can’t be bothered to dig down through your projects and folders to find it, try this,&lt;/span&gt;&lt;span style="font-weight: normal;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;  &lt;div class="entry"&gt; &lt;ol&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Click in the Find box in the toolbar, &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;Type &gt;of followed by a space, then begin the name of the file you are looking for. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;An auto-complete drop down will appear as you type filtering all the files in all your projects in your solution. Continue typing until the list is short enough to fine the one you want. Select it and hit enter. &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size:85%;"&gt;The file will open in the editor.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt; &lt;div align="center"&gt;&lt;span style="font-size:85%;"&gt;&lt;img style="border-width: 0px;" alt="openfile" src="http://www.alteridem.net/wp-content/uploads/2007/09/openfile.png" border="0" height="218" width="265" /&gt;&lt;/span&gt;&lt;/div&gt;  &lt;p&gt;&lt;span style="font-size:85%;"&gt;Another useful tip is that &lt;strong&gt;Ctrl+D&lt;/strong&gt; or &lt;strong&gt;Ctrl+/&lt;/strong&gt; will automatically jump to the find box, so your hands don’t even need to leave your keyboard.&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-9214835924234566610?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/9214835924234566610/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2008/09/following-content-is-from-site-httpwww.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/9214835924234566610'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/9214835924234566610'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2008/09/following-content-is-from-site-httpwww.html' title='Quickly Find/Open a File in Visual Studio'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-7259049260141001874</id><published>2008-07-28T06:23:00.000-07:00</published><updated>2008-07-28T06:35:17.364-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='script tricks'/><title type='text'>on makefile</title><content type='html'>some notes on makefile:&lt;br /&gt;&lt;br /&gt;The basic basic rule: 'target' depends on 'prerequisites' and the relationship is defined by 'command'.&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;target ... : prerequisites ...&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;command&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;version 1&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;objects = main.o kbd.o command.o display.o \&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;insert.o search.o files.o utils.o&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;edit : $(objects)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;cc -o edit $(objects)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;main.o : defs.h&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;kbd.o : defs.h command.h&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;command.o : defs.h command.h&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;display.o : defs.h buffer.h&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;insert.o : defs.h buffer.h&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;search.o : defs.h buffer.h&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;files.o : defs.h buffer.h command.h&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;utils.o : defs.h&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;.PHONY : clean&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;clean :&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;rm edit $(objects)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;version 2&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;objects = main.o kbd.o command.o display.o \&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;insert.o search.o files.o utils.o&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;edit : $(objects)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;cc -o edit $(objects)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;$(objects) : defs.h&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;kbd.o command.o files.o : command.h&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;display.o insert.o search.o files.o : buffer.h&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;.PHONY : clean&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;clean :&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;rm edit $(objects)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;.PHONY is followed by a pseudo target and it only defines a series of action, rather than files dependencies.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;.PHONY : clean&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;clean :&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153);"&gt;-rm edit $(objects)&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;The '-' in front of rm means 'go ahead' about the action and do not stop for errors.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-7259049260141001874?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/7259049260141001874/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2008/07/on-makefile.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/7259049260141001874'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/7259049260141001874'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2008/07/on-makefile.html' title='on makefile'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-5943733046022353241</id><published>2007-12-13T18:47:00.000-08:00</published><updated>2007-12-13T19:37:39.007-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C++'/><title type='text'>Polymorphism, RTTI, and MFC run time type info, what is my choice?</title><content type='html'>Polymorphism is one very important feature of C++ and a pivotal concept from OOP. Yet, we often distract ourself to other more restrictive implementations, when what we really need is a C++ virtual function.&lt;br /&gt;&lt;br /&gt;A nice article from a C++guru, Ovidiu Cucu, illustrated this with a rather classical programming example. (&lt;a href="http://www.codeguru.com/cpp/cpp/cpp_mfc/general/article.php/c14535__3/"&gt;http://www.codeguru.com/cpp/cpp/cpp_mfc/general/article.php/c14535__3/&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;Let me just quote his final words in this article as a quick note:&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;"You can implement run-time type checking by using RTTI or the old MFC-like mechanism, but usually that's not absolutely needed."&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;One more thing I wish to add here. Look at the example from above article using polymorphism methods below; the &lt;span style="color:#000099;"&gt;'virtual'&lt;/span&gt; keyword preceding the function definition in the derived classes are NOT necessary for late-binding to work. Just put it in base class is enough.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Another note: use of &lt;span style="color:#000099;"&gt;pure&lt;/span&gt; virtual function is NOT necessary unless you wish to force the user to re-define this method in the derived classes; if a particular function is declared &lt;span style="color:#000066;"&gt;pure virtual&lt;/span&gt;, and yet not implemented in derived class, then the code won't compile. There will be a compiler error. In this case, we achieved something similar to 'interface' in Java, if you are familiar with J2SE.&lt;br /&gt;&lt;span style="color:#000066;"&gt;=============================================&lt;/span&gt;&lt;br /&gt;#include &lt;iostream&gt;&lt;br /&gt;&lt;br /&gt;class Animal&lt;br /&gt;{&lt;br /&gt;public:&lt;br /&gt;   // pure virtual function&lt;br /&gt;   virtual void ISay() = 0;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;class Dog : public Animal&lt;br /&gt;{&lt;br /&gt;public:&lt;br /&gt;   // specific implementation for Dog&lt;br /&gt;   &lt;span style="color:#660000;"&gt;virtual&lt;/span&gt; void ISay() {std::cout &lt;&lt; "Bark! ";}&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;class Cat : public Animal&lt;br /&gt;{&lt;br /&gt;public:&lt;br /&gt;   // specific implementation for Cat&lt;br /&gt;   &lt;span style="color:#660000;"&gt;virtual&lt;/span&gt; void ISay() {std::cout &lt;&lt; "Miaou! ";}&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;class CFoo&lt;br /&gt;{&lt;br /&gt;public:&lt;br /&gt;   void AnimalSays(Animal*);&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;int main(int argc, char* argv[])&lt;br /&gt;{&lt;br /&gt;   Dog   rex;&lt;br /&gt;   Cat   kitty;&lt;br /&gt;   CFoo  foo;&lt;br /&gt;&lt;br /&gt;   foo.AnimalSays(&amp;amp;rex);&lt;br /&gt;   foo.AnimalSays(&amp;amp;kitty);&lt;br /&gt;&lt;br /&gt;   return 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void CFoo::AnimalSays(Animal* pAnimal)&lt;br /&gt;{&lt;br /&gt;   pAnimal-&gt;ISay();&lt;br /&gt;}&lt;br /&gt;&lt;span style="color:#000099;"&gt;=============================================&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-5943733046022353241?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/5943733046022353241/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/12/polymorphism-rtti-and-mfc-run-time-type.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/5943733046022353241'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/5943733046022353241'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/12/polymorphism-rtti-and-mfc-run-time-type.html' title='Polymorphism, RTTI, and MFC run time type info, what is my choice?'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-7651112394722438820</id><published>2007-11-18T23:42:00.000-08:00</published><updated>2008-02-14T00:23:16.628-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='script tricks'/><title type='text'>A few prime tools on unix programming</title><content type='html'>My previous experience with unix has limited to cc/gcc, vim, shell scripts, .cshrc and knowledge of some configuration files.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Recently, due to my job needs, I have tried to learn some make/nmake programming. After 1,2 days googling, I managed to dig up two good references. One is the 'NMAKE reference' from MSDN, and it is dedicated to Microsoft NMAKE, of course. I didn't find any downloadable version. The other is a tuotorial-like blog series on GNU MAKE usage from a very experienced Chinese programmer (google &lt;span style="color:#000066;"&gt;&lt;u&gt;跟我一起写Makefile&lt;/u&gt;&lt;/span&gt;). Fans have spent time to put the series together into a more readable PDF file. It is long, complete with many useful examples. It is very useful as both tutorial and reference manual.&lt;br /&gt;&lt;br /&gt;Here, ladies and gentlemen, I am going to introduce some byproducts from my learning journey. (Thanks to the 2nd reference mentioned above.) You may already heard the name of SED and AWK, two famous unix utilities. What are they? read the following from: &lt;a href="http://www.faqs.org/docs/abs/HTML/sedawk.html"&gt;http://www.faqs.org/docs/abs/HTML/sedawk.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;sed: a non-interactive text file editor&lt;br /&gt;awk: a field-oriented pattern processing language with a C-like syntax&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;Despite all their differences, the two utilities share a similar invocation syntax, both use &lt;/span&gt;&lt;a href="http://www.faqs.org/docs/abs/HTML/regexp.html#REGEXREF"&gt;&lt;span style="color:#660000;"&gt;regular expressions&lt;/span&gt;&lt;/a&gt;&lt;span style="color:#660000;"&gt;, both read input by default from stdin, and both output to stdout. These are well-behaved UNIX tools, and they work together well. The output from one can be piped into the other, and &lt;u&gt;their combined capabilities give shell scripts some of the power of Perl&lt;/u&gt;.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;so, try it!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-7651112394722438820?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/7651112394722438820/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/11/few-prime-tools-on-unix-programming.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/7651112394722438820'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/7651112394722438820'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/11/few-prime-tools-on-unix-programming.html' title='A few prime tools on unix programming'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-7145399877158127410</id><published>2007-11-15T00:51:00.000-08:00</published><updated>2007-11-19T00:16:40.779-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hardware'/><title type='text'>Why serial? Why not parallel?</title><content type='html'>&lt;strong&gt;&lt;span style="color:#000099;"&gt;Why the latest data transmission bus favors serial comm over parallel comm? Why a single data line could outperform a group of lines carrying signals in parallel? this is a really &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_0"&gt;fundamental&lt;/span&gt; question, however, for long time, I am confused. Here is a good explanatory article from &lt;a href="http://www.hardwaresecrets.com/article/190/2"&gt;http://www.hardwaresecrets.com/article/190/2&lt;/a&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#000099;"&gt;&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="color:#000099;"&gt;I favor such good articles which articulates &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;fundamental&lt;/span&gt; yet confusing scientific or engineering issues in simple terms. Thanks a lot to the original authors. I have quoted a few in my blog, and I will &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_2"&gt;continue to&lt;/span&gt; recommend more in future.&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;From Parallel to Serial &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;The &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;PCI&lt;/span&gt; Express bus (formerly known as 3&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;GIO&lt;/span&gt;) represents an extraordinary advance in the way peripheral devices communicate with the computer. It differs from the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;PCI&lt;/span&gt; bus in many aspects, but the most important one is the way data is transferred. The &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;PCI&lt;/span&gt; Express bus is an example of how PC data transfer is migrating from parallel communication to serial communication. Read our article Why Serial? to understand the differences between serial and parallel communications.&lt;br /&gt;&lt;br /&gt;Almost all PC buses (ISA, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;EISA&lt;/span&gt;, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;MCA&lt;/span&gt;, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;VLB&lt;/span&gt;, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;PCI&lt;/span&gt; and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;AGP&lt;/span&gt;) use parallel communication. Parallel communication differs from the serial one because it transmits several bits at a time, while in serial communication only one bit is transmitted at a time. This makes, at first, parallel communication faster than the serial one, since the higher the number of bits transmitted at a time, the faster the communication will be.&lt;br /&gt;&lt;br /&gt;But parallel communication suffers from some problems that prevent transmissions from reaching higher clocks. &lt;span style="color:#cc0000;"&gt;The higher the clock, the greater will be the problems with magnetic interference and propagation delay.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;When the electric current passes flows through a wire, an electromagnetic field is created around it. If the electromagnetic field created by the wire happens to be very strong, noise will be produced in the near wire, corrupting the information being transmitted. As in parallel transmission several bits are transmitted at a time, each bit involved in the transmission uses one wire. For example, in a 32-bit communication (such as the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;PCI&lt;/span&gt; slot) it’s necessary to have 32 wires just to transmit data, not counting additional control signals that are also necessary. The higher the clock, the greater the electromagnetic interference problem.&lt;br /&gt;&lt;br /&gt;As we have commented before, each bit in parallel communication is transmitted in a separate wire. But it’s almost impossible to make those 32 wires have exactly the same length in a motherboard. This difference in wire length &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;didn&lt;/span&gt;’t alter the way the bus worked in older PCs, but due to the increased speed in which data is transmitted (clock), data transmitted through shorter wires started to arrive before the rest of the data that was transmitted through longer wires. That is, the bits in parallel communication started to arrive out of order.&lt;br /&gt;&lt;br /&gt;As a consequence, the receptor device has to wait for all bits to arrive in order to process the complete data, which represents significant loss in performance. This problem is known as propagation delay and, as we said, becomes worse with the increase in the operating frequency (clock).&lt;br /&gt;&lt;br /&gt;The project of a bus using serial communication is much more simple to be implemented than one using parallel communication, since only two wires are necessary to data transmission (one wire for data transmission and one ground wire). Besides, serial communication allows operation with much higher clocks than those used in parallel communication, since problems with &lt;span style="color:#000000;"&gt;the&lt;/span&gt; electromagnetic interference and propagation delay appear most frequently in parallel communication, which prevents high clocks from being reached in the transmissions. Another difference between parallel communication and serial communication is that parallel communication is usually half-duplex (the same wires are used both to transmit and to receive data) due to the high number of wires that are necessary to its implementation, while serial communication is full-duplex (there’s a separate set of wires to transmit data and another one to receive data) because it needs just two wires.&lt;br /&gt;&lt;br /&gt;That’s why engineers adopted serial communication instead of parallel communication in &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;PCI&lt;/span&gt; Express bus.&lt;br /&gt;&lt;br /&gt;Now you might be asking yourself: &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;isn&lt;/span&gt;’t serial communication slower? Not necessarily, and the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17"&gt;PCI&lt;/span&gt; Express bus is a good example: if higher clock is used, serial communication is faster than parallel communication.&lt;br /&gt;&lt;br /&gt;We’ll talk about how the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;PCI&lt;/span&gt; Express bus works on the next page.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-7145399877158127410?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/7145399877158127410/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/11/why-latest-data-transmission-bus-favors.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/7145399877158127410'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/7145399877158127410'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/11/why-latest-data-transmission-bus-favors.html' title='Why serial? Why not parallel?'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-5413280251652304950</id><published>2007-10-03T19:28:00.000-07:00</published><updated>2009-02-03T06:21:59.061-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='I create'/><title type='text'>GUI design engineering</title><content type='html'>Many people view GUI(HMI) design as the cosmetic aspect of the underlying engineering products or problems; other people view this a serious engineering topic as part of the products/problems.&lt;br /&gt;&lt;br /&gt;In a highly competitive business world where quality and customer satisfaction is ultimately emphasized, software is more appropriately addressed as service rather than product. Thus, software usability depends on both the 'quality' in a traditional sense, but also customer experience. However, very often than not, we are seeing people/company creating/upgrading products which prevent people from using it or loving it (you hate it, yet, you may still have to use it, :( ).&lt;br /&gt;&lt;br /&gt;As a very intensive sofware user, observer, I wish to compile a check list as warning for all GUI engineers, including myself.&lt;br /&gt;&lt;br /&gt;1) do not use out-dated technologies for the sake of compatibility; be a hero, lead the revolution! we should avoid creating software which we know will only survive a few months.&lt;br /&gt;&lt;br /&gt;2) do not count on users to read and comprehand your thick mauals! let your software speak for itself. Use their language and sign, follow their thinking, and mimic their habits.&lt;br /&gt;&lt;br /&gt;3) do not let user repetitively input information. And, you know what I am talking about. That is NOT called validation or security measure, it is called &lt;span style="color:#660000;"&gt;'amnesia'&lt;/span&gt;. Always remember what the user has told you until they have logged out or timed out.&lt;br /&gt;&lt;br /&gt;4) be intelligent. Try to make use of known information on the fly, and avoid asking stupid questions. (we do not ask NRIC number from a foreigner.)&lt;br /&gt;&lt;br /&gt;5) always leave your user a choice. Customer is god! your god should be able to do whatever whenever they want. They should be able to quit, delete, save, roll back, un-subscribe, un-focus, etc anytime on any page.&lt;br /&gt;&lt;br /&gt;6) allow user to copy n paste, including pictures and objects.&lt;br /&gt;&lt;br /&gt;7) consider i18n, if you can not support it, at least do not let it ruin the running instance of your program. (There are many such cases in the web: when you switch the input method, the page hangs or browser suicides.)&lt;br /&gt;&lt;br /&gt;8) consider error handling. that is one of the basics in software engineering. Testing cases are part of error handling design.)&lt;br /&gt;&lt;br /&gt;9) do not display useless information. Exception stacks are only useful to programmers, do not let them run out of the curtain, and that just adds to the frustration over the awkward accident. if it is going to die inevitably, let it die silently and rest in peace.&lt;br /&gt;&lt;br /&gt;*) last but not least, never assume your software is perfect. the most we can achieve is 99.9, and 100 is hallucination. Consider debugging and error logging devices seriously ever since the design stage. Software which does not allow debugging and error logging can hardly achieve a passing grade.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-5413280251652304950?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/5413280251652304950/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/10/gui-design-engineering.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/5413280251652304950'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/5413280251652304950'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/10/gui-design-engineering.html' title='GUI design engineering'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-6097607928553257106</id><published>2007-09-26T00:59:00.000-07:00</published><updated>2007-09-26T01:49:48.455-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='math fun'/><title type='text'>greatest common divisor</title><content type='html'>//while loop version&lt;br /&gt;int gcd(int m, int n)&lt;br /&gt;{&lt;br /&gt;  int r, q, d;&lt;br /&gt;  while (n!=0)&lt;br /&gt;  {&lt;br /&gt;    r = m % n;&lt;br /&gt;    q = m / n;&lt;br /&gt;    r = m - n * q; &lt;br /&gt;    m = n;&lt;br /&gt;    n = r;&lt;br /&gt;  }&lt;br /&gt;  return q;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//a recursive version, pretty, but maybe slower :)&lt;br /&gt;int gcd(int m, int n)&lt;br /&gt;{&lt;br /&gt;  if (!m || !n) return 0;&lt;br /&gt;  if (m &lt; 0) return gcd(-m,n);&lt;br /&gt;  if (n &lt; 0) return gcd(m,-n);&lt;br /&gt;  if (m &lt; n) return gcd(n,m);&lt;br /&gt;  if (m%n) return gcd(n, m%n);&lt;br /&gt;  return n;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-6097607928553257106?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/6097607928553257106/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/09/greatest-common-divisor.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/6097607928553257106'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/6097607928553257106'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/09/greatest-common-divisor.html' title='greatest common divisor'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-721745285327163566</id><published>2007-09-26T00:45:00.000-07:00</published><updated>2007-09-26T00:54:45.078-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C51 stuff'/><title type='text'>Harvard architecture vs von Neumann architecture</title><content type='html'>I was asked about the architecture difference between the Harward model and the von Neumann model during an interview. Shame! Shame! Shame! I only rememeber Harward was faster in certain mathematical calculation, such as Fourier transform.&lt;br /&gt;&lt;br /&gt;Here is something I extracted from wikipedia.org.&lt;br /&gt;&lt;br /&gt;Harward has the &lt;strong&gt;physically separated data and instruction storage and pathways&lt;/strong&gt;, which means it has the capability to &lt;strong&gt;read instruction and read/write data at the same time&lt;/strong&gt;. Obviously, this is not possible in the classical x86 architecure, since our data and instruction are all stored in the ram (from hardisk) and read/write through the shared data/address bus. One thing has to note: the cache. We are talking about the case of von Neumann model without cache here.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-721745285327163566?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/721745285327163566/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/09/harvard-architecture-vs-von-neumann.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/721745285327163566'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/721745285327163566'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/09/harvard-architecture-vs-von-neumann.html' title='Harvard architecture vs von Neumann architecture'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-4573022747130252643</id><published>2007-08-09T19:48:00.000-07:00</published><updated>2007-08-09T19:54:21.922-07:00</updated><title type='text'>some extremely compact guide to MS .NET</title><content type='html'>first, you are right, MS.NET is extremely similar to Java, language grammar wise and language or platform design wise.&lt;br /&gt;&lt;br /&gt;how does .Net work?&lt;br /&gt;&lt;br /&gt;1. the source code (any .net supported language, vb.net, c#.net,etc.) is compiled into MSIL (intermediate language, something like Java bytecode).&lt;br /&gt;&lt;br /&gt;2. at execution, the MSIL is compiled into instructions by JIT (just in time) compiler to become 'managed native code' ,and then&lt;br /&gt;&lt;br /&gt;3. runs on CLR (common language runtime).&lt;br /&gt;&lt;br /&gt;sounds like Java?&lt;br /&gt;&lt;br /&gt;ok, let take a look at some source code.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;using System ;&lt;br /&gt;Class Hello &lt;br /&gt;{&lt;br /&gt;Public static void Main ()&lt;br /&gt;{&lt;br /&gt;Console.writeLine ("Hello C#"); &lt;br /&gt;} &lt;br /&gt;} //end of the main&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;not only sounds like Java, it also looks like.....&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-4573022747130252643?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/4573022747130252643/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/08/some-extremely-compact-guide-to-ms-net.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/4573022747130252643'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/4573022747130252643'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/08/some-extremely-compact-guide-to-ms-net.html' title='some extremely compact guide to MS .NET'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-4325272631273925068</id><published>2007-07-16T00:18:00.000-07:00</published><updated>2007-07-16T02:10:51.494-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>some tricky but fundmental interview questions (Java)</title><content type='html'>1. checked vs unchecked exceptions&lt;br /&gt;&lt;br /&gt;what are the difference?&lt;br /&gt;first, checked exceptions are checked by compiler at compiling time. So programmers are compulsory to handle them; while unchecked exceptions are NOT, and they are reported at runtime. There is actually no way or too expensive to check them at compile time, like array out of bound exception, negative array index, or something very serious, and not remediable.&lt;br /&gt;&lt;br /&gt;2. are all methods of parent class inherited?&lt;br /&gt;&lt;br /&gt;NO, constructors are of exceptions. They can not be inherited.&lt;br /&gt;&lt;br /&gt;3. what is HashCode()?&lt;br /&gt;&lt;br /&gt;HashCode() returns the memory address of the owner class. And, Equals() without overriding compares memory address of the two classes.&lt;br /&gt;&lt;br /&gt;4.When To Use Interfaces&lt;br /&gt;An interface allows somebody to start from scratch to implement your interface or implement your interface in some other code whose original or primary purpose was quite different from your interface. To them, your interface is only incidental, something that have to add on to the their code to be able to use your package. &lt;br /&gt;When To Use Abstract classes&lt;br /&gt;&lt;br /&gt;An abstract class, in contrast, provides more structure. It usually defines some default implementations and provides some tools useful for a full implementation. The catch is, code using it must use your class as the base. That may be highly inconvenient if the other programmers wanting to use your package have already developed their own class hierarchy independently. In Java, a class can inherit from only one base class.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-4325272631273925068?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/4325272631273925068/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/07/some-tricky-but-fundmental-interview.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/4325272631273925068'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/4325272631273925068'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/07/some-tricky-but-fundmental-interview.html' title='some tricky but fundmental interview questions (Java)'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-2073371811765500962</id><published>2007-06-19T02:27:00.000-07:00</published><updated>2007-06-19T02:28:57.584-07:00</updated><title type='text'>for Technorati claim</title><content type='html'>&lt;a href="http://technorati.com/claim/wbsjseyryk" rel="me"&gt;Technorati Profile&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-2073371811765500962?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/2073371811765500962/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/06/for-technorati-claim.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/2073371811765500962'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/2073371811765500962'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/06/for-technorati-claim.html' title='for Technorati claim'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-2595866288036227753</id><published>2007-06-12T03:00:00.000-07:00</published><updated>2008-02-13T22:11:54.942-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OS hacks'/><title type='text'>A simple note on port access under windows NT</title><content type='html'>&lt;span style="color:#000066;"&gt;I intend to write a short on port access under windows now.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;1. Using Microsoft VB, you can not do port access stuff, whatever, NO. If you really need, use c/c++ to write the function, and port to dll, call it from your vb project.&lt;br /&gt;&lt;br /&gt;2. under DOS, win98, winMe, port is open accessible; however, for NT kernel system, like winNT, win2000, winXP, direct port access is blocked; to access the port, there are two methods commonly adopted:&lt;br /&gt;&lt;br /&gt;a) get/write a driver, like giveio.sys, and load it to grant access inside your project, prior to any port accessing;&lt;br /&gt;&lt;br /&gt;b) if you code is already there, or you only have the executable, use portTalk/allowIo to invoke your application and grant access to some port by command line arguments;&lt;br /&gt;&lt;br /&gt;------------------------------------------------------------------------------------------&lt;br /&gt;&lt;span style="color:#000066;"&gt;how is the blocking mechanism under NT kernel system working?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;basically, under NT kernel, programs run in two mode, user mode and kernel mode. User mode are considered unstable, and thus restricted by OS. it works in this way:&lt;br /&gt;a&gt; user mode program runs in privilege level ring 3, and kernel mode program runs in privilege leve ring 0.&lt;br /&gt;b&gt; if a program request to access a port, the OS checks for two things:&lt;br /&gt;1) if the program runs in ring 0, ok, go; otherwise&lt;br /&gt;2) check the IOPM mapping in TSS, if the corresponding bit for the port is cleared, ok, go, otherwise&lt;br /&gt;3) blocked!!!&lt;br /&gt;&lt;br /&gt;--------------------------------------------------------------------------------------------&lt;br /&gt;&lt;span style="color:#000066;"&gt;how does driver like giveio.sys or port talk walk around the limitation?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;it changes the IOPM to grant access for certain process; how? the answer is , there is some un-documented api under windows to manipulate the bit in IOPM.&lt;br /&gt;&lt;br /&gt;------------------------------------------------------------------------------------&lt;br /&gt;&lt;span style="color:#000066;"&gt;what is IOPM?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;forget about the details if you are not interested. it is some system managed memory, each bit inside represents the access right for one port. Bit 1(default value) means blocking, and bit 0 means green light.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;How is the details? how does it really really works?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;do not ask; u need something like SoftICE or winDBG to dig into TSS to see it yourself. did i? NOT yet. It is not straight forward to me.&lt;br /&gt;&lt;br /&gt;anything wrong or inaccurate above, leave a comment. thanks&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-2595866288036227753?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/2595866288036227753/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/06/simple-note-on-port-access.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/2595866288036227753'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/2595866288036227753'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/06/simple-note-on-port-access.html' title='A simple note on port access under windows NT'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-2635838468046732889</id><published>2007-06-08T00:50:00.000-07:00</published><updated>2008-02-13T22:25:40.704-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OS hacks'/><title type='text'>From "Undocumented Windows 2000 Secrets" (1)</title><content type='html'>The first obstacle is that debugging usually involves two separate machines connected by a cable—one running the debugger, the other one hosting the debuggee.&lt;br /&gt;&lt;br /&gt;However, there is a much easier way, eliminating the necessity of a second machine, if live debugging is not a requirement. For example, if a buggy application throws an unhandled exception causing the infamous NT &lt;span style="color:#330033;"&gt;“Blue Screen Of Death” (BSOD)&lt;/span&gt; to pop up, you can choose to save the memory image that was in effect right before the crash to a file and examine this crash dump after rebooting. This technique is usually called post mortem debugging (post mortem&lt;br /&gt;is Latin and means “after death”).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-2635838468046732889?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/2635838468046732889/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/06/from-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/2635838468046732889'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/2635838468046732889'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/06/from-1.html' title='From &quot;Undocumented Windows 2000 Secrets&quot; (1)'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-1689811008437151009</id><published>2007-06-08T00:41:00.001-07:00</published><updated>2007-06-08T00:42:46.574-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OS hacks'/><title type='text'>A really really nice page!</title><content type='html'>hi, all, here, look here:&lt;br /&gt;&lt;a href="http://www.rawol.com/?topic=77"&gt;http://www.rawol.com/?topic=77&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;a free download of &lt;span style="color:#990000;"&gt;Undocumented Windows 2000 Secrets&lt;/span&gt; in nice pdf format for download or online browse!!!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-1689811008437151009?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/1689811008437151009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/06/really-really-nice-page.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/1689811008437151009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/1689811008437151009'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/06/really-really-nice-page.html' title='A really really nice page!'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-588621113107278113</id><published>2007-06-07T19:53:00.000-07:00</published><updated>2008-02-13T22:28:42.437-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OS hacks'/><title type='text'>Let's start from how to access ports under Windows NT</title><content type='html'>&lt;p&gt;From KMD:&lt;/p&gt;&lt;p&gt;Most strange thing here is that we have accessed the SMOS memory without the system stops us. As I have already mentioned above, the &lt;span style="color:#ff0000;"&gt;access to I/O ports is protected under Windows NT&lt;/span&gt;. Executing IN or OUT instruction in user-mode will cause process termination. But we have touched them. How it can be? Well, it becomes possible due to the giveio driver.&lt;/p&gt;&lt;p&gt;The driver's code is based on well-known example (giveio) by Dale Roberts. I have decided it will be appropriate to mention here.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#cc0000;"&gt;Our driver changes the I/O permission bit map (IOPM) that allows the process free access to the I/O ports.&lt;/span&gt; Each process has its own I/O permission bit map, thus access to the individual I/O ports can be granted to the individual process. Each bit in the I/O permission bit map corresponds to the byte I/O port. If this bit is set, the access to the corresponding port is forbidden, if it is clear the process may access this I/O port. Since the I/O address space consists of 64K individually addressable 8-bit I/O ports, the maximum IOPM size is 2000h bytes.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="color:#330033;"&gt;The purpose of the TSS is to save the state of the processor during task or context switches. For performance reasons, Windows NT does not use this architectural feature and maintains one base TSS that all processes share. This means that IOPM is also shared. So any changes to it are not private for particular process but are system-wide.&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="color:#330033;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;br /&gt;There are some undocumented functions in the ntoskrnl.exe to manipulate with the IOPM:&lt;br /&gt;&lt;span style="color:#660000;"&gt;Ke386QueryIoAccessMap and Ke386SetIoAccessMap.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;Ke386QueryIoAccessMap proto stdcall dwFlag:DWORD, pIopm:PVOID&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;Ke386QueryIoAccessMap&lt;/span&gt; copies current IOPM by the size of 2000h bytes from TSS to the memory buffer pointed to by pIopm parameter.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;Ke386SetIoAccessMap&lt;/span&gt; copies specified IOPM by the size of 2000h from the memory buffer pointed to by pIopm parameter to TSS. &lt;/p&gt;&lt;p&gt;[some comment from &lt;a href="http://www.nsfocus.net/index.php?act=magazine&amp;amp;do=view&amp;amp;mid=2205"&gt;http://www.nsfocus.net/index.php?act=magazine&amp;amp;do=view&amp;amp;mid=2205&lt;/a&gt;]&lt;/p&gt;&lt;p&gt;&lt;span style="color:#660000;"&gt;I think these comments are extremely necessary, so I decided to concatenate them here.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;通过前面对 NT 系统中 KTSS 结构和实际内存的分析，我们可以了解：NT 环境下，每个进程单独维护了一个 TSS 内存区域，其中由 TSS 内部维护了一个全部标志位置 1 的 IOPM 表，在 TSS 末尾还维护了另外一个实际中承担端口管理工作的 IOPM 表。Ke386SetIoAccessMap 函数(ntos\ke\i386\iopm.c:80)和 Ke386QueryIoAccessMap 函数(ntos\ke\i386\iopm.c:235)就是系统提供用来读写这两个 IOPM 表的函数。而 Ke386IoSetAccessProcess 函数(ntos\ke\i386\iopm.c:318)则指定进程到底使用哪个 IOPM 表。&lt;/p&gt;&lt;p&gt;对前两个函数来说，MapNumber指定要对哪个表进行操作。系统定义了一个 IO_ACCESS_MAP_NONE = 0 常量表示在 TSS 后面那个真实 IOPM 表，而其他的索引对应于 KTSS.IoMaps[] 数组。此数组大多数情况下只有一个表项，也就是说 MapNumber 为 0 时表示 TSS 后面那个 IOPM；为 1 时表示 TSS 内部的 KTSS.IoMaps[0]。 Ke386QueryIoAccessMap 函数只是简单的根据 MapNumber 判断是将 IoAccessMap 内容全部置位(MapNumber = 0)、还是从 TSS 中复制对应的表 (0 &lt; iopm_count =" 1)。伪代码如下：&lt;/P"&gt; &lt;p align="left"&gt;&lt;span style="font-family:times new roman;font-size:85%;color:#000099;"&gt;#define IOPM_COUNT 1&lt;br /&gt;#define IOPM_SIZE 8192 // Size of map callers can set.&lt;br /&gt;&lt;br /&gt;BOOLEAN Ke386QueryIoAccessMap(ULONG MapNumber, PKIO_ACCESS_MAP IoAccessMap)&lt;br /&gt;{&lt;br /&gt;if(MapNumber &gt; IOPM_COUNT) return FALSE;&lt;br /&gt;&lt;br /&gt;if(MapNumber == IO_ACCESS_MAP_NONE)&lt;br /&gt;{&lt;br /&gt;memset(IoAccessMap, -1, IOPM_SIZE);&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;void *pIOPM = &amp;amp;(KiPcr()-&gt;TSS-&gt;IoMaps[MapNumber-1].IoMap);&lt;br /&gt;&lt;br /&gt;memcpy(IoAccessMap, pIOPM, IOPM_SIZE);&lt;br /&gt;}&lt;br /&gt;return TRUE;&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p align="left"&gt;而 Ke386SetIoAccessMap 在 MapNumber 为 0 时直接返回 FALSE，因为 TSS 后的那个表是不允许修改的；对其他情况，函数将 IoAccessMap 中的内容复制回 TSS 的 IOPM 表中，并在多处理器情况下通知其他处理器重新载入 IOPM 表。伪代码如下：&lt;/p&gt;&lt;p align="left"&gt;&lt;span style="font-size:85%;color:#000099;"&gt;BOOLEAN Ke386SetIoAccessMap(ULONG MapNumber, PKIO_ACCESS_MAP IoAccessMap)&lt;br /&gt;{&lt;br /&gt;if((MapNumber &gt; IOPM_COUNT) (MapNumber == IO_ACCESS_MAP_NONE)) return FALSE;&lt;br /&gt;&lt;br /&gt;void *pIOPM = &amp;amp;(KiPcr()-&gt;TSS-&gt;IoMaps[MapNumber-1].IoMap);&lt;br /&gt;&lt;br /&gt;memcpy(pIOPM, IoAccessMap, IOPM_SIZE);&lt;br /&gt;&lt;br /&gt;KiPcr()-&gt;TSS-&gt;IoMapBase = GetCurrentProcess()-&gt;IopmOffset;&lt;br /&gt;&lt;br /&gt;// 通知其他处理器重设 IOPM&lt;br /&gt;&lt;br /&gt;return TRUE;&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;p align="left"&gt;&lt;span style="color:#000000;"&gt;Ke386IoSetAccessProcess 函数则简单地修改当前 TSS 的 IOPM 偏移为 MapNumber 指定的 IOPM 表偏移，并在多 CPU 情况下通知其他 CPU 重新载入 IOPM 偏移。计算偏移算法如下：&lt;/span&gt;&lt;/p&gt;&lt;p align="left"&gt;&lt;span style="font-size:85%;color:#000099;"&gt;#define KiComputeIopmOffset(MapNumber) \&lt;br /&gt;(MapNumber == IO_ACCESS_MAP_NONE) ? \&lt;br /&gt;(USHORT)(sizeof(KTSS)) : \&lt;br /&gt;(USHORT)(FIELD_OFFSET(KTSS, IoMaps[MapNumber-1].IoMap))&lt;br /&gt;USHORT MapOffset = KiComputeIopmOffset(MapNumber);&lt;/span&gt;&lt;/p&gt;&lt;p align="left"&gt;&lt;span style="color:#000000;"&gt;完整的使用流程代码如下：&lt;/span&gt;&lt;/p&gt;&lt;p align="left"&gt;&lt;span style="font-size:85%;color:#000099;"&gt;#define IOPM_SIZE 8192 // Size of map callers can set.&lt;br /&gt;&lt;br /&gt;typedef UCHAR KIO_ACCESS_MAP[IOPM_SIZE];&lt;br /&gt;typedef KIO_ACCESS_MAP *PKIO_ACCESS_MAP;&lt;br /&gt;&lt;br /&gt;PKIO_ACCESS_MAP IOPM_local = MmAllocateNonCachedMemory(sizeof(IOPM));&lt;br /&gt;if(IOPM_local == 0)&lt;br /&gt;return STATUS_INSUFFICIENT_RESOURCES;&lt;br /&gt;&lt;br /&gt;Ke386QueryIoAccessMap(1, IOPM_local);&lt;br /&gt;&lt;br /&gt;// 修改 IOPM_Local 内容打开需要使用的端口&lt;br /&gt;Ke386SetIoAccessMap(1, IOPM_local);&lt;br /&gt;Ke386IoSetAccessProcess(PsGetCurrentProcess(), 1);&lt;/span&gt;&lt;/p&gt;&lt;p align="left"&gt;I will make the English translation later.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-588621113107278113?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/588621113107278113/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/06/lets-start-from-how-to-set-cmos-under.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/588621113107278113'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/588621113107278113'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/06/lets-start-from-how-to-set-cmos-under.html' title='Let&apos;s start from how to access ports under Windows NT'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-2887967931414652878</id><published>2007-05-28T18:10:00.000-07:00</published><updated>2007-05-28T18:15:51.424-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OS hacks'/><title type='text'>from KMD tutorial</title><content type='html'>Windows NT internals are divided by two distinct part concerning both address space and code permissions and responsibilities.&lt;br /&gt;Address space sharing is amazingly simple. Whole four gigabytes of memory available in 32-bit architecture divided by two equal parts (4GT RAM Tuning and Physical Address Extension omitted as an exotic case). The address space for a user-mode processes is mapped into the lower 2GB of linear memory at addresses 00000000 - 7FFFFFFFh. The upper 2GB of linear memory address range 80000000h - 0FFFFFFFFh maps system components such as device drivers, system memory pools, system data structures etc. Sharing permissions and responsibilities is slightly complicated.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;The architecture of the Intel x86 processor defines four privilege levels (known as rings). Windows uses privilege level 0 (or ring 0) for kernel-mode and privilege level 3 (or ring 3) for user-mode. The reason Windows uses only two levels is that some of the hardware architectures that were supported in the past (such as Compaq Alpha and Silicon Graphics MIPS) implemented only two privilege levels.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;Properly speaking the user-mode applications are completely separated from the operating system. It's good for the integrity of the operating system but it could be a headache for some kind of utility application such as debugging tools. Fortunately, unrestricted access provided by the kernel-mode drivers could be used to perform practically impossible tasks on behalf of user-mode applications. So, if you plan to access internal operating system functions or data structures that are not accessible in user-mode, the only way is to load a kernel-mode driver into the system address space. It's rather simple, yet reliable and completely supported by the operating system itself.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-2887967931414652878?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/2887967931414652878/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/05/from-kmd-tutorial.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/2887967931414652878'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/2887967931414652878'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/05/from-kmd-tutorial.html' title='from KMD tutorial'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-7830134022514561217</id><published>2007-05-23T00:37:00.000-07:00</published><updated>2008-02-14T00:26:44.200-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='script tricks'/><title type='text'>Some very very useful unix command !!!</title><content type='html'>There is something I wish I could remember and forget again and again, so I note them down.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#993300;"&gt;.tar&lt;/span&gt; ; use tar -xvvf to un-tar them&lt;br /&gt;&lt;span style="color:#993300;"&gt;.gz&lt;/span&gt;  ; use uncompress&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#993300;"&gt;find . -name xxx&lt;/span&gt; ; search for a file or dir named xxx in the current directory&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#993300;"&gt;rm      &lt;/span&gt;; to delete a file&lt;br /&gt;&lt;span style="color:#993300;"&gt;rm -r&lt;/span&gt; ; to delete a directory&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#990000;"&gt;more&lt;/span&gt; ; to see the first few lines of a file&lt;br /&gt;&lt;span style="color:#990000;"&gt;less    &lt;/span&gt;; to see the last few lines of a file&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#993300;"&gt;rpm -ivh packageName&lt;/span&gt; ; to install a rpm package&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-7830134022514561217?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/7830134022514561217/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/05/some-very-very-frequent-unix-command.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/7830134022514561217'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/7830134022514561217'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/05/some-very-very-frequent-unix-command.html' title='Some very very useful unix command !!!'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-4251499431098989607</id><published>2007-05-16T02:46:00.000-07:00</published><updated>2008-02-13T22:33:13.310-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='X86 secrets'/><title type='text'>Some debugging tools for system developers</title><content type='html'>&lt;span style="color:#000000;"&gt;Here is some good assembly tools that worth recommendations.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;* windows Debug.exe&lt;/span&gt;&lt;br /&gt;The only 16 bit debugger that I know is debug.exe; it is free, and it comes with every modern windows system, just type 'debug a.exe' from command prompt to use it.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;* dependency walker&lt;/span&gt;&lt;br /&gt;A nice DLL dependency analyzer from microsoft. It will list different PE section information according to windows PE format.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;* PE browser&lt;/span&gt;&lt;br /&gt;A 3rd party free tool. Nice work! It is capable of de-assemble 32 bit executable, and comment it nicely.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;* OllyDBG&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;Quite famous tool among assembly programmers. It is capable to de-assemble 32 bit executable, and trace code while watching memory and processor registers.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;* Visual studio dumpbin&lt;/span&gt;&lt;br /&gt;I have not tried yet. no comment.&lt;br /&gt;&lt;br /&gt;please leave a comment if you know of any good de-assembler and executable analyzer. thanks for sharing!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-4251499431098989607?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/4251499431098989607/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/05/some-notes-in-debuggers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/4251499431098989607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/4251499431098989607'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/05/some-notes-in-debuggers.html' title='Some debugging tools for system developers'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-2690503511149832728</id><published>2007-05-16T02:44:00.000-07:00</published><updated>2007-05-16T02:46:12.593-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='X86 secrets'/><title type='text'>some notes on masm</title><content type='html'>summary on c style calling convention:&lt;br /&gt;&lt;br /&gt;1. the caller needs to push params to stack&lt;br /&gt;2. params are pushed from right to left&lt;br /&gt;3. caller needs to adjust the stack after 'call' (increase the sp)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-2690503511149832728?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/2690503511149832728/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/05/some-notes-on-masm.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/2690503511149832728'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/2690503511149832728'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/05/some-notes-on-masm.html' title='some notes on masm'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-4518518496838893644</id><published>2007-05-15T02:10:00.000-07:00</published><updated>2007-05-15T02:17:35.379-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='script tricks'/><title type='text'>! you do want to miss this -- ultra ugly tricks in batch</title><content type='html'>here I will introduce three ugly tricks to do one simple task -- get the batch file path from inside&lt;br /&gt;&lt;br /&gt;1. very ugly, appears very sophisticated, very profound&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;for /f %%i in ("%0") do set curpath=%%~dpi &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;cd /d %curpath%&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;[%0 returns the file path and name that your typed at command prompt to run the batch, and ~dp means to get &lt;span style="color:#000066;"&gt;drive&lt;/span&gt; and &lt;span style="color:#000066;"&gt;path&lt;/span&gt;]&lt;br /&gt;&lt;br /&gt;2. much more simpler, and easier to understand&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;cd /d %~dp0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;[see explanation in item 1]&lt;br /&gt;&lt;br /&gt;3.  simple and maybe can not be simpler&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;cd /d %0\..&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;[do I need to explain? ]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-4518518496838893644?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/4518518496838893644/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/05/you-do-want-to-miss-this-ultra-ugly.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/4518518496838893644'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/4518518496838893644'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/05/you-do-want-to-miss-this-ultra-ugly.html' title='! you do want to miss this -- ultra ugly tricks in batch'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-1044832903020281229</id><published>2007-05-14T18:13:00.000-07:00</published><updated>2007-05-14T18:20:53.027-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OS hacks'/><title type='text'>What is Delay loading DLL?</title><content type='html'>This is a popular terms cited under windows programming. What is really a delayed loading of DLL? You can get a rought idea from the following article from codeproject.com&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.codeproject.com/dll/Delay_Loading_Dll.asp"&gt;http://www.codeproject.com/dll/Delay_Loading_Dll.asp&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Normally, if you executable reference a API function in another DLL, windows loader will attempt to load the DLL into memory, and report error if the DLL is missing or out of date. If your application has a lot of DLL dependancy, then the loading process will be long, even if you just made one API call to each DLL.&lt;br /&gt;&lt;br /&gt;Delay Loading of DLL simply means the DLL is not loaded until a call to the API inside has been made. By adding a few linker directive in the exe, the windows loader will be able to do so.&lt;br /&gt;&lt;br /&gt;Disadvantage: if the underlying dll is missing, it will only be discovered when the call the API in dll has been made, and your program maybe terminated abruptly at run time. SO a Structure Exception Handler (SEH) is suggested.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-1044832903020281229?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/1044832903020281229/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/05/what-is-delay-loading-dll.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/1044832903020281229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/1044832903020281229'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/05/what-is-delay-loading-dll.html' title='What is Delay loading DLL?'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-6632303446607752177</id><published>2007-05-13T18:59:00.000-07:00</published><updated>2007-05-13T19:03:03.654-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='X86 secrets'/><title type='text'>bootup sequence from disk perspective -- a chinese version</title><content type='html'>&lt;span style="color:#000066;"&gt;&lt;a href="http://211.90.241.130:22366/view.asp?file=309"&gt;http://211.90.241.130:22366/view.asp?file=309&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;罗云彬的网站教程&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;三. 系统启动过程简介    系统启动过程主要由一下几步组成(以硬盘启动为例):   &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;1. 开机 :-)    &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;2. BIOS 加电自检 ( Power On Self Test -- POST )       内存地址为 0ffff:0000    &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;3. 将硬盘第一个扇区 (0头0道1扇区, 也就是Boot Sector)       读入内存地址 0000:7c00 处.    &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;4. 检查 (WORD) 0000:7dfe 是否等于 0xaa55, 若不等于       则转去尝试其他启动介质, 如果没有其他启动介质则显示       "No ROM BASIC" 然后死机.    &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;5. 跳转到 0000:7c00 处执行 MBR 中的程序.    &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;6. MBR 首先将自己复制到 0000:0600 处, 然后继续执行.    &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;7. 在主分区表中搜索标志为活动的分区. 如果发现没有活动       分区或有不止一个活动分区, 则转停止.    &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;8. 将活动分区的第一个扇区读入内存地址 0000:7c00 处.    &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;9. 检查 (WORD) 0000:7dfe 是否等于 0xaa55, 若不等于则       显示 "Missing Operating System" 然后停止, 或尝试       软盘启动.    &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;10. 跳转到 0000:7c00 处继续执行特定系统的启动程序.    &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;11. 启动系统 ...    &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000066;"&gt;以上步骤中 2,3,4,5 步是由 BIOS 的引导程序完成. 6,7,8,9,10步由MBR中的引导程序完成.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-6632303446607752177?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/6632303446607752177/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/05/bootup-sequence-from-disk-perspective.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/6632303446607752177'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/6632303446607752177'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/05/bootup-sequence-from-disk-perspective.html' title='bootup sequence from disk perspective -- a chinese version'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-4935814703129927430</id><published>2007-05-12T02:14:00.000-07:00</published><updated>2007-05-12T02:25:13.126-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='X86 secrets'/><title type='text'>the many difference between 16 bit asm and 32 bit asm</title><content type='html'>There are many things being different between 16 bit asm programming and 32 bit asm programming.&lt;br /&gt;&lt;br /&gt;* The introduction of 32 bit segment registers. (EAX, EBX, etc)&lt;br /&gt;&lt;br /&gt;* A program written in native 32 bit Windows format is created in what is called FLAT memory model which has a single segment that contains both code and data. The programs must be run on a 386 or higher processor.&lt;br /&gt;&lt;br /&gt;* Differing from earlier 16 bit code that used combined segment and offset addressing with a 64k segment limit, FLAT memory model works only in offsets and has a range of 4 gigabytes. This makes assembler easier to write and the code is generally a lot faster.&lt;br /&gt;&lt;br /&gt;* All segment registers are automatically set to the same value with this memory model and this means that segment / offset addressing must NOT be used in 32 bit programs that run in 32 bit Windows.&lt;br /&gt;&lt;br /&gt;* For programmers who have written code in DOS, a 32 bit Windows PE executable file is similar in some respects to a dos COM file, they have a single segment that can contain both code and data and they both work directly in offsets, neither use Segment / Offset addressing. The defaults in flat-model programs are NEAR code addressing and NEAR data addressing within the range of 4 gigabytes.&lt;br /&gt;&lt;br /&gt;* The addition of FS and GS segment registers in 32 bit mode. The FS and GS segment registers are not normally used in application programs but are used in some instances by the operating system.&lt;br /&gt;&lt;br /&gt;* 32 bit mode has introduced the concept of priority which helps for memory organization and isolation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-4935814703129927430?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/4935814703129927430/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/05/many-difference-between-16-bit-asm-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/4935814703129927430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/4935814703129927430'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/05/many-difference-between-16-bit-asm-and.html' title='the many difference between 16 bit asm and 32 bit asm'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-33539164363570773</id><published>2007-05-11T01:42:00.000-07:00</published><updated>2007-05-11T02:40:53.485-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OS hacks'/><title type='text'>What is MBR, and How it works?</title><content type='html'>the following information is based on my understanding of the following webpage, please read the original site for detailed explanation.&lt;br /&gt;&lt;a href="http://mirror.href.com/thestarman/asm/mbr/Win2kmbr.htm"&gt;http://mirror.href.com/thestarman/asm/mbr/Win2kmbr.htm&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;MBR is the first sector in the first cylinder, first head of the current Master hard drive active partition. It is a 512 bytes (one sector) long paragraph of data and code.&lt;br /&gt;&lt;br /&gt;* what is inside the MBR? -- under windows, you can use any binary reader to open &lt;span style="color:#000066;"&gt;c:\windows\system32\dmadmin.exe&lt;/span&gt;, and the MBR code itself is found between offsets &lt;span style="color:#333399;"&gt;34E28h&lt;/span&gt; through &lt;span style="color:#000066;"&gt;35027h&lt;/span&gt;. It contains some machine code, some error message, some OS related remarks and last but not least, the partition table.&lt;br /&gt;&lt;br /&gt;* how it is invoked? -- I am not very sure about my answer, but I do provide short answer here. remember the DOS interrupt &lt;span style="color:#000066;"&gt;int 13&lt;/span&gt;? Yes, &lt;span style="color:#000066;"&gt;int 13&lt;/span&gt; is used in BIOS to load this particular sector into memory location &lt;span style="color:#000066;"&gt;0000:7c00&lt;/span&gt;. The processor will execute the code from &lt;span style="color:#000066;"&gt;0000:7c00&lt;/span&gt;, and somewhere at &lt;span style="color:#000066;"&gt;0000:7c1B&lt;/span&gt;, the code will try to copy the rest of the sector (about &lt;span style="color:#000066;"&gt;485&lt;/span&gt; bytes long)  to another memory location.&lt;br /&gt;&lt;br /&gt;[why make another copy? because this copy in memory will be overwritten by boot sector of the active partition later. the remaining code has to find itself a new home. :) ]&lt;br /&gt;&lt;br /&gt;The website listed above provide some code comment to the disassembled MBR machine code. nice work!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-33539164363570773?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/33539164363570773/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/05/what-is-mbr-and-how-it-works.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/33539164363570773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/33539164363570773'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/05/what-is-mbr-and-how-it-works.html' title='What is MBR, and How it works?'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-6567670300902426870</id><published>2007-05-09T22:56:00.000-07:00</published><updated>2007-05-09T23:33:09.424-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OS hacks'/><title type='text'>How does IBM compatible PC boot up?</title><content type='html'>precaution: do not take my statement word by word, this is just very very rough and inaccurate guide on this topic.&lt;br /&gt;&lt;br /&gt;--- it all starts with a cold reset.&lt;br /&gt;&lt;br /&gt;--- the processor will try to look for a BIOS rom at a pre-defined sytem IO address (F000:FFF0)&lt;br /&gt;&lt;br /&gt;--- if the ROM is found and it is valid, processor will try to execute the BIOS code in the rom, and doing all hardware validation and initialization stuff (so called &lt;span style="color:#660000;"&gt;Power On Self Check&lt;/span&gt;, or POST)&lt;br /&gt;&lt;br /&gt;[ after the memory controller is initialized successfully, part of the ROM code and data will be copied (or you call shadowed) to the DRAM, and execution continues from there.]&lt;br /&gt;&lt;br /&gt;--- when all this done, and a default or user preferred fix storage is detected (e.g. a hdd)&lt;br /&gt;&lt;br /&gt;--- processor will look into the first sector of the hdd partition (so called &lt;span style="color:#660000;"&gt;Master boot record&lt;/span&gt;, or MBR)&lt;br /&gt;&lt;br /&gt;[MBR is a 512 bytes long area in hdd, and it contains the disk partition, vendor info, and something related to 2nd stage boot loader, while the MBR is considered the 1st stage boot loader]&lt;br /&gt;&lt;br /&gt;--- MBR machine code may boot directly to OS or it may pass control to 2nd stage boot loader (normally, it refers to famous names: &lt;span style="color:#660000;"&gt;LILO, GRUB or window NTLDR&lt;/span&gt;)&lt;br /&gt;&lt;br /&gt;[these 2nd stage boot loader normally have some user interaction shell, and allows user to boot from one of several installed OSes]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-6567670300902426870?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/6567670300902426870/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/05/how-does-ibm-compatible-pc-boot-up.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/6567670300902426870'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/6567670300902426870'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/05/how-does-ibm-compatible-pc-boot-up.html' title='How does IBM compatible PC boot up?'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-7245423128450902699</id><published>2007-05-08T20:00:00.000-07:00</published><updated>2007-05-09T23:33:09.424-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='OS hacks'/><title type='text'>windows exe file format, etc</title><content type='html'>some un-organized notes...&lt;br /&gt;&lt;br /&gt;Early versions of Microsoft windows OS are DOS-based, from windows 3.0 to Windows Me, the GUI are just graphical shells of the underlying DOS system. However, the DOS basis is discarded when Microsoft moved on to Windows NT and its late variations (so called windows 2000 and windows xp).&lt;br /&gt;&lt;br /&gt;For a executionable file to be excuted by the operating system, some common consensus over fie format has to be agreed. How does it tell the OS to find libraries, etc. This leads to the area of windows exe file format. In the current prevailing windows platform, PE (portable executable) format is assumed. Portable executable basically targets at portability over all all 32 bit Microsoft OSes. PE is developed based on the old COFF (common object file format) format on Unix.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-7245423128450902699?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/7245423128450902699/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/05/windows-exe-file-format-etc.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/7245423128450902699'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/7245423128450902699'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/05/windows-exe-file-format-etc.html' title='windows exe file format, etc'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-7262937718627823240</id><published>2007-04-19T20:00:00.000-07:00</published><updated>2007-06-10T20:36:18.393-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='X86 secrets'/><title type='text'>some important but always ignored questions in ASM</title><content type='html'>These are some issues which bothered me a lot when I started to code ASM. I hope to note down and share it with people.&lt;br /&gt;&lt;br /&gt;The first fact on ASM tutorial and sample code for beginners, most of them are written for 16 bit environment!!! And, what does that mean? it means you have to compile them with 16 bit assembler and link them with 16 bit linker. If you happen to start with Microsoft MASM v8 (like me), you may use the 'ml.exe' for 16 bit or 32 bit code assembling by a command option switch, however, the default 'Link.exe' included with the package is a 32 bit linker and it does not link 16 bit object files!!!&lt;br /&gt;&lt;br /&gt;so??? so you have to download a separate 16 bit linker(supposeably, 'lnk16.exe'), and put it in the /bin directory of your assembler installation, and specifically use it.&lt;br /&gt;&lt;br /&gt;now that is how your compile your 16-bit code,&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#6633ff;"&gt;C:\masm32\bin\ML /c /Cp /nologo /I"C:\masm32\include" A16bit.ASM&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#6633ff;"&gt;C:\masm32\bin\Lnk16 /SUBSYSTEM:CONSOLE A16bit.obj /o A16bit.exe&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#6633ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#993399;"&gt;(the /c option force the ML.exe to do assembling only, no linking.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#993399;"&gt;/Cp keep user case sensitive symbols)&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#6633ff;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#6633ff;"&gt;&lt;span style="color:#000000;"&gt;or alternatively, you can compile and link in one go,&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#6633ff;"&gt;C:\masm32\ML &lt;span style="color:#cc0000;"&gt;/Bl .\Lnk16.exe&lt;/span&gt; /SUBSYSTEM:CONSOLE /Cp /nologo /I"C:\masm32\include" A16bit.ASM /o A16bit.exe&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000000;"&gt;then how do we compile 32-bit code? using the /coff switch. This is how you compile them in one go,&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#6600cc;"&gt;C:\masm32\ML &lt;span style="color:#cc0000;"&gt;/coff&lt;/span&gt; /Cp /nologo /SUBSYSTEM:WINDOWS /I"C:\masm32\include" A16bit.ASM /o A16bit.exe&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#993399;"&gt;(this will use the default 'link.exe')&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#993399;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#993399;"&gt;&lt;span style="color:#000000;"&gt;There are actually quite a lot of options for ML and link, and you can find them out by&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#6600cc;"&gt;ML /?&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#6600cc;"&gt;link /?&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#6600cc;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;2007. June. 11&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#6600cc;"&gt;&lt;span style="color:#660000;"&gt;some more comment regarding the 16bit issue, when you see the following code snippet in asm, they mean to be compiled by 16 bit environment,&lt;/span&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="color:#6600cc;"&gt;==================&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;mov     ax, code&lt;/span&gt; ; or mov ax, @data&lt;br /&gt;mov     ds, ax&lt;br /&gt;mov     es, ax&lt;br /&gt;&lt;span style="color:#000099;"&gt;==================&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#660000;"&gt;such statement is NOT allowed by 32bit compilers. Under 32 bit environment, segment concept is totally different.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-7262937718627823240?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/7262937718627823240/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/04/some-important-but-always-ignored.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/7262937718627823240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/7262937718627823240'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/04/some-important-but-always-ignored.html' title='some important but always ignored questions in ASM'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-8415357493066249517</id><published>2007-04-16T02:15:00.000-07:00</published><updated>2007-04-16T02:28:16.635-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='math fun'/><title type='text'>Dining philosophers problem</title><content type='html'>&lt;div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;a href="http://en.wikipedia.org/wiki/Dining_philosophers_problem"&gt;http://en.wikipedia.org/wiki/Dining_philosophers_problem&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;a href="http://bp2.blogger.com/_mWsL8abaYZk/RiNBYL6B7NI/AAAAAAAAADc/Njqd90rAhAs/s1600-h/200px-Dining_philosophers.png"&gt;&lt;img id="BLOGGER_PHOTO_ID_5053955090608680146" style="CURSOR: hand" alt="" src="http://bp2.blogger.com/_mWsL8abaYZk/RiNBYL6B7NI/AAAAAAAAADc/Njqd90rAhAs/s400/200px-Dining_philosophers.png" border="0" /&gt;&lt;/a&gt;&lt;a href="http://en.wikipedia.org/wiki/Dining_philosophers_problem"&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-8415357493066249517?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/8415357493066249517/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/04/dining-philosophers-problem.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/8415357493066249517'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/8415357493066249517'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/04/dining-philosophers-problem.html' title='Dining philosophers problem'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp2.blogger.com/_mWsL8abaYZk/RiNBYL6B7NI/AAAAAAAAADc/Njqd90rAhAs/s72-c/200px-Dining_philosophers.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-5554931811267107668</id><published>2007-04-12T17:56:00.000-07:00</published><updated>2007-05-09T23:32:27.723-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='script tricks'/><title type='text'>some useful windows batch file command</title><content type='html'>@ECHO OFF:: Check Windows version -- Windows 2000 or later&lt;br /&gt;&lt;br /&gt;IF NOT "%OS%"=="Windows_NT" GOTO Syntax&lt;br /&gt;VER  FIND.EXE "Windows NT" &gt;NUL&lt;br /&gt;IF NOT ERRORLEVEL 1 GOTO Syntax&lt;br /&gt;&lt;br /&gt;:: Save a list of ALL shares found on the source server&lt;br /&gt;NET.EXE SHARE &gt; "%~dp0%ComputerName%_originalshares.txt" 2&gt;&amp;amp;1&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-5554931811267107668?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/5554931811267107668/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/04/some-useful-windows-batch-file-command.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/5554931811267107668'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/5554931811267107668'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/04/some-useful-windows-batch-file-command.html' title='some useful windows batch file command'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-675183977276529802</id><published>2007-04-12T02:42:00.000-07:00</published><updated>2007-05-09T23:34:22.571-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C51 stuff'/><title type='text'>dirty tricks in 80C51</title><content type='html'>The following content is quoted from:&lt;br /&gt;&lt;a href="http://www.esacademy.com/automation/docs/c51primer/c15.htm#15"&gt;http://www.esacademy.com/automation/docs/c51primer/c15.htm#15&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.esacademy.com/automation/docs/c51primer/c15.htm#15"&gt;General Things to be Aware of&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The ANSI standard says that the product of two 8 bit numbers is also an 8 bit number. This means that any unsigned chars which might have to be multiplied must actually be declared as unsigned int's if there is any possibility that they may produce even an intermediate result over 255.&lt;br /&gt;&lt;br /&gt;However it is very wasteful to use integer quantities in an 8051 if a char can do the job! The solution is to temporarily convert (cast) a char to an int. Here the numerator potentially could be 16 bits but the result always 8 bits. The "(unsigned int)" casts ensure that a 16 bit multiply is used by C51.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#333399;"&gt;{&lt;br /&gt;unsigned char z ;&lt;br /&gt;unsigned char x ;&lt;br /&gt;unsigned char y ;&lt;br /&gt;z = ((unsigned int) y * (unsigned int) x) &gt;&gt; 8 ;&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here the two eight bit numbers x and y are multiplied and then divided by 256. The intermediate 16 bit (unsigned int) result is permissible because y and x have been loaded by the multiplier library routine as int's.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-675183977276529802?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/675183977276529802/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/04/dirty-tricks-in-80c51.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/675183977276529802'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/675183977276529802'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/04/dirty-tricks-in-80c51.html' title='dirty tricks in 80C51'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-8905208264348328906</id><published>2007-04-12T01:33:00.000-07:00</published><updated>2007-05-09T23:30:35.704-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='hardware'/><title type='text'>RS485, specifications and in depth tutorial</title><content type='html'>&lt;a href="http://www.lammertbies.nl/comm/info/RS-485.html"&gt;http://www.lammertbies.nl/comm/info/RS-485.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;a very good illustration of RS-485, and its difference and advantage over RS232.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-8905208264348328906?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/8905208264348328906/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/04/rs485-specifications-and-in-depth.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/8905208264348328906'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/8905208264348328906'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/04/rs485-specifications-and-in-depth.html' title='RS485, specifications and in depth tutorial'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-8015866842999690034</id><published>2007-04-02T23:35:00.000-07:00</published><updated>2009-02-03T06:21:59.061-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='I create'/><title type='text'>Why SWT? Why not SWING? - (1)</title><content type='html'>Well, this is a hard question. Do not mistake me, neither of them is better than the other. I have been using SWING for more than three years, and SWING is perfectly designed to embrace the concept of MVC (Model-View-Control). I love it.&lt;br /&gt;&lt;br /&gt;In Java paradigm, SWING is considered a RI (reference implementation) for Java graphical specification. Yes, I believe most people will equal SWING and Java GUI library, but, that is not totally true. SWT is another implementation from IBM. I will try to touch a bit on the difference.&lt;br /&gt;&lt;br /&gt;Java boasts its cross-platform capability of "write once, compile once, and run everywhere". The secret and cost is a virtual machine(VM) residing on every single OS species to run these compiled byte codes. SWING is part of the standard library implementation. The virtual machine will try to render every object you intended and coded on its own effort (without the help of OS). Well, this ensures the same graphics appears on different OSes (if you code wisely), but it hurts the runtime performance. This is even more sketchy in early versions of Sun JDK release. IBM has tried to tackle this problem from a fundamentally 'un-java' approach. SWT leverages the strength of MS Windows API, and let the windows draw whenever possible, and let Java draw whenelse. There are significant improvement in speed, but it becomes partially 'native'. While, you may already realized, is it still Java? emmm, that is a good question. But the fact is, SWT implementation is not bad, and it has quite a lot of users.&lt;br /&gt;&lt;br /&gt;to be continued...&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-8015866842999690034?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/8015866842999690034/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/04/why-swt-why-not-swing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/8015866842999690034'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/8015866842999690034'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/04/why-swt-why-not-swing.html' title='Why SWT? Why not SWING? - (1)'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-3781926165053464560</id><published>2007-04-01T22:24:00.000-07:00</published><updated>2007-05-09T23:35:32.700-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='X86 secrets'/><title type='text'>G state, D state, C state, P state, what are they? -- ACPI</title><content type='html'>&lt;span style="color:#ff0000;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;The following are extracted from wikipedia.org.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="color:#000099;"&gt;&lt;em&gt;Global states&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;&lt;em&gt;&lt;span style="color:#000099;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;p&gt;&lt;br /&gt;The ACPI specification defines the following seven states (so-called global states) an ACPI-compliant computer system can be in:&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="color:#cc66cc;"&gt;G0&lt;/span&gt; Working is the normal working state of the computer, meaning that the operating system and whatever applications, run. The &lt;a title="CPU" href="http://en.wikipedia.org/wiki/CPU"&gt;CPU&lt;/a&gt;(s) execute instructions. Within this state (i.e., without entering G1 Sleeping), it is possible for &lt;a title="CPU" href="http://en.wikipedia.org/wiki/CPU"&gt;CPU&lt;/a&gt;(s) and devices like &lt;a title="Hard drive" href="http://en.wikipedia.org/wiki/Hard_drive"&gt;hard drives&lt;/a&gt;, &lt;a title="DVD drive" href="http://en.wikipedia.org/wiki/DVD_drive"&gt;DVD drives&lt;/a&gt;, etc. to be repeatedly put into and come back from low-energy states, called &lt;a title="" href="http://en.wikipedia.org/wiki/Acpi#Processor_states"&gt;C0–Cn&lt;/a&gt; and &lt;a title="" href="http://en.wikipedia.org/wiki/Acpi#Device_states"&gt;D0–D3&lt;/a&gt;. (&lt;a title="Laptop" href="http://en.wikipedia.org/wiki/Laptop"&gt;Laptops&lt;/a&gt;, for example, routinely power down all currently unused devices when running on battery; some computers do this to reduce noise.)&lt;br /&gt;G1 Sleeping subdivides into the four states S1 through S4. The time needed to bring the system from here back into G0 Working (wake-latency time) is shortest for S1, short for S2 and S3, and not so short for S4. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="color:#cc33cc;"&gt;S1&lt;/span&gt; is the most power-hungry of sleep modes. All processor caches are flushed, and the CPU(s) stop executing instructions. Power to the CPU(s) and RAM is maintained; devices that do not indicate they must remain on may be powered down. Some newer machines do not support S1; older machines are more likely to support S1 than S3. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="color:#cc33cc;"&gt;S2&lt;/span&gt; is a deeper sleep state than S1, where the CPU is powered off; however, it is not commonly implemented. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="color:#cc33cc;"&gt;S3&lt;/span&gt; is called Standby in &lt;a title="Microsoft Windows" href="http://en.wikipedia.org/wiki/Microsoft_Windows"&gt;Windows&lt;/a&gt;, Sleep in &lt;a title="Mac OS X" href="http://en.wikipedia.org/wiki/Mac_OS_X"&gt;Mac OS X&lt;/a&gt;, and sometimes also Suspend to RAM (STR), although the ACPI specification mentions only the terms S3 and Sleep. In this state, main memory (&lt;a title="RAM" href="http://en.wikipedia.org/wiki/RAM"&gt;RAM&lt;/a&gt;) is still powered, although it is almost the only component that is. Since the state of the &lt;a title="Operating system" href="http://en.wikipedia.org/wiki/Operating_system"&gt;operating system&lt;/a&gt; and all applications, open documents, etc. lies all in main memory, the user can resume work exactly where he/she left off—the main memory content when the computer comes back from S3 is the same as when it was put into S3. (The specification mentions that S3 is rather similar to S2, only that some more components are powered down in S3.) S3 has two advantages over S4; the computer resumes in about the time it takes the monitor to come on, secondly if any running applications (open documents, etc) have private information in them, this will not be written to the disk. &lt;a title="Desktop computer" href="http://en.wikipedia.org/wiki/Desktop_computer"&gt;Desktop&lt;/a&gt; users using this state may want to disable disk &lt;a title="Caching" href="http://en.wikipedia.org/wiki/Caching"&gt;caching&lt;/a&gt; (also called &lt;a title="Caching" href="http://en.wikipedia.org/wiki/Caching#Disk_buffer"&gt;disk buffer&lt;/a&gt;) so that, in the event of a power failure, the system disk is less likely to become corrupted due to data in the cache not being written to the disk. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="color:#cc33cc;"&gt;S4&lt;/span&gt; -- Main article: &lt;a title="Hibernate (OS feature)" href="http://en.wikipedia.org/wiki/Hibernate_(OS_feature)"&gt;Hibernate (OS feature)&lt;/a&gt;. S4 is called Hibernation in &lt;a title="Microsoft Windows" href="http://en.wikipedia.org/wiki/Microsoft_Windows"&gt;Windows&lt;/a&gt;, Safe Sleep in &lt;a title="Mac OS X" href="http://en.wikipedia.org/wiki/Mac_OS_X"&gt;Mac OS X&lt;/a&gt;, and sometimes also Suspend to disk, although the ACPI specification mentions only the term S4. In this state, all content of &lt;a title="RAM" href="http://en.wikipedia.org/wiki/RAM"&gt;main memory&lt;/a&gt; is saved to a &lt;a title="Hard drive" href="http://en.wikipedia.org/wiki/Hard_drive"&gt;hard drive&lt;/a&gt;, preserving the state of the &lt;a title="Operating system" href="http://en.wikipedia.org/wiki/Operating_system"&gt;operating system&lt;/a&gt;, all applications, open documents etc. That means that after coming back from S4, the user can resume work where it was left off in much the same way as with S3. The difference between S4 and S3, apart from the added time of moving the main memory content to disk and back, is that a power loss of a computer in S3 makes it lose all data in main memory, including all unsaved documents, while a computer in S4 is unaffected. S4 is quite different from the other S states and actually resembles G2 Soft Off and G3 Mechanical Off more than it resembles S1–S3.&lt;br /&gt;G2 (S5) Soft Off-- G2, S5, and Soft Off are &lt;a title="Synonyms" href="http://en.wikipedia.org/wiki/Synonyms"&gt;synonyms&lt;/a&gt;. G2 is almost the same as G3 Mechanical Off, but some components remain powered so the computer can "wake" from input from the keyboard, &lt;a title="LAN" href="http://en.wikipedia.org/wiki/LAN"&gt;LAN&lt;/a&gt;, or &lt;a title="USB" href="http://en.wikipedia.org/wiki/USB"&gt;USB&lt;/a&gt; device &lt;a class="external autonumber" title="http://www.kananov.com/notes/s3" href="http://www.kananov.com/notes/s3" rel="nofollow"&gt;[2]&lt;/a&gt;. This state is the same as G3 Mechanical Off, in that the &lt;a title="Booting" href="http://en.wikipedia.org/wiki/Booting"&gt;boot procedure&lt;/a&gt; must be run to bring the system from G2 to G0 Working. G3 Mechanical Off is entered only when a power loss occurs, whereas G2 is initiated by the &lt;a title="Operating system" href="http://en.wikipedia.org/wiki/Operating_system"&gt;operating system&lt;/a&gt; (typically because the user issued a shutdown command in some way). The computer is not safe for disassembly in the G2 state due to the components that remain powered, however it is safe to unplug the computer and, after approximately 20 seconds, the computer will be in the G3 state. It is always advisable to unplug a &lt;a title="Desktop computer" href="http://en.wikipedia.org/wiki/Desktop_computer"&gt;desktop computer&lt;/a&gt; (and wait 20 seconds) prior to "disassembly", because, although internal drives are usually not powered, the (&lt;a title="PS/2 connector" href="http://en.wikipedia.org/wiki/PS/2_connector"&gt;PS2&lt;/a&gt;) keyboard, &lt;a title="USB" href="http://en.wikipedia.org/wiki/USB"&gt;USB&lt;/a&gt; ports, &lt;a title="Mainboard" href="http://en.wikipedia.org/wiki/Mainboard"&gt;mainboard&lt;/a&gt;, &lt;a title="Expansion cards" href="http://en.wikipedia.org/wiki/Expansion_cards"&gt;expansion cards&lt;/a&gt;, and &lt;a title="Power supply" href="http://en.wikipedia.org/wiki/Power_supply"&gt;power supply&lt;/a&gt; may remain powered, even if the computer is not used to wake from input to these devices.&lt;br /&gt;G3 Mechanical Off: The computer's power consumption is very close to zero, to the point that the power cord can be removed and the system is safe for disassembly (typically, only the real-time clock is running off its own small battery). The computer falls into this state when a power loss occurs, e.g. in case of a power outage. Once power is restored, a full &lt;a title="Booting" href="http://en.wikipedia.org/wiki/Booting"&gt;boot procedure&lt;/a&gt; is necessary to bring the system from G3 to G0 Working.&lt;br /&gt;Furthermore, a state Legacy is defined as the state when an &lt;a title="Operating system" href="http://en.wikipedia.org/wiki/Operating_system"&gt;operating system&lt;/a&gt; runs which does not support ACPI. In this state, the hardware and power are not managed via ACPI, effectively disabling ACPI.&lt;br /&gt;(Reference: ACPI specification 3.0b is linked to under &lt;a title="" href="http://en.wikipedia.org/wiki/Acpi#External_links"&gt;External links&lt;/a&gt;, section 7.3.4)&lt;/p&gt;&lt;span style="color:#ff0000;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;Device states&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;&lt;/span&gt;&lt;br /&gt;The device states D0-D3 are device-dependent:&lt;br /&gt;&lt;span style="color:#cc33cc;"&gt;D0&lt;/span&gt; Fully-On is the operating state.&lt;br /&gt;&lt;span style="color:#cc33cc;"&gt;D1&lt;/span&gt; and D2 are intermediate power states whose definition varies by device.&lt;br /&gt;&lt;span style="color:#cc33cc;"&gt;D3&lt;/span&gt; Off has the device powered off and unresponsive to its bus.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;Processor states&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The CPU power states C0-C3 are defined as follows:&lt;br /&gt;&lt;span style="color:#cc33cc;"&gt;C0&lt;/span&gt; is the operating state.&lt;br /&gt;&lt;span style="color:#cc33cc;"&gt;C1&lt;/span&gt; (often known as Halt) is a state where the processor is not executing instructions, but can return to an executing state essentially instantaneously. Some processors, such as the Pentium 4, also support an Enhanced C1 state (C1E) for lower power consumption.&lt;br /&gt;&lt;span style="color:#cc33cc;"&gt;C2&lt;/span&gt; (often known as Stop-Clock) is a state where the processor maintains all software-visible state, but may take longer to wake up.&lt;br /&gt;&lt;span style="color:#cc33cc;"&gt;C3&lt;/span&gt; (often known as Sleep) is a state where the processor does not need to keep its &lt;a title="Cache" href="http://en.wikipedia.org/wiki/Cache"&gt;cache&lt;/a&gt; coherent, but maintains other state. Some processors have variations on the C3 state (Deep Sleep, Deeper Sleep, etc.) that differ in how long it takes to wake the processor.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;Performance states&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;&lt;br /&gt;&lt;/span&gt;While a device or processor is operating (D0 and C0, respectively), it can be in one of several power-performance states. These states are implementation-dependent, but P0 is always the highest-performance state, with &lt;span style="color:#cc33cc;"&gt;P1 to Pn&lt;/span&gt; being successively lower-performance states, up to an implementation-specific limit of n no greater than 16.&lt;br /&gt;P-states are called &lt;a title="SpeedStep" href="http://en.wikipedia.org/wiki/SpeedStep"&gt;SpeedStep&lt;/a&gt; in &lt;a title="Intel" href="http://en.wikipedia.org/wiki/Intel"&gt;Intel&lt;/a&gt; processors, &lt;a title="Cool'n'Quiet" href="http://en.wikipedia.org/wiki/Cool"&gt;Cool'n'Quiet&lt;/a&gt; in &lt;a title="Advanced Micro Devices" href="http://en.wikipedia.org/wiki/Advanced_Micro_Devices"&gt;AMD&lt;/a&gt; processors and &lt;a class="new" title="PowerSaver" href="http://en.wikipedia.org/w/index.php?title=PowerSaver&amp;action=edit"&gt;PowerSaver&lt;/a&gt; in &lt;a title="VIA" href="http://en.wikipedia.org/wiki/VIA"&gt;VIA&lt;/a&gt; processors.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-3781926165053464560?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/3781926165053464560/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/04/g-state-d-state-c-state-p-state-what.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/3781926165053464560'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/3781926165053464560'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/04/g-state-d-state-c-state-p-state-what.html' title='G state, D state, C state, P state, what are they? -- ACPI'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-3249301035697909633</id><published>2007-04-01T20:58:00.000-07:00</published><updated>2007-05-09T23:35:32.700-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='X86 secrets'/><title type='text'>Key Benefits of the I/O APIC</title><content type='html'>&lt;span style="color:#ff0000;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;The following contains extracts from MSDN and wikipedia.com.&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#ff0000;"&gt;&lt;/span&gt;&lt;br /&gt;The &lt;a title="Intel" href="http://en.wikipedia.org/wiki/Intel"&gt;Intel&lt;/a&gt; APIC Architecture is a system of &lt;a title="Advanced Programmable Interrupt Controller" href="http://en.wikipedia.org/wiki/Advanced_Programmable_Interrupt_Controller"&gt;Advanced Programmable Interrupt Controllers&lt;/a&gt; (APICs) designed by &lt;a title="Intel" href="http://en.wikipedia.org/wiki/Intel"&gt;Intel&lt;/a&gt; for use in &lt;a title="Symmetric multiprocessing" href="http://en.wikipedia.org/wiki/Symmetric_multiprocessing"&gt;Symmetric Multi-Processor&lt;/a&gt; (SMP) &lt;a title="Computer system" href="http://en.wikipedia.org/wiki/Computer_system"&gt;computer systems&lt;/a&gt;. It was originally implemented by the Intel 82093AA and 82489DX, and is found in most &lt;a title="X86" href="http://en.wikipedia.org/wiki/X86"&gt;x86&lt;/a&gt; SMP &lt;a title="Motherboards" href="http://en.wikipedia.org/wiki/Motherboards"&gt;motherboards&lt;/a&gt;. It is one of several attempts to solve interrupt routing efficiency issues in multiprocessor computer systems.&lt;br /&gt;&lt;br /&gt;There are two components in the Intel &lt;span style="color:#6600cc;"&gt;APIC&lt;/span&gt; system, the &lt;span style="color:#3333ff;"&gt;Local APIC (LAPIC)&lt;/span&gt; and the &lt;span style="color:#3333ff;"&gt;I/O APIC&lt;/span&gt;. The LAPIC is integrated into each CPU in the system, and the I/O APIC is used throughout the system's peripheral buses. There is typically one I/O APIC for each peripheral bus in the system. In original system designs, LAPICs and I/O APICs were connected by a dedicated APIC bus. Newer systems use the system bus for communication between all APIC components.&lt;br /&gt;&lt;br /&gt;In systems containing an &lt;a title="8259" href="http://en.wikipedia.org/wiki/8259"&gt;8259&lt;/a&gt; PIC, the 8259 may be connected to the LAPIC in the system's bootstrap processor (BSP), or to one of the system's I/O APICs.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;&lt;strong&gt;Sharing Interrupts Is Bad&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:#3366ff;"&gt;&lt;em&gt;Edge-triggered Interrupts&lt;/em&gt;&lt;/span&gt;. With any interrupt controller, an edge-triggered interrupt is a one-time event. There is no notion of feedback. The operating system never really knows when it has handled the situation that caused the interrupt; it can only know that an event happened sometime in the recent past. Therefore, the only rational response to an edge-triggered interrupt is to run all the Interrupt Service Routines (ISRs) associated with that vector once, with the hope that this will resolve it.&lt;br /&gt;&lt;br /&gt;This situation is especially sketchy when dealing with hardware that doesn't give any real indication of why it interrupted, a common occurrence among today's edge-triggering devices. The result is that the operating system can miss interrupts delivered in the interval between when an interrupt is first taken and when it is acknowledged.&lt;br /&gt;&lt;br /&gt;With an 8259 PIC interrupt controller, the situation is even worse. The 8259 is inherently unreliable, particularly when coupled with an actual ISA bus. The operating system software will see a number of spurious interrupts, some of which show up on different vectors than the original signal.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;span style="color:#3366ff;"&gt;Level-triggered Interrupts.&lt;/span&gt;&lt;/em&gt; The protocol of a level-triggered interrupt is as follows:&lt;br /&gt;•Whenever the interrupt signal is held low (for active-low interrupts, which are the most common), the interrupt controller will generate an interrupt.&lt;br /&gt;•If the interrupt is acknowledged and the signal is still low, then the interrupt controller will generate another interrupt.&lt;br /&gt;This is good for sharing, because it confirms that the operating system handled the interrupting device. The algorithm is:&lt;br /&gt;1.Take an interrupt.&lt;br /&gt;2.Run the first ISR in the chain.&lt;br /&gt;3.If that ISR returns TRUE (meaning that it handled an interrupt), then the operating system will ACK the interrupt and quit.&lt;br /&gt;4.If that ISR returns FALSE, then run the next ISR in the chain and go to Step 3.&lt;br /&gt;&lt;br /&gt;An excellent example of the problem case comes when there are twelve devices all chained on one vector, common for a docked laptop. Every time the operating system takes an interrupt, the operating system must run as many as twelve ISRs before it begins to handle the condition that caused the interrupt.&lt;br /&gt;&lt;br /&gt;more on this question, &lt;a href="http://www.microsoft.com/whdc/system/sysperf/IO-APIC.mspx"&gt;http://www.microsoft.com/whdc/system/sysperf/IO-APIC.mspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-3249301035697909633?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/3249301035697909633/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/04/key-benefits-of-io-apic.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/3249301035697909633'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/3249301035697909633'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/04/key-benefits-of-io-apic.html' title='Key Benefits of the I/O APIC'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-4243472388112107636</id><published>2007-04-01T20:52:00.000-07:00</published><updated>2007-05-09T23:35:32.701-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='X86 secrets'/><title type='text'>something on Assembly language (for beginners)</title><content type='html'>&lt;span style="color:#000099;"&gt;The different procedure calling convention.&lt;/span&gt;&lt;br /&gt;&lt;em&gt;STDCALL&lt;/em&gt;&lt;br /&gt;Parameters are pushed to stack using right to left order.&lt;br /&gt;Parameters pushed to stack are removed by the called procedure itself.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;C ALL&lt;/em&gt;&lt;br /&gt;Parameters are pushed to stack using right to left order.&lt;br /&gt;Parameters pushed to stack are removed by the calling program.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;PASCAL CALL&lt;br /&gt;&lt;/em&gt;Parameters are pushed to stack using left to right order.&lt;br /&gt;Parameters pushed to stack are removed by the called procedure itself.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;Declaring Procedure Prototypes&lt;/span&gt;&lt;br /&gt;MASM provides the INVOKE directive to handle many of the details important to procedure calls, such as pushing parameters according to the correct calling conventions. To use INVOKE, the procedure called must have been declared previously with a PROC statement, an EXTERNDEF (or EXTERN) statement, or a TYPEDEF. You can also place a prototype defined with PROTO before the INVOKE if the procedure type does not appear before the INVOKE. Procedure prototypes defined with PROTO inform the assembler of types and numbers of arguments so the assembler can check for errors and provide automatic conversions when INVOKE calls the procedure.&lt;br /&gt;&lt;br /&gt;does it ring a bell on C prototype and forward declaration? :)&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;How to make a choice between a Macro and procedure?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Macros are processed by preprocessor, rather than the compiler. Macro invocations are replaced with the macro repetitively. It appears in the listing repetitively.&lt;br /&gt;&lt;br /&gt;Procedures involves CALL and RET, and it appears only once in the listing;&lt;br /&gt;&lt;br /&gt;So as a result, Macros has a larger size of compiled code, while Procedures has some overhead with CALL and RET, and thus a slower execution speed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-4243472388112107636?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/4243472388112107636/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/04/something-on-assembly-language-for.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/4243472388112107636'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/4243472388112107636'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/04/something-on-assembly-language-for.html' title='something on Assembly language (for beginners)'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-52690186015491226</id><published>2007-04-01T20:41:00.000-07:00</published><updated>2007-05-09T23:35:32.701-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='X86 secrets'/><title type='text'>DDR-200, PC-1600, what is all this about</title><content type='html'>&lt;span style="color:#ff0000;"&gt;The following information is based on pages from &lt;strong&gt;wikipedia.com&lt;/strong&gt;.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;DDR SDRAM&lt;/strong&gt; or double-data-rate &lt;a title="Synchronous dynamic random access memory" href="http://en.wikipedia.org/wiki/Synchronous_dynamic_random_access_memory"&gt;synchronous dynamic random access memory&lt;/a&gt; is a class of memory &lt;a title="Integrated circuit" href="http://en.wikipedia.org/wiki/Integrated_circuit"&gt;integrated circuit&lt;/a&gt; used in &lt;a title="Computer" href="http://en.wikipedia.org/wiki/Computer"&gt;computers&lt;/a&gt;. It achieves greater &lt;a title="Bandwidth" href="http://en.wikipedia.org/wiki/Bandwidth"&gt;bandwidth&lt;/a&gt; than the preceding &lt;a title="SDR SDRAM" href="http://en.wikipedia.org/wiki/SDR_SDRAM"&gt;single-data-rate SDRAM&lt;/a&gt; by transferring data on the rising and falling edges of the &lt;a title="Clock signal" href="http://en.wikipedia.org/wiki/Clock_signal"&gt;clock signal&lt;/a&gt; (&lt;a title="Double pumped" href="http://en.wikipedia.org/wiki/Double_pumped"&gt;double pumped&lt;/a&gt;). Effectively, it nearly doubles the &lt;a title="Transfer rate" href="http://en.wikipedia.org/wiki/Transfer_rate"&gt;transfer rate&lt;/a&gt; without increasing the frequency of the &lt;a title="Front side bus" href="http://en.wikipedia.org/wiki/Front_side_bus"&gt;front side bus&lt;/a&gt;. Thus a 100 &lt;a title="Megahertz" href="http://en.wikipedia.org/wiki/Megahertz"&gt;MHz&lt;/a&gt; DDR system has an effective &lt;a title="Clock rate" href="http://en.wikipedia.org/wiki/Clock_rate"&gt;clock rate&lt;/a&gt; of 200 MHz when compared to equivalent SDR SDRAM, the “SDR” being a &lt;em&gt;retrospective&lt;/em&gt; designation.&lt;br /&gt;&lt;br /&gt;DDR-200: DDR-SDRAM memory chips specified to operate at 100 MHz&lt;br /&gt;DDR-266: DDR-SDRAM memory chips specified to operate at 133 MHz&lt;br /&gt;DDR-333: DDR-SDRAM memory chips specified to operate at 166 MHz&lt;br /&gt;DDR-400: DDR-SDRAM memory chips specified to operate at 200 MHz&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Then what is the PC-1600? it is the data rate,&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="color:#000099;"&gt;Data rate = DDR frequency * 64(mem width) / 8 (bits per byte)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;See the following table.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bp3.blogger.com/_mWsL8abaYZk/RhB8_2rKuWI/AAAAAAAAADM/CoAnaGOM8Kw/s1600-h/DDR.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5048672618732501346" style="CURSOR: hand" alt="" src="http://bp3.blogger.com/_mWsL8abaYZk/RhB8_2rKuWI/AAAAAAAAADM/CoAnaGOM8Kw/s320/DDR.JPG" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-52690186015491226?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/52690186015491226/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/04/ddr-200-pc-1600-what-is-all-this-about.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/52690186015491226'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/52690186015491226'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/04/ddr-200-pc-1600-what-is-all-this-about.html' title='DDR-200, PC-1600, what is all this about'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_mWsL8abaYZk/RhB8_2rKuWI/AAAAAAAAADM/CoAnaGOM8Kw/s72-c/DDR.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-6191491732285990248</id><published>2007-04-01T20:37:00.000-07:00</published><updated>2007-05-09T23:35:32.702-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='X86 secrets'/><title type='text'>The Myth around A20 and HMA(High Memory Area)</title><content type='html'>The following is extracted from:&lt;br /&gt;&lt;a href="http://www.pcguide.com/ref/ram/logicHMA-c.html"&gt;http://www.pcguide.com/ref/ram/logicHMA-c.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;this is the best explanation for this question I found so far.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.pcguide.com/ref/ram/logicHMA-c.html" target="_top"&gt;PC memory&lt;/a&gt; addresses are referred to using a &lt;a href="http://www.pcguide.com/ref/ram/logicAddressing-c.html" target="C"&gt;segment:offset addressing scheme&lt;/a&gt;; the segment is multiplied by 16 (shifted one hexadecimal digit to the left) and then the offset is added to it to get the real address. The original IBM PC had only 20 address lines and so its highest memory address was FFFFFh. However, the weird segment:offset addressing makes it possible to generate a linear address that is higher than this number.&lt;br /&gt;&lt;br /&gt;Take the address FFFF:FFFF. To convert this to a linear address you take the segment and multiply it by 16, to get FFFF0. Then you add the offset, FFFF. FFFF0+FFFF in hexadecimal results in 10FFEFh. There's a problem with this: that "1" at the front requires a 21st address line to represent it, and that doesn't exist on the 8088 or 8086 processors used in the first PCs. They deal with this problem by ignoring the "1"--they treat the address simply as 0FFEFh. Software must be able to handle this "wrap around" of the memory addresses.&lt;br /&gt;&lt;br /&gt;When Intel created the 80286 processor, it supported both protected mode and real mode. When in real mode the 80286 was supposed to behave exactly the same as an 8088 or 8086, for compatibility. However, the 80286 does have a 21st address line (it has 24), and due to a bug in its design it didn't do the wrap around in the same way as the 8088 when in real mode. When it used address FFFF:FFFF and came up with 10FFEFh for a linear address, it kept it as 10FFEFh instead of wrapping it around to 0FFEFh like on the older &lt;a href="http://www.pcguide.com/ref/ram/logicHMA-c.html" target="_top"&gt;CPUs&lt;/a&gt;. This allowed the first FFEFh of extended memory (100000-10FFEFh) to be accessed by the chip even while still in real mode. This block of memory is the high memory area (HMA).&lt;br /&gt;&lt;br /&gt;There was still the problem of ensuring compatibility of the 80286 when in real mode. IBM solved this in the original AT by using spare lines in the keyboard controller chip to manage the 21st address line (which is called the A20 line because address bits are numbered starting with zero). The keyboard controller turns off the A20 line when the processor is running in real mode, to allow for full compatibility with the older PCs. It turns it back on when running in protected mode.&lt;br /&gt;&lt;br /&gt;&lt;a name="MidHMA"&gt;Many years later&lt;/a&gt;, when the 640 KB limit of conventional memory began to be quite cramping, the ability to access an additional 64 KB of memory in real mode was seen as a significant advantage. (People at this time were scratching and clawing to get even 8 KB more conventional memory to let them run large programs that insisted on certain minimums). Microsoft developed a special driver called HIMEM.SYS that allowed the A20 line to be manipulated under software control. This allows the high memory area to be put to good use.&lt;br /&gt;In practical terms, the high memory area is normally used by DOS itself. Specifying "DOS=HIGH" in the DOS system file CONFIG.SYS tells DOS to load a portion of its own code into the high memory area instead of into conventional memory. This frees approximately 45 KB of conventional memory for use by programs.&lt;br /&gt;&lt;br /&gt;The final step in institutionalizing this former bug as an official PC feature was removing manipulation of the A20 line from the keyboard controller. Since that was originally a hack anyway--the controller was used because there was no better way to do it, after all, it has nothing to do with the keyboard--in many newer PCs there is a &lt;a href="http://www.pcguide.com/ref/mbsys/bios/set/adv_A20.htm"&gt;BIOS option to allow the chipset to control the A20 line directly&lt;/a&gt;. This provides a small performance increase compared to letting the keyboard controller manage the line.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-6191491732285990248?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/6191491732285990248/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/04/myth-around-a20-and-hmahigh-memory-area.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/6191491732285990248'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/6191491732285990248'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/04/myth-around-a20-and-hmahigh-memory-area.html' title='The Myth around A20 and HMA(High Memory Area)'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-3172332321114865085</id><published>2007-03-31T08:04:00.000-07:00</published><updated>2009-02-03T06:19:53.040-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='I recommend'/><title type='text'>Solute to open source project 2 -- Jakarta Commons Net</title><content type='html'>I believe there is definitely no need for wordy introduction of the royal bloodline of this package. Yes, Jakarta Commons Net is also from the most respectable open source family, Apache.&lt;br /&gt;&lt;br /&gt;To enable efficient data communication or control between a local Java application and remote native process, some intermediate network protocol and application must exist. Surprisingly, the standard JDK library does not provide enough support for such network communication, and we have to borrow some third party library tools.&lt;br /&gt;&lt;br /&gt;I get acquainted with this package during a academic project. To accomplish a remote HSPICE simulation task, simulation data and remote execution command has to be sent over the network. I have compared a few of the available tools.&lt;br /&gt;&lt;br /&gt;RMI -- The local client can only talk to remote application through a Java server application which resides on server side.&lt;br /&gt;&lt;br /&gt;Sun network package -- This package is included in the current release of JDK, however, not as a standard component, which means it may not be compatible with future JDK versions.&lt;br /&gt;&lt;br /&gt;Commercial tools -- not free. :(&lt;br /&gt;&lt;br /&gt;some light weight implementations -- lack of the remote execution features.&lt;br /&gt;&lt;br /&gt;The Jakarta Commons Net is such an open source effort targeting at implementing the client side of many basic Internet protocols, including FTP, TELNET, REXEC, etc. There are several reasons to the choice of Jakarta Commons Net. First of all, it provides all the necessary protocols we need, FTP, REXEC, and Rlogin. And, it is free and open source, which is very relaxed for academic use.&lt;br /&gt;&lt;br /&gt;Specific to my problem, Jakarta Commons Net is purely Java based, which could be interfaced to our existing Java code easily and seamlessly. Another advantage of Jakarta Commons Net over other choices like RMI is that it is a purely client side library, and the remote server side could be left intact for the application to run.&lt;br /&gt;&lt;br /&gt;Download link, license agreement and installation information of Jakarta Commons Net could be found at: &lt;a href="http://jakarta.apache.org/commons/net/"&gt;http://jakarta.apache.org/commons/net/&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bp0.blogger.com/_mWsL8abaYZk/Rg5-SmrKuVI/AAAAAAAAADE/QqtnLXGr7QU/s1600-h/EMC2_remote_exe.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5048111090413254994" style="CURSOR: hand" alt="" src="http://bp0.blogger.com/_mWsL8abaYZk/Rg5-SmrKuVI/AAAAAAAAADE/QqtnLXGr7QU/s320/EMC2_remote_exe.JPG" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-3172332321114865085?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/3172332321114865085/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/03/solute-to-open-source-project-2-jakarta.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/3172332321114865085'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/3172332321114865085'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/03/solute-to-open-source-project-2-jakarta.html' title='Solute to open source project 2 -- Jakarta Commons Net'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp0.blogger.com/_mWsL8abaYZk/Rg5-SmrKuVI/AAAAAAAAADE/QqtnLXGr7QU/s72-c/EMC2_remote_exe.JPG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-6582758342344633740</id><published>2007-03-31T07:47:00.000-07:00</published><updated>2009-02-03T06:19:53.040-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='I recommend'/><title type='text'>Solute to open source projects 1 -- G from GeoSoft</title><content type='html'>G is a generic graphics library built on top of Java 2D from GeoSoft. It makes scene graph oriented 2D graphics available to client applications in a high level, easy to use way. (&lt;a href="http://geosoft.no/graphics/index.html"&gt;http://geosoft.no/graphics/index.html&lt;/a&gt;) It is capable of producing high quality 2D line sketches, bar plots, curve plots, and etc. It is licensed under the GNU Lesser General Public License.&lt;br /&gt;&lt;br /&gt;Thanks to this great and open source package, I implemented the output curve 2d display with minimu effort and great visual effect for a EMC simulation package development project. In this project, G is used to plot circuit parameters, such as current, voltage, etc, with Cartesian coordinates. Note that, the G package comes with some basic image controls, like zoom-in, zoom-out, and localized magnification.&lt;br /&gt;&lt;br /&gt;The following is a screen capture of the curve plotting generated by G from the EMC project.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bp3.blogger.com/_mWsL8abaYZk/Rg50zWrKuUI/AAAAAAAAAC8/tHmqxfo5DpI/s1600-h/EMC2_output_plot.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5048100657937692994" style="CURSOR: hand" alt="" src="http://bp3.blogger.com/_mWsL8abaYZk/Rg50zWrKuUI/AAAAAAAAAC8/tHmqxfo5DpI/s320/EMC2_output_plot.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-6582758342344633740?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/6582758342344633740/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/03/solute-to-open-source-projects-1-g-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/6582758342344633740'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/6582758342344633740'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/03/solute-to-open-source-projects-1-g-from.html' title='Solute to open source projects 1 -- G from GeoSoft'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp3.blogger.com/_mWsL8abaYZk/Rg50zWrKuUI/AAAAAAAAAC8/tHmqxfo5DpI/s72-c/EMC2_output_plot.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-8803334992303287546</id><published>2007-03-29T06:15:00.000-07:00</published><updated>2009-02-03T06:21:59.061-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='I create'/><title type='text'>MiniCAD -- a stand alone module for EMC simulation tool</title><content type='html'>This is something I developed during my first job. At the time, I was expected to enhance and expand the functionality of an existing GUI-based EMC simulation package.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The tool is capable of importing standard geometry data (meshed or un-meshed), collecting user simulation input, invoking simulation engine, and process simulation output.&lt;br /&gt;&lt;br /&gt;The next phase of the project was to add in a simple CAD like module, which enables users to create customized geometry, and generate the mesh all under-one-roof.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For ease of tuning, I started to create a stand-alone module which allows to user to input some really really simple geometry. I also implemented some basic graphics control, like zoom-in, zoom-out and mouse-rotation.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bp0.blogger.com/_mWsL8abaYZk/RgvB3WrKuRI/AAAAAAAAACk/1tiipQmLmvA/s1600-h/EMC0_user_input.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5047340964122376466" style="CURSOR: hand" alt="" src="http://bp0.blogger.com/_mWsL8abaYZk/RgvB3WrKuRI/AAAAAAAAACk/1tiipQmLmvA/s200/EMC0_user_input.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bp0.blogger.com/_mWsL8abaYZk/RgvB3WrKuSI/AAAAAAAAACs/XfL6wcSqeIE/s1600-h/EMC1_miniCAD.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5047340964122376482" style="WIDTH: 201px; CURSOR: hand; HEIGHT: 193px" height="193" alt="" src="http://bp0.blogger.com/_mWsL8abaYZk/RgvB3WrKuSI/AAAAAAAAACs/XfL6wcSqeIE/s200/EMC1_miniCAD.JPG" width="192" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Enabled by an open source package, the miniCAD can also create some surface meshing of the graphics. See...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bp3.blogger.com/_mWsL8abaYZk/RgvDDGrKuTI/AAAAAAAAAC0/Q5J3nCzXPus/s1600-h/EMC1_miniCAD_meshed.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5047342265497467186" style="WIDTH: 201px; CURSOR: hand; HEIGHT: 193px" height="200" alt="" src="http://bp3.blogger.com/_mWsL8abaYZk/RgvDDGrKuTI/AAAAAAAAAC0/Q5J3nCzXPus/s200/EMC1_miniCAD_meshed.JPG" width="199" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-8803334992303287546?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/8803334992303287546/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/03/minicad-stand-alone-module-i-created-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/8803334992303287546'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/8803334992303287546'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/03/minicad-stand-alone-module-i-created-to.html' title='MiniCAD -- a stand alone module for EMC simulation tool'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp0.blogger.com/_mWsL8abaYZk/RgvB3WrKuRI/AAAAAAAAACk/1tiipQmLmvA/s72-c/EMC0_user_input.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-3710874253075482932</id><published>2007-03-28T07:28:00.000-07:00</published><updated>2009-02-03T06:21:59.062-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='I create'/><title type='text'>FlowViewer -- By the engineer, For the engineer</title><content type='html'>&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;My second job is a test software engineer position in a semiconductor testing firm. It is quite shocking to see how XML was maximizingly utilized in the testing programs. It is so heavily 'abused' that at the first look, we may think testing programs are XML programs (they are actually Java programs). XML is used to describe not only how these test are configured, but also in what sequence they are executed. A complete sapphire ATE program employs hundreds of XMLs, and it is really a headache to transverse these files to search for certain information. People have to be very sophisticated about how these files are organized, and spend a lot of time to trace certain information by opening many files in the file explorer.&lt;br /&gt;&lt;br /&gt;I believe that a graphical based program analyzer and viewer could be very helpful. The application shall be able to load all these files in memory, and display them graphically in a organized and user-friendly fashion. User can then browse the test execution flow with a few mouse clicks, an find particular test information by a very fast memory-based search.&lt;br /&gt;&lt;br /&gt;A little background to catch up here. The ATE tester software platform comes with a powerful (and also tricky) GUI based interface (namely, XTOS) which are used to load, run, configure, debug and log all the tests. Everything I am going to implement is already pretty encapsulated in this software suite. I am re-invent the wheels because of several considerations. Most importantly, XTOS is heavily coupled with tester hardware, which is a piece of extremely expensive (million $) hardware which we can not afford to have many. These testers are always shared by production line and we engineers, and we are always in the situation to struggle for more tester time. So if we can simulate the program by software, we saves a lot of hardware resources(and thus $!!!). Another killing factor is that, in real test setup, XTOS will try to load huge amount of test data, which takes about 1-2 hours waiting time. To properly view the test programs flow and setup, these data are not necessarily to be loaded. Last but not least, XTOS is more like a propriety software, and we are unable and also not supposed to modify its behavior and outlook to better fit our needs. So, I think it worthes the effort to create our own.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What FlowViewer is?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Flow Viewer has three functional blocks in current release:&lt;br /&gt;** Test flow extraction and browse&lt;br /&gt;** Test flow validation&lt;br /&gt;** XML search, trace and highlight&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;What it is not?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;*Flow Viewer is NOT part of TP&lt;br /&gt;*Flow Viewer is NOT part of XTOS&lt;br /&gt;*Flow Viewer is NOT a TP editor&lt;br /&gt;*Flow Viewer is NOT capable to corrupt your TP&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Flow Viewer is designed to be a convenient toolbox for TP owners/Test engineers.&lt;br /&gt;*Flow Viewer is built on&lt;br /&gt;*SWT/JFace graphics framework&lt;br /&gt;*JDOM library&lt;br /&gt;*XML validation Schema technology&lt;br /&gt;*XPath enabled search technology&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://bp2.blogger.com/_mWsL8abaYZk/Rgp8PGrKuOI/AAAAAAAAACM/Q6uw0hPivTs/s1600-h/FV0.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5046982931353614562" style="CURSOR: hand" alt="" src="http://bp2.blogger.com/_mWsL8abaYZk/Rgp8PGrKuOI/AAAAAAAAACM/Q6uw0hPivTs/s320/FV0.JPG" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The project created a good opportunity for me to get acquainted with many XML related  technologies, which I will write up to share in later posts.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-3710874253075482932?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/3710874253075482932/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/03/flowviewer-by-engineer-for-engineer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/3710874253075482932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/3710874253075482932'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/03/flowviewer-by-engineer-for-engineer.html' title='FlowViewer -- By the engineer, For the engineer'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp2.blogger.com/_mWsL8abaYZk/Rgp8PGrKuOI/AAAAAAAAACM/Q6uw0hPivTs/s72-c/FV0.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-8617458170160470358</id><published>2007-03-28T06:35:00.000-07:00</published><updated>2009-02-03T06:21:59.062-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='I create'/><title type='text'>ProgramManager: the first project I designed, implemented, and successfully marketed (for free)</title><content type='html'>Program manager is designed to work with Jobtool for easy repository and access of current production program revision, path, and invocation command. So, developers are reminded that any modification or addition of features to PM/Jobtool must ensure proper interface with Jobtool/PM.&lt;br /&gt;&lt;br /&gt;PM is a GUI program which reads the program list file, parses the program information, and renders programs and program descriptions as user friendly tree and tables. User may click on the program tree to browse relevant configurations in table format, and modify/add/delete programs by keyboard input.&lt;br /&gt;&lt;br /&gt;External libraries&lt;br /&gt;&lt;br /&gt;- JDOM.jar (to parse XML file to DOM structure)&lt;br /&gt;- activation.jar (to support mail.jar)&lt;br /&gt;- mail.jar (to support email function)&lt;br /&gt;&lt;br /&gt;Implemented features:&lt;br /&gt;&lt;br /&gt;*Graphical representation of program hierarchy&lt;br /&gt;*Context sensitive program configuration display and modification&lt;br /&gt;*Program expiry auto email notification&lt;br /&gt;*Program list file write access grant&lt;br /&gt;*User login session auto time out&lt;br /&gt;*program list auto backup&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;a href="http://bp2.blogger.com/_mWsL8abaYZk/Rgp4oGrKuLI/AAAAAAAAAB0/v6jpAScPRa0/s1600-h/pm0_login.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5046978962803833010" style="CURSOR: hand" alt="" src="http://bp2.blogger.com/_mWsL8abaYZk/Rgp4oGrKuLI/AAAAAAAAAB0/v6jpAScPRa0/s320/pm0_login.JPG" border="0" /&gt;&lt;/a&gt; &lt;a href="http://bp2.blogger.com/_mWsL8abaYZk/Rgp4yGrKuMI/AAAAAAAAAB8/LOJmRGOeMDM/s1600-h/pm1_main.JPG"&gt;&lt;img id="BLOGGER_PHOTO_ID_5046979134602524866" style="CURSOR: hand" alt="" src="http://bp2.blogger.com/_mWsL8abaYZk/Rgp4yGrKuMI/AAAAAAAAAB8/LOJmRGOeMDM/s320/pm1_main.JPG" border="0" /&gt;&lt;/a&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-8617458170160470358?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/8617458170160470358/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/03/programmanager-first-project-i-designed.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/8617458170160470358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/8617458170160470358'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/03/programmanager-first-project-i-designed.html' title='ProgramManager: the first project I designed, implemented, and successfully marketed (for free)'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp2.blogger.com/_mWsL8abaYZk/Rgp4oGrKuLI/AAAAAAAAAB0/v6jpAScPRa0/s72-c/pm0_login.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4435940641816407781.post-8132691542262555712</id><published>2007-03-27T06:24:00.000-07:00</published><updated>2007-03-27T06:26:20.444-07:00</updated><title type='text'>emmm, put a wild card first</title><content type='html'>hi, everybody, my google version blog in blogger.com is born. cheers!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4435940641816407781-8132691542262555712?l=kkshichao.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://kkshichao.blogspot.com/feeds/8132691542262555712/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://kkshichao.blogspot.com/2007/03/emmm-put-wild-card-first.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/8132691542262555712'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4435940641816407781/posts/default/8132691542262555712'/><link rel='alternate' type='text/html' href='http://kkshichao.blogspot.com/2007/03/emmm-put-wild-card-first.html' title='emmm, put a wild card first'/><author><name>苏乞儿, S.Q.R</name><uri>http://www.blogger.com/profile/03544708469358603951</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
