<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;DEEAQ386eip7ImA9WhRbGEs.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159</id><updated>2012-02-10T03:37:22.112-06:00</updated><category term="Others" /><category term="C#" /><category term="Cryptography" /><category term="Winform" /><category term="SQL 2005" /><category term="XML" /><category term="Tips" /><category term="ASP.Net" /><category term="Freeware" /><category term="SSRS 2005" /><category term="Javascript" /><title>Kenny Hsu's Blog</title><subtitle type="html">My .Net programming notes.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://kennyshu.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>104</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/KennyHsuBlog" /><feedburner:info uri="kennyhsublog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;AkUGR3kzfyp7ImA9WhRbFkU.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-2845314733022651542</id><published>2012-02-08T02:03:00.000-06:00</published><updated>2012-02-08T02:03:46.787-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-08T02:03:46.787-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Tips" /><category scheme="http://www.blogger.com/atom/ns#" term="SQL 2005" /><title>SQL get current datetime</title><content type="html">&lt;pre class="brush: sql"&gt;SELECT CURRENT_TIMESTAMP&lt;/pre&gt;or&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SELECT {fn NOW()}&lt;/pre&gt;or&lt;br /&gt;
&lt;pre class="brush: sql"&gt;SELECT GETDATE()&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-2845314733022651542?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/8V3_ngp_y7qVWHz-RsrYaLWMJ94/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8V3_ngp_y7qVWHz-RsrYaLWMJ94/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/8V3_ngp_y7qVWHz-RsrYaLWMJ94/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8V3_ngp_y7qVWHz-RsrYaLWMJ94/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/U3ry7ejj2Gk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/2845314733022651542/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2012/02/sql-get-current-datetime.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/2845314733022651542?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/2845314733022651542?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/U3ry7ejj2Gk/sql-get-current-datetime.html" title="SQL get current datetime" /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><thr:total>0</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2012/02/sql-get-current-datetime.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUYCRn04fip7ImA9WhRbFkU.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-1808607019305655200</id><published>2012-02-07T22:00:00.000-06:00</published><updated>2012-02-08T01:46:07.336-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-08T01:46:07.336-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Tips" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><title>byte[] convert to hexadecimal string (and vice versa)</title><content type="html">byte[] to hex string:&lt;br&gt;
&lt;pre style="background: white; color: black; font-family: Consolas; font-size: 15;"&gt;&lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; ByteArrayToString1(&lt;span style="color: blue;"&gt;byte&lt;/span&gt;[] source)
{
    &lt;span style="color: #2b91af;"&gt;StringBuilder&lt;/span&gt; sb = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;StringBuilder&lt;/span&gt;();
    &lt;span style="color: blue;"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue;"&gt;byte&lt;/span&gt; item &lt;span style="color: blue;"&gt;in&lt;/span&gt; source)
    {
        sb.AppendFormat(&lt;span style="color: #a31515;"&gt;&amp;quot;{0:x2}&amp;quot;&lt;/span&gt;, item);
    }
    &lt;span style="color: blue;"&gt;return&lt;/span&gt; sb.ToString();
}

&lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; ByteArrayToString2(&lt;span style="color: blue;"&gt;byte&lt;/span&gt;[] source)
{
    &lt;span style="color: blue;"&gt;return&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;BitConverter&lt;/span&gt;.ToString(source).Replace(&lt;span style="color: #a31515;"&gt;&amp;quot;-&amp;quot;&lt;/span&gt;, &lt;span style="color: #a31515;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;);
}

&lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; ByteArrayToString3(&lt;span style="color: blue;"&gt;byte&lt;/span&gt;[] source)
{
    &lt;span style="color: green;"&gt;// namespace: System.Runtime.Remoting.Metadata.W3cXsd2001&lt;/span&gt;
    &lt;span style="color: blue;"&gt;return&lt;/span&gt; &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;SoapHexBinary&lt;/span&gt;(source).ToString();
}

&lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; ByteArrayToString4(&lt;span style="color: blue;"&gt;byte&lt;/span&gt;[] source)
{
    &lt;span style="color: green;"&gt;// works for .Net 4 only&lt;/span&gt;
    &lt;span style="color: blue;"&gt;return&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;String&lt;/span&gt;.Concat(&lt;span style="color: #2b91af;"&gt;Array&lt;/span&gt;.ConvertAll(source, x =&amp;gt; x.ToString(&lt;span style="color: #a31515;"&gt;&amp;quot;X2&amp;quot;&lt;/span&gt;)));
}
&lt;/pre&gt;&lt;a href="http://kennyshu.blogspot.com/2012/02/byte-convert-to-hexadecimal-string-and.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-1808607019305655200?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Y3gqPROoyPys3LerPvZGYBGhnzg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Y3gqPROoyPys3LerPvZGYBGhnzg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Y3gqPROoyPys3LerPvZGYBGhnzg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Y3gqPROoyPys3LerPvZGYBGhnzg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/GRII--Bn2qE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/1808607019305655200/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2012/02/byte-convert-to-hexadecimal-string-and.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/1808607019305655200?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/1808607019305655200?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/GRII--Bn2qE/byte-convert-to-hexadecimal-string-and.html" title="byte[] convert to hexadecimal string (and vice versa)" /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-q9awKxBtWrQ/TzHne40FYWI/AAAAAAAAA-s/TYIuboIV1u0/s72-c/Costing.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2012/02/byte-convert-to-hexadecimal-string-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkcBSXs7eyp7ImA9WhRbFks.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-3369514357928424802</id><published>2012-02-07T19:19:00.000-06:00</published><updated>2012-02-07T19:20:58.503-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-07T19:20:58.503-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Tips" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><title>Loop through enum</title><content type="html">&lt;pre style="background: white; color: black; font-family: Consolas; font-size: 15;"&gt;&lt;span style="color: blue;"&gt;enum&lt;/span&gt;&amp;nbsp;&lt;span style="color: #2b91af;"&gt;Week&lt;/span&gt;
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Sunday,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Monday,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Tuesday,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Wednesday,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Thursday,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Friday,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Saturday
}
&lt;/pre&gt;
&lt;pre style="background: white; color: black; font-family: Consolas; font-size: 15;"&gt;&lt;span style="color: blue;"&gt;foreach&lt;/span&gt;&amp;nbsp;(&lt;span style="color: #2b91af;"&gt;Week&lt;/span&gt;&amp;nbsp;item&amp;nbsp;&lt;span style="color: blue;"&gt;in&lt;/span&gt;&amp;nbsp;&lt;span style="color: #2b91af;"&gt;Enum&lt;/span&gt;.GetValues(&lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af;"&gt;Week&lt;/span&gt;)))
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: green;"&gt;//...&lt;/span&gt;
}
&lt;/pre&gt;
&lt;br /&gt;
Reference: &lt;a href="http://stackoverflow.com/a/972322/1122641"&gt;Can You Loop Through All Enum Values? c#&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-3369514357928424802?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/h0I4mEVNl8KZiFjVtd8rzlT0qno/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/h0I4mEVNl8KZiFjVtd8rzlT0qno/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/h0I4mEVNl8KZiFjVtd8rzlT0qno/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/h0I4mEVNl8KZiFjVtd8rzlT0qno/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/09f6yx5uSbI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/3369514357928424802/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2012/02/loop-through-enum.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/3369514357928424802?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/3369514357928424802?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/09f6yx5uSbI/loop-through-enum.html" title="Loop through enum" /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><thr:total>0</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2012/02/loop-through-enum.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkQGSXY4eip7ImA9WhRbFks.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-888652172129853196</id><published>2012-01-16T20:04:00.000-06:00</published><updated>2012-02-07T19:25:28.832-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-07T19:25:28.832-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Tips" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><title>IPv4 Address convert to Integer (and reverse) (updated)</title><content type="html">&lt;pre style="background: white; color: black; font-family: Consolas; font-size: 15;"&gt;&lt;span style="color: blue;"&gt;static&lt;/span&gt;&amp;nbsp;&lt;span style="color: #2b91af;"&gt;Int64&lt;/span&gt;&amp;nbsp;IPv4StringToInt64(&lt;span style="color: blue;"&gt;string&lt;/span&gt;&amp;nbsp;ipv4String)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #2b91af;"&gt;Int64&lt;/span&gt;&amp;nbsp;ipInteger&amp;nbsp;=&amp;nbsp;0;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;try&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ipInteger&amp;nbsp;=&amp;nbsp;(&lt;span style="color: blue;"&gt;long&lt;/span&gt;)(&lt;span style="color: blue;"&gt;uint&lt;/span&gt;)&lt;span style="color: #2b91af;"&gt;IPAddress&lt;/span&gt;.NetworkToHostOrder(&lt;span style="color: #2b91af;"&gt;BitConverter&lt;/span&gt;.ToInt32(&lt;span style="color: #2b91af;"&gt;IPAddress&lt;/span&gt;.Parse(ipv4String).GetAddressBytes(),&amp;nbsp;0));
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;catch&lt;/span&gt;&amp;nbsp;(&lt;span style="color: #2b91af;"&gt;Exception&lt;/span&gt;)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;}

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: blue;"&gt;return&lt;/span&gt;&amp;nbsp;ipInteger;
}&lt;/pre&gt;
&lt;pre style="background: none repeat scroll 0% 0% white; color: black; font-family: Consolas; font-size: 15px;"&gt;&lt;span style="color: blue;"&gt;static&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;string&lt;/span&gt;&amp;nbsp;IPv4Int64ToString(&lt;span style="color: #2b91af;"&gt;Int64&lt;/span&gt;&amp;nbsp;ipv4Int64)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;if&lt;/span&gt;&amp;nbsp;(ipv4Int64&amp;nbsp;&amp;lt;&amp;nbsp;0)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style="color: #a31515;"&gt;"0.0.0.0"&lt;/span&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;else&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue;"&gt;if&lt;/span&gt;&amp;nbsp;(ipv4Int64&amp;nbsp;&amp;lt;&amp;nbsp;4294967295)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style="color: #2b91af;"&gt;IPAddress&lt;/span&gt;.Parse(ipv4Int64.ToString()).ToString();
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;else&lt;/span&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue;"&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style="color: #a31515;"&gt;"255.255.255.255"&lt;/span&gt;;
}&lt;/pre&gt;
Usage:&lt;br /&gt;
&lt;pre style="background: white; color: black; font-family: Consolas; font-size: 15;"&gt;&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515;"&gt;"255.255.255.0&amp;nbsp;=&amp;gt;&amp;nbsp;"&lt;/span&gt;&amp;nbsp;+&amp;nbsp;IPv4StringToInt64(&lt;span style="color: #a31515;"&gt;"255.255.255.0"&lt;/span&gt;));
&lt;span style="color: #2b91af;"&gt;Console&lt;/span&gt;.WriteLine(&lt;span style="color: #a31515;"&gt;"4294967040&amp;nbsp;=&amp;gt;&amp;nbsp;"&lt;/span&gt;&amp;nbsp;+&amp;nbsp;IPv4Int64ToString(4294967040));&lt;/pre&gt;
&lt;br /&gt;
Reference: &lt;a href="http://stackoverflow.com/questions/461742/how-to-convert-an-ipv4-address-into-a-integer-in-c"&gt;stackoverflow - How to convert an IPv4 address into a integer in C#?&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-888652172129853196?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/1ezD7v2trfoBvIpW26AkYdLcxaE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1ezD7v2trfoBvIpW26AkYdLcxaE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/1ezD7v2trfoBvIpW26AkYdLcxaE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1ezD7v2trfoBvIpW26AkYdLcxaE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/soz6lkn6DZ0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/888652172129853196/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2012/01/ip-address-convert-to-integer-and.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/888652172129853196?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/888652172129853196?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/soz6lkn6DZ0/ip-address-convert-to-integer-and.html" title="IPv4 Address convert to Integer (and reverse) (updated)" /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><thr:total>0</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2012/01/ip-address-convert-to-integer-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEYERXk7eip7ImA9WhZbFU4.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-6902749021738269986</id><published>2011-06-19T20:08:00.000-05:00</published><updated>2011-06-19T20:08:24.702-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-06-19T20:08:24.702-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Freeware" /><title>Kenny's XML Encrypter</title><content type="html">&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-eE489Ejpx1I/Tf6bMi7V7SI/AAAAAAAAA8E/0E335WYEmnE/s1600/KXE.png" imageanchor="1" style="clear:right; float:right; margin-left:1em; margin-bottom:1em"&gt;&lt;img border="0" height="158" width="200" src="http://4.bp.blogspot.com/-eE489Ejpx1I/Tf6bMi7V7SI/AAAAAAAAA8E/0E335WYEmnE/s200/KXE.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;b&gt;Name&lt;/b&gt;: &lt;a href="http://www.4shared.com/file/_G_MKbyp/KXE.html"&gt;Kenny's XML Encrypter&lt;/a&gt;&lt;br /&gt;
&lt;b&gt;Version&lt;/b&gt;: 1.1&lt;br /&gt;
&lt;b&gt;Platform&lt;/b&gt;: Windows with .Net Framework 2.0 installed&lt;br /&gt;
&lt;b&gt;Introduction&lt;/b&gt;:&lt;br /&gt;
A small tool that can encrypt/decrypt xml element and attribute value. You can click Help button to see how to use it.&lt;br /&gt;
You can set different keys to encrypt different elements or attributes in the same time. Just don't forget those keys.&lt;br /&gt;
This tool only works on those leaf elements.&lt;br /&gt;
Play around, and leave a message at here if you found any problems.&lt;br /&gt;
&lt;br /&gt;
PS: Don't forget to keep an original copy of your XML file in case something happeded. The save is done automatically when you click the "Encrypt" or "Decrypt" button.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-6902749021738269986?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/srxTuTytWmvmnxoa-LCd951_Sik/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/srxTuTytWmvmnxoa-LCd951_Sik/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/srxTuTytWmvmnxoa-LCd951_Sik/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/srxTuTytWmvmnxoa-LCd951_Sik/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/ijYh0Qo8RlU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/6902749021738269986/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2011/06/kennys-xml-encrypter.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/6902749021738269986?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/6902749021738269986?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/ijYh0Qo8RlU/kennys-xml-encrypter.html" title="Kenny's XML Encrypter" /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-eE489Ejpx1I/Tf6bMi7V7SI/AAAAAAAAA8E/0E335WYEmnE/s72-c/KXE.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2011/06/kennys-xml-encrypter.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkICRno-eip7ImA9WhRTFEw.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-4487200698737648348</id><published>2011-06-14T00:25:00.001-05:00</published><updated>2011-11-04T09:56:07.452-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-04T09:56:07.452-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Winform" /><category scheme="http://www.blogger.com/atom/ns#" term="Tips" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><title>Refresh WebBrowser in Winform</title><content type="html">I put a WebBrowser control on my form and use it to load XML files.  Here is the code:&lt;br&gt;
&lt;pre class="brush: csharp"&gt;OpenFileDialog FileDialog = new OpenFileDialog();
FileDialog.Title = &amp;quot;Open XML Document&amp;quot;;
FileDialog.Filter = &amp;quot;XML file (*.xml)|*.xml&amp;quot;;
if (FileDialog.ShowDialog() == DialogResult.OK)
{
  WebBrowser1.Navigate(FileDialog.FileName);
  WebBrowser1.Refresh();
}&lt;/pre&gt;I found that if I load the second XML, sometimes it will not refresh itself to show the new XML content. Instead, it still shows the previous one.  I google the web to see if there is any other way to prevent the cache. Unfortunately, I found nothing. But &lt;a href="http://social.msdn.microsoft.com/Forums/en-IE/Vsexpressvb/thread/171ea933-8e36-4e08-bb5b-1889262b0291"&gt;this post&lt;/a&gt; inspires me and so I create a workaround.&lt;br&gt;
&lt;a href="http://kennyshu.blogspot.com/2011/06/tips-refresh-webbrowser-in-winform.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-4487200698737648348?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/nSyD0672JFLvWgyGri0a7CskRWE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nSyD0672JFLvWgyGri0a7CskRWE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/nSyD0672JFLvWgyGri0a7CskRWE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nSyD0672JFLvWgyGri0a7CskRWE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/lCl7DJrOVEY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/4487200698737648348/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2011/06/tips-refresh-webbrowser-in-winform.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/4487200698737648348?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/4487200698737648348?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/lCl7DJrOVEY/tips-refresh-webbrowser-in-winform.html" title="Refresh WebBrowser in Winform" /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><thr:total>0</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2011/06/tips-refresh-webbrowser-in-winform.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEUNRn84eCp7ImA9WhZVEkw.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-9151514920446237863</id><published>2011-05-24T00:51:00.000-05:00</published><updated>2011-05-24T00:51:37.130-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-24T00:51:37.130-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="ASP.Net" /><title>Integrated the EasyAlgo FlashUpload control into the ASP.Net web application</title><content type="html">Recently, I used their &lt;a href="http://www.easyalgo.com/eaflashupload.aspx"&gt;FlashUpload&lt;/a&gt; flash control to manage user uploads. It is a very powerful flash control that can let you customize the control. The price is affordabile (or you can try it free without limitations), and their customer service is outstanding. I use google talk to chat with them when I encounter any problem (also request some features!) with no problem.&lt;br&gt;
&lt;br&gt;
OK, no more advertisement. :)  Below is an example of what I&amp;#39;ve done for customizing it. The reason I put a blog here is because their document is good but not organized very well. I spent lots of time on puting things together... You can select many ways to integrate the flash control into your web app. Here I choose javascript.&lt;br&gt;
&lt;a href="http://kennyshu.blogspot.com/2011/05/integrated-easyalgo-flashupload-control.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-9151514920446237863?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/rNFBAtZV3iMFEOTqgNAyWZb5Uxc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rNFBAtZV3iMFEOTqgNAyWZb5Uxc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/rNFBAtZV3iMFEOTqgNAyWZb5Uxc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rNFBAtZV3iMFEOTqgNAyWZb5Uxc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/4cSJtDt2cio" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/9151514920446237863/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2011/05/integrated-easyalgo-flashupload-control.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/9151514920446237863?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/9151514920446237863?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/4cSJtDt2cio/integrated-easyalgo-flashupload-control.html" title="Integrated the EasyAlgo FlashUpload control into the ASP.Net web application" /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-Da0VFepVXso/TWkv8r2gkUI/AAAAAAAAA60/BAzZmvtZdzM/s72-c/EasyAlgo%2BFlashUpload.JPG" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2011/05/integrated-easyalgo-flashupload-control.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck4FQXo6eSp7ImA9WhZWEUg.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-7875713506635975020</id><published>2011-03-03T22:31:00.001-06:00</published><updated>2011-05-11T16:55:10.411-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-11T16:55:10.411-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Javascript" /><title>[javascript] Text wrapping in the alert/confirm function</title><content type="html">Wrap words in the javascript alert (or confirm).&lt;br /&gt;
&lt;br /&gt;
This doesn't work.&lt;br /&gt;
alert("First Line&amp;lt;br/&amp;gt;Second Line")&lt;br /&gt;
&lt;br /&gt;
This doesn't work.&lt;br /&gt;
&lt;pre class="brush: javascript"&gt;alert("First Line\r\nSecond Line")&lt;/pre&gt;&lt;br /&gt;
This will work&lt;br /&gt;
&lt;pre class="brush: javascript"&gt;alert("First Line\\r\\nSecond Line")&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-7875713506635975020?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ut1-0z-bhpQTu1D7-5M8VW6PvWQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ut1-0z-bhpQTu1D7-5M8VW6PvWQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ut1-0z-bhpQTu1D7-5M8VW6PvWQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ut1-0z-bhpQTu1D7-5M8VW6PvWQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/xqMXr85Yl5k" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/7875713506635975020/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2011/03/word-wrapping-in-javascript.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/7875713506635975020?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/7875713506635975020?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/xqMXr85Yl5k/word-wrapping-in-javascript.html" title="[javascript] Text wrapping in the alert/confirm function" /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><thr:total>0</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2011/03/word-wrapping-in-javascript.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0MFQ3s_eSp7ImA9Wx9bFko.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-6760535520991078507</id><published>2011-02-25T17:01:00.014-06:00</published><updated>2011-02-25T17:10:12.541-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-25T17:10:12.541-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="ASP.Net" /><title>Simple file upload by using FileUpload control.</title><content type="html">What I need:&lt;br&gt;
1.User can upload only one file at a time.&lt;br&gt;
2.No save file to disk; read it&amp;#39;s content and then dispose it.&lt;br&gt;
3.Only txt and csv file types are allowed.&lt;br&gt;
&lt;br&gt;
Here is the aspx page&lt;pre class="brush: csharp"&gt;&amp;lt;asp:Panel ID=&amp;quot;PanelUploadList&amp;quot; runat=&amp;quot;server&amp;quot; ViewStateMode=&amp;quot;Disabled&amp;quot;&amp;gt;
    &amp;lt;hr /&amp;gt;
    Please select a text file to upload:
    &amp;lt;asp:FileUpload ID=&amp;quot;FileUpload1&amp;quot; runat=&amp;quot;server&amp;quot; /&amp;gt;
    &amp;lt;asp:RequiredFieldValidator ID=&amp;quot;RequiredFieldValidatorFileUpload&amp;quot; runat=&amp;quot;server&amp;quot;
        ControlToValidate=&amp;quot;FileUpload1&amp;quot;
        ErrorMessage=&amp;quot;Please select a file to upload!&amp;quot; Display=&amp;quot;Dynamic&amp;quot;&amp;gt;*asp:RequiredFieldValidator&amp;gt;
    &amp;lt;asp:RegularExpressionValidator ID=&amp;quot;RegularExpressionValidatorFileUpload&amp;quot; runat=&amp;quot;server&amp;quot;
        ControlToValidate=&amp;quot;FileUpload1&amp;quot; ValidationExpression=&amp;quot;^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))+(.txt|.csv)$&amp;quot;
        ErrorMessage=&amp;quot;Only txt and csv file types are allowed!&amp;quot;&amp;gt;*asp:RegularExpressionValidator&amp;gt;
    &amp;lt;asp:Button ID=&amp;quot;ButtonUpload&amp;quot; runat=&amp;quot;server&amp;quot; OnClick=&amp;quot;ButtonUpload_Click&amp;quot;
        Text=&amp;quot;Upload&amp;quot; /&amp;gt;
    &amp;lt;hr /&amp;gt;
&amp;lt;/asp:Panel&amp;gt;&lt;/pre&gt;&lt;a href="http://kennyshu.blogspot.com/2011/02/simple-file-upload-by-using-fileupload.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-6760535520991078507?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/l7KGVfNbVAvgcDvm_A6Gx6uHyZ0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/l7KGVfNbVAvgcDvm_A6Gx6uHyZ0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/l7KGVfNbVAvgcDvm_A6Gx6uHyZ0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/l7KGVfNbVAvgcDvm_A6Gx6uHyZ0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/Fa-yAzQ7deQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/6760535520991078507/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2011/02/simple-file-upload-by-using-fileupload.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/6760535520991078507?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/6760535520991078507?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/Fa-yAzQ7deQ/simple-file-upload-by-using-fileupload.html" title="Simple file upload by using FileUpload control." /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><thr:total>0</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2011/02/simple-file-upload-by-using-fileupload.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0UFSX85cCp7ImA9Wx9aEkw.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-7386365556073860056</id><published>2011-01-20T17:42:00.002-06:00</published><updated>2011-03-03T23:06:58.128-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-03T23:06:58.128-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="ASP.Net" /><title>Sort ListBox items (ascending/descending)</title><content type="html">1. Create a class that implements IComparer&amp;lt;T&amp;gt; interface.&lt;br&gt;
&lt;pre class="brush: csharp"&gt;private class SortListItem : IComparer&amp;lt;ListItem&amp;gt;
{
    public int Compare(ListItem x, ListItem y)
    {
        return String.Compare(x.Value, y.Value);
    }
}&lt;/pre&gt;&lt;a href="http://kennyshu.blogspot.com/2011/01/sort-listbox-items-ascendingdescending.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-7386365556073860056?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/eLgxZ7t-GZqy51csd-PIzf2j4Zg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/eLgxZ7t-GZqy51csd-PIzf2j4Zg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/eLgxZ7t-GZqy51csd-PIzf2j4Zg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/eLgxZ7t-GZqy51csd-PIzf2j4Zg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/3SZHK8XUMIE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/7386365556073860056/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2011/01/sort-listbox-items-ascendingdescending.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/7386365556073860056?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/7386365556073860056?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/3SZHK8XUMIE/sort-listbox-items-ascendingdescending.html" title="Sort ListBox items (ascending/descending)" /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><thr:total>1</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2011/01/sort-listbox-items-ascendingdescending.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C04HQ3Y9eCp7ImA9Wx9WFUg.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-4412675125194706347</id><published>2011-01-20T13:32:00.000-06:00</published><updated>2011-01-20T13:32:12.860-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-20T13:32:12.860-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Tips" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><title>DateTime: Get the first date of the week</title><content type="html">1. Create an extension method.&lt;br&gt;
&lt;pre class="brush: csharp"&gt;public static class DateTimeExtensions
{
    public static DateTime StartOfWeek(this DateTime dt, DayOfWeek startOfWeek)
    {
        int diff = dt.DayOfWeek - startOfWeek;
        if (diff &amp;lt; 0)
        {
            diff += 7;
        }

        return dt.AddDays(-1 * diff).Date;
    }
}&lt;/pre&gt;
&lt;a href="http://kennyshu.blogspot.com/2011/01/datetime-get-first-date-of-week.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-4412675125194706347?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/IJDZ90xqPXXfqCaofPpiX1-YCr8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IJDZ90xqPXXfqCaofPpiX1-YCr8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/IJDZ90xqPXXfqCaofPpiX1-YCr8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IJDZ90xqPXXfqCaofPpiX1-YCr8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/A_UZHfmJhjE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/4412675125194706347/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2011/01/datetime-get-first-date-of-week.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/4412675125194706347?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/4412675125194706347?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/A_UZHfmJhjE/datetime-get-first-date-of-week.html" title="DateTime: Get the first date of the week" /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><thr:total>0</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2011/01/datetime-get-first-date-of-week.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C04MQH86eCp7ImA9Wx9WFUg.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-3948869858276378629</id><published>2011-01-20T13:15:00.002-06:00</published><updated>2011-01-20T13:33:01.110-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-20T13:33:01.110-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Tips" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><title>Enum - simple example</title><content type="html">&lt;pre class="brush: csharp"&gt;class Program
{
    enum DateTypeEnum
    {
        Year = 1,
        Quarter = 2,
        Month = 4,
        Day = 8
    }

    static void Main(string[] args)
    {
        int AvailablePayMethod = 7;

        Console.WriteLine(&amp;quot;Your available Paying Methods are: &amp;quot;);

        //check all available paying methods
        if ((AvailablePayMethod &amp;amp; (int)DateTypeEnum.Year) == (int)DateTypeEnum.Year)
            Console.WriteLine(DateTypeEnum.Year);

        if ((AvailablePayMethod &amp;amp; (int)DateTypeEnum.Quarter) == (int)DateTypeEnum.Quarter)
            Console.WriteLine(DateTypeEnum.Quarter);

        if ((AvailablePayMethod &amp;amp; (int)DateTypeEnum.Month) == (int)DateTypeEnum.Month)
            Console.WriteLine(DateTypeEnum.Month);

        if ((AvailablePayMethod &amp;amp; (int)DateTypeEnum.Day) == (int)DateTypeEnum.Day)
            Console.WriteLine(DateTypeEnum.Day);

        Console.WriteLine();

        int FavoritePayMethod = 4;

        //retrieve enum
        DateTypeEnum BillPeriod = (DateTypeEnum)Enum.Parse(typeof(DateTypeEnum), FavoritePayMethod.ToString());
        Console.WriteLine(&amp;quot;Your Favorite Paying Method is \&amp;quot;{0}\&amp;quot;.&amp;quot;, BillPeriod);
    }
}&lt;/pre&gt;&lt;a href="http://kennyshu.blogspot.com/2011/01/enum-simple-example.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-3948869858276378629?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/YCqsod-AtBf7hrXsFC-ne8qB_rU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/YCqsod-AtBf7hrXsFC-ne8qB_rU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/YCqsod-AtBf7hrXsFC-ne8qB_rU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/YCqsod-AtBf7hrXsFC-ne8qB_rU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/uBGhKdckdXY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/3948869858276378629/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2011/01/enum-simple-example.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/3948869858276378629?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/3948869858276378629?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/uBGhKdckdXY/enum-simple-example.html" title="Enum - simple example" /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><thr:total>0</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2011/01/enum-simple-example.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEIARXc6fip7ImA9WhRRF0k.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-5267837534810215576</id><published>2010-12-17T13:32:00.004-06:00</published><updated>2011-12-01T06:29:04.916-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-01T06:29:04.916-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Tips" /><category scheme="http://www.blogger.com/atom/ns#" term="ASP.Net" /><title>Doing some works after Response.End()</title><content type="html">I need to do something that after users download a file from my website.  Most file downloading approach is using something like this:&lt;br&gt;
&lt;pre class="brush: csharp"&gt;//data preparation at here...

Page.Response.ClearContent();
Page.Response.ClearHeaders();
Page.Response.Clear();
Page.Response.Buffer = true;
Page.Response.ExpiresAbsolute = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0, 0));
Page.Response.Expires = 0;
Response.AddHeader(&amp;quot;content-disposition&amp;quot;, &amp;quot;attachment;filename=&amp;quot; + YourFileNameHere + &amp;quot;.xls&amp;quot;;
//here I use excel file type
Response.ContentType = &amp;quot;application/vnd.ms-excel&amp;quot;;
//FileContent is a string variable which stores your file content
Page.Response.AddHeader(&amp;quot;content-length&amp;quot;, FileContent.Length.ToString());
Response.Write(FileContent);
Response.End();&lt;/pre&gt;&lt;a href="http://kennyshu.blogspot.com/2010/12/doing-some-works-after-responseend.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-5267837534810215576?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ITuf2vIMEGte4pa4xciW0I3b9GQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ITuf2vIMEGte4pa4xciW0I3b9GQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ITuf2vIMEGte4pa4xciW0I3b9GQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ITuf2vIMEGte4pa4xciW0I3b9GQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/7FsUUYf4kQQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/5267837534810215576/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2010/12/doing-some-works-after-responseend.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/5267837534810215576?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/5267837534810215576?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/7FsUUYf4kQQ/doing-some-works-after-responseend.html" title="Doing some works after Response.End()" /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><thr:total>4</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2010/12/doing-some-works-after-responseend.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEIBQXs4eSp7ImA9Wx9RFU8.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-5992136324271536103</id><published>2010-12-16T12:02:00.000-06:00</published><updated>2010-12-16T12:02:30.531-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-16T12:02:30.531-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Others" /><title>Mobile version is on.</title><content type="html">Added a mobile version to my blog.  If you use your smart phone to browse my blog, it will transfer you to the mobile version of my blog after few seconds.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-5992136324271536103?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/F53e1kuui0k941AMIj-Oll6l0H0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/F53e1kuui0k941AMIj-Oll6l0H0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/F53e1kuui0k941AMIj-Oll6l0H0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/F53e1kuui0k941AMIj-Oll6l0H0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/lfMkDz9aCpU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/5992136324271536103/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2010/12/mobile-version-is-on.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/5992136324271536103?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/5992136324271536103?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/lfMkDz9aCpU/mobile-version-is-on.html" title="Mobile version is on." /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><thr:total>0</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2010/12/mobile-version-is-on.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck8FSHszcCp7ImA9WhdXF08.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-593229467022981530</id><published>2010-12-03T10:07:00.004-06:00</published><updated>2011-08-30T11:13:39.588-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-30T11:13:39.588-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Tips" /><category scheme="http://www.blogger.com/atom/ns#" term="ASP.Net" /><title>Tips: Prevent CheckBox from being changed by user</title><content type="html">The easiest way to prevent your CheckBox from being changed by users is adding this to your CheckBox's html code:&lt;pre class="brush: csharp"&gt;OnClick="return false;"&lt;/pre&gt;For example:&lt;pre class="brush: csharp"&gt;&amp;lt;asp:CheckBox ID="CheckBox1" runat="server" Text="Want a salary increase?" Checked="False"
 OnClick="return false;" /&amp;gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-593229467022981530?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/CfdDCTMNR-Mu_bUBBEpPmKiu_d0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CfdDCTMNR-Mu_bUBBEpPmKiu_d0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/CfdDCTMNR-Mu_bUBBEpPmKiu_d0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CfdDCTMNR-Mu_bUBBEpPmKiu_d0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/JIU1QVZDV34" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/593229467022981530/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2010/12/tips-prevent-checkbox-from-being.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/593229467022981530?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/593229467022981530?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/JIU1QVZDV34/tips-prevent-checkbox-from-being.html" title="Tips: Prevent CheckBox from being changed by user" /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><thr:total>0</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2010/12/tips-prevent-checkbox-from-being.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUAMRHo7fip7ImA9Wx9TFU4.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-4957227656834884615</id><published>2010-11-23T11:36:00.000-06:00</published><updated>2010-11-23T11:36:25.406-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-23T11:36:25.406-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Others" /><title>How to copy codes in my blog</title><content type="html">Since I am using the latest syntex highlighter, there is no more flash control for users to copy the code or view code in text mode.&lt;br /&gt;
&lt;br /&gt;
The new way to copy the code is "double click" on the code and it will mark all codes automatically.  Then press "Ctrl + C" will do the work.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-4957227656834884615?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ojIIF10eXqkla82Ie_NZPxabGa4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ojIIF10eXqkla82Ie_NZPxabGa4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ojIIF10eXqkla82Ie_NZPxabGa4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ojIIF10eXqkla82Ie_NZPxabGa4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/EKE8xQQaQBo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/4957227656834884615/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2010/11/how-to-copy-codes-in-my-blog.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/4957227656834884615?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/4957227656834884615?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/EKE8xQQaQBo/how-to-copy-codes-in-my-blog.html" title="How to copy codes in my blog" /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><thr:total>0</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2010/11/how-to-copy-codes-in-my-blog.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkYGQ3o7fSp7ImA9Wx5aGU8.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-7658676411013452867</id><published>2010-11-16T11:22:00.000-06:00</published><updated>2010-11-16T11:22:02.405-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-16T11:22:02.405-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="ASP.Net" /><title>SqlDataSource/ObjectDataSource use ViewState</title><content type="html">On SqlDataSource's Selecting event:&lt;br /&gt;
&lt;pre class="brush: csharp"&gt;protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
    e.Command.Parameters["UserID"].Value = ViewState["UserID"].ToString();
}&lt;/pre&gt;&lt;br /&gt;
On ObjectDataSource's Selecting event:&lt;br /&gt;
&lt;pre class="brush: csharp"&gt;protected void ObjectDataSource1_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
{
    e.InputParameters["UserID"] = ViewState["UserID"].ToString();
}&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-7658676411013452867?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/zuxBC2npJcbvoYtiQiIbFmf9bXI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/zuxBC2npJcbvoYtiQiIbFmf9bXI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/zuxBC2npJcbvoYtiQiIbFmf9bXI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/zuxBC2npJcbvoYtiQiIbFmf9bXI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/96u3iIUc_bc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/7658676411013452867/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2010/11/sqldatasourceobjectdatasource-use.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/7658676411013452867?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/7658676411013452867?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/96u3iIUc_bc/sqldatasourceobjectdatasource-use.html" title="SqlDataSource/ObjectDataSource use ViewState" /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><thr:total>0</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2010/11/sqldatasourceobjectdatasource-use.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkcEQ3k6eip7ImA9Wx5aFU0.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-5808348052642415539</id><published>2010-11-11T14:40:00.000-06:00</published><updated>2010-11-11T14:40:02.712-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-11T14:40:02.712-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Others" /><title>SyntaxHighlighter broken</title><content type="html">My SyntaxHighlighter is broken so those codes looks ugly...  I will fix it (hopefully soon enough).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-5808348052642415539?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/QGXYCtSOpXQwCZy2ptkYFEjuaQM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/QGXYCtSOpXQwCZy2ptkYFEjuaQM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/QGXYCtSOpXQwCZy2ptkYFEjuaQM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/QGXYCtSOpXQwCZy2ptkYFEjuaQM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/55bSSm7TBw4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/5808348052642415539/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2010/11/syntaxhighlighter-broken.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/5808348052642415539?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/5808348052642415539?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/55bSSm7TBw4/syntaxhighlighter-broken.html" title="SyntaxHighlighter broken" /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><thr:total>0</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2010/11/syntaxhighlighter-broken.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEYFRXc_fCp7ImA9Wx5aFko.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-2426085218771892162</id><published>2010-11-11T14:22:00.007-06:00</published><updated>2010-11-13T13:21:54.944-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-13T13:21:54.944-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><title>Two DateTime related questions and solutions.</title><content type="html">&lt;b&gt;How do I get the month name?&lt;/b&gt;&lt;br /&gt;
1.&lt;br /&gt;
&lt;pre class="brush: csharp"&gt;DateTime.Now.ToString("MMMM")&lt;/pre&gt;2.&lt;br /&gt;
&lt;pre class="brush: csharp"&gt;CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(DateTime.Now.Month)&lt;/pre&gt;&lt;br /&gt;
If you want to use the method 2, don't forget to include the&lt;br /&gt;
&lt;pre class="brush: csharp"&gt;using System.Globalization;&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;How to know this Sunday's date? (or Monday, Tuesday... etc)&lt;/b&gt;&lt;br /&gt;
First, create an extension method.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="brush: csharp"&gt;public static class DateTimeExtensions
{
  public static DateTime StartOfWeek(this DateTime dt, DayOfWeek startOfWeek)
  {
    int diff = dt.DayOfWeek - startOfWeek;
    if (diff &amp;lt; 0)
    {
      diff += 7;
    }

    return dt.AddDays(-1 * diff).Date;
  }
}&lt;/pre&gt;&lt;br /&gt;
Then call it like this&lt;br /&gt;
&lt;pre class="brush: csharp"&gt;DateTime.Now.StartOfWeek(DayOfWeek.Sunday)&lt;/pre&gt;so that I can get the date of this week's Sunday.&lt;br /&gt;
&lt;br /&gt;
I have these two questions is because I am creating a Google Calendar-liked calendar . :)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Reference:&lt;br /&gt;
&lt;a href="http://www.velocityreviews.com/forums/t363806-month-name-in-c-august.html"&gt;&lt;span style="font-size: x-small;"&gt;Month Name in C#&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;span style="font-size: x-small;"&gt;&lt;a href="http://stackoverflow.com/questions/38039/how-can-i-get-the-datetime-for-the-start-of-the-week"&gt;How can I get the DateTime for the Start of the Week&lt;/a&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-2426085218771892162?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/K_ePnB99S-SS3_Hu84q4pN94kM8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/K_ePnB99S-SS3_Hu84q4pN94kM8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/K_ePnB99S-SS3_Hu84q4pN94kM8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/K_ePnB99S-SS3_Hu84q4pN94kM8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/2P8NuCitA3c" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/2426085218771892162/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2010/11/two-datetime-related-questions-and.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/2426085218771892162?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/2426085218771892162?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/2P8NuCitA3c/two-datetime-related-questions-and.html" title="Two DateTime related questions and solutions." /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><thr:total>0</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2010/11/two-datetime-related-questions-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D04NRXk7eSp7ImA9Wx9WEkQ.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-921497083518509362</id><published>2010-10-21T19:39:00.008-05:00</published><updated>2011-01-17T14:26:34.701-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-01-17T14:26:34.701-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="ASP.Net" /><title>Aspx page, Frameset, and QueryString</title><content type="html">I encountered a situation that I have to pass values through the query string to an aspx page which contains frameset settings.  Here is what I found how to do it (and it works for me).&lt;br&gt;
&lt;br&gt;
Let&amp;#39;s say I have a Default.aspx which has a frameset settings, and it contains two frames link to Menu.aspx and Content.aspx.  Here is the html code for the Default.aspx&lt;br&gt;
&lt;pre class="brush: html"&gt;&amp;lt;%@ Page Language=&amp;quot;C#&amp;quot; AutoEventWireup=&amp;quot;true&amp;quot; CodeBehind=&amp;quot;Default.aspx.cs&amp;quot; Inherits=&amp;quot;Default&amp;quot; %&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&amp;gt;
&amp;lt;html xmlns=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&amp;gt;
 &amp;lt;head runat=&amp;quot;server&amp;quot;&amp;gt;
  &amp;lt;title&amp;gt;xxxx&amp;lt;/title&amp;gt;
 &amp;lt;/head&amp;gt;
 &amp;lt;frameset cols=&amp;quot;20%,80%&amp;quot;&amp;gt;
  &amp;lt;frame name=&amp;quot;Menu&amp;quot; src=&amp;lt;%= GetMenuFrame()%&amp;gt; /&amp;gt;
  &amp;lt;frame name=&amp;quot;Content&amp;quot; src=&amp;lt;%= GetContentFrame()%&amp;gt; /&amp;gt;
 &amp;lt;/frameset&amp;gt;
&amp;lt;/html&amp;gt;&lt;/pre&gt;&lt;a href="http://kennyshu.blogspot.com/2010/10/aspx-frameset-and-querystring.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-921497083518509362?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/SLKoSHg9tDOJfXlRNWiVDnhQT6s/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/SLKoSHg9tDOJfXlRNWiVDnhQT6s/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/SLKoSHg9tDOJfXlRNWiVDnhQT6s/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/SLKoSHg9tDOJfXlRNWiVDnhQT6s/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/zdz9dOOHGJ4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/921497083518509362/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2010/10/aspx-frameset-and-querystring.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/921497083518509362?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/921497083518509362?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/zdz9dOOHGJ4/aspx-frameset-and-querystring.html" title="Aspx page, Frameset, and QueryString" /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><thr:total>0</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2010/10/aspx-frameset-and-querystring.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0IMSX4-fyp7ImA9Wx5aFkU.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-5135597420133772803</id><published>2010-07-07T22:08:00.009-05:00</published><updated>2010-11-13T14:53:08.057-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-13T14:53:08.057-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Tips" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><title>Distinct in DataTable or DataView</title><content type="html">How to remove duplicated data?  Suppose I have a DataTable (dtMembers) looks like this:&lt;br /&gt;
&lt;table align="left" border="1" cellpadding="1" cellspacing="1" style="width: 100px;"&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;ID&lt;/td&gt;&lt;td&gt;Name&lt;/td&gt;&lt;td&gt;City&lt;/td&gt;&lt;td&gt;ZipCode&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;01&lt;/td&gt;&lt;td&gt;Kenny&lt;/td&gt;&lt;td&gt;LA&lt;/td&gt;&lt;td&gt;12345&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;02&lt;/td&gt;&lt;td&gt;Peter&lt;/td&gt;&lt;td&gt;CA&lt;/td&gt;&lt;td&gt;54321&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;03&lt;/td&gt;&lt;td&gt;John&lt;/td&gt;&lt;td&gt;NY&lt;/td&gt;&lt;td&gt;13125&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;04&lt;/td&gt;&lt;td&gt;Jimmy&lt;/td&gt;&lt;td&gt;NY&lt;/td&gt;&lt;td&gt;13125&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Using the following two lines of codes if you want to get the non-duplicated city list:&lt;br /&gt;
&lt;pre class="brush: csharp"&gt;string[] columnNames = new string[] { "City" };
DataTable dtCity = dtMembers.DefaultView.ToTable(true, columnNames);&lt;/pre&gt;The result will be "LA, CA, NY".&lt;br /&gt;
&lt;br /&gt;
Take a look of the &lt;a href="http://msdn.microsoft.com/en-us/library/wec2b2e6.aspx"&gt;DataView.ToTable()&lt;/a&gt; method and &lt;a href="http://social.msdn.microsoft.com/forums/en-US/adodotnetdataset/thread/ed9c6a6a-a93e-4bf5-a892-d8471b84aa3b/"&gt;this&lt;/a&gt; discussion.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-5135597420133772803?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/JvYOm5nD6rRyBz143DUKdqGvAmo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JvYOm5nD6rRyBz143DUKdqGvAmo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/JvYOm5nD6rRyBz143DUKdqGvAmo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JvYOm5nD6rRyBz143DUKdqGvAmo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/aIntY_ZV2eE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/5135597420133772803/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2010/07/distinct-in-datatable-or-dataview.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/5135597420133772803?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/5135597420133772803?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/aIntY_ZV2eE/distinct-in-datatable-or-dataview.html" title="Distinct in DataTable or DataView" /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><thr:total>0</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2010/07/distinct-in-datatable-or-dataview.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEADR3g_eyp7ImA9Wx5aFkU.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-8539300984811482986</id><published>2010-04-21T13:46:00.019-05:00</published><updated>2010-11-13T15:12:56.643-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-13T15:12:56.643-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SSRS 2005" /><title>[SSRS 2005] One table uses two DataSets by using Multivalue Parameter</title><content type="html">It&amp;#39;s not possible that one report item (table, matrix, list... etc) can use two different datasets.  Most people will suggest you to merge them into one dataset, but that doesn&amp;#39;t work for me because they are not from the same database.&lt;br&gt;
&lt;br&gt;
In my case, one dataset is coming from SQL 2005, and another one is coming from OSIsoft PI Server.  I want to create a table that display hourly data for each day by using these two datasets.  Not only so, some data are calculated on the fly by refering them.  It&amp;#39;s like mission impossible to create a report like this: these two datasets don&amp;#39;t know each other, and one table cannot be assigned two datasets.&lt;br&gt;
&lt;br&gt;
Here is how I solved this problem. &lt;a href="http://kennyshu.blogspot.com/2010/04/ssrs-2005-one-table-uses-two-datasets.html#more"&gt;Read more »&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-8539300984811482986?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/0lROXgXtaZJJfzWWtK5vv_LWEUQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0lROXgXtaZJJfzWWtK5vv_LWEUQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/0lROXgXtaZJJfzWWtK5vv_LWEUQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0lROXgXtaZJJfzWWtK5vv_LWEUQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/PIF39fXudIY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/8539300984811482986/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2010/04/ssrs-2005-one-table-uses-two-datasets.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/8539300984811482986?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/8539300984811482986?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/PIF39fXudIY/ssrs-2005-one-table-uses-two-datasets.html" title="[SSRS 2005] One table uses two DataSets by using Multivalue Parameter" /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_rIYUnPohNkY/S89Rr4-DL3I/AAAAAAAAA2M/Zksf91anYTQ/s72-c/SSRS_Parameter.JPG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2010/04/ssrs-2005-one-table-uses-two-datasets.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE8HQHo5cCp7ImA9Wx5aFkU.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-4360154323854636393</id><published>2010-04-05T11:24:00.004-05:00</published><updated>2010-11-13T15:13:51.428-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-13T15:13:51.428-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Tips" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="ASP.Net" /><title>Get .Net Color from Hex Color (Hex string)</title><content type="html">It's easy but also easy to forget.  I put it here as a note for myself. :)&lt;br /&gt;
&lt;pre class="brush: csharp"&gt;Label1.BackColor = System.Drawing.ColorTranslator.FromHtml("#FFC0FF");&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-4360154323854636393?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/7JVmd7FPa6Pfhik9Vxxe-nHq2WA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7JVmd7FPa6Pfhik9Vxxe-nHq2WA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/7JVmd7FPa6Pfhik9Vxxe-nHq2WA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7JVmd7FPa6Pfhik9Vxxe-nHq2WA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/wzh5rpDusH8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/4360154323854636393/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2010/04/get-net-color-from-hex-color-hex-string.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/4360154323854636393?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/4360154323854636393?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/wzh5rpDusH8/get-net-color-from-hex-color-hex-string.html" title="Get .Net Color from Hex Color (Hex string)" /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><thr:total>0</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2010/04/get-net-color-from-hex-color-hex-string.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE8DSXg9eyp7ImA9Wx5aFkU.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-5981605285177254398</id><published>2010-03-25T15:50:00.006-05:00</published><updated>2010-11-13T15:14:38.663-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-11-13T15:14:38.663-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="ASP.Net" /><title>[ASP.NET]The DataSourceMode of SqlDataSource</title><content type="html">By default, the DataSourceMode of the SqlDataSource is &lt;span style="font-weight:bold;"&gt;DataSet&lt;/span&gt;.  Here is how to retrieve the dataset from the SqlDataSource control:&lt;pre class="brush: csharp"&gt;DataTable dt = ((DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty)).ToTable();
or
DataTable dt = ((DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty)).Table;&lt;/pre&gt;&lt;br /&gt;
If you set the DataSourceMode to &lt;span style="font-weight:bold;"&gt;DataReader&lt;/span&gt;, here is how to read the data:&lt;pre class="brush: csharp"&gt;IDataReader reader = (IDataReader)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
while (reader.Read())
{
//your code here
}
reader.Close();
reader.Dispose();&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-5981605285177254398?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Gns7rO9LHiJn1iBvucKLS-EtwiE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Gns7rO9LHiJn1iBvucKLS-EtwiE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Gns7rO9LHiJn1iBvucKLS-EtwiE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Gns7rO9LHiJn1iBvucKLS-EtwiE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/N5SdMSQTTuo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/5981605285177254398/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2010/03/aspnetthe-datasourcemode-of.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/5981605285177254398?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/5981605285177254398?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/N5SdMSQTTuo/aspnetthe-datasourcemode-of.html" title="[ASP.NET]The DataSourceMode of SqlDataSource" /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><thr:total>0</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2010/03/aspnetthe-datasourcemode-of.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0INRHY7fip7ImA9WhdXGU0.&quot;"><id>tag:blogger.com,1999:blog-257501392534895159.post-2632510319345406965</id><published>2009-12-11T14:31:00.007-06:00</published><updated>2011-09-01T14:33:15.806-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-01T14:33:15.806-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="ASP.Net" /><title>[ASP.Net]Dynamically assign your page's background image</title><content type="html">I would like to change/assign a page's background image depends on some conditions, and here is what I did.&lt;br /&gt;1.Assign an id to the body and add the runat="server" to it.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_rIYUnPohNkY/SyKvT-aK9QI/AAAAAAAAAzY/XcymM9xQ5lU/s1600-h/body.JPG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 200px; height: 97px;" src="http://2.bp.blogspot.com/_rIYUnPohNkY/SyKvT-aK9QI/AAAAAAAAAzY/XcymM9xQ5lU/s200/body.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5414082459757901058" /&gt;&lt;/a&gt;&lt;br /&gt;2.Add the following code to your code-behind (you can put it in the Page_Load event)&lt;br /&gt;&lt;pre class="brush: csharp"&gt;if (ConfigurationManager.ConnectionStrings["MyWebsite"].ConnectionString.Contains("test"))&lt;br /&gt;    body1.Style.Add("background-image", @"url(Images/test.jpg)");&lt;br /&gt;else&lt;br /&gt;    body1.Style.Add("background-image", @"url(Images/production.jpg)");&lt;/pre&gt;Modify the if statement to meet your needs.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/257501392534895159-2632510319345406965?l=kennyshu.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/rPJosc9SL99MOuSJXB5M3KMFusQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rPJosc9SL99MOuSJXB5M3KMFusQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/rPJosc9SL99MOuSJXB5M3KMFusQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rPJosc9SL99MOuSJXB5M3KMFusQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/KennyHsuBlog/~4/NcTrOidFOG8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://kennyshu.blogspot.com/feeds/2632510319345406965/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://kennyshu.blogspot.com/2009/12/aspnetdynamically-assign-your-pages.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/2632510319345406965?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/257501392534895159/posts/default/2632510319345406965?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/KennyHsuBlog/~3/NcTrOidFOG8/aspnetdynamically-assign-your-pages.html" title="[ASP.Net]Dynamically assign your page's background image" /><author><name>Kenny Hsu</name><uri>http://www.blogger.com/profile/09636040327211268566</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="32" height="32" src="http://byfiles.storage.live.com/y1pZ5rY13uk-otJt0VfHIOocLhn7pCtBpYhX-ffUuJQ3jIg6qvB16ahToB7eQpCQcvtB0HFnLvnm_s" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_rIYUnPohNkY/SyKvT-aK9QI/AAAAAAAAAzY/XcymM9xQ5lU/s72-c/body.JPG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://kennyshu.blogspot.com/2009/12/aspnetdynamically-assign-your-pages.html</feedburner:origLink></entry></feed>

