<?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-4058876028773815143</id><updated>2011-07-31T00:27:53.653+08:00</updated><category term='file transfer'/><category term='scripting language - JScript'/><category term='Unicode'/><category term='information security'/><category term='CSS'/><category term='unix'/><category term='programming style'/><category term='scripting language - Javascript'/><category term='HTML'/><category term='Chinese Computing'/><category term='Others'/><category term='windows'/><category term='mainframe CLIST'/><category term='Data Warehouse'/><category term='web server'/><category term='programming language - SAS'/><category term='Android'/><category term='BlackBerry'/><category term='networking'/><category term='job scheduling'/><category term='scripting language - bat file'/><category term='software freeware webware'/><category term='mainframe'/><category term='DOS'/><title type='text'>A B C D E - Alvin's Blog in Cyber Digital Era</title><subtitle type='html'>In the world of computer there is no boundary ....... It was the best of times, it was the worst of times ....... A ray of hope flickers in the sky ....... I believe I can fly ....... I have a dream .................................</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>58</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-7392818454088052105</id><published>2010-02-16T23:49:00.000+08:00</published><updated>2010-02-16T23:49:08.396+08:00</updated><title type='text'>Use CamStudio as screen recorder</title><content type='html'>&lt;p&gt;This web page [ &lt;a target="_blank" href="http://www.ehow.com/how_5202087_use-camstudio.html"&gt;How to use CamStudio&lt;/a&gt; ] teach you how to use the software to record the screen.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-7392818454088052105?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/7392818454088052105/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=7392818454088052105' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/7392818454088052105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/7392818454088052105'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2010/02/use-camstudio-as-screen-recorder.html' title='Use CamStudio as screen recorder'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-1152839044414013031</id><published>2010-01-04T15:02:00.002+08:00</published><updated>2010-01-04T15:26:33.950+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><title type='text'>MS Data Access Components</title><content type='html'>&lt;p&gt;Mahesh Chand has written an article [[ &lt;a target="_blank" href="http://www.dotnetheaven.com/Uploadfile/mahesh/mdac05112005014341AM/mdac.aspx"&gt;Micrsoft Data Access Components (MDAC)&lt;/a&gt; ]] to explain various Microsoft database access methods and which one to use and when.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;This article [[ &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Microsoft_Jet_Database_Engine"&gt;Microsoft Jet Database Engine&lt;/a&gt; ]] in Wikipedia says that the Access ODBC developers used parts of the Jet code to produce the ODBC driver. &lt;br /&gt;
&lt;/p&gt;&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-1152839044414013031?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/1152839044414013031/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=1152839044414013031' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/1152839044414013031'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/1152839044414013031'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2010/01/ms-data-access-components.html' title='MS Data Access Components'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-7092942899801664499</id><published>2010-01-04T14:16:00.009+08:00</published><updated>2010-01-04T15:30:28.753+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><title type='text'>Access97 mdb in WinXP</title><content type='html'>&lt;p&gt;Recently, I was asked to migrate an application from the WinNT4 world to the WinXP world.  Here is some details of the application.&lt;br /&gt;
&lt;/p&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;Old World&lt;/td&gt;&lt;td&gt;New World&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;OS of the PC&lt;/td&gt;&lt;td&gt;WinNT4 WS SP6&lt;/td&gt;&lt;td&gt;WinXP Pro SP3&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;The Application is written by&lt;/td&gt;&lt;td&gt;Delphi 4&lt;/td&gt;&lt;td&gt;N/A&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Database Connectivity&lt;/td&gt;&lt;td&gt;ODBC&lt;/td&gt;&lt;td&gt;ODBC&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Database&lt;/td&gt;&lt;td&gt;Access 97 mdb file&lt;/td&gt;&lt;td&gt;Access 97 mdb file&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;p&gt;My first question is : Do I need to  install Access97 in WinXP ? This article [[ &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Microsoft_Access"&gt;Microsoft Access in Wikipedia&lt;/a&gt; ]] says that Access97 is not supported by the WinXP OS.  Also, there is significant transition was from the Access 97 to the Access 2000 format.&lt;/p&gt;&lt;p&gt;After &lt;a target="_blank"  href="http://www.google.com.hk/search?q=window+xp+access+97&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t&amp;rls=org.mozilla:en-US:official&amp;client=firefox-a"&gt;searching the net&lt;/a&gt;, it seems that there are many problems when running Access97 in WinXP.  For example, this article [[ &lt;a target="_blank"  href="http://bytes.com/topic/access/answers/201419-access-97-install-difficulty-windows-xp-system-mdw"&gt;Access 97 Install Difficulty on Windows XP - System.mdw&lt;/a&gt; ]] shows a life experience about the difficulties for installing Access97 in WinXP.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Is it possible to setup ODBC driver for the Access97 mdb file in WinXP ?.  This post [[ &lt;a target="_blank" href="http://www.dbforums.com/microsoft-access/1191323-access97-odbc.html"&gt;Access97 ODBC&lt;/a&gt; ]] is doing this thing.&lt;br /&gt;
&lt;/p&gt;&lt;div&gt;This article [[ &lt;a target="_blank" href="http://en.wikipedia.org/wiki/Microsoft_Jet_Database_Engine"&gt;Microsoft Jet Database Engine&lt;/a&gt; ]] in Wikipedia says that :&lt;br /&gt;
&lt;table align="center" width="80%"&gt;&lt;tr&gt;&lt;td&gt;The Jet DLL determined what sort of database it was accessing, and how to perform what was requested of it. If the data source was an MDB file (a Microsoft Access format) then it would directly read and write the data to the file. If the data source was external, then it would call on the correct ODBC driver to perform its request.&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;&lt;/div&gt;&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-7092942899801664499?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/7092942899801664499/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=7092942899801664499' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/7092942899801664499'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/7092942899801664499'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2010/01/access97-mdb-in-winxp.html' title='Access97 mdb in WinXP'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-7917569300521745141</id><published>2010-01-02T12:49:00.001+08:00</published><updated>2010-01-02T12:49:59.744+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Unicode'/><title type='text'>Unicode Related Articles</title><content type='html'>&lt;p&gt;This blog article [ &lt;a href="http://blog.csdn.net/sfdev/archive/2009/01/13/3770706.aspx"&gt;中文化和国际化问题权威解析之一：字符编码发展历程&lt;/a&gt; ] give a clear and precise description on Unicode with a brief history of character encoding.  The article is written in Simplified Chinese.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-7917569300521745141?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/7917569300521745141/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=7917569300521745141' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/7917569300521745141'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/7917569300521745141'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2010/01/unicode-related-articles.html' title='Unicode Related Articles'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-5653021426365152229</id><published>2010-01-01T16:06:00.002+08:00</published><updated>2010-01-01T16:06:39.392+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Unicode'/><title type='text'>ASCII, Code Page and Unicode</title><content type='html'>&lt;p&gt;This web page [ &lt;a target="_blank" href="http://www.microsoft.com/typography/unicode/cs.htm"&gt;Microsoft Typography  | Developer information  | Character sets &lt;/a&gt; ] has documented the history of character sets from ASCII, OEM 8-bit character, Windows ANSI and code page, DBCS to Unicode.  At the end of the web page, it also tells 12 steps to Unicode-enabling.&lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-5653021426365152229?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/5653021426365152229/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=5653021426365152229' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/5653021426365152229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/5653021426365152229'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2010/01/ascii-code-page-and-unicode.html' title='ASCII, Code Page and Unicode'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-1665390622590257462</id><published>2010-01-01T15:18:00.010+08:00</published><updated>2010-01-03T20:52:20.909+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Unicode'/><title type='text'>Unicode and UTF8</title><content type='html'>&lt;p&gt;What is the relationship between Unicode and UTF-8 ? This article "&lt;a target="_blank" href="http://developers.sun.com/dev/gadc/technicalpublications/articles/utf8.html"&gt;What Is UTF-8 And Why Is It Important?&lt;/a&gt;" is quite good for reading. Anyway, I want to further explain a little bit.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Actually, the so-called Unicode for most of the time is referring to the mapping table which map a number (called code point) to a character.  The number can be a small number between 0 to 127.  This number will map to the normal ASCII characters. For example, the decimal number 65 (hex 41) map to English letter A.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;The number can be a little larger, which need 16-bit to represent it.  Then, this number will map to, such as, some commonly used Chinese character. For example, the decimal number 20,013 (hex 4E2D) map to Chinese character 中.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;If the number is further larger (which need 20-bit to represent it), this number will map to, such as, some rarely used Chinese characters. For example, the decimal number 194,712 (hex 2F898) map to Chinese character &amp;#x2F898;&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;So far, I am just talking about the mapping and the size (16-bit &amp;amp; 20-bit) of the number.  I have not mentioned how to store this number.&lt;/p&gt;&lt;p&gt;At the first glance, you can simply store each character as a 20-bit number.  But this is a waste of storage because there are many unused ZEROs.  For example, the English letter A is ASCII-65.  Its 1-byte representation is 0x41.  Using 32-bit representation will be 0x00000041.  There are many unused ZEROs at the beginning.  For Chinese characters, those commonly used characters only need 2 bytes.  If using 32-bit representation, the first 16-bit will also become unused ZEROs&lt;/p&gt;&lt;p&gt;To tackle this problem, a method UTF-8 is developed. This method will store the Unicode code point number in 1-byte, 2-byte or 3-byte, depending on the VALUE of the number. If the code point is a small number, i.e. those ASCII characters code points, only 1 byte will be used.  About 1900+ code points (usually for those European letters) need 2 bytes.  For those code points for commonly used Chinese characters, 3-byte is used.&lt;/p&gt;&lt;p&gt;It can be said that, under the UTF-8 method, the Unicode character table is divided into several areas.  Those characters in the area related to ASCII will use 1-byte to store.  About 1900+ characters in another area will use 2-byte to store.  Most commonly used Chinese characters will use 3-byte to store.&lt;/p&gt;&lt;p&gt;Take an experiment, cut and paste the following line to PSPad :&lt;/p&gt;&lt;p&gt;abcdefghijαβγδ中文字&lt;/p&gt;&lt;p&gt;Then, choose &lt;b&gt;Format&lt;/b&gt; &amp;gt; &lt;b&gt;UTF-8&lt;/b&gt; and then save the file.&lt;/p&gt;&lt;p&gt;The file size is 27 bytes.  The 10 English letters consume 10 x 1 = 10 bytes.  The 4 Greek letters consume 4 x 2 = 8 bytes.  The 3 Chinese characters consume 3 x 3 = 9 bytes.  10 + 8 + 9 = 27 bytes.  You can open the file using Firefox 3.0.8 which can auto-detect UTF-8 to open the file.&lt;/p&gt;&lt;p&gt;(By the way, you can save it using UTF-16 LE encoding by chooseing &lt;b&gt;Format&lt;/b&gt; &amp;gt; &lt;b&gt;UTF-16 LE&lt;/b&gt;.  The file size will be 36 byte.  The 17 characters consumes 17 x 2 = 34 bytes.  Plus the BOM marker FFFE total to 2 + 34 = 36 bytes. Firefox can also auto-detect UTF-16 LE to open the file.)&lt;/p&gt;&lt;p&gt;If simply looking at Chinese characters, this UTF-8 method seems quite "expensive" because it uses 3 bytes to store those commonly used Chinese characters.  And, those Chinese characters is a 16-bit (2-byte) code point.  In other words, there is a 8-bit (1-byte) overhead (i.e. 50% overhead) for each Chinese character.  Yes, this is the truth.  Therefore, if the information is a pure Chinese character, using UTF-8 will make the file size much larger than using UTF-16 !&lt;/p&gt;&lt;p&gt;But, UTF-8 has many advantages.&lt;/p&gt;&lt;p&gt;First of all, UTF-8 is backward compatible to all ASCII encoding.  The ASCII can be treated as a subset of UTF-8.  All English characters are represented using 1 byte, the same as ASCII.  Therefore, all existing software or else handling ASCII can also handle UTF-8.&lt;/p&gt;&lt;p&gt;Secondly, there is no unused ZEROs in UTF-8.  In C programming language, the null character ZERO is the string terminator.  If there is such a ZERO in the stream, it will terminate the string.  Then, this unused ZERO will make many C program behave not as expected.  UTF-8 encoding method ensure that there is no unused ZEROs.  Many C program can run as usual.&lt;/p&gt;&lt;p&gt;Also, UTF-8 can define the character BOUNDARY. In UTF-8, if the code point is for ASCII character, it is stored as 0zzzzzzz (where zzzzzzz is the ASCII value ranging from 0 to 127).  For those code point needing 2-byte representation, it is stored as 110yyyzz 10zzzzzz (where yyyzzzzzzzz is the code point).  For those code point (e.g. for Chinese character) which need a 3-byte representation, it is stored as 1110yyyy 10yyyyzz 10zzzzzz .  In other words, all 16-bit Unicode character is either a (0-something) or (110-something 10-something) or (1110-something 10-something 10-something) representation in UTF-8.  For a more technical details, please refer to the web page &lt;a target="_blank" href="http://en.wikipedia.org/wiki/UTF-8"&gt;UTF-8 in Wikipedia&lt;/a&gt;. &lt;/p&gt;&lt;p&gt;Furthermore, in information transmission, UTF-8 can help detecting error.  For example, if a new character is beginning with 1110-something, 3-byte is expected.  There should be two 10-something bytes follows. If you cannot find 2 more 10-something bytes, there must be something wrong.  For another example, a 2-byte representation is (110-something 10-something).  It is impossible to have this sequence (110-something 0-something).  There must be something wrong.&lt;/p&gt;&lt;p&gt;At last, although this article uses only 1-byte, 2-byte and 3-byte as example, in theory, UTF-8 can be expanded into 4-byte, 5-byte, ... etc.  For example, the 4-byte representation will be 11110xxx 10xxyyyy 10yyyyzz 10zzzzzz.  This 4-byte representation can denote 21-bit Unicode characters.&lt;/p&gt;&lt;div&gt;Other useful references:&lt;ol&gt;&lt;li&gt;&lt;a target="_blank" href="http://unicode.org/faq/utf_bom.html"&gt;UTF-8, UTF-16, UTF-32 &amp; BOM&lt;/a&gt;&lt;br /&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-1665390622590257462?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/1665390622590257462/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=1665390622590257462' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/1665390622590257462'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/1665390622590257462'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2010/01/unicode-and-utf8.html' title='Unicode and UTF8'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-7773484615975252077</id><published>2009-12-31T23:33:00.005+08:00</published><updated>2010-01-01T15:18:39.532+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Chinese Computing'/><category scheme='http://www.blogger.com/atom/ns#' term='Unicode'/><title type='text'>English Windows Systems with Chinese</title><content type='html'>&lt;p&gt;This web page [ &lt;a target="_blank" href="http://lingua.mtsu.edu/chinese-computing/faq/pc.html"&gt;How to display and edit Chinese on English Windows systems&lt;/a&gt; ] is worth reading.  It can make an English Windows system to be able to work with English and Chinese.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;This web page [ &lt;a target="_blank" href="http://www.biblioscape.com/tips/tip_020318.htm"&gt;Enter Chinese Characters under Windows XP - March 18, 2002&lt;/a&gt; ] also has some information with some screen captures.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Well the above articles tell you how to ENABLE your OS to let you input Chinese char and to display Chinese char.  Once, the proper font is used, the Chinese char is displayed happily.  However, what is the more in-depth knowledge inside ?&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Actually, Windows XP is using NTFS filesystem.  This filesystem uses unicode as filenames.  In other words, all filenames characters (no matter Chinese, Japanese, Korean, English, Greek, ... etc) as stored as unicode UTF-16 format as the filename.  This is the underlying filesystem filename data structure.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Then, how the win32 applications interact with this UTF-16 unicode filesystem ?  Unfortunately, there are 2 sets of APIs.  For those unicode-aware applications, it will use the unicode API to directly handle the unicode filename.   For those non-unicode aware application, there are troubles.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;When the non-unicode application handles a filename of a string of double-byte, how to convert each double-byte to a unicode ?  The non-unicode API will use MBCS codec.  The MBCS codec together with locale information will convert a double-byte to a particular unicode char.  With the same double-byte char, changing the locale will change the unicode char.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;What is the default locale your XP is using ? It is already determined in Control Panel -&gt; Regional and Language Options -&gt; Advanced -&gt; Language for non-Unicode programs.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;This comes another troublesome situation.  For example, if your system is of default locale being Traditional Chinese, you can still make a file with Japanese char using unicode aware program.  Then, how the non-unicode aware program handle this filename ? This Japanese unicode char should map to a double-byte of the Japanese locale.  But, the default locale is Traditional Chinese, not Japnese.  What to do then ? Sometimes they simply cannot handle this file, or will display question mark in the filename.&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;For the details of the MBCS and the API, please refer to this web page [ &lt;a target="_blank" href="http://boodebr.org/main/python/all-about-python-and-unicode#PLAT_WIN"&gt;All About Python and Unicode&lt;/a&gt; ].&lt;br /&gt;
&lt;/p&gt;&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-7773484615975252077?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/7773484615975252077/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=7773484615975252077' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/7773484615975252077'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/7773484615975252077'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/12/english-windows-systems-with-chinese.html' title='English Windows Systems with Chinese'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-7538924704940615503</id><published>2009-12-30T18:59:00.005+08:00</published><updated>2009-12-30T19:25:28.818+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><title type='text'>My first "R cannot be resolved" error with Android</title><content type='html'>&lt;p&gt;When I new a project for an Android sample, I intentionally select a Android 2.0.1 platform to see what happens.  The program editing part seems OK.  However, when I test run the program, there is an error message saying that the default AVD cannot be used.  I have to find another AVD.  Then, I try to fix the project property to fall back to use the Android 1.5.0 platform and test run again.  Now, error message keeps up coming. &lt;br /&gt;
&lt;/p&gt;&lt;p&gt;The first error message is "R cannot be resolved!".  When I search the internet, I come across many replies, but non of them works.  Also, they introduce other messages such as "Build Path error", "The project cannot be built until build path errors are resolved" &amp;amp; "missing required source folder 'gen'".  I even delete the 'gen' folder, it still cannot solve the problem.  I also try to copy a 'gen' folder from other sample projects, this method does not work either. &lt;br /&gt;
&lt;/p&gt;&lt;p&gt;At last, what I can do is to give up this project.  New another project with Android platform 1.5.0 to do this ample program again.  This is a much faster way. &lt;br /&gt;
&lt;/p&gt;&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-7538924704940615503?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/7538924704940615503/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=7538924704940615503' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/7538924704940615503'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/7538924704940615503'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/12/my-first-r-cannot-be-resolved-error.html' title='My first &quot;R cannot be resolved&quot; error with Android'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-5891408718571556950</id><published>2009-12-30T18:44:00.003+08:00</published><updated>2009-12-30T19:11:35.931+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><title type='text'>Wrap text inside the HTML pre tag</title><content type='html'>&lt;p&gt;Normally the text inside the HTML pre tag will NOT be wrapped.  However, this document [ &lt;a target="_blank" href="http://forums.techguy.org/web-design-development/249849-forcing-long-text-lines-wrap.html"&gt;Forcing long text lines to wrap  &lt;/a&gt; ] shows how to make text wrap inside the HTML pre tag.
&lt;/p&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-5891408718571556950?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/5891408718571556950/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=5891408718571556950' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/5891408718571556950'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/5891408718571556950'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/12/wrap-text-inside-html-pre-tag.html' title='Wrap text inside the HTML pre tag'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-102063466162426376</id><published>2009-12-30T18:38:00.004+08:00</published><updated>2009-12-30T19:11:44.931+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='HTML'/><title type='text'>http header, BOM and meta charset</title><content type='html'>&lt;p&gt;This document [ &lt;a target="_blank" href="http://www.validome.org/lang/en/errors/HTML-CHARSET"&gt;HTML-Error documents regarding charset encodings&lt;/a&gt; ] has documented some detail description regarding http header, BOM and the charset in meta tag of html.
&lt;/p&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-102063466162426376?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/102063466162426376/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=102063466162426376' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/102063466162426376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/102063466162426376'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/12/http-header-bom-and-meta-charset.html' title='http header, BOM and meta charset'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-5049522681510442637</id><published>2009-12-28T18:01:00.005+08:00</published><updated>2009-12-28T18:14:37.634+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='software freeware webware'/><title type='text'>The Question Mark in the Subtitle of VLC</title><content type='html'>&lt;p&gt;My previous post &lt;a target="_blank" href="http://alvinsiu.blogspot.com/2009/08/square-char-in-subtitle-of-vlc.html"&gt;The Square in Subtitle of VLC&lt;/a&gt; has documented how to set the VLC to use unicode for subtitles.  However, even so sometimes there are one or two question marks at the end of each subtitle lines.
&lt;/p&gt;
&lt;p&gt;For example, when opening the subtitle files, the characters can be read without difficulties.  The subtitle lines appear to be chopped at the middle and show with one of two question marks instead.  After investigation, when opening the subtitle file using PSPad, the file format (as shown at the status bar) is UTF-16 LE.  This is the root cause.  For VLC, the subtitle file is better to be in UTF-8 format.  So, simply convert the UTF-16 LE format file into a UTF-8 format file with the same name.  Then, VLC can display the subtitle correctly.
&lt;/p&gt;
&lt;br/&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-5049522681510442637?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/5049522681510442637/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=5049522681510442637' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/5049522681510442637'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/5049522681510442637'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/12/question-mark-in-subtitle-of-vlc.html' title='The Question Mark in the Subtitle of VLC'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-8921319251314553096</id><published>2009-12-24T13:56:00.004+08:00</published><updated>2009-12-24T14:33:58.201+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><title type='text'>My 2nd Hello World Program using XML in Android</title><content type='html'>&lt;p&gt;After finishing my first Hello World program in Android, I continued explore &lt;a target="_blank" href="http://developer.android.com/resources/tutorials/hello-world.html"&gt;Android's Hello World&lt;/a&gt; web page.  The page says that the Hello World program can be written with XML.  So, I want to have a try.
&lt;/p&gt;
&lt;div&gt;Since I want to keep the first non-XML version of Hello World program, I have to setup another project for this XML version.  Actually, I prefer to setup a new workspace in Eclipse for this.  If I start everything from scratch, I have to input the application name, ... etc.  It is quite a headache.After searching the net, I can duplicate an Eclipse workspace.  Here is the steps :&lt;ol&gt;&lt;li&gt;Make sure Eclipse is not running
&lt;li&gt;Copy the workspace directory [ ws_hello ] to a new directory [ ws_hello_xml ]
&lt;li&gt;Go to directory [ ws_hello_xml ]
&lt;li&gt;Go to sub-directory [ .metadata\.plugins\org.eclipse.jdt.core ]
&lt;li&gt;Delete all [ *.index ] files
&lt;li&gt;Delete the file [ savedIndexNames.txt ]
&lt;li&gt;Start Eclipse and choose the [ ws_hello_xml ] workspace&lt;/ol&gt;&lt;/div&gt;
&lt;p&gt;Using this way, a new workspace [ ws_hello_xml ] is ready for my development of the Hello World program using XML.
&lt;/p&gt;
&lt;p&gt;Then, follow the steps as documented in &lt;a target="_blank" href="http://developer.android.com/resources/tutorials/hello-world.html"&gt;Android's Hello World&lt;/a&gt; web page, I finished my second program in Android : the Hello World program using XML.
&lt;/p&gt;
&lt;br/&gt;
&lt;br/&gt;
&lt;br/&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-8921319251314553096?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/8921319251314553096/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=8921319251314553096' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/8921319251314553096'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/8921319251314553096'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/12/my-2nd-hello-world-program-using-xml-in.html' title='My 2nd Hello World Program using XML in Android'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-1061451063840633871</id><published>2009-12-23T23:05:00.003+08:00</published><updated>2009-12-23T23:27:18.048+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='software freeware webware'/><title type='text'>Change Google Desktop Data Directory</title><content type='html'>&lt;p&gt;There are many configuration data stored under the directory [ Documents and Settings ].  Therefore, it is better to backup this directory regularly.  However, Google desktop has put its indexing database under this directory.  This make it very large (sometimes more than 10 GB) and difficult to backup.  Is it possible to move the Google Desktop directory to another place ?  After searching the net, here is the solution :
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Stop Google Desktop by:
   &lt;ol type="i"&gt;
   &lt;li&gt;Go to system tray
   &lt;li&gt;Right-click the Google Desktop icon
   &lt;li&gt;Select [ Exit ]
   &lt;/ol&gt;
&lt;li&gt;Move the [ Google Desktop ] directory to some other location
&lt;li&gt; Run [ regedit ] by :
   &lt;ol type="i"&gt;
   &lt;li&gt;Go to Start
   &lt;li&gt;Click [ Run ]
   &lt;li&gt;Input [ regedit ]
   &lt;/ol&gt;
&lt;li&gt;Locate the registry key:&lt;br&gt;
HKEY_CURRENT_USER\Software\Google\Google Desktop\data_dir
&lt;li&gt;Change its value to the location in step-2
&lt;li&gt;Start Google Desktop again
&lt;/ol&gt;
&lt;br/&gt;
&lt;br/&gt;
&lt;br/&gt;
&lt;br/&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-1061451063840633871?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/1061451063840633871/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=1061451063840633871' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/1061451063840633871'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/1061451063840633871'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/12/change-google-desktop-data-directory.html' title='Change Google Desktop Data Directory'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-3835404367101314916</id><published>2009-12-23T14:25:00.027+08:00</published><updated>2009-12-23T22:23:23.397+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Android'/><title type='text'>My First Hello World Program in Android</title><content type='html'>&lt;p&gt;Here is my first day experience of writing my first Hello, World program using Android.
&lt;/p&gt;
&lt;h2&gt;A. Install the Android SDK&lt;/h2&gt;
&lt;div&gt;Firstly, I had to install the SDK :&lt;ol&gt;
&lt;li&gt;Download the &lt;a target="_blank" href="http://developer.android.com/sdk/index.html"&gt;SDK&lt;/a&gt; file [ android-sdk_r04-windows.zip ]
&lt;li&gt;Unzip it.  Actually, it will unzip to a directory [ android-sdk-windows ].
&lt;li&gt;Put this directory under directory [ \bin ] (or other directory you like, provided that its name has no white space char)
&lt;li&gt;Go to directory [ \bin\android-sdk-windows ]
&lt;li&gt;Noted that there is a sub-directory [ platforms ] which is empty.  Now, we are going to set it up.
&lt;li&gt;Run the file [ SDK Setup.exe ]
&lt;li&gt;This message may appear [ Failed to fetch URL https://dl-ssl.google.com/android/repository/repository.xml,
reason: HTTPS SSL error. You might want to force download through HTTP
in the settings.  ].  Then, do the following:
  &lt;ol type="i"&gt;
  &lt;li&gt;Click the menu [ Tools -&gt; android ]
  &lt;li&gt;Check [ Settings -&gt; Force https://... sources to be fetched using http://... ]
  &lt;li&gt;Click [ Save &amp; Apply ] button
  &lt;li&gt;Close
  &lt;li&gt;Run the file [ SDK Setup.exe ] again
  &lt;/ol&gt;
&lt;li&gt;Now, you should see a list of platforms.  Simply install all of them.&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;
After successful installation, there are many different sub-directories under [ \bin\android-sdk-windows\platforms ].
&lt;/p&gt;
&lt;p&gt;Also, the configuration information can be found in the directory [ %USERPROFILE%\.android ].
&lt;/p&gt;
&lt;br /&gt;
&lt;h2&gt;B. Install Eclipse 3.5.1&lt;/h2&gt;
&lt;div&gt;Because I use Eclipse for many other developments, I want to use a CLEAN Eclipse for this Android development.  Therefore, I have to install a blank new Eclipse as follows :&lt;ol&gt;
&lt;li&gt;Download the file [ eclipse-jee-ganymede-SR1-win32.zip ]
&lt;li&gt;Unzip the directory [ eclipse ] to directory [ \temp ]
&lt;li&gt;Go to directory [ \temp ]
&lt;li&gt;Rename the directory [ eclipse ] to [ eclipse_A ]
&lt;li&gt;Move the directory [ eclipse_A ] under the directory [ \bin ]
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;Now, Eclipse 3.5.1 is successfully installed under the directory [ \bin\eclipse_A ]
&lt;/p&gt;
&lt;br /&gt;
&lt;h2&gt;C. Install the Android Development Tools (ADT) plugin for Eclipse&lt;/h2&gt;
&lt;div&gt;Follow these steps to install this plugin (basically it is the same steps as mentioned in the site &lt;a target="_blank" href="http://developer.android.com/sdk/eclipse-adt.html"&gt;http://developer.android.com/sdk/eclipse-adt.html&lt;/a&gt;) :
&lt;ol&gt;
&lt;li&gt;Go to the directory [ \bin\eclipse_A ]
&lt;li&gt;Run the file eclipse.exe
&lt;li&gt;Click the menu Help -&gt; Install New Software
&lt;li&gt;In the [ Available Software ] dialog, click the [ Add ] button
&lt;li&gt;Then, the [ Add Site ] dialog appear
&lt;li&gt;In the [ Name ] field, input [ Android Plugin ]
&lt;li&gt;In the [ Location ] field, input this URL [ http://dl-ssl.google.com/android/eclipse/ ]
&lt;li&gt;Click the [ OK ] button
&lt;li&gt;Back to the [ Available Software ] dialog, you should now see [ Developer Tools ] added to the list.
&lt;li&gt;Select the checkbox next to [ Developer Tools ], which will automatically select the nested tools Android DDMS and Android Development Tools. 
&lt;li&gt;Click the [ Next ] button
&lt;li&gt;The [ Install Details ] dialog will appear to list all the Android DDMS and Android Development Tools features.
&lt;li&gt;Click the [ Next ] button to read and accept the license agreement and install any dependencies.
&lt;li&gt;Then, click [ Finish ] button.
&lt;li&gt;Wait for the installation
&lt;li&gt;Restart Eclipse
&lt;li&gt;Quit Eclipse
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;Now, the plugin is successfully setup in Eclipse.&lt;/p&gt;
&lt;br /&gt;
&lt;h2&gt;D. Create Android Emulator - Android Virtual Device (AVD)&lt;/h2&gt;
&lt;p&gt;Before developing the program, you have to firstly setup the Android Emulator in which your application is run.  The emulator is called Android Virtual Device (AVD).
&lt;/p&gt;
&lt;div&gt;Here are the steps to setup the most simple AVD (basically the steps are the same as documented in the &lt;a target="_blank" href="http://developer.android.com/resources/tutorials/hello-world.html"&gt;Android developer&lt;/a&gt; site) :&lt;ol&gt;
&lt;li&gt;Open DOS prompt
&lt;li&gt;cd \bin\android-sdk-windows\tools
&lt;li&gt;Run the following command :&lt;br&gt;
android create avd --target 2 --name my_avd
&lt;li&gt;When being asked to create a custom hardware profile, press [ ENTER ] to accept the default [ no ]
&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;Now the AVD named my_avd is ready for your Android application.  There is a sub-directory [ my_avd.avd ] created under the directory [ %USERPROFILE%\.android\avd ].
&lt;/p&gt;
&lt;br /&gt;
&lt;h2&gt;E. Develop the Hello World Program&lt;/h2&gt;
&lt;div&gt;Before writing the Hello program, we have to setup Eclipse workspace and create an Android project inside Eclipse using these steps:
&lt;ol&gt;
&lt;li&gt;Make a folder [ D:\Android_WS ] to store all Android related Eclipse workspaces
&lt;li&gt;Start Eclipse
&lt;li&gt;When you are prompt for a workspace, input the following [ D:\Android_WS\ws_hello ]
&lt;li&gt;Click the [ OK ] button.  Eclipse will create the workspace directory [ ws_hello ] for you.
&lt;li&gt;Inside Eclipse, click the [ Workbench ] button on the right to go to the workbench panel
&lt;li&gt;Then, select the menu [ File -&gt; New -&gt; Project ]
&lt;li&gt;In the [ New Project ] dialog, there should be a folder [ Android ] which contains an item [ Android Project ]
&lt;li&gt;Select highlight the item [ Android Project ]
&lt;li&gt;Click the [ Next ] button
&lt;li&gt;The [ New Android Project ] dialog should appear, now fill in the Android project details.
  &lt;ul&gt;
  &lt;li&gt;For the [ Project name ] field, fill in [ HelloAndroid ]
  &lt;li&gt;For the [ Build Target ], tick the box [ Android 2.0.1 ]
  &lt;li&gt;For the [ Application name ], fill in [ Hello, Android ]
  &lt;li&gt;For the [ Package name ], fill in [ com.example.helloandroid ]
  &lt;li&gt;For [ Create Activity ] field, fill in [ HelloAndroid ]
  &lt;li&gt;For [ Min SDK Version ] field, fill in [ 2 ]
  &lt;li&gt;Click the [ Finish ] button
  &lt;/ul&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;DIV&gt;Once the [ Finish ] button is pressed, the project is automatically built.  Then, a file [ HelloAndroid.java ] should be created under [ HelloAndroid -&gt; src -&gt; com.exmplae.helloandroid ] in the Package Explorer on the left.  The HelloAndroid.java should look like this:&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mynumcode"&gt;package com.example.helloandroid;

import android.app.Activity;
import android.os.Bundle;

public class HelloAndroid extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;Noted that the Eclipse will NOT show the line numbering.  I add the numbering information for your easy reference.
&lt;/DIV&gt;
&lt;br /&gt;
&lt;DIV&gt;Now, we have to write our own Hello World program. as follows :&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mynumcode"&gt;package com.android.helloandroid;

import android.app.Activity;
import android.os.Bundle;
&lt;b&gt;import android.widget.TextView;&lt;/b&gt;

public class HelloAndroid extends Activity {
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       &lt;b&gt;TextView tv = new TextView(this);&lt;/b&gt;
       &lt;b&gt;tv.setText("Hello, Android");&lt;/b&gt;
       setContentView(tv);
   }
}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;Noted that line-5, line-12 &amp; line-13 are newly added coding.
&lt;/DIV&gt;
&lt;p&gt;Now, the program is ready to run.
&lt;/p&gt;
&lt;h2&gt;F. Run the Hello World Program&lt;/h2&gt;
&lt;div&gt;Run the program inside Eclipse as follows:
&lt;ol&gt;
&lt;li&gt;Click the menu [ Run -&gt; Run ]
&lt;li&gt;In the [ Run As ] dialog, select [ Android Application ]
&lt;li&gt;Click the [ OK ] button
&lt;li&gt;Wait a while as it needs time to startup the simulator
&lt;li&gt;A red simulation phone should appear
&lt;li&gt;If the screen is locked due to timeout, click the [ menu ] button on the simulation phone.
&lt;li&gt;A text message [ Hello Android ] should appear on the black screen of the phone
&lt;li&gt;Click the [ Back ] button to quit the application
&lt;li&gt;Close the simulation
&lt;/ol&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-3835404367101314916?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/3835404367101314916/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=3835404367101314916' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/3835404367101314916'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/3835404367101314916'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/12/my-first-hello-world-program-in-android.html' title='My First Hello World Program in Android'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-5289066227896410307</id><published>2009-08-06T16:59:00.009+08:00</published><updated>2009-08-06T20:54:57.508+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><title type='text'>Access Permission of the Underlying Directory BEFORE mount</title><content type='html'>&lt;p&gt;In AIX 5.2, the du, find and tar command will sometimes fail in some directories.  But, they can be run successfully in some other directories.  Why this happens ?  It is all because of the filesystem mounting.
&lt;/p&gt;&lt;p&gt;It is very natural to mount numerous filesystems in AIX.  Usually, a filesystem is mounted onto a directory of the same name in another filesystem.  For example, under the ROOT filesystem, there are numerous other filesystems mounted onto many directories.  When you ls these directories, you are actually getting the access permission of the AFTER-MOUNTED image.  However, in AIX 5.2, the technical aspect of some commands such as find and tar will check the access permission of the BEFORE-MOUNTED directory.  As a result, even the ls command reports a permission of 777 for the directory, the access permission of the BEFORE-MOUNTED underlying directory may have a permissoin of 700.  Then, the find or tar command will certainly fail.
&lt;/p&gt;&lt;p&gt;Since the ls command (and many other commands) will only reports the access permission of the AFTER-MONUTED image, how to know about the access permission of the before image ?  The answer is to check the inode information.  But, how to do so ?
&lt;/p&gt;&lt;p&gt;&lt;div&gt;First of all, you have to know the inode number.  Supposed that your filesystem is mounted onto the directory /usr/your/directory.  To search for the inode number of the underlying directory /usr/your/directory, issue this command:
&lt;table border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td bgcolor="black"&gt;&lt;div class="myscreen"&gt;&lt;font color="green"&gt;
ncheck | grep -e ':$' /usr/your/directory

&lt;/font&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;div&gt;The output may look like this:&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td bgcolor="black"&gt;&lt;div class="myscreen"&gt;&lt;font color="green"&gt;:
:
/dev/hd1:
1996 /usr/God/directory
1997 /usr/your/directory
1998 /usr/others/directory 
:
:
&lt;/font&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;&lt;/p&gt;&lt;p&gt;&lt;div&gt;Then, use this command to check the access permission of the inode of the underlying directory:&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td bgcolor="black"&gt;&lt;div class="myscreen"&gt;&lt;font color="green"&gt;
istat 1997 /dev/hd1

&lt;/font&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;&lt;/p&gt;&lt;p&gt;You will certainly get the access perssions which is very different to that got from the ls command.  This is the access permission of the underlying directory.
&lt;/p&gt;
&lt;br /&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-5289066227896410307?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/5289066227896410307/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=5289066227896410307' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/5289066227896410307'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/5289066227896410307'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/08/access-permission-of-underlying.html' title='Access Permission of the Underlying Directory BEFORE mount'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-6545431256486280483</id><published>2009-08-03T13:41:00.007+08:00</published><updated>2009-12-28T18:17:54.547+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='software freeware webware'/><title type='text'>The Square in Subtitle of VLC</title><content type='html'>&lt;p&gt;Sometimes when watching videos using VLC 1.0.1 with subtitle srt file, there are squares instead of readable characters in the substitle.  Usually, each square is a Chinese character.  When opening the srt file using a word processor with appropriate encoding (Big5, GB2312, GB18030 or Unicode), the Chinese character can be read.  However, VLC 1.0.1 simply cannot display the Chinese character correctly.  You can only see squares.  How to handle this situation ?
&lt;/p&gt;&lt;p&gt;First of all, convert the srt file to Unicode.
&lt;/p&gt;&lt;p&gt;&lt;div&gt;Then config the VLC 1.0.1 as follows: &lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mystep"&gt;&lt;ol&gt;&lt;li&gt;Open VLC 1.0.1
&lt;li&gt;In the main menu, click &lt;b&gt;Tools&lt;/b&gt;
&lt;li&gt;Click &lt;b&gt;Preferences&lt;/b&gt;
&lt;li&gt;On the LHS, click &lt;b&gt;Subtitles &amp;amp; OSD&lt;/b&gt;
&lt;li&gt;In &lt;b&gt;Subtitles Language&lt;/b&gt; &amp;gt; &lt;b&gt;Default encoding&lt;/b&gt;, choose &lt;b&gt;Universal, Chinese (GB18030)&lt;/b&gt;
&lt;li&gt;In &lt;b&gt;Display Settings&lt;/b&gt; &amp;gt; &lt;b&gt;Font&lt;/b&gt;, input the fullpath filename of the font : &lt;b&gt;Font Arial Unicode MS&lt;/b&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt; How to find out the fullpath filename of a font ?  All fonts should be inside the directory &lt;b&gt;%SystemRoot%\Fonts&lt;/b&gt;.  Simply open this directory using details view.  The filename (XXXXXXXX.TTF) should be displayed next to the column &lt;b&gt;Font Name&lt;/b&gt;
&lt;/div&gt;&lt;/p&gt;&lt;p&gt;
&lt;/p&gt;&lt;p&gt;
&lt;/p&gt;&lt;p&gt;By the way, using this method, the srt file must be in unicode and should be stored using UTF-8 format.  Using UTF-16 LE format will make VLC displaying one or two question marks at the end of subtitle lines.
&lt;/p&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-6545431256486280483?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/6545431256486280483/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=6545431256486280483' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/6545431256486280483'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/6545431256486280483'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/08/square-char-in-subtitle-of-vlc.html' title='The Square in Subtitle of VLC'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-4069178074392211940</id><published>2009-07-09T16:01:00.023+08:00</published><updated>2009-07-26T20:43:41.257+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming style'/><title type='text'>The Equal Sign and Double-Equal Sign</title><content type='html'>&lt;p&gt;The use of equal sign and double-equal sign is really an interesting topic in programming.
&lt;/p&gt;
&lt;p&gt;In computer programming, the assignment operation and the equal-comparison operation are two distinct operations.  How to 'represent' these two operations ? The equal sign(s) plays an very important role.
&lt;/p&gt;
&lt;p&gt;&lt;div&gt;In some older programming languages such as BASIC &amp; COBOL, single equal sign is used for both assignment and equality comparison.  For example, here is a COBOL snippet:&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mynumcode"&gt;  COMPUTE X = (5 + 1) * (5 - 1).
  IF X = 24
  THEN DISPLAY 'YES, 24'
  ELSE DISPLAY 'NOT 24'
  END-IF.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;&lt;div&gt;Pascal, as an language for teaching programming, wants to tell the programmer the difference between the assignment operation and the equal-comparison operation.  Pascal uses colon-equal (i.e. :=) as assignment operation and single-equal sign as equality comparison.  Here is a Pascal snippet:&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mynumcode"&gt;  x := (5 + 1) * (5 - 1) ;
  if( x = 24 )
  then writeln('Yes, 24');
  else writeln('Not 24') ;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;&lt;div&gt;Distinguishing assignment and equal-comparison is of great merit in programming.  Many modern programming languages agree with this theory.  In C programming lanaguage, however, an alternate approach is used.  She uses single-equal sign as assignment operator and double-equal signs as the equality comparison operator.  C++ and Java also follow this approach. Here is a C snippet:&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mynumcode"&gt;  x = (5 + 1) * (5 - 1) ;
  if( x == 24 )
       printf('Yes, 24');
  else printf('Not 24') ;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Why choose single-equal sign (instead of colon-equal or double-equal or else) as assignment operator ?  The answer is for efficiency.  It was told that assignment operation is a type of very frequent operation.  Using a single character (instead of two or more characters) can gain speed in writing programs.  Programmers input fewer keystrokes.
&lt;/p&gt;
&lt;p&gt;&lt;div&gt;Although efficiency is the advantage, this violate the normal behavior of human beings.  Most human beings on Earth learns arithmetics and mathematics at his very early age.  When learning arithmetics, the single-equal sign represents EQUAL.  Some will learn mathematics for more than 10 years before learning programming.  As a result, treating single-equal sign as EQUAL is nearly an intrinsic action of human being.  Here is a very simple mathematical equation:&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;  x + 3 = 9            x plus 3 equals 9
      x = 9 - 3        x equals 9 minus 3
      x = 6            x equals 6&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;&lt;div&gt;Imaging that, in the middle of the night, you are woken up by an emergency pager call to debug this program snippet:&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mynumcode"&gt;  x = (5 + 1) * (5 - 1) ;
  if( x = 24 )
       printf('Yes, 24');
  else printf('Not 24') ;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;Even experienced programmer may not spot the bug instantly.  This is because they intrinsicly treat single-equal sign as EQUAL.
&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;&lt;div&gt;To solve this problem, some suggest to put the constant in the left hand side when doing equality comparison such as this snippet:&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mynumcode"&gt;  x = (5 + 1) * (5 - 1) ;
  if( 24 = x )
       printf('Yes, 24');
  else printf('Not 24') ;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;With this method, the compiler will certainly shouts at you.  Then, the programmer can fix the bug as:&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mynumcode"&gt;  x = (5 + 1) * (5 - 1) ;
  if( 24 == x )
       printf('Yes, 24');
  else printf('Not 24') ;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;But, reading "twenty-four equals x" sounds not so comfortable as reading "x equals twenty-four".
&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;&lt;div&gt;Also, this method cannot be used when comparing two variables like this one:&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mynumcode"&gt;  x = 5 + 1 ;
  y = 5 - 1 ;
  z = x     ;
  &lt;b&gt;if( x = y )&lt;/b&gt;
       printf('the same') ;
  else printf('different');&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;Even the compiler gives you warning, the programming may overlook, especially when there are thousands of warnings.
&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;&lt;div&gt;In my programming life, I have another method to tackle this problem.  I use SPACE.  Look at this equation:&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;  x + 3 = 9
      x = 9 - 3
      x = 6&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;Do you notice that there is SPACE in both the LEFT and RIGHT hand side of the equal-sign ?  Many human beings will do the same.  So, my method is to put a apace in BOTH the LHS and RHS when doing equality comparison.  When doing assignment operation, I put space ONLY at the RHS of the assignment operator like this:&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mynumcode"&gt;  x= 5 + 1 ;
  y= 5 - 1 ;
  z= x     ;                // No space at LHS of =
  if( x == y )              // Spaces at both LHS and RHS of ==
       printf('the same') ;
  else printf('different');&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;&lt;div&gt;If you adopt this programming style and make it as a habit, you will feel very odd when seeing this:&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mynumcode"&gt;  x= 5 + 1 ;
  y= 5 - 1 ;
  z= x     ;
  &lt;b&gt;if( x = y )&lt;/b&gt;
       printf('the same') ;
  else printf('different');&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;This is because putting spaces at both the left &amp; right side of the equal sign is NOT your programming habit.  There must be something wrong.  You can then get aware that you should use double-equal sign.
&lt;/div&gt;&lt;/p&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-4069178074392211940?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/4069178074392211940/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=4069178074392211940' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/4069178074392211940'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/4069178074392211940'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/07/equal-sign-and-double-equal-sign.html' title='The Equal Sign and Double-Equal Sign'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-6437694339159445769</id><published>2009-05-22T17:36:00.003+08:00</published><updated>2009-05-22T17:43:38.453+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mainframe'/><title type='text'>Undelete a PDS member</title><content type='html'>&lt;div&gt;The following steps show how to un-delete a member of a PDS dataset in MVS
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mystep"&gt;&lt;ol&gt;&lt;li&gt;Make sure the PDS dataset is &lt;b&gt;NOT compressed&lt;/b&gt;
&lt;li&gt;Go to &lt;b&gt;TSO Ready prompt&lt;/b&gt;
&lt;li&gt;Input &lt;b&gt;pds&lt;/b&gt;
&lt;li&gt;Input the &lt;b&gt;PDS dataset name&lt;/b&gt;
&lt;li&gt;Input &lt;b&gt;restore&lt;/b&gt;
&lt;li&gt;answer &lt;b&gt;Y&lt;/b&gt; to restore a member (answer &lt;b&gt;N&lt;/b&gt; to skip)&lt;br&gt; Noted that, for the same name, there happens to be more than one deleted copy.
&lt;/ol&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-6437694339159445769?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/6437694339159445769/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=6437694339159445769' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/6437694339159445769'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/6437694339159445769'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/05/undelete-pds-member.html' title='Undelete a PDS member'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-8656342829201553917</id><published>2009-05-04T22:16:00.016+08:00</published><updated>2009-05-05T00:00:02.982+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming language - SAS'/><title type='text'>Different Methods to Specify SAS Config File</title><content type='html'>&lt;div&gt;There are different methods to config SAS in unix environment.  First of all, for every installatoin, there is a config file stored in the installation directory alongside with the SAS executable file (i.e. the sasroot directory).  This file is named config.sas in version-6, sasv8.cfg in version-8 and sasv9.cfg in version-9.  This config file is effective for all users in this machine using this SAS.  For example, this line in the config file can let all users to share the SAS working directory: &lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;-work '/production/global/sas_working_directory' ;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;&lt;div&gt;However, if there is a config file in the $HOME directory e.g. &lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;/home/alvin/config.sas&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;, SAS will use this $HOME config file instead.
&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;&lt;div&gt;Using this method, each programmer can has his/her own SAS configuration setting, e.g. using his own very large working directory instead of the global one :&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;-work '/my_large_filesystem/sas_working_directory' ;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;&lt;div&gt;But, when there are some other parameters changes e.g.&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;-sortsize 32M&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
and the program is rolled out to production, how can you ensure that the config file is also adjusted to be similar to the programmer's own config file (i.e. to -sortsize 32M) ?  The change is ONLY in the programmer's config file in the programmer's $HOME directory.  This is a serious drawback.  (Actually, the change is not reflected in system test and user acceptance test either.)
&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;Also, when upgrading from SAS version-6 to version-8, the name of the config file is changed from config.sas to sasv8.cfg.  All user's config file under $HOME directory will be affected.  Similarly when upgrading from version-8 to version-9.
&lt;/p&gt;
&lt;p&gt;&lt;div&gt;Starting from version-8, we can also use environment variables SASV8_OPTIONS and SASV8_CONFIG to specify the config files.  Using this method, it is more easy for all team members of a department to SHARE a common config file. For example: &lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;export SASV8_OPTIONS='-config /company/department/common/sasv8.cfg'
sas my_program.sas&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
or &lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;export SASV8_CONFIG=/company/department/common/sasv8.cfg
sas my_program.sas&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;These environmental variables can be specified in a common profile file.  All team members has to call this departmental common profile file to make it effective for the login sessoin.
&lt;/p&gt;
&lt;p&gt;&lt;div&gt;Another method is to specify the config file as command line option when calling the SAS executable.  The advantage of using this method is the capability of specifing different configuration under different development phases.  For example, in development phase, we can use a development configuration file like this : &lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;export MYSASCONFIGFILE=/project/dvt/sasv8.cfg
sas -config $MYSASCONFIGFILE my_program.sas&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
Then, during system test, we can do this :
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;export MYSASCONFIGFILE=/project/syt/sasv8.cfg
sas -config $MYSASCONFIGFILE my_program.sas&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
During user acceptance test, we can do this :
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;export MYSASCONFIGFILE=/project/uat/sasv8.cfg
sas -config $MYSASCONFIGFILE my_program.sas&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
Using this method, we can adjust the parameters (e.g. the working directory) in different development phases.  In case some parameters needed to be adjusted, the UAT version of sasv8.cfg file can also be check-in / check-out to rollout to production.
&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;By the way, since SAS version-8 and versoin-9 has some more complicated ways to specify the config file please refer &lt;a target="_blank" href="http://www.technion.ac.il/docs/sas/unixc/z0279259.htm#config"&gt;here&lt;/a&gt; for the details for version-8 and &lt;a target="_blank" href="http://support.sas.com/documentation/cdl/en/hostunx/61879/HTML/default/a002460936.htm#config"&gt;this&lt;/a&gt; for version-9.
&lt;/p&gt;
&lt;p&gt;In short, before using SAS for any project, the first thing is to define the way of using the config file.  It is better to use a systematic approach, rather than an ad-hoc way (e.g. the $HOME config file method).
&lt;/p&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-8656342829201553917?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/8656342829201553917/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=8656342829201553917' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/8656342829201553917'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/8656342829201553917'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/05/different-methods-to-config-sas.html' title='Different Methods to Specify SAS Config File'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-5171421364894942946</id><published>2009-04-30T12:55:00.007+08:00</published><updated>2009-04-30T13:26:46.012+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming language - SAS'/><title type='text'>SAS Operator for Not-Equal</title><content type='html'>&lt;p&gt;For many programmers, Pascal is the first programming language learnt.  In Pascal, the operator &lt;b&gt;&amp;lt;&amp;gt;&lt;/b&gt; means &lt;b&gt;not equal&lt;/b&gt;.
&lt;/p&gt;
&lt;p&gt;SAS also has such a &lt;b&gt;&amp;lt;&amp;gt;&lt;/b&gt; operator.  But, this &lt;b&gt;&amp;lt;&amp;gt;&lt;/b&gt; operator does NOT mean not-equal, it means &lt;b&gt;MAX&lt;/b&gt;.  It simply return the maximum of the 2 values under comparsion.
&lt;/p&gt;
&lt;div&gt;Actually, the offical not-equal operator in SAS are :&lt;ol&gt;&lt;li&gt;ne&lt;/li&gt;
&lt;li&gt;^=&lt;/li&gt;
&lt;li&gt;¬=&lt;/li&gt;
&lt;li&gt;~=&lt;/li&gt;&lt;/ol&gt;
&lt;/div&gt;
&lt;p&gt;
This is the &lt;a target="_blank" href="http://v8doc.sas.com/sashtml/lrcon/z0780367.htm"&gt;link&lt;/a&gt; for SAS version-8 operators for your reference.
&lt;/p&gt;
&lt;p&gt;Frankly speaking, this quite odd usage of the &lt;b&gt;&amp;lt;&amp;gt;&lt;/b&gt; operator in SAS will easily make some beginners fall into the trap of assuming &lt;b&gt;&amp;lt;&amp;gt;&lt;/b&gt; to stand for not-equal.  In SAS version-8, you can change the warning level to let the interpreter to issue a warning message when it sees a &lt;b&gt;&amp;lt;&amp;gt;&lt;/b&gt; operator to alert the programmer that it is a &lt;b&gt;MAX&lt;/b&gt; operator.
&lt;/p&gt;
&lt;p&gt;Since in real life the usage of getting the maximum using the &lt;b&gt;&amp;lt;&amp;gt;&lt;/b&gt; operator is quite rare, my previous working experience is to use a pre-compiler alike construct to scan all SAS program to &lt;b&gt;forbid&lt;/b&gt; using the &lt;b&gt;&amp;lt;&amp;gt;&lt;/b&gt; operator.  This can avoid falling into the trap of mistakenly using it to mean not-equal for everyong in the department.  Actually, in SAS, there is a &lt;a target="_blank" href="http://v8doc.sas.com/sashtml/lgref/z0245913.htm"&gt;ma&lt;/a&gt;&lt;a target="_blank" href="http://support.sas.com/documentation/cdl/en/lrdict/61724/HTML/default/a000245913.htm"&gt;x()&lt;/a&gt; function which perform SIMILAR processing as the &lt;b&gt;&amp;lt;&amp;gt;&lt;/b&gt; operator.
&lt;/p&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-5171421364894942946?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/5171421364894942946/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=5171421364894942946' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/5171421364894942946'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/5171421364894942946'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/04/sas-operator-for-not-equal.html' title='SAS Operator for Not-Equal'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-2549540446449000760</id><published>2009-04-30T11:30:00.005+08:00</published><updated>2009-04-30T12:25:55.543+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming language - SAS'/><title type='text'>Substring in SAS</title><content type='html'>&lt;p&gt;In many programming languages, there is a substr() function which will extract a portion of a string. SAS also has such a function.  But, in SAS the substr() function is a little bit complicated.
&lt;/p&gt;
&lt;p&gt;In SAS version-8, if you put the substr() function on the left of the = sign, the substr() is actually a &lt;b&gt;procedure&lt;/b&gt; to &lt;b&gt;substitute string&lt;/b&gt;.  It will replace a portion of the argument string with values at the right of the = sign.  This &lt;a target="_blank" href="http://v8doc.sas.com/sashtml/lgref/z0212267.htm"&gt;link&lt;/a&gt; shows the version-8 syntax and &lt;a target="_blank" href="http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a000212267.htm"&gt;here&lt;/a&gt; is the version-9 syntax.
&lt;/p&gt;
&lt;p&gt;If, however, the substr() function is put at the right of the = sign, the behavior of the substr() function is the normal sub-string function as expected by many ones. It will return a portion of the argument string.  This  &lt;a target="_blank" href="http://v8doc.sas.com/sashtml/lgref/z0212264.htm"&gt;link&lt;/a&gt; is the version-8 syntax and &lt;a target="_blank" href="http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a000212264.htm"&gt;here&lt;/a&gt; is the version-9 syntax.
&lt;/p&gt;
&lt;p&gt;In SAS version-8, there is another function called &lt;a target="_blank" href="http://v8doc.sas.com/sashtml/lgref/z0426180.htm"&gt;kstrstrb()&lt;/a&gt;. Its function is to extract a substring in terms of byte. The DBCS version of this function is called &lt;a target="_blank" href="http://v8doc.sas.com/sashtml/lgref/z0426143.htm"&gt;ksubstr()&lt;/a&gt;.  SAS version-9 also has these two functions.
&lt;/p&gt;
&lt;p&gt;In short, putting the substr() function on the LHS or RHS of the = sign will have very different behaviours.  Putting it on the LHS will &lt;b&gt;alter&lt;/b&gt; the argument string, just like passing parameter by reference.  Putting it on the RHS is a function call with  parameters passed by value and the argument string will NOT be altered.
&lt;/p&gt;
&lt;p&gt;By the way, when writing SAS macro, there are &lt;a target="_blank" href="http://v8doc.sas.com/sashtml/macro/z4substr.htm"&gt;%substr() and %qsubstr()&lt;/a&gt; macro functions doing similar substring extraction processing.
&lt;/p&gt;
&lt;br/&gt;
&lt;br/&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-2549540446449000760?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/2549540446449000760/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=2549540446449000760' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/2549540446449000760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/2549540446449000760'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/04/sub-string-in-sas.html' title='Substring in SAS'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-2152266587327623250</id><published>2009-04-14T13:14:00.005+08:00</published><updated>2009-04-29T16:11:48.325+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='BlackBerry'/><title type='text'>Blackberry Signature Keys and Sign .cod File</title><content type='html'>&lt;p&gt;This web page &lt;a target="_blank" href="http://a-developers-notes.blogspot.com/2007/05/install-rim-blackberry-signature-keys.html"&gt;Install RIM Blackberry Signature Keys and Sign .cod File&lt;/a&gt; tells the necessary steps for handling the signature keys after receiving them.
&lt;/p&gt;
&lt;p&gt;I follow the steps to 'install' the 3 csi files as emailed from Blackberry.  After this 'installation' the RBB, RRT and RCR keys are 'registered' with RIM.
&lt;/p&gt;
&lt;p&gt;Afterward, double-click the cod file.  A window will be displayed to ask for signing the application using the RBB, RRT and RCR keys.
&lt;/p&gt;
&lt;p&gt;After signed, the .cod file is updated.
&lt;/p&gt;
&lt;p&gt;Throughout the whole process, there is nothing to do with Eclipse.  
&lt;/p&gt;
&lt;br/&gt;
&lt;br/&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-2152266587327623250?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/2152266587327623250/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=2152266587327623250' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/2152266587327623250'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/2152266587327623250'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/04/blackberry-signature-keys-and-sign-cod.html' title='Blackberry Signature Keys and Sign .cod File'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-560122379207271072</id><published>2009-04-09T17:37:00.003+08:00</published><updated>2009-04-10T10:13:59.581+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='software freeware webware'/><title type='text'>My First Day Experience with Google Chrome 1.0.154.53</title><content type='html'>&lt;p&gt;After installing Google Chrome 1.0.154.53, the first web page loaded is "Google Chrome: The application failed to initialize properly (0xc0000005)"&lt;/p&gt;

&lt;p&gt;To solve this error, use Firefox to google search.  This &lt;a target="_blank" href="http://techblissonline.com/google-chrome-application-failed-initialize/"&gt;URL in techblissonline.com&lt;/a&gt; really helps.  It told me to add a &lt;b&gt;--no-sandbox&lt;/b&gt; option to open the application.&lt;/p&gt;

&lt;p&gt;This is my first day experience with Google Chrome.  The moral of this story is : there must be at least two browsers in your computer.  In case one browser has error, you can use another one to search the internet for solution !
&lt;/p&gt;

&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-560122379207271072?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/560122379207271072/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=560122379207271072' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/560122379207271072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/560122379207271072'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/04/my-first-day-experience-with-google.html' title='My First Day Experience with Google Chrome 1.0.154.53'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-2987970347655699222</id><published>2009-04-09T08:51:00.014+08:00</published><updated>2009-04-09T11:21:16.761+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='job scheduling'/><title type='text'>What is a Job ?</title><content type='html'>&lt;p&gt;In this article, I am not talking about the &lt;b&gt;job&lt;/b&gt; command in unix.  I am talking about batch job. 
&lt;/p&gt;
&lt;div&gt;A job can be defined as the smallest unit of work in a job scheduler.  Following is some attributes of a job:
&lt;table class="single"&gt;
&lt;thead bgcolor="azure"&gt;
&lt;tr&gt;
&lt;td class="single"&gt;#&lt;/td&gt;&lt;td class="single"&gt;Attributes&lt;/td&gt;
&lt;td class="single"&gt;Description&lt;/td&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class="single"&gt;1.&lt;/td&gt;&lt;td class="single"&gt;Executing Member Name&lt;/td&gt;
&lt;td class="single"&gt;In unix, this is the name of the job script to be executed.&lt;br&gt;In mainframe, this is the member name of the JCL.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="single"&gt;2.&lt;/td&gt;&lt;td class="single"&gt;Resident Directory&lt;/td&gt;
&lt;td class="single"&gt;In unix, this is the directory which stores the job script to be executed.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="single"&gt;3.&lt;/td&gt;&lt;td class="single"&gt;Job Owner&lt;/td&gt;
&lt;td class="single"&gt;This is the user-id to execute the job member.
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="single"&gt;4.&lt;/td class="single"&gt;&lt;td&gt;Machine name&lt;/td&gt;
&lt;td class="single"&gt;Some scheduler acts as an central job dispatching agent.  This field tells the scheduler which machine the job is to be executed.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="single"&gt;5.&lt;/td&gt;&lt;td class="single"&gt;some job ordering information&lt;/td&gt;
&lt;td class="single"&gt;This specify when the job is order to the machine waiting for execution.  For example : &lt;ul&gt;
&lt;li&gt;every 5 minute everyday
&lt;li&gt;every 5 minute every business day
&lt;li&gt;every 4 hour from 07:00 to 19:00 (both inclusive) everyday
&lt;li&gt;at 01:01 daily
&lt;li&gt;at 01:02 every business day
&lt;li&gt;at 02:21 every Monday
&lt;li&gt;at 02:22 every Monday and Thursday
&lt;li&gt;at 03:31 every 1st of the month
&lt;li&gt;at 03:32 on the last day of every month
&lt;li&gt;at 03:33 on the last business day of every month
&lt;li&gt;at 04:41 on March 31st of every year
&lt;li&gt;at 04:42 on December 31st of every year
&lt;/ul&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="single"&gt;6.&lt;/td&gt;&lt;td class="single"&gt;incoming condition&lt;/td&gt;
&lt;td class="single"&gt;A job is going to be executed only when this incoming condition(s) is satisfied.  The incoming condition(s) is actually the outgoing condition(s) of the preceding job(s).  Of course, some incoming condition can be an alarm time, e.g. at 0:00 every day.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class="single"&gt;7.&lt;/td&gt;&lt;td class="single"&gt;outgoing condition&lt;/td&gt;
&lt;td class="single"&gt;When the job is executed successfully, it will give out this outgoing condition(s) to the scheduler.  This outgoing condition(s) is actually the incoming condition(s) of succeeding job(s).&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;Of course, there are some more attributes.  Different scheduler software will have its own set of attributes.  The above is some common ones.
&lt;/div&gt;
&lt;p&gt;These attributes altogether will form a job record.  All the job records will be stored in a job database.  At regular time, the job scheduler will then scan the database to extract those job records to order (or give birth) jobs in the job agent machine (e.g. a PC) to wait for execution.  When the incoming condition(s) of a job is satisfied, the job script member will then put into the unix machine to run.
&lt;/p&gt;
&lt;p&gt;It is very important to understand that a &lt;b&gt;job&lt;/b&gt; is NOT a &lt;b&gt;script&lt;/b&gt; nor a &lt;b&gt;JCL&lt;/b&gt;. A job is much more than a script or a JCL.  For example, a job has incoming condition(s) and outgoing condition(s).  A script or JCL will not have this condition information.
&lt;/p&gt;
&lt;p&gt;Also, in the OO terminology a job is a &lt;b&gt;class&lt;/b&gt; declaration, NOT an object.  When the job is &lt;b&gt;order out&lt;/b&gt;, an object of that job is created.  In order words, job ordering is one way to &lt;b&gt;NEW&lt;/b&gt; a job object.
&lt;/p&gt;
&lt;p&gt;When job object is newly born, its status is &lt;b&gt;waiting for execution&lt;/b&gt;.  When incoming condition is fulfilled, a script in a unix machine will be executed.  If the script is executed successfully, the job object will change status to &lt;b&gt;successfully run&lt;/b&gt;.  Then, it will generate out condition(s) to the job scheduler.  When to clean-up these job objects (i.e. garbage collection in Java terminology) ?  The job scheduler will do it in regular base.
&lt;/p&gt;
&lt;p&gt;Each job object will have its own sysout information to store those messages issued by the printf or echo command in the job script.  This is similar to the case that each object will have its own variables and methods in the OO terminoloty.
&lt;/p&gt;
&lt;p&gt;The job scheduler take full control of all job objects. 
&lt;/p&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-2987970347655699222?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/2987970347655699222/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=2987970347655699222' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/2987970347655699222'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/2987970347655699222'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/04/what-is-job.html' title='What is a Job ?'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-7247533086308813165</id><published>2009-03-28T22:35:00.016+08:00</published><updated>2009-03-28T23:19:36.175+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='software freeware webware'/><title type='text'>Using ffmpeg to capture screen of flv file</title><content type='html'>&lt;p&gt;&lt;a target="_blank" href="http://www.ffmpeg.org"&gt;ffmpeg&lt;/a&gt; is a powerful utility for audio and video processing.  However, you have to compile the source code yourself.  This &lt;a target="_blank" href="http://idaiwan.pixnet.net/blog/post/26879051"&gt;web page&lt;/a&gt; tells how to compile the source code of ffmpeg to become executables.&lt;/p&gt;
&lt;p&gt;One very simple use of ffmpeg is to capture screen from a flv file.  Actually, this is to save a video frame to file.&lt;/p&gt;
&lt;DIV class="paragraph"&gt;For example, this command :&lt;table &gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;ffmpeg -i MyFile.flv -ss 00:00:31 -vframes 1 -y MyImage.jpg
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
will capture a frame from the file MyFile.flv at the time 00:00:31 to the file MyImage.jpg
&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;If you want to capture 101 frames, here is the command:
&lt;table &gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;ffmpeg -i MyFile.flv -ss 00:00:31 -vframes 101 -y MyImage-%03d.jpg
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
The will capture the 101 frames to the files MyImage-001.jpg to Myimage-101.jpg.
&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;However, under Windows, there is some special processing for the percent sign.  Therefore, the command has to be adjusted as follow:
&lt;table &gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;ffmpeg -i MyFile.flv -ss 00:00:31 -vframes 101 -y MyImage-%%03d.jpg
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
In short, double percent signs have to be used under Windows.
&lt;/DIV&gt;
&lt;br&gt; 
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-7247533086308813165?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/7247533086308813165/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=7247533086308813165' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/7247533086308813165'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/7247533086308813165'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/03/using-ffmpeg-to-capture-screen-of-flv.html' title='Using ffmpeg to capture screen of flv file'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-616437956089585650</id><published>2009-03-26T19:08:00.010+08:00</published><updated>2009-03-28T23:20:42.508+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='software freeware webware'/><title type='text'>Change Color of the Tabs in Firefox 3.0.6</title><content type='html'>&lt;DIV class="paragraph"&gt;In Firefox 3.0.6 the background colors of the selected active tab and the un-selected inactive tabs are very similar.  The color of the selected tabs cannot stand-out to catch your eyes.  Here is a way to change the colors.
&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;Firstly, go to the chrome directory of your profile in Firefox 3.0.6.  Create or edit the file userChrome.css and add the following lines :&lt;br&gt;
&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;tab
{
    -moz-appearance: none !important;
}
tab[selected="true"]
{
    background-color: #FF6A6A !important;
    color: blue !important;
}
tab:not([selected="true"])
{
    background-color: #CCFFFF !important;
    color: black !important;
}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
Then, re-start the firefox.
&lt;/DIV&gt;
&lt;p&gt;This will make the active tab have red background with blue text and the inactive tabs have light cyan background with black text.
&lt;/p&gt;&lt;br&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-616437956089585650?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/616437956089585650/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=616437956089585650' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/616437956089585650'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/616437956089585650'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/03/change-color-of-tabs-in-firefox-306.html' title='Change Color of the Tabs in Firefox 3.0.6'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-7157330362781375206</id><published>2009-03-21T18:07:00.039+08:00</published><updated>2009-04-09T17:56:37.623+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scripting language - Javascript'/><title type='text'>Line numbering source code snippet with Javascript function on body load</title><content type='html'>&lt;p&gt;Yesterday's blog I am talking about performing line numbering using Javascript for-loop hard coding.  Since you have to count the line numbering beforehand in order to hard code it, this is quite troublesome.  Here is a more automatic method, no need to count the line number manually.
&lt;/p&gt;
&lt;DIV class="paragraph"&gt;Here is a program code snippet using this line numbering method :&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mynumcode"&gt;program Hello_World ;

begin

  writeln('Hello World !');

  {
    This source code snippet is line numbered using
    a Javascript function which replace every line
    with a &amp;lt;li&amp;gt; and then use the HTML order list
    tag in order to make it appear as line numbering.
    As a result, there is a "dot" after each line number.

    Noted : 
    This method does not work in IE6 when the
    convert-line-breaks option is turn off in blogspot.
    Therefore, I simply disable this method for all IE.
    So, if you are using IE to read this web page,
    there is no line numbering for this program snippet.    
  }

end.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;The steps of this method are :
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mystep"&gt;&lt;ol&gt;&lt;li&gt;Use a HTML TTT  tag with a class XXX where TTT is either a pair of (&lt;b&gt;pre&lt;/b&gt; + &lt;b&gt;code&lt;/b&gt;) tags or  just a &lt;b&gt;div&lt;/b&gt; tag.
&lt;li&gt;Put the source code inside the TTT tags
&lt;li&gt;Use a Javascript function to process every lines inside the TTT tags
&lt;li&gt;Make the HTML to call this function in the &lt;b&gt;body&lt;/b&gt; tag &lt;b&gt;onload&lt;/b&gt; attribute.&lt;/ol&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
The class XXX in the TTT tag is used for easy setup for CSS style sheet.  Using the above example, the blue line border and the alternate gray line background image are the CSS style sheet settings.
&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;Also, this class XXX can help as an identifier for the Javascript function to identify this special piece of information for processing.  When the browser load this HTML, the function will do the following:
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mystep"&gt;&lt;ol&gt;&lt;li&gt;Search all TTT  elements in the HTML with the class XXX.
&lt;li&gt;Start processing the innerHTML information of this element
&lt;li&gt;Firstly, add an order list tag &lt;b&gt;&amp;lt;ol&amp;gt;&lt;/b&gt; at the beginning with a class XXX.
&lt;li&gt;For each line, add a list item tag &lt;b&gt;&amp;lt;li&amp;gt;&lt;/b&gt; at the beginning of the line
&lt;li&gt;At last, close the order list using this tag &lt;b&gt;&amp;lt;/ol&amp;gt;&lt;/b&gt;
&lt;li&gt;Then, replace the innerHTML using this new piece of information.&lt;/ol&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;When the function is ready, call the function in the &lt;b&gt;onload&lt;/b&gt; attribute of the HTML &lt;b&gt;body&lt;/b&gt; tag.  Using this way, when the HTML is loaded by the browser, this function will be automatically called.  The function will scan the whole document to search for all TTT elements to add the order list processing for your source code snippets.
&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;When applying this method in blog post of blogspot, something additional has to be done :
&lt;ul&gt;
&lt;li&gt;Firstly, it will be more easy to put the Javascript function in an external Javascript js file in an outside server, rather than putting inline in the HTML blogspot settings.
&lt;/li&gt;
&lt;li&gt;When the &lt;b&gt;convert line breaks&lt;/b&gt; option is turn on, blogspot will replace the hard return with &amp;lt;br&amp;gt; in Firefox 3.0.6 (&amp;lt;BR&amp;gt; in IE6) in the source code snippet.  In other words, the source code snippet is no longer line-by-line as seen in the blogspot editor.  Instead, the original "lines" are separated by either &amp;lt;br&amp;gt or &amp;lt;BR&amp;gt; in the innerHTML.  The Javascript function has to take care of this during the processing.
&lt;/li&gt;
&lt;li&gt;When the &lt;b&gt;convert line breaks&lt;/b&gt; option is turn off in blogspot, no &amp;lt;BR&amp;gt; will be inserted.  Then, in IE6, there is not way to "identify" something to convert to &amp;lt;li&amp;gt;.  So, I have to disable using this method when detecting a IE browser.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/DIV&gt;
&lt;DIV class="paragraph"&gt;Using this method, the disadvantages are:
&lt;ol&gt;
&lt;li&gt;One disadvantage is about the browser.  As you may have noticed, if this page is read by Firefox 3.0.6, the alternate gray line background image does not match the source code text lines.  It is quite difficult to control the line height of the HTML order list tag using CSS under Firefox 3.0.6 (I am still looking into this issue).   But, when reading with IE6 or Google Chrome 1.0.154.53, there is no such problem.  Maybe this is a bug in Firefox.
&lt;/li&gt;
&lt;li&gt;Moreover, since the source code is inside the order list tag, it is quite difficult to cut-and-paste the source code in Firefox to Notepad or Writepad.  When paste to PSPad, the line number is also pasted.  However, if using Google Chrome 1.0.154.53, the line number is also &lt;b&gt;hightlighted&lt;/b&gt; during &lt;b&gt;copy&lt;/b&gt;.  But, there is no line number after paste.  The source code looks fine !
&lt;/li&gt;
&lt;li&gt;In addition, as tested on 2009-03-21, one serious drawback of this method under IE6 is that the indentation leading space are all gone in IE6. 
&lt;/li&gt;
&lt;li&gt;At last, as mention before, this method is disabled when detecting a IE browser because my blogspot has turn off the convert-line-breaks option starting 2009-03-22.  This is because I cannot detect a "lin" after turning off the convert-line-break option.
&lt;/li&gt;
&lt;/ol&gt;
&lt;/DIV&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-7157330362781375206?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/7157330362781375206/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=7157330362781375206' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/7157330362781375206'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/7157330362781375206'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/03/line-numbering-source-code-snippet-with.html' title='Line numbering source code snippet with Javascript function on body load'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-1123347003017427136</id><published>2009-03-20T21:06:00.036+08:00</published><updated>2009-03-22T13:24:06.943+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scripting language - Javascript'/><title type='text'>Line numbering source code snippet using Javascript for-loop hard coding</title><content type='html'>&lt;p&gt;Here is a quick-and-dirty method of adding line numbers to the source code snippet.
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top" align="right" style="border-top:2px solid blue;border-left:6px solid blue;border-bottom:2px solid blue"&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;var maxLine= 12 ; if (navigator.appName == "Microsoft Internet Explorer") maxLine= 12 ;for (var i= 1 ; i &lt;= maxLine ; ++i ) { document.writeln( i + ' :') ; }&lt;/script&gt;&lt;/pre&gt;&lt;/td&gt;&lt;td valign="top" bgcolor="cyan" style="padding-left:15px; border-top:2px solid blue;border-right:6px solid blue;border-bottom:2px solid blue"&gt;&lt;pre&gt;program Hello_World ;

begin

   writeln('Hello, World !');

   { This method of line numbering is not so smart.
     The line numbers on the left is generated
     using a Javascript for-loop with hard-coding the
     number of loops which is 12. }

end.&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;The method is very simple : use a HTML &lt;b&gt;table&lt;/b&gt; tag with only 1 row of 2 cells.  The right cell is the code snippet.  In the left cell, use Javascript to call a for-loop to document.writeln the line number.
&lt;/p&gt;
&lt;p&gt;The text inside both cells is inside a HTML &lt;b&gt;pre&lt;/b&gt; tag.  As long as they are of the same fonts and line heights, the line number will match the source code snippet.
&lt;/p&gt;
&lt;p&gt;Following coding snippet is contained inside a table of one cell :&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;div class="mycode"&gt;program Hello_World ;

begin

   writeln('Hello, World !');

   { This method of line numbering is not so smart.
     The line numbers on the left is generated
     using a Javascript for-loop with hard-coding the
     number of loops which is 12. }

end.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;Using the same method, the line numbers are added :&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top" align="right"&gt;&lt;div class="mycodeleft"&gt;&lt;script type="text/javascript"&gt;var maxLine= 12 ; if (navigator.appName == "Microsoft Internet Explorer") maxLine= 12 ; for (var i= 1 ; i &lt;= maxLine ; i++ ) { document.writeln(i); }&lt;/script&gt;&lt;/div&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mycode"&gt;program Hello_World ;

begin

   writeln('Hello, World !');

   { This method of line numbering is not so smart.
     The line numbers on the left is generated
     using a Javascript for-loop with hard-coding the
     number of loops which is 12. }

end.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;Now, the table consists of 2 cells in a row.  The left cell is for line numbers.
&lt;/p&gt;
&lt;p&gt;The disadvantages of this method are:&lt;ol&gt;
&lt;li&gt;One disadvantage of this method is that the number of loop is hard-coded.  You have count the total number of lines in your source code snippet and put this number in the for-loop.
&lt;li&gt;Another disadvantage is with the browser and blogspot.&lt;br&gt;If the convert-line-breaks option is turn on in blogspot and you are using Firefox to read this page, the above table should be very perfect.  The Pascal program &lt;b&gt;end&lt;/b&gt; statement is at the line-12.  But, if you are using IE6, the program &lt;b&gt;end&lt;/b&gt; statement is at line-8.  This is because the IE6 does not shown the blank lines from Blogger.  There should be each of one blank line in between the statements &lt;b&gt;program&lt;/b&gt;, &lt;b&gt;begin&lt;/b&gt;, &lt;b&gt;writeln&lt;/b&gt;, the block comment and the &lt;b&gt;end&lt;/b&gt; statements.  So, in order to take care of readers using IE6 and the convert-line-breaks is yes in blogspot, you have to count the number of blank lines and do a re-calculation on the final maximum number of lines for using in the for-loop.&lt;br&gt;However, it the convert-line-breaks is NO, there is no such problem.&lt;br&gt;Now, I have turn off the convert-line-breaks in my blog in blogsport and this page does not have this problem.
&lt;/ol&gt;
&lt;/p&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-1123347003017427136?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/1123347003017427136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=1123347003017427136' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/1123347003017427136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/1123347003017427136'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/03/line-numbering-source-code-snippet.html' title='Line numbering source code snippet using Javascript for-loop hard coding'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-4713834387850689091</id><published>2009-03-18T16:47:00.032+08:00</published><updated>2009-03-22T11:03:59.831+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Others'/><title type='text'>2 to the power</title><content type='html'>&lt;p&gt;Here is a table of 2 to the power :
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;div class="mycode"&gt;Power Of 2 Decimal Values
---------- ------------------------------------------------&lt;ol start="0"&gt;&lt;li&gt;                                1
&lt;/li&gt;&lt;li&gt;                                2  ← 1 bit to store 0 or 1
&lt;/li&gt;&lt;li&gt;                                4
&lt;/li&gt;&lt;li&gt;                                8  ← 3 bit octet
&lt;/li&gt;&lt;li&gt;               0x10            16  ← 4 bit, half-byte to store hexadecimal
&lt;/li&gt;&lt;li&gt;                               32
&lt;/li&gt;&lt;li&gt;                               64
&lt;/li&gt;&lt;li&gt;                              128  ← 7 bit for ASCII encoding
&lt;/li&gt;&lt;li&gt;              0x100           256  ← 1 byte = 8 bit, 0 - 255 ----------------
&lt;/li&gt;&lt;li&gt;                              512
&lt;/li&gt;&lt;li&gt;                            1,024  ← 1K (Kilo)
&lt;/li&gt;&lt;li&gt;                            2,048
&lt;/li&gt;&lt;li&gt;                            4,096
&lt;/li&gt;&lt;li&gt;                            8,192
&lt;/li&gt;&lt;li&gt;                           16,384
&lt;/li&gt;&lt;li&gt;                           32,768
&lt;/li&gt;&lt;li&gt;           0x10000         65,536  ← 2 byte, 64K, double-byte Unicode -------
&lt;/li&gt;&lt;li&gt;                          131,072
&lt;/li&gt;&lt;li&gt;                          262,144
&lt;/li&gt;&lt;li&gt;                          524,288
&lt;/li&gt;&lt;li&gt;                        1,048,576  ← 1M (Mega), more than 1 million
&lt;/li&gt;&lt;li&gt;                        2,097,152
&lt;/li&gt;&lt;li&gt;                        4,194,304
&lt;/li&gt;&lt;li&gt;                        8,388,608  ← 8M, 23 bit mantissa for float in IEEE754
&lt;/li&gt;&lt;li&gt;      0x1000000        16,777,216  ← 3 byte, 24 bit, 16M color --------------
&lt;/li&gt;&lt;li&gt;                       33,554,432
&lt;/li&gt;&lt;li&gt;                       67,108,864  ←  64M
&lt;/li&gt;&lt;li&gt;                      134,217,728  ← 128M
&lt;/li&gt;&lt;li&gt;                      268,435,456  ← 256M
&lt;/li&gt;&lt;li&gt;                      536,870,912  ← 512M
&lt;/li&gt;&lt;li&gt;                    1,073,741,824  ← 1G (Giga)
&lt;/li&gt;&lt;li&gt;                    2,147,483,648
&lt;/li&gt;&lt;li&gt;    0x100000000     4,294,967,296  ← 4 byte ---------------------------------
&lt;/li&gt;&lt;li&gt;                    8,589,934,592  ← 8G
&lt;/li&gt;&lt;li&gt;                   17,179,869,184
&lt;/li&gt;&lt;li&gt;                   34,359,738,368
&lt;/li&gt;&lt;li&gt;                   68,719,476,736
&lt;/li&gt;&lt;li&gt;                  137,438,953,472
&lt;/li&gt;&lt;li&gt;                  274,877,906,944
&lt;/li&gt;&lt;li&gt;                  549,755,813,888
&lt;/li&gt;&lt;li&gt;                1,099,511,627,776  ← 5 byte, 1T (Tera) ----------------------
&lt;/li&gt;&lt;li&gt;                2,199,023,255,552
&lt;/li&gt;&lt;li&gt;                4,398,046,511,104
&lt;/li&gt;&lt;li&gt;                8,796,093,022,208
&lt;/li&gt;&lt;li&gt;               17,592,186,044,416
&lt;/li&gt;&lt;li&gt;               35,184,372,088,832
&lt;/li&gt;&lt;li&gt;               70,368,744,177,664
&lt;/li&gt;&lt;li&gt;              140,737,488,355,328
&lt;/li&gt;&lt;li&gt;              281,474,976,710,656  ← 6 byte ---------------------------------
&lt;/li&gt;&lt;li&gt;              562,949,953,421,312
&lt;/li&gt;&lt;li&gt;            1,125,899,906,842,624  ← 1P (Peta)
&lt;/li&gt;&lt;li&gt;            2,251,799,813,685,248
&lt;/li&gt;&lt;li&gt;            4,503,599,627,370,496  ← 52 bit mantissa for double in IEEE754
&lt;/li&gt;&lt;li&gt;            9,007,199,254,740,992
&lt;/li&gt;&lt;li&gt;           18,014,398,509,481,984  ← stepping into 17 digits
&lt;/li&gt;&lt;li&gt;           36,028,797,018,963,968
&lt;/li&gt;&lt;li&gt;           72,057,594,037,927,936  ← 7 byte ---------------------------------
&lt;/li&gt;&lt;li&gt;          144,115,188,075,855,872
&lt;/li&gt;&lt;li&gt;          288,230,376,151,711,744
&lt;/li&gt;&lt;li&gt;          576,460,752,303,423,488
&lt;/li&gt;&lt;li&gt;        1,152,921,504,606,846,976  ← 1E (Exa), stepping into 19 digits
&lt;/li&gt;&lt;li&gt;        2,305,843,009,213,693,952
&lt;/li&gt;&lt;li&gt;        4,611,686,018,427,387,904
&lt;/li&gt;&lt;li&gt;        9,223,372,036,854,775,808
&lt;/li&gt;&lt;li&gt;       18,446,744,073,709,551,616  ← 8 byte ---------------------------------
&lt;/li&gt;&lt;li&gt;       36,893,488,147,419,103,232
&lt;/li&gt;&lt;li&gt;       73,786,976,294,838,206,464
&lt;/li&gt;&lt;li&gt;      147,573,952,589,676,412,928  ← stepping into 21 digits
&lt;/li&gt;&lt;li&gt;      295,147,905,179,352,825,856
&lt;/li&gt;&lt;li&gt;      590,295,810,358,705,651,712
&lt;/li&gt;&lt;li&gt;    1,180,591,620,717,411,303,424  ← 1Z (Zetta) 
&lt;/li&gt;&lt;li&gt;    2,361,183,241,434,822,606,848
&lt;/li&gt;&lt;li&gt;    4,722,366,482,869,645,213,696  ← 9 byte ---------------------------------
&lt;/li&gt;&lt;li&gt;    9,444,732,965,739,290,427,392
&lt;/li&gt;&lt;li&gt;   18,889,465,931,478,580,854,784
&lt;/li&gt;&lt;li&gt;   37,778,931,862,957,161,709,568
&lt;/li&gt;&lt;li&gt;   75,557,863,725,914,323,419,136
&lt;/li&gt;&lt;li&gt;  151,115,727,451,828,646,838,272
&lt;/li&gt;&lt;li&gt;  302,231,454,903,657,293,676,544
&lt;/li&gt;&lt;li&gt;  604,462,909,807,314,587,353,088
&lt;/li&gt;&lt;li&gt;1,208,925,819,614,629,174,706,176  ← 10 byte , 1Y (Yotta) -------------------
&lt;/li&gt;&lt;li&gt;2,417,851,639,229,258,349,412,352&lt;/ol&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;hr color="crimson"&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-4713834387850689091?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/4713834387850689091/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=4713834387850689091' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/4713834387850689091'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/4713834387850689091'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/03/2-to-power.html' title='2 to the power'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-6908482345839391623</id><published>2009-02-03T15:19:00.006+08:00</published><updated>2009-03-22T11:04:36.181+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='BlackBerry'/><title type='text'>Always Keep LCD On in BlackBerry Simulator in Eclipse 3.4.1</title><content type='html'>&lt;p&gt;I used to program my BlackBerry project in Eclipse 3.1.4 with a 9530 simulator.  The LCD display of the simulator will dim out after a while.  This is very annoying.
&lt;/p&gt;
&lt;p&gt;Here is to config the simulator to always keep LCD on :&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mystep"&gt;&lt;ol&gt;&lt;li&gt;In the menu bar, click &lt;b&gt;Run&lt;/b&gt;
&lt;li&gt;Click &lt;b&gt;Run Configurations...&lt;/b&gt;
&lt;li&gt;Click the &lt;b&gt;Simulator&lt;/b&gt; tab sheet
&lt;li&gt;In &lt;b&gt;Profile:&lt;/b&gt;,click the &lt;b&gt;New&lt;/b&gt; button
&lt;li&gt;When prompt for &lt;b&gt;Enter profile name&lt;/b&gt;, for example, input &lt;b&gt;9530 English&lt;/b&gt;
&lt;li&gt;Then, click the &lt;b&gt;OK&lt;/b&gt; button.  Now, you can edit this profile.
&lt;li&gt;Click the &lt;b&gt;Advanced&lt;/b&gt; tab sheet
&lt;li&gt;In the text box under &lt;b&gt;Command Line:&lt;/b&gt;, there is a long command line string :
&lt;b&gt;... fledge.exe ... /app=Jvm.dll&lt;/b&gt;
Go to the end of this string, add one more option string :
&lt;b&gt; /keep-lcd-on&lt;/b&gt;
&lt;li&gt;Then, click the &lt;b&gt;Apply&lt;/b&gt; button
&lt;li&gt;Then, click the &lt;b&gt;Close&lt;/b&gt; button&lt;/ol&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;Then, the next time when you test run your project using the simulator, the LCD display will always on.  You can click the main menu View to double check.  The &lt;b&gt;Keep LCD On&lt;/b&gt; should be tick
&lt;/p&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-6908482345839391623?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/6908482345839391623/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=6908482345839391623' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/6908482345839391623'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/6908482345839391623'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2009/02/always-keep-lcd-on-in-blackberry.html' title='Always Keep LCD On in BlackBerry Simulator in Eclipse 3.4.1'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-1311758713961846834</id><published>2008-12-16T13:53:00.011+08:00</published><updated>2009-03-22T11:05:49.401+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scripting language - bat file'/><title type='text'>Mould / Copy A Directory Tree Structure in Windows</title><content type='html'>&lt;p&gt;In Windows, it is eay to copy / duplicate the entire directory tree by simply right click the mouse.  But, how to mould / copy only the directory tree structure ?  This batch file is the answer.
&lt;/p&gt;
&lt;p&gt;The following batch file named tree_mould.bat can mould / copy the directory tree structure without copying the files inside.  It can be used in the command line mode or inside the GUI explorer (by using the Send To).
&lt;/p&gt;
&lt;p&gt;The batch file will by default mould / copy the directory tree structure to a new directory name with the current date as suffix.  So, your PC has to pre-set the short date format as YYYY-MM-DD in order for this batch file proper functioning.
&lt;/p&gt;
&lt;p&gt;Here is the batch file tree_mould.bat
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top" align="right"&gt;&lt;div class="mycodeleft"&gt;&lt;script type="text/javascript"&gt;var i=0; for (i=110;i&lt;=1;i++) { document.write(i + "&lt;br /&gt;"); }&lt;/script&gt;&lt;/div&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mycode"&gt;@echo off
:: ------------------------------------------------------
:: Licence Information:
:: --------------------
:: This coding is offered at no charge for 
:: NON-COMMERCIAL PERSONAL USE only.
:: The coding is copyright.
:: Reproduction of this coding in whole or in part 
:: in any form without the express written permission 
:: of the author is strictly prohibited. 
:: ------------------------------------------------------
:: Disclaimer:
:: -----------
:: This coding is distributed "as is" and is UNSUPPORTED.
:: NO WARRANTY of any kind is expressed or implied.
:: You use AT YOUR OWN RISK.
:: The author will not be liable for any data loss,
:: damages, and loss of profits or any other kind of
:: tangible or intangible loss while using or 
:: misusing this coding.
:: ------------------------------------------------------
:: Name    : tree_mould.bat
:: Purpose : Mould the directory tree using the xcopy command
::           with today as the suffix of the new tree
:: Platform: DOS, Win XP
:: Author  : Alvin SIU
:: Date    : 2007-12-16
:: ------------------------------------------------------
:: Attentions:
:: -----------
:: 1. It is highly recommended to set the SHORT date format
::    of your PC to be YYYY-MM-DD
:: 2. If your short date format uses slash (i.e. /) as 
::    separator, this batch file cannot function properly.
:: ------------------------------------------------------
:: Command Line Usage Example: 
::           tree_mould  A_Directory
:: This will mould the directory tree structure of 
:: A_Directory to A_Directory.d2007-12-16
:: provided that today is 2007-12-16 and the date /t command
:: in your PC will display 2007-12-16
:: ------------------------------------------------------
:: GUI Installation:
::   1. Put this file tree_mould.bat into any directory
::   2. Go to your Send To folder 
::   3. Create a shortcut tree_mould.bat to point to this file
:: GUI Usage Example:
::   1. Highlight any one directory, e.g. A_Directory
::   2. Right click mouse
::   3. Select Send To
::   4. Select the shortcut tree_mould.bat
::   This will mould the directory tree structure of 
::   A_Directory to A_Directory.d2007-12-16
::   provided that today is 2007-12-16 and the date command
::   in your PC will display 2007-12-16
:: ------------------------------------------------------

set TMP_TREE_MOULD_NEW_DIR=%1.d%DATE%

echo tree_mould 
echo from tree : %1 
echo to   tree : %TMP_TREE_MOULD_NEW_DIR%
echo.

if not exist %1 goto NOT_EXIST

if not exist %1\NUL goto NOT_DIR

if exist %TMP_TREE_MOULD_NEW_DIR% goto JUST_EXIST

mkdir %TMP_TREE_MOULD_NEW_DIR%
if errorlevel 1 goto MD_ERR

xcopy /f /t /e %1 %TMP_TREE_MOULD_NEW_DIR%
if errorlevel 1 goto XCOPY_ERR

echo OK, directory tree structure is moulded
goto QUITING

:NOT_EXIST
echo ERROR: There is no such directory %1
goto QUITING

:NOT_DIR
echo ERROR: The item %1
echo ERROR: is NOT a directory
goto QUITING

:JUST_EXIST
echo ERROR: Target directory %TMP_TREE_MOULD_NEW_DIR%
echo ERROR: already exist
goto QUITING

:MD_ERR
echo Error: Cannot Create NEW directory %TMP_TREE_MOULD_NEW_DIR%
goto QUITING

:XCOPY_ERR
echo ERROR: xcopy returns error
goto QUITING

:QUITING
set TMP_TREE_MOULD_NEW_DIR=
echo.
echo.
pause

:: ------------------------------------------------------
:: End Of File tree_mould.bat
:: ------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;The detail installation and usage instruction are at the beginning of the file.
&lt;/p&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-1311758713961846834?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/1311758713961846834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=1311758713961846834' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/1311758713961846834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/1311758713961846834'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/12/mould-copy-directory-tree-structure-in.html' title='Mould / Copy A Directory Tree Structure in Windows'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-4395771043023000321</id><published>2008-12-05T12:21:00.021+08:00</published><updated>2009-03-22T11:09:53.227+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Others'/><title type='text'>What are the Date(s) in a Computer System ?</title><content type='html'>&lt;p&gt;The term [&amp;nbsp;Date&amp;nbsp;] seems to be very simple.  Every morning when you wake up, it is a new day with a new date.  However, in a computer system, there are many different dates.  Here is a brief description of some of the [&amp;nbsp;dates&amp;nbsp;].
&lt;/p&gt;
&lt;h3&gt;1. Calendar Date&lt;/h3&gt;
&lt;p&gt;This is the date related to human being.  It is the information got from the paper calendar or from you wrist watch.
&lt;/p&gt;
&lt;h3&gt;2. Business Date&lt;/h3&gt;
&lt;p&gt;This is also a term related to human being.  It refers to those date with business activities.
&lt;/p&gt;
&lt;p&gt;For many countries, it refers to Monday to Saturday, excluding public holidays.  For those 5-day work countries, it refers to Monday to Friday, excluding public holidays.
&lt;/p&gt;
&lt;p&gt;However, in Israel world, the normal business date is from Sunday to Thursday and Friday morning.  So, Sunday is a normal business date.
&lt;/p&gt;
&lt;h3&gt;3. Machine Date / OS Date&lt;/h3&gt;
&lt;p&gt;This is the date as reported by the operating system (OS) of your machine.  In unix or DOS system, this is the information displayed by the [&amp;nbsp;date&amp;nbsp;] command.  In the MVS mainframe, this is the information usually displayed on the top right part of the ISPF login panel.  In Windows, this is the information shown in the clock of the taskbar.
&lt;/p&gt;
&lt;p&gt;Basically, the file creation/modification/access time is marked with this machine date by the OS.
&lt;/p&gt;
&lt;p&gt;In unix, normal users are not allowed to change this machine date.  The [&amp;nbsp;date&amp;nbsp;] command can only display the machine date.  But, super users can use the [&amp;nbsp;date&amp;nbsp;] command to CHANGE the machine date.
&lt;/p&gt;
&lt;h3&gt;4. Job Order Date&lt;/h3&gt;
&lt;p&gt;This term applies for some job scheduler.  This is the time when the job scheduler to [&amp;nbsp;create&amp;nbsp;] a job according to the information in the job database.  One can refer it as the job born date.  Once a job is ordered out, it comes to this world and is WAITING for execution.
&lt;/p&gt;
&lt;p&gt;Noted that this job order date may NOT be the same as the job execution date.  Usually, a job is executed only when in-condition(s) is satisfied.  If there is delay, the job execution date may be 1, 2, 3 or more days after the job order date.  In other words, for example, job ordered on 1st of the month may NOT be run/executed on the 1st of the month.
&lt;/p&gt;
&lt;h3&gt;5. Job Execution Date&lt;/h3&gt;
&lt;p&gt;This is the time when the job starts execution.  This is the time when the job is kick-off. If the job creates a job log file once it is run, the file creation date will be the job execution date.
&lt;/p&gt;
&lt;h3&gt;6. System Date&lt;/h3&gt;
&lt;p&gt;The term [&amp;nbsp;System&amp;nbsp;Date&amp;nbsp;] is very ambiguous.  It can refer to many things. Some refer system date as the machine date.  Some refer this as the [&amp;nbsp;Today&amp;nbsp;] of the computer system/project.
&lt;/p&gt;
&lt;p&gt;When [&amp;nbsp;System&amp;nbsp;Date&amp;nbsp;] means the [&amp;nbsp;Today&amp;nbsp;] of the computer system/project, usually it will be stored in a file.  Then, all the program will read this file to get the [&amp;nbsp;Today&amp;nbsp;] value, rather than getting the machine date using API call to the OS.  Using this method, all programs will get the SAME date information even when some programs are run after midnight.  Also, this method is easy for project/program development and testing.  Programmers can put any date you like into the file for development and testing.  For example, when testing leap year behavior of your system/project, simply put a Feb 28th or Feb 29th into the file will do.
&lt;/p&gt;
&lt;p&gt;It is quite odd to use the machine date as the [&amp;nbsp;Today&amp;nbsp;] of a computer system/project.  When doing so, one has to make sure that all the jobs/programs in the system/project must be finished before midnight.  After midnight, it is tomorrow.
&lt;/p&gt;
&lt;h3&gt;7. Reporting Date&lt;/h3&gt;
&lt;p&gt;Again, [&amp;nbsp;Reporting&amp;nbsp;Date&amp;nbsp;] is ambiguous.  Some may refer it as the [&amp;nbsp;Today&amp;nbsp;] of the computer system/project.  Some will refer it as the as-of date of a report generated by the program.  Therefore, when using this term, please make sure what is the exact meaning of [&amp;nbsp;Reporting&amp;nbsp;Date&amp;nbsp;].
&lt;/p&gt;
&lt;p&gt;In some computer system/project design, the as-of date of a report is 1 day before the [&amp;nbsp;Today&amp;nbsp;] of the computer system/project.  This is because that computer system/project is designed to work on data of yesterday.  You can view the situation as running the computer system/project after midnight working on data of yesterday.
&lt;/p&gt;
&lt;p&gt;In some computer system/project design, the as-of date of a report will be the SAME as the [&amp;nbsp;Today&amp;nbsp;] of the computer system/project.  For example, after 17:00 everyday, all the business data are ready and the jobs of [&amp;nbsp;Today&amp;nbsp;] will start working on that data.  When the job is running slowly until after midnight to next morning, please ensure that the [&amp;nbsp;Today&amp;nbsp;] value will not be changed after midnight.
&lt;/p&gt;
&lt;h3&gt;8. Report Printing Date&lt;/h3&gt;
&lt;p&gt;This term is clear and non-ambiguous.  It simply refers to the time of printing the report.
&lt;/p&gt;
&lt;p&gt;When reading a report having the text [&amp;nbsp;Report&amp;nbsp;Date&amp;nbsp;:&amp;nbsp;XXXX-XX-XX&amp;nbsp;], please make sure what this ambiguous text is talking about.  Does it refer to the as-of date ? Or, the report printing date ?
&lt;/p&gt;
&lt;h3&gt;9. File Creation / Modification / Access Date&lt;/h3&gt;
&lt;p&gt;These 3 types of date information of a file sound simple.  For the modification / access date information, they refer to the time of last modified / access of the file.  The creation date refer to the time when the file is created.
&lt;/p&gt;
&lt;p&gt;But, remember that NOT all filesystems will store the file creation date.  Many unix inode filesystems does NOT store the file creation date information.
&lt;/p&gt;
&lt;p&gt;This is a widespread misconception about the [&amp;nbsp;-ctime&amp;nbsp;] option of the unix [&amp;nbsp;find&amp;nbsp;] command. Actually, the [&amp;nbsp;c&amp;nbsp;] does NOT stand for [&amp;nbsp;creation&amp;nbsp;].  The [&amp;nbsp;-ctime&amp;nbsp;] option shows the last time when the status of the inode is changed.  When you change the permission of the file or rename the file, the [&amp;nbsp;-ctime&amp;nbsp;] information is updated.  In other words, the [&amp;nbsp;c&amp;nbsp;] stands for the last [&amp;nbsp;changed&amp;nbsp;] time of the inode status of the file.  Only when you do not rename, change permission, ... etc on the file since its creation, the ctime can be treated as the file creation date.  But this case is really rare.
&lt;/p&gt;
&lt;p&gt;On the other hand, NTFS5 filesystem will store the file creation date time information.  When you copy an old file with a new name, the newly created file will have a modification date OLDER than the file creation date.
&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;After reading this article, next time when designing a computer system/project concerning the [&amp;nbsp;Date&amp;nbsp;], please make sure what [&amp;nbsp;Date&amp;nbsp;] is talking about.  Also, pay additional attention when dealing with the file creation date information.
&lt;/p&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-4395771043023000321?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/4395771043023000321/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=4395771043023000321' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/4395771043023000321'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/4395771043023000321'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/12/what-are-dates-in-computer-system.html' title='What are the Date(s) in a Computer System ?'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-8062721116243632114</id><published>2008-12-03T23:01:00.063+08:00</published><updated>2009-04-30T12:29:47.601+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming language - SAS'/><title type='text'>A Trap in SAS Macro Programming</title><content type='html'>&lt;p&gt;When using SAS macro, beginners will easily fall into this trap if they do not understand that SAS macro is somewhat just a &lt;b&gt;text substitution&lt;/b&gt;.
&lt;/p&gt;
&lt;div&gt;Look at this example.  There is a database of 10 persons created using this program :
&lt;table align="center"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top" align="right"&gt;&lt;div class="mycodeleft"&gt;&lt;script type="text/javascript"&gt;var i=0; for (i=1;i&lt;=17;i++) { document.write(i + "&lt;br /&gt;"); }&lt;/script&gt;&lt;/div&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mycode"&gt;option mprint source2 noovp ;

data person ;
     length name  $20. ;
     length sex   $1.  ;

     name= 'Angelina'  ; sex= 'F' ; output ;
     name= 'Babara'    ; sex= 'F' ; output ;
     name= 'Clara'     ; sex= 'F' ; output ;
     name= 'Diana'     ; sex= 'F' ; output ;
     name= 'Eva'       ; sex= 'F' ; output ;
     name= 'Frankie'   ; sex= 'M' ; output ;
     name= 'George'    ; sex= 'M' ; output ;
     name= 'Henry'     ; sex= 'M' ; output ;
     name= 'Ivan'      ; sex= 'M' ; output ;
     name= 'John'      ; sex= 'M' ; output ;
run;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;After execution, the table person contains these records:
&lt;table align="center"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;Obs    name        sex

  1    Angelina     F
  2    Babara       F
  3    Clara        F
  4    Diana        F
  5    Eva          F
  6    Frankie      M
  7    George       M
  8    Henry        M
  9    Ivan         M
 10    John         M
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;Then, three more fields (initial, wear_tie and wear_bra) are added to the table.  Records of male and female are with different initialization.  The initial is 'Mr.' for all males and 'Miss' for all females.  All male records will have wear_tie=Y and wear_bra=N whereas all female records are just the opposite (i.e.  wear_tie=N and wear_bra=Y).
&lt;/p&gt;
&lt;div&gt;For the first thought, here is the program using macro for the initialization :
&lt;table align="center"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top" align="right"&gt;&lt;div class="mycodeleft"&gt;&lt;script type="text/javascript"&gt;var i=0; for (i=1;i&lt;=24;i++) { document.write(i + "&lt;br /&gt;"); }&lt;/script&gt;&lt;/div&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mycode"&gt;%macro init_male ;
       initial=  'Mr.' ;
       &lt;span style="color:red"&gt;wear_tie= 'Y'   ;
       wear_bra= 'N'   ;&lt;/span&gt;
%mend;

%macro init_female ;
       initial=  'Miss' ;
       &lt;span style="color:green"&gt;wear_tie= 'N'    ;
       wear_bra= 'Y'    ;&lt;/span&gt;
%mend;

data person_1 ;
     set person ;
     length initial  $4. 
            wear_tie $1.
            wear_bra $1.     
            ;
     if sex = 'M' then %init_male   ;
     if sex = 'F' then %init_female ;
run;

proc print data=person_1 ;
quit;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;The program design seems very straight forward.  The macro init_male is for male record initialization and the macro init_female is for all female record initialization.
&lt;/p&gt;
&lt;div&gt;But, the outcome is not what we expected.  Here is the output table person_1 :
&lt;table align="center"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;Obs    name        sex    initial   wear_tie   wear_bra

  1    Angelina     F      Miss        N          Y
  2    Babara       F      Miss        N          Y
  3    Clara        F      Miss        N          Y
  4    Diana        F      Miss        N          Y
  5    Eva          F      Miss        N          Y
  6    Frankie      M      Mr.         &lt;span style="color:orange"&gt;N          Y&lt;/span&gt;
  7    George       M      Mr.         &lt;span style="color:orange"&gt;N          Y&lt;/span&gt;
  8    Henry        M      Mr.         &lt;span style="color:orange"&gt;N          Y&lt;/span&gt;
  9    Ivan         M      Mr.         &lt;span style="color:orange"&gt;N          Y&lt;/span&gt;
 10    John         M      Mr.         &lt;span style="color:orange"&gt;N          Y&lt;/span&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
The fields wear_tie and wear_bra are initialized incorrectly for all male records.  The male records should have wear_tie=Y and wear_bra=N, but they are not.
&lt;/div&gt;

&lt;div&gt;How about re-arranging the 2 macro lines like this:
&lt;table align="center"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top" align="right"&gt;&lt;div class="mycodeleft"&gt;&lt;script type="text/javascript"&gt;var i=0; for (i=1;i&lt;=12;i++) { document.write(i + "&lt;br /&gt;"); }&lt;/script&gt;&lt;/div&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mycode"&gt;data person_2 ;
     set person ;
     length initial  $4. 
            wear_tie $1.
            wear_bra $1.     
            ;
     &lt;b&gt;if sex = 'F' then %init_female ;&lt;/b&gt;
     &lt;b&gt;if sex = 'M' then %init_male   ;&lt;/b&gt;
run;

proc print data=person_2 ;
quit;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;Now, the output table person_2 looks:
&lt;table align="center"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;Obs    name        sex    initial   wear_tie   wear_bra

  1    Angelina     F      Miss        &lt;span style="color:limegreen"&gt;Y          N&lt;/span&gt;
  2    Babara       F      Miss        &lt;span style="color:limegreen"&gt;Y          N&lt;/span&gt;
  3    Clara        F      Miss        &lt;span style="color:limegreen"&gt;Y          N&lt;/span&gt;
  4    Diana        F      Miss        &lt;span style="color:limegreen"&gt;Y          N&lt;/span&gt;
  5    Eva          F      Miss        &lt;span style="color:limegreen"&gt;Y          N&lt;/span&gt;
  6    Frankie      M      Mr.         Y          N
  7    George       M      Mr.         Y          N
  8    Henry        M      Mr.         Y          N
  9    Ivan         M      Mr.         Y          N
 10    John         M      Mr.         Y          N
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
This time, the result is wrong for all female records.
&lt;/div&gt;
&lt;br /&gt;
&lt;div&gt;Actually, both programs have fall into the trap of SAS macro.  The correct program should be written like this :
&lt;table align="center"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top" align="right"&gt;&lt;div class="mycodeleft"&gt;&lt;script type="text/javascript"&gt;var i=0; for (i=1;i&lt;=12;i++) { document.write(i + "&lt;br /&gt;"); }&lt;/script&gt;&lt;/div&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mycode"&gt;data person_3 ;
     set person ;
     length initial    $4. 
            wear_tie $1.
            wear_bra   $1.     
            ;
     if sex = 'M' then do; %init_male   ; end;
     if sex = 'F' then do; %init_female ; end;
run;

proc print data=person_3 ;
quit;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;Then, the table person_3 will have these records :
&lt;table align="center"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;Obs    name        sex    initial   wear_tie   wear_bra

  1    Angelina     F      Miss        &lt;span style="color:green"&gt;N          Y&lt;/span&gt;
  2    Babara       F      Miss        &lt;span style="color:green"&gt;N          Y&lt;/span&gt;
  3    Clara        F      Miss        &lt;span style="color:green"&gt;N          Y&lt;/span&gt;
  4    Diana        F      Miss        &lt;span style="color:green"&gt;N          Y&lt;/span&gt;
  5    Eva          F      Miss        &lt;span style="color:green"&gt;N          Y&lt;/span&gt;
  6    Frankie      M      Mr.         &lt;span style="color:red"&gt;Y          N&lt;/span&gt;
  7    George       M      Mr.         &lt;span style="color:red"&gt;Y          N&lt;/span&gt;
  8    Henry        M      Mr.         &lt;span style="color:red"&gt;Y          N&lt;/span&gt;
  9    Ivan         M      Mr.         &lt;span style="color:red"&gt;Y          N&lt;/span&gt;
 10    John         M      Mr.         &lt;span style="color:red"&gt;Y          N&lt;/span&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
The output result is exactly what we want.
&lt;/div&gt;
&lt;p&gt;Then, actually what is wrong with the programs for person_1 and person_2 ?  This is due to SAS macro substitution.  SAS will actually [ substitute ] the macro statements into the program.  If you do not understand this [ substitution ] activity, you will fall into this trap.
&lt;/p&gt;
&lt;div&gt;So, for the program fragment for person_1 : 
&lt;table align="center"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top" align="right"&gt;&lt;div class="mycodeleft"&gt;&lt;script type="text/javascript"&gt;var i=0; for (i=1;i&lt;=9;i++) { document.write(i + "&lt;br /&gt;"); }&lt;/script&gt;&lt;/div&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mycode"&gt;data person_1 ;
     set person ;
     length initial  $4. 
            wear_tie $1.
            wear_bra $1.     
            ;
     if sex = 'M' then %init_male   ;
     if sex = 'F' then %init_female ;
run;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;
, after substitution, the program fragment will become :
&lt;table align="center"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top" align="left"&gt;&lt;div class="mycodeleft"&gt;&lt;script type="text/javascript"&gt;var i=0; for (i=1;i&lt;=7;i++) { document.write(i + "&lt;br /&gt;"); }&lt;/script&gt;7.1
7.2
8
8.1
8.2
9&lt;/div&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mycode"&gt;data person_1 ;
     set person ;
     length initial  $4. 
            wear_tie $1.
            wear_bra $1.     
            ;
     if sex = 'M' then initial= 'Mr.' ;
     wear_tie= 'Y' ;
     wear_bra= 'N' ;
     if sex = 'F' then initial= 'Miss' ;
     wear_tie= 'N' ;
     wear_bra= 'Y' ;
run;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;(I have re-indent the coding for easy reading.  The actual substitution text is quite difficult to read.)
&lt;/div&gt;
&lt;p&gt;As one can see, after substitution, only the [ initial ] field will work as what we expected.  The fields wear_tie and wear_bra will be set regardless of the sex field.  At the last 2 lines of the program, all the wear_tie will be N and wear_bra will be Y regardless of male or female record.  Thus, the person_1 will have this not-expected output.
&lt;/p&gt;
&lt;div&gt;However, when calling a macro inside a pair of do-end statements, these 2 lines of coding :
&lt;table align="center"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top" align="left"&gt;&lt;div class="mycodeleft"&gt;7
8&lt;/div&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mycode"&gt;if sex = 'M' then do; %init_male   ; end;
if sex = 'F' then do; %init_female ; end;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;, after substitution, will become :
&lt;table align="center"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top" align="left"&gt;&lt;div class="mycodeleft"&gt;7
7.1
7.2
7.3
7.4
8
8.1
8.2
8.3
8.4&lt;/div&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mycode"&gt;if sex = 'M' then do;
                    initial=  'Mr.' ;
                    wear_tie= 'Y'   ;
                    wear_bra= 'N'   ;
                  end;
if sex = 'F' then do;
                    initial=  'Miss' ;
                    wear_tie= 'N'    ;
                    wear_bra= 'Y'    ;
                  end; 
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;(Again, I have re-indent the coding for easy reading.)
&lt;/div&gt;
&lt;p&gt;This is what we expected.
&lt;/p&gt;
&lt;p&gt;To avoid falling into this trap, always remember that SAS macro can be treated as &lt;b&gt;text substitution&lt;/b&gt;.
&lt;/p&gt;
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mystep"&gt;&lt;font size="-1"&gt;&lt;p&gt;&lt;u&gt;Licence Information:&lt;/u&gt;
All coding in this article is offered at no charge for NON-COMMERCIAL PERSONAL USE only.
The coding is copyright.
Reproduction of this coding in whole or in part in any form without the express written permission of the author is strictly prohibited. 
&lt;/p&gt;
&lt;p&gt;&lt;u&gt;Disclaimer : &lt;/u&gt;
All coding in this article is distributed "as is" and is UNSUPPORTED.
NO WARRANTY of any kind is expressed or implied.
You use AT YOUR OWN RISK.
The author will not be liable for any data loss,damages, and loss of profits or any other kind of tangible or intangible loss while using or misusing this coding.&lt;/p&gt;&lt;/font&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;br /&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-8062721116243632114?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/8062721116243632114/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=8062721116243632114' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/8062721116243632114'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/8062721116243632114'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/12/trap-in-sas-macro-programming.html' title='A Trap in SAS Macro Programming'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-7784270534237242650</id><published>2008-11-29T17:57:00.060+08:00</published><updated>2009-03-22T11:24:29.395+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='software freeware webware'/><title type='text'>My Favorites</title><content type='html'>&lt;p&gt;Here is a list of my favorites:
&lt;table style="border-width:1px; border-style:solid; border-collapse:collapse; border-spacing:1pt "&gt;&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top"&gt;Favorite Ancient Civilization&lt;/td&gt;
&lt;td valign="top"&gt;:&lt;/td&gt;
&lt;td&gt;&lt;a href="http://usa.autodesk.com/adsk/servlet/index?siteID=123112&amp;id=7635018" target="_blank"&gt;M&lt;/a&gt;&lt;a href="http://en.wikipedia.org/wiki/Maya_civilization" target="_blank"&gt;aya&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" style="border-width:1px"&gt;Favorite Animals&lt;/td&gt;
&lt;td&gt;:&lt;/td&gt;
&lt;td&gt;&lt;a href="http://cobra-language.com" target="_blank"&gt;C&lt;/a&gt;&lt;a href="http://en.wikipedia.org/wiki/Cobra" target="_blank"&gt;obra&lt;/a&gt;
, &lt;a href="http://www.mozilla.com" target="_blank"&gt;F&lt;/a&gt;&lt;a href="http://en.wikipedia.org/wiki/Red_Panda" target="_blank"&gt;irefox&lt;/a&gt;
 &amp;amp; &lt;a href="http://www.pandasecurity.com" target="_blank"&gt;P&lt;/a&gt;&lt;a href="http://www.panda.org.cn" target="_blank"&gt;anda&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top"&gt;Favorite Astronomy&lt;/td&gt;&lt;td valign="top"&gt;:&lt;/td&gt;&lt;td&gt;&lt;a href="http://www.eclipse.org" target="_blank"&gt;E&lt;/a&gt;&lt;a href="http://en.wiktionary.org/wiki/eclipse" target="_blank"&gt;clipse&lt;/a&gt; &amp;amp; &lt;a href="http://www.sun.com" target="_blank"&gt;S&lt;/a&gt;&lt;a href="http://en.wiktionary.org/wiki/Sun" target="_blank"&gt;un&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;Favorite Drinks&lt;/td&gt;&lt;td&gt;:&lt;/td&gt;&lt;td&gt;&lt;a href="http://java.sun.com" target="_blank"&gt;J&lt;/a&gt;&lt;a href="http://en.wikipedia.org/wiki/Java_coffee" target="_blank"&gt;ava&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;Favorite Flights&lt;/td&gt;&lt;td&gt;:&lt;/td&gt;&lt;td&gt;&lt;a href="http://www.apache.org" target="_blank"&gt;A&lt;/a&gt;&lt;a href="http://en.wikipedia.org/wiki/AH-64_Apache" target="_blank"&gt;pache&lt;/a&gt; &amp;amp; &lt;a href="http://tomcat.apache.org" target="_blank"&gt;T&lt;/a&gt;&lt;a href="http://en.wikipedia.org/wiki/F-14_Tomcat" target="_blank"&gt;omcat&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;Favorite Fruits&lt;/td&gt;&lt;td&gt;:&lt;/td&gt;&lt;td&gt;Apple, Blackberry &amp;amp; &lt;a href="http://www.dooyoo.co.uk/telecommunications-services/orange-network/" target="_blank"&gt;O&lt;/a&gt;&lt;a href="http://en.wikipedia.org/wiki/Orange_(fruit)" target="_blank"&gt;range&lt;/a&gt;&lt;/td&gt;&lt;tr&gt;&lt;td valign="top"&gt;Favorite Girl&lt;/td&gt;&lt;td valign="top"&gt;:&lt;/td&gt;&lt;td&gt;&lt;a href="http://www.ruby-lang.org" target="_blank"&gt;R&lt;/a&gt;&lt;a href="http://en.wikipedia.org/wiki/Ruby_(given_name)" target="_blank"&gt;uby&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;Favorite Heroine&lt;/td&gt;&lt;td valign="top"&gt;:&lt;/td&gt;&lt;td&gt;&lt;a href="http://www.oracle.com" target="_blank"&gt;O&lt;/a&gt;&lt;a href="http://www.darkknight.ca/heroes/oracle.html" target="_blank"&gt;racle&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;Favorite Legends / Mythology&lt;/td&gt;&lt;td valign="top"&gt;:&lt;/td&gt;&lt;td&gt;&lt;table&gt;&lt;tr&gt;&lt;td valign="top"&gt;(Greek)&lt;td&gt;&lt;a href="http://en.wikipedia.org/wiki/Kerberos_(protocol)" target="_blank"&gt;K&lt;/a&gt;&lt;a href="http://www.theoi.com/Ther/KuonKerberos.html" target="_blank"&gt;erberos&lt;/a&gt;, &lt;a href="http://www.oracle.com" target="_blank"&gt;O&lt;/a&gt;&lt;a href="http://ehistory.osu.edu/world/articles/ArticleView.cfm?AID=8" target="_blank"&gt;racle of &lt;/a&gt;&lt;a href="http://www.codegear.com/products/delphi/win32" target="_blank"&gt;D&lt;/a&gt;elphi, &lt;a href="http://docs.python.org/tutorial" target="_blank"&gt;P&lt;/a&gt;&lt;a href="http://www.theoi.com/Ther/DrakainaPython.html" target="_blank"&gt;ython&lt;/a&gt; &amp;amp; &lt;a href="http://en.wikipedia.org/wiki/Trojan_horse_(computing)" target="_blank"&gt;T&lt;/a&gt;&lt;a href="http://www.stanford.edu/~plomio/history.html" target="_blank"&gt;rojan Horse&lt;/a&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;(Indian)&lt;/td&gt;&lt;td&gt;&lt;a href="http://www.mozilla.com/en-US/products/thunderbird" target="_blank"&gt;T&lt;/a&gt;&lt;a href="http://www.angelfire.com/realm/bodhisattva/tbird-northeast.html" target="_blank"&gt;hunderbird&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;(misc)&lt;/td&gt;&lt;td valign="top"&gt;&lt;a href="http://en.wikipedia.org/wiki/Daemon_(computer_software)" target="_blank"&gt;d&lt;/a&gt;&lt;a href="http://en.wikipedia.org/wiki/Daemon_(mythology)" target="_blank"&gt;aemon&lt;/a&gt;&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;Favorite Painter&lt;/td&gt;&lt;td valign="top"&gt;:&lt;/td&gt;&lt;td valign="top"&gt;&lt;a href="http://en.wikipedia.org/wiki/Michelangelo_(virus)" target="_blank"&gt;M&lt;/a&gt;&lt;a href="http://en.wikipedia.org/wiki/Michelangelo" target="_blank"&gt;ichelangelo&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;Favorite Professionals&lt;/td&gt;&lt;td valign="top"&gt;:&lt;/td&gt;&lt;td&gt;&lt;a href="http://www.open-std.org/jtc1/sc22/wg9/overview.htm" target="_blank"&gt;A&lt;/a&gt;&lt;a href="http://en.wikipedia.org/wiki/Ada_Lovelace" target="_blank"&gt;da&lt;/a&gt; &amp;amp; &lt;a href="http://www.learn-programming.za.net/programming_pascal_learn01.html" target="_blank"&gt;P&lt;/a&gt;&lt;a href="http://en.wikipedia.org/wiki/Blaise_Pascal" target="_blank"&gt;ascal&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;Favorite Snacks&lt;/td&gt;&lt;td valign="top"&gt;:&lt;/td&gt;&lt;td valign="top"&gt;cookies &amp;amp; hot dog&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;hr color="crimson"&gt;
&lt;!--
&lt;td&gt;(Egypt)&lt;/td&gt;&lt;td&gt;&lt;a href="http://www.egyptianmyths.net/isis.htm" target="_blank"&gt;ISIS&lt;/a&gt;&lt;/td&gt; 
--&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-7784270534237242650?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/7784270534237242650/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=7784270534237242650' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/7784270534237242650'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/7784270534237242650'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/11/my-favorites.html' title='My Favorites'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-4683614530741642937</id><published>2008-11-28T15:59:00.017+08:00</published><updated>2009-03-22T11:25:32.288+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scripting language - JScript'/><title type='text'>Display the Length of the Filename in Windows</title><content type='html'>&lt;p&gt;Sometimes if the file name is too long, some application will not work properly.  So, it is better to make the name short.  What is the length of the file name now ?
&lt;/p&gt;
&lt;p&gt;Instead of counting by fingers, I have written this JScript named &lt;b&gt;filename_length.js&lt;/b&gt; :
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top" align="right"&gt;&lt;div class="mycodeleft"&gt;&lt;script type="text/javascript"&gt;var i=0; for (i=132;i&lt;=1;i++) { document.write(i + "&lt;br /&gt;"); }&lt;/script&gt;&lt;/div&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mycode"&gt;// -------------------------------------------------------------
// Licence Information:
// --------------------
// This coding is offered at no charge for 
// NON-COMMERCIAL PERSONAL USE only.
// The coding is copyright.
// Reproduction of this coding in whole or in part 
// in any form without the express written permission 
// of the author is strictly prohibited. 
// -------------------------------------------------------------
// Disclaimer : 
// ------------
// This coding is distributed "as is" and is UNSUPPORTED.
// NO WARRANTY of any kind is expressed or implied.
// You use AT YOUR OWN RISK.
// The author will not be liable for any data loss,
// damages, and loss of profits or any other kind of
// tangible or intangible loss while using or 
// misusing this coding.
// -------------------------------------------------------------
// Purpose: Display the length of the filename(s)
//          as well as the length of the fullpath filename(s).
//          If there are multiple files,
//             the whole list of files will be displayed line by line
//             with the length of the fullpath filename inside brackets
//             And, at the end, the file(s) with the longest length
//             will be identified (except when all files are with same
//             length).
// Noted  : This script counts the number of characters in the name,
//          not the number of byte.  Double-byte character (e.g.
//          Chinese) is counted as 1 in the filename length.
//          For example, a filename with 4 Chinese characters will
//          give a length of 4 (even though the name occupies 8 bytes).
// Limitation: 1. The total number of files passed to this script
//                cannot be too large because this will trigger the 
//                error - arguments list is too long
//             2. When filename is with Unicode characters, some 
//                application cannot open it because the application
//                does not use Unicode-API.
//                This script also cannot display Unicode filename
//                correctly.  Instead, a Question Mark will be seen.
// Platform    : Windows XP
// Installation: 1. Put this script in the any folder you like
//               2. Go to the Send To folder
//               3. Create a shortcut to point to this script
// Usage     : Inside any folder,
//             1. Select one (or multiple) file
//             2. Right-Click
//             3. Select Send To
//             4. Select the shortcut of this script
//             The information will be dislayed in a pop up window.
//             After reading, click OK to quit.
// Author    : Alvin SIU
// Date      : 2007-11-28
//-------------------------------------------------------------

  var fso=  WScript.createObject("Scripting.FileSystemObject");
  var args= WScript.arguments;

//-------------------------------------------------------------
// Ensure at least 1 argument
//-------------------------------------------------------------
  if (args.length == 0) { 
    WScript.Echo('The script requires argument(s)'); 
    WScript.Quit()
  }

//-------------------------------------------------------------
// Main program
//-------------------------------------------------------------
  var dasFullpathFilename ;
  var dasFilename         ;
  var dasCount            ;
      dasCount= 0         ;
  var dasLongest          ;   
      dasLongest= 0       ;
  var dasLongestString    ;  // Store all filenames with longest length
      dasLongestString= '';
  var k                   ; 
  var dasString           ;
      dasString= ''       ;
  var dasString1          ;
  var shorter             ; // When all files are with same length,
      shorter= false      ; // both the longer and shorter flags
  var longer              ; // will be false.
      longer=  false      ;
  var dasCount            ;
      dasCount= 0         ;

  for ( k= 0 ; k &lt; args.length ; k++) {
    dasFullpathFilename= args(k) ; 
    dasFilename= fso.GetFileName(dasFullpathFilename);

    dasCount++ ;
    dasString1= '[' + dasCount + '.]     '
              + dasFilename.length + ' ( ' 
              + dasFullpathFilename.length + ' ) ' 
              + dasFilename + '\n';

    dasString+= dasString1 ; 

    if     (dasFilename.length &gt; dasLongest) {
              if (k &gt; 0) longer= true ; 
              dasLongest=       dasFilename.length ;
              dasLongestString= dasString1 ;
    }
    else if (dasFilename.length == dasLongest) {
              dasLongestString+= dasString1 ;
         }
    else shorter= true;
  }

  if (k &gt; 1) {
     if (shorter | longer) {
        WScript.Echo( dasString
                    + '\nThe Longest Filename is/are :\n'
                    + dasLongestString);
     }
     else {
            WScript.Echo( dasString );
          }
  }
  else {
         WScript.Echo( dasFilename.length + ' : ' 
                     + dasFilename+'\n'
                     + dasFullpathFilename.length + ' : ' 
                     + dasFullpathFilename);
       }

//-------------------------------------------------------------
// End Of Script
//-------------------------------------------------------------
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
The installation and usage instructions are at the beginning of the script flower comment.
&lt;/p&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-4683614530741642937?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/4683614530741642937/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=4683614530741642937' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/4683614530741642937'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/4683614530741642937'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/11/display-lengrh-of-filename-in-windows.html' title='Display the Length of the Filename in Windows'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-849342738463473536</id><published>2008-11-28T13:44:00.041+08:00</published><updated>2009-03-22T13:26:27.053+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CSS'/><title type='text'>Alternate Line Shading in Program Coding</title><content type='html'>&lt;p&gt;It is very simple to use alternate line shading in program coding like this :
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;program Hello_World;
begin;
  writeln('Hello World !');
  writeln('This is a demo for alternate line shading.');
end.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;&lt;table&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;img src="http://www.alvinsiu.com/picture_library/alternate_gray_line_12.jpg"&gt;&lt;/td&gt;
&lt;td&gt;The alternate line shading in the above example are simply implemented by repeating the image at the left.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
Of course, you have to adjust the height of the image to the line-height of the text.
&lt;/p&gt;
&lt;p&gt;This demo shows alternate line shading for 5 different shadings :
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode5"&gt;All animals are equal, but some animals are more equal than others. They are ... Administrators.
Better late than never.  Better never be late.
Curiosity killed the cat.  Who kill the Cat Woman ?
Do as I say, and not as I do. How about when you say 'I do' ?
Early bird catches the worm. Early programmer catches the bug.
Failure is the mother of success.  Program failure is a shit.
Garbage in, garbage out and garbage inside out.
Hello World ! Halloween !
I am serious. It was a joke.  I am just kidding.
Java, cookies together with the Sun : this is my breakfast.
Keep your mouth shut and your ear, eye, mind, source-code, ... open.
Life is just a bowl of cherries, and ... honeys.
Money($) is not everything, but no money makes you a nothing.
Nothing is impossible.  Impossible is nothing. Is nothing impossible ?
Orz
Practice makes perfect.  Illegal practice makes money.
Quality rather than quantity. But, man-day is a measure for quantity.
Rome was not built in one day, so did computer systems.
Simple is beautiful.  Simple mind is brilliant. Simphson is ...
There are 10 types of people in the world: Those who understand binary, and those who don't.
Universe in a nutshell.  C, C++, Java, Perl, SQL, Unix, ... also in a nutshell.
Vision without action is merely a dream. Action without vision just passes time.
Wonder is the beginning of wisdom. Wonder Woman is ... WoW !
XD :) XP (^o^) (^0^) (^O^) ... 囧囧
You jump, I jump !
Z notation is ...
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;&lt;table&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;img src="http://www.alvinsiu.com/picture_library/alternate_5_line_15.jpg"&gt;&lt;/td&gt;
&lt;td valign="top"&gt;The alternate line shading colors in the above example are implemented by repeating the image at the left.&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mystep"&gt;&lt;font size="-1"&gt;&lt;u&gt;Licence Information:&lt;/u&gt;&lt;br&gt;
All coding in this article is offered at no charge for NON-COMMERCIAL PERSONAL USE only.&lt;br&gt;
The coding is copyright.&lt;br&gt;
Reproduction of this coding in whole or in part in any form without the express written permission of the author is strictly prohibited.&lt;br&gt; 
&lt;br&gt;
&lt;u&gt;Disclaimer : &lt;/u&gt;&lt;br&gt;
All coding in this article is distributed "as is" and is UNSUPPORTED.&lt;br&gt;
NO WARRANTY of any kind is expressed or implied.&lt;br&gt;
You use AT YOUR OWN RISK.&lt;br&gt;
The author will not be liable for any data loss,damages, and loss of profits or any other kind of tangible or intangible loss while using or misusing this coding.&lt;/font&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-849342738463473536?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/849342738463473536/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=849342738463473536' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/849342738463473536'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/849342738463473536'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/11/alternate-lines-in-program-coding.html' title='Alternate Line Shading in Program Coding'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-370070654841147825</id><published>2008-11-27T12:08:00.013+08:00</published><updated>2009-08-03T14:30:28.231+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='software freeware webware'/><category scheme='http://www.blogger.com/atom/ns#' term='information security'/><title type='text'>Make Hong Kong Post as a Trusted CA in Firefox 3.0.4</title><content type='html'>&lt;p&gt;Every time when I login the &lt;a href="http://www.hkpl.gov.hk/cgi-bin/eplb.cgi" target="_blank"&gt;Renewal of Libarary Materials&lt;/a&gt; of &lt;a href="https://libcat.hkpl.gov.hk" target="_blank"&gt;Hong Kong Public Libraries&lt;/a&gt; and the &lt;b&gt;eTax&lt;/b&gt; of &lt;a href="http://www.ird.gov.hk/" target="_blank"&gt;Inland Revenue Department of Hong Kong&lt;/a&gt; to perform any taxation related activities, Firefox 3.0.4 will pop up to ask me to add the site as exception. So far I was asked 3 times because in each time I was re-directed to a different server , namely etax11, etax21 and etax22.  This is quite troublesome.
&lt;/p&gt;
&lt;p&gt;So, the best way is to add the Hong Kong Post as a trusted CA in Firfox.
&lt;/p&gt;
&lt;p&gt;To do so, the first step is to get the certificate of Hong Kong Post.
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mystep"&gt;&lt;ol&gt;&lt;li&gt;Go to this URL &lt;a href="https://secure1.info.gov.hk/ogcio/eng/caro/esub41.htm" target="_blank"&gt;Recognition of Certification Authorities and Certificates  &gt; Disclosure Records of Recognized Certification Authorities&lt;/a&gt;
&lt;li&gt;Download the certificate &lt;b&gt;Hongkong Post Root CA 1.cer&lt;/b&gt;.
&lt;/ol&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;Then, follows these steps
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mystep"&gt;&lt;ol&gt;&lt;li&gt;Go to Firefox 3.0.4
&lt;li&gt;In the main menu, click &lt;b&gt;&lt;u&gt;T&lt;/u&gt;ools&lt;/b&gt;
&lt;li&gt;Click &lt;b&gt;&lt;u&gt;O&lt;/u&gt;ptions&lt;/b&gt;
&lt;li&gt;Click &lt;b&gt;Advanced&lt;/b&gt;
&lt;li&gt;Click &lt;b&gt;Encryption&lt;/b&gt; tab
&lt;li&gt;Click &lt;b&gt;View Certificate&lt;u&gt;s&lt;/u&gt;&lt;/b&gt; button
&lt;li&gt;Click &lt;b&gt;Authorities&lt;/b&gt; tab
&lt;li&gt;Click &lt;b&gt;I&lt;u&gt;m&lt;/u&gt;port...&lt;/b&gt; button
&lt;li&gt;In the pop up window, locate the file &lt;b&gt;Hongkong Post Root CA 1.cer&lt;/b&gt;
&lt;li&gt;Click &lt;b&gt;&lt;u&gt;O&lt;/u&gt;pen&lt;/b&gt; button
&lt;li&gt;In the Downloading Certificate window, click &lt;b&gt;View&lt;/b&gt; button to examine the certificate
&lt;li&gt;Make sure the &lt;b&gt;Issued by&lt;/b&gt; is &lt;b&gt;Hongkong Post Root CA 1&lt;/b&gt;
&lt;li&gt;Make sure the &lt;b&gt;SHA1 Fingerprint&lt;/b&gt; is &lt;b&gt;D6:DA:A8:20:8D:09:D2:15:4D:24:B5:2F:CB:34:6E:B2:58:B2:8A:58&lt;/b&gt;
&lt;li&gt;Click &lt;b&gt;Close&lt;/b&gt; button to close the view
&lt;li&gt;Tick the check box &lt;b&gt;Trust this CA to identify web sites&lt;/b&gt;
&lt;li&gt;Click &lt;b&gt;OK&lt;/b&gt; button
&lt;li&gt;When back to the &lt;b&gt;Authorities&lt;/b&gt; tab, the &lt;b&gt;Hongkong Post&lt;/b&gt; entry should be appear in the &lt;b&gt;Certificate Name&lt;/b&gt; column.
&lt;li&gt;Click many &lt;b&gt;OK&lt;/b&gt; buttons to end and save the setting&lt;/ol&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;Now the Hongkong Post is one of the trusted CA in your Firefox.  When going to the sites having certificates issued by Hongkong Post, it will be trust and will not prompt for add exception in Firefox.
&lt;/p&gt;
&lt;p&gt;For example, when you go to Hong Kong Public Libraries for books renewal, the site will be trusted.  At the bottom right corner of the status bar, there is a site name &lt;b&gt;libcat.hkpl.gov.hk&lt;/b&gt; with a &lt;b&gt;lock&lt;/b&gt; button.  Double-click the &lt;b&gt;lock&lt;/b&gt; button and then the &lt;b&gt;&lt;u&gt;V&lt;/u&gt;iew Certificate&lt;/b&gt; button will see the certificate.
&lt;/p&gt;
&lt;p&gt;BTW, as at 2008-11-28, the eTax of Inland Revenue Departement of Hong Kong still cannot support the browser Firefox 3.  However, as at 2009-02-05, Firefox 3 can be used to login the eTax.
&lt;/p&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-370070654841147825?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/370070654841147825/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=370070654841147825' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/370070654841147825'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/370070654841147825'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/11/make-hong-kong-post-as-trusted-ca-in.html' title='Make Hong Kong Post as a Trusted CA in Firefox 3.0.4'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-5036745274865121169</id><published>2008-11-26T11:15:00.008+08:00</published><updated>2009-03-22T11:29:05.160+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='software freeware webware'/><title type='text'>Search Operators in Google</title><content type='html'>&lt;p&gt;Although we use Google everyday, do you really know about some advanced technique.
&lt;/p&gt;
&lt;p&gt;This URL &lt;a href="http://www.googleguide.com/basic_operator_summary.html" target="_blank"&gt;www.googleguide.com - Special Characters: Summary&lt;/a&gt; show some useful search operators (e.g. + - ~ OR | .. *) in Google search.
&lt;/p&gt;
&lt;p&gt;The URL also contains some other userful information of Google search.
&lt;/p&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-5036745274865121169?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/5036745274865121169/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=5036745274865121169' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/5036745274865121169'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/5036745274865121169'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/11/search-operators-in-google.html' title='Search Operators in Google'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-8078573246395359360</id><published>2008-11-25T11:22:00.007+08:00</published><updated>2009-03-22T11:29:36.172+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scripting language - JScript'/><title type='text'>Remove Square Brackets in Filename</title><content type='html'>&lt;p&gt;When you drag a file (e.g. index.htm) from the Temporary Internet Folder to a standard folder, the file is renamed with square brackets with a number inside (e.g. index[1].htm or index[2].htm).
&lt;/p&gt;
&lt;p&gt;The URL &lt;a href="http://www.icpug.org.uk/national/features/050423fe.htm"&gt;SCRIPTING REMOVE BRACKETS REVISITED&lt;/a&gt; has a JScript to remove this square brackets.  The steps are :
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mystep"&gt;&lt;ol&gt;&lt;li&gt;Put the JScript in the &lt;b&gt;SendTo&lt;/b&gt; directory
&lt;li&gt;Over the file (e.g. index[1].htm), &lt;b&gt;right click&lt;/b&gt;
&lt;li&gt;Select &lt;b&gt;Send To&lt;/b&gt;
&lt;li&gt;Select the &lt;b&gt;JScript&lt;/b&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;Then, the file will be renamed with square brackets removed.
&lt;/p&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-8078573246395359360?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/8078573246395359360/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=8078573246395359360' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/8078573246395359360'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/8078573246395359360'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/11/remove-square-brackets-in-filename.html' title='Remove Square Brackets in Filename'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-911930146061217217</id><published>2008-11-24T19:30:00.021+08:00</published><updated>2009-03-22T11:32:49.872+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='BlackBerry'/><title type='text'>Run the BlackBerry Localization Demo</title><content type='html'>&lt;p&gt;After numerous trials and errors and searching the net, I finally can partially run the Localization Demo of BlackBerry in Eclipse 3.4.1.
&lt;/p&gt;
&lt;p&gt;By default, the simulator's language is English.  So, the followings are the steps to call the application in English :
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mystep"&gt;&lt;ol&gt;&lt;li&gt;Go to the Simulator
&lt;li&gt;Press &lt;b&gt;Menu&lt;/b&gt; key
&lt;li&gt;Choose &lt;b&gt;Downloads&lt;/b&gt;
&lt;li&gt;Choose &lt;b&gt;Localization Demo&lt;/b&gt;
&lt;li&gt;In &lt;b&gt;Choose a Country:&lt;/b&gt;, the default is &lt;b&gt;United States&lt;/b&gt;.
Just let it be.
&lt;li&gt;Press the &lt;b&gt;Menu&lt;/b&gt; key
&lt;li&gt;Choose &lt;b&gt;View&lt;/b&gt;.
The information of USA is displayed on the screen.
&lt;li&gt;Press &lt;b&gt;Escape&lt;/b&gt; key to back to the &lt;b&gt;Choose a Country:&lt;/b&gt;
&lt;li&gt;Click the &lt;b&gt;United States&lt;/b&gt; to call the pop up menu
&lt;li&gt;Press &lt;b&gt;down arrow&lt;/b&gt; in the keyboard to go to &lt;b&gt;China&lt;/b&gt;
&lt;li&gt;Press &lt;b&gt;Enter&lt;/b&gt; key in the keyboard.
Now, the China information is display.
&lt;li&gt;Press &lt;b&gt;Escape&lt;/b&gt; key to back to the &lt;b&gt;Choose a Country:&lt;/b&gt;
&lt;li&gt;Click the &lt;b&gt;China&lt;/b&gt; to call the pop up menu
&lt;li&gt;Press &lt;b&gt;down arrow&lt;/b&gt; in the keyboard to go to &lt;b&gt;Germany&lt;/b&gt;
&lt;li&gt;Press &lt;b&gt;Enter&lt;/b&gt; key in the keyboard.
Now, the information of Germany is displayed.
&lt;li&gt;Press &lt;b&gt;Escape&lt;/b&gt; key to back to the &lt;b&gt;Choose a Country:&lt;/b&gt;
&lt;li&gt;Press &lt;b&gt;Escape&lt;/b&gt; key to quit the application&lt;/ol&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;To test the Demo in German, one have to add the German language into the simulator. For example, when using the simulator 9530, edit the 9530.xml to locate the line:
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;   &amp;lt;application&amp;gt;net.rim.blackberry.lang.en_GB&amp;lt;/application&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;Then, add the following line under it :
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;   &amp;lt;application&amp;gt;net.rim.blackberry.lang.de&amp;lt;/application&amp;gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;Afterwards, use the followings to test the application in German :
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mystep"&gt;&lt;ol&gt;&lt;li&gt;Go to the Simulator
&lt;li&gt;Press &lt;b&gt;Menu&lt;/b&gt; key
&lt;li&gt;Choose &lt;b&gt;Options&lt;/b&gt;
&lt;li&gt;Choose &lt;b&gt;Language&lt;/b&gt;
&lt;li&gt;In the &lt;b&gt;Language:&lt;/b&gt;, choose &lt;b&gt;Deutsche&lt;/b&gt;
&lt;li&gt;Press &lt;b&gt;Menu&lt;/b&gt; key
&lt;li&gt;Choose &lt;b&gt;Save&lt;/b&gt;.
Now everything is in German.  Hope that you know German :)
&lt;li&gt;Press &lt;b&gt;Escape&lt;/b&gt; key
&lt;li&gt;Choose &lt;b&gt;Downloads&lt;/b&gt;
&lt;li&gt;Choose &lt;b&gt;Sparchopti...&lt;/b&gt;
&lt;li&gt;In the screen, the default is &lt;b&gt;United States&lt;/b&gt;.
Just let it be.
&lt;li&gt;Press the &lt;b&gt;Menu&lt;/b&gt; key
&lt;li&gt;Choose &lt;b&gt;Anzeigen&lt;/b&gt; to view the information of USA in German language
&lt;li&gt;Press &lt;b&gt;Escape&lt;/b&gt; key to go back
&lt;li&gt;Click the &lt;b&gt;United States&lt;/b&gt; to call the pop up menu
&lt;li&gt;Press &lt;b&gt;down arrow&lt;/b&gt; in the keyboard to go to &lt;b&gt;China&lt;/b&gt;
&lt;li&gt;Press &lt;b&gt;Enter&lt;/b&gt; key in the keyboard.
Now, the China information is display in German
&lt;li&gt;Press &lt;b&gt;Escape&lt;/b&gt; key to go back
&lt;li&gt;Click the &lt;b&gt;China&lt;/b&gt; to call the pop up menu
&lt;li&gt;Press &lt;b&gt;down arrow&lt;/b&gt; in the keyboard to go to &lt;b&gt;Deutschland&lt;/b&gt;
&lt;li&gt;Press &lt;b&gt;Enter&lt;/b&gt; key in the keyboard.
Now, the information of Germany is display in German
&lt;li&gt;Press &lt;b&gt;Escape&lt;/b&gt; key to go back
&lt;li&gt;Press &lt;b&gt;Escape&lt;/b&gt; key to quit the application
&lt;li&gt;Now reset the phone to English. &amp;nbsp; Choose &lt;b&gt;Optionen&lt;/b&gt;
&lt;li&gt;Choose &lt;b&gt;Sprache&lt;/b&gt;
&lt;li&gt;In &lt;b&gt;Sprache:&lt;/b&gt;, click the &lt;b&gt;Deutsch&lt;/b&gt; to show the pop up menu
&lt;li&gt;Choose &lt;b&gt;English&lt;/b&gt;
&lt;li&gt;Press the &lt;b&gt;Menu&lt;/b&gt; key
&lt;li&gt;Choose &lt;b&gt;Speichem&lt;/b&gt; to save the setting.
Now, everything will resume to English&lt;/ol&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;For France, in the 9530.xml add the following lines under it :
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;   &amp;lt;application&amp;gt;net.rim.blackberry.lang.fr&amp;lt;/application&amp;gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;Then, follow the similar steps as German to test the application.
&lt;/p&gt;
&lt;p&gt;BTW, I have tried the followings language but seems that 9530 simulator does not support them :
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mystep"&gt;&lt;ul&gt;&lt;li&gt;Netherland (net.rim.blackberry.lang.en_NL)
&lt;li&gt;Traditional Chinese (net.rim.blackberry.lang.zh_TW)
&lt;li&gt;Simplied Chinese (net.rim.blackberry.lang.zh_CN)&lt;/ul&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;hr color="crimson"&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-911930146061217217?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/911930146061217217/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=911930146061217217' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/911930146061217217'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/911930146061217217'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/11/run-blackberry-localization-demo.html' title='Run the BlackBerry Localization Demo'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-1303668583188487607</id><published>2008-11-22T13:42:00.016+08:00</published><updated>2009-03-22T11:34:38.961+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='software freeware webware'/><title type='text'>Set Gmail as the default mail sending application in Firefox 3</title><content type='html'>&lt;p&gt;There are many web sites having the standard emailto: protocol for you to directly email to the web site owner.  For example, &lt;a href="mailto:alvin.siu@gmail.com?subject=Testing" target="_blank"&gt;you can click this hyperlink to email to me&lt;/a&gt;.  Traditionally, once you click this emailto link, it will call a pre-installed email software in your PC to open a email compose window for you to write and send email.  But nowadays, with Firefox 3 we can use webware instead of software to handle this email matter.  Firefox can use Gmail and Yahoo email to handle this mailto: protocol.
&lt;/p&gt;
&lt;p&gt;Here are the steps :
&lt;/p&gt;
&lt;h3&gt;1. Make sure the mailto handler is turn on&lt;/h3&gt;
&lt;p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mystep"&gt;&lt;ol&gt;&lt;li&gt;Open Firefox 3
&lt;li&gt;In the address bar, input &lt;b&gt;about:config&lt;/b&gt;
(If there is a friendly warning, simply accept it.)
&lt;li&gt;In the filter box, input &lt;b&gt;network.protocol-handler.external.mailto&lt;/b&gt;
&lt;li&gt;Make sure the value is &lt;b&gt;true&lt;/b&gt;.
If it is &lt;b&gt;false&lt;/b&gt;, double click it to toggle it to &lt;b&gt;true&lt;/b&gt;.
After setting it to true, the settings will be saved in the file
%ProgramFiles%\Mozilla Firefox\defaults\pref\filrefox.js&lt;/ol&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;h3&gt;2. Set Gmail as the default email application&lt;/h3&gt;
&lt;p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mystep"&gt;&lt;ol&gt;&lt;li&gt;In the Firefox main menu, click &lt;b&gt;Tools&lt;/b&gt;
&lt;li&gt;Click &lt;b&gt;Options&lt;/b&gt;
&lt;li&gt;Click the &lt;b&gt;Applications&lt;/b&gt; tab
&lt;li&gt;In the &lt;u&gt;S&lt;/u&gt;earch box, input &lt;b&gt;mailto&lt;/b&gt;
&lt;li&gt;In the Action drop down box, choose &lt;b&gt;Use Gmail&lt;/b&gt;
&lt;li&gt;Tick the check-box &lt;b&gt;Remember my choice for mailto links&lt;/b&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;Now, Firefox will call gmail to handle the mailto: link.
&lt;/p&gt;
&lt;p&gt;As a reminder, sometimes, the mailto: link may be inside a frame of the web page.  In this case, Firefox will switch to Gmail inside that frame.  If that frame is too small, you have to :&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mystep"&gt;&lt;ol&gt;&lt;li&gt;Right click the mouse button
&lt;li&gt;Click &lt;b&gt;T&lt;u&gt;h&lt;/u&gt;is frame&lt;/b&gt;
&lt;li&gt;Click &lt;b&gt;Open Frame in New &lt;u&gt;T&lt;/u&gt;ab&lt;/b&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
Then, the frame will be opened in a new tab for you to use Gmail to write and send email.
&lt;/p&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-1303668583188487607?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/1303668583188487607/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=1303668583188487607' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/1303668583188487607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/1303668583188487607'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/11/set-gmail-as-default-mail-sending.html' title='Set Gmail as the default mail sending application in Firefox 3'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-4754096602509572385</id><published>2008-11-21T22:45:00.006+08:00</published><updated>2009-03-22T11:35:26.748+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='software freeware webware'/><title type='text'>Gmail Themes</title><content type='html'>&lt;p&gt;Today when I open gmail, there is a highlight conerning gmail theme.  After reading my mails, I go to [ Settings &gt; Themes ] to have a look. When I try it out, it is great.
&lt;/p&gt;
&lt;p&gt;After trying some themes, finally I choose the Phantasea.  Its background is green and the theme is cool !
&lt;/p&gt;
&lt;p&gt;Together with color labels, this give a new look to my gmail.
&lt;/p&gt;
&lt;p&gt;For details of themes, please visit the official &lt;a href="http://gmailblog.blogspot.com/2008/11/spice-up-your-inbox-with-colors-and.html" target="_blank"&gt;Gmail blog&lt;/a&gt;.
&lt;/p&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-4754096602509572385?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/4754096602509572385/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=4754096602509572385' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/4754096602509572385'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/4754096602509572385'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/11/gmail-themes.html' title='Gmail Themes'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-7822926688316632265</id><published>2008-11-21T18:05:00.004+08:00</published><updated>2009-03-22T11:36:27.244+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='information security'/><title type='text'>The volume of junk mail dropped drastically in 2008-11</title><content type='html'>&lt;p&gt;After un-plug the servers of McColo Corp, the volume of junk email dropped drastically.
&lt;/p&gt;
&lt;p&gt;For details, please visit these URLs:
&lt;ol&gt;
&lt;li&gt;&lt;a href="http://www.washingtonpost.com/wp-dyn/content/article/2008/11/12/AR2008111200658.html" target="_blank"&gt;Host of Internet Spam Groups Is Cut Off&lt;/a&gt;
&lt;li&gt;&lt;a href="http://www.linuxtoday.com/security/2008111902735NWNT" target="_blank"&gt;Unplugging The World's Biggest Spam Host-- Temporarily&lt;/a&gt;
&lt;/ol&gt;
&lt;/p&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-7822926688316632265?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/7822926688316632265/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=7822926688316632265' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/7822926688316632265'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/7822926688316632265'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/11/volume-of-junk-mail-dropped-drastically.html' title='The volume of junk mail dropped drastically in 2008-11'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-3518655179561808660</id><published>2008-11-21T16:56:00.037+08:00</published><updated>2009-08-04T22:14:01.340+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='web server'/><category scheme='http://www.blogger.com/atom/ns#' term='networking'/><title type='text'>How do you know an internal web server is up or down ?</title><content type='html'>&lt;p&gt;Nowadays, setting up a web server for internal use in a company intranet is very common.  But, sometimes when your browser reports that you cannot connect to the main page of your web server, what can you do ?
&lt;/p&gt;
&lt;p&gt;Here is some simple diagnostic steps (assuming that the web server IP is 10.20.30.40) :
&lt;/p&gt;
&lt;h3&gt;1. Ensure that your PC can reach the web server machine&lt;/h3&gt;
&lt;p&gt;&lt;div&gt;Try to ping the machine using :
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td bgcolor="black"&gt;&lt;div class="myscreen"&gt;&lt;font color="white"&gt;ping  10.20.30.40


                                                 &lt;/font&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
If you cannot ping the machine, maybe the machine is not up or may be there is a firewall to block the access to the machine.
&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;If you can ping the machine, the machine is proved to be up and running and is connected to the network.
&lt;/p&gt;
&lt;h3&gt;2. telnet using port 80&lt;/h3&gt;
&lt;p&gt;&lt;div&gt;If you can ping the machine, the next step is to check whether you can visit the port 80 of the server machine. Type this command :
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td bgcolor="black"&gt;&lt;div class="myscreen"&gt;&lt;font color="white"&gt;telnet  10.20.30.40  80


                                                 &lt;/font&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;(Port-80 is the default web server listening port.  If your server uses another port number, just replace 80 with that port number.)
&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;&lt;div&gt;If the telnet command reports any connection error like :
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td bgcolor="black"&gt;&lt;div class="myscreen"&gt;&lt;font color="white"&gt;Connecting To 10.20.30.40...
Could not open connection to the host, on port 80
Connect failed                                   &lt;/font&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;, most probably the web server software is not up or there is a firewall blocking the port 80.
&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;&lt;div&gt;If you see the screen black out :
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td bgcolor="black"&gt;&lt;div class="myscreen"&gt;&lt;font color="white"&gt;


                                                 &lt;/font&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;, congratulation, the web server is probably up and running !
&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;&lt;div&gt;To double confirm, just type this command :&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td bgcolor="black"&gt;&lt;div class="myscreen"&gt;&lt;font color="white"&gt;get


                                                 &lt;/font&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;If you see something like &lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td bgcolor="black"&gt;&lt;div class="myscreen"&gt;&lt;font color="white"&gt;&amp;lt;html&amp;gt;   ..... .... .....
       ......  .....  ............. .... ....
Connection to host lost.                         &lt;/font&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;and then quit back to the command prompt, the web server is actually up and running. She try to send you a HTML pages.
&lt;/div&gt;&lt;/p&gt;
&lt;br /&gt;
&lt;h3&gt;3. Check your own PC&lt;/h3&gt;
&lt;p&gt;Steps 1 and 2 confirm that the web server is up and running. If your browser still cannot display the HTML page, the problem must be in the client side, i.e. your own PC.
&lt;/p&gt;
&lt;p&gt;Here are some suggested actions:&lt;ul&gt;&lt;li&gt;Check the personal firewall&lt;/li&gt;&lt;li&gt;Check the browser setting / options (e.g. check pop-up blocking)&lt;/li&gt;&lt;li&gt;If possible, try another browser&lt;/li&gt;&lt;li&gt;When Java related, look at Java console&lt;/li&gt;&lt;/ul&gt;
&lt;/p&gt;
&lt;p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mystep"&gt;&lt;font size="-1"&gt;&lt;u&gt;Disclaimer : &lt;/u&gt;&lt;br&gt;
All coding/commands in this article is distributed "as is" and is UNSUPPORTED.&lt;br&gt;
NO WARRANTY of any kind is expressed or implied.&lt;br&gt;
You use AT YOUR OWN RISK.&lt;br&gt;
The author will not be liable for any data loss,damages, and loss of profits or any other kind of tangible or intangible loss while using or misusing this coding/commands.&lt;/font&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;hr color="crimson"&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-3518655179561808660?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/3518655179561808660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=3518655179561808660' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/3518655179561808660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/3518655179561808660'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/11/how-do-you-know-internal-web-server-is.html' title='How do you know an internal web server is up or down ?'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-4697635817000068267</id><published>2008-11-21T15:58:00.013+08:00</published><updated>2009-04-09T19:09:28.962+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='programming language - SAS'/><title type='text'>Describe a SAS view</title><content type='html'>&lt;p&gt;For SAS  version 6.12 in unix, files with extension ssv01 are SAS views.  For SAS version 8 and 9, the file extension is changed to sas7bvew (this also apply for Windows).
&lt;/p&gt;
&lt;p&gt;In my previous company, there are at least 2 types of SAS views.  I will called one type as data step views, because the view is generated by a data step statement.  Another type is referred as SQL-view which is actually a SAS view on DB2 table generated using a [ proc sql ] statement.
&lt;/p&gt;
&lt;p&gt;Both types of SAS view will have the same file extension.  Therefore, by just looking at the file extension, you cannot know which type of view one is using.
&lt;/p&gt;
&lt;p&gt;Starting from SAS version 8 in AIX, the view generation source code is also included inside the sas7bvew file.  Therefore, you can [ describe ] the sas7bvew file to find out how the view is generated.
&lt;/p&gt;
&lt;p&gt;But, you have to use different programming statements to [ describe ] the 2 types of views.
&lt;/p&gt;
&lt;div&gt;For data step views, the coding is :&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;  data view=myLib.myView ;
       describe ;
  run;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;For SQL-view, the coding is :&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;  proc sql ;
       describe view myLib.myView ;
  quit;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;On looking at the myView.sas7bvew file, how do you know which one of the two codings to be used ?  This depends on whether there is some pre-defined file name naming standard in your company.  If there is such a standard, you can tell by the file name.  If not, simply use trial and error.
&lt;/p&gt;
&lt;p&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mystep"&gt;&lt;font size="-1"&gt;&lt;u&gt;Licence Information:&lt;/u&gt;&lt;br&gt;
All coding in this article is offered at no charge for NON-COMMERCIAL PERSONAL USE only.&lt;br&gt;
The coding is copyright.&lt;br&gt;
Reproduction of this coding in whole or in part in any form without the express written permission of the author is strictly prohibited.&lt;br&gt;
&lt;br&gt;
&lt;u&gt;Disclaimer : &lt;/u&gt;&lt;br&gt;
All coding in this article is distributed "as is" and is UNSUPPORTED.&lt;br&gt;
NO WARRANTY of any kind is expressed or implied.&lt;br&gt;
You use AT YOUR OWN RISK.&lt;br&gt;
The author will not be liable for any data loss,damages, and loss of profits or any other kind of tangible or intangible loss while using or misusing this coding.&lt;/font&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-4697635817000068267?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/4697635817000068267/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=4697635817000068267' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/4697635817000068267'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/4697635817000068267'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/11/describe-sas-view.html' title='Describe a SAS view'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-6780233623217586418</id><published>2008-11-19T10:00:00.010+08:00</published><updated>2009-03-22T11:47:05.478+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='software freeware webware'/><title type='text'>Convert Seconds to Hour-Minute-Second in Excel</title><content type='html'>&lt;p&gt;Sometimes when doing time related calculation, the final values are in second.
&lt;/p&gt;
&lt;p&gt;For example, downloading a 369,300 byte file with a speed of 100 byte/second, the time required is 3693 seconds. Then, what is the hour-minute-second of 3693 seconds ?
&lt;/p&gt;
&lt;p&gt;Using Excel, there is a formula called time(). Put this formula into a cell :
&lt;table bgcolor=#FFFFBB&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;=time(0,0,3693)
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;Then, format the cell with :
&lt;table bgcolor=#FFFFBB&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;hh:mm:ss
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;The cell will display 01:01:33 (i.e. 1 hour 1 minute and 33 seconds).
&lt;/p&gt;
&lt;hr color="crimson" /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-6780233623217586418?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/6780233623217586418/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=6780233623217586418' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/6780233623217586418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/6780233623217586418'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/11/convert-second-to-hour-minute-second-in.html' title='Convert Seconds to Hour-Minute-Second in Excel'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-2869354155274995307</id><published>2008-11-18T21:35:00.010+08:00</published><updated>2009-03-22T11:44:56.802+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><title type='text'>Smooth Font Look Better in Windows XP</title><content type='html'>&lt;p&gt;The font appearance in Windows XP for some LCD monitor under some resolution setting can be looked better by choosing the ClearType method to smooth the edge of fonts.
&lt;/p&gt;
&lt;p&gt;Here is the steps:&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mystep"&gt;&lt;ol&gt;&lt;li&gt;Click &lt;span style="font-weight: bold;"&gt;Start&lt;/span&gt;
&lt;/li&gt;&lt;li&gt;Click &lt;span style="font-weight: bold;"&gt;Settings&lt;/span&gt;
&lt;/li&gt;&lt;li&gt;Click &lt;span style="font-weight: bold;"&gt;Control Panel&lt;/span&gt;
&lt;/li&gt;&lt;li&gt;Double-click the &lt;span style="font-weight: bold;"&gt;Display &lt;/span&gt;icon
&lt;/li&gt;&lt;li&gt;Click the &lt;span style="font-weight: bold;"&gt;Appearance &lt;/span&gt;tab
&lt;/li&gt;&lt;li&gt;Click the &lt;span style="font-weight: bold;"&gt;Effects &lt;/span&gt;button
&lt;/li&gt;&lt;li&gt;Check the box : &lt;span style="font-weight: bold;"&gt;Use the below method to smooth edges of screen fonts&lt;/span&gt;
&lt;/li&gt;&lt;li&gt;Choose the &lt;span style="font-weight: bold;"&gt;ClearType &lt;/span&gt;method&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;hr color="crimson"&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-2869354155274995307?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/2869354155274995307/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=2869354155274995307' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/2869354155274995307'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/2869354155274995307'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/11/smooth-font-look-better-in-windows-xp.html' title='Smooth Font Look Better in Windows XP'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-9108833492946087399</id><published>2008-11-15T08:30:00.009+08:00</published><updated>2009-03-26T19:23:22.054+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='software freeware webware'/><title type='text'>Duplicate Tab in Firefox</title><content type='html'>&lt;p&gt;I have used Firefox for a long time.  Just wonder why there is no such thing as duplicating a tab.  This action is similar to Ctrl-N to duplicate a window.
&lt;/p&gt;
&lt;p&gt;With Firefox 3 (actually I am using 3.0.4 today), when you right-click on a tab, there is still no such feature.  However, there is really a duplicate tab functionality in Firefox 3.  All you have to do is to :&lt;ol&gt;&lt;li&gt;Hold the Ctrl key
&lt;li&gt;Drag the tab left or right.  While moving around, an arrow will appear when crossing the border of the tabs.
&lt;li&gt;Then, when you release the mouse button, the tab will be duplicated and inserted in that border.
&lt;li&gt;Now, the last thing to do is to un-hold the Ctrl key.
&lt;/ol&gt;
&lt;/p&gt;
&lt;p&gt;If you make the above steps in another sequence :&lt;ol&gt;&lt;li&gt;Hold Ctrl key
&lt;li&gt;Drag around
&lt;li&gt;Un-hold Ctrl key
&lt;li&gt;release mouse button&lt;/ol&gt;, this will &lt;b&gt;move&lt;/b&gt; the tab in Firfox 3.0.4.&lt;br&gt;
(&lt;b&gt;Noted that in Firefox 3.0.6, you can simply drag-and-drop the tab&lt;/b&gt; in order to move it.)
&lt;/p&gt;
&lt;p&gt;Now, my wonder is : why don't just make the whole thing more simple ? Maybe just right-click on the tab to pop-up a menu to choose [ duplicate tab ].  Then, simply duplicate the tab at the rightmost. This is far most user friendly than the existing Ctrl-key-drag method.
&lt;/p&gt;
&lt;hr color="crimson"&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-9108833492946087399?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/9108833492946087399/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=9108833492946087399' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/9108833492946087399'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/9108833492946087399'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/11/duplicate-tab-in-firefox.html' title='Duplicate Tab in Firefox'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-5618119691274767958</id><published>2008-11-14T17:47:00.008+08:00</published><updated>2009-03-22T11:55:10.202+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='software freeware webware'/><title type='text'>Some Firefox Plugins</title><content type='html'>&lt;p&gt;Today, I have to install the Firefox 3.0.3. Therefore, I have also to re-install those useful plugins.  Here are them:
&lt;/p&gt;
&lt;h3&gt;1. DowmThemAll 1.0.3&lt;/h3&gt;
&lt;p&gt;This plugin will add a menu in the Tool menu.
&lt;/p&gt;
&lt;p&gt;For first use, please remember to input the default file saving location.
&lt;/p&gt;
&lt;p&gt;Then, for any web page, simply choose [ dTa One Click! ] menu item from the [ Tools &gt; DownThemAll Tools ] menu, all the images, etc will be saved to the default file saving location.
&lt;/p&gt;
&lt;h3&gt;2. Linkification 1.3.5&lt;/h3&gt;
&lt;p&gt;Sometimes, some web page will display this string, e.g.
http://www.orbis.org , as normal text, not a hyper link.  You have to open a new tab, and then cut and paste the string into the address box.
&lt;/p&gt;
&lt;p&gt;This plug-in is very helpful.  You simply highlight the text, and then right-click.  A pop-up menu will be displayed and you can choose [ open selected link ] to open it.
&lt;/p&gt;
&lt;p&gt;I like to config this plug-in to open in a new tab.
&lt;/p&gt;
&lt;h3&gt;3. PlainOldFavorites 1.0.1&lt;/h3&gt;
&lt;p&gt;This plug-in allows you directly use the IE Favorites inside Firefox.  No need to do any import or export activities.
After installing this plug-in, you will see the [ Favorites ] menu item just next to the [ Bookmarks ] item in the menu bar.
&lt;/p&gt;
&lt;h3&gt;4. Dictionary Tooltip 1.3&lt;/h3&gt;
&lt;p&gt;This plug-in will search some predefined dictionary after you highlight a word.  So far, all are English-English dictionary.  You cannot config to use your prefer English-Chinese dictionary.
&lt;/p&gt;
&lt;p&gt;After installation, simply double-click a word will see a small icon (look like a book).  Put the mouse over the icon will pop-up a dictionary content.
&lt;/p&gt;
&lt;h3&gt;5. FastDic 0.2.7&lt;/h3&gt;
&lt;p&gt;This plug-in is helpful for using your own prefer dictionary.  For my case, I have try the Yahoo and sina dictionary.  They can give the meanings in Chinese.
&lt;/p&gt;
&lt;p&gt;This version 0.2.7 cannot be installed in Firefox 3.0.4
To make it happen, you have to follow this procedure (by outyarder on July 21, 2008 documented in the review comment section)
&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mystep"&gt;&lt;ol&gt;
&lt;li&gt;Go on the 'See All Versions' page
&lt;li&gt;Right click on the latest version, then 'Save Link As...'
&lt;li&gt;on your computer, open the saved .xpi file with WinRar or something similar
&lt;li&gt;extract the 'install.rdf' file from the archive and open it in Notepad
&lt;li&gt;change em:maxVersion 2.bla bla to 3.*
&lt;li&gt;replace the 'install.rdf' file in the archive with this modified version
&lt;li&gt;drag the modified .xpi on Firefox and install it
&lt;/ol&gt;
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;After installation, config the option to use Alt - Click.
&lt;/p&gt;
&lt;p&gt;In the URL box, input the URL for calling the dictionary.
For yahoo dictionary, input the following :
&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mystep"&gt;http://hk.dictionary.yahoo.com/search.html?s=$&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;For sina dictionary, input the following :
&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mystep"&gt;http://dictionary.sina.com.hk/p/word/$&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;At last, click OK to save.
&lt;/p&gt;
&lt;p&gt;Then, in any web page, you can press the Alt key and then click on any English word.  Then, a new window will be pop-up by the sina dictionary with the meaning.
&lt;/p&gt;
&lt;p&gt;The shortcoming is that you cannot work on words inside a hyperlink string because by default Alt-Click a hyperlink will auto-download the URL. (BTW, Ctrl-Click will auto open hyperlink in new tab and Shift-Click will open in new window.)
&lt;/p&gt;
&lt;h3&gt;6. OpenBook 2.0.1.1.&lt;/h3&gt;
&lt;p&gt;This add-on can allow you to resize the box when you bookmark this page.  Also, it can show the bookmark tree immediately when you bookmark this page.
&lt;/p&gt;
&lt;hr color="crimson"&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-5618119691274767958?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/5618119691274767958/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=5618119691274767958' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/5618119691274767958'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/5618119691274767958'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/11/some-firefix-plugins.html' title='Some Firefox Plugins'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-4672109463100458811</id><published>2008-11-13T18:29:00.014+08:00</published><updated>2009-03-22T11:58:21.614+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mainframe CLIST'/><title type='text'>Run my utility CLIST in SYSPROC library</title><content type='html'>&lt;p&gt;In unix, I would like to put my helpful utilities inside a directory [ util ] under my $HOME.  Then, I will put this directory as the first directory in the searching path like this:
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;export PATH=/home/alvin/util:$PATH
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;Putting this statement at in the .profile file, I can use my utilities every time when I login my korn shell.
&lt;/p&gt;
&lt;p&gt;In mainframe MVS, there is something similar.
&lt;/p&gt;
&lt;p&gt;Actually, every time when you logon the TSO ISPF session, there is a SYSPROC library allocated to your session.  This SYSPROC is similar to the PATH variable in unix. This SYSPROC contains a list of partition datasets.  Members inside these partition datasets are those command, CLIST or REXX which you can execute in the TSO session.
&lt;/p&gt;
&lt;p&gt;Usually, I will put my useful REXX or CLIST (e.g. QDEL as mentioned in my other post) inside a partition dataset named, e.g. ALVIN.MISC.CLISTLIB.
&lt;/p&gt;
&lt;p&gt;Some sites allow you to customize your login procedure.  Then, I can allocate this ALVIN.MISC.CLISTLIB as the first dataset in SYSPROC.
&lt;/p&gt;
&lt;p&gt;However, some sites do not provide this customization.  In this case, once you have successfully login the ISPF panel, you can run the following command :
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;div class="mycode"&gt;CONCAT SYSPROC 'ALVIN.MISC.CLISTLIB' FIRST
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;This command will make ALVIN.MISC.CLISTLIB to be the first dataset in the SYSPROC library, just like putting /home/alvin/util as the first directory in the PATH in unix.  
&lt;/p&gt;
&lt;p&gt;Noted that, if you omit the word [ FIRST ], the dataset ALVIN.MISC.CLISTLIB will be concat at the end of the datasets list in SYSPROC.
&lt;/p&gt;
&lt;p&gt;Comparing the two scenarios, SYSPROC corresponds to the PATH variable.  Each allocated PDS datasets corresponds to the directories in the PATH.  The PDS dataset members correspond to the files in the directories.
&lt;/p&gt;
&lt;hr color="crimson"&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-4672109463100458811?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/4672109463100458811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=4672109463100458811' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/4672109463100458811'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/4672109463100458811'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/11/run-my-utilitiies-clist-in-sysproc.html' title='Run my utility CLIST in SYSPROC library'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-5825700179566270948</id><published>2008-11-11T19:52:00.006+08:00</published><updated>2009-03-22T12:00:26.056+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CSS'/><title type='text'>Display code snippets on the blog</title><content type='html'>&lt;p&gt;Today when I display the CLIST on my blog, I find out that all the formatting are gone.
&lt;/p&gt;
&lt;p&gt;Searching the internet, the following article is found to be useful for displaying code snippets on the blog.
&lt;br&gt;
&lt;a href="http://bguide.blogspot.com/2008/02/howto-add-custom-css-class-to-blogger.html" target="_blank"&gt;http://bguide.blogspot.com/2008/02/howto-add-custom-css-class-to-blogger.html&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;Following the method documented in the article, I setup a CSS class named mycode.  Then, the CLIST code snippets can be displayed in good format.
&lt;/p&gt;
&lt;hr color="crimson"&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-5825700179566270948?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/5825700179566270948/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=5825700179566270948' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/5825700179566270948'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/5825700179566270948'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/11/display-code-snippets-on-blog.html' title='Display code snippets on the blog'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-1304717359595090422</id><published>2008-11-11T11:58:00.069+08:00</published><updated>2009-04-09T19:17:30.467+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mainframe CLIST'/><title type='text'>Use CLIST to submit JCL to batch delete dataset</title><content type='html'>&lt;p&gt;In mainframe MVS ISPF option 3.4 panel, one can easily delete a dataset.  However, if the dataset is already migrated to tape, such a deletion will hold up your session until the dataset is recovered from taped.
&lt;/p&gt;
&lt;p&gt;To avoid this, I have written a CLIST (called QDEL) to submit batch job JCL to do the deletion.  Using batch job, there is no need to wait for those migrated dataaset.
&lt;/p&gt;
&lt;p&gt;Also, tranditonally, one cannot delete tape dataset in the foreground ISPF 3.4.  But, since QDEL will submit a JCL, it can delete tape dataset.
&lt;/p&gt;
&lt;p&gt;But looking at the coding, it can also delete alias.  Sorry that I cannot remember what exactly it is because the CLIST is written more than 10 years ago and I am now no longer working in mainframe platform.
&lt;/p&gt;
&lt;p&gt;As far as I remember, using this QDEL, I can delete many datasets in the background using batch JCL.  I do not need to care whether the dataset is a tape or not, or whether it is migrated, ... etc.
&lt;/p&gt;
&lt;p&gt;QDEL is one of my favorite utilities.  I usually put it as a member of a CLISTLIB which is usually the first allocated dataset of SYSPROC.
&lt;/p&gt;
&lt;p&gt;Here is the CLIST QDEL :
&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="top" align="right"&gt;&lt;div class="mycodeleft"&gt;&lt;script type="text/javascript"&gt;var i=0; for (i=242;i&lt;=1;i++) { document.write(i + "&lt;br /&gt;"); }&lt;/script&gt;&lt;/div&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;div class="mycode"&gt;PROC 1 INDD DEBUG DELETE GDG(N) GEN() CLASS(H) USER()
CONTROL NOFLUSH NOMSG
IF &amp;amp;DEBUG = DEBUG THEN CONTROL MSG LIST NOFLUSH CONLIST SYMLIST
/* ******************************************************************
/* Licence Information:
/* --------------------
/* This coding is offered at no charge for 
/* NON-COMMERCIAL PERSONAL USE only.
/* The coding is copyright.
/* Reproduction of this coding in whole or in part 
/* in any form without the express written permission 
/* of the author is strictly prohibited. 
/* ******************************************************************
/* Disclaimer : 
/* ------------
/* This coding is distributed "as is" and is UNSUPPORTED.
/* NO WARRANTY of any kind is expressed or implied.
/* You use AT YOUR OWN RISK.
/* The author will not be liable for any data loss,
/* damages, and loss of profits or any other kind of
/* tangible or intangible loss while using or 
/* misusing this coding.
/* ******************************************************************
/* NAME   : QDEL
/* PURPOSE: BATCH DELETE DSN
/* AUTHOR : ALVIN SIU
/* *******************************************************************
/* MDIFICATIONS:
/* -------------
/* 1. ADD FUNCTION TO DELETE ALIAS
/* 2. ADD DOUBLE CONFIRMATION "DELETE"
/* 3. FIX SMALL BUG ON ALIAS CHECKING
/* 4. ADD ENVIRONMENT SAVE/RESTORE AND QUITING
/*    IN ORDER TO HANDLE THOSE PROFILE-PREFIX
/* 5. DO NOT DELETE A MEMBER OF PDS
/*    BECAUSE DELETE DDNAME(MEMBER) WILL
/*    ACTUALLY DELETE THE WHOLE "DDNAME" DATASET
/* *******************************************************************
NGLOBAL PARM0
NGLOBAL OPREFIX
SET PARM0 = QDEL
SET MYDD = &amp;amp;STR(&amp;amp;INDD)

/* ---------------- */
/* SAVE ENVIRONMENT */
/* ---------------- */
SET OPREFIX = &amp;amp;SYSPREF
PROFILE NOPREFIX

/* ------------ */
/* DISPLAY HELP */
/* ------------ */
IF &amp;amp;STR(&amp;amp;MYDD) = &amp;amp;STR(?) OR &amp;amp;STR(&amp;amp;MYDD) = &amp;amp;STR(HELP) THEN +
DO
  CLEAR
  SYSCALL USAGE
  SYSCALL QUITING 0
END

/* ------------------------------- */
/* ENSURE CANNOT DELETE PDS MEMBER */
/* ------------------------------- */
SET LP = &amp;amp;STR((
SET RP = &amp;amp;STR())
IF &amp;amp;SYSINDEX(&amp;amp;STR(&amp;amp;LP),&amp;amp;INDD) GT 0 +
OR &amp;amp;SYSINDEX(&amp;amp;STR(&amp;amp;RP),&amp;amp;INDD) GT 0 THEN +
DO
  WRITE QDEL &amp;amp;INDD
  WRITE
  WRITE ERROR: CANNOT DELETE A MEMBER IN A PARTITION DATASET
  SYSCALL QUITING 20
END

/* ------------------- */
/* DOUBLE CONFIRMATION */
/* ------------------- */
IF &amp;amp;DELETE = DELETE THEN SET TMP = 0
ELSE DO
       WRITE QDEL
       WRITE ERROR: PLEASE ADD THE WORD "DELETE" AS A DOUBLE
       WRITE CONFIRMATION.
       SYSCALL QUITING 21
     END

/* ------------- */
/* REMOVE QUOTES */
/* ------------- */
SET QUOTED = NO
SET L = &amp;amp;LENGTH(&amp;amp;STR(&amp;amp;MYDD))
SET L1 = &amp;amp;L - 1
IF &amp;amp;STR(&amp;amp;SUBSTR(&amp;amp;L:&amp;amp;L,&amp;amp;STR(&amp;amp;MYDD))) = &amp;amp;STR(') THEN +
DO
  SET MYDD = &amp;amp;SUBSTR(1:&amp;amp;L1,&amp;amp;STR(&amp;amp;MYDD))
  SET QUOTED = YES
END
SET L = &amp;amp;LENGTH(&amp;amp;STR(&amp;amp;MYDD))
IF &amp;amp;STR(&amp;amp;SUBSTR(1:1,&amp;amp;STR(&amp;amp;MYDD))) = &amp;amp;STR(') THEN +
DO
  SET MYDD = &amp;amp;SUBSTR(2:&amp;amp;L,&amp;amp;STR(&amp;amp;MYDD))
  SET QUOTED = YES
END
IF &amp;amp;QUOTED = NO AND &amp;amp;OPREFIX ¬= THEN +
   SET MYDD = &amp;amp;OPREFIX..&amp;amp;MYDD
SET L = &amp;amp;LENGTH(&amp;amp;STR(&amp;amp;MYDD))

/* ------------------- */
/* FIND OUT THE SUFFIX */
/* ------------------- */
SET TMP = &amp;amp;STR(&amp;amp;MYDD)
SET I = 1
SET S = 1
SET J = -1
DO WHILE &amp;amp;I &gt; 0
   SET I = &amp;amp;SYSINDEX(&amp;amp;STR(.),&amp;amp;STR(&amp;amp;TMP),&amp;amp;S)
   IF &amp;amp;I &gt; 0 THEN SET J = &amp;amp;I
   SET S = &amp;amp;J + 1
END
IF &amp;amp;J = -1 THEN SET SUF = &amp;amp;STR(&amp;amp;MYDD)
           ELSE SET SUF = &amp;amp;SUBSTR(&amp;amp;S:&amp;amp;L,&amp;amp;STR(&amp;amp;MYDD))

/* -------------- */
/* CHECK IF ALIAS */
/* -------------- */
SET &amp;amp;SYSOUTTRAP = 1000
LISTCAT ENTRY(&amp;amp;MYDD) ALL
SET LINE001 = &amp;amp;&amp;amp;SYSOUTLINE1
SET &amp;amp;SYSOUTTRAP = 0
IF &amp;amp;STR(&amp;amp;SUBSTR(1:5,&amp;amp;STR(&amp;amp;LINE001 ))) = &amp;amp;STR(ALIAS) THEN +
     SET ISALIAS = Y
ELSE SET ISALIAS = N

/* ------------ */
/* CHECK IF GDG */
/* ------------ */
IF &amp;amp;STR(&amp;amp;GEN) = &amp;amp;STR() THEN SET J = 0
ELSE DO
       IF &amp;amp;GEN &gt; 0 THEN +
       DO
         WRITE ERROR: INVALID OPTIONAL PARAMETER - GEN
         WRITE GEN SHOULD BE A NUMERIC GENERATION FOR GDG DATASET
         WRITE CURRENT VALUE IS &lt;&amp;amp;GEN&gt;
         WRITE BUT ITS VALUE SHOULD BE 0 OR NEGATIVE
         SYSCALL QUITING 22
       END
       SET MYDD = &amp;amp;STR(&amp;amp;MYDD(&amp;amp;GEN))
     END

/* ---------- */
/* SUBMIT JCL */
/* ---------- */
SET TMP1 =
IF      &amp;amp;ISALIAS = Y THEN SET TMP1 = ALIAS
ELSE IF &amp;amp;GDG = Y     THEN SET TMP1 = GDG
WRITE &amp;amp;PARM0 - DELETE &amp;amp;TMP1 DATASET &amp;amp;MYDD
SET XXX = &amp;amp;STR(//**)
SUBMIT * END($$)
//&amp;amp;SYSUID.D JOB (AAAAAA,BBBBBB),
//       '&amp;amp;SUBSTR(1:20,&amp;amp;STR(DELETE &amp;amp;SUF ))',
//       NOTIFY=&amp;amp;SYSUID,
//       CLASS=&amp;amp;CLASS,
//       MSGCLASS=X,MSGLEVEL=(1,1),
IF &amp;amp;USER ¬= THEN +
//       USER=&amp;amp;USER,
//       REGION=1M
&amp;amp;XXX
&amp;amp;XXX*******************************************************************
&amp;amp;XXX PURPOSE : BATCH DELETE DATASET
&amp;amp;XXX &amp;amp;STR(&amp;amp;MYDD)
&amp;amp;XXX JOB OWNER: &amp;amp;SYSUID
&amp;amp;XXX DATE : &amp;amp;SYSSDATE - &amp;amp;SYSTIME
&amp;amp;XXX*******************************************************************
&amp;amp;XXX
IF &amp;amp;ISALIAS = Y THEN DO
//DEL#ALIA EXEC PGM=IDCAMS
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
&amp;amp;STR( DELETE &amp;amp;STR(&amp;amp;MYDD) - )
&amp;amp;STR( ALIAS )
&amp;amp;STR(/* )
END
ELSE +
IF &amp;amp;GDG = Y THEN DO
//DEL#GDG EXEC PGM=IDCAMS
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
&amp;amp;STR( DELETE &amp;amp;STR(&amp;amp;MYDD) - )
&amp;amp;STR( GDG FORCE PURGE )
&amp;amp;STR(/* )
END
ELSE DO
//DEL#DD EXEC PGM=IEFBR14
//DD1 DD DISP=(OLD,DELETE,DELETE),
// DSN=&amp;amp;STR(&amp;amp;MYDD)
END
//
//
$$
WRITE JOB SUBMITTED
SYSCALL QUITING 0
END /* OF CLIST */


USAGE: PROC 0
/* ***************************************************************** */
/* PURPOSE: DISPLAY USAGE HELP
/* ***************************************************************** */
IF &amp;amp;OPREFIX = THEN SET PP =
          ELSE SET PP = &amp;amp;STR(&amp;amp;OPREFIX..)

WRITE &amp;amp;PARM0 - SUBMIT JCL TO DELETE A QSAM, A GDG BASE OR A GDG +
GENERATION
WRITE
WRITE EXAMPLE:
WRITE - &amp;amp;PARM0 MY.PROJECT.QSAM
WRITE DELETE THE QSAM DATASET '&amp;amp;STR(&amp;amp;PP)MY.PROJECT.QSAM'
WRITE - &amp;amp;PARM0 'MY.PROJECT.QSAM1'
WRITE DELETE THE QSAM DATASET 'MY.PROJECT.QSAM1'
WRITE - &amp;amp;PARM0 MY.PROJECT.GDGBASE GEN(0)
WRITE DELETE A GDG GENERATION '&amp;amp;STR(&amp;amp;PP)MY.PROJECT.GDGBASE(0)'
WRITE - &amp;amp;PARM0 MY.PROJECT.GDGBASE GEN(-1)
WRITE DELETE A GDG GENERATION '&amp;amp;STR(&amp;amp;PP)MY.PROJECT.GDGBASE(-1)'
WRITE - &amp;amp;PARM0 MY.PROJECT.GDGBASE GDG(Y)
WRITE DELETE A GDG BASE '&amp;amp;STR(&amp;amp;PP)MY.PROJECT.GDGBASE'
END /* OF PROC USAGE*/


QUITING: PROC 1 XCODE
/* ******************************************************************
/* PURPOSE: EXIT CLIST WITH ENVIRONMENT RESTORED
/* ******************************************************************
/* ------------------- */
/* RESTORE ENVIRONMENT */
/* ------------------- */
IF &amp;amp;OPREFIX ¬= THEN PROFILE PREFIX(&amp;amp;OPREFIX)

/* ---- */
/* EXIT */
/* ---- */
EXIT CODE(&amp;amp;XCODE)
END /* OF PROC QUITING */
&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;With this CLIST, in the ISPF option 3.4 panel like this:
&lt;table  border="1" style="color:black;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td bgcolor="black"&gt;&lt;div class="myscreen"&gt;&lt;span style="color:green;"&gt;        ALVIN.PROJECT1.QSAM1                       DD1233
        ALVIN.PROJECT1.QSAM2                       DD1234
        ALVIN.PROJECT1.QSAM3                       DD1235
        ALVIN.PROJECT1.QSAM4                       MIGRAT
        ALVIN.PROJECT1.QSAM5                       MIGRAT
        ALVIN.PROJECT1.TAPE1                       T12345
        ALVIN.PROJECT1.TAPE2                       T12346
        ALVIN.PROJECT1.TAPE3                       T12347
&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
I can do the following:
&lt;table style="color:black;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td bgcolor="black"&gt;&lt;div class="myscreen"&gt;&lt;span style="color:green;"&gt;        ALVIN.PROJECT1.QSAM1                       DD1233
        ALVIN.PROJECT1.QSAM2                       DD1234
        ALVIN.PROJECT1.QSAM3                       DD1235
        ALVIN.PROJECT1.QSAM4                       MIGRAT
        ALVIN.PROJECT1.QSAM5                       MIGRAT
qdel / delete PROJECT1.TAPE1                       T12345
        ALVIN.PROJECT1.TAPE2                       T12346
        ALVIN.PROJECT1.TAPE3                       T12347
&lt;/span&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
This will call QDEL to submit JCL to delete the tape dataset ALVIN.PROJECT1.TAPE1.
&lt;/p&gt;

&lt;!--
&lt;td width=30px align="right" valign="top"&gt;&lt;div class="mycodenum"&gt;&amp;nbsp;1 &amp;nbsp;2 &amp;nbsp;3 &amp;nbsp;4 &amp;nbsp;5 &amp;nbsp;6 &amp;nbsp;7 &amp;nbsp;8 &amp;nbsp;9 &amp;nbsp;10
11 12 13 14 15 16 17 18 19 20
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
101 102 103 104 105 106 107 108 109 110 
111 112 113 114 115 116 117 118 119 120
121 122 123 124 125 126 127 128 129 130 
131 132 133 134 135 136 137 138 139 140
141 142 143 144 145 146 147 148 149 150
151 152 153 154 155 156 157 158 159 160
161 162 163 164 165 166 167 168 169 170
171 172 173 174 175 176 177 178 179 180
181 182 183 184 185 186 187 188 189 190
191 192 193 194 195 196 197 198 199 200
201 202 203 204 205 206 207 208 209 210
211 212 213 214 215 216 217 218 219 220
221 222 223&lt;/div&gt;&lt;/td&gt;
--&gt;

&lt;hr color="crimson"&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-1304717359595090422?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/1304717359595090422/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=1304717359595090422' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/1304717359595090422'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/1304717359595090422'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/11/use-clist-to-submit-jcl-to-batch-delete.html' title='Use CLIST to submit JCL to batch delete dataset'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-6046223431234932507</id><published>2008-11-10T10:59:00.011+08:00</published><updated>2009-03-22T12:07:27.196+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DOS'/><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><category scheme='http://www.blogger.com/atom/ns#' term='information security'/><title type='text'>The PATH in unix and DOS</title><content type='html'>&lt;p&gt;Both unix and DOS have the PATH environment variable.  But, the behavior is a little bit different.
&lt;/p&gt;
&lt;p&gt;In DOS, if you type a command XXX in a directory, DOS shell will first search for a file XXX.com or XXX.exe or XXX.bat in the [ current ] directory to execute.   If DOS cannot find any one of these 3 files, DOS will look at the directories in the PATH one by one.
&lt;/p&gt;
&lt;p&gt;In unix, the story is a little bit different.  Once you key in a non-shell-built-in XXX command, usually the shell will directly look at the directories in the PATH to search for the XXX file to execute.  If there is a dot (.) in the PATH, this means the current directory.  If this dot is at the beginning of the PATH, the current directory will be the first one to search for.  If the dot is at the end, the current directory will be the last directory to be searched.
&lt;/p&gt;
&lt;p&gt;Also, unix will only look for files with execution permission (e.g. rwxr-xr-x).   It will ignore those file without execution permission (e.g. rw-r--r--).
&lt;/p&gt;
&lt;div&gt;This altogether makes a funny story:
&lt;table bgcolor=#66FFFF border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;p&gt;One day, a guy cd to a directory named, say, one-directory.  When he issues the ls command, there is nothing happen.  The directory seems to be empty.
&lt;/p&gt;
&lt;p&gt;But, yesterday, there were thousands of file inside one-directory.  What happen to this one-directory ?  Did someone delete all files ?
&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;div&gt;After investigation, here is the truth:
&lt;table bgcolor=#99FFFF border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;p&gt;This guy, just like other users, loves to put the dot (i.e. current directory) as the first directory in the PATH environmental variable.
&lt;/p&gt;
&lt;p&gt;Actually, in the one-directory, someone has accidentally put a file named [ ls ].  Yes, this file name is exactly the same as the unix ls command.  But, the file is zero byte with a permission is rw-r--r--.
&lt;/p&gt;
&lt;p&gt;Yesterday, when the guy issue the unix ls command, he was actually using the /bin/ls command, which will display thousands of files in one-directory.  Out of thousands of files, this zero-byte [ ls ] file will certainly be overlooked.
&lt;/p&gt;
&lt;p&gt;Then, some other person has accidentally change the the permission of the zero-byte [ ls ] file in one-directory to rwx-r-xr-x.
&lt;/p&gt;
&lt;p&gt;Today, when the guy issue the ls command in one-directory, since the current directory is the first directory in the PATH, the shell will look up the one-directory at once.  The shell will find a file named [ ls ] with executable permission (rwxr-xr-x).  So, it will execute this zero-byte file.  The shell just treat this file as a shell script actually.  Since the file is zero byte, nothing will happen after execution.  So, the outcome is the same as to execute the /bin/ls command on an empty directory.
&lt;/p&gt;
&lt;p&gt;After changing back the permission to rw-r--r-- for the zero byte [ ls ] file in one-directory, everything returns to normal.  The guy can see the thousands of files under one-directory.
&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;What is the moral of this story ?
&lt;/p&gt;
&lt;p&gt;Of course, it is not a good practice to use a file name which is exactly the same as some common unix command (unless there is really such a need).
&lt;/p&gt;
&lt;p&gt;However, this story also reflects a security leak.  Imagine that, if this guy is a root, this zero byte [ ls ] file has fooled the root.  In this case, the [ ls ] file is zero byte; there is nothing harmful.  How about when there is some malicious coding inside the [ ls ] file in one-directory ?  So, there is a strong suggestion NOT to put the current directory in the PATH, especially for the root account.
&lt;/p&gt;
&lt;hr /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-6046223431234932507?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/6046223431234932507/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=6046223431234932507' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/6046223431234932507'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/6046223431234932507'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/11/path-in-unix-and-dos.html' title='The PATH in unix and DOS'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-8506141618126794531</id><published>2008-11-07T08:12:00.016+08:00</published><updated>2009-03-22T12:11:44.332+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Data Warehouse'/><category scheme='http://www.blogger.com/atom/ns#' term='file transfer'/><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><title type='text'>The Max Download Session Problem</title><content type='html'>&lt;p&gt;Think about this story : there is a big data warehouse department in a company.  The DW department unix machine has to download numerous files from various other departments in order to collect data to build the warehouse.
&lt;/p&gt;
&lt;p&gt;&lt;div&gt;There is a situation that : for example, job script-1 will download file-A, file-B, file-C, file-D &amp;amp; file-E from department-1 of the company,  Job script-2 will download file-F, file-G, file-H, file-I &amp;amp; file-J from department-2 of the company,  similarly for job script-3, script-4, script-5, script-6 and so so.  All jobs are inside the job database and are kick-out by the job scheduler in a monthly, weekly and daily basis respectively.
&lt;/p&gt;
&lt;p&gt;How to do the download ? Actually, the script will call a third party file transfer software.
&lt;/p&gt;
&lt;p&gt;For this situation, there are many outstanding questions :
&lt;table bgcolor=#99FFFF border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Due to license issue, the third party file transfer software only allows a max download session of 4.  If there are 6 scripts kick-out by the job scheduler, what will happen ?  Can the third party file transfer software put the requests queuing ? Or, will it just turn down the all upcoming requests ?
&lt;/p&gt;
&lt;p&gt;How about, for example, job script-1 &amp;amp; job script-2 are monthly jobs,  script-3 &amp;amp; script-4 are weekly jobs and script-5 &amp;amp; script-6 are daily jobs.  The files in monthly job scripts  (e.g. script-1 and script-2) are very large.  They take a long time for transfer.  The files in daily job scripts (e.g. script-5 and script-6) are relatively smaller, just a few hours or minutes are required.  But, the daily job scripts have a batch running window of approx 24 hour only.  They must finish the file downloading within one day.  On the next day, there is a new daily batch.  Can the third party file transfer software prioritize the transfer requests ?  What happen when all the 4 downloading sessions are occupied by the files of the monthly job scripts ? Can the third party file transfer software let the daily job scripts to jump queue to do the downloading once a monthly file finishes its downloading ? If the transfer software only serves the request in a first-come-first-serve basis and the monthly job scripts appear first, all the monthly file transfer will be answered first.  Then, the daily job scripts may face starvation.
&lt;/p&gt;
&lt;p&gt;What happen when the third party software is hang up ?  Will the job scripts get notified ?  Or, will the job script simply wait infinitely ? Will the human being production system support get alerted ?
&lt;/p&gt;
&lt;p&gt;When that third party file transfer software is down, what happens to all the downloading job scripts ?  Can all the job scripts automatically switch to use another file transfer software ?
&lt;/p&gt;
&lt;p&gt;If the DW department wants to upgrade the third party file transfer software or to replace it by another software, will the job script affected ?
&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;To tackle all these questions, one solution is to build a centralized file transfer request manager as an agent or a middle-man between the job scripts and the third party file transfer software.
&lt;/p&gt;
&lt;p&gt;First of all, the DW job scripts should not call the third party file transfer software directly.  Instead, they will submit the file transfer requests to the file transfer request manager and then go sleeping.  For example, job script-1 will submit the request of file-A, file-B, file-C, file-D &amp;amp; file-E to the manager and then go sleeping for 2 days.  After 2 days, if all the 5 files are not received, the job script-1 should raise a non-zero return-code to the job scheduler to signal the production system support personnel, similarly for script-2.  For script-3 and script-4, since they are weekly jobs, sleeping hour is only 1 day.  For daily job script-5 &amp;amp; script-6, they can only sleep for a few hours.  Each job script can control its own sleeping hours, depending on the average file transfer time of the job script.
&lt;/p&gt;
&lt;p&gt;On receiving the file transfer requests, the manager can then call the third party file transfer software to perform the actual file downloading.
&lt;/p&gt;
&lt;p&gt;Normally, the request is done in a first-come-file-serve basis.  However, the manager can also allow daily jobs to jump queue.  Daily jobs should have a higher priority always.
&lt;/p&gt;
&lt;p&gt;Also, the manager can control over the max file transfer session.  If there are already 4 files performing transfer, the manager simply put all upcoming request queuing.  Also, the manager can further control that each job can only occupy at most 2 file transfer sessions in order to avoid one single job to use up all the 4 sessions.
&lt;/p&gt;
&lt;p&gt;The manager should totally take care about the third party file transfer software. If the third party software is down, the manager should alert the human being production system support (i.e. PSS).  After investigation, if the bug cannot be fixed shortly, this PSS can instruct the manger to switch to use another file transfer software.  This is transparent to the DW job scripts.
&lt;/p&gt;
&lt;p&gt;For the handshaking between the manager and the job scripts, the manager to send signal to the job script to report whether the file transfer is successful or fail.  When receiving a successful signal, the DW job script can do some post processing.
&lt;/p&gt;
&lt;p&gt;For example, when all the file-A, file-B, file-C, file-D &amp;amp; file-E are downloaded successfully, the manger can alert the job script-1.  Another method is to let the job script-1 to count whether all the 5 files are downloaded, the manager does not perform the counting.  When all the 5 files are downloaded successfully, job script-1 should wake up from sleeping (job script-1 sleeps at most 2 days).  Then, job script-1 should give a zero return-code to the job scheduler to indicate job successfully complete so that the scheduler can kick-out job(s) in the downstream.
&lt;/p&gt;
&lt;p&gt;When there is a software upgrade, only the manger is affected.  The DW job scripts are totally transparent.
&lt;/p&gt;
&lt;p&gt;Furthermore, the manager can be enhanced to classify and distribute requests to different multiple queues.  The requests of some VIP DW job scripts can go to high priority queues which is always served first.  Those requests from some can-be-wait job scripts should go to lower priority queues.  Also, maybe different queues are using different third party file transfer software.  Maybe some queues are using software for secured channel to provide higher security level with maybe slower performance.
&lt;/p&gt;
&lt;p&gt;By the way, although this article is talking about file downloading, everything can also be applied to uploading as well.  In other words, this situation and the file request manager can actually handle both file downloading / receiving / pulling as well as file uploading / sending / pushing.  There can be out-queues and in-queues in the manger.
&lt;/p&gt;
&lt;hr color="crimson"&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-8506141618126794531?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/8506141618126794531/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=8506141618126794531' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/8506141618126794531'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/8506141618126794531'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/11/max-download-session-problem.html' title='The Max Download Session Problem'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-6971904636024166179</id><published>2008-11-05T21:51:00.009+08:00</published><updated>2009-03-22T12:14:56.105+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windows'/><title type='text'>Go to your Application Data folder</title><content type='html'>&lt;p&gt;In Windows XP, there is a quick way to go to the application data folder of the current user.
&lt;ol&gt;
&lt;li&gt;Click Start
&lt;li&gt;Click Run
&lt;li&gt;Then, in the box, type :
&lt;table bgcolor=#FFFFBB border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;%APPDATA%&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/ol&gt;
&lt;/p&gt;
&lt;p&gt;Then, the a new explorer window will be opened to take you to
&lt;table bgcolor=#FFFFBB border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;C:\Documents and Settings\XXXXXX\Application Data&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;hr color="crimson"&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-6971904636024166179?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/6971904636024166179/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=6971904636024166179' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/6971904636024166179'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/6971904636024166179'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/11/go-to-your-application-data-folder.html' title='Go to your Application Data folder'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-4917339417466303865</id><published>2008-10-27T17:26:00.007+08:00</published><updated>2009-08-06T17:26:53.240+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><title type='text'>The date command in unix</title><content type='html'>&lt;p&gt;In unix, the &lt;b&gt;date&lt;/b&gt; command is to show the current date and time.
&lt;/p&gt;
&lt;p&gt;If you are the root, you can use the date command to &lt;b&gt;set&lt;/b&gt; the system date (i.e. the current date as reported by the unix machine).  Since the majority of the users are not root, for most of the time this command is used for display.
&lt;/p&gt;
&lt;p&gt;Without any parameter, just type the date command will display the current date and/or time in the default format.
&lt;/p&gt;
&lt;p&gt;But, you can set the display format as you like.
&lt;/p&gt;
&lt;p&gt;Usually, I will create file with a filename having the current date-time.  Then I will use this date command.  Here it is:&lt;font size="+1"&gt;&lt;table border="1" bgcolor=#99FFFF&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;touch my_file.d`date +"%Y%m%d%H%M%S"`&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/font&gt;
&lt;/p&gt;
&lt;p&gt;Assuming now is 2008-12-31 23:58:59, this will create a file my_file.d20081231235859
&lt;/p&gt;
&lt;hr color="crimson"&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-4917339417466303865?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/4917339417466303865/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=4917339417466303865' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/4917339417466303865'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/4917339417466303865'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/10/date-command-in-unix.html' title='The date command in unix'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-3882357778868619104</id><published>2008-10-23T10:12:00.010+08:00</published><updated>2009-03-22T12:20:53.923+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DOS'/><category scheme='http://www.blogger.com/atom/ns#' term='mainframe'/><category scheme='http://www.blogger.com/atom/ns#' term='unix'/><title type='text'>What is a line ?</title><content type='html'>&lt;p&gt;When a human being reads a text file in computer, the file is well formatted line by line.  When the file is a COBOL program in mainframe MVS, the program is displayed in a well formatted 80-column line by line.  When the file is a C program in unix, it is also formatted well line by line, similarly for many DOS files.
&lt;/p&gt;
&lt;p&gt;Human beings see the text file as a line-by-line file.  How does the computer see this file ?
&lt;/p&gt;
&lt;p&gt;Actually, the computer does NOT see the file in a human being line-by-line concept.
&lt;/p&gt;
&lt;p&gt;In fact, the file is stored as a STREAM of bytes, i.e. a byte following a byte continuously until the end of the file.  Then, some special handling (e.g. using line delimiter or else) is done to identify which portion is line-1 and which portion is line-2 in that long stream of bytes.
&lt;/p&gt;
&lt;p&gt;For example, when you see this 2-line file (named C:\example.txt) in DOS:
&lt;table bgcolor="#ffffbb" border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;This is first line.
This is second line.&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;This file has 2 lines.  The first line [ &lt;b&gt;This is first line.&lt;/b&gt; ] has 19 characters from T to the last period.  Similarly, the second line [ &lt;b&gt;This is second line.&lt;/b&gt; ] has 20 characters.  One can count a total of 39 characters.
&lt;/p&gt;
&lt;p&gt;However, when you use the DOS command [ &lt;b&gt;dir&lt;/b&gt; ] to examine the file size:
&lt;table bgcolor="#ffffbb" border="1"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;C:\&gt; dir example.txt
2006-03-20  13:39                41 example.txt
1 File(s)             41 bytes
&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
This [ &lt;b&gt;dir&lt;/b&gt; ] command reports a file size of 41 byte, not 39 byte.  Why there are 2 more bytes ?
&lt;/p&gt;
&lt;p&gt;Actually, how the file is stored in DOS ? Using the [ &lt;b&gt;debug&lt;/b&gt; ] program, the following will be seen:
&lt;table bgcolor="#ffffbb" border="2"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;pre&gt;C:\&gt; debug example.txt
-d
0B1A:0100  54 68 69 73 20 69 73 20-66 69 72 73 74 20 6C 69   This is first li
0B1A:0110  6E 65 2E &lt;b&gt;0D 0A&lt;/b&gt; 54 68 69-73 20 69 73 20 73 65 63   ne.&lt;b&gt;..&lt;/b&gt;This is sec
0B1A:0120  6F 6E 64 20 6C 69 6E 65-2E &lt;i&gt;6B 6A 6B 6A 65 72 6A&lt;/i&gt;   ond line.&lt;i&gt;kjkjerj
0B1A:0130  20 64 67 6B 3B 6C 64 73-20 6C 6B 6A 66 67 6C 73    dgk;lds lkjfgls
0B1A:0140  20 64 68 6A 73 64 6B 68-6A 6B 73 68 20 73 20 68    dhjsdkhjksh s h
0B1A:0150  6B 73 20 68 20 73 68 20-73 20 68 20 64 73 68 20   ks h sh s h dsh
0B1A:0160  66 64 73 20 68 20 73 66-64 68 20 6B 20 73 68 20   fds h sfdh k sh
0B1A:0170  6B 68 6A 6B 73 68 6B 20-73 68 20 73 66 64 68 20&lt;/i&gt;   khjkshk sh sfdh
-q&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;/p&gt;
&lt;p&gt;As one can see, the file is stored as a STREAM of characters in the harddisk.  After the string [ &lt;b&gt;This is first line.&lt;/b&gt; ], one can find 2 characters [ &lt;b&gt;0D 0A&lt;/b&gt; ].  Then, the second line follows.
&lt;/p&gt;
&lt;p&gt;This [ &lt;b&gt;0D 0A&lt;/b&gt; ] characters are termed line delimiter.  This 39-byte information plus 2-byte line delimiter results in a 41-byte file.
&lt;/p&gt;
&lt;p&gt;Also, this line delimiter [ &lt;b&gt;0D 0A&lt;/b&gt; ] tells the software editor to display the file into 2 lines.
&lt;/p&gt;
&lt;p&gt;According to ASCII encoding sequence, [ &lt;b&gt;0D&lt;/b&gt; ] is the decimal value 13.  This [ &lt;b&gt;0D&lt;/b&gt; ] is called [ carriage return ], with an abbreviation [ &lt;b&gt;CR&lt;/b&gt; ].  Similarly, [ &lt;b&gt;0A&lt;/b&gt; ] is decimal 10, called [ line feed ], abbreviated as [ &lt;b&gt;LF&lt;/b&gt; ].  Together, [ &lt;b&gt;0D 0A&lt;/b&gt; ] are represented by &lt;b&gt;CRLF&lt;/b&gt;.
&lt;/p&gt;
&lt;p&gt;In the world of unix, the line delimiter is  [ &lt;b&gt;0A&lt;/b&gt; ] for most of the common settings.
&lt;/p&gt;
&lt;p&gt;As a result, when using FTP to transfer files between DOS and unix, it is better to use the [ &lt;b&gt;ascii&lt;/b&gt; ] option to turn on the line delimiter conversion between [ &lt;b&gt;0D 0A&lt;/b&gt; ] and [ &lt;b&gt;0A&lt;/b&gt; ].  If someone forget to do so, after uploading a DOS file into unix, there will be a ^M character at the end of each line (when the file is opened by vi editor).  This ^M is actually the [ &lt;b&gt;0D&lt;/b&gt; ] character which is NOT treated as line delimiter and is considered as normal character to be displayed.
&lt;/p&gt;
&lt;p&gt;Similar mistake can occur for downloading unix file into DOS.  Without using the [ &lt;b&gt;ascii&lt;/b&gt; ] option, there is no line delimiter conversion.  The received file in DOS will be delimited by [ &lt;b&gt;0A&lt;/b&gt; ] only, not the common DOS line delimiter [ &lt;b&gt;0D 0A&lt;/b&gt; ].  So far, the Notepad application CANNOT recognize this [ &lt;b&gt;0A&lt;/b&gt; ] as line delimiter.  You will see all the line mess together into one very long line.  Another application, Wordpad, is more intelligent.  It knows that [ &lt;b&gt;0A&lt;/b&gt; ] is also a line delimiter.  It can open the file normally for human being to read.
&lt;/p&gt;
&lt;p&gt;In the mainframe MVS world, if the dataset file is a QSAM, there is no need to have line delimiter.  The dataset organization has already tell the exact number of characters for each line.
&lt;/p&gt;
&lt;hr color="crimson"&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-3882357778868619104?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/3882357778868619104/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=3882357778868619104' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/3882357778868619104'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/3882357778868619104'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/10/what-is-line.html' title='What is a line ?'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4058876028773815143.post-445762021699386803</id><published>2008-10-23T00:19:00.004+08:00</published><updated>2009-03-22T12:17:25.828+08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Others'/><title type='text'>This is the first article</title><content type='html'>&lt;p&gt;This is the first article.
&lt;/p&gt;
&lt;p&gt;Just for testing.
&lt;/p&gt;
&lt;hr color="crimson"&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4058876028773815143-445762021699386803?l=alvinsiu.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://alvinsiu.blogspot.com/feeds/445762021699386803/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4058876028773815143&amp;postID=445762021699386803' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/445762021699386803'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4058876028773815143/posts/default/445762021699386803'/><link rel='alternate' type='text/html' href='http://alvinsiu.blogspot.com/2008/10/this-is-first-article.html' title='This is the first article'/><author><name>Alvin SIU</name><uri>http://www.blogger.com/profile/03015260715585597937</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://4.bp.blogspot.com/_5KectgGfL2o/SQANG8cKxCI/AAAAAAAAACM/socvnNvkpQM/S220/image_alvin_original_03.bmp'/></author><thr:total>0</thr:total></entry></feed>
