<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-9153561184848277923</id><updated>2011-07-07T22:14:10.728-04:00</updated><category term='control'/><category term='enumerating enum'/><category term='partial postback'/><category term='TreeView Recursive'/><category term='scroll scrollable table div'/><category term='Convert'/><category term='lnk4075'/><category term='String'/><category term='validator label'/><category term='javascript server invoke'/><category term='Char'/><category term='textbox autoscroll'/><category term='updatepanel javascript'/><title type='text'>My Tech Notes</title><subtitle type='html'>Blog programming issues I encountered.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>59</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-7378984813602895170</id><published>2010-09-24T16:08:00.000-04:00</published><updated>2010-09-24T16:08:01.576-04:00</updated><title type='text'>Rails - RJS ERROR: TypeError element is null</title><content type='html'>Usually this error is caused by "page.replace_html 'div_1', render()". Do you have "div_1" defined anywhere in the html?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-7378984813602895170?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/7378984813602895170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=7378984813602895170' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/7378984813602895170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/7378984813602895170'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2010/09/rails-rjs-error-typeerror-element-is.html' title='Rails - RJS ERROR: TypeError element is null'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-5857129864728669865</id><published>2010-03-31T10:30:00.001-04:00</published><updated>2010-03-31T10:38:10.328-04:00</updated><title type='text'>Javascript in Rails Partial</title><content type='html'>Javascript function defined in a partial sometimes doesn't work (I've seen both worked case and non-worked case). I have a partial named _v_1_0_edit.html.erb; its parent page is index.html.erb. The javascript portion is below:&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;function my_alert() {&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert("Hello");&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;}&lt;/div&gt;&lt;br /&gt;If the above is inside a partial, it doesn't work when I call my_alert() from a onclick event of a button on the partial; it is as if the function is not defined. But if the above is inside the parent, it works.&lt;br /&gt;&lt;br /&gt;However, if I change the function definition to below:&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;my_alert = function my_alert() {&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert("Hello");&lt;/div&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;}&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size: x-small;"&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;&lt;/span&gt;&lt;/span&gt;It works if it's defined in a partial (But it doesn't work in IE).&lt;br /&gt;&lt;br /&gt;If I just throw the below on a view:&lt;br /&gt;&lt;br /&gt;&lt;div style="font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;"&gt;alert("Hello");&lt;/div&gt;&lt;br /&gt;It will show the alert message no matter it's on the partial or the parent.&lt;br /&gt;&lt;br /&gt;I need to do more research on this. I think as long as the defined function is shown on page source, it should work. Can I have a script&lt;br /&gt;section inside a div?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-5857129864728669865?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/5857129864728669865/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=5857129864728669865' title='36 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/5857129864728669865'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/5857129864728669865'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2010/03/javascript-in-rails-partial.html' title='Javascript in Rails Partial'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>36</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-4419203731102974261</id><published>2009-10-07T17:28:00.002-04:00</published><updated>2009-10-07T17:28:34.328-04:00</updated><title type='text'>VS2008 Remote Debugging</title><content type='html'>First you need to create a user on your desktop and the remote machine with  the same username and password on both machines.&lt;br /&gt;Make sure msvsmon.exe is installed on the remote computer. It should be in  your Visual studio 2008 directory.&lt;br /&gt;on the remote computer do a runas /user:debuguser  c:\fullpath\msvsmon.exe&lt;br /&gt;where debuguser is the user you created above&lt;br /&gt;You should see a window popup saying "3/31/2009 12:22:56 PM Msvsmon started a  new server named 'debuguser@TSIK2552100'. Waiting for new connections."&lt;br /&gt;now on your desktop do a runas /user:debuguser "c:\Program Files\Microsoft  Visual Studio 9.0\Common7\IDE\devenv.exe"&lt;br /&gt;where debuguser is again the user  you created above&lt;br /&gt;the load your project and go to attach to process, enter  debuguser@remotemachinename in the Qualifier box and you may need to select the  show processes from all users check box. select your process and you should be  able to debug.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-4419203731102974261?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/4419203731102974261/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=4419203731102974261' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/4419203731102974261'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/4419203731102974261'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2009/10/vs2008-remote-debugging.html' title='VS2008 Remote Debugging'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-6577874805889696697</id><published>2009-09-28T13:52:00.000-04:00</published><updated>2009-09-28T13:52:41.659-04:00</updated><title type='text'>Enable Sql Server Authentication Mode Over Network</title><content type='html'>Check the followings:&lt;br /&gt;1. Right click the root node on Object Explorer, in Server Properties window-&amp;gt;Security-&amp;gt;Server authentication: SQL Server and Windows Authentication mode&lt;br /&gt;2. Create a new user for login.&lt;br /&gt;3. Right click the user on Object Explorer, in Login Properties window:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3.1 User Mapping: Check the desired database to access&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 3.2 Status-&amp;gt;Permission to connect to database engine: Grant; Login: Enabled&lt;br /&gt;4. Sql Server Configuration Manager -&amp;gt; Enable TCP/IP and Named Pipes&lt;br /&gt;5. REMEMBER TO RESTART THE MSSQLSERVER SERVICE.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-6577874805889696697?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/6577874805889696697/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=6577874805889696697' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/6577874805889696697'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/6577874805889696697'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2009/09/enable-sql-server-authentication-mode.html' title='Enable Sql Server Authentication Mode Over Network'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-1949924884634034400</id><published>2009-09-17T15:24:00.001-04:00</published><updated>2009-10-21T17:36:15.249-04:00</updated><title type='text'>Object.GetHashCode, Object.Equals, operator==, and related</title><content type='html'>After some research, I summarize some points below as guidelines.&lt;br /&gt;&lt;br /&gt;1. &lt;strike&gt;Object.Equals method and operator== are supposed to be used interchangeably. (It applies to all the .net classes)  Therefore, when implementing a new class, it's a good idea to always implement both of them.&lt;/strike&gt;&lt;br /&gt;Equals() is usually used (implemented) for value equality and Operator== is used for reference equality by default. When a type is an immutable type (e.g. String), overloading Operator== to compare value equality makes sense.&lt;br /&gt;&lt;br /&gt;Guidelines for Overloading Equals() and Operator==&lt;br /&gt;http://msdn.microsoft.com/en-us/library/ms173147%28VS.80%29.aspx&lt;br /&gt;&lt;br /&gt;Override equals on overloading operator equals&lt;br /&gt;http://msdn.microsoft.com/en-us/library/ms182357%28VS.80%29.aspx&lt;br /&gt;&lt;br /&gt;When should I use == and when should I use Equals&lt;br /&gt;http://blogs.msdn.com/csharpfaq/archive/2004/03/29/102224.aspx&lt;br /&gt;&lt;br /&gt;2. It is important to override GetHashCode when overriding Equals method. Although failure to do so will not always break your code, things can go wrong if the class is used as a key in a dictionary etc. In that situation, if the hash-code for two items does not match, they may never be considered equal (Equals will never be called). To write the GetHashCode, we need to make sure that: if two objects are equal, then they must return the same value for GetHashCode. On the other hand, we do NOT have to make sure two different objects always return different values for GetHashCode.&lt;br /&gt;&lt;br /&gt;Why is it important to override GetHashCode when Equals method is overriden in C#&lt;br /&gt;http://stackoverflow.com/questions/371328/why-is-it-important-to-override-gethashcode-when-equals-method-is-overriden-in-c&lt;br /&gt;&lt;br /&gt;3. A good implementation of GetHashCode that can be used in many situations:&lt;br /&gt;&lt;pre class="prettyprint"&gt;&lt;code&gt;public int GetHashCode()&lt;br /&gt;{&lt;br /&gt;int hash = 17;&lt;br /&gt;// Suitable nullity checks etc, of course :)&lt;br /&gt;hash = hash * 23 + field1.GetHashCode();&lt;br /&gt;hash = hash * 23 + field2.GetHashCode();&lt;br /&gt;hash = hash * 23 + field3.GetHashCode();&lt;br /&gt;return hash;&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;What is the best algorithm for an overridden System.Object.GetHashCode&lt;br /&gt;http://stackoverflow.com/questions/263400#263416&lt;br /&gt;&lt;br /&gt;4. Implementing IEquatable Properly&lt;br /&gt;http://www.codeproject.com/KB/dotnet/IEquatable.aspx&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-1949924884634034400?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/1949924884634034400/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=1949924884634034400' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/1949924884634034400'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/1949924884634034400'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2009/09/objectgethashcode-objectequals-operator.html' title='Object.GetHashCode, Object.Equals, operator==, and related'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-8135391153419376817</id><published>2009-08-25T16:20:00.000-04:00</published><updated>2009-08-25T16:22:30.731-04:00</updated><title type='text'>Sql Server Script to Restore a Database</title><content type='html'>use master&lt;br /&gt;&lt;br /&gt;alter database DBName&lt;br /&gt;set single_user with rollback immediate&lt;br /&gt;&lt;br /&gt;restore database DBName&lt;br /&gt;from disk = 'C:\DBBackup.bak'&lt;br /&gt;&lt;br /&gt;-- use the following to overwrite log in case the log file was not backed up&lt;br /&gt;with replace&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-8135391153419376817?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/8135391153419376817/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=8135391153419376817' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/8135391153419376817'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/8135391153419376817'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2009/08/sql-server-script-to-restore-database.html' title='Sql Server Script to Restore a Database'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-4542547265634574766</id><published>2009-08-18T09:23:00.000-04:00</published><updated>2009-08-18T09:49:18.529-04:00</updated><title type='text'>SQL Commands - Disable Constraints</title><content type='html'>The following commands are from this URL&lt;br /&gt;http://gchandra.wordpress.com/2008/02/18/sql-server-clean-your-database-records-and-reset-identity-columns-the-shortest-path/&lt;br /&gt;&lt;br /&gt;--Disable Constraints &amp; Triggers &lt;br /&gt;exec sp_MSforeachtable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'  &lt;br /&gt;exec sp_MSforeachtable 'ALTER TABLE ? DISABLE TRIGGER ALL'  &lt;br /&gt; &lt;br /&gt;--Perform delete operation on all table for cleanup  &lt;br /&gt;exec sp_MSforeachtable 'DELETE ?'  &lt;br /&gt;&lt;br /&gt;--Enable Constraints &amp; Triggers again &lt;br /&gt;exec sp_MSforeachtable 'ALTER TABLE ? CHECK CONSTRAINT ALL'  &lt;br /&gt;exec sp_MSforeachtable 'ALTER TABLE ? ENABLE TRIGGER ALL'  &lt;br /&gt;    &lt;br /&gt;--Reset Identity on tables with identity column&lt;br /&gt;exec sp_MSforeachtable 'IF OBJECTPROPERTY(OBJECT_ID(''?''), ''TableHasIdentity'') = 1 BEGIN DBCC CHECKIDENT (''?'',RESEED,0) END' &lt;br /&gt;&lt;br /&gt;I found the commands are very useful. For example, I once got the foreign key constraint error when trying to import data into my database. I executed the first two commands to disable constraints and triggers first, then imported the data, the errors were gone. After importing data, I then executed the last three commands to re-enable and reset stuff.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-4542547265634574766?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/4542547265634574766/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=4542547265634574766' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/4542547265634574766'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/4542547265634574766'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2009/08/sql-commands-disable-constraints.html' title='SQL Commands - Disable Constraints'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-1731887606957936647</id><published>2009-07-22T17:24:00.000-04:00</published><updated>2009-07-22T17:32:06.112-04:00</updated><title type='text'>WaitCallback method has to be static</title><content type='html'>The following is a demo for using WaitCallback delegate. Note that the method ThreadProc has to be static.&lt;br /&gt;&lt;br /&gt;using namespace System;&lt;br /&gt;using namespace System::Threading;&lt;br /&gt;ref class Example&lt;br /&gt;{&lt;br /&gt;public:&lt;br /&gt;&lt;br /&gt;   // This thread procedure performs the task.&lt;br /&gt;   static void ThreadProc( Object^ stateInfo )&lt;br /&gt;   {&lt;br /&gt;&lt;br /&gt;      // No state object was passed to QueueUserWorkItem, so &lt;br /&gt;      // stateInfo is 0.&lt;br /&gt;      Console::WriteLine( "Hello from the thread pool." );&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;int main()&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;   // Queue the task.&lt;br /&gt;   ThreadPool::QueueUserWorkItem( gcnew WaitCallback( Example::ThreadProc ) );&lt;br /&gt;   Console::WriteLine( "Main thread does some work, then sleeps." );&lt;br /&gt;&lt;br /&gt;   // If you comment out the Sleep, the main thread exits before&lt;br /&gt;   // the thread pool task runs.  The thread pool uses background&lt;br /&gt;   // threads, which do not keep the application running.  (This&lt;br /&gt;   // is a simple example of a race condition.)&lt;br /&gt;   Thread::Sleep( 1000 );&lt;br /&gt;   Console::WriteLine( "Main thread exits." );&lt;br /&gt;   return 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;If it's not static, we'll get the following error:&lt;br /&gt;error C3867: 'Example::ThreadProc': function call missing argument list; use '&amp;Example::ThreadProc' to create a pointer to member&lt;br /&gt;error C3350: 'System::Threading::WaitCallback' : a delegate constructor expects 2 argument(s)&lt;br /&gt;&lt;br /&gt;Why??&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-1731887606957936647?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/1731887606957936647/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=1731887606957936647' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/1731887606957936647'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/1731887606957936647'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2009/07/waitcallback-method-has-to-be-static.html' title='WaitCallback method has to be static'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-6665199523938048888</id><published>2009-06-24T16:26:00.000-04:00</published><updated>2009-06-24T16:49:15.286-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript server invoke'/><title type='text'>Calling javascript from code behind</title><content type='html'>Previously, we know how to easily call server side method from javascript. The opposite is also simple enough.&lt;br /&gt;&lt;br /&gt;Just use the RegisterClientScriptBlock method of ClientScriptManager (in case of full postback) or ScirptManager (in case of patial postback). Following is an example:&lt;br /&gt;&lt;br /&gt;&lt;!--  /* Font Definitions */  @font-face 	{font-family:"Cambria Math"; 	panose-1:2 4 5 3 5 4 6 3 2 4; 	mso-font-charset:1; 	mso-generic-font-family:roman; 	mso-font-format:other; 	mso-font-pitch:variable; 	mso-font-signature:0 0 0 0 0 0;} @font-face 	{font-family:Calibri; 	panose-1:2 15 5 2 2 2 4 3 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:-1610611985 1073750139 0 0 159 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-parent:""; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:10.0pt; 	margin-left:0in; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:Calibri; 	mso-fareast-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} .MsoChpDefault 	{mso-style-type:export-only; 	mso-default-props:yes; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:Calibri; 	mso-fareast-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} .MsoPapDefault 	{mso-style-type:export-only; 	margin-bottom:10.0pt; 	line-height:115%;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.0in 1.0in 1.0in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-qformat:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin-top:0in; 	mso-para-margin-right:0in; 	mso-para-margin-bottom:10.0pt; 	mso-para-margin-left:0in; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-theme-font:minor-fareast; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%;font-family:&amp;quot;;font-size:10;"  &gt;ScriptManager&lt;/span&gt;&lt;span style="line-height: 115%;font-family:&amp;quot;;font-size:10;"  &gt;.RegisterClientScriptBlock(&lt;span style="color:blue;"&gt;this&lt;/span&gt;, &lt;span style="color:blue;"&gt;this&lt;/span&gt;.GetType(), &lt;span style="color: rgb(163, 21, 21);"&gt;"confirmInPageNav"&lt;/span&gt;, &lt;span style="color: rgb(163, 21, 21);"&gt;"&amp;lt;script&amp;gt;confirmInPageNav()&amp;lt;/script&amp;gt;"&lt;/span&gt;, &lt;span style="color:blue;"&gt;false&lt;/span&gt;);&lt;/span&gt;&lt;/p&gt; &lt;br /&gt;&lt;br /&gt;confirmInPageNav can be any javascript function&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-6665199523938048888?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/6665199523938048888/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=6665199523938048888' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/6665199523938048888'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/6665199523938048888'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2009/06/calling-javascript-from-code-behind.html' title='Calling javascript from code behind'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-1123168889655728186</id><published>2009-06-16T10:04:00.000-04:00</published><updated>2009-06-16T10:23:18.610-04:00</updated><title type='text'>Calling server side method from client (using javascript)</title><content type='html'>I didn't know how easy to achieve this  until I read the post in this link:&lt;br /&gt;http://disturbedbuddha.wordpress.com/2008/01/08/executing-server-side-code-from-javascript/&lt;br /&gt;&lt;br /&gt;The essence is to put the server side logic in a button's OnClick event handler; then use the HTML DOM click() method to raise the OnClick event.&lt;br /&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"&gt;   &lt;w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 1"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 2"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 3"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 4"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 5"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 6"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 7"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 8"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 9"&gt;   &lt;w:lsdexception locked="false" priority="35" qformat="true" name="caption"&gt;   &lt;w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"&gt;   &lt;w:lsdexception locked="false" priority="1" name="Default Paragraph Font"&gt;   &lt;w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"&gt;   &lt;w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"&gt;   &lt;w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"&gt;   &lt;w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Revision"&gt;   &lt;w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"&gt;   &lt;w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"&gt;   &lt;w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"&gt;   &lt;w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"&gt;   &lt;w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"&gt;   &lt;w:lsdexception locked="false" priority="37" name="Bibliography"&gt;   &lt;w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:"Cambria Math"; 	panose-1:2 4 5 3 5 4 6 3 2 4; 	mso-font-charset:1; 	mso-generic-font-family:roman; 	mso-font-format:other; 	mso-font-pitch:variable; 	mso-font-signature:0 0 0 0 0 0;} @font-face 	{font-family:Calibri; 	panose-1:2 15 5 2 2 2 4 3 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:-1610611985 1073750139 0 0 159 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-parent:""; 	margin-top:0in; 	margin-right:0in; 	margin-bottom:10.0pt; 	margin-left:0in; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:Calibri; 	mso-fareast-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} .MsoChpDefault 	{mso-style-type:export-only; 	mso-default-props:yes; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:Calibri; 	mso-fareast-theme-font:minor-latin; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} .MsoPapDefault 	{mso-style-type:export-only; 	margin-bottom:10.0pt; 	line-height:115%;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.0in 1.0in 1.0in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-qformat:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin-top:0in; 	mso-para-margin-right:0in; 	mso-para-margin-bottom:10.0pt; 	mso-para-margin-left:0in; 	line-height:115%; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-theme-font:minor-fareast; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;script&lt;/span&gt; &lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;="text/javascript"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;function&lt;/span&gt; myClientButton_onclick() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;            &lt;/span&gt;document.getElementById(&lt;span style="color: rgb(163, 21, 21);"&gt;'btn1'&lt;/span&gt;).click();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;        &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 10pt; line-height: 115%; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;script&lt;/span&gt;&lt;span style="color: blue;"&gt;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;asp&lt;/span&gt;&lt;span style="color: blue;"&gt;:&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Button&lt;/span&gt; &lt;span style="color: red;"&gt;ID&lt;/span&gt;&lt;span style="color: blue;"&gt;="btn1"&lt;/span&gt; &lt;span style="color: red;"&gt;runat&lt;/span&gt;&lt;span style="color: blue;"&gt;="server"&lt;/span&gt; &lt;span style="color: red;"&gt;Text&lt;/span&gt;&lt;span style="color: blue;"&gt;="Original"&lt;/span&gt; &lt;span style="color: red;"&gt;OnClientClick&lt;/span&gt;&lt;span style="color: blue;"&gt;="alert('abc')"&lt;/span&gt; &lt;span style="color: red;"&gt;onclick&lt;/span&gt;&lt;span style="color: blue;"&gt;="btn1_Click"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="font-size: 10pt; line-height: 115%; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;input&lt;/span&gt; &lt;span style="color: red;"&gt;id&lt;/span&gt;&lt;span style="color: blue;"&gt;="myClientButton"&lt;/span&gt; &lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;="button"&lt;/span&gt; &lt;span style="color: red;"&gt;value&lt;/span&gt;&lt;span style="color: blue;"&gt;="Press Me"&lt;/span&gt; &lt;span style="color: red;"&gt;onclick&lt;/span&gt;&lt;span style="color: blue;"&gt;="return myClientButton_onclick()"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;asp:button id="btn1" runat="server" text="Original" onclientclick="alert('abc')" onclick="btn1_Click"&gt;Note that the HTML DOM click() method also raises btn1's OnClientClick event.&lt;/asp:button&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-1123168889655728186?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/1123168889655728186/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=1123168889655728186' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/1123168889655728186'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/1123168889655728186'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2009/06/calling-server-side-method-from-client.html' title='Calling server side method from client (using javascript)'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-3591934582665113901</id><published>2009-06-10T16:34:00.000-04:00</published><updated>2009-06-10T16:40:11.764-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='control'/><title type='text'>FindControlByID</title><content type='html'>When we want to find a control by its ID, chances are it is usually nested in many levels. In this scenario, we need more powerful method than the .NET framework provided Control.FindControl.&lt;br /&gt;&lt;br /&gt;Writing such a method actually is straightforward enough:&lt;br /&gt;&lt;br /&gt;        private static Control FindControlByID(Control root, string id)&lt;br /&gt;        {&lt;br /&gt;            if (id == string.Empty)&lt;br /&gt;                return null;&lt;br /&gt;&lt;br /&gt;            if (root.ID == id)&lt;br /&gt;                return root;&lt;br /&gt;&lt;br /&gt;            foreach (Control c in root.Controls)&lt;br /&gt;            {&lt;br /&gt;                Control t = FindControlByID(c, id);&lt;br /&gt;                if (t != null)&lt;br /&gt;                {&lt;br /&gt;                    return t;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            return null;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;It works great no matter there is master page involved or not; no matter how many levels the control hierarchy has.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-3591934582665113901?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/3591934582665113901/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=3591934582665113901' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/3591934582665113901'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/3591934582665113901'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2009/06/findcontrolbyid.html' title='FindControlByID'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-1548033262757398543</id><published>2009-06-02T10:29:00.000-04:00</published><updated>2009-06-02T10:40:33.690-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='validator label'/><title type='text'>Using Validator as a Label</title><content type='html'>Occasionally, we have several validation logic and for some of them we use the validators ASP.NET provides and for some of them we may want to write our own code and have a label displaying the error message. As we know, a validator control has a label to display its error message. By using the validator's label, we can save a label control and more importantly, it may be easier for the layout. (This may not be a good practice since we are letting the validator doing some work it is not supposed to do. I want to log it anyway since sometimes this can be handy)&lt;br /&gt;&lt;br /&gt;In our own logic, if we want to use the RequireFieldsValidator's (rfvVersion) build-in label to display our custom error message, we can write:&lt;br /&gt;&lt;br /&gt;rfvVersion.IsValid = false;&lt;br /&gt;rfvVersion.Text = "Incorrect Format";&lt;br /&gt;rfvVersion.Enabled = true;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-1548033262757398543?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/1548033262757398543/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=1548033262757398543' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/1548033262757398543'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/1548033262757398543'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2009/06/using-validator-as-label.html' title='Using Validator as a Label'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-3911858824337621612</id><published>2009-05-27T13:01:00.000-04:00</published><updated>2009-05-27T13:11:33.939-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='enumerating enum'/><title type='text'>Enumerating enum</title><content type='html'>Probably all of us have encountered the situation where we need to enumerating a enum type. For example, we may want to put all the enum values in a listbox. The solution may not be so straight forward to come up with, but is simple enough: (RegistryValueKind is an enum type in Microsoft.Win32 namespace)&lt;br /&gt;&lt;br /&gt;&lt;!--[endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face  {font-family:"Cambria Math";  panose-1:2 4 5 3 5 4 6 3 2 4;  mso-font-charset:0;  mso-generic-font-family:roman;  mso-font-pitch:variable;  mso-font-signature:-1610611985 1107304683 0 0 159 0;} @font-face  {font-family:Calibri;  panose-1:2 15 5 2 2 2 4 3 2 4;  mso-font-charset:0;  mso-generic-font-family:swiss;  mso-font-pitch:variable;  mso-font-signature:-1610611985 1073750139 0 0 159 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal  {mso-style-unhide:no;  mso-style-qformat:yes;  mso-style-parent:"";  margin-top:0in;  margin-right:0in;  margin-bottom:10.0pt;  margin-left:0in;  line-height:115%;  mso-pagination:widow-orphan;  font-size:11.0pt;  font-family:"Calibri","sans-serif";  mso-ascii-font-family:Calibri;  mso-ascii-theme-font:minor-latin;  mso-fareast-font-family:Calibri;  mso-fareast-theme-font:minor-latin;  mso-hansi-font-family:Calibri;  mso-hansi-theme-font:minor-latin;  mso-bidi-font-family:"Times New Roman";  mso-bidi-theme-font:minor-bidi;} .MsoChpDefault  {mso-style-type:export-only;  mso-default-props:yes;  mso-ascii-font-family:Calibri;  mso-ascii-theme-font:minor-latin;  mso-fareast-font-family:Calibri;  mso-fareast-theme-font:minor-latin;  mso-hansi-font-family:Calibri;  mso-hansi-theme-font:minor-latin;  mso-bidi-font-family:"Times New Roman";  mso-bidi-theme-font:minor-bidi;} .MsoPapDefault  {mso-style-type:export-only;  margin-bottom:10.0pt;  line-height:115%;} @page Section1  {size:8.5in 11.0in;  margin:1.0in 1.0in 1.0in 1.0in;  mso-header-margin:.5in;  mso-footer-margin:.5in;  mso-paper-source:0;} div.Section1  {page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable  {mso-style-name:"Table Normal";  mso-tstyle-rowband-size:0;  mso-tstyle-colband-size:0;  mso-style-noshow:yes;  mso-style-priority:99;  mso-style-qformat:yes;  mso-style-parent:"";  mso-padding-alt:0in 5.4pt 0in 5.4pt;  mso-para-margin-top:0in;  mso-para-margin-right:0in;  mso-para-margin-bottom:10.0pt;  mso-para-margin-left:0in;  line-height:115%;  mso-pagination:widow-orphan;  font-size:11.0pt;  font-family:"Calibri","sans-serif";  mso-ascii-font-family:Calibri;  mso-ascii-theme-font:minor-latin;  mso-fareast-font-family:"Times New Roman";  mso-fareast-theme-font:minor-fareast;  mso-hansi-font-family:Calibri;  mso-hansi-theme-font:minor-latin;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;List&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;&lt;span style="color:blue;"&gt;string&lt;/span&gt;&gt; list = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;List&lt;/span&gt;&lt;&lt;span style="color:blue;"&gt;string&lt;/span&gt;&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:blue;"   &gt;foreach&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;( &lt;span style="color: rgb(43, 145, 175);"&gt;RegistryValueKind&lt;/span&gt; kind &lt;span style="color:blue;"&gt;in&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;span style=""&gt;    &lt;/span&gt;Enum&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;.GetValues(&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color: rgb(43, 145, 175);"&gt;RegistryValueKind&lt;/span&gt;)).Cast&lt;&lt;span style="color: rgb(43, 145, 175);"&gt;RegistryValueKind&lt;/span&gt;&gt;())&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;span style=""&gt;    &lt;/span&gt;list.Add(kind.ToString() + ((&lt;span style="color:blue;"&gt;int&lt;/span&gt;)kind).ToString());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%;font-family:&amp;quot;;font-size:10;"  &gt;}&lt;/span&gt;&lt;/p&gt;  &lt;string&gt;&lt;string&gt;&lt;registryvaluekind&gt;&lt;br /&gt;&lt;/registryvaluekind&gt;&lt;/string&gt;&lt;/string&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-3911858824337621612?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/3911858824337621612/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=3911858824337621612' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/3911858824337621612'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/3911858824337621612'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2009/05/enumerating-enum.html' title='Enumerating enum'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-6146507221896225376</id><published>2009-05-04T17:46:00.000-04:00</published><updated>2009-05-04T17:59:48.429-04:00</updated><title type='text'>Accessing Data Bound to ListView</title><content type='html'>If we try to access data that are bound to listview by the following code:&lt;br /&gt;ListViewDataItem lvDataItem = ListView.Item[index];&lt;br /&gt;&lt;br /&gt;We'll find that lvDataItem is null.&lt;br /&gt;&lt;br /&gt;In fact, all the ListViewDataItem in listview's Item collection are null. The only time it is not null is in ItemDataBound event of ListView. I guess it is designed this way to save memory space. So what if we need to access the data outside ItemDataBound event?&lt;br /&gt;&lt;br /&gt;The answer is simple. Just specify DataKeyNames property of ListView like this:&lt;br /&gt;DataKeyNames="ProductName, UnitPrice"&lt;br /&gt;&lt;br /&gt;Then, we can access any data:&lt;br /&gt;ListView.DataKeys[index]["ProductName"]&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-6146507221896225376?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/6146507221896225376/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=6146507221896225376' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/6146507221896225376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/6146507221896225376'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2009/05/accessing-data-bound-to-listview.html' title='Accessing Data Bound to ListView'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-6505596679363316743</id><published>2009-05-01T09:27:00.000-04:00</published><updated>2009-09-02T14:49:58.956-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='updatepanel javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='partial postback'/><title type='text'>Javascript Code Meets Postback(full and partial)</title><content type='html'>Code in $(document).ready is NOT executed in partial postback; pageLoad() function works for partial postback. Both work in full(standard postback).&lt;br /&gt;&lt;br /&gt;For the javascript code register in ClientScript.RegisterClientScriptBlock, it is on the page for both full and partial postback. (Because in partial postback, Page_Load event on server side also gets called.) &lt;br /&gt;&lt;br /&gt;http://encosia.com/2009/03/25/document-ready-and-pageload-are-not-the-same/&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-6505596679363316743?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/6505596679363316743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=6505596679363316743' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/6505596679363316743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/6505596679363316743'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2009/05/javascript-code-meets-postbackfull-and.html' title='Javascript Code Meets Postback(full and partial)'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-6128696307992299267</id><published>2009-04-27T09:23:00.000-04:00</published><updated>2009-04-27T09:30:47.072-04:00</updated><title type='text'>Restoring master and msdb Database</title><content type='html'>Restoring master database requires sql server running in single-user mode. We can do the following:&lt;br /&gt;1. Start a cmd window&lt;br /&gt;2. Stop SQL Server&lt;br /&gt;net stop mssqlserver&lt;br /&gt;3. Start SQL Server in single user mode&lt;br /&gt;sqlservr -m&lt;br /&gt;4. Start another cmd window&lt;br /&gt;5. Restore the master database&lt;br /&gt;osql -E -Q"restore database master from disk = 'D:\SQL2000\MSSQL\BACKUP\master-2007-03-12.bak'&lt;br /&gt;&lt;br /&gt;NOTE: after executing this command you should see the following output:&lt;br /&gt;The master database has been successfully restored. Shutting down SQL Server.&lt;br /&gt;SQL Server is terminating this process.&lt;br /&gt;&lt;br /&gt;In step 5, we can also restore the database in Query Analyzer by running: restore database master from disk = 'D:\SQL2000\MSSQL\BACKUP\master-2007-03-12.bak'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To restore msdb database, we should run sql server in multi-user mode. If there is an error indicating exclusive access, then try to stop sqlserveragent.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-6128696307992299267?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/6128696307992299267/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=6128696307992299267' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/6128696307992299267'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/6128696307992299267'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2009/04/restoring-master-and-msdb-database.html' title='Restoring master and msdb Database'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-8542974098556202321</id><published>2009-04-10T10:40:00.000-04:00</published><updated>2009-04-10T10:44:48.450-04:00</updated><title type='text'>Color of Source Code in Blog</title><content type='html'>&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:trackmoves/&gt;   &lt;w:trackformatting/&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:donotpromoteqf/&gt;   &lt;w:lidthemeother&gt;EN-US&lt;/w:LidThemeOther&gt;   &lt;w:lidthemeasian&gt;X-NONE&lt;/w:LidThemeAsian&gt;   &lt;w:lidthemecomplexscript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;    &lt;w:splitpgbreakandparamark/&gt;    &lt;w:dontvertaligncellwithsp/&gt;    &lt;w:dontbreakconstrainedforcedtables/&gt;    &lt;w:dontvertalignintxbx/&gt;    &lt;w:word11kerningpairs/&gt;    &lt;w:cachedcolbalance/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;   &lt;m:mathpr&gt;    &lt;m:mathfont val="Cambria Math"&gt;    &lt;m:brkbin val="before"&gt;    &lt;m:brkbinsub val="&amp;#45;-"&gt;    &lt;m:smallfrac val="off"&gt;    &lt;m:dispdef/&gt;    &lt;m:lmargin val="0"&gt;    &lt;m:rmargin val="0"&gt;    &lt;m:defjc val="centerGroup"&gt;    &lt;m:wrapindent val="1440"&gt;    &lt;m:intlim val="subSup"&gt;    &lt;m:narylim val="undOvr"&gt;   &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"&gt;   &lt;w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 1"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 2"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 3"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 4"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 5"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 6"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 7"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 8"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 9"&gt;   &lt;w:lsdexception locked="false" priority="35" qformat="true" name="caption"&gt;   &lt;w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"&gt;   &lt;w:lsdexception locked="false" priority="1" name="Default Paragraph Font"&gt;   &lt;w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"&gt;   &lt;w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"&gt;   &lt;w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"&gt;   &lt;w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Revision"&gt;   &lt;w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"&gt;   &lt;w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"&gt;   &lt;w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"&gt;   &lt;w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"&gt;   &lt;w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"&gt;   &lt;w:lsdexception locked="false" priority="37" name="Bibliography"&gt;   &lt;w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face  {font-family:"Cambria Math";  panose-1:2 4 5 3 5 4 6 3 2 4;  mso-font-charset:1;  mso-generic-font-family:roman;  mso-font-format:other;  mso-font-pitch:variable;  mso-font-signature:0 0 0 0 0 0;} @font-face  {font-family:Calibri;  panose-1:2 15 5 2 2 2 4 3 2 4;  mso-font-charset:0;  mso-generic-font-family:swiss;  mso-font-pitch:variable;  mso-font-signature:-1610611985 1073750139 0 0 159 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal  {mso-style-unhide:no;  mso-style-qformat:yes;  mso-style-parent:"";  margin-top:0in;  margin-right:0in;  margin-bottom:10.0pt;  margin-left:0in;  line-height:115%;  mso-pagination:widow-orphan;  font-size:11.0pt;  font-family:"Calibri","sans-serif";  mso-ascii-font-family:Calibri;  mso-ascii-theme-font:minor-latin;  mso-fareast-font-family:Calibri;  mso-fareast-theme-font:minor-latin;  mso-hansi-font-family:Calibri;  mso-hansi-theme-font:minor-latin;  mso-bidi-font-family:"Times New Roman";  mso-bidi-theme-font:minor-bidi;} .MsoChpDefault  {mso-style-type:export-only;  mso-default-props:yes;  mso-ascii-font-family:Calibri;  mso-ascii-theme-font:minor-latin;  mso-fareast-font-family:Calibri;  mso-fareast-theme-font:minor-latin;  mso-hansi-font-family:Calibri;  mso-hansi-theme-font:minor-latin;  mso-bidi-font-family:"Times New Roman";  mso-bidi-theme-font:minor-bidi;} .MsoPapDefault  {mso-style-type:export-only;  margin-bottom:10.0pt;  line-height:115%;} @page Section1  {size:8.5in 11.0in;  margin:1.0in 1.0in 1.0in 1.0in;  mso-header-margin:.5in;  mso-footer-margin:.5in;  mso-paper-source:0;} div.Section1  {page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable  {mso-style-name:"Table Normal";  mso-tstyle-rowband-size:0;  mso-tstyle-colband-size:0;  mso-style-noshow:yes;  mso-style-priority:99;  mso-style-qformat:yes;  mso-style-parent:"";  mso-padding-alt:0in 5.4pt 0in 5.4pt;  mso-para-margin-top:0in;  mso-para-margin-right:0in;  mso-para-margin-bottom:10.0pt;  mso-para-margin-left:0in;  line-height:115%;  mso-pagination:widow-orphan;  font-size:11.0pt;  font-family:"Calibri","sans-serif";  mso-ascii-font-family:Calibri;  mso-ascii-theme-font:minor-latin;  mso-fareast-font-family:"Times New Roman";  mso-fareast-theme-font:minor-fareast;  mso-hansi-font-family:Calibri;  mso-hansi-theme-font:minor-latin;} &lt;/style&gt; &lt;![endif]--&gt;Paste the code in Word, copy it from there and paste here (in Compose mode). Then we'll have the source code color preserved!&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color:blue;"&gt;function&lt;/span&gt; sayAlice() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color:blue;"&gt;var&lt;/span&gt; sayAlert = &lt;span style="color:blue;"&gt;function&lt;/span&gt;() { alert(alice); }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color:green;"&gt;// Local variable that ends up within closure&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color:blue;"&gt;var&lt;/span&gt; alice = &lt;span style="color: rgb(163, 21, 21);"&gt;'Hello Alice'&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin-bottom: 0.0001pt; line-height: normal;"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color:blue;"&gt;return&lt;/span&gt; sayAlert;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="line-height: 115%;font-family:&amp;quot;;font-size:10;"  &gt;&lt;span style=""&gt;        &lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-8542974098556202321?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/8542974098556202321/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=8542974098556202321' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/8542974098556202321'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/8542974098556202321'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2009/04/color-of-source-code-in-blog.html' title='Color of Source Code in Blog'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-6414930153161566043</id><published>2009-03-24T17:03:00.000-04:00</published><updated>2009-03-24T17:19:14.906-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='updatepanel javascript'/><title type='text'>javascript code not working when using updatepanel?</title><content type='html'>I have some javascript code gets executed when window.onload is fired. It basically modifies the appearance of my server controls. Everything works fine before I placed my server controls in an updatePanel(ASP.NET).&lt;br /&gt;&lt;br /&gt;When the page got partially rendered(i.e. I clicked the button which is inside the updatePanel to cause a postback), the javascript code didn't work anymore.&lt;br /&gt;&lt;br /&gt;I haven't delve into this issue to completely understand this, but I found a solution. It is to use PageRequestManager to register the javascript function I'd like to call each time there is a postback(async or sync). The code is: &lt;br /&gt;function load() {&lt;br /&gt;Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(javascriptFuncName);&lt;br /&gt;}&lt;br /&gt;Then add onload="load()" to body tag.&lt;br /&gt;&lt;br /&gt;For reference:http://msdn.microsoft.com/en-us/library/bb311028.aspx(Sys.WebForms.PageRequestManager Class)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-6414930153161566043?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/6414930153161566043/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=6414930153161566043' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/6414930153161566043'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/6414930153161566043'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2009/03/javascript-code-not-working-when-using.html' title='javascript code not working when using updatepanel?'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-3767001767699261291</id><published>2009-03-18T14:54:00.000-04:00</published><updated>2009-03-18T14:58:10.351-04:00</updated><title type='text'>Web page gets messy in IE6</title><content type='html'>&lt;a href="http://3.bp.blogspot.com/_UX_DoHjmTOg/ScFEP6RoEgI/AAAAAAAAAAU/9DnTLwyYgJg/s1600-h/messy.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 246px;" src="http://3.bp.blogspot.com/_UX_DoHjmTOg/ScFEP6RoEgI/AAAAAAAAAAU/9DnTLwyYgJg/s320/messy.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5314604075405808130" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The problem: Using background inside frames.&lt;br /&gt;The solution: Use img instead of background and set its z-index properly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-3767001767699261291?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/3767001767699261291/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=3767001767699261291' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/3767001767699261291'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/3767001767699261291'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2009/03/web-page-gets-messy-in-ie6.html' title='Web page gets messy in IE6'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_UX_DoHjmTOg/ScFEP6RoEgI/AAAAAAAAAAU/9DnTLwyYgJg/s72-c/messy.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-1679104047348981576</id><published>2009-03-18T10:53:00.000-04:00</published><updated>2009-03-18T10:58:24.474-04:00</updated><title type='text'>Setup IIS for ASP.NET projects</title><content type='html'>1. Make sure .Net Framework and IIS are installed.&lt;br /&gt;2. Register ASP.NET with IIS by executing ASPNET_REGIIS.EXE -i  Use the one from version 2.0 (i.e.  C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727) &lt;br /&gt;3. Make sure ASP.NET 2.0 is the default framework: &lt;br /&gt;      1)Open IIS &lt;br /&gt;      2)Right-click on the default web site and click 'properties'. &lt;br /&gt;      3)Click on the ASP.NET tab. &lt;br /&gt;      4)Select ASP.NET 2.0 as the default version. &lt;br /&gt;      5)Repeat for the target web virtual directory&lt;br /&gt;4. Click on Web Service Extensions and mark  ASP.NET v2.0.50727 as 'allowed'. (For IIS 5.1, ignore this)&lt;br /&gt;5. Right Click on the virtual directory - select properties and then click on "Create" next to the "Application" Label and the textbox. It will automatically create the "application" using the virtual directory's name. Now the application can be accessed.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-1679104047348981576?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/1679104047348981576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=1679104047348981576' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/1679104047348981576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/1679104047348981576'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2009/03/setup-iis-for-aspnet-projects.html' title='Setup IIS for ASP.NET projects'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-3090250964744851059</id><published>2009-03-15T13:39:00.000-04:00</published><updated>2009-03-15T13:43:28.800-04:00</updated><title type='text'>Coninental ticket number on eTicket Boarding Pass</title><content type='html'>My eTicket has 14 digits while the ticket number of Continental is 13 digits which starts with 005. Just ignore the damn last digit.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-3090250964744851059?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/3090250964744851059/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=3090250964744851059' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/3090250964744851059'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/3090250964744851059'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2009/03/coninental-ticket-number-on-eticket.html' title='Coninental ticket number on eTicket Boarding Pass'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-4590845308958045489</id><published>2009-03-10T11:51:00.000-04:00</published><updated>2009-03-10T12:11:09.435-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='scroll scrollable table div'/><title type='text'>Making a table scrollable</title><content type='html'>The whole point is to make an html table(asp.net table or whatever is rendered as an html one) sitting inside a div element that has overflow attribute set to "auto" or "scroll".&lt;br /&gt;&lt;br /&gt;For example:&lt;br /&gt;  &amp;lt;div style="border-style: solid; overflow: scroll; height: 100px; width: 100px;"&amp;gt;&lt;br /&gt;&lt;br /&gt;      &amp;lt;asp:table id="table" runat="server" borderwidth="1px" width="100%"&amp;gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;/asp:table&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;asp:Panel is render as div, we can also use it:&lt;br /&gt;&lt;br /&gt;  &lt;asp:panel id="pl2" runat="server" height="100px" width="50%" cssclass="overflow"&gt;&lt;br /&gt;    &amp;lt;table border="1" width="100%"&amp;gt;&lt;br /&gt;&lt;br /&gt;              &amp;lt;tbody&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;stuff&amp;lt;/td&amp;gt;&lt;br /&gt;&lt;br /&gt;          &amp;lt;td&amp;gt;more stuff&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;&lt;br /&gt;              &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;stuff&amp;lt;/td&amp;gt;&lt;br /&gt;&lt;br /&gt;          &amp;lt;td&amp;gt;more stuff&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;&lt;br /&gt;              &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;stuff&amp;lt;/td&amp;gt;&lt;br /&gt;&lt;br /&gt;          &amp;lt;td&amp;gt;more stuff&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;&lt;br /&gt;              &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;stuff&amp;lt;/td&amp;gt;&lt;br /&gt;&lt;br /&gt;          &amp;lt;td&amp;gt;more stuff&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;&lt;br /&gt;              &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;stuff&amp;lt;/td&amp;gt;&lt;br /&gt;&lt;br /&gt;          &amp;lt;td&amp;gt;more stuff&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;/tbody&amp;gt;&amp;lt;/table&amp;gt;&lt;br /&gt;  &lt;/asp:panel&gt;&lt;br /&gt;&lt;br /&gt;Just aware that we need to set the "CssClass" attribute for asp:Panel (not "Style", not "overflow"). Same technique should be able to make other control scrollable (e.g. GridView).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-4590845308958045489?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/4590845308958045489/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=4590845308958045489' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/4590845308958045489'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/4590845308958045489'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2009/03/making-table-scrollable.html' title='Making a table scrollable'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-5178428497941856651</id><published>2008-09-07T13:48:00.000-04:00</published><updated>2008-09-07T13:55:15.979-04:00</updated><title type='text'>Making Tomcat Support JSF</title><content type='html'>1. Download the latest version of the JSF Reference Implementation from &lt;a href="http://java.sun.com/j2ee/javaserverfaces/download.html"&gt;http://java.sun.com/j2ee/javaserverfaces/download.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;2. Unzip the downloaded file. Copy all JAR files files from the &lt;tt&gt;lib&lt;/tt&gt; subdirectory of JSF unzipped folder to the &lt;tt&gt;lib&lt;/tt&gt; subdirectory of Tomcat. (At the time of writing, they are &lt;tt&gt;jsf-api.jar&lt;/tt&gt;&lt;tt&gt; jsf-impl.jar&lt;/tt&gt;)&lt;br /&gt;&lt;br /&gt;3. Copy the following two JAR files from the &lt;tt&gt;webapps/examples/WEB-INF/lib&lt;/tt&gt; subdirectory of Tomcat installation to the &lt;tt&gt;lib&lt;/tt&gt; subdirectory of Tomcat&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;tt&gt;jstl.jar&lt;/tt&gt;&lt;/li&gt;&lt;li&gt;&lt;tt&gt;standard.jar&lt;/tt&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-5178428497941856651?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/5178428497941856651/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=5178428497941856651' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/5178428497941856651'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/5178428497941856651'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2008/09/making-tomcat-support-jsf.html' title='Making Tomcat Support JSF'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-7175515710177597095</id><published>2008-08-20T14:02:00.000-04:00</published><updated>2008-08-20T14:29:56.562-04:00</updated><title type='text'>Show Ellipsis Text in GridView</title><content type='html'>protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;   {&lt;br /&gt;       // ... ...&lt;br /&gt;       gv1.Style["TABLE-LAYOUT"] = "fixed";&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   protected void gv1_RowCreated(object sender, GridViewRowEventArgs e)&lt;br /&gt;   {&lt;br /&gt;       foreach (TableCell cell in e.Row.Cells)&lt;br /&gt;       {&lt;br /&gt;           cell.Wrap = false;&lt;br /&gt;           cell.Style["overflow"] = "hidden";&lt;br /&gt;           cell.Style["text-overflow"] = "ellipsis";&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   // Showing full text tooltip in each cell&lt;br /&gt;   protected void gv1_RowDataBound(object sender, GridViewRowEventArgs e)&lt;br /&gt;   {&lt;br /&gt;       foreach (TableCell cell in e.Row.Cells)&lt;br /&gt;       {&lt;br /&gt;           cell.ToolTip = cell.Text;&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;The above code just shows what style settings need to be set for the ellipsis effect. It is not recommended to write product code like this. Keep in mind that&lt;br /&gt;gv1.Style["TABLE-LAYOUT"] = "fixed";&lt;br /&gt;actually sets "TABLE-LAYOUT" style property of HTML Table. Therefore, this should be done in a CSS file: not only to separate UI part from logic part, but to make the data travel between server and client much light-weighted. (To demonstrate the last part, look at the source of the rendered HTML to see the table cell styles are duplicated across all the tags.)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-7175515710177597095?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/7175515710177597095/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=7175515710177597095' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/7175515710177597095'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/7175515710177597095'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2008/08/show-ellipsis-text-in-gridview.html' title='Show Ellipsis Text in GridView'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-2360403535400645548</id><published>2008-08-18T11:47:00.000-04:00</published><updated>2008-09-04T15:50:03.913-04:00</updated><title type='text'>Register Custom Control in Web Page</title><content type='html'>When we want to use a User Control (which is defined in *.ascx) in a web page, we can register the control like this:&lt;br /&gt;&amp;lt;%@ Register Src="~/MyObjectDisplayer.ascx" TagName="MOD" TagPrefix="CustomControl" %&gt;&lt;br /&gt;&lt;br /&gt;If we use a Custom Control (which is defined in *.cs), however, the register tag should be a little different:&lt;br /&gt;&amp;lt;%@ Register Namespace="MyControls" TagPrefix="CustomControl" %&gt;&lt;br /&gt;&lt;br /&gt;Whenever we want to place this control in the webpage, we write:&lt;br /&gt;&amp;lt;CustomControl:PromptButton id="pb1" runat="server"/&gt;&lt;br /&gt;&lt;br /&gt;It assumes that our control classes is PromptButton and it is in MyControls namespace. And note that it has been tested in ASP.NET Web Site project, but not in ASP.NET Web Application project.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-2360403535400645548?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/2360403535400645548/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=2360403535400645548' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/2360403535400645548'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/2360403535400645548'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2008/08/register-custom-control-in-web-page.html' title='Register Custom Control in Web Page'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-8625379191823286098</id><published>2008-08-05T11:39:00.000-04:00</published><updated>2008-08-05T11:50:22.191-04:00</updated><title type='text'>The Statelessness of Web Page</title><content type='html'>In ASP.NET, it is common to have some data members of our Page class (one who derived from System.Web.UI.Page). It is important to keep in mind that those members are re-defined or re-declared every time a new instance of our Page class is created. This happens each time there is a round-trip between the server and the browser (i.e. but may not limited to: Page_Load event). Therefore, we need to be aware of the state of those data members.&lt;br /&gt;&lt;br /&gt;One more thing: even if an UpdatePanel is used in a page, Page_Load event still gets fired every time.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-8625379191823286098?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/8625379191823286098/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=8625379191823286098' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/8625379191823286098'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/8625379191823286098'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2008/08/statelessness-of-web-page.html' title='The Statelessness of Web Page'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-979335415523462768</id><published>2008-07-29T16:03:00.001-04:00</published><updated>2008-07-29T16:09:25.697-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='TreeView Recursive'/><title type='text'>Building TreeView Programmably in a Recursively Fashion</title><content type='html'>Below is an example of building a TreeView from a registry hierarchy. Note that RegistryKey and Registry objects are in Microsoft.Win32 namespace.&lt;br /&gt;&lt;br /&gt;private int maxDepth = 0, depth = 0;&lt;br /&gt;&lt;br /&gt;protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;    RegistryKey schangeRoot = Registry.LocalMachine.OpenSubKey("Software\\SeaChange", false);&lt;br /&gt;&lt;br /&gt;    TreeNode rootNode = new TreeNode(schangeRoot.Name);&lt;br /&gt;&lt;br /&gt;    Traverse(schangeRoot, rootNode);&lt;br /&gt;&lt;br /&gt;    Response.Write(maxDepth.ToString() + "&lt;/br&gt;" + depth.ToString());&lt;br /&gt;&lt;br /&gt;    TreeView1.Nodes.Add(rootNode);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private void Traverse(RegistryKey current, TreeNode currentNode)&lt;br /&gt;{&lt;br /&gt;    Response.Write(depth.ToString() + current.Name + "&lt;/br&gt;");&lt;br /&gt;&lt;br /&gt;    if (current.SubKeyCount &lt;= 0)&lt;br /&gt;    {&lt;br /&gt;        if (depth &gt; maxDepth)&lt;br /&gt;            maxDepth = depth;&lt;br /&gt;&lt;br /&gt;        return;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    foreach (string subkeyName in current.GetSubKeyNames())&lt;br /&gt;    {&lt;br /&gt;        // Before traversing the subkey, create a new node for it&lt;br /&gt;        TreeNode childNode = new TreeNode(subkeyName);&lt;br /&gt;&lt;br /&gt;        // Traverse subkey&lt;br /&gt;        depth++;&lt;br /&gt;        Traverse(current.OpenSubKey(subkeyName), childNode);&lt;br /&gt;        depth--;&lt;br /&gt;&lt;br /&gt;        // Finish traversing the subkey, add the subkey to this node&lt;br /&gt;        currentNode.ChildNodes.Add(childNode);&lt;br /&gt;    }&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-979335415523462768?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/979335415523462768/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=979335415523462768' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/979335415523462768'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/979335415523462768'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2008/07/building-treeview-programmably-in.html' title='Building TreeView Programmably in a Recursively Fashion'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-8263714201959751775</id><published>2008-07-24T11:05:00.000-04:00</published><updated>2008-07-24T11:26:04.777-04:00</updated><title type='text'>Cannot Access Profile Property in Webpage</title><content type='html'>In web application projects, we cannot access Profile property as what we do in web site projects. (See the differences between the two projects here: &lt;a href="http://webproject.scottgu.com/CSharp/Migration2/Migration2.aspx"&gt;Introduction to Web Application Projects&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;To work around this, use &lt;a href="http://www.codeplex.com/WebProfile"&gt;ASP.NET WebProfileGenerator&lt;/a&gt;, which is an add-in for Visual Studio. If we don't want to use an add-in, we could implement a custom profile provider. Use &lt;a href="http://weblogs.asp.net/jgalloway/archive/2008/01/19/writing-a-custom-asp-net-profile-class.aspx"&gt;this article&lt;/a&gt; for a reference.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-8263714201959751775?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/8263714201959751775/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=8263714201959751775' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/8263714201959751775'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/8263714201959751775'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2008/07/cannot-access-profile-property-in.html' title='Cannot Access Profile Property in Webpage'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-4904726343894436407</id><published>2008-07-23T11:24:00.000-04:00</published><updated>2008-07-23T11:52:16.721-04:00</updated><title type='text'>The Importance of Page.IsPostBack</title><content type='html'>For most of the time, we should think about adding if(!Page.IsPostBack) block in Page_Load event of our webpage. Since ViewState of all the webcontrols are enabled by default, most of the time the logic in Page_Load event is supposed to be executed only during the first time webpage is loaded. If we forget to wrap the logic inside the if block when we are supposed to do so, not only can it causes inefficiency, but leads to bugs.&lt;br /&gt;&lt;br /&gt;Here is an example. (Refer to ASP.NET security tutorial #10 &lt;a href="http://www.asp.net/learn/security/tutorial-10-cs.aspx"&gt;http://www.asp.net/learn/security/tutorial-10-cs.aspx&lt;/a&gt;, step 4)&lt;br /&gt;&lt;br /&gt;If we don't wrap the following logic inside if(!Page.IsPostBack) block:&lt;br /&gt;&lt;br /&gt;// Reference the SpecifyRolesStep WizardStep&lt;br /&gt;WizardStep SpecifyRolesStep = RegisterUserWithRoles.FindControl("SpecifyRolesStep") as WizardStep;&lt;br /&gt;// Reference the RoleList CheckBoxList&lt;br /&gt;CheckBoxList RoleList = SpecifyRolesStep.FindControl("RoleList") as CheckBoxList;&lt;br /&gt;// Bind the set of roles to RoleList&lt;br /&gt;RoleList.DataSource = Roles.GetAllRoles();&lt;br /&gt;RoleList.DataBind();&lt;br /&gt;&lt;br /&gt;something unexpected will happen.&lt;br /&gt;&lt;br /&gt;During the second step of the wizard, if we check any role we'd like to assign to the newly created user, it will fail to assign. After we check any CheckBox on the CheckBoxList and press the next button, the logic in Page_Load event is executed again. This will cause the RoleList to be bound again. It seems to be harmless at first, but the truth is, RoleList.DataBind() will clear any change made to the CheckBoxList. Hence, even if we've checked some CheckBox in the RoleList the second step, they all become unchecked now.&lt;br /&gt;&lt;br /&gt;So, in this case, there is no reason not to use if(!Page.IsPostBack) block.&lt;br /&gt;&lt;br /&gt;Perhaps saying "most of the time if(!Page.IsPostBack) block should be added in Page_Load event" is a bit absolute; but for me, I'll wrap the logic in the block every time; unless there is a reason convinces me not to do so.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-4904726343894436407?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/4904726343894436407/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=4904726343894436407' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/4904726343894436407'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/4904726343894436407'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2008/07/importance-of-pageispostback.html' title='The Importance of Page.IsPostBack'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-3813832194123860624</id><published>2008-07-18T11:36:00.000-04:00</published><updated>2008-07-18T11:55:58.460-04:00</updated><title type='text'>Configuring passwordFormat="Encrypted" in ASP.NET</title><content type='html'>When setting passwordFortmat="Encrypted" (compared to "Hashed" by default) in web.config, I got an exception after trying to create a user.&lt;br /&gt;&lt;br /&gt;Solution:&lt;br /&gt;A &lt;machinekey/&gt; tag is necessary in this case. I think it is used to encrypt password. MSDN says about machineKey:&lt;br /&gt;Configures keys to use for encryption and decryption of forms authentication cookie data and view-state data, and for verification of out-of-process session state identification.&lt;br /&gt;A typical tag looks like this:&lt;br /&gt;&lt;machinekey validationkey="2F30EED1BD5473845A866069D298342DCF9AD97B92717B5868C40568C9F210D1436421F6D2965414133621B49DEA34C2D0C06869823AC345BE56E0EDBB07236F" decryptionkey="403C7FDC63F90C840FA03D2C454F292A582BA7030F2CE1BF" validation="SHA1"&gt;&lt;br /&gt;&lt;br /&gt;The following is a &lt;machinekey&gt; generator:&lt;br /&gt;&lt;a href="http://www.aspnetresources.com/tools/keycreator.aspx"&gt;http://www.aspnetresources.com/tools/keycreator.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-3813832194123860624?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/3813832194123860624/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=3813832194123860624' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/3813832194123860624'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/3813832194123860624'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2008/07/configuring-passwordformatencrypted-in.html' title='Configuring passwordFormat=&quot;Encrypted&quot; in ASP.NET'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-8834931639920799075</id><published>2008-07-07T16:11:00.000-04:00</published><updated>2008-07-07T16:20:50.294-04:00</updated><title type='text'>Passing Reference in C#</title><content type='html'>In the article &lt;a href="http://msdn.microsoft.com/en-us/library/s6938f28(VS.80).aspx"&gt;Passing Reference-Type Parameters&lt;/a&gt;, we've seen that we need to use the "ref" keyword in order to swap string values. This is also true for any other reference-types such as an ArrayList.&lt;br /&gt;&lt;br /&gt;Remember:&lt;br /&gt;&lt;code&gt;When you pass a reference-type parameter by value, it is possible to change the data pointed to by the reference, such as the value of a class member. However, you cannot change the value of the reference itself;&lt;/code&gt; ...&lt;br /&gt;&lt;br /&gt;This reminds me the differences between a reference and a pointer: In the swap function, if we are passing parameters by pointer(like in C or C++), then any local change is also global;  if we are passing parameters by reference (like in C#), then any local change is not global.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-8834931639920799075?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/8834931639920799075/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=8834931639920799075' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/8834931639920799075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/8834931639920799075'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2008/07/passing-reference-in-c.html' title='Passing Reference in C#'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-5434567075866025453</id><published>2008-03-31T16:33:00.000-04:00</published><updated>2008-03-31T16:39:03.378-04:00</updated><title type='text'>Every keyCode is 229?!</title><content type='html'>I need to blog this. When I was debugging javascript, I found that no matter I press "A" or "X", the keyCode of it is 229. It turned out that I was typing using Microsoft PinYin. Although the mode is English instead of Chinese, it is Chinese  input keyboard anyway. That's why the keyCode behaves strangly.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-5434567075866025453?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/5434567075866025453/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=5434567075866025453' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/5434567075866025453'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/5434567075866025453'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2008/03/every-keycode-is-229.html' title='Every keyCode is 229?!'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-500850689313200937</id><published>2008-03-02T17:14:00.000-05:00</published><updated>2008-03-02T17:19:19.060-05:00</updated><title type='text'>Constant Pointers and Pointers to Constants</title><content type='html'>&lt;span class="bodycopy"&gt;&lt;span class="bodycopy"&gt;&lt;pre&gt;&lt;a name="more"&gt;&lt;span class="bodycopy"&gt;&lt;span style="font-family:arial;"&gt;1. Pointer to Constant&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="bodycopy"&gt;&lt;span class="bodycopy"&gt;&lt;pre&gt;&lt;span class="codeKeyword"&gt;&lt;a name="more"&gt;char&lt;/a&gt;&lt;/span&gt;&lt;a name="more"&gt; char_A = 'A';&lt;br /&gt;&lt;span class="codeKeyword"&gt;const&lt;/span&gt; &lt;span class="codeKeyword"&gt;char&lt;/span&gt; * myPtr = &amp;amp;char_A;&lt;br /&gt;*myPtr = 'J';    // error - can't change value of *myPtr&lt;br /&gt;&lt;br /&gt;&lt;span class="bodycopy"&gt;&lt;span style="font-family:arial;"&gt;2. Constant Pointer&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="bodycopy"&gt;&lt;span class="bodycopy"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;pre&gt;&lt;a name="more"&gt;&lt;span class="bodycopy"&gt;&lt;span class="bodycopy"&gt;&lt;span class="codeKeyword"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="bodycopy"&gt;&lt;span class="codeKeyword"&gt;&lt;a name="more"&gt;&lt;span class="bodycopy"&gt;char&lt;/span&gt;&lt;/a&gt;&lt;span class="bodycopy"&gt;&lt;/span&gt;&lt;span class="bodycopy"&gt;&lt;a name="more"&gt; char_A = 'A';&lt;br /&gt;&lt;span class="codeKeyword"&gt;char&lt;/span&gt; char_B = 'B';&lt;br /&gt;&lt;br /&gt;&lt;span class="codeKeyword"&gt;char&lt;/span&gt; * &lt;span class="codeKeyword"&gt;const&lt;/span&gt; myPtr = &amp;amp;char_A;&lt;br /&gt;myPtr = &amp;amp;char_B;    &lt;span class="codeComment"&gt;// error - can't change address of myPtr&lt;/span&gt; &lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span class="bodycopy"&gt;&lt;span class="bodycopy"&gt;&lt;span class="codeKeyword"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;span class="bodycopy"&gt;&lt;span class="bodycopy"&gt;&lt;span class="codeKeyword"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-500850689313200937?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/500850689313200937/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=500850689313200937' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/500850689313200937'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/500850689313200937'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2008/03/constant-pointers-and-pointers-to.html' title='Constant Pointers and Pointers to Constants'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-9035207864514150753</id><published>2008-03-02T15:49:00.000-05:00</published><updated>2008-03-02T15:50:25.405-05:00</updated><title type='text'>Difference between Reference and Pointer</title><content type='html'>&lt;strong&gt;&lt;span style="font-size: 130%; color: rgb(0, 0, 153);"&gt;Difference between Reference and Pointer in C++&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Reference should be initialized and pointer need not be.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Reference can’t point to NULL and pointer can.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Reference can’t be changed to some other objects it is once initialized but pointer can be.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Pointer can be incremented or decremented and subjected to any pointer arithmetic operations, but reference can’t.&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-9035207864514150753?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/9035207864514150753/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=9035207864514150753' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/9035207864514150753'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/9035207864514150753'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2008/03/difference-between-reference-and.html' title='Difference between Reference and Pointer'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-1449761802592354810</id><published>2008-02-10T19:27:00.000-05:00</published><updated>2008-02-10T19:29:16.213-05:00</updated><title type='text'>Quotes</title><content type='html'>Half the world is composed of people who have something to say and can't; the other half have nothing to say and keep saying it.&lt;br /&gt;&lt;br /&gt;If anything can go wrong, it will.&lt;br /&gt;&lt;br /&gt;Chance favors the prepared mind.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-1449761802592354810?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/1449761802592354810/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=1449761802592354810' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/1449761802592354810'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/1449761802592354810'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2008/02/quotes.html' title='Quotes'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-2884710580053931653</id><published>2008-01-30T15:57:00.000-05:00</published><updated>2008-01-30T16:20:52.544-05:00</updated><title type='text'>Add() method in .NET (passing parameter)</title><content type='html'>Collection objects have Add() method in .NET. It is very important to understand how it works.&lt;br /&gt;&lt;br /&gt;Code Block 1:&lt;br /&gt;        TableRow row = new TableRow();&lt;br /&gt;        for (int i = 0; i &lt; resultFields.Count; i++)&lt;br /&gt;        {&lt;br /&gt;           &lt;br /&gt;            foreach(string str in resultFields[i])&lt;br /&gt;            {&lt;br /&gt;                TableCell cell = new TableCell();&lt;br /&gt;                cell.Text = str;&lt;br /&gt;                this.Response.Write(str);&lt;br /&gt;                row.Cells.Add(cell);&lt;br /&gt;            }&lt;br /&gt;            tbl_rsltFields.Rows.Add(row);&lt;br /&gt;        }       &lt;br /&gt;In this example, if resultFields.Count is 2, how many rows do you think are in the tbl_rsltFields?&lt;br /&gt;The answer is 1. It is worth noticing this case.&lt;br /&gt;&lt;br /&gt;Code Block 2:&lt;br /&gt;        for (int i = 0; i &lt; resultFields.Count; i++)&lt;br /&gt;        {&lt;br /&gt;            TableRow row = new TableRow();&lt;br /&gt;           &lt;br /&gt;            foreach(string str in resultFields[i])&lt;br /&gt;            {&lt;br /&gt;                TableCell cell = new TableCell();&lt;br /&gt;                cell.Text = str;&lt;br /&gt;                this.Response.Write(str);&lt;br /&gt;                row.Cells.Add(cell);&lt;br /&gt;            }&lt;br /&gt;            tbl_rsltFields.Rows.Add(row);&lt;br /&gt;        }  &lt;br /&gt;In this case, the answer is 2.&lt;br /&gt;&lt;br /&gt;Actually, if we try to add "row.Cells.Clear();" right after "tbl_rsltFields.Rows.Add(row)" in code block 1, there will be nothing contained in tbl_rsltFields at last. Based on this fact, we know that by calling Add() method, it only gets a copy of the reference, instead of making a copy of the whole row. So it acts like it is passing reference by value.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-2884710580053931653?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/2884710580053931653/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=2884710580053931653' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/2884710580053931653'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/2884710580053931653'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2008/01/add-method-in-net-passing-parameter.html' title='Add() method in .NET (passing parameter)'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-7778740613895374288</id><published>2008-01-23T12:20:00.000-05:00</published><updated>2008-01-23T12:27:17.395-05:00</updated><title type='text'>Application["UserCount"] += 1 doesn't work</title><content type='html'>Why does &lt;span style="font-style: italic;"&gt;Application["UserCount"] += 1;&lt;/span&gt; incur compiler error? It's the same reason why &lt;span style="font-style: italic;"&gt;Application["UserCount"] = Application["UserCount"] + 1;&lt;/span&gt; doesn't work either.&lt;br /&gt;&lt;br /&gt;And once you know the correct way should be: &lt;span style="font-style: italic;"&gt;Application["UserCount"] = (int)Application["UserCount"] + 1;&lt;/span&gt; you'll also know &lt;span style="font-style: italic;"&gt;(int)Application["UserCount"] += 1;&lt;/span&gt; is wrong too.&lt;span style="font-style: italic;"&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-7778740613895374288?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/7778740613895374288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=7778740613895374288' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/7778740613895374288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/7778740613895374288'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2008/01/applicationusercount-1-doesnt-work.html' title='Application[&quot;UserCount&quot;] += 1 doesn&apos;t work'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-2617057070455874228</id><published>2007-12-11T13:04:00.000-05:00</published><updated>2007-12-11T13:15:37.817-05:00</updated><title type='text'>What's wrong with Monitor::Enter()</title><content type='html'>Suppose we have the following variable we'd like to set as a state and we'd like to make it thread safe (at most one thread is allowed to access the variable):&lt;br /&gt;&lt;br /&gt;bool workQueued;&lt;br /&gt;&lt;br /&gt;Now if we write something like this, it's not gonna work:&lt;br /&gt;&lt;br /&gt;Monitor::Enter(__box(workQueued));&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;    workQueued = true;&lt;br /&gt;}&lt;br /&gt;__finally&lt;br /&gt;{&lt;br /&gt;    Monitor::Exit(__box(workQueued));&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Why it will not work? The problem is, after workQueued is boxed, the value is not store anywhere. So the second thread reaches here will execute Enter statement with another object value.&lt;br /&gt;&lt;br /&gt;To make it work as desired, we need to create a object whose only purpose is to act like a lock:&lt;br /&gt;&lt;br /&gt;Object* lock;&lt;br /&gt;&lt;br /&gt;Then, we feed this object to Enter and Exit method:&lt;br /&gt;&lt;br /&gt;Monitor::Enter(lock);&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;    workQueued = true;&lt;br /&gt;}&lt;br /&gt;__finally&lt;br /&gt;{&lt;br /&gt;    Monitor::Exit(lock);&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-2617057070455874228?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/2617057070455874228/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=2617057070455874228' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/2617057070455874228'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/2617057070455874228'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2007/12/whats-wrong-with-monitorenter.html' title='What&apos;s wrong with Monitor::Enter()'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-1312365977664782770</id><published>2007-12-05T15:43:00.000-05:00</published><updated>2007-12-05T16:00:54.160-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='lnk4075'/><title type='text'>LINK : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification</title><content type='html'>What the heck?! If you've spent more than ten minutes just trying to find where to set EDITANDCONTINUE property in VC++ project property page, you are not alone. It can be set through: (Under Project Property Pages) Configuration Properties -&gt; C/C++ -&gt; General -&gt; Debug Information Format.&lt;br /&gt;&lt;br /&gt;OK. Now I've set it NOT to be /ZI and disabled incremental link, why the darn VS still complain the same warning. Remember that no matter how bizarre a problem seems to be, computer always works as expected. Why don't you check the project properties of other projects that this project depends on?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-1312365977664782770?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/1312365977664782770/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=1312365977664782770' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/1312365977664782770'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/1312365977664782770'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2007/12/link-warning-lnk4075-ignoring.html' title='LINK : warning LNK4075: ignoring &apos;/EDITANDCONTINUE&apos; due to &apos;/INCREMENTAL:NO&apos; specification'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-6357914565496972352</id><published>2007-12-03T17:13:00.000-05:00</published><updated>2007-12-03T17:17:31.389-05:00</updated><title type='text'>Visual Studio got stuck when opening sln file</title><content type='html'>Sometimes VS may get stuck when we double-click a .sln file. We can see the file name on which it got stuck. But even if we try to rename that file or replace with another one with the same name, it may still not work. In this case, try to delete the corresponding .suo file.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-6357914565496972352?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/6357914565496972352/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=6357914565496972352' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/6357914565496972352'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/6357914565496972352'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2007/12/visual-studio-got-stuck-when-opening.html' title='Visual Studio got stuck when opening sln file'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-244506962455161233</id><published>2007-11-30T16:11:00.000-05:00</published><updated>2007-11-30T16:24:49.680-05:00</updated><title type='text'>Problem caused by dll loading mistake</title><content type='html'>It is very common that we have two versions of dll: somedll.dll(for Release build) and somedll_d.dll(for Debug build). Because of the dll dependancy complications, if these two versions were load at the same time, it may not cause build errors. However, something wrong can happen during the run time.&lt;br /&gt;&lt;br /&gt;For example, if there is a global variable in the source file whose output is somedll.dll/somedll_d.dll, that global variable may be initialized twice (once during the load time of somedll.dll and once during the load time of somedll_d.dll). The client code then will get confused on which of the two references to use. But the fact is, it should be only one instance of that global variable existing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-244506962455161233?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/244506962455161233/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=244506962455161233' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/244506962455161233'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/244506962455161233'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2007/11/problem-caused-by-dll-loading-mistake.html' title='Problem caused by dll loading mistake'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-292812827737405616</id><published>2007-11-29T16:57:00.000-05:00</published><updated>2007-11-29T17:08:40.583-05:00</updated><title type='text'>Time-saving Tips</title><content type='html'>1. Sometimes we may have weird link errors. Some of the errors will be gone if we try to delete the debug/release folder (clean) and rebuild the project.&lt;br /&gt;&lt;br /&gt;2. If an environment involves several executables and dlls working together, their build version should match exactly. Otherwise, some bizarre behaviors may happen.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-292812827737405616?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/292812827737405616/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=292812827737405616' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/292812827737405616'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/292812827737405616'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2007/11/time-saving-tips.html' title='Time-saving Tips'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-5803147576709770307</id><published>2007-11-29T13:23:00.000-05:00</published><updated>2007-11-29T13:29:22.967-05:00</updated><title type='text'>Mixed DLL Loading Problem</title><content type='html'>When using managed code inside unmanaged dll entry point, it may cause dll loading problem. For more information, follow the link below.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa290048(vs.71).aspx"&gt;http://msdn2.microsoft.com/en-us/library/aa290048(vs.71).aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-5803147576709770307?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/5803147576709770307/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=5803147576709770307' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/5803147576709770307'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/5803147576709770307'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2007/11/mixed-dll-loading-problem.html' title='Mixed DLL Loading Problem'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-6546871529489855611</id><published>2007-11-26T16:15:00.000-05:00</published><updated>2007-11-26T16:32:47.455-05:00</updated><title type='text'>Be Careful of Naming</title><content type='html'>Sometimes bad naming may cause compile errors.&lt;br /&gt;&lt;br /&gt;I named a managed enum "Event" (__value enum Event) inside a managed class "SopExt" (__gc class SopExt). In this class, I had a private field whose type is the managed enum "Event" and a pair of getter/setter of it. Later, I found that the compiler sometimes had trouble to recognize the expression like this: "sopExt-&gt;Event". The compiler sometimes also didn't recognize the type "SopExt::Event".&lt;br /&gt;&lt;br /&gt;Obviously, neither expression is wrong. But apperently, the name of the managed enum "Event" is not a good name. Just by changing "Event" to "StreamEvent" (without even changing the name of getter/setter), the compiler error is gone. The reason that caused the compiler error is not clear. It might be that the name "Event" is too general so it confused the compiler? Anyway, good naming is a very important element in programming.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-6546871529489855611?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/6546871529489855611/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=6546871529489855611' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/6546871529489855611'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/6546871529489855611'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2007/11/be-careful-of-naming.html' title='Be Careful of Naming'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-7992330430128901863</id><published>2007-11-16T14:45:00.000-05:00</published><updated>2007-11-16T14:47:01.461-05:00</updated><title type='text'>Examine std::vector in VS watch window</title><content type='html'>vector-&gt;_Myfirst[offset] or vector-&gt;_Myfirst, count&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-7992330430128901863?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/7992330430128901863/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=7992330430128901863' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/7992330430128901863'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/7992330430128901863'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2007/11/examine-stdvector-in-vs-watch-window.html' title='Examine std::vector in VS watch window'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-1781224401783591225</id><published>2007-11-15T11:59:00.000-05:00</published><updated>2008-01-30T18:01:40.409-05:00</updated><title type='text'>Why using managed extension is a pain in the ***?</title><content type='html'>1. We simply cannot include unmanaged objects in a managed class. We can only include pointers to unmanaged objects.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-1781224401783591225?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/1781224401783591225/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=1781224401783591225' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/1781224401783591225'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/1781224401783591225'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2007/11/why-using-managed-extension-is-pain-in.html' title='Why using managed extension is a pain in the ***?'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-341837442840235809</id><published>2007-11-13T10:39:00.000-05:00</published><updated>2007-11-13T13:22:33.408-05:00</updated><title type='text'>__gc Array Aggregate Initialization</title><content type='html'>__gc Array Aggregate Initialization doesn't work inside a namespace (except that the method is a member of a gc class). We have to initialize each element one by one.&lt;br /&gt;&lt;br /&gt;namespace Sample&lt;br /&gt;{&lt;br /&gt;void ParseString(String* str)&lt;br /&gt;{&lt;br /&gt;...&lt;br /&gt;Char splitter[] = { ',' }; // This will cause link error&lt;br /&gt;// Use the following instead&lt;br /&gt;// Char splitter[] = new Char[1];&lt;br /&gt;// splitter[0] = ',';&lt;br /&gt;...&lt;br /&gt;}&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-341837442840235809?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/341837442840235809/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=341837442840235809' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/341837442840235809'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/341837442840235809'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2007/11/gc-array-aggregate-initialization.html' title='__gc Array Aggregate Initialization'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-6152445863226617254</id><published>2007-10-17T13:18:00.000-04:00</published><updated>2007-10-17T13:28:01.268-04:00</updated><title type='text'>Switch between Windows debuggers</title><content type='html'>The key "Debugger" under registry:&lt;br /&gt;\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AeDebug&lt;br /&gt;specifies which debugger will be invoked in case of application unhandled exceptions are thrown.&lt;br /&gt;&lt;br /&gt;Usually, if Visual Studio is installed, the default debugger will be Visual Studio JIT Debugger("C:\WINDOWS\system32\vsjitdebugger.exe" -p %ld -e %ld); But if we want to use Dr. Watson(drwtsn32 -p %ld -e %ld -g) to debug (creating log and crash dump), we can set the key name of Dr. Watson to "Debugger" and VS JIT Debugger to something else.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-6152445863226617254?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/6152445863226617254/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=6152445863226617254' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/6152445863226617254'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/6152445863226617254'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2007/10/switch-between-windows-debuggers.html' title='Switch between Windows debuggers'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-2627693872960886709</id><published>2007-09-12T11:52:00.000-04:00</published><updated>2007-12-14T11:49:49.883-05:00</updated><title type='text'>About Copy Constructor</title><content type='html'>In the example below, push_back will call the copy constructor of Family implicitly. In this case, it's a deep copy. If we comment out the copy constructor, a default one will gets called, which is a shallow copy.&lt;br /&gt;&lt;br /&gt;If we have at least one complex object in a class, we should think about writing our own copy constructor. (choose between deep copy and shallow copy) If there's no complex object in the class, a default copy constructor will do since there's no difference between deep and shallow copy in this case. Remember that if we provide our own copy constructor, we also need to write the destructor so the complex objects can be deallocated.&lt;br /&gt;&lt;br /&gt;class Person&lt;br /&gt;{&lt;br /&gt;public:&lt;br /&gt;int age;&lt;br /&gt;Person()&lt;br /&gt;{&lt;br /&gt;age = 0;&lt;br /&gt;}&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;class Family&lt;br /&gt;{&lt;br /&gt;public:&lt;br /&gt;Person* houseHold;&lt;br /&gt;int aptNum;&lt;br /&gt;Family()&lt;br /&gt;{&lt;br /&gt;houseHold = 0;&lt;br /&gt;aptNum = 0;&lt;br /&gt;}&lt;br /&gt;Family(const Family&amp;amp; family)&lt;br /&gt;{&lt;br /&gt;this-&gt;houseHold = new Person(*family.houseHold);&lt;br /&gt;this-&gt;aptNum = family.aptNum;&lt;br /&gt;}&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;vector&lt;family&gt; vecF;&lt;br /&gt;Person* p = new Person();&lt;br /&gt;p-&gt;age = 30;&lt;br /&gt;Family* f = new Family();&lt;br /&gt;f-&gt;houseHold = p;&lt;br /&gt;f-&gt;aptNum = 100;&lt;br /&gt;vecF.push_back(*f);&lt;br /&gt;delete f;&lt;br /&gt;delete p;&lt;br /&gt;cout &lt;&lt;&lt;br /&gt;vecF.at(0).houseHold-&gt;age &lt;&lt; endl &lt;&lt; vecF.at(0).aptNum &lt;&lt; endl;&lt;br /&gt;getchar();&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-2627693872960886709?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/2627693872960886709/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=2627693872960886709' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/2627693872960886709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/2627693872960886709'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2007/09/about-copy-constructor.html' title='About Copy Constructor'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-3606914884832470546</id><published>2007-08-21T16:11:00.000-04:00</published><updated>2007-08-21T16:12:23.106-04:00</updated><title type='text'>A Key Difference Between an Assembly and an Unmanaged DLL or EXE</title><content type='html'>Assemblies are entirely self-describing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-3606914884832470546?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/3606914884832470546/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=3606914884832470546' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/3606914884832470546'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/3606914884832470546'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2007/08/key-difference-between-assembly-and.html' title='A Key Difference Between an Assembly and an Unmanaged DLL or EXE'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-7502147502647306102</id><published>2007-08-14T17:38:00.000-04:00</published><updated>2007-08-14T17:46:31.929-04:00</updated><title type='text'>Get used to managed C++ style definition</title><content type='html'>Sometimes the ugly managed c++ grammar can cause us much pain.&lt;br /&gt;&lt;br /&gt;For example, what is the correct way of defining a __wchar_t gc array?&lt;br /&gt;&lt;br /&gt;Wrong answers:&lt;br /&gt;__wchar_t charArr[] = {':', '\\'};&lt;br /&gt;__wchar_t[] charArr = {':', '\\'};&lt;br /&gt;__wchar_t __gc[] charArr = {':', '\\'};&lt;br /&gt;__wchar_t __gc charArr[] = {':', '\\'};&lt;br /&gt;__wchar_t __gc[] charArr[] = {':', '\\'};&lt;br /&gt;JUST_LET_ME_DEFINE_A_DAMN __wchar_t __gc charArr[] = {':', '\\'};&lt;br /&gt;&lt;br /&gt;Only this one is right:&lt;br /&gt;__wchar_t charArr __gc[] = {':', '\\'};&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-7502147502647306102?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/7502147502647306102/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=7502147502647306102' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/7502147502647306102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/7502147502647306102'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2007/08/get-used-to-managed-c-style-definition.html' title='Get used to managed C++ style definition'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-6053799314328139314</id><published>2007-07-20T14:22:00.000-04:00</published><updated>2007-08-08T15:33:07.177-04:00</updated><title type='text'>What I've learn from COOP</title><content type='html'>1. Enterprise-scaled project. More stuff to concern: multi-threading, better use on resources(memory etc.), structure flexibility, code reusability, refactoring.&lt;br /&gt;&lt;br /&gt;2. Testing. Software engineering knowledge and experience.&lt;br /&gt;&lt;br /&gt;3. Documenting code and project. Also improved writting skills.&lt;br /&gt;&lt;br /&gt;4. Interpersonal skills. Working with peers and supervisors. Presentation. Book club.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-6053799314328139314?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/6053799314328139314/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=6053799314328139314' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/6053799314328139314'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/6053799314328139314'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2007/07/what-ive-learn-from-coop.html' title='What I&apos;ve learn from COOP'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-7042066461068784160</id><published>2007-07-12T11:32:00.000-04:00</published><updated>2007-07-20T09:37:24.346-04:00</updated><title type='text'>Avoid Pitfalls</title><content type='html'>The following code snippet is error-prone:&lt;br /&gt;&lt;br /&gt;for (int i = 0; i &lt;&gt;SelectedIndices-&gt;Count; i++)&lt;br /&gt;{&lt;br /&gt;/* do something */&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Why? listView-&gt;SelectedIndices-&gt;Count may change in the loop. For example, if we delete one item in listView-&gt;SelectedIndices collection a time, listView-&gt;SelectedIndices-&gt;Count will be 1 less than the the value in last loop.&lt;br /&gt;&lt;br /&gt;Another common pitfall is, when deleting items in a collection, items after the deleted item are shifted automatically. Therefore, we are to delete some items one by one in a collection according to their initial indices, we need to delete them backwards.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-7042066461068784160?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/7042066461068784160/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=7042066461068784160' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/7042066461068784160'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/7042066461068784160'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2007/07/avoid-pitfalls.html' title='Avoid Pitfalls'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-8990255788952624331</id><published>2007-07-06T10:46:00.000-04:00</published><updated>2007-07-06T10:54:23.612-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='textbox autoscroll'/><title type='text'>Making Textbox control autoscrollable</title><content type='html'>If text is appended every time, we can do this way:&lt;br /&gt;&lt;br /&gt;txtBx-&gt;AppendText(strToAppend);&lt;br /&gt;txtBx-&gt;Focus();&lt;br /&gt;txtBx-&gt;ScrollToCaret();&lt;br /&gt;&lt;br /&gt;If text is completely loaded from the beginning to the end every time, it can be done this way:&lt;br /&gt;&lt;br /&gt;txtBx-&gt;Text = strContent;&lt;br /&gt;txtBx-&gt;Focus();&lt;br /&gt;txtBx-&gt;SelectionLength = 0;&lt;br /&gt;txtBx-&gt;SelectionStart = txtBx-&gt;Text-&gt;Length;&lt;br /&gt;txtBx-&gt;ScrollToCaret();&lt;br /&gt;&lt;br /&gt;In either case, Focus method is indispensable.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-8990255788952624331?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/8990255788952624331/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=8990255788952624331' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/8990255788952624331'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/8990255788952624331'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2007/07/making-textbox-control-autoscrollable.html' title='Making Textbox control autoscrollable'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-4704610879849935592</id><published>2007-07-05T16:16:00.000-04:00</published><updated>2007-07-05T16:26:21.165-04:00</updated><title type='text'>Implementing indexers in VC++</title><content type='html'>Unlike C#, C++ doesn't support indexers directly. However, we can achieve the same goal through a different way:&lt;br /&gt;&lt;br /&gt;[System::Reflection::DefaultMemberAttribute(S"Item")]&lt;br /&gt;public __gc class PlayoutLists : public ICollection&lt;br /&gt;{&lt;br /&gt;public:&lt;br /&gt;ArrayList* listArray;&lt;br /&gt;public:&lt;br /&gt;PlayoutLists()&lt;br /&gt;{&lt;br /&gt;listArray = new ArrayList();&lt;br /&gt;}&lt;br /&gt;public:&lt;br /&gt;__property PlayoutList* get_Item(int index)&lt;br /&gt;{&lt;br /&gt;return dynamic_cast&lt;playoutlist*&gt;(listArray-&gt;get_Item(index));&lt;br /&gt;}&lt;br /&gt;public: void CopyTo(Array* a, int index)&lt;br /&gt;{&lt;br /&gt;listArray-&gt;CopyTo(a, index);&lt;br /&gt;}&lt;br /&gt;public: __property int get_Count()&lt;br /&gt;{&lt;br /&gt;return listArray-&gt;get_Count();&lt;br /&gt;}&lt;br /&gt;public: __property Object* get_SyncRoot()&lt;br /&gt;{&lt;br /&gt;return listArray-&gt;get_SyncRoot();&lt;br /&gt;}&lt;br /&gt;public: __property bool get_IsSynchronized()&lt;br /&gt;{&lt;br /&gt;return false;&lt;br /&gt;}&lt;br /&gt;public: IEnumerator* GetEnumerator()&lt;br /&gt;{&lt;br /&gt;return listArray-&gt;GetEnumerator();&lt;br /&gt;}&lt;br /&gt;public: void Add(PlayoutList* newList)&lt;br /&gt;{&lt;br /&gt;listArray-&gt;Add(newList);&lt;br /&gt;}&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;get_Item (and set_Item if you want to be able to set the value) property will work the same way as indexers in C#.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-4704610879849935592?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/4704610879849935592/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=4704610879849935592' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/4704610879849935592'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/4704610879849935592'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2007/07/implementing-indexers-in-vc.html' title='Implementing indexers in VC++'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-8481602684963102079</id><published>2007-06-28T13:37:00.001-04:00</published><updated>2007-07-20T09:44:17.126-04:00</updated><title type='text'>Beware of "==" in VC++</title><content type='html'>"==" operator of String class may not return desired result. For example, when checking the equality of two Strings:&lt;br /&gt;&lt;br /&gt;if (cmbBx_Pos-&gt;Text == S"BOL")&lt;br /&gt;&lt;br /&gt;Even if the two Strings are the same, it may have a "false" result. To make sure it return the correct result, use this instead:&lt;br /&gt;&lt;br /&gt;if (cmbBx_Pos-&gt;Text-&gt;Equals(S"BOL"))&lt;br /&gt;&lt;br /&gt;It doesn't make much sense why the "==" operator failed. Perhaps it was the operator of Object class, so it was comparing two references instead of two Strings.&lt;br /&gt;&lt;br /&gt;Updated: when using a .net string literal in VC, always write as: S"hello". "==" operator will return false when comparing "hello" and S"hello". If a project has only .net strings as S"xxx", using "==" operator probably has no problem. If a project deals with different kinds of string, we better off use String::Equals to check string equality.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-8481602684963102079?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/8481602684963102079/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=8481602684963102079' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/8481602684963102079'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/8481602684963102079'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2007/06/beware-of-in-vc.html' title='Beware of &quot;==&quot; in VC++'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-2048729274044096542</id><published>2007-06-21T11:50:00.000-04:00</published><updated>2007-06-27T17:37:05.992-04:00</updated><title type='text'>Rules That Make Your Programming Life Easier</title><content type='html'>Rule 1: Life is like an onion: you peel it one layer at a time, and sometimes you weep. So is programming.&lt;br /&gt;&lt;br /&gt;Rule 2: Internet is one of your most reliable friends.&lt;br /&gt;&lt;br /&gt;Rule 3: Whenever encounter a problem, search on Internet, refer to books and think. Until you know exactly what the problem is, don't ask for help.&lt;br /&gt;&lt;br /&gt;Rule 4: Don't bother (ask tech questions etc.) colleagues too often. People are all busy!&lt;br /&gt;&lt;br /&gt;Rule 5: Taking notes is very very important. If you have a doubt, read Rule 1 five times.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-2048729274044096542?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/2048729274044096542/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=2048729274044096542' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/2048729274044096542'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/2048729274044096542'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2007/06/rules-that-make-your-programming-life.html' title='Rules That Make Your Programming Life Easier'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-2667275462118413415</id><published>2007-06-12T17:10:00.000-04:00</published><updated>2007-06-12T17:29:34.213-04:00</updated><title type='text'>Access form controls freely</title><content type='html'>Sometimes we want to access form controls outside the normal scope. For example, a callback function in another file need to notify some control so it can update its display. Simply change the control from private to public is not enough, we also need to get the current form instance. According to the article &lt;a href="http://www.codeproject.com/csharp/currentappcontext.asp"&gt;How to get current ApplicationContext instance at run time&lt;/a&gt;, we can create a new class MyForm which inherits Form class and set a similar static field _myForm. The static field will always store the first instance of that class, even if that class is initialized multiple times later.&lt;br /&gt;&lt;br /&gt;We then use this new class to run the application:&lt;br /&gt;&lt;br /&gt;Application::Run(new MyForm());&lt;br /&gt;&lt;br /&gt;Later on, whenever we want to get the instance of MyForm, we can do this:&lt;br /&gt;&lt;br /&gt;MyForm* myForm = (new MyForm())-&gt;_myForm;&lt;br /&gt;&lt;br /&gt;Although this method may not deserve the word "pattern", it is interesting to compare it to the Singleton Pattern. Different from Singleton Pattern, we can have more than one instance in this case, but we can freely get the first instance.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-2667275462118413415?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/2667275462118413415/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=2667275462118413415' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/2667275462118413415'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/2667275462118413415'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2007/06/access-form-controls-freely.html' title='Access form controls freely'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9153561184848277923.post-3897641891272906358</id><published>2007-06-12T16:58:00.000-04:00</published><updated>2007-08-08T15:07:20.605-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Convert'/><category scheme='http://www.blogger.com/atom/ns#' term='Char'/><category scheme='http://www.blogger.com/atom/ns#' term='String'/><title type='text'>Convert String* to char* and backwards</title><content type='html'>To convert String* to char*, use the following:&lt;br /&gt;&lt;br /&gt;using namespace System::Runtime::InteropServices;&lt;br /&gt;char* temp;&lt;br /&gt;temp = (char*)(void*)Marshal::StringToHGlobalAnsi(txtBx_MgmtName-&gt;Text);&lt;br /&gt;&lt;br /&gt;To convert char* to String*, just use the constructor of System::String.&lt;br /&gt;&lt;br /&gt;BTW, most data types in .NET has the ToString method.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9153561184848277923-3897641891272906358?l=mytechissues.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://mytechissues.blogspot.com/feeds/3897641891272906358/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9153561184848277923&amp;postID=3897641891272906358' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/3897641891272906358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9153561184848277923/posts/default/3897641891272906358'/><link rel='alternate' type='text/html' href='http://mytechissues.blogspot.com/2007/06/conver-string-to-char-and-backwards.html' title='Convert String* to char* and backwards'/><author><name>Xiaoguang</name><uri>http://www.blogger.com/profile/08509314968024808841</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
