<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title><![CDATA[BlueStrait - My Life, My Site - 程序员]]></title>
<link>http://www.bluestrait.com/blog/</link>
<description><![CDATA[DIY, 数码, 程序, 生活]]></description>
<language>zh-cn</language>
<copyright><![CDATA[Copyright 2005 PBlog3 v2.8]]></copyright>
<webMaster><![CDATA[bluestrait@gmail.com(Min)]]></webMaster>
<generator>PBlog2 v2.4</generator> 
<image>
	<title>BlueStrait - My Life, My Site</title>
	<url>http://www.bluestrait.com/blog/images/logos.gif</url>
	<link>http://www.bluestrait.com/blog/</link>
	<description>BlueStrait - My Life, My Site</description>
</image>

			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=326</link>
			<title><![CDATA[DBPROP_COMMANDTIMEOUT does not seem to work?]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Thu,03 Jun 2010 02:29:17 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=326</guid>
		<description><![CDATA[This is set as a property to a dbcommand, <br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>propSet.AddProperty(DBPROP_COMMANDTIMEOUT, 30);<br/></div></div><br/><br/>But the command does not seem to work after 30 seconds.<br/><br/>This <a target="_blank" href="http://www.ms-news.net/f767/commandtimeout-detail-question-how-accurate-6408414.html" rel="external">post</a> appears making sense to me:<br/><br/><div class="UBBPanel quotePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/quote.gif" style="margin:0px 2px -3px 0px" alt="引用内容"/> 引用内容</div><div class="UBBContent"><br/>o The timeout no longer counts, once the client library have received some<br/>data back from SQL Server. (This is something I have read in a book; I<br/>have not verified it myself.)<br/>o If the timeout elapses when SQL Server has been ins&#101;rting data into a<br/>table for 30 seconds, o&#114; even worse been updating rows row 30 seconds,<br/>it will not yield on the spot. The effect of the currently executing<br/>statement must be rolled back. And rollbacks usually takes longer than<br/>command that started the operation.<br/></div></div><br/><br/>In my case, the first one makes sense because the query in my test command does return 696164 rows. That explains why the command took around 175 seconds and did not report any timeout failure. After all, if there is data incoming, why the command can be assumed hanged?<br/><br/>If I put a sleep in a sproc, the timeout will still occur, obviously since no data is returned to the client, the client think the command is stalled. <br/><br/>Further reading:<br/><a target="_blank" href="http://blogs.msdn.com/b/khen1234/archive/2005/10/20/483015.aspx" rel="external">This MSDN blog</a> explains query timeouts are a client-side concept only.<br/><br/>But this is probably the best explanation about how the timeout is calculated: <a target="_blank" href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.commandtimeout.aspx" rel="external">http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.commandtimeout.aspx</a><br/><br/><div class="UBBPanel quotePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/quote.gif" style="margin:0px 2px -3px 0px" alt="引用内容"/> 引用内容</div><div class="UBBContent"><br/>This property is the cumulative time-out for all network reads during command execution o&#114; processing of the results. A time-out can still occur after the first row is returned, and does not include user processing time, only network read time.<br/></div></div><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=323</link>
			<title><![CDATA[[zt] Virtuality]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Mon,24 May 2010 19:03:22 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=323</guid>
		<description><![CDATA[A very insightful article about Virtuality in C++: <br/><br/><a target="_blank" href="http://www.gotw.ca/publications/mill18.htm" rel="external">http://www.gotw.ca/publications/mill18.htm</a>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=320</link>
			<title><![CDATA[static variable in header file? ]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Wed,19 May 2010 19:54:00 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=320</guid>
		<description><![CDATA[<br/>A few discussions: <br/><br/><a target="_blank" href="http://stackoverflow.com/questions/92546/variable-declarations-in-header-files-static-or-not" rel="external">http://stackoverflow.com/questions/92546/variable-declarations-in-header-files-static-or-not</a><br/><br/>This confirms that a static variable declared in a header file will leave one copy of it cr&#101;ated for each source file in which the header file is included. <br/><br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=319</link>
			<title><![CDATA[typedef o&#114; class wrapper]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Tue,18 May 2010 20:07:55 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=319</guid>
		<description><![CDATA[I faced a question to ensure correct parameter type is passed in, although the type essentially is a WORD only: <br/>1. typedef<br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>typedef WORD ParamType<br/></div></div><br/><br/>Pro: no run-time overhead cost<br/>Con: no compiler checking hence the app can actually pass in a WORD, o&#114; int o&#114; whatever numeric values that can be cast into WORD. <br/><br/>2. o&#114; use a class wrapper: <br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>class CParamType<br/>{<br/>public:<br/>&nbsp;&nbsp;&nbsp;&nbsp;CParamType(WORD wValue) : m_wValue(wValue) {};<br/>&nbsp;&nbsp;&nbsp;&nbsp;virtual ~CParamType() : {};<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;WORD m_wValue;<br/>}<br/></div></div><br/>Pro: compiler checking will kick in to enforce valid CParamType only.<br/>Con: extra class means a performance hit.<br/><br/>Which way I should go? <br/><br/>Some discussion: <br/>1. <a target="_blank" href="http://www.cplusplus.com/forum/general/8423/" rel="external">http://www.cplusplus.com/forum/general/8423/</a><br/>Basically use the class when in a special compiler mode to be able to detect the error but fall back to typedef in other compiler mode.<br/><br/>2. <a target="_blank" href="http://stackoverflow.com/questions/376452/enforce-strong-type-checking-in-c-type-strictness-for-typedefs" rel="external">http://stackoverflow.com/questions/376452/enforce-strong-type-checking-in-c-type-strictness-for-typedefs</a><br/>It seems <a target="_blank" href="http://www.boost.org/doc/libs/1_40_0/boost/strong_typedef.hpp" rel="external">BOOST_STRONG_TYPEDEF</a> from boost library is recommended by many. It is a macro introduced in boost, and internally uses struct to differentiate between types. Essentially same as using a simple class wrapper listed above.]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=315</link>
			<title><![CDATA[va_start does not work with reference parameter]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Thu,06 May 2010 21:48:20 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=315</guid>
		<description><![CDATA[It is the first time I noticed this issue. <br/><br/>Basically the first parameter of a unknown number of parameters function call must have the first parameter passed as value. <br/><br/>See the full discussion at <a target="_blank" href="http://stackoverflow.com/questions/222195/are-there-gotchas-using-varargs-with-reference-parameters" rel="external">http://stackoverflow.com/questions/222195/are-there-gotchas-using-varargs-with-reference-parameters</a>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=313</link>
			<title><![CDATA[Compiler expression evaluation Interesting]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Mon,03 May 2010 02:18:43 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=313</guid>
		<description><![CDATA[<div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&#160;&#160;&#160;&#160;CString strTest2(_T(&#34;Hello&#34;)), strTest3;<br/>&#160;&#160;&#160;&#160;LPCTSTR szBuf = TRUE ? NULL : strTest2;<br/>&#160;&#160;&#160;&#160;LPCTSTR szBuf2 = TRUE ? NULL : strTest3;<br/>&#160;&#160;&#160;&#160;LPCWSTR szBuf3 = TRUE ? (LPCTSTR)NULL : strTest3;<br/>&#160;&#160;&#160;&#160;LPCWSTR szBuf4 = TRUE ? NULL : (LPCTSTR)strTest3;<br/></div></div><br/><br/>What will be the value of these buffer pointers? <br/><br/><br/>ANSWER:<br/>szBuf --&gt; Same as m_pszData of strTest3<br/>szBuf2 --&gt; Same as m_pszData of strTest3<br/>szBuf3 --&gt; NULL<br/>szBuf4 --&gt; NULL<br/><br/>Explanation: <br/>It must have something to do with the type implication here. ]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=311</link>
			<title><![CDATA[Building Boost.Locale]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Mon,19 Apr 2010 02:04:07 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=311</guid>
		<description><![CDATA[1. download and install cmake<br/>2. download and uncompress icu 4.4 binary format<br/>3. download and uncompress boost 1.33.1+.<br/>3. download boost locale library source code and uncompress.<br/>4. cr&#101;ate build directory:<br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>mkdir boost_locale_build<br/>cd boost_locale_build<br/></div></div><br/>5. set up environment variable for cmake and then run cmake<br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>set CMAKE_INCLUDE_PATH=D:\devel\Lab\icu\include;D:\devel\mhuangTfs\3rdParty\Boost\1.35\main<br/>set CMAKE_LIBRARY_PATH=D:\devel\Lab\icu\lib<br/>cmake ..\boost_locale\libs\locale<br/></div></div><br/>This will cr&#101;ate .vcproj files under&nbsp;&nbsp;boost_locale_build directory<br/><div class="UBBScreen"><br/>D:\devel\Lab\boost_locale_build&gt;dir<br/> Volume in drive D has no label.<br/> Volume Serial Number is B6AD-2046<br/><br/> Directory of D:\devel\Lab\boost_locale_build<br/><br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&lt;DIR&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&lt;DIR&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;..<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16,229 ALL_BUILD.vcproj<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;17,919 boost_locale-static.vcproj<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;20,828 boost_locale.vcproj<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;19,503 boundary.vcproj<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;19,503 calendar.vcproj<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;15,364 CMakeCache.txt<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&lt;DIR&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CMakeFiles<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7,090 cmake_install.cmake<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;19,481 collate.vcproj<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;19,569 conversions.vcproj<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1,063 CTestTestfile.cmake<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;19,437 hello.vcproj<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16,587 INSTALL.vcproj<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;25,239 Project.sln<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;16,587 RUN_TESTS.vcproj<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;19,609 test_boundary.vcproj<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;19,609 test_codepage.vcproj<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;19,587 test_collate.vcproj<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;19,587 test_convert.vcproj<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;19,631 test_date_time.vcproj<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;19,653 test_formatting.vcproj<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;19,631 test_generator.vcproj<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;19,609 test_ios_prop.vcproj<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;19,587 test_message.vcproj<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;19,525 wboundary.vcproj<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;19,591 wconversions.vcproj<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;19,459 whello.vcproj<br/>19/04/2010&nbsp;&nbsp;03:53 PM&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;15,562 ZERO_CHECK.vcproj<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;27 File(s)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;485,039 bytes<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3 Dir(s)&nbsp;&nbsp;33,357,881,344 bytes free<br/></div><br/><br/>6. After that, The IDE o&#114; MSBuild of MSVC 2008 can be used to build the relevant projects.]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=309</link>
			<title><![CDATA[Basic GNU Gettext how-to]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Wed,14 Apr 2010 20:28:38 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=309</guid>
		<description><![CDATA[1. Mark the strings using chosen keywoard (for example, &#39;_&#39;)<br/><br/>2. Extract text template out of source code with specified keyword and domain name:<br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>\gettext-0.17\bin\xgettext -k_ PnxErrors.h Error.cpp -ophoenix.po -dPhoenix<br/></div></div><br/><br/>3. Creating a po file out of template with specified locale so that it can be translated.<br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>\gettext-0.17\bin\msginit -iphoenix.po -ophoenix.zh_CN.po -lzh_CN<br/></div></div><br/><br/>this step will produce phoenix.zh_CN.po file under current directory. <br/><br/>4. Translate the strings in produced zh_CN.po. Make sure the file is saved with UTF-8 encoding, and the charset is set to UTF-8, as shown in example below:<br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&#34;Content-Type: text/plain; charset=UTF-8\n&#34;<br/></div></div><br/><br/>5. After translation, build the binary string resource file (.bo):<br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>\gettext-0.17\bin\msgfmt -ozh_CN\LC_MESSAGES\phoenix.mo phoenix.zh_CN.po<br/></div></div><br/><br/>6. Later if the source code has been up&#100;ated and new strings added, step 2 can be run again to cr&#101;ate up&#100;ated string template. After that, msgmerge can be run to up&#100;ate the existing translation files to add in the new strings:<br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>\gettext-0.17\bin\msgmerge.exe -U phoenix.zh_CN.po phoenix.en_US.po<br/></div></div><br/>Note: it seems it is not possible to remove an existing translation if a string does not exist any more in the source code.<br/><br/>NOTE:<br/>1. SetThreadLocale() controls which language gettext will use.<br/>2. However, environment variables such as LANG, LANGUAGE, LC_ALL takes precendence of SetThreadLocale() if any of them is present present, unfortunately.<br/>3. User locale is taken if neither thread locale nor environment variables set.<br/>This is actually a big disadvantage of gettext tool which may prevents of the use of this tool in a server environment, when the requirements is to provide localized data to each client based on their locale. SetThreadLocale() is definitely a no-go. <br/><br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=308</link>
			<title><![CDATA[l in Format Specification Fields ]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Tue,13 Apr 2010 21:07:11 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=308</guid>
		<description><![CDATA[It is the first time I noticed that you can use l as a size specification for a string parameter, for example:<br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&#160;&#160;&#160;&#160;CStringA strTest;<br/>&#160;&#160;&#160;&#160;strTest.Format(&#34;%ls&#34;, L&#34;Hello&#34;);<br/></div></div><br/><br/>It means the parameter is a wide-character string. It works for both printf and wprintf. <br/><br/>I only realized it after I did unnecessary W2A conversion on a wide-char string which led to ASSERT error from ATL and crashed the app. The guilty code is like below:<br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&#160;&#160;&#160;&#160;CStringA strTest;<br/>&#160;&#160;&#160;&#160;strTest.Format(&#34;%ls&#34;, &#34;Hello&#34;);<br/></div></div><br/><br/>Reference: <a target="_blank" href="http://msdn.microsoft.com/en-us/library/tcxf1dw6(VS.90).aspx" rel="external">http://msdn.microsoft.com/en-us/library/tcxf1dw6(VS.90).aspx</a>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=300</link>
			<title><![CDATA[Evaluating the performance of a stored proc]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Wed,10 Mar 2010 17:53:04 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=300</guid>
		<description><![CDATA[SET STATISTICS TIME { ON | OFF }<br/><br/>SET STATISTICS IO { ON | OFF }<br/>can be used to help do the IO count.<br/><br/>References:<br/><a target="_blank" href="http://msdn.microsoft.com/en-us/library/ms190287.aspx" rel="external">SET STATISTICS TIME (Transact-SQL)</a><br/><a target="_blank" href="http://msdn.microsoft.com/en-us/library/ms190356.aspx" rel="external">SET (Transact-SQL)</a>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=291</link>
			<title><![CDATA[Differences in behavior between SQLNCLI and MDAC]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Thu,04 Feb 2010 22:13:21 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=291</guid>
		<description><![CDATA[Following differences are listed in <a target="_blank" href="http://msdn.microsoft.com/en-us/library/ms131035.aspx" rel="external">Updating an Application to SQL Server Native Client from MDAC</a>:<br/><br/><div class="UBBPanel quotePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/quote.gif" style="margin:0px 2px -3px 0px" alt="引用内容"/> 引用内容</div><div class="UBBContent"><br/><ul style="list-style-type:decimal"><br/><li>If you use an ODBC o&#114; OLE DB call to start transactions, there is a difference in behavior between SQL Server Native Client and MDAC; transactions will begin immediately with SQL Server Native Client, but transactions will begin after the first database access using MDAC. This can affect the behavior of stored procedures and batches because SQL Server requires @@TRANCOUNT to be the same after a batch o&#114; stored procedure finishes execution as it was when the batch o&#114; stored procedure started. See Rollbacks and Commits in Stored Procedures and Triggers for more information.<br/><br/></li><li> With SQL Server Native Client, ITransactionLocal::BeginTransaction will cause a transaction to be started immediately. With MDAC the transaction start was delayed until the application executed a statement which required a transaction in implicit transaction mode. For more information, see SET IMPLICIT_TRANSACTIONS (Transact-SQL).<br/></li></ul><br/></div></div><br/><br/>This statement was a bit difficult for me to understand. After further research and testing, verified by comparing the results of oledb calls and results of sql calls from SQL Server Management Studio, I came to following conclusion: <br/><ul style="list-style-type:decimal"><br/><li>Within MDAC, <i>ITransactionLocal::StartTransaction</i> is basically an equivalent of <i>SET IMPLICIT_TRANSACTIONS ON</i>. This means the transaction will not start until one of the particular set of SQL statements executes. For the list of these statements, see <a target="_blank" href="http://msdn.microsoft.com/en-us/library/ms187807.aspx" rel="external">SET IMPLICIT_TRANSACTIONS (Transact-SQL) </a>. Do note <i>Sel&#101;ct</i> is one of the statements that will cause the start of a transaction, if it is not in a transaction yet.<br/><br/></li><li>Within SQLNCLI, <i>ITransactionLocal::StartTransaction</i> is basically an equivalent of <i>BEGIN TRANSACTION</i>, which means an immediate start of a new transaction. But it can not be used to start a nested transaction. If a session has a transaction active, the repeated call of StartTransaction will be ignored.<br/><br/></li><li>With this difference in mind, the time of a transaction for a stored procedure call using SQLNCLI is possibly slightly longer than it was within MDAC, but the difference is likely negligible. <br/><br/></li><li>Unless absolutely required, it is not recommended to have your own transaction management stuff in a stored procedure. It will increase unnecessary burden and is prone to human errors. See <a target="_blank" href="http://msdn.microsoft.com/en-us/library/ms187844.aspx" rel="external">Rollbacks and Commits in Stored Procedures and Triggers </a> for more info.<br/></li></ul><br/><br/>According to <a target="_blank" href="http://msdn.microsoft.com/en-us/library/aa213067%28SQL.80%29.aspx" rel="external">API Implicit Transactions </a><br/><div class="UBBPanel quotePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/quote.gif" style="margin:0px 2px -3px 0px" alt="引用内容"/> 引用内容</div><div class="UBBContent"><br/>OLE DB does not have a method to set implicit transaction mode specifically.<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;* Call the ITransactionLocal::StartTransaction method to start an explicit transaction.<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;* When you then call either the ITransaction::Commit o&#114; ITransaction::Abort method with fRetaining set to TRUE, OLE DB completes the current transaction and goes into implicit transaction mode. The connection remains in implicit transaction mode as long as you set fRetaining on ITransaction::Commit o&#114; ITransaction::Abort to TRUE.<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;* Call ITransaction::Commit o&#114; ITransaction::Abort with fRetaining set to FALSE to stop implicit transaction mode.<br/></div></div><br/>But my test is showing fRetaining MUST be false in ITransaction::Commit. This is proved by the MSDN library and actual testing (a TRUE value will result in error hr 0x8004d00f &#34;An invalid combination of flags was specified&#34;).<br/><br/>If that&#39;s true, it means in SQLNCLI OleDB 2005/2008, there is no way to set the Implicit Transaction Mode. Which is not really a big deal since explicit transaction is probably better for clearer understanding anyway.<br/><br/>Reference:<br/><a target="_blank" href="http://msdn.microsoft.com/en-us/library/ms187807.aspx" rel="external">SET IMPLICIT_TRANSACTIONS (Transact-SQL) </a><br/><a target="_blank" href="http://msdn.microsoft.com/en-us/library/ms131035.aspx" rel="external">Updating an Application to SQL Server Native Client from MDAC</a><br/><a target="_blank" href="http://support.microsoft.com/kb/198024" rel="external">INFO: Understanding ADO Transactions with MS SQL Server</a><br/><a target="_blank" href="http://msdn.microsoft.com/en-us/library/ms189336.aspx" rel="external">Nesting Transactions</a>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=281</link>
			<title><![CDATA[[zt] Comparing Memory Allocation Methods]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Tue,15 Dec 2009 18:26:59 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=281</guid>
		<description><![CDATA[<div class="majorTitle"><!----></div>
<div class="title">Comparing Memory Allocation Methods</div>
<!--Content type: HTML. Transform: webcollection2mtps.xslt.-->
<p><!----></p>
<p>The following is a brief comparison of the various memory allocation methods:</p>
<p><!----></p>
<ul>
    <li><a id="ctl00_MainContent_ctl01" href="http://msdn.microsoft.com/en-us/library/ms692727%28VS.85%29.aspx" onclick="javascript:Track('ctl00_MainContent_ctl00|ctl00_MainContent_ctl01',this);"><strong>CoTaskMemAlloc</strong></a></li>
    <li><a id="ctl00_MainContent_ctl02" href="http://msdn.microsoft.com/en-us/library/aa366574%28VS.85%29.aspx" onclick="javascript:Track('ctl00_MainContent_ctl00|ctl00_MainContent_ctl02',this);"><strong>GlobalAlloc</strong></a></li>
    <li><a id="ctl00_MainContent_ctl03" href="http://msdn.microsoft.com/en-us/library/aa366597%28VS.85%29.aspx" onclick="javascript:Track('ctl00_MainContent_ctl00|ctl00_MainContent_ctl03',this);"><strong>HeapAlloc</strong></a></li>
    <li><a id="ctl00_MainContent_ctl04" href="http://msdn.microsoft.com/en-us/library/aa366723%28VS.85%29.aspx" onclick="javascript:Track('ctl00_MainContent_ctl00|ctl00_MainContent_ctl04',this);"><strong>LocalAlloc</strong></a></li>
    <li><strong>malloc</strong></li>
    <li><strong>new</strong></li>
    <li><a id="ctl00_MainContent_ctl05" href="http://msdn.microsoft.com/en-us/library/aa366887%28VS.85%29.aspx" onclick="javascript:Track('ctl00_MainContent_ctl00|ctl00_MainContent_ctl05',this);"><strong>VirtualAlloc</strong></a></li>
</ul>
<p>Although the <strong>GlobalAlloc</strong>, <strong>LocalAlloc</strong>, and <strong>HeapAlloc</strong> functions ultimately allocate memory from the same heap, each provides a slightly different set of functionality. For example, <strong>HeapAlloc</strong> can be instructed to raise an exception if memory could not be allocated, a capability not available with <strong>LocalAlloc</strong>.  <strong>LocalAlloc</strong> supports allocation of handles which permit the underlying memory to be moved by a reallocation without changing the handle value, a capability not available with <strong>HeapAlloc</strong>.</p>
<p>Starting with 32-bit Windows, <strong>GlobalAlloc</strong> and <strong>LocalAlloc</strong> are implemented as wrapper functions that call <strong>HeapAlloc</strong> using a handle to the process's default heap. Therefore, <strong>GlobalAlloc</strong> and <strong>LocalAlloc</strong> have greater overhead than <strong>HeapAlloc</strong>.</p>
<p>Because the different heap allocators provide distinctive functionality by using different mechanisms, you must free memory with the correct function. For example, memory allocated with <strong>HeapAlloc</strong> must be freed with <a id="ctl00_MainContent_ctl06" href="http://msdn.microsoft.com/en-us/library/aa366701%28VS.85%29.aspx" onclick="javascript:Track('ctl00_MainContent_ctl00|ctl00_MainContent_ctl06',this);"><strong>HeapFree</strong></a> and not <a id="ctl00_MainContent_ctl07" href="http://msdn.microsoft.com/en-us/library/aa366730%28VS.85%29.aspx" onclick="javascript:Track('ctl00_MainContent_ctl00|ctl00_MainContent_ctl07',this);"><strong>LocalFree</strong></a> or <a id="ctl00_MainContent_ctl08" href="http://msdn.microsoft.com/en-us/library/aa366579%28VS.85%29.aspx" onclick="javascript:Track('ctl00_MainContent_ctl00|ctl00_MainContent_ctl08',this);"><strong>GlobalFree</strong></a>. Memory allocated with <strong>GlobalAlloc</strong> or <strong>LocalAlloc</strong> must be queried, validated, and released with the corresponding global or local function.</p>
<p>The  <strong>VirtualAlloc</strong> function allows you to specify additional options for memory allocation. However, its allocations use a page granularity, so using <strong>VirtualAlloc</strong> can result in higher memory usage.</p>
<p>The <strong>malloc</strong> function has the disadvantage of being run-time dependent. The <strong>new</strong> operator has the disadvantage of being compiler dependent and language dependent.</p>
<p>The  <a id="ctl00_MainContent_ctl09" href="http://msdn.microsoft.com/en-us/library/ms692727%28VS.85%29.aspx" onclick="javascript:Track('ctl00_MainContent_ctl00|ctl00_MainContent_ctl09',this);"><strong>CoTaskMemAlloc</strong></a> function has the advantage of working well in either C, C++, or Visual Basic. It is also the only way to share memory in a COM-based application, since MIDL uses <strong>CoTaskMemAlloc</strong> and  <a id="ctl00_MainContent_ctl10" href="http://msdn.microsoft.com/en-us/library/ms680722%28VS.85%29.aspx" onclick="javascript:Track('ctl00_MainContent_ctl00|ctl00_MainContent_ctl10',this);"><strong>CoTaskMemFree</strong></a> to marshal memory.</p>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=266</link>
			<title><![CDATA[error C2371: &#39;WCHAR&#39; : redefinition]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Mon,16 Nov 2009 17:00:11 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=266</guid>
		<description><![CDATA[I got this error today, when trying to switch an existing oledb project to use the new Microsoft SQL Server Native Client (referred to hereafter as SNAC) 10 instead of previous Microsoft Data Access Components (MDAC), to get the support of the new features introduced in MS SQL Server 2005 and 2008. For more info about this switching, see <a target="_blank" href="http://blogs.msdn.com/sqlnativeclient/archive/2008/02/27/microsoft-sql-server-native-client-and-microsoft-sql-server-2008-native-client.aspx" rel="external">Microsoft SQL Server Native Client and Microsoft SQL Server 2008 Native Client</a>.<br/><br/>As the fist step to introduce the definitions of SNAC 10, I added #include &lt;sqlncli.h&gt; to the end of include list, immediately the compiler started to report following errors:<br/><br/><div class="UBBScreen"><br/>1&gt;Compiling...<br/>1&gt;DBColumnSet.cpp<br/>1&gt;c:\devel\mhuangtfs\3rdparty\microsoft\sqlsdk\10.0\main\include\sqlncli.h(2736) : error C2371: &#39;WCHAR&#39; : redefinition; different basic types<br/>1&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;c:\program files\microsoft sdks\windows\v6.0a\include\winnt.h(289) : see declaration of &#39;WCHAR&#39;<br/></div><br/><br/>The relevant codes involved include: <br/><br/>sqlncli.h<br/><div class="UBBSourceCode"><br/>#ifdef UNICODE<br/>typedef wchar_t&nbsp;&nbsp;DBCHAR;<br/>#else<br/>typedef char DBCHAR;<br/><br/>#endif<br/></div><br/><br/>winnt.h<br/><div class="UBBSourceCode"><br/>#ifndef _MAC<br/>typedef wchar_t WCHAR;&nbsp;&nbsp;&nbsp;&nbsp;// wc,&nbsp;&nbsp; 16-bit UNICODE character<br/>#else<br/>// some Macintosh compilers don&#39;t define wchar_t in a convenient location, o&#114; define it as a char<br/>typedef unsigned short WCHAR;&nbsp;&nbsp;&nbsp;&nbsp;// wc,&nbsp;&nbsp; 16-bit UNICODE character<br/>#endif<br/></div><br/><br/>Various workarounds such as <a target="_blank" href="http://www.dotnet247.com/247reference/msgs/36/183712.aspx" rel="external">this one</a> found from Internet were attempted but only to no avail. Eventually I found this article <a target="_blank" href="http://msdn.microsoft.com/en-us/library/ms131291.aspx" rel="external">Using the SQL Server Native Client Header and Library Files </a>. After I added in the macro definition, the compiler worked. Since I am using Oledb, my code is like below:<br/><div class="UBBSourceCode"><br/>#define _SQLNCLI_OLEDB_<br/>#include &lt;sqlncli.h&gt;<br/></div>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=258</link>
			<title><![CDATA[Function Template]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Sun,01 Nov 2009 18:35:14 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=258</guid>
		<description><![CDATA[Function template is compiled on demand. As function template is compiled on demand, the compiler needs a way to know the actual type to substitute the template parameter. It seems the only two ways are: either explicitly specify the type as in the example you have given, o&#114; make the type being used for one of the function parameters. <br/><br/>The chances are most of the time you do not even need to specify the type that you want the compiler to use - it will substitute them correctly, and complain if it finds an error. Each usage is compiled on demand, as and when the compiler encounters the references in the code.<br/><br/>However, you do need to specify the type if you don&#39;t reference the type as one of the parameter of the function prototype. <br/><br/>See following example:<br/><div class="UBBSourceCode"><br/>template&lt;typename T&gt;<br/>void HelloTemplate()<br/>{<br/>&#160;&#160;&#160;&#160;T tTemp = _T(&#34;hello&#34;);<br/>&#160;&#160;&#160;&#160;printf(&#34;%s&#34;, tTemp);<br/>}<br/><br/><br/>HelloTemplate();<br/><br/></div><br/>The compiler will produce following error:<br/><div class="UBBScreen"><br/>error C2783: &#39;void HelloTemplate(void)&#39; : could not deduce template argument for &#39;T&#39;<br/></div><br/>The reason appears to be the compiler is unable to determine what type is the T actually. <br/>The code will work if you modify the line calling the function to be as below:<br/><div class="UBBSourceCode"><br/>HelloTemplate&lt;LPCTSTR&gt;();<br/></div><br/><br/>Another case it will work is change the function prototype like below:<br/><div class="UBBSourceCode"><br/>template&lt;typename T&gt;<br/>void HelloTemplate(T tParam)<br/>{<br/>&#160;&#160;&#160;&#160;printf(&#34;%s&#34;, tParam);<br/>}<br/><br/>HelloTemplate(_T(&#34;Hello&#34;));<br/></div>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=252</link>
			<title><![CDATA[Addressing MaxReceivedMessageSize issues]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Sun,25 Oct 2009 19:18:18 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=252</guid>
		<description><![CDATA[You may come across this exception when calling a web service from a C# program:<br/>“<i>System.ServiceModel.CommunicationException : The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.</i>”<br/><br/>This has something to do with the buffer size limit, the full explanation is in this blog: <br/><a target="_blank" href="http://craigrandall.net/archives/2009/04/maxreceivedmessagesize/" rel="external">http://craigrandall.net/archives/2009/04/maxreceivedmessagesize/</a>. <br/><br/>Remember to up&#100;ate all three settings: maxBufferSize, maxBufferPoolSize, and maxReceivedMessageSize. <br/><br/>example app.config:<br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;binding name=&#34;IRESSSoap&#34; closeTimeout=&#34;00:10:00&#34; openTimeout=&#34;00:10:00&#34;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;receiveTimeout=&#34;00:10:00&#34; sendTimeout=&#34;00:10:00&#34; allowCookies=&#34;false&#34;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bypassProxyOnLocal=&#34;false&#34; hostNameComparisonMode=&#34;StrongWildcard&#34;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;maxBufferSize=&#34;1000000&#34; maxBufferPoolSize=&#34;1000000&#34; maxReceivedMessageSize=&#34;1000000&#34;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;messageEncoding=&#34;Text&#34; textEncoding=&#34;utf-8&#34; transferMode=&#34;Buffered&#34;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;useDefaultWebProxy=&#34;true&#34;&gt;<br/></div></div>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=237</link>
			<title><![CDATA[Resource compiler: error RC2173]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Tue,15 Sep 2009 22:22:29 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=237</guid>
		<description><![CDATA[This is a very weird problem I came across the other day. <br/><br/>I have a resource file whose first a few lines are as below:<br/><div class="UBBSourceCode"><br/>// Microsoft Visual C++ generated resource script.<br/>//<br/>#include &#34;IressRes.h&#34;<br/><br/>#define APSTUDIO_READONLY_SYMBOLS<br/>/////////////////////////////////////////////////////////////////////////////<br/>//<br/>// Generated from the TEXTINCLUDE 2 resource.<br/>//<br/>#include &#34;afxres.h&#34;<br/>#include &lt;CmdSym.h&gt;<br/>/////////////////////////////////////////////////////////////////////////////<br/>#undef APSTUDIO_READONLY_SYMBOLS<br/><br/>/////////////////////////////////////////////////////////////////////////////<br/>// Neutral resources<br/><br/>#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)<br/>#ifdef _WIN32<br/>LANGUAGE&nbsp;&nbsp;LANG_NEUTRAL, SUBLANG_NEUTRAL<br/>#pragma code_page(1252)<br/>#endif //_WIN32<br/></div><br/><br/>When I tried to compile, I got following errors from resource compiler:<br/><br/><div class="UBBScreen"><br/>1&gt;.\Iress.rc(21) : error RC2173 : file .\Iress.rc is not a valid animated cursor/icon RIFF file<br/></div><br/><br/>A search on Google on the reported error RC2173 returns nothing useful. Besides the error message is making no sense whatsoever, as there is not any animated curson/icon in the app at all. <br/><br/>After two hours fiddling around with the code, I found if I removed line 20 and line 23, the compiler would work. However, this does not make any sense. Almost driven crazy by this, I accidentally saved the file forcing to use Windows CR-LF as the line-ending (set in &#34;Advanced Save Options&#34; dialog) character, as I vaguely remembered for once VS asked me about that CR-LF thing at one stage, and only found out after that, the compiling succeeded. <br/><br/>After comparing the source code of the involved .rc file, it appears the problem was caused by the mismatching return character at one line of the resource file. <br/><br/><i>A bit backgournd about the new line character: <br/>On Windows/DOS, a new line is represented by \r\n (i.e. 0x0D0A), while on Unix-like, it is a single \n (i.e. 0x0A), and \r (0x0D) on Mac.</i><br/><br/>In this case, for some reason, the line that caused the problem was ended with a single 0x0D, missing the paring 0x0A. <br/><br/>So forcing VS to save it using Windows CR-LF fix this newline character, and subsequently leads to the success of the resource compiler. <br/><br/>This is one of the weirdest problems I have ever seen with resource compiler. The error message and reported line position are not helpful at all, and it does not make sense for the compiler to fail just because of the missing 0x0A. I can only blame it on the lameness of the MS Resource Compiler.<br/><br/>Having said that, I suspected the missing of 0x0a in the first place is caused by some bugs of TFS.<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=229</link>
			<title><![CDATA[The right permission to assigned to pjblog ]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Sun,30 Aug 2009 17:07:05 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=229</guid>
		<description><![CDATA[READ and Write permission must be assigned to the database folder otherwise checkuser.asp will complain unable to run some database operation (some up&#100;ate).<br/><br/>READ and Write permission must be assigned to Post and Cache folder. Otherwise, it will complain 3002: could not open file. ]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=223</link>
			<title><![CDATA[Removing unwanted source control binding]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Tue,18 Aug 2009 21:38:33 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=223</guid>
		<description><![CDATA[Sometimes after you fiddled around with your projects within a solution by adding, removing, moving files around etc, you will find the newly added project may not be bound to source control any more, while its source files are still bound, when this happened, it may turn out that you can&#39;t find the menu &#34;Add Sel&#101;cted Project to Source Control&#34; any wh&#101;re. <br/><br/>When this happened, there are two ways to add the project back to source control: <br/><br/>1. Manually added the .vcproj file into source control as an new item. <br/><br/>2. o&#114; remove existing binding information to make the &#34;add project to source control&#34; appear again. Namely following lines appearing in a .vcproj file in Bold font must be removed:<br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">&lt;VisualStudioProject<br/>&#160;&#160;&#160;&#160;ProjectType=&#34;Visual C++&#34;<br/>&#160;&#160;&#160;&#160;Version=&#34;9.00&#34;<br/>&#160;&#160;&#160;&#160;Name=&#34;Price&#34;<br/>&#160;&#160;&#160;&#160;ProjectGUID=&#34;{147EEF02-76DD-4668-9C99-51534E8A6A32}&#34;<br/>&#160;&#160;&#160;&#160;RootNamespace=&#34;Price&#34;<br/><strong>SccProjectName=&#34;SAK&#34;<br/>&#160;&#160;&#160;&#160;SccAuxPath=&#34;SAK&#34;<br/>&#160;&#160;&#160;&#160;SccLocalPath=&#34;SAK&#34;<br/>&#160;&#160;&#160;&#160;SccProvider=&#34;SAK&#34;</strong><br/>&#160;&#160;&#160;&#160;Keyword=&#34;MFCDLLProj&#34;<br/>&#160;&#160;&#160;&#160;TargetFrameworkVersion=&#34;131072&#34;<br/>&#160;&#160;&#160;&#160;&gt;<br/></div></div><br/><br/>Also remove the associated .vspscc file. <br/><br/>After that, loading the solution will popup a warning dialog as you either remove the binding info for this project from the solution, o&#114; reuse the binding info from the solution. Choose to remove and then, your project will appear unbound from the source control. Now check the main menu and you should see the &#34;add project to source control&#34; again. ]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=222</link>
			<title><![CDATA[LNK2001: &#34;int __cdecl _AfxInitManaged(void)&#34;]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Tue,18 Aug 2009 16:01:24 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=222</guid>
		<description><![CDATA[I got this error when I moved all source files (.h, .cpp, .rc) of a project from the o&#114;iginal directory to another child directory, and then added them back to the project. <br/><br/>The problem is caused due to the fact that re-adding stdafx.cpp removed the preset configuration with respect to precompiled header. As explained in following thread:<br/><br/><a target="_blank" href="http://social.msdn.microsoft.com/forums/en-US/vclanguage/thread/b3aa10fa-141b-4a03-934c-7e463f92b2a5/" rel="external">http://social.msdn.microsoft.com/forums/en-US/vclanguage/thread/b3aa10fa-141b-4a03-934c-7e463f92b2a5/</a><br/><br/><div class="UBBPanel quotePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/quote.gif" style="margin:0px 2px -3px 0px" alt="引用内容"/> 引用内容</div><div class="UBBContent"><br/>The fact that precompiled headers is solution wide and project wide property doesn&#39;t mean that the setting should be the same for all source files. Right click and choose properties for each and every one of your .cpp files, set the stdafx.cpp one to cr&#101;ate and all other to use.</div></div><br/><br/>In detail, to fix the problem, from the solution pane, right-click the stdafx.cpp and open its properties, sel&#101;ct All Configurations, then go to C/C++ -- Precompiled Headers page, and set <strong>Cr&#101;ate/Use Precompiled Header</strong> property to be <strong>Cr&#101;ate Precompiled Header (Yc)</strong>.<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=219</link>
			<title><![CDATA[书签： Scott Hanselman&#39;s ComputerZen.com]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Mon,10 Aug 2009 15:51:23 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=219</guid>
		<description><![CDATA[<a target="_blank" href="http://www.hanselman.com/blog/ScottHanselmans2007UltimateDeveloperAndPowerUsersToolListForWindows.aspx" rel="external">Scott Hanselman&#39;s ComputerZen.com</a><br/><br/>including the very handy Rocky Scroll for VS 2005/2008.]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=206</link>
			<title><![CDATA[Run Command Prompt Window as Administrator]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Mon,27 Jul 2009 21:16:59 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=206</guid>
		<description><![CDATA[Lazy to type “CMD” o&#114; pressing any keyboard keys just to elevate the opened command prompt window with full administrator credentials and privileges mode? <br/><br/><strong>Windows Vista</strong><br/>The following registry hack for Windows Vista will allow you to open an elevated command window by simply right click on Computer (formerly known as My Computer in Windows XP) icon at Start Menu o&#114; Desktop, and sel&#101;ct Run Command Prompt as Administrator from the contextual menu.<br/><br/>To add and place a new menu item to right click context menu for Computer so that whenever you right click on the icon, a contextual menu item of Run Command Prompt as Administrator will be shown, and then you can straight away click on the entry to immediately open the elevated command prompt, unzip the enclosed .reg file from the attached zip and then import it into the registry database.<br/><br/><br/><br/><strong>Windows 7</strong> <br/>Manual way: <br/>Search Bar<br/>1. Click on Start and type CMD in search bar<br/><br/>2. Now press Ctrl+Shift+Enter<br/><br/>3. This should bring elevated command prompt with full Administrators rights. <br/><br/>Add Elevated Command Prompt Option in Right Click Context Menu of Folder in Windows 7<br/>1. <img src="http://www.bluestrait.com/blog/images/download.gif" alt="下载文件" style="margin:0px 2px -4px 0px"/> <a href="http://www.bluestrait.com/blog/attachments/month_0907/12009727211651.zip" target="_blank">Downoad</a> and unzip the enclosed reg file.<br/><br/>2. Right Click on AddElevatedCMDtoFolder.reg and sel&#101;ct Merge from context menu.<br/><br/>3. Accept UAC prompt<br/><br/>4. Now Right click on any folder to very “Open Command Window Here (Administrator)” option is added o&#114; not.<br/><br/>References: <br/><a target="_blank" href="http://www.blogsdna.com/2226/windows-7-add-elevated-command-prompt-option-in-right-click-context-menu.htm" rel="external">http://www.blogsdna.com/2226/windows-7-add-elevated-command-prompt-option-in-right-click-context-menu.htm</a>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=202</link>
			<title><![CDATA[A on-the-fly localizing strategy]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Tue,21 Jul 2009 21:56:54 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=202</guid>
		<description><![CDATA[<a href="http://stackoverflow.com/questions/751094/loading-caption-of-controls-from-resource-dll" target="_blank" rel="external">http://stackoverflow.com/questions/751094/loading-caption-of-controls-from-resource-dll</a><br/><br/>I work on a large localized MFC project. Here is our strategy:<br/><br/>&nbsp;&nbsp; 1.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A dictionary of key -&gt; localized string, specific to each language. There are a few ways to implement this, more later.<br/><br/>&nbsp;&nbsp; 2.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Control IDs o&#114; captions in the dialog resource are set to the key used to look up the translation<br/><br/>&nbsp;&nbsp; 3.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cr&#101;ate a base CDialog, CFormView, etc and in at init call ::EnumChildWindows. In the callback, look up the translation and replace the control&#39;s caption with the translation.<br/><br/>For your dictionary, you can go a few ways.<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If you want to rely on the built-in localized resource sel&#101;ction and string tables, you have to somehow match the control to the string ID. You can carefully ensure that the control ID matches the string ID, o&#114; you can ASCII-encode the ID in the caption and then use atoi to parse the int value.<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;You can forgo the built-in localized string table deal and maintain your own string -&gt; string dictionary for each language. This lets you set the caption to the non-localized string in the resource which makes layout easier (although you&#39;ll still need to test in all languages.) It will require you to do your own &#34;dependency injection&#34; to make sure you load up the right dictionary. You want to be able to release up&#100;ated/additional languages without rebuilding the core binaries.<br/><br/><br/><a href="http://www.codeproject.com/KB/locale/MultiLangSupportMFCExtDLL.aspx" target="_blank" rel="external">http://www.codeproject.com/KB/locale/MultiLangSupportMFCExtDLL.aspx</a><br/><br/><a href="http://msdn.microsoft.com/en-us/library/8fkteez0%28VS.71%29.aspx" target="_blank" rel="external">http://msdn.microsoft.com/en-us/library/8fkteez0%28VS.71%29.aspx</a><br/>According to this, <br/>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=196</link>
			<title><![CDATA[Vista/Win 2008: registering an automation server]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Sun,12 Jul 2009 17:53:39 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=196</guid>
		<description><![CDATA[On Vista o&#114; Vista-based OS (Windows 2008 server e.g.), when running an application from visual studio, which supports automation following line will produce errors:<br/><br/><div class="UBBSourceCode"><br/>m_server.Up&#100;ateRegistry(OAT_DISPATCH_OBJECT);<br/>COleObjectFactory::Up&#100;ateRegistryAll();<br/>AfxOleRegisterTypeLib(AfxGetInstanceHandle(), _tlid);<br/></div><br/><br/><div class="UBBScreen"><br/>Error: failed setting key &#39;Phonebook.Document\CLSID&#39; to value &#39;{6309D913-88FF-4E2D-AC8B-E2FD580D527C}&#39;.<br/></div><br/><br/>As a result, the attempt to call this automation application from any other automation client app will fail with an error unable to cr&#101;ate the object. For example,&nbsp;&nbsp;the test using following simple VBScript will produce error: <br/><div class="UBBSourceCode"><br/>set wshell = Cr&#101;ateObject(&#34;Wscript.shell&#34;) <br/><br/>Dim obj<br/>Set obj = Cr&#101;ateObject(&#34;Phonebook.Document&#34;)<br/>obj.ShowWindow()<br/><br/>wscript.sleep 10000<br/></div><br/><br/><div class="UBBScreen"><br/>Error 800A01AD <br/><img src="http://www.computerperformance.co.uk/images/code/code_146.jpg" border="0" alt=""/><br/></div><br/><br/>The problem appears to be Vista&#39;s annoying UAC (User Account Control) policy. This is preventing the running of debug application registering the server component in registry. <br/><br/>My workaround is to after building the application, run the .exe from Windows explorer, using &#34;Run as administrator&#34; from righ-click menu. ]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=186</link>
			<title><![CDATA[Login failed for user xxx to SQL Server 2008]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Tue,07 Jul 2009 21:19:24 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=186</guid>
		<description><![CDATA[On Windows 2008 Server (64bit), Tried to connect to the database using SQL server Management Studio 2008 using Windows Authentication, receiving an error: <br/><br/><div class="UBBScreen"><br/>Cannot connect to (local).<br/><br/>===================================<br/><br/>Login failed for user &#39;DEVEL\mhuang&#39;. (.Net SqlClient Data Provider)<br/><br/>------------------------------<br/>For help, click: <a href="http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server" target="_blank" rel="external">http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server</a>&amp;EvtSrc=MSSQLServer&amp;EvtID=18456&amp;LinkId=20476<br/><br/>------------------------------<br/>Server Name: (local)<br/>Error Number: 18456<br/>Severity: 14<br/>State: 1<br/>Line Number: 65536<br/><br/></div><br/><br/>Found the trick here to fix this problem is to I should have started SQL Management Studio as Administrator. This issue only occurs on Vista/2008 Server R2.<br/><br/>[2010-6-29 Up&#100;ate] Similar issue is occurring again after I switched back from SQL authentication to Windows Authentication and this time, the trick above does not work. <br/><br/>The cause is because the windows user account was not set up as a login in sql server. The detailed solution is in <a target="_blank" href="http://docs.google.com/document/pub?id=1UO1v69QcWdgwifXwfB6EGZg_YbiKma5cyx4XTGZuM8A" rel="external">http://docs.google.com/document/pub?id=1UO1v69QcWdgwifXwfB6EGZg_YbiKma5cyx4XTGZuM8A</a>.<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=182</link>
			<title><![CDATA[Script error in VC++ wizards after installing ]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Mon,29 Jun 2009 16:06:43 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=182</guid>
		<description><![CDATA[<p>You might have script errors in VC++ wizards after installing IE8, for example, trying to add a member variable using class wizard, or when you double click inside a dialog normally we should taken to corresponding file but instead we get a script error&hellip;</p>
<div style="width: 458px;" class="wp-caption alignnone" id="attachment_1829"><img width="448" height="288" src="http://nibuthomas.files.wordpress.com/2009/04/scripterror.png?w=448&amp;h=288" alt="Script error" title="Script error" class="size-full wp-image-1829" />
<p class="wp-caption-text">Script error</p>
</div>
<p>Pretty strange isn&rsquo;t it. Well as per <a href="http://blogs.msdn.com/vcblog/archive/2009/03/28/some-vs2005-and-vs2008-wizards-pop-up-script-error.aspx" title="VC++ Team Blog - Script error bug"><font color="#c9740a">VC++ team blogs</font></a> this bug due to IE8 installation. Reason for this behavior is as explained below (quoted from VC++ team blogs&hellip;)</p>
<address><span style="font-family: Calibri; font-size: small;"><font size="2">The VC++ Wizards Engine implements the IInternetSecurityManager interface.&nbsp; In this implementation it allows or disallows specific actions under certain policies that Internet Explorer queries it about.&nbsp; In IE8 a custom Security Manager now also gets queried about the URLACTION_ACTIVEX_OVERRIDE_REPURPOSEDETECTION policy which IE previously did not delegate to custom security managers when the engine wasn&rsquo;t running in the iexplore.exe process.&nbsp; The IE engine then fails this action because we don&rsquo;t have a policy entry for it in the custom zone for VC++ Wizards. We are still investigating whether this change in IE8 is by design and will possibly be addressing it by a fix in either the Wizard or IE components depending on the outcome.</font></span></address>
<p>And according to this blog, following fix should work&hellip;.</p>
<address class="MsoNoSpacing"><span style="font-family: Calibri; font-size: small;"><font size="2">Please follow the following steps:</font></span></address>
<ul>
    <li>
    <address class="MsoNoSpacing"><span style="font-family: Calibri; font-size: small;"><font size="2">Open regedit (on a 64-bit OS, open the 32-bit regedit)</font></span></address>
    </li>
    <li>
    <address class="MsoNoSpacing"><span style="font-family: Calibri; font-size: small;"><font size="2">Under &ldquo;HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet<br />
    Settings\Zones&rdquo;, create a new key called 1000 (if it isn&rsquo;t already there)</font></span></address>
    </li>
    <li>
    <address class="MsoNoSpacing"><span style="font-family: Calibri; font-size: small;"><font size="2">Under 1000, create a DWORD entry with:</font></span></address>
    <ul>
        <li>
        <address class="MsoNoSpacing"><span style="font-family: 'Courier New';"><span><span style="font-size: small;"><font size="2">o</font></span><span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;"> </span></span></span><span style="font-family: Calibri; font-size: small;"><font size="2">Name = 1207</font></span></address>
        </li>
        <li>
        <address class="MsoNoSpacing"><span style="font-family: 'Courier New';"><span><span style="font-size: small;"><font size="2">o</font></span><span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;"> </span></span></span><span style="font-family: Calibri; font-size: small;"><font size="2">Type = REG_DWORD</font></span></address>
        </li>
        <li>
        <address class="MsoNoSpacing"><span style="font-family: 'Courier New';"><span><span style="font-size: small;"><font size="2">o</font></span><span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal; -x-system-font: none;"> </span></span></span><span style="font-family: Calibri; font-size: small;"><font size="2">Data = 0&times;000000</font></span></address>
        </li>
    </ul>
    </li>
</ul>
<p>Just now I had this problem hence I had to use this fix and it works.</p>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=179</link>
			<title><![CDATA[How to remote root login over ssh]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Wed,17 Jun 2009 19:24:16 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=179</guid>
		<description><![CDATA[In /etc/ssh/sshd_config there is a line as below:<br/><br/>PermitRootLogin no<br/><br/>Change &#34;no&#34; to &#34;yes&#34; then restart sshd service to do the trick. <br/>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=170</link>
			<title><![CDATA[C++ FAQ LITE]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Mon,11 May 2009 21:11:28 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=170</guid>
		<description><![CDATA[<a href="http://www.parashift.com/c++-faq-lite/" target="_blank" rel="external">http://www.parashift.com/c++-faq-lite/</a>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=167</link>
			<title><![CDATA[Use regular expressions to remove blank lines]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Mon,27 Apr 2009 13:47:59 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=167</guid>
		<description><![CDATA[<h1 class="pthead">Remove blank lines</h1>
<p>A question which is frequently asked is &quot;I have a lot of blank lines in my file and I don't want to go through and manually delete them. Is there an easier way to do this?&quot;</p>
<p>The answer: <strong>YES!</strong></p>
<p>In versions of UltraEdit that support Perl-compatible regular expressions, you can use the following Perl-compatible regular expression in DOS/Unix/Mac formatted-files. You can enable Perl-compatible regular expressions under Advanced -&gt; Configuration -&gt; Search -&gt; Regular Expression engine.</p>
<p>&nbsp;</p>
<p>Replace: &quot;<strong>^\r?\n?$</strong>&quot; (without the quotes)<br />
With &quot;&quot; (without the quotes - i.e. nothing).</p>
<p>In previous versions of UltraEdit, to delete blank lines you can use a regular expression replace as follows: Find What: &quot;<strong>^p$</strong>&quot; (without the quotes)<br />
Replace With: &quot;&quot; (without the quotes - i.e. nothing).</p>
<p>&nbsp;</p>
<h1 class="sub">Removing Blank lines</h1>
<!-- STEP ONE -->
<p>&nbsp;</p>
<div class="sectionhead">Step 1: Determine the file(s) that contain blank lines</div>
<p class="paragraph_text"><img border="0" src="http://www.ultraedit.com/assets/images/powertips/ue/deleteblanklines1.png" alt="" /></p>
<!-- STEP TWO -->
<p>&nbsp;</p>
<div class="sectionhead">Step 2: Open the Replace dialog</div>
<p class="paragraph_text">You may open the replace dialog using the shortcut (CTRL + R) or by going to the search menu and clicking on &quot;Replace&quot;.</p>
<p class="paragraph_text">To delete blank lines you can use a regular expression replace as follows:<br />
&nbsp;</p>
<p>Find What: &quot;^p$&quot; (without the quotes)<br />
Replace With: &quot;&quot; (without the quotes - i.e. nothing).<br />
<br />
Note: You MUST select &quot;Regular Expressions.&quot; Also, &quot;UltraEdit style expressions&quot; must be selected under Advanced -&gt; Configuration -&gt; Search -&gt; Regular Expression Engine.</p>
<p class="paragraph_text">Depending on your circumstances, the &quot;Replace Where&quot; option you select may vary.</p>
<p class="paragraph_text"><img border="0" src="http://www.ultraedit.com/assets/images/powertips/ue/deleteblanklines2.png" alt="" /></p>
<!-- STEP THREE -->
<p>&nbsp;</p>
<div class="sectionhead">Step 3: Your blank lines are gone!</div>
<p class="paragraph_text">Please note, you may have to run the &quot;Replace All&quot; multiple times to ensure all blank lines are removed. Because of the way the regular expression works, the replace will not replace all blank lines that are grouped together.</p>
<p class="paragraph_text"><img border="0" src="http://www.ultraedit.com/assets/images/powertips/ue/deleteblanklines3.png" alt="" /></p>
<p class="paragraph_text">&nbsp;</p>
<p class="paragraph_text"><em><strong>NOTE:</strong></em> <strong><em>From my experience, I&nbsp;have found &quot;^\r?\n?&quot; works in TextPad, but not &quot;^\r?\n?$&quot;. It seems TextPad does not understand &quot;$&quot;.</em></strong></p>
<p class="paragraph_text">&nbsp;</p>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=157</link>
			<title><![CDATA[[zt] Which process listens to this port (in Solari]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Tue,31 Mar 2009 16:31:40 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=157</guid>
		<description><![CDATA[If you have &#39;lsof&#39; installed, it is very easy to find out which process is listening at certain port. However, in Solaris, it may not be so obvious. This is the question my friend asked me and I wrote a short script (listen.sh) for him. Basically it runs &#39;pfile&#39; over all the processes listed in /proc (except process 0, which is the sched) <br/><br/>#! /bin/sh<br/><br/>if [ $# -ne 1 ]; then<br/>&nbsp;&nbsp;echo &#34;Usage: $0 &#34;<br/>&nbsp;&nbsp;exit 1<br/>fi<br/>listen=$1<br/><br/><br/>PATH=/usr/bin:/bin<br/>export PATH<br/><br/><br/>#<br/># skip process 0<br/>#<br/>cd /proc<br/>for i in [1-9][0-9]*<br/>do<br/>&nbsp;&nbsp;pfiles $i | nawk -v listen=$listen &#39;<br/>&nbsp;&nbsp;&nbsp;&nbsp;BEGIN {<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;found=0<br/>&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;NR==1 {<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;process=$0<br/>&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;/sockname/ &amp;&amp; $NF == listen {<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;getline<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( ! /peername/ ) {<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;found=1<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;END {<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ( found == 1 ) {<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf(&#34;%s\n&#34;,process)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br/>&nbsp;&nbsp;&nbsp;&nbsp;}&#39;<br/>done<br/><br/><br/>For example:<br/># ./listen.sh 22<br/>29626: /usr/lib/ssh/sshd<br/>#<br/><br/>this script is great - just what I needed! I adopted it in the following way such that it won&#39;t output error messages of processes which the uses who runs this script does not have access to, modify the line<br/>pfiles $i 2&gt; /dev/null | nawk ...<br/><br/>such that strerr will be redirected to /dev/null<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=142</link>
			<title><![CDATA[Replacing with a new line character]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Thu,05 Feb 2009 15:39:06 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=142</guid>
		<description><![CDATA[In vi, hit ctrl+v then tap return (enter). This pastes in a ^M which is actually a newline character.<br/><br/>It will look like below for example: <br/><br/>:%s /^@/^M/g<br/><br/>This is to replace some strange control character (Ctrl-@) with a new line character.]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=120</link>
			<title><![CDATA[How to set the output of a command to a variable]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Fri,28 Nov 2008 20:51:30 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=120</guid>
		<description><![CDATA[to set the output of a command to a variable in DOS extension:<br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">FOR /F &#34;tokens=*&#34; %%R IN (&#39;PROGRAM.EXE /SWITCH&#39;) DO SET VAR=%%R</div></div>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=117</link>
			<title><![CDATA[Remove ^M and other control characters in vi]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Tue,11 Nov 2008 09:03:48 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=117</guid>
		<description><![CDATA[To remove the ^M characters at the end of all lines in vi, use:<br/><br/>:%s/^V^M//g<br/><br/>The ^v is a CONTROL-V character and ^m is a CONTROL-M. When you type this, it will look like this:<br/><br/>:%s/^M//g<br/><br/>In UNIX, you can escape a control character by preceeding it with a CONTROL-V. The :%s is a basic search and replace command in vi. It tells vi to replace the regular e&#173;xpression between the first and second slashes (^M) with the text between the second and third slashes (nothing in this case). The g at the end directs vi to search and replace globally (all occurrences).Remove ^M characters at end of lines in vi]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=69</link>
			<title><![CDATA[How to link a directory outside htdocs to Apache]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Tue,19 Aug 2008 09:56:38 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=69</guid>
		<description><![CDATA[Use alias directive, for example: <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">&nbsp;&nbsp;&nbsp;&nbsp;<br/>Alias /sharedfiles/ &#34;D:\Personal\Video\2008BeijingOpening/&#34;&nbsp;&nbsp;&nbsp;&nbsp; <br/></div></div><br/><br/>Note the trailing slash is a backward slash instead of forward slash. This is important.<br/><br/>After that, you should be able to access the content in that directory by using a url like below: <br/><a href="http://" target="_blank" rel="external">http://</a>&lt;host&gt;:&lt;port&gt;/shardfiles/&lt;file name&gt;]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=41</link>
			<title><![CDATA[Timezone issue with PJBlog]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Wed,23 Jul 2008 12:08:49 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=41</guid>
		<description><![CDATA[It is quite common that the web server is hosted on a different physical location from wh&#101;re you run it, sometimes even on a different continent. This expose a problem when your server side code is getting system time for timestamps, which later got displayed on the web page and confuse you. <br/><br/>I believe that means your code should be flexible enough to handle this sort of situation, at least customizable. <br/><br/><a href="http://www.pjhome.net" target="_blank">PJBlog</a>, the server hosting this blog, unfortunately does not seem to be capable to handle this issue. It uses now() function widely to get timestamp from the server and set it to the posts, articles, comments, etc. For me, it is a problem as my server is located in US, while I am working from Australia. <br/><br/>I checked the source code of <a href="http://www.pjhome.net" target="_blank">PJBlog</a>, and it seems there is no any place that you can work around it, except to modify the code wh&#101;re now() function is called, so that a correct timezone difference (17 hours in my case) will be added to return value from now() before it got used by the application. <br/><br/>The attempt to make a &#34;global&#34; function so that it can be included in each asp script that has now() referenced failed too, due to some recursive include issue among these pages. Shame.]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=37</link>
			<title><![CDATA[.NET framwork issue with IIS on Windows XP]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Mon,21 Jul 2008 18:10:39 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=37</guid>
		<description><![CDATA[Had following issues:<br/><i>Server Application Unavailable</i><br/><br/>on asp.net page, but asp seems fine. This is indicating .net framework issue.<br/>Event log is showing:<br/><br/><i>Failed to execute request because the App-Domain could not be cr&#101;ated. Error: 0x80131902 </i><br/><br/>also stopping iis has failed, and event viewer is showing:<br/><br/><i>Failed while restarting W3SVC.&nbsp;&nbsp;Error code: 0x8007041d</i><br/><br/>Fixes: <br/>1. use previous blog to cr&#101;ate a new site on IIS, set the root folder.<br/>2. right-click the root folder and set the folder to be web shared as &#34;/&#34; for the new site, in the properties window of the folder.<br/>3. uninstalled .net framework 1.0<br/>4. ran <br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727&gt; aspnet_regiis.exe -i</div></div><br/>to install 2.0 framework only<br/>5. ran <br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">C:\WINDOWS\system32&gt;iisreset</div></div> to reset/restart IIS. <br/>6. after that, in IIS service panel, stop default site, and start the new site. ]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=36</link>
			<title><![CDATA[[zt] Multiple websites using IIS 5.1 on Windows XP]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Mon,21 Jul 2008 17:10:59 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=36</guid>
		<description><![CDATA[Ever wondered how you can set up multiple websites in Windows XP (i.e. Proffesional)?<br/>Did you wonder at least if it possible?<br/><br/>Well, it is. Microsoft has it’s own way of hiding things…from novice users, so that the system will not crash down… Hmm, just a small thought: is this how you should protect something? By not letting people get their hands on all of it?<br/><br/>Another small thought: Microsoft is more like…building this car, lots and lots of advertising to gather a big percentage of the market, you buy it, looks very nice with all those visual styles…iuhuu! :) …then, when something goes wrong with the car..and you just want to take a peak….uppps!… The hood is locked.<br/>But still, Microsoft is Microsoft and few wackos can deny this…<br/><br/>Back to our stuff.<br/>Inside the INETPUB folder that Windows XP cr&#101;ates when installing IIS, there’s a folder called ADMINSCRIPTS…<br/>Open a Command Prompt in that folder.<br/>By typing <br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">adsutil.vbs enum w3svc /p</div></div> you will get a list of websites cr&#101;ated. Basically only the Default Website (W3SVC/1)<br/><br/>To cr&#101;ate a new one, type<br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">adsutil.vbs cr&#101;ate_vserv W3SVC/2</div></div><br/>(the last number can be anything; it is the index of the new website)<br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">adsutil.vbs copy W3SVC/1 W3SVC/2</div></div><br/>and go to the Internet Information Services/Computer Management and rename this new website, give it a new root folder and set it up however you like.<br/><br/>To del&#101;te one, type<br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">adsutil.vbs del&#101;te W3SVC/2</div></div><br/><br/>What you have to remember is that in Windows XP, <strong>you can only have one, and only one website running</strong>. That means, if you want to start the new site just cr&#101;ated, you have to stop the default one first.<br/><br/>Of course, there is a simpler way – free software:<br/><a target="_blank" href="http://www.firstserved.net/services/iisadmin.php" rel="external">http://www.firstserved.net/services/iisadmin.php</a><br/><a target="_blank" href="http://jetstat.com/iisadmin/" rel="external">http://jetstat.com/iisadmin/</a><br/><br/>You can also try <a target="_blank" href="http://www.hairy-spider.com/multisite.aspx" rel="external">http://www.hairy-spider.com/multisite.aspx</a>, which is an ISAPI filter that can associate different domains to 127.0.0.1 and differenciates requests through that. It doesn’t deliver website alt&#101;rnative configuration though.<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=35</link>
			<title><![CDATA[Opening a DOS Prompt from Windows File Explorer]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Mon,21 Jul 2008 09:17:12 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=35</guid>
		<description><![CDATA[<strong>Windows 2000, Windows XP</strong><br/>This trick works on both Window 2k and XP with minor differences between<br/>dialogs.<br/><br/>You can use the Explorer to easily open up a DOS window to a specific<br/>directory.<br/><br/>&nbsp;&nbsp;1. From Explorer Option Menu sel&#101;ct File Types<br/>&nbsp;&nbsp;2. Highlight the object for Folder - NOT File Folder. If you can&#39;t<br/>find it, click &#34;new&#34; to cr&#101;ate a new file extension, type in &#34;*&#34; as the<br/>file extension, and click &#34;Advanced&#34;&nbsp;&nbsp;so that you can see Associated<br/>file type: Sel&#101;ct &#34;Folder&#34; as the file type.<br/>&nbsp;&nbsp;3. Click the Edit/Advanced button<br/>&nbsp;&nbsp;4. From the &#39;Edit File Type&#39; panel click the &#39;New&#39; button<br/>&nbsp;&nbsp;5. Action is &#39;&amp;Goto DOS Prompt&#39;<br/>&nbsp;&nbsp;6. Application used is cmd.exe /k pushd %L<br/>&nbsp;&nbsp;7. Sel&#101;ct OK, then Close and Close.<br/>&nbsp;&nbsp;8. Now from Explorer secondary (right) click the folder you want to<br/>go to in DOS<br/>&nbsp;&nbsp;9. From the menu sel&#101;ct &#39;Goto DOS Prompt&#39; (or hit G) and you are in<br/>that directory with a DOS windows<br/><br/><strong>Windows Vista</strong><br/> Here comes Windows Vista and ads this very useful shortcut to the DEFAULT installation inside Windows Explorer&#39;s context menu!<br/><br/>&nbsp;&nbsp; 1.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Open a Windows Explorer windows, browse to the required folder.<br/><br/>&nbsp;&nbsp; 2.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Right-click that folder in the right pane of the Windows Explorer window. Note that you do NOT have the &#34;Open Command Prompt Here&#34; option.<br/><br/>&nbsp;&nbsp; 3.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Now, hold the SHIFT key while you right-click the folder. Behold!<br/><br/>Note: As in most cases, Microsoft has only gone part of the way with this cool feature. It&#39;s silly but this context menu add-on in only available when you right-click on the folder in the right pane, and not in the left pane o&#114; in a My Computer window...<br/><br/>A cool feature of this context menu add-on is that in case of a network share it will automatically and silently map a drive to that share, and disconnect the mapped drive when the Command Prompt closes.<br/><br/>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=34</link>
			<title><![CDATA[Recording output of series of commmands on Linux]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Mon,21 Jul 2008 09:03:36 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=34</guid>
		<description><![CDATA[The basic idea is to make use of script command. <br/><br/>Usage: <br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent">$ script &lt;logfilename&gt;<br/>&lt;run your batch of commands here&gt; <br/>$ exit</div></div><br/><br/>After that, logfilename should have all the output on the screen recorded.<br/><br/>Example: <br/><br/>[oracle@mhuang-au2 ~]$ script templog<br/>Script started, file is templog<br/>[oracle@mhuang-au2 ~]$ pwd<br/>/home/oracle<br/>[oracle@mhuang-au2 ~]$ ls -ltr<br/>total 28248<br/>-rw-r--r--&nbsp;&nbsp; 1 o&#114;acle oinstall&nbsp;&nbsp;4869710 Dec 28&nbsp;&nbsp;2006 php-4.3.9.tar.gz<br/>drwxr-xr-x&nbsp;&nbsp;16 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Dec 28&nbsp;&nbsp;2006 php-4.3.9<br/>drwxr-xr-x&nbsp;&nbsp; 3 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jan&nbsp;&nbsp;3&nbsp;&nbsp;2007 userlog<br/>drwxr-xr-x&nbsp;&nbsp; 2 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jan&nbsp;&nbsp;4&nbsp;&nbsp;2007 Desktop<br/>drwx------&nbsp;&nbsp; 5 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jan 12&nbsp;&nbsp;2007 o&#114;aInventory<br/>drwxrwx---&nbsp;&nbsp; 2 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jan 12&nbsp;&nbsp;2007 o&#114;aDev<br/>drwxrwx---&nbsp;&nbsp; 4 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Mar&nbsp;&nbsp;9&nbsp;&nbsp;2007 o&#114;adata<br/>-rw-rw----&nbsp;&nbsp; 1 o&#114;acle oinstall 23840481 Apr&nbsp;&nbsp;3&nbsp;&nbsp;2007 installation.report.txt<br/>drwxrwx---&nbsp;&nbsp; 3 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Apr&nbsp;&nbsp;3&nbsp;&nbsp;2007 o&#114;aHome_BI<br/>drwx------&nbsp;&nbsp; 2 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Apr 30&nbsp;&nbsp;2007 wlt_testlbr<br/>drwxrwx---&nbsp;&nbsp; 3 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 May&nbsp;&nbsp;1&nbsp;&nbsp;2007 o&#114;aHome_6<br/>drwxrwx---&nbsp;&nbsp; 2 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 May&nbsp;&nbsp;1&nbsp;&nbsp;2007 o&#114;aHome_7<br/>drwx------&nbsp;&nbsp; 2 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 May&nbsp;&nbsp;2&nbsp;&nbsp;2007 testwallet2<br/>drwxrwx---&nbsp;&nbsp; 3 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 May 15&nbsp;&nbsp;2007 o&#114;adata2<br/>drwx------&nbsp;&nbsp;81 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jun&nbsp;&nbsp;5&nbsp;&nbsp;2007 o&#114;aHome_5<br/>drwx------&nbsp;&nbsp; 2 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jun 21&nbsp;&nbsp;2007 testwallet3<br/>drwx------&nbsp;&nbsp;74 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jun 22&nbsp;&nbsp;2007 o&#114;aHome_TestInfra<br/>-rwxr--r--&nbsp;&nbsp; 1 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;113 Aug&nbsp;&nbsp;1&nbsp;&nbsp;2007 setinfra1env<br/>-rwxr--r--&nbsp;&nbsp; 1 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;129 Aug&nbsp;&nbsp;1&nbsp;&nbsp;2007 setinfra2env<br/>drwxrwx---&nbsp;&nbsp; 3 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Aug&nbsp;&nbsp;9&nbsp;&nbsp;2007 product<br/>drwxr-xr-x&nbsp;&nbsp; 3 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Aug 10&nbsp;&nbsp;2007 testweb<br/>drwxrwxr-x&nbsp;&nbsp; 8 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Aug 14&nbsp;&nbsp;2007 installcds<br/>drwxrwx---&nbsp;&nbsp; 2 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Sep&nbsp;&nbsp;5&nbsp;&nbsp;2007 o&#114;aHome_8<br/>drwxr-xr-x&nbsp;&nbsp; 2 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Sep 10&nbsp;&nbsp;2007 testweb4<br/>drwxr-x---&nbsp;&nbsp;56 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Sep 13&nbsp;&nbsp;2007 soa_10131_basic<br/>drwxr-x---&nbsp;&nbsp;55 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Sep 20&nbsp;&nbsp;2007 o&#114;aHome_soa10131_j2ee<br/>drwxr-xr-x&nbsp;&nbsp; 4 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Oct&nbsp;&nbsp;3&nbsp;&nbsp;2007 patches<br/>-rw-r--r--&nbsp;&nbsp; 1 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;393 Oct 16&nbsp;&nbsp;2007 README.MIN<br/>drwxr-xr-x&nbsp;&nbsp; 3 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Oct 25&nbsp;&nbsp;2007 loadzone<br/>drwxr-xr-x&nbsp;&nbsp; 5 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jan 21 10:40 testweb2<br/>drwxrwx---&nbsp;&nbsp; 2 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Feb&nbsp;&nbsp;5 07:11 o&#114;aHome_9<br/>drwx------&nbsp;&nbsp;76 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Apr 23 08:40 o&#114;aHome_1<br/>-rw-r--r--&nbsp;&nbsp; 1 root&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1005 Apr 23 11:27 profile.bak<br/>drwxr-xr-x&nbsp;&nbsp; 5 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Apr 30 09:20 JAT<br/>-rw-r--r--&nbsp;&nbsp; 1 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;320 May&nbsp;&nbsp;1 07:34 jsptest.jsp<br/>drwxr-x---&nbsp;&nbsp;42 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 May 26 11:44 o&#114;aHome_soa10131_http<br/>drwxr-xr-x&nbsp;&nbsp; 2 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 May 29 10:46 lab<br/>drwx------&nbsp;&nbsp;21 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jun 10 11:57 mechan<br/>drwx------&nbsp;&nbsp;61 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jun 11 12:13 mid101202<br/>drwxr-xr-x&nbsp;&nbsp; 4 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jul&nbsp;&nbsp;4 06:59 rdatool<br/>drwx------&nbsp;&nbsp;62 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jul 15 07:47 o&#114;aHome_3<br/>drwx------&nbsp;&nbsp;86 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jul 15 13:29 o&#114;aHome_2<br/>-rw-r--r--&nbsp;&nbsp; 1 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 7705 Jul 21 07:31 temp.log<br/>-rw-r--r--&nbsp;&nbsp; 1 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0 Jul 21 07:32 templog<br/>[oracle@mhuang-au2 ~]$ exit<br/>exit<br/>Script done, file is templog&nbsp;&nbsp;<br/><br/>[oracle@mhuang-au2 ~]$ cat templog<br/>Script started on Mon 21 Jul 2008 07:32:56 AM EST<br/>[oracle@mhuang-au2 ~]$ pwd<br/>/home/oracle<br/>[oracle@mhuang-au2 ~]$ ls -ltr<br/>total 28248<br/>-rw-r--r--&nbsp;&nbsp; 1 o&#114;acle oinstall&nbsp;&nbsp;4869710 Dec 28&nbsp;&nbsp;2006 php-4.3.9.tar.gz<br/>drwxr-xr-x&nbsp;&nbsp;16 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Dec 28&nbsp;&nbsp;2006 php-4.3.9<br/>drwxr-xr-x&nbsp;&nbsp; 3 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jan&nbsp;&nbsp;3&nbsp;&nbsp;2007 userlog<br/>drwxr-xr-x&nbsp;&nbsp; 2 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jan&nbsp;&nbsp;4&nbsp;&nbsp;2007 Desktop<br/>drwx------&nbsp;&nbsp; 5 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jan 12&nbsp;&nbsp;2007 o&#114;aInventory<br/>drwxrwx---&nbsp;&nbsp; 2 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jan 12&nbsp;&nbsp;2007 o&#114;aDev<br/>drwxrwx---&nbsp;&nbsp; 4 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Mar&nbsp;&nbsp;9&nbsp;&nbsp;2007 o&#114;adata<br/>-rw-rw----&nbsp;&nbsp; 1 o&#114;acle oinstall 23840481 Apr&nbsp;&nbsp;3&nbsp;&nbsp;2007 installation.report.txt<br/>drwxrwx---&nbsp;&nbsp; 3 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Apr&nbsp;&nbsp;3&nbsp;&nbsp;2007 o&#114;aHome_BI<br/>drwx------&nbsp;&nbsp; 2 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Apr 30&nbsp;&nbsp;2007 wlt_testlbr<br/>drwxrwx---&nbsp;&nbsp; 3 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 May&nbsp;&nbsp;1&nbsp;&nbsp;2007 o&#114;aHome_6<br/>drwxrwx---&nbsp;&nbsp; 2 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 May&nbsp;&nbsp;1&nbsp;&nbsp;2007 o&#114;aHome_7<br/>drwx------&nbsp;&nbsp; 2 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 May&nbsp;&nbsp;2&nbsp;&nbsp;2007 testwallet2<br/>drwxrwx---&nbsp;&nbsp; 3 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 May 15&nbsp;&nbsp;2007 o&#114;adata2<br/>drwx------&nbsp;&nbsp;81 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jun&nbsp;&nbsp;5&nbsp;&nbsp;2007 o&#114;aHome_5<br/>drwx------&nbsp;&nbsp; 2 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jun 21&nbsp;&nbsp;2007 testwallet3<br/>drwx------&nbsp;&nbsp;74 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jun 22&nbsp;&nbsp;2007 o&#114;aHome_TestInfra<br/>-rwxr--r--&nbsp;&nbsp; 1 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;113 Aug&nbsp;&nbsp;1&nbsp;&nbsp;2007 setinfra1env<br/>-rwxr--r--&nbsp;&nbsp; 1 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;129 Aug&nbsp;&nbsp;1&nbsp;&nbsp;2007 setinfra2env<br/>drwxrwx---&nbsp;&nbsp; 3 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Aug&nbsp;&nbsp;9&nbsp;&nbsp;2007 product<br/>drwxr-xr-x&nbsp;&nbsp; 3 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Aug 10&nbsp;&nbsp;2007 testweb<br/>drwxrwxr-x&nbsp;&nbsp; 8 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Aug 14&nbsp;&nbsp;2007 installcds<br/>drwxrwx---&nbsp;&nbsp; 2 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Sep&nbsp;&nbsp;5&nbsp;&nbsp;2007 o&#114;aHome_8<br/>drwxr-xr-x&nbsp;&nbsp; 2 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Sep 10&nbsp;&nbsp;2007 testweb4<br/>drwxr-x---&nbsp;&nbsp;56 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Sep 13&nbsp;&nbsp;2007 soa_10131_basic<br/>drwxr-x---&nbsp;&nbsp;55 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Sep 20&nbsp;&nbsp;2007 o&#114;aHome_soa10131_j2ee<br/>drwxr-xr-x&nbsp;&nbsp; 4 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Oct&nbsp;&nbsp;3&nbsp;&nbsp;2007 patches<br/>-rw-r--r--&nbsp;&nbsp; 1 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;393 Oct 16&nbsp;&nbsp;2007 README.MIN<br/>drwxr-xr-x&nbsp;&nbsp; 3 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Oct 25&nbsp;&nbsp;2007 loadzone<br/>drwxr-xr-x&nbsp;&nbsp; 5 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jan 21 10:40 testweb2<br/>drwxrwx---&nbsp;&nbsp; 2 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Feb&nbsp;&nbsp;5 07:11 o&#114;aHome_9<br/>drwx------&nbsp;&nbsp;76 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Apr 23 08:40 o&#114;aHome_1<br/>-rw-r--r--&nbsp;&nbsp; 1 root&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1005 Apr 23 11:27 profile.bak<br/>drwxr-xr-x&nbsp;&nbsp; 5 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Apr 30 09:20 JAT<br/>-rw-r--r--&nbsp;&nbsp; 1 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;320 May&nbsp;&nbsp;1 07:34 jsptest.jsp<br/>drwxr-x---&nbsp;&nbsp;42 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 May 26 11:44 o&#114;aHome_soa10131_http<br/>drwxr-xr-x&nbsp;&nbsp; 2 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 May 29 10:46 lab<br/>drwx------&nbsp;&nbsp;21 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jun 10 11:57 mechan<br/>drwx------&nbsp;&nbsp;61 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jun 11 12:13 mid101202<br/>drwxr-xr-x&nbsp;&nbsp; 4 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jul&nbsp;&nbsp;4 06:59 rdatool<br/>drwx------&nbsp;&nbsp;62 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jul 15 07:47 o&#114;aHome_3<br/>drwx------&nbsp;&nbsp;86 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 4096 Jul 15 13:29 o&#114;aHome_2<br/>-rw-r--r--&nbsp;&nbsp; 1 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp; 7705 Jul 21 07:31 temp.log<br/>-rw-r--r--&nbsp;&nbsp; 1 o&#114;acle oinstall&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0 Jul 21 07:32 templog<br/>[oracle@mhuang-au2 ~]$ exit<br/>exit<br/><br/>Script done on Mon 21 Jul 2008 07:33:01 AM EST<br/>]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=28</link>
			<title><![CDATA[VIM Tricks]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Mon,21 Jul 2008 07:35:21 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=28</guid>
		<description><![CDATA[<strong>Movement commands</strong><br/><br/>G<br/>&nbsp;&nbsp;&nbsp;&nbsp;Move to the end of the file. <br/><br/>~CTRL-g<br/>&nbsp;&nbsp; Display file summary information.<br/><br/>gg<br/>&nbsp;&nbsp;&nbsp;&nbsp;Move to the beginning of the file. <br/><br/>~CTRL-e<br/>&nbsp;&nbsp;&nbsp;&nbsp;Expose another line at the top. Useful for scrolling the screen without moving your cursor from its position. <br/><br/>~CTRL-y<br/>&nbsp;&nbsp;&nbsp;&nbsp;Expose another line at the bottom. Useful for scrolling the screen without moving your cursor from its position. <br/><br/>}<br/>&nbsp;&nbsp;&nbsp;&nbsp;Move forward a paragraph. Useful for moving through documents which have blank lines separating paragraphs o&#114; blocks. An easy way to distinguish between this and { is to remember it points in the direction you wish to go. <br/><br/>{<br/>&nbsp;&nbsp;&nbsp;&nbsp;Move backward a paragraph. Useful for moving through documents which have blank lines separating paragraphs o&#114; blocks. <br/><br/>)<br/>&nbsp;&nbsp;&nbsp;&nbsp;Move forward a sentence. An easy way to distinguish between this and ( is to remember it points in the direction you wish to go <br/><br/>(<br/>&nbsp;&nbsp;&nbsp;&nbsp;Move backward a sentence. <br/><br/>:number<br/>&nbsp;&nbsp;&nbsp;&nbsp;Wh&#101;re number is a decimal number indicating the line number you wish to jump/move to. <br/><br/>&#39;0<br/>&nbsp;&nbsp;&nbsp;&nbsp;Vim cr&#101;ates a &#34;bookmark&#34; each time you exit Vim. The last &#34;bookmark&#34; is &#39;0. So if you have a file you haven&#39;t edited in a long time and can&#39;t remember wh&#101;re you left off simply type this command and it will take you to the place you last edited. You can find out what marks are set by typing :marks. <br/><br/><strong>Search Commands</strong><br/><br/>&#39;&#39;*&#39;&#39;<br/>&nbsp;&nbsp;&nbsp;&nbsp;This is a search command which will find the next occurance (forward) of the word the cursor is currently on. <br/><br/>n<br/>&nbsp;&nbsp;&nbsp;&nbsp;Find the (n)ext occurance of the previous search. It will use the same direction (i.e. forward vs. backwards) of the previous search as well. <br/><br/><br/><strong>Simple editing/combination commands</strong><br/><br/>Deleting/sel&#101;cting parts of a line<br/><br/>dfx<br/>&nbsp;&nbsp;&nbsp;&nbsp;Del&#101;te forward until you find x (inclusive). If x is found, vim will del&#101;te everything from the current cursor position to and including x.<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;This one and its variations dFx, dtx, and dTx are very useful when editing mark-up languages like html and sgml. It is especially useful in deleting and changing quoted attributes within mark-up tags.<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;This is a combination of the (d)elete command and the (f)ind motion command. You may also substitute other commands for the del&#101;te portion of that command, such as visual by character, o&#114; yank. <br/><br/>dFx<br/>&nbsp;&nbsp;&nbsp;&nbsp;Del&#101;te backward until you find x (inclusive). If x is found, vim will del&#101;te everything from the current cursor position to and including x. <br/><br/>dtx<br/>&nbsp;&nbsp;&nbsp;&nbsp;Del&#101;te forward until you find x (exclusive). If x is found, vim will del&#101;te everything from the current cursor position to, but not including x. <br/><br/>dTx<br/>&nbsp;&nbsp;&nbsp;&nbsp;Del&#101;te backward until you find x (exclusive). If x is found, vim will del&#101;te everything from the current cursor position to, but not including x. <br/><br/>Deleting/sel&#101;cting spanning multiple lines<br/><br/>d/x<br/>&nbsp;&nbsp;&nbsp;&nbsp;Del&#101;te forward until you find x (exclusive). If x is found, vim will del&#101;te everything from the current cursor position to, but not including x, spanning multiple lines if necessary.<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;x doesn&#39;t have to be one character. It&#39;s most likely to be a word o&#114; several characters. If you&#39;re editing your email, you could use this to del&#101;te all text up to your signature by executing d/--.<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;This is a combination of the (d)elete command and the (/) search forward motion command. You may also substitute other commands for the del&#101;te portion of that command, such as visual by character, Visual by line, o&#114; yank. <br/><br/>d?x<br/>&nbsp;&nbsp;&nbsp;&nbsp;Del&#101;te backward until you find x (exclusive). If x is found, vim will del&#101;te everything from the current cursor position to, but not including x, spanning multiple lines if necessary. ]]></description>
		</item>
		
			<item>
			<link>http://www.bluestrait.com/blog/article.asp?id=26</link>
			<title><![CDATA[Checking the processes using a particular TCP port]]></title>
			<author>bluestrait@gmail.com(黄敏)</author>
			<category><![CDATA[程序员]]></category>
			<pubDate>Mon,21 Jul 2008 07:15:14 +0800</pubDate>
			<guid>http://www.bluestrait.com/blog/default.asp?id=26</guid>
		<description><![CDATA[This is the command that can be used to display the processes using a particular TCP port:<br/><br/><i>lsof -i TCP:&lt;port&gt;</i><br/><br/>Note: lsof typically is located in /usr/sbin and unfortunately it may not be in default PATH. <br/><br/>Example: <br/><br/><div class="UBBPanel codePanel"><div class="UBBTitle"><img src="http://www.bluestrait.com/blog/images/code.gif" style="margin:0px 2px -3px 0px" alt="程序代码"/> 程序代码</div><div class="UBBContent"><br/>[oracle@mhuang-au2 bin]$ /usr/sbin/lsof -i :7779<br/>COMMAND&nbsp;&nbsp; PID&nbsp;&nbsp; USER&nbsp;&nbsp; FD&nbsp;&nbsp; TYPE&nbsp;&nbsp; DEVICE SIZE NODE NAME<br/>httpd&nbsp;&nbsp; 25976 o&#114;acle&nbsp;&nbsp; 22u&nbsp;&nbsp;IPv4 70480520&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TCP *:7779 (LISTEN)<br/>httpd&nbsp;&nbsp; 25997 o&#114;acle&nbsp;&nbsp; 22u&nbsp;&nbsp;IPv4 70480520&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TCP *:7779 (LISTEN)<br/>httpd&nbsp;&nbsp; 26000 o&#114;acle&nbsp;&nbsp; 22u&nbsp;&nbsp;IPv4 70480520&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TCP *:7779 (LISTEN)<br/></div></div><br/><br/>After that, we can query process information using the PID found.]]></description>
		</item>
		
</channel>
</rss>
