<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5705257284633178319</id><updated>2012-02-17T09:06:24.447+08:00</updated><title type='text'>Carso Leong's Blog</title><subtitle type='html'>Sometimes, we want to program somethings that talk, learn and express...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default?start-index=101&amp;max-results=100'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>112</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-2278102033782578715</id><published>2011-08-24T10:15:00.001+08:00</published><updated>2011-08-24T10:15:33.614+08:00</updated><title type='text'>get database columns using mssql server</title><content type='html'>&lt;pre&gt;SELECT&amp;nbsp;&amp;nbsp; schemas.name AS [Schema],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tables.name AS [Table],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; columns.name AS [Column],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CASE &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 34&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN 'byte[]'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 35&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN 'string'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 36&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN 'System.Guid'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 48&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN 'byte'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 52&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN 'short'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 56&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN 'int'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 58&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN 'System.DateTime'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 59&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN 'float'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 60&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN 'decimal'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 61&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN 'System.DateTime'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 62&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN 'double'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 98&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN 'object'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 99&amp;nbsp;&amp;nbsp;&amp;nbsp; THEN 'string'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 104&amp;nbsp;&amp;nbsp; THEN 'bool'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 106&amp;nbsp;&amp;nbsp; THEN 'decimal'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 108&amp;nbsp;&amp;nbsp; THEN 'decimal'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 122&amp;nbsp;&amp;nbsp; THEN 'decimal'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 127&amp;nbsp;&amp;nbsp; THEN 'long'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 165&amp;nbsp;&amp;nbsp; THEN 'byte[]'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 167&amp;nbsp;&amp;nbsp; THEN 'string'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 173&amp;nbsp;&amp;nbsp; THEN 'byte[]'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 175&amp;nbsp;&amp;nbsp; THEN 'string'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 189&amp;nbsp;&amp;nbsp; THEN 'long'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 231&amp;nbsp;&amp;nbsp; THEN 'string'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 239&amp;nbsp;&amp;nbsp; THEN 'string'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 241&amp;nbsp;&amp;nbsp; THEN 'string'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHEN columns.system_type_id = 241&amp;nbsp;&amp;nbsp; THEN 'string'&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; END AS [Type],&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; columns.is_nullable AS [Nullable]&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;FROM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.tables tables&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; INNER JOIN&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.schemas schemas ON (tables.schema_id = schemas.schema_id )&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; INNER JOIN&amp;nbsp;&amp;nbsp;&amp;nbsp; sys.columns columns ON (columns.object_id = tables.object_id) &lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;WHERE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tables.name &amp;lt;&amp;gt; 'sysdiagrams' &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND&amp;nbsp;&amp;nbsp; tables.name &amp;lt;&amp;gt; 'dtproperties' &lt;br /&gt;&lt;br /&gt;ORDER BY [Schema], [Table], [Column], [Type]&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-2278102033782578715?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/2278102033782578715/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=2278102033782578715' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/2278102033782578715'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/2278102033782578715'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2011/08/get-database-columns-using-mssql-server.html' title='get database columns using mssql server'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-4986943988467318099</id><published>2011-02-23T16:24:00.002+08:00</published><updated>2011-02-23T16:27:19.721+08:00</updated><title type='text'>how to generate json file from .net object</title><content type='html'>&amp;nbsp;&amp;nbsp;&amp;nbsp; public class data_city&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; private string _city;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; public string city&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; get { return _city; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; public data_city(string city)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _city = city;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public class data_state&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; public data_state(string id, string name)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _id = id;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _name = name;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; private string _id;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; public string id&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; get { return _id; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; private string _name;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; public string name&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; get { return _name; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; private List&amp;lt;data_city&amp;gt; _Cities = new List&amp;lt;data_city&amp;gt;();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; public List&amp;lt;data_city&amp;gt; cities&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; get { return _Cities; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; set { _Cities = value; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private void GenerateJsonCities()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; var state = from s in developerDataContext.States&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; orderby s.DisplayOrder&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; select new { id = s.StateCode, name = s.Description };&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; List&amp;lt;data_state&amp;gt; dsl = new List&amp;lt;data_state&amp;gt;();&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (var s in state)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; data_state ds = new data_state(s.id, s.name);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; List&amp;lt;City&amp;gt; ss&amp;nbsp; = developerDataContext.Cities.Where(p =&amp;gt; p.StateCode == s.id).OrderBy(p =&amp;gt; p.City1).ToList();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (City c in ss)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ds.cities.Add(new data_city(c.City1));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; dsl.Add(ds);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;div style="background-color: #fff2cc;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; JavaScriptSerializer serializer = new JavaScriptSerializer();&lt;/div&gt;&lt;div style="background-color: #fff2cc;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; string json = serializer.Serialize(dsl);&lt;/div&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; string city_json = string.Format("var data_state = {0};", json);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; File.WriteAllText(MapPath("~/scripts/referenceData/state_city.js"), city_json);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-4986943988467318099?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/4986943988467318099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=4986943988467318099' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/4986943988467318099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/4986943988467318099'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2011/02/how-to-generate-json-file-from-net.html' title='how to generate json file from .net object'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-2995228285161783188</id><published>2010-04-06T09:49:00.003+08:00</published><updated>2010-04-06T09:54:40.817+08:00</updated><title type='text'>how to get optimum sizes of resized image with proportion in .NET</title><content type='html'>&lt;blockquote&gt;&lt;br /&gt;        Private _MaxWidth As Integer&lt;br /&gt;        Private _MaxHeight As Integer&lt;br /&gt;&lt;br /&gt;        Public Property MaxWidth() As Integer&lt;br /&gt;            Get&lt;br /&gt;                Return _MaxWidth&lt;br /&gt;            End Get&lt;br /&gt;            Set(ByVal value As Integer)&lt;br /&gt;                _MaxWidth = value&lt;br /&gt;            End Set&lt;br /&gt;        End Property&lt;br /&gt;&lt;br /&gt;        Public Property MaxHeight() As Integer&lt;br /&gt;            Get&lt;br /&gt;                Return _MaxHeight&lt;br /&gt;            End Get&lt;br /&gt;            Set(ByVal value As Integer)&lt;br /&gt;                _MaxHeight = value&lt;br /&gt;            End Set&lt;br /&gt;        End Property&lt;br /&gt;      &lt;br /&gt;&lt;br /&gt;&lt;br /&gt; Private Function CalculateOptimumImageSize(ByVal src As System.Drawing.Image) As Integer()&lt;br /&gt;            Dim sizeImgDim As Integer() = New Integer(1) {}&lt;br /&gt;&lt;br /&gt;            sizeImgDim(0) = src.Width&lt;br /&gt;            sizeImgDim(1) = src.Height&lt;br /&gt;&lt;br /&gt;            'if the max and min are larger than the original size, therefore follow the original&lt;br /&gt;            If sizeImgDim(0) &amp;gt; _MaxWidth OrElse sizeImgDim(1) &amp;gt; _MaxHeight Then&lt;br /&gt;                Dim imageRatio As Decimal = CDec(sizeImgDim(0)) / CDec(sizeImgDim(1))&lt;br /&gt;                Dim w As Decimal = imageRatio * CDec(_MaxHeight)&lt;br /&gt;                If w &amp;gt; _MaxWidth Then&lt;br /&gt;&lt;br /&gt;                    sizeImgDim(0) = _MaxWidth&lt;br /&gt;                Else&lt;br /&gt;                    sizeImgDim(0) = Convert.ToInt32(w)&lt;br /&gt;                End If&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                Dim h As Decimal = CDec(_MaxWidth) / imageRatio&lt;br /&gt;                If h &amp;gt; _MaxHeight Then&lt;br /&gt;&lt;br /&gt;                    sizeImgDim(1) = _MaxHeight&lt;br /&gt;                Else&lt;br /&gt;&lt;br /&gt;                    sizeImgDim(1) = Convert.ToInt32(h)&lt;br /&gt;&lt;br /&gt;                End If&lt;br /&gt;            End If&lt;br /&gt;            Return sizeImgDim&lt;br /&gt;        End Function&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-2995228285161783188?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/2995228285161783188/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=2995228285161783188' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/2995228285161783188'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/2995228285161783188'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2010/04/how-to-get-optimum-sizes-of-resized.html' title='how to get optimum sizes of resized image with proportion in .NET'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-4515254371965124113</id><published>2010-04-06T09:47:00.000+08:00</published><updated>2010-04-06T09:49:25.500+08:00</updated><title type='text'>Clean up html code and words tag in .NET</title><content type='html'>Private Shared Function CleanHTML(ByVal html As String) As String&lt;br /&gt;   html = Regex.Replace(html, &amp;quot;&amp;lt;[/]?(font|span|xml|del|ins|[ovwxp]:\w+)[^&amp;gt;]*?&amp;gt;&amp;quot;, &amp;quot;&amp;quot;, RegexOptions.IgnoreCase)&lt;br /&gt;   html = Regex.Replace(html, &amp;quot;&amp;lt;([^&amp;gt;]*)(?:class|lang|style|size|face|[ovwxp]:\w+)=(?:'[^']*'|&amp;quot;&amp;quot;[^&amp;quot;&amp;quot;]*&amp;quot;&amp;quot;|[^\s&amp;gt;]+)([^&amp;gt;]*)&amp;gt;&amp;quot;, &amp;quot;&amp;lt;$1$2&amp;gt;&amp;quot;, RegexOptions.IgnoreCase)&lt;br /&gt;   html = Regex.Replace(html, &amp;quot;&amp;lt;([^&amp;gt;]*)(?:class|lang|style|size|face|[ovwxp]:\w+)=(?:'[^']*'|&amp;quot;&amp;quot;[^&amp;quot;&amp;quot;]*&amp;quot;&amp;quot;|[^\s&amp;gt;]+)([^&amp;gt;]*)&amp;gt;&amp;quot;, &amp;quot;&amp;lt;$1$2&amp;gt;&amp;quot;, RegexOptions.IgnoreCase)&lt;br /&gt;   Return html&lt;br /&gt;  End Function&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-4515254371965124113?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/4515254371965124113/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=4515254371965124113' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/4515254371965124113'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/4515254371965124113'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2010/04/clean-up-html-code-and-words-tag-in-net.html' title='Clean up html code and words tag in .NET'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-7036918210835215258</id><published>2010-04-06T09:40:00.000+08:00</published><updated>2010-04-06T09:46:43.475+08:00</updated><title type='text'>How to capitalize every first letter using .NET</title><content type='html'>Public Shared Function Capitalize(ByVal value As String) As String&lt;br /&gt;   Return System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(value)&lt;br /&gt;  End Function&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-7036918210835215258?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/7036918210835215258/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=7036918210835215258' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/7036918210835215258'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/7036918210835215258'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2010/04/how-to-capitalize-every-first-letter.html' title='How to capitalize every first letter using .NET'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-7160224031847203686</id><published>2009-07-01T15:43:00.002+08:00</published><updated>2009-07-01T15:53:37.449+08:00</updated><title type='text'>Regex for strong password implementation</title><content type='html'>&lt;p&gt;&lt;strong&gt;Advance password&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;(?=^.{12,}$)((?=.*\d)(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$&lt;/p&gt;Passwords will contain at least (1) upper case letter&lt;br /&gt;Passwords will contain at least (1) lower case letter&lt;br /&gt;Passwords will contain at least (1) number or special character&lt;br /&gt;Passwords will contain at least (12) characters in length&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Basic password&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;(?=^.{12,}$)((?=.*\d)(?=.*\W+))(?![.\n])(?=.*[a-z]).*$&lt;br /&gt;&lt;br /&gt;Passwords will contain at least (1) letter&lt;br /&gt;Passwords will contain at least (1) number or special character&lt;br /&gt;Passwords will contain at least (12) characters in length&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-7160224031847203686?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/7160224031847203686/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=7160224031847203686' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/7160224031847203686'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/7160224031847203686'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2009/07/regex-for-strong-password.html' title='Regex for strong password implementation'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-531572681512649103</id><published>2009-05-11T11:49:00.003+08:00</published><updated>2009-05-11T11:54:18.955+08:00</updated><title type='text'>how to add mata keyword &amp; meta description in ASP.NET?</title><content type='html'>There is no easy way to add but I have a simple method to introduce&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;pageEx.cs&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;using System;&lt;br /&gt;using System.Data;&lt;br /&gt;using System.Configuration;&lt;br /&gt;using&lt;br /&gt;System.Web;&lt;br /&gt;using System.Web.Security;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;using&lt;br /&gt;System.Web.UI.WebControls;&lt;br /&gt;using System.Web.UI.WebControls.WebParts;&lt;br /&gt;using System.Web.UI.HtmlControls;&lt;br /&gt;&lt;br /&gt;public class PageEx : System.Web.UI.Page&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;private HtmlMeta&lt;br /&gt;metaDescription = new HtmlMeta();&lt;br /&gt;private HtmlMeta metaKeywords = new&lt;br /&gt;HtmlMeta();&lt;br /&gt;&lt;br /&gt;public string Description&lt;br /&gt;{&lt;br /&gt;get { return&lt;br /&gt;metaDescription.Content; }&lt;br /&gt;set { metaDescription.Content = value; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public string[] Keywords&lt;br /&gt;{&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;if&lt;br /&gt;(metaKeywords.Content == null)&lt;br /&gt;{&lt;br /&gt;return new string[] { "" };&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;return metaKeywords.Content.Split(new char[] { ',' });&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;set&lt;br /&gt;{&lt;br /&gt;if (value != null)&lt;br /&gt;{&lt;br /&gt;metaKeywords.Content =&lt;br /&gt;string.Join(",", value);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public PageEx()&lt;br /&gt;{&lt;br /&gt;Init += new EventHandler(PageEx_Init);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void PageEx_Init(object&lt;br /&gt;sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;//Add the description Meta control&lt;br /&gt;metaDescription.Name = "description";&lt;br /&gt;Page.Header.Controls.Add(metaDescription);&lt;br /&gt;//Add the keywords Meta&lt;br /&gt;control&lt;br /&gt;metaKeywords.Name = "keywords";&lt;br /&gt;Page.Header.Controls.Add(metaKeywords);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;} &lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;someasp.aspx&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;this.Description = "the power 123";&lt;br /&gt;this.Keywords = new string[] {&lt;br /&gt;"Enquiries", "enquiry", "contact", "contacts", "email", "tel" };&lt;br /&gt;&lt;br /&gt;}&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Hope this helps :)&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-531572681512649103?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/531572681512649103/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=531572681512649103' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/531572681512649103'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/531572681512649103'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2009/05/how-to-add-mata-keyword-meta.html' title='how to add mata keyword &amp; meta description in ASP.NET?'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-1572834183918480260</id><published>2009-04-28T16:09:00.004+08:00</published><updated>2009-04-28T16:11:45.462+08:00</updated><title type='text'>a simple method to manipulate data using sql using .net</title><content type='html'>&lt;blockquote&gt;public static DataTable ExecuteSQL(string sql, Dictionary&lt;string,&gt; parameters)&lt;br /&gt;{&lt;br /&gt;   DataTable dt = new DataTable("DataTable");&lt;br /&gt;using (SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["localConnectionString"].ConnectionString))&lt;br /&gt;   {&lt;br /&gt;       myConnection.Open();&lt;br /&gt;       SqlCommand mySqlCommand = new SqlCommand(sql, myConnection);&lt;br /&gt;&lt;br /&gt;       if (parameters != null)&lt;br /&gt;       {&lt;br /&gt;           foreach (KeyValuePair&lt;string,&gt; p in parameters)&lt;br /&gt;           {&lt;br /&gt;               mySqlCommand.Parameters.AddWithValue(p.Key, p.Value);&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       using (SqlDataReader datareader = mySqlCommand.ExecuteReader())&lt;br /&gt;       {&lt;br /&gt;           dt.Load(datareader);&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;   return dt;&lt;br /&gt;}&lt;/string,&gt;&lt;/string,&gt;&lt;/blockquote&gt;        //insert a tag record&lt;br /&gt;       Dictionary&lt;string,&gt; param = new Dictionary&lt;string,&gt;();&lt;br /&gt;       param.Add("@TagName", txtTagName.Text);&lt;br /&gt;       ExecuteSQL("INSERT TOP (200) INTO Tag(TagName) VALUES (@TagName)", param);&lt;/string,&gt;&lt;/string,&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-1572834183918480260?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/1572834183918480260/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=1572834183918480260' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1572834183918480260'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1572834183918480260'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2009/04/simple-method-to-manipulate-data-using.html' title='a simple method to manipulate data using sql using .net'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-8278338777536349555</id><published>2009-03-27T12:13:00.004+08:00</published><updated>2009-03-27T12:18:06.970+08:00</updated><title type='text'>add or modify table column using sql server database script</title><content type='html'>it is always recommended that you use script to run for modifucation rather set by using interface for this case.&lt;br /&gt;&lt;br /&gt;Here is the trick&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To add new column:&lt;br /&gt;&lt;blockquote&gt;ALTER TABLE Customer ADD IsFeatured bit not NULL default 0&lt;/blockquote&gt;&lt;br /&gt;To modify existing column such as data type:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;ALTER TABLE news ALTER COLUMN title VARCHAR(150) NOT NULL&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-8278338777536349555?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/8278338777536349555/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=8278338777536349555' title='268 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8278338777536349555'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8278338777536349555'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2009/03/add-or-modify-table-column-using-sql.html' title='add or modify table column using sql server database script'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>268</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-255112796819475736</id><published>2009-03-26T11:54:00.004+08:00</published><updated>2009-03-26T12:05:19.754+08:00</updated><title type='text'>How to run VB code and C# code in appCode folder?</title><content type='html'>In the web.config, under compilation&lt;br /&gt;    &lt;blockquote&gt;&lt;br /&gt;&amp;lt;compilation debug="true" strict="false" explicit="true"&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;add,&lt;br /&gt;             &lt;blockquote&gt;&amp;lt;codeSubDirectories&amp;gt;&lt;br /&gt;                 &amp;lt;add directoryName="VBCode" /&amp;gt;&lt;br /&gt;                 &amp;lt;add directoryName="CSCode" /&amp;gt;&lt;br /&gt;             &amp;lt;/codeSubDirectories&amp;gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;VBCode and CSCode are the folders in the AppCode.&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-255112796819475736?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/255112796819475736/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=255112796819475736' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/255112796819475736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/255112796819475736'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2009/03/how-to-run-vb-code-and-c-code-in.html' title='How to run VB code and C# code in appCode folder?'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-5716585744979872614</id><published>2009-03-19T00:12:00.009+08:00</published><updated>2009-03-21T20:47:35.409+08:00</updated><title type='text'>ASP.NET move  to next record or move to previous record</title><content type='html'>Basically, ASP.NET does not have move next or move previous function, therefore you need to manually use a for loop to determine the position of the target index and then use position + 1 or position -1 to get the next or previous record.&lt;br /&gt;&lt;br /&gt;If you are developing a windows form then you are lucky you can use &lt;span style="FONT-WEIGHT: bold"&gt;BindingContext&lt;/span&gt;[dataTable].Position + 1 or BindingContext[dataTable].Position - 1.&lt;br /&gt;&lt;br /&gt;Well, we are talking about ASP.NET here, if we are populating a few hundreds items and use for loop to get the position and I think it is fine.  Or u might be using datatable something like&lt;br /&gt;&lt;br /&gt;DataTable dt = new DataTable();&lt;br /&gt;dt.Rows.IndexOf(datarow);&lt;br /&gt;&lt;br /&gt;to get the index and from there u manipulate it.&lt;br /&gt;&lt;br /&gt;However what if we have 1 million of records in the table? That would be crazy!&lt;br /&gt;&lt;br /&gt;The more efficient way is to use &lt;span style="FONT-WEIGHT: bold"&gt;over&lt;/span&gt; keyword which only available in SQL Server 2005 or later. The idea is to get the previous record and the next record given the record identity. I just have to get 2 records and I just want the first record as previous and second record as next. So here is the trick.&lt;br /&gt;&lt;br /&gt;subcategoryid, name&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;31&lt;/td&gt;&lt;td&gt;Game Downloads&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;32&lt;/td&gt;&lt;td&gt;Computers &amp;amp; Accessories&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="FONT-WEIGHT: bold"&gt;33&lt;/td&gt;&lt;td style="FONT-WEIGHT: bold"&gt;Software&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;34&lt;/td&gt;&lt;td&gt;PC Games&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;35&lt;/td&gt;&lt;td&gt;Computer Components&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;36&lt;/td&gt;&lt;td&gt;Office Products &amp;amp; Supplies&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;select top(1) row_number() &lt;span style="FONT-WEIGHT: bold"&gt;over&lt;/span&gt; (order by subcategoryid desc) row, subcategoryid, name from subcategory where subcategoryid&lt;&lt;span style="FONT-WEIGHT: bold"&gt;33&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-WEIGHT: bold"&gt;union&lt;/span&gt;&lt;br /&gt;select top(1) row_number() &lt;span style="FONT-WEIGHT: bold"&gt;over&lt;/span&gt; (order by subcategoryid) row, subcategoryid, name from subcategory where subcategoryid&gt;&lt;span style="FONT-WEIGHT: bold"&gt;33&lt;/span&gt; &lt;/blockquote&gt;results:&lt;br /&gt;&lt;br /&gt;1 32 Computers &amp;amp; Accessories&lt;br /&gt;1 34 PC Games&lt;br /&gt;&lt;br /&gt;p/s please note that this solution only applicable for int column having auto numbering enabled only. the subcategoryid is the primary key, auto number and numaric&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-5716585744979872614?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/5716585744979872614/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=5716585744979872614' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/5716585744979872614'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/5716585744979872614'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2009/03/aspnet-move-next-record-or-move.html' title='ASP.NET move  to next record or move to previous record'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-3602797006784533874</id><published>2009-03-18T10:55:00.002+08:00</published><updated>2009-03-18T10:58:11.837+08:00</updated><title type='text'>SQL upcoming date</title><content type='html'>if you want to get the up coming listing such as event you can do a SQL query like this:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;SELECT        EventID,  EventName, StartDate, EndDate, EventTime, EventLink&lt;br /&gt;FROM            Events&lt;br /&gt;WHERE        (StartDate BETWEEN GETDATE() AND GETDATE() + 45)  AND (GETDATE() BETWEEN StartDate AND EndDate + 1)&lt;br /&gt;ORDER BY StartDate&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-3602797006784533874?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/3602797006784533874/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=3602797006784533874' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3602797006784533874'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3602797006784533874'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2009/03/sql-upcoming-date.html' title='SQL upcoming date'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-6542682200287025594</id><published>2009-03-12T13:25:00.005+08:00</published><updated>2009-03-12T13:37:21.049+08:00</updated><title type='text'>get data from excel using linq .net</title><content type='html'>You might want to read excel file and import the data from the excel into your .net application. Therefore you need a service that provide you this functionality. Here is the class that you can use it.&lt;br /&gt;&lt;br /&gt;I suggest you to import the data and store into a DataTable and from there you can start to manipulate it. You can also use a linq to query the data. Is that simple and easy?&lt;br /&gt;&lt;br /&gt;Initialization&lt;br /&gt;&lt;blockquote&gt;PrivatePropertyExcel ppe;&lt;br /&gt;DataTable currentExcelDataTable;&lt;br /&gt;&lt;br /&gt;private void btnTestConnection_Click(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;if (openFileDialog1.ShowDialog() == DialogResult.OK &amp;amp;&amp;amp; txtSheetName.Text != "")&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;ppe = new PrivatePropertyExcel(openFileDialog1.FileName, txtSheetName.Text);&lt;br /&gt;currentExcelDataTable = ppe.ExcelProvider.GetDataTable();&lt;br /&gt;gridSource.DataSource = currentExcelDataTable;&lt;br /&gt;gridTarget.DataSource = null;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;btnValidate.Enabled = true;&lt;br /&gt;txtStatus.Text = "";&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;if (txtSheetName.Text == "")&lt;br /&gt;{&lt;br /&gt;MessageBox.Show("Please enter sheet name");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;catch(Exception ex)&lt;br /&gt;{&lt;br /&gt;MessageBox.Show(ex.Message);&lt;br /&gt;}&lt;br /&gt;}&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Calling function&lt;br /&gt;&lt;blockquote&gt;public List&amp;lt;string&amp;gt; GetPropertyType(int columnIndex)&lt;br /&gt;{&lt;br /&gt;List&amp;lt;string&amp;gt; propertyTypeList = new List&amp;lt;string&amp;gt;();&lt;br /&gt;&lt;br /&gt;var propertyTypes =&lt;br /&gt;(from e in ppe.ExcelProvider&lt;br /&gt;where e.GetString(columnIndex).Trim() != ""&lt;br /&gt;select e.GetString(columnIndex).Trim()).Distinct();&lt;br /&gt;&lt;br /&gt;foreach (string pt in propertyTypes)&lt;br /&gt;{&lt;br /&gt;if (!propertyTypeList.Contains(pt))&lt;br /&gt;{&lt;br /&gt;propertyTypeList.Add(pt);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;return propertyTypeList;&lt;br /&gt;}&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Class&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;using System;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;using System.Linq;&lt;br /&gt;using System.Text;&lt;br /&gt;using System.Data.OleDb;&lt;br /&gt;using System.Collections;&lt;br /&gt;using System.Data;&lt;br /&gt;&lt;br /&gt;namespace ReplicatorServices&lt;br /&gt;{&lt;br /&gt;public class ExcelRow&lt;br /&gt;{&lt;br /&gt;List&amp;lt;object&amp;gt; columns;&lt;br /&gt;&lt;br /&gt;public ExcelRow()&lt;br /&gt;{&lt;br /&gt;columns = new List&amp;lt;object&amp;gt;();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;internal void AddColumn(object value)&lt;br /&gt;{&lt;br /&gt;columns.Add(value);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public object this[int index]&lt;br /&gt;{&lt;br /&gt;get { return columns[index]; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public string GetString(int index)&lt;br /&gt;{&lt;br /&gt;if (columns[index] is DBNull)&lt;br /&gt;{&lt;br /&gt;return null;&lt;br /&gt;}&lt;br /&gt;return columns[index].ToString();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public int Count&lt;br /&gt;{&lt;br /&gt;get { return this.columns.Count; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class ExcelProvider:IEnumerable&amp;lt;ExcelRow&amp;gt;&lt;br /&gt;{&lt;br /&gt;private string sheet;&lt;br /&gt;private string filePath;&lt;br /&gt;private List&amp;lt;ExcelRow&amp;gt; rows;&lt;br /&gt;private string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties= ""Excel 8.0;HDR=YES;""";&lt;br /&gt;&lt;br /&gt;public ExcelProvider()&lt;br /&gt;{&lt;br /&gt;rows = new List&amp;lt;ExcelRow&amp;gt;();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public static ExcelProvider Create(string filePath, string sheet)&lt;br /&gt;{&lt;br /&gt;ExcelProvider provider = new ExcelProvider();&lt;br /&gt;provider.sheet = sheet;&lt;br /&gt;provider.filePath = filePath;&lt;br /&gt;return provider;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public DataTable GetDataTable()&lt;br /&gt;{&lt;br /&gt;DataTable dt= new DataTable();&lt;br /&gt;connectionString = string.Format(connectionString, filePath);&lt;br /&gt;rows.Clear();&lt;br /&gt;using (OleDbConnection conn = new OleDbConnection(connectionString))&lt;br /&gt;{&lt;br /&gt;conn.Open();&lt;br /&gt;using (OleDbCommand cmd = conn.CreateCommand())&lt;br /&gt;{&lt;br /&gt;cmd.CommandText = "select DISTINCT * from [" + sheet + "$] ";&lt;br /&gt;using (OleDbDataReader reader = cmd.ExecuteReader())&lt;br /&gt;{&lt;br /&gt;dt.Load(reader);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;return dt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public DataTable GetDataTable(string sqlCommand)&lt;br /&gt;{&lt;br /&gt;DataTable dt = new DataTable();&lt;br /&gt;connectionString = string.Format(connectionString, filePath);&lt;br /&gt;rows.Clear();&lt;br /&gt;using (OleDbConnection conn = new OleDbConnection(connectionString))&lt;br /&gt;{&lt;br /&gt;conn.Open();&lt;br /&gt;using (OleDbCommand cmd = conn.CreateCommand())&lt;br /&gt;{&lt;br /&gt;cmd.CommandText = sqlCommand;&lt;br /&gt;using (OleDbDataReader reader = cmd.ExecuteReader())&lt;br /&gt;{&lt;br /&gt;dt.Load(reader);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;return dt;&lt;br /&gt;}&lt;br /&gt;public List&amp;lt;string&amp;gt; GetColumnsName()&lt;br /&gt;{&lt;br /&gt;List&amp;lt;string&amp;gt; columnlist = new List&amp;lt;string&amp;gt;();&lt;br /&gt;connectionString = string.Format(connectionString, filePath);&lt;br /&gt;rows.Clear();&lt;br /&gt;using (OleDbConnection conn = new OleDbConnection(connectionString))&lt;br /&gt;{&lt;br /&gt;conn.Open();&lt;br /&gt;using (OleDbCommand cmd = conn.CreateCommand())&lt;br /&gt;{&lt;br /&gt;cmd.CommandText = "select * from [" + sheet + "$]";&lt;br /&gt;using (OleDbDataReader reader = cmd.ExecuteReader())&lt;br /&gt;{&lt;br /&gt;for (int i = 0; i &amp;lt; reader.FieldCount; i++)&lt;br /&gt;{&lt;br /&gt;columnlist.Add(reader.GetName(i).Trim());&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;return columnlist;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private void Load()&lt;br /&gt;{&lt;br /&gt;connectionString = string.Format(connectionString, filePath);&lt;br /&gt;rows.Clear();&lt;br /&gt;using (OleDbConnection conn = new OleDbConnection(connectionString))&lt;br /&gt;{&lt;br /&gt;conn.Open();&lt;br /&gt;using (OleDbCommand cmd = conn.CreateCommand())&lt;br /&gt;{&lt;br /&gt;cmd.CommandText = "select * from [" + sheet + "$]";&lt;br /&gt;using (OleDbDataReader reader = cmd.ExecuteReader())&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;while (reader.Read())&lt;br /&gt;{&lt;br /&gt;ExcelRow newRow = new ExcelRow();&lt;br /&gt;for(int count = 0; count &amp;lt; reader.FieldCount; count++) {&lt;br /&gt;newRow.AddColumn(reader[count]);&lt;br /&gt;}&lt;br /&gt;rows.Add(newRow);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public IEnumerator&amp;lt;ExcelRow&amp;gt; GetEnumerator()&lt;br /&gt;{&lt;br /&gt;Load();&lt;br /&gt;return rows.GetEnumerator();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;IEnumerator IEnumerable.GetEnumerator()&lt;br /&gt;{&lt;br /&gt;Load();&lt;br /&gt;return rows.GetEnumerator();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;}&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-6542682200287025594?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/6542682200287025594/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=6542682200287025594' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6542682200287025594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6542682200287025594'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2009/03/get-data-from-excel-using-linq-net.html' title='get data from excel using linq .net'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-8029863481362723859</id><published>2009-03-12T13:14:00.002+08:00</published><updated>2009-03-12T13:21:25.594+08:00</updated><title type='text'>Get html tag using regex .net</title><content type='html'>Let say you want to get a specific tag from the html, you need to use regex to scan and grab it. here is the example :)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;private string FixedImgHtml(string html, int fixedwidth)&lt;br /&gt;{&lt;br /&gt;string input = html;&lt;br /&gt;MatchCollection mc = Regex.Matches(input, "&amp;lt;img[a-zA-Z0-9_\\^\\$\\.\\\\{\\[\\}\\]\\(\\)\\*\\+\\?\\\\~`!@#%&amp;amp;-=;:'\",/\\n\\s]*&amp;gt;", RegexOptions.IgnoreCase);&lt;br /&gt;foreach (Match m in mc)&lt;br /&gt;{&lt;br /&gt;input = input.Replace(m.Value, m.Value + " onload='AutoImageResizing(this, "+ fixedwidth.ToString()+")'");&lt;br /&gt;}&lt;br /&gt;return input;&lt;br /&gt;}&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-8029863481362723859?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/8029863481362723859/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=8029863481362723859' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8029863481362723859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8029863481362723859'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2009/03/get-html-tag-using-regex-net.html' title='Get html tag using regex .net'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-2612743415128776846</id><published>2009-03-06T18:40:00.002+08:00</published><updated>2009-03-06T18:43:22.264+08:00</updated><title type='text'>dynamic sql generated column using data</title><content type='html'>Sometimes we want dynamically create a column by using data and not having table structure. You can do it having this sql statement&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;select *, LFV1.Description as DevName,LFV2.Description as Location&lt;br /&gt;from&lt;br /&gt;listing L&lt;br /&gt;LEFT OUTER JOIN ListingFieldValue LFV1 ON L.ListingID =&lt;br /&gt;LFV1.ListingID AND LFV1.ListingFieldTypeID = '1'&lt;br /&gt;LEFT OUTER JOIN&lt;br /&gt;ListingFieldValue LFV2 ON L.ListingID = LFV2.ListingID AND&lt;br /&gt;LFV2.ListingFieldTypeID = '2'&lt;br /&gt;WHERE L.listingid = 1&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-2612743415128776846?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/2612743415128776846/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=2612743415128776846' title='40 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/2612743415128776846'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/2612743415128776846'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2009/03/dynamic-sql-generated-column-using-data.html' title='dynamic sql generated column using data'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>40</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-5587321435241664910</id><published>2009-02-27T18:06:00.003+08:00</published><updated>2009-02-27T18:08:26.327+08:00</updated><title type='text'>using jquery to create check box for each item</title><content type='html'>if you want to create a check box each of the item with toggle functionality use this code snippet&lt;br /&gt;&lt;br /&gt;&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt; $(document).ready(function() {&lt;br /&gt;&lt;br /&gt;  $(&amp;quot;#&amp;lt;%=btnSendEnquiryList.ClientID%&amp;gt;&amp;quot;).click(function(event) {&lt;br /&gt;   var hasItemSelected = false;&lt;br /&gt;   $(&amp;quot;#&amp;lt;%=dlNewDev.ClientID%&amp;gt; :checkbox&amp;quot;).attr(&amp;quot;checked&amp;quot;, function() {&lt;br /&gt;    if ($(this).attr(&amp;quot;checked&amp;quot;) == true) {&lt;br /&gt;     hasItemSelected = true;&lt;br /&gt;        $(this).preventDefault();&lt;br /&gt;    } else {&lt;br /&gt;     hasItemSelected = false;&lt;br /&gt;    }&lt;br /&gt;   });&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;   if (hasItemSelected == false) {&lt;br /&gt;    alert(&amp;quot;There is no listing selected. Please select at least 1 listing.&amp;quot;);&lt;br /&gt;    return false;&lt;br /&gt;   }&lt;br /&gt;  });&lt;br /&gt;&lt;br /&gt;  $(&amp;quot;#&amp;lt;%=chkCheckedAll.ClientID%&amp;gt;&amp;quot;).click(function() {&lt;br /&gt;   $(&amp;quot;#&amp;lt;%=dlNewDev.ClientID%&amp;gt; :checkbox&amp;quot;).attr(&amp;quot;checked&amp;quot;, function() {&lt;br /&gt;    if ($(this).attr(&amp;quot;checked&amp;quot;) != true) {&lt;br /&gt;     $(this).attr(&amp;quot;checked&amp;quot;, &amp;quot;checked&amp;quot;)&lt;br /&gt;    } else {&lt;br /&gt;     $(this).removeAttr(&amp;quot;checked&amp;quot;)&lt;br /&gt;    }&lt;br /&gt;   });&lt;br /&gt;&lt;br /&gt;  });&lt;br /&gt;&lt;br /&gt; });&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-5587321435241664910?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/5587321435241664910/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=5587321435241664910' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/5587321435241664910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/5587321435241664910'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2009/02/using-jquery-to-create-check-box-for.html' title='using jquery to create check box for each item'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-8130831476706102609</id><published>2009-02-27T14:43:00.004+08:00</published><updated>2009-02-27T14:50:37.726+08:00</updated><title type='text'>set/get selected value from select option / dropdownlist using jquery</title><content type='html'>Here is an example of how to set/get selected value from select option / dropdownlist using jquery&lt;br /&gt;&lt;br /&gt;To get a selected value&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;var selectedItemText = $('#&amp;lt;%=ddlCurrency.ClientID%&amp;gt;&lt;br /&gt;option:selected').val(); &lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;To set an option value to be selected&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;$('#&amp;lt;%=ddlLocation.ClientID%&amp;gt; option:contains(' + location +&lt;br /&gt;')').attr("selected", true);&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-8130831476706102609?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/8130831476706102609/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=8130831476706102609' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8130831476706102609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8130831476706102609'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2009/02/setget-selected-value-from-select.html' title='set/get selected value from select option / dropdownlist using jquery'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-8080450029090683256</id><published>2009-02-25T19:52:00.002+08:00</published><updated>2009-02-25T19:58:49.042+08:00</updated><title type='text'>Failed to load viewstate.</title><content type='html'>if you encounter this error&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Failed to load viewstate. The control tree into which viewstate is being loaded&lt;br /&gt;must match the control tree that was used to save viewstate during the previous&lt;br /&gt;request. For example, when adding controls dynamically, the controls added&lt;br /&gt;during a post-back &lt;/blockquote&gt;&lt;p&gt;&lt;br /&gt;Make sure the related control is set to false &lt;/p&gt;&lt;blockquote&gt;EnableViewState="false"&lt;/blockquote&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-8080450029090683256?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/8080450029090683256/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=8080450029090683256' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8080450029090683256'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8080450029090683256'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2009/02/failed-to-load-viewstate.html' title='Failed to load viewstate.'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-1616224055666733791</id><published>2009-02-25T11:46:00.003+08:00</published><updated>2009-02-25T11:51:57.823+08:00</updated><title type='text'>Create thumbnail image using jquery or javascript</title><content type='html'>If you want to maintain the proportion of the image when creating thumbnail for your website, please use this tested script&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&amp;lt;script src="js/jquery-1.2.6.min.js"&lt;br /&gt;type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;style&lt;br /&gt;type="text/css"&amp;gt;&lt;br /&gt;.thumbnail&lt;br /&gt;{&lt;br /&gt;vertical-align:middle;&lt;br /&gt;}&lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript" &amp;gt;&lt;br /&gt;$(document).ready(&lt;br /&gt;function AutoImageResizing(src, fixedSize) {&lt;br /&gt;var&lt;br /&gt;width = src.width;&lt;br /&gt;var height = src.height;&lt;br /&gt;var ratio = width / height;&lt;br /&gt;if (width &amp;gt; fixedSize) {&lt;br /&gt;src.width = fixedSize&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;if&lt;br /&gt;(height &amp;gt; fixedSize) {&lt;br /&gt;var sizedwidth = fixedSize / ratio;&lt;br /&gt;var&lt;br /&gt;sizedheight = fixedSize / ratio;&lt;br /&gt;if (height &amp;gt; width) {&lt;br /&gt;if (height&lt;br /&gt;&amp;gt; sizedwidth) {&lt;br /&gt;src.height = fixedSize&lt;br /&gt;}&lt;br /&gt;if (sizedwidth&lt;br /&gt;&amp;gt; fixedSize) {&lt;br /&gt;src.width = src.width * ratio;&lt;br /&gt;} else {&lt;br /&gt;src.height = src.height * ratio;&lt;br /&gt;}&lt;br /&gt;} else {&lt;br /&gt;src.width =&lt;br /&gt;fixedSize&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;);&lt;br /&gt;&amp;lt;/script&amp;gt; &lt;/blockquote&gt;HTML&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&amp;lt;img class="thumbnail"&lt;br /&gt;src="http://latimesblogs.latimes.com/photos/uncategorized/2008/10/05/love.jpg"&lt;br /&gt;onload="AutoImageResizing(this,100)" /&amp;gt;&lt;br /&gt;&amp;lt;img class="thumbnail"&lt;br /&gt;src="http://images.google.com.my/intl/en_ALL/images/images_hp.gif"&lt;br /&gt;onload="AutoImageResizing(this,100)"/&amp;gt; &lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Do you find this useful, please let me know! :)&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-1616224055666733791?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/1616224055666733791/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=1616224055666733791' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1616224055666733791'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1616224055666733791'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2009/02/create-thumbnail-image-using-jquery-or.html' title='Create thumbnail image using jquery or javascript'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-6562104192454794269</id><published>2009-02-24T10:13:00.002+08:00</published><updated>2009-02-24T10:15:32.313+08:00</updated><title type='text'>Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function.</title><content type='html'>if you got this error dealing with XML&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;{"Namespace Manager or XsltContext needed. This query has a prefix, variable, or&lt;br /&gt;user-defined function."}&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;You need to make sure that you include the &lt;strong&gt;XmlNamespaceManager &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;//Setting up NSManager&lt;br /&gt;XmlNamespaceManager man = new XmlNamespaceManager(rssDoc.NameTable);&lt;br /&gt;man.AddNamespace("msncp", "urn:schemas-microsoft-com/contentpublishing/content");&lt;br /&gt;&lt;br /&gt;take a look at the example here&lt;br /&gt;&lt;a href="http://carso-owen.blogspot.com/2009/02/how-to-get-data-from-msn-navigation.html"&gt;http://carso-owen.blogspot.com/2009/02/how-to-get-data-from-msn-navigation.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-6562104192454794269?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/6562104192454794269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=6562104192454794269' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6562104192454794269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6562104192454794269'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2009/02/namespace-manager-or-xsltcontext-needed.html' title='Namespace Manager or XsltContext needed. This query has a prefix, variable, or user-defined function.'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-6542985734453487714</id><published>2009-02-24T09:59:00.003+08:00</published><updated>2009-02-24T10:03:10.414+08:00</updated><title type='text'>string manipulation websites you must know as web designer or perhaps blogger</title><content type='html'>Some times some web editor doesn't allow you to post certain characters. Here u can hack it by encode the html&lt;br /&gt;&lt;a href="http://www.string-functions.com/htmlencode.aspx"&gt;http://www.string-functions.com/htmlencode.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You got a string put you want it a one line sentance, here is the best website to remote the breaks&lt;br /&gt;&lt;a href="http://www.textfixer.com/tools/remove-line-breaks.php"&gt;http://www.textfixer.com/tools/remove-line-breaks.php&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;You u want to generate dummy text here is the&lt;br /&gt;Lorem ipsum site&lt;br /&gt;&lt;a href="http://www.lipsum.com/"&gt;http://www.lipsum.com/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-6542985734453487714?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/6542985734453487714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=6542985734453487714' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6542985734453487714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6542985734453487714'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2009/02/string-manipulation-websites-you-must.html' title='string manipulation websites you must know as web designer or perhaps blogger'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-3479407183713780785</id><published>2009-02-24T09:29:00.006+08:00</published><updated>2009-02-24T09:52:21.385+08:00</updated><title type='text'>How to get data from msn navigation feed rss using .net</title><content type='html'>I have a project to develop a website for MSN and I have to read the feed (Microsoft own schema). Here is the code to save ur time :)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_ZJX-9msraUM/SaNPUYuReEI/AAAAAAAAAI4/DwvYBmyxYZ0/s1600-h/msn-feed.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5306171997625088066" style="WIDTH: 400px; CURSOR: hand; HEIGHT: 89px" alt="" src="http://4.bp.blogspot.com/_ZJX-9msraUM/SaNPUYuReEI/AAAAAAAAAI4/DwvYBmyxYZ0/s400/msn-feed.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Let say i want to get a feed from this link&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;http://sg.msn.com/rss/navfeedrssensg.aspx&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;By using few lines of codes to get the feed:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;MSNNavFeedMenu feedmenu = new&lt;br /&gt;MSNNavFeedMenu("http://sg.msn.com/rss/navfeedrssensg.aspx");&lt;br /&gt;string feedLinkMenu =&lt;br /&gt;feedmenu.CreateNavLinks(feedmenu.GetNavLinks(4), 5);&lt;br /&gt;string feedToolLinkMenu =&lt;br /&gt;feedmenu.CreateNavToolLinks(feedmenu.GetNavToolLinks(), 5);&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Here is the class:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Collections;&lt;br /&gt;using System.ComponentModel;&lt;br /&gt;using System.Data;&lt;br /&gt;using System.Drawing;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.Web.SessionState;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;using System.Web.UI.WebControls;&lt;br /&gt;using System.Web.UI.HtmlControls;&lt;br /&gt;using System.Configuration;&lt;br /&gt;using System.Web.Security;&lt;br /&gt;using System.Net;&lt;br /&gt;using System.IO;&lt;br /&gt;using System.Xml;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public class NavFeedRss&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;private string _Title;&lt;br /&gt;private string _Link;&lt;br /&gt;private string _Icon;&lt;br /&gt;private string _Description;&lt;br /&gt;&lt;br /&gt;public string Description&lt;br /&gt;{&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;return _Description;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public string Title&lt;br /&gt;{&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;return _Title;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public string Link&lt;br /&gt;{&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;return _Link;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public string Icon&lt;br /&gt;{&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;return _Icon;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public NavFeedRss(string title, string description, string link, string icon)&lt;br /&gt;{&lt;br /&gt;_Title = title;&lt;br /&gt;_Link = link;&lt;br /&gt;_Icon = icon;&lt;br /&gt;_Title = title;&lt;br /&gt;_Description = description;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/// &amp;lt;summary&amp;gt;&lt;br /&gt;/// Summary description for MSNNavFeedMenu&lt;br /&gt;/// &amp;lt;/summary&amp;gt;&lt;br /&gt;public class MSNNavFeedMenu&lt;br /&gt;{&lt;br /&gt;private string rssUrl;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public MSNNavFeedMenu(string rsslink)&lt;br /&gt;{&lt;br /&gt;rssUrl = rsslink;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public string CreateNavLinks(List&amp;lt;NavFeedRss&amp;gt; RssNavMenu, int columns)&lt;br /&gt;{&lt;br /&gt;string itemTitles = String.Empty;&lt;br /&gt;&lt;br /&gt;if (RssNavMenu.Count &amp;gt; 0)&lt;br /&gt;{&lt;br /&gt;//Create list&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//Create dynamic row with specified fixed column&lt;br /&gt;int row = Convert.ToInt32(Math.Floor(Convert.ToDouble(RssNavMenu.Count / columns)));&lt;br /&gt;int reminder = RssNavMenu.Count % columns;&lt;br /&gt;&lt;br /&gt;int c = 0;&lt;br /&gt;int temp = 0;&lt;br /&gt;for (int r = 1; r &amp;lt;= row; r++)&lt;br /&gt;{&lt;br /&gt;itemTitles += "&amp;lt;ul class='linklist1'&amp;gt;";&lt;br /&gt;for (c = temp; c &amp;lt; (columns * r); c++)&lt;br /&gt;{&lt;br /&gt;if (r == 1)&lt;br /&gt;{&lt;br /&gt;itemTitles += "&amp;lt;li class='first'&amp;gt;";&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;itemTitles += "&amp;lt;li&amp;gt;";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;itemTitles += "&amp;lt;a href='" + RssNavMenu[c].Link + "'&amp;gt;" + RssNavMenu[c].Title + "&amp;lt;/a&amp;gt;";&lt;br /&gt;itemTitles += "&amp;lt;/li&amp;gt;";&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;temp = columns * r;&lt;br /&gt;itemTitles += "&amp;lt;/ul&amp;gt;";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//Add reminder item&lt;br /&gt;itemTitles += "&amp;lt;ul class='linklist1'&amp;gt;";&lt;br /&gt;&lt;br /&gt;for (c = temp; c &amp;lt; temp + reminder; c++)&lt;br /&gt;{&lt;br /&gt;if (c == temp)&lt;br /&gt;{&lt;br /&gt;itemTitles += "&amp;lt;li class='first'&amp;gt;";&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;itemTitles += "&amp;lt;li&amp;gt;";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;itemTitles += "&amp;lt;a href='" + RssNavMenu[c].Link + "'&amp;gt;" + RssNavMenu[c].Title + "&amp;lt;/a&amp;gt;";&lt;br /&gt;itemTitles += "&amp;lt;/li&amp;gt;";&lt;br /&gt;}&lt;br /&gt;itemTitles += "&amp;lt;/ul&amp;gt;";&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//Closing list&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;return itemTitles;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public string CreateNavToolLinks(List&amp;lt;NavFeedRss&amp;gt; RssNavMenu, int columns)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;string itemTitles = String.Empty;&lt;br /&gt;&lt;br /&gt;if (RssNavMenu.Count &amp;gt; 0)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;//Create dynamic row with specified fixed column&lt;br /&gt;int row = Convert.ToInt32(Math.Floor(Convert.ToDouble(RssNavMenu.Count / columns)));&lt;br /&gt;int reminder = RssNavMenu.Count % columns;&lt;br /&gt;&lt;br /&gt;int c = 0;&lt;br /&gt;int temp = 0;&lt;br /&gt;for (int r = 1; r &amp;lt;= row; r++)&lt;br /&gt;{&lt;br /&gt;itemTitles += "&amp;lt;ul class='linkedimglinklist1 cf'&amp;gt;";&lt;br /&gt;for (c = temp; c &amp;lt; (columns * r); c++)&lt;br /&gt;{&lt;br /&gt;if (r == 1)&lt;br /&gt;{&lt;br /&gt;itemTitles += "&amp;lt;li class='first'&amp;gt;";&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;itemTitles += "&amp;lt;li&amp;gt;";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;itemTitles += "&amp;lt;a href='" + RssNavMenu[c].Link + "'&amp;gt;&amp;lt;img src='" + RssNavMenu[c].Icon + "' width='25' height='20' alt='Windows Live Messenger' /&amp;gt;&amp;lt;span&amp;gt;&amp;lt;strong&amp;gt;" + RssNavMenu[c].Title + "&amp;lt;/strong&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;";&lt;br /&gt;itemTitles += "&amp;lt;/li&amp;gt;";&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;temp = columns * r;&lt;br /&gt;itemTitles += "&amp;lt;/ul&amp;gt;";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//Add reminder item&lt;br /&gt;itemTitles += "&amp;lt;ul class='linkedimglinklist1 cf'&amp;gt;";&lt;br /&gt;&lt;br /&gt;for (c = temp; c &amp;lt; temp + reminder; c++)&lt;br /&gt;{&lt;br /&gt;if (c == temp)&lt;br /&gt;{&lt;br /&gt;itemTitles += "&amp;lt;li class='first'&amp;gt;";&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;itemTitles += "&amp;lt;li&amp;gt;";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;itemTitles += "&amp;lt;a href='" + RssNavMenu[c].Link + "'&amp;gt;&amp;lt;img src='" + RssNavMenu[c].Icon + "' width='25' height='20' alt='Windows Live Messenger' /&amp;gt;&amp;lt;span&amp;gt;&amp;lt;strong&amp;gt;" + RssNavMenu[c].Title + "&amp;lt;/strong&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;";&lt;br /&gt;&lt;br /&gt;itemTitles += "&amp;lt;/li&amp;gt;";&lt;br /&gt;}&lt;br /&gt;itemTitles += "&amp;lt;/ul&amp;gt;";&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//Closing list&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;return itemTitles;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public List&amp;lt;NavFeedRss&amp;gt; GetNavToolLinks()&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;List&amp;lt;NavFeedRss&amp;gt; rsstitles = new List&amp;lt;NavFeedRss&amp;gt;();&lt;br /&gt;&lt;br /&gt;WebRequest myRequest = WebRequest.Create(rssUrl);&lt;br /&gt;WebResponse myResponse = myRequest.GetResponse();&lt;br /&gt;&lt;br /&gt;Stream rssStream = myResponse.GetResponseStream();&lt;br /&gt;XmlDocument rssDoc = new XmlDocument();&lt;br /&gt;rssDoc.Load(rssStream);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//Setting up NSManager&lt;br /&gt;XmlNamespaceManager man = new XmlNamespaceManager(rssDoc.NameTable);&lt;br /&gt;man.AddNamespace("msncp", "urn:schemas-microsoft-com/contentpublishing/content");&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;XmlNodeList rssItemsImg = rssDoc.SelectNodes("rss/channel/msncp:gtl/msncp:networklists/msncp:toollist/msncp:tool/msncp:imagelink/msncp:image", man);&lt;br /&gt;XmlNodeList rssItemsLnk = rssDoc.SelectNodes("rss/channel/msncp:gtl/msncp:networklists/msncp:toollist/msncp:tool/msncp:imagelink/msncp:link", man);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;string title = "";&lt;br /&gt;string link = "";&lt;br /&gt;string description = "";&lt;br /&gt;string enclosure = "";&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;for (int i = 0; i &amp;lt; rssItemsLnk.Count; i++)&lt;br /&gt;{&lt;br /&gt;XmlNode rssDetail;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;rssDetail = rssItemsImg.Item(i).SelectSingleNode("msncp:src", man);&lt;br /&gt;if (rssDetail != null)&lt;br /&gt;{&lt;br /&gt;enclosure = rssDetail.InnerText;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;enclosure = "";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;rssDetail = rssItemsImg.Item(i).SelectSingleNode("msncp:alternatetext", man);&lt;br /&gt;if (rssDetail != null)&lt;br /&gt;{&lt;br /&gt;description = rssDetail.InnerText;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;description = "";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;rssDetail = rssItemsLnk.Item(i).SelectSingleNode("msncp:text", man);&lt;br /&gt;if (rssDetail != null)&lt;br /&gt;{&lt;br /&gt;title = rssDetail.InnerText;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;title = "";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;rssDetail = rssItemsLnk.Item(i).SelectSingleNode("msncp:url", man);&lt;br /&gt;if (rssDetail != null)&lt;br /&gt;{&lt;br /&gt;link = rssDetail.InnerText;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;link = "";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;rsstitles.Add(new NavFeedRss(title, description, link, enclosure));&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;return rsstitles;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public List&amp;lt;NavFeedRss&amp;gt; GetNavLinks(int start)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;List&amp;lt;NavFeedRss&amp;gt; rsstitles = new List&amp;lt;NavFeedRss&amp;gt;();&lt;br /&gt;&lt;br /&gt;WebRequest myRequest = WebRequest.Create(rssUrl);&lt;br /&gt;WebResponse myResponse = myRequest.GetResponse();&lt;br /&gt;&lt;br /&gt;Stream rssStream = myResponse.GetResponseStream();&lt;br /&gt;XmlDocument rssDoc = new XmlDocument();&lt;br /&gt;rssDoc.Load(rssStream);&lt;br /&gt;&lt;br /&gt;XmlNodeList rssItems = rssDoc.SelectNodes("rss/channel/item");&lt;br /&gt;&lt;br /&gt;string title = "";&lt;br /&gt;string link = "";&lt;br /&gt;string description = "";&lt;br /&gt;string enclosure = "";&lt;br /&gt;&lt;br /&gt;for (int i = start; i &amp;lt; rssItems.Count; i++)&lt;br /&gt;{&lt;br /&gt;XmlNode rssDetail;&lt;br /&gt;&lt;br /&gt;rssDetail = rssItems.Item(i).SelectSingleNode("title");&lt;br /&gt;if (rssDetail != null)&lt;br /&gt;{&lt;br /&gt;title = rssDetail.InnerText;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;title = "";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;rssDetail = rssItems.Item(i).SelectSingleNode("enclosure");&lt;br /&gt;if (rssDetail != null)&lt;br /&gt;{&lt;br /&gt;enclosure = rssDetail.Attributes["url"].InnerText;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;enclosure = "";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;rssDetail = rssItems.Item(i).SelectSingleNode("link");&lt;br /&gt;if (rssDetail != null)&lt;br /&gt;{&lt;br /&gt;link = rssDetail.InnerText;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;link = "";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;rssDetail = rssItems.Item(i).SelectSingleNode("description");&lt;br /&gt;if (rssDetail != null)&lt;br /&gt;{&lt;br /&gt;description = rssDetail.InnerText;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;description = "";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;rsstitles.Add(new NavFeedRss(title, description, link, enclosure));&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;return rsstitles;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-3479407183713780785?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/3479407183713780785/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=3479407183713780785' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3479407183713780785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3479407183713780785'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2009/02/how-to-get-data-from-msn-navigation.html' title='How to get data from msn navigation feed rss using .net'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_ZJX-9msraUM/SaNPUYuReEI/AAAAAAAAAI4/DwvYBmyxYZ0/s72-c/msn-feed.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-1238932846866352225</id><published>2009-02-22T11:22:00.006+08:00</published><updated>2009-02-22T11:38:23.127+08:00</updated><title type='text'>using store procedure is not my style in .net</title><content type='html'>During the past I am quite excited about using store procedure and I used it quite often for some performance reason and right now I found out that performance gain is a big trade off of the code maintainability and flexibility in my system. The reason I say so is because when i want to perform a select statement for instance, I need to create a new store procedure and over the time I have a hard time to maintain it. Actually, putting SQL statements inside application code is far more better than having storing store procedure over the server. Just think about by concatenate sql in a string with some condition and forget about store procedure which create so much complication. What do you think? Is life more simpler?&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-1238932846866352225?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/1238932846866352225/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=1238932846866352225' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1238932846866352225'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1238932846866352225'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2009/02/using-store-procedure-is-not-my-style.html' title='using store procedure is not my style in .net'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-4710071469711600076</id><published>2009-02-20T10:05:00.003+08:00</published><updated>2009-02-20T10:09:37.749+08:00</updated><title type='text'>jquery get and set value dealing with asp.net control</title><content type='html'>this demo show that how I get value from the lblSearchType &lt;span style="font-style: italic;"&gt;(Label)&lt;/span&gt; and populate data into txtKeyword&lt;span style="font-style: italic;"&gt; (TextBox)&lt;/span&gt; asp.net control when I click different radio button using jquery&lt;br /&gt;&lt;br /&gt;           &lt;blockquote&gt; $('#&lt;%=rdKeywordSearch.ClientID%&gt;').click(function() {&lt;br /&gt;                $('#&lt;%=lblSearchType.ClientID%&gt;').text("Keyword");&lt;br /&gt;                $('#&lt;%=txtKeyword.ClientID%&gt;_input').attr("value", "Keyword");&lt;br /&gt;                $('#&lt;%=txtKeyword.ClientID%&gt;_input').attr("value", "Enter keyword here...");&lt;br /&gt;            });&lt;br /&gt;&lt;br /&gt;            $('#&lt;%=rdLocationSearch.ClientID%&gt;').click(function() {&lt;br /&gt;                $('#&lt;%=lblSearchType.ClientID%&gt;').text("Location");&lt;br /&gt;                $('#&lt;%=txtKeyword.ClientID%&gt;_input').attr("value", "Location");&lt;br /&gt;               $('#&lt;%=txtKeyword.ClientID%&gt;_input').attr("value", "Enter location here...");&lt;br /&gt;           });&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-4710071469711600076?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/4710071469711600076/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=4710071469711600076' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/4710071469711600076'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/4710071469711600076'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2009/02/jquery-get-value-from-aspnet-control.html' title='jquery get and set value dealing with asp.net control'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-3642441822157739219</id><published>2009-02-18T14:39:00.002+08:00</published><updated>2009-02-18T14:49:51.402+08:00</updated><title type='text'>Resize picture function in C#</title><content type='html'>&lt;blockquote&gt;&lt;p&gt;&lt;br /&gt;using System.Drawing;&lt;br /&gt;using System.Drawing.Drawing2D;&lt;/p&gt;&lt;p&gt;//w means the output size of the image width&lt;/p&gt;&lt;p&gt;&lt;br /&gt;public static bool ResizePhoto(string src, string dest, int w)&lt;br /&gt;{&lt;br /&gt;System.Drawing.Image imgTmp = default(System.Drawing.Image);&lt;br /&gt;double sf = 0;&lt;br /&gt;System.Drawing.Bitmap imgFoto = default(System.Drawing.Bitmap);&lt;br /&gt;imgTmp = System.Drawing.Image.FromFile(src);&lt;br /&gt;if ((imgTmp.Width &gt; w))&lt;br /&gt;{&lt;br /&gt;sf = imgTmp.Width / w;&lt;br /&gt;imgFoto = new System.Drawing.Bitmap(w, (int)(imgTmp.Height / sf));&lt;br /&gt;Rectangle recDest = new Rectangle(0, 0, w, imgFoto.Height);&lt;br /&gt;Graphics gphCrop = Graphics.FromImage(imgFoto);&lt;br /&gt;gphCrop.SmoothingMode = SmoothingMode.HighQuality;&lt;br /&gt;gphCrop.CompositingQuality = CompositingQuality.HighQuality;&lt;br /&gt;gphCrop.InterpolationMode = InterpolationMode.High;&lt;br /&gt;gphCrop.DrawImage(imgTmp, recDest, 0, 0, imgTmp.Width, imgTmp.Height, GraphicsUnit.Pixel);&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;imgFoto = (Bitmap)imgTmp;&lt;br /&gt;}&lt;br /&gt;System.Drawing.Imaging.Encoder myEncoder = default(System.Drawing.Imaging.Encoder);&lt;br /&gt;System.Drawing.Imaging.EncoderParameter myEncoderParameter = default(System.Drawing.Imaging.EncoderParameter);&lt;br /&gt;System.Drawing.Imaging.EncoderParameters myEncoderParameters = default(System.Drawing.Imaging.EncoderParameters);&lt;br /&gt;System.Drawing.Imaging.ImageCodecInfo[] arrayICI = System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders();&lt;br /&gt;System.Drawing.Imaging.ImageCodecInfo jpegICI = null;&lt;br /&gt;int x = 0;&lt;br /&gt;for (x = 0; x &lt;= arrayICI.Length - 1; x++)&lt;br /&gt;{&lt;br /&gt;if ((arrayICI[x].FormatDescription.Equals("JPEG")))&lt;br /&gt;{&lt;br /&gt;jpegICI = arrayICI[x];&lt;br /&gt;break;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;myEncoder = System.Drawing.Imaging.Encoder.Quality;&lt;br /&gt;myEncoderParameters = new System.Drawing.Imaging.EncoderParameters(1);&lt;br /&gt;myEncoderParameter = new System.Drawing.Imaging.EncoderParameter(myEncoder, 60L);&lt;br /&gt;myEncoderParameters.Param[0] = myEncoderParameter;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;imgFoto.Save(dest, jpegICI, myEncoderParameters);&lt;br /&gt;}&lt;br /&gt;catch (Exception ex)&lt;br /&gt;{&lt;br /&gt;throw ex;&lt;br /&gt;}&lt;br /&gt;imgFoto.Dispose();&lt;br /&gt;imgTmp.Dispose();&lt;br /&gt;return true;&lt;br /&gt;} &lt;/p&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-3642441822157739219?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/3642441822157739219/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=3642441822157739219' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3642441822157739219'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3642441822157739219'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2009/02/resize-picture-function-in-c.html' title='Resize picture function in C#'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-8969432716832845210</id><published>2009-02-17T15:13:00.005+08:00</published><updated>2009-02-17T17:34:46.249+08:00</updated><title type='text'>ajax json jquery call with passing parameters using ASP.Net</title><content type='html'>If you want to load a content faster than before, you need to use ajax to load content. To get started you need to:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;HTML&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;div id="EventContent" class="loading"/&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;SCRIPT&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;$.ajax({&lt;br /&gt;type: "POST",&lt;br /&gt;url: "RSSReader.asmx/GetRSSReader",&lt;br /&gt;data:&lt;br /&gt;"{&lt;strong&gt;controlName&lt;/strong&gt;:'events.ascx'}",&lt;br /&gt;contentType: "application/json;&lt;br /&gt;charset=utf-8",&lt;br /&gt;dataType: "json",&lt;br /&gt;success: function(data)&lt;br /&gt;{&lt;br /&gt;$('#EventContent').removeClass('loading').html(data);&lt;br /&gt;}&lt;br /&gt;});&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;APP_CODE&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;[WebService(Namespace = "http://tempuri.org/")]&lt;br /&gt;[WebServiceBinding(ConformsTo&lt;br /&gt;=&lt;br /&gt;WsiProfiles.BasicProfile1_1)]&lt;br /&gt;[System.Web.Script.Services.ScriptService]&lt;br /&gt;public&lt;br /&gt;class RSSReader : System.Web.Services.WebService {&lt;br /&gt;[WebMethod]&lt;br /&gt;public&lt;br /&gt;string GetRSSReader(string &lt;strong&gt;controlName&lt;/strong&gt;)&lt;br /&gt;{&lt;br /&gt;Page page = new&lt;br /&gt;Page();&lt;br /&gt;UserControl ctl =&lt;br /&gt;(UserControl)page.LoadControl("~/controls/" +&lt;br /&gt;controlName);&lt;br /&gt;page.Controls.Add(ctl);&lt;br /&gt;StringWriter writer = new&lt;br /&gt;StringWriter();&lt;br /&gt;HttpContext.Current.Server.Execute(page, writer,&lt;br /&gt;false);&lt;br /&gt;return writer.ToString();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Notice that the bold text is the parameter name and it have to be same. It is recommended to be string&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-8969432716832845210?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/8969432716832845210/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=8969432716832845210' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8969432716832845210'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8969432716832845210'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2009/02/ajax-json-jquery-call-with-passing.html' title='ajax json jquery call with passing parameters using ASP.Net'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-1508793669930118959</id><published>2009-01-14T09:23:00.003+08:00</published><updated>2009-01-14T09:27:25.427+08:00</updated><title type='text'>check string contains chinese character or not in C#</title><content type='html'>string word = "是集室內";&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        char fo = word[0];&lt;br /&gt;&lt;br /&gt;        UnicodeCategory cat = char.GetUnicodeCategory(fo);&lt;br /&gt;        if (cat == UnicodeCategory.OtherLetter)&lt;br /&gt;        {&lt;br /&gt;               //chinese char&lt;br /&gt;        }&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;              //english char&lt;br /&gt;        }&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-1508793669930118959?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/1508793669930118959/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=1508793669930118959' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1508793669930118959'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1508793669930118959'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2009/01/check-string-contains-chinese-character.html' title='check string contains chinese character or not in C#'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-2535326060171383802</id><published>2008-12-12T10:49:00.001+08:00</published><updated>2008-12-12T10:50:51.138+08:00</updated><title type='text'>Remove HTML tags using regex .NET</title><content type='html'>&lt;blockquote&gt;private string StripTagsRegex(string text)&lt;br /&gt;  {&lt;br /&gt;      return Regex.Replace(text, "&lt;.*?&gt;", string.Empty);&lt;br /&gt;  }&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-2535326060171383802?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/2535326060171383802/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=2535326060171383802' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/2535326060171383802'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/2535326060171383802'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/12/remove-html-tags.html' title='Remove HTML tags using regex .NET'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-6378237240585558847</id><published>2008-11-28T00:15:00.003+08:00</published><updated>2008-11-28T00:21:13.270+08:00</updated><title type='text'>ASP.NET validation problem with Response.Redirect</title><content type='html'>What is the correct why of doing validation? Why the the form doesn't validated if Response.Redirect code sit under the command button?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;answer:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt; if(Page.IsValid){&lt;br /&gt;&lt;br /&gt;Response.Redirect("abc.aspx");&lt;br /&gt;&lt;br /&gt;}&lt;/blockquote&gt;&lt;br /&gt;Otherwise, the page do not have chance to be validated.&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-6378237240585558847?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/6378237240585558847/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=6378237240585558847' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6378237240585558847'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6378237240585558847'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/11/aspnet-validation-problem-with.html' title='ASP.NET validation problem with Response.Redirect'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-3584502733883959787</id><published>2008-11-28T00:13:00.003+08:00</published><updated>2008-11-28T00:15:32.274+08:00</updated><title type='text'>Put ASP.NET dynamic data into your existing application</title><content type='html'>Sometimes we might want to move the dynamic data folder to another directory so here is the tricks&lt;br /&gt;&lt;br /&gt;http://msdn.microsoft.com/en-us/library/cc837197.aspx&lt;br /&gt;&lt;br /&gt;http://msdn.microsoft.com/en-us/library/cc837200.aspx&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Hope it helps&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-3584502733883959787?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/3584502733883959787/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=3584502733883959787' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3584502733883959787'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3584502733883959787'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/11/put-aspnet-dynamic-data-into-your.html' title='Put ASP.NET dynamic data into your existing application'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-6564017084480463920</id><published>2008-11-27T09:38:00.003+08:00</published><updated>2008-11-27T09:44:11.916+08:00</updated><title type='text'>Running .NET 3.5 in .NET 2.0 environment</title><content type='html'>&lt;code&gt;If you love linq and want to get it runs in .NET Framework 2.0 environment, don't worry just copy those files below into your application bin and do some settings in the web.config and it will works.&lt;br /&gt;&lt;br /&gt;System.Core.dll&lt;br /&gt;System.Data.DataSetExtensions.dll&lt;br /&gt;System.Data.Linq.dll&lt;br /&gt;System.Web.dll&lt;br /&gt;System.Web.Extensions.dll&lt;br /&gt;System.Xml.Linq.dll&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;Where to find all these files?&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-6564017084480463920?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/6564017084480463920/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=6564017084480463920' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6564017084480463920'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6564017084480463920'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/11/running-net-35-in-net-20-environment.html' title='Running .NET 3.5 in .NET 2.0 environment'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-822042123234590012</id><published>2008-11-09T23:09:00.002+08:00</published><updated>2008-11-10T00:00:50.806+08:00</updated><title type='text'>Globalization &amp; Localization in ASP.NET</title><content type='html'>&amp;lt;strong&amp;gt;&amp;lt;a href="http://www.blogger.com/post-edit.g?culture=en-US"&amp;gt;English&amp;lt;/a&amp;gt;&amp;lt;/strong&amp;gt; | 日本語 |&amp;lt;a href="http://www.blogger.com/post-edit.g?culture=zh-HK"&amp;gt;中国&amp;lt;/a&amp;gt;  | Deutsch | 한국어&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;if (Request.QueryString["culture"] != null)&lt;br /&gt;     {&lt;br /&gt;         Session["Culture"] = Request.QueryString["culture"];&lt;br /&gt;     }&lt;br /&gt;&lt;br /&gt;     if (Session["Culture"] != null)&lt;br /&gt;     {&lt;br /&gt;&lt;br /&gt;         Thread.CurrentThread.CurrentUICulture = new CultureInfo(Session["Culture"].ToString());&lt;br /&gt;         Thread.CurrentThread.CurrentCulture = new CultureInfo(Session["Culture"].ToString());&lt;br /&gt;     }&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-822042123234590012?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/822042123234590012/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=822042123234590012' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/822042123234590012'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/822042123234590012'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/11/globalization-localization.html' title='Globalization &amp; Localization in ASP.NET'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-127011756635197826</id><published>2008-11-09T13:25:00.005+08:00</published><updated>2008-11-09T13:50:26.994+08:00</updated><title type='text'>Create Tag Cloud C# 2.0 - The simplest and fastest way</title><content type='html'>Output:&lt;br /&gt;&lt;span style="font-size:36;"&gt;&lt;/span&gt;&lt;span style="font-size:12;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 36pt;"&gt;palad1 &lt;/span&gt;&lt;span style="font-size: 24pt;"&gt;palad2  &lt;/span&gt;&lt;span style="font-size: 12pt;"&gt;palad3 &lt;/span&gt;&lt;span style="font-size: 12pt;"&gt;palad4  &lt;/span&gt;&lt;span style="font-size:12;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;blockquote&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Collections;&lt;br /&gt;using System.Configuration;&lt;br /&gt;using System.Data;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.Web.Security;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;using System.Web.UI.HtmlControls;&lt;br /&gt;using System.Web.UI.WebControls;&lt;br /&gt;using System.Web.UI.WebControls.WebParts;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;using System.Text;&lt;br /&gt;&lt;br /&gt;namespace WebApplication1&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;public class ItemFeq&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;private string _PhotoName;&lt;br /&gt;&lt;br /&gt;public string PhotoName&lt;br /&gt;{&lt;br /&gt;   get { return _PhotoName; }&lt;br /&gt;   set { _PhotoName = value; }&lt;br /&gt;}&lt;br /&gt;private int _Count;&lt;br /&gt;&lt;br /&gt;public int Count&lt;br /&gt;{&lt;br /&gt;   get { return _Count; }&lt;br /&gt;   set { _Count = value; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private int _Size;&lt;br /&gt;&lt;br /&gt;public int Size&lt;br /&gt;{&lt;br /&gt;   get { return _Size; }&lt;br /&gt;   set { _Size = value; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public ItemFeq(string photoname, int count, int size)&lt;br /&gt;{&lt;br /&gt;   _PhotoName = photoname;&lt;br /&gt;   _Count = count;&lt;br /&gt;   _Size = size;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class ItemTag&lt;br /&gt;{&lt;br /&gt;private int _ItemID;&lt;br /&gt;&lt;br /&gt;public int PhotoID&lt;br /&gt;{&lt;br /&gt;   get { return _ItemID; }&lt;br /&gt;   set { _ItemID = value; }&lt;br /&gt;}&lt;br /&gt;private string _Tag;&lt;br /&gt;&lt;br /&gt;public string Tag&lt;br /&gt;{&lt;br /&gt;   get { return _Tag; }&lt;br /&gt;   set { _Tag = value; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public ItemTag(int itemid, string tag)&lt;br /&gt;{&lt;br /&gt;   _Tag = tag;&lt;br /&gt;   _ItemID = itemid;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class ItemTagComparer : IComparer&amp;lt;ItemTag&amp;gt;&lt;br /&gt;{&lt;br /&gt;public int Compare(ItemTag x, ItemTag y)&lt;br /&gt;{&lt;br /&gt;   if (x.Tag == y.Tag) { return 0; } else { return x.Tag.CompareTo(y.Tag); }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class ItemFeqByCountComparer : IComparer&amp;lt;ItemFeq&amp;gt;&lt;br /&gt;{&lt;br /&gt;public int Compare(ItemFeq x, ItemFeq y)&lt;br /&gt;{&lt;br /&gt;   if (x.Count == y.Count)&lt;br /&gt;   { return 0; }&lt;br /&gt;   else&lt;br /&gt;   { return x.Count.CompareTo(y.Count); }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public partial class _Default : System.Web.UI.Page&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;public string CreateTagCloud(List&amp;lt;ItemTag&amp;gt; tags, int baseSize)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;   tags.Sort(new ItemTagComparer());&lt;br /&gt;&lt;br /&gt;   List&amp;lt;ItemFeq&amp;gt; photofeqlist = new List&amp;lt;ItemFeq&amp;gt;();&lt;br /&gt;&lt;br /&gt;   foreach (ItemTag ptag in tags)&lt;br /&gt;   {&lt;br /&gt;       if (photofeqlist.Exists(delegate(ItemFeq pf) { return pf.PhotoName == ptag.Tag; }))&lt;br /&gt;       {&lt;br /&gt;           photofeqlist.Find(delegate(ItemFeq pq) { return pq.PhotoName == ptag.Tag; }).Count += 1;&lt;br /&gt;           photofeqlist.Find(delegate(ItemFeq pq) { return pq.PhotoName == ptag.Tag; }).Size += 1;&lt;br /&gt;       }&lt;br /&gt;       else&lt;br /&gt;       {&lt;br /&gt;           photofeqlist.Add(new ItemFeq(ptag.Tag, 1, baseSize));&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   photofeqlist.Sort(new ItemFeqByCountComparer());&lt;br /&gt;   photofeqlist.Reverse();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   StringBuilder sb = new StringBuilder();&lt;br /&gt;&lt;br /&gt;   int sum = 0;&lt;br /&gt;   foreach (ItemFeq pf in photofeqlist)&lt;br /&gt;   {&lt;br /&gt;       sum += pf.Count;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   foreach (ItemFeq pf in photofeqlist)&lt;br /&gt;   {&lt;br /&gt;       sb.Append("&amp;lt;span style='font-size:" + (pf.Size / (sum / photofeqlist.Count)) * baseSize + "pt'&amp;gt;" + pf.PhotoName + " &amp;lt;/span&amp;gt;");&lt;br /&gt;&lt;br /&gt;   }&lt;br /&gt;   return sb.ToString();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;protected void Button1_Click(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;   List&amp;lt;ItemTag&amp;gt; phototags = new List&amp;lt;ItemTag&amp;gt;();&lt;br /&gt;   phototags.Add(new ItemTag(121, "palad1"));&lt;br /&gt;   phototags.Add(new ItemTag(122, "palad1"));&lt;br /&gt;   phototags.Add(new ItemTag(123, "palad1"));&lt;br /&gt;   phototags.Add(new ItemTag(124, "palad1"));&lt;br /&gt;   phototags.Add(new ItemTag(125, "palad1"));&lt;br /&gt;   phototags.Add(new ItemTag(126, "palad2"));&lt;br /&gt;   phototags.Add(new ItemTag(122, "palad2"));&lt;br /&gt;   phototags.Add(new ItemTag(122, "palad2"));&lt;br /&gt;   phototags.Add(new ItemTag(121, "palad2"));&lt;br /&gt;   phototags.Add(new ItemTag(122, "palad2"));&lt;br /&gt;   phototags.Add(new ItemTag(121, "palad2"));&lt;br /&gt;   phototags.Add(new ItemTag(126, "palad2"));&lt;br /&gt;   phototags.Add(new ItemTag(121, "palad2"));&lt;br /&gt;   phototags.Add(new ItemTag(122, "palad2"));&lt;br /&gt;   phototags.Add(new ItemTag(121, "palad2"));&lt;br /&gt;   phototags.Add(new ItemTag(122, "palad3"));&lt;br /&gt;   phototags.Add(new ItemTag(123, "palad3"));&lt;br /&gt;   phototags.Add(new ItemTag(124, "palad3"));&lt;br /&gt;   phototags.Add(new ItemTag(125, "palad4"));&lt;br /&gt;   phototags.Add(new ItemTag(126, "palad4"));&lt;br /&gt;   phototags.Add(new ItemTag(121, "palad1"));&lt;br /&gt;   phototags.Add(new ItemTag(122, "palad1"));&lt;br /&gt;   phototags.Add(new ItemTag(121, "palad1"));&lt;br /&gt;   phototags.Add(new ItemTag(122, "palad1"));&lt;br /&gt;   phototags.Add(new ItemTag(121, "palad1"));&lt;br /&gt;   phototags.Add(new ItemTag(122, "palad1"));&lt;br /&gt;   phototags.Add(new ItemTag(121, "palad1"));&lt;br /&gt;   phototags.Add(new ItemTag(122, "palad1"));&lt;br /&gt;   phototags.Add(new ItemTag(121, "palad1"));&lt;br /&gt;   phototags.Add(new ItemTag(122, "palad1"));&lt;br /&gt;   phototags.Add(new ItemTag(121, "palad1"));&lt;br /&gt;   phototags.Add(new ItemTag(122, "palad1"));&lt;br /&gt;&lt;br /&gt;   Literal1.Text = CreateTagCloud(phototags, 12);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-127011756635197826?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/127011756635197826/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=127011756635197826' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/127011756635197826'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/127011756635197826'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/11/create-tag-cloud-c-20.html' title='Create Tag Cloud C# 2.0 - The simplest and fastest way'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-8162739562011483026</id><published>2008-11-09T02:59:00.002+08:00</published><updated>2008-11-09T03:02:05.196+08:00</updated><title type='text'>Encode HTML</title><content type='html'>do u know u need to encode some html code so that it will display correctly in some website because those website afraid you inject some dangerous scripts into their website.&lt;br /&gt;&lt;br /&gt;Here is the translation:&lt;br /&gt;http://demo.nickname.net/demo/testpak/encode.pl&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-8162739562011483026?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/8162739562011483026/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=8162739562011483026' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8162739562011483026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8162739562011483026'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/11/encode-html.html' title='Encode HTML'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-8777492097715325032</id><published>2008-11-09T02:45:00.010+08:00</published><updated>2008-11-09T03:05:16.954+08:00</updated><title type='text'>The most simple way to group by in a list collection using .NET 2.0  (IEqualityComparer &amp; IComparer)  and .NET 3.5 (Linq) functions</title><content type='html'>&lt;blockquote&gt;using System;&lt;br /&gt;using System.Collections;&lt;br /&gt;using System.Configuration;&lt;br /&gt;using System.Data;&lt;br /&gt;using System.Linq;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.Web.Security;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;using System.Web.UI.HtmlControls;&lt;br /&gt;using System.Web.UI.WebControls;&lt;br /&gt;using System.Web.UI.WebControls.WebParts;&lt;br /&gt;using System.Xml.Linq;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;&lt;br /&gt;namespace WebApplication1&lt;br /&gt;{&lt;br /&gt;  public class PhotoFeq&lt;br /&gt;  {&lt;br /&gt;      private string _PhotoName;&lt;br /&gt;&lt;br /&gt;      public string PhotoName&lt;br /&gt;      {&lt;br /&gt;          get { return _PhotoName; }&lt;br /&gt;          set { _PhotoName = value; }&lt;br /&gt;      }&lt;br /&gt;      private int _Count;&lt;br /&gt;&lt;br /&gt;      public int Count&lt;br /&gt;      {&lt;br /&gt;          get { return _Count; }&lt;br /&gt;          set { _Count = value; }&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;      public PhotoFeq(string photoname, int count)&lt;br /&gt;      {&lt;br /&gt;          _PhotoName = photoname;&lt;br /&gt;          _Count = count;&lt;br /&gt;      }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public class PhotoTag&lt;br /&gt;  {&lt;br /&gt;      private int _PhotoID;&lt;br /&gt;&lt;br /&gt;      public int PhotoID&lt;br /&gt;      {&lt;br /&gt;          get { return _PhotoID; }&lt;br /&gt;          set { _PhotoID = value; }&lt;br /&gt;      }&lt;br /&gt;      private string _Tag;&lt;br /&gt;&lt;br /&gt;      public string Tag&lt;br /&gt;      {&lt;br /&gt;          get { return _Tag; }&lt;br /&gt;          set { _Tag = value; }&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;      public PhotoTag(int photoid, string tag)&lt;br /&gt;      {&lt;br /&gt;          _Tag = tag;&lt;br /&gt;          _PhotoID = photoid;&lt;br /&gt;      }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public class PhotoTagEqualityComparer : IEqualityComparer&amp;lt;PhotoTag&amp;gt;&lt;br /&gt;  {&lt;br /&gt;      public bool Equals(PhotoTag x, PhotoTag y)&lt;br /&gt;      {&lt;br /&gt;          if (x.Tag == y.Tag )&lt;br /&gt;          {&lt;br /&gt;              return true;&lt;br /&gt;          }&lt;br /&gt;          else&lt;br /&gt;          {&lt;br /&gt;              return false;&lt;br /&gt;          }&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;      public int GetHashCode(PhotoTag obj)&lt;br /&gt;      {&lt;br /&gt;          return base.GetHashCode();&lt;br /&gt;      }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  public class PhotoTagComparer : IComparer&amp;lt;PhotoTag&amp;gt;&lt;br /&gt;  {&lt;br /&gt;      public int Compare(PhotoTag x, PhotoTag y)&lt;br /&gt;      {&lt;br /&gt;          if (x.Tag == y.Tag) { return 0; } else { return x.Tag.CompareTo(y.Tag); }&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  public partial class _Default : System.Web.UI.Page&lt;br /&gt;  {&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;      protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;      {&lt;br /&gt;&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;      protected void Button1_Click(object sender, EventArgs e)&lt;br /&gt;      {&lt;br /&gt;          //output&lt;br /&gt;          //kiki 1&lt;br /&gt;          //gigi 2&lt;br /&gt;          //jojo 3&lt;br /&gt;          //sasa 3&lt;br /&gt;          //lala 6&lt;br /&gt;          //nini 6&lt;br /&gt;&lt;br /&gt;          List&amp;lt;PhotoTag&amp;gt; phototags = new List&amp;lt;PhotoTag&amp;gt;();&lt;br /&gt;          phototags.Add(new PhotoTag(121, "lala"));&lt;br /&gt;          phototags.Add(new PhotoTag(122, "lala"));&lt;br /&gt;          phototags.Add(new PhotoTag(123, "lala"));&lt;br /&gt;          phototags.Add(new PhotoTag(124, "lala"));&lt;br /&gt;          phototags.Add(new PhotoTag(125, "lala"));&lt;br /&gt;          phototags.Add(new PhotoTag(126, "lala"));&lt;br /&gt;&lt;br /&gt;          phototags.Add(new PhotoTag(127, "jojo"));&lt;br /&gt;          phototags.Add(new PhotoTag(128, "jojo"));&lt;br /&gt;          phototags.Add(new PhotoTag(129, "jojo"));&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;          phototags.Add(new PhotoTag(120, "gigi"));&lt;br /&gt;          phototags.Add(new PhotoTag(1201, "gigi"));&lt;br /&gt;&lt;br /&gt;          phototags.Add(new PhotoTag(1202, "kiki"));&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;          phototags.Add(new PhotoTag(1203, "sasa"));&lt;br /&gt;          phototags.Add(new PhotoTag(1204, "sasa"));&lt;br /&gt;          phototags.Add(new PhotoTag(1205, "sasa"));&lt;br /&gt;&lt;br /&gt;          phototags.Add(new PhotoTag(1206, "nini"));&lt;br /&gt;          phototags.Add(new PhotoTag(1207, "nini"));&lt;br /&gt;          phototags.Add(new PhotoTag(1208, "nini"));&lt;br /&gt;          phototags.Add(new PhotoTag(1209, "nini"));&lt;br /&gt;          phototags.Add(new PhotoTag(1211, "nini"));&lt;br /&gt;          phototags.Add(new PhotoTag(1212, "nini"));&lt;br /&gt;&lt;br /&gt;          //3.5 method&lt;br /&gt;          var feqTags = from n in phototags&lt;br /&gt;                        group n by n.Tag into g&lt;br /&gt;                        orderby g.Count()&lt;br /&gt;                        select new { PhotoName = g.Key , Count = g.Count() };&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;          foreach (var g in feqTags)&lt;br /&gt;          {&lt;br /&gt;             Response.Write(g.PhotoName + " " + g.Count + "&amp;lt;br/&amp;gt;");&lt;br /&gt;          }&lt;br /&gt;&lt;br /&gt;          //2.0 method&lt;br /&gt;        phototags.Sort(new PhotoTagComparer());&lt;br /&gt;&lt;br /&gt;        List&amp;lt;PhotoFeq&amp;gt; photofeqlist = new List&amp;lt;PhotoFeq&amp;gt;();&lt;br /&gt;&lt;br /&gt;        foreach (PhotoTag ptag in phototags)&lt;br /&gt;        {&lt;br /&gt;            if (photofeqlist.Exists(delegate(PhotoFeq pf) { return pf.PhotoName == ptag.Tag; }))&lt;br /&gt;            {&lt;br /&gt;                photofeqlist.Find(delegate(PhotoFeq pq) { return pq.PhotoName == ptag.Tag; }).Count += 1;&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                photofeqlist.Add(new PhotoFeq(ptag.Tag, 1));&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;       //search object by comparison &lt;br /&gt;       int j =  phototags.BinarySearch(new PhotoTag(1202, "kiki"), new PhotoTagComparer());&lt;br /&gt;       Response.Write(phototags[j].PhotoID);&lt;br /&gt;&lt;br /&gt;       //get distinct in list &lt;br /&gt;       List&amp;lt;PhotoTag&amp;gt; distinctPhotoTag = phototags.Distinct(new PhotoTagEqualityComparer()).ToList&amp;lt;PhotoTag&amp;gt;();&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;      }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-8777492097715325032?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/8777492097715325032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=8777492097715325032' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8777492097715325032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8777492097715325032'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/11/blog-post.html' title='The most simple way to group by in a list collection using .NET 2.0  (IEqualityComparer &amp; IComparer)  and .NET 3.5 (Linq) functions'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-8938674078765022812</id><published>2008-08-27T09:51:00.003+08:00</published><updated>2008-08-27T10:24:18.344+08:00</updated><title type='text'>ADO.NET C# common error dealing with inserting NULL value</title><content type='html'>If you are using c# and you are trying to insert null value into a table by using a shorthand something like below&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;param.Add("@abc", strAbc == "" ? null  : strAbc);&lt;/blockquote&gt;&lt;br /&gt;it will not work. And you will got this error such as below:&lt;br /&gt;&lt;blockquote&gt;Parameterized Query '(@Type nvarchar(2),@GroupType nvarchar(1),@Keyword' expects parameter @Type, which was not supplied.&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;To solve this problem you need to do a trick something like this&lt;br /&gt;&lt;blockquote&gt;param.Add("@abc", strAbc == "" ? (object)DBNull.Value : strAbc);&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;change from null to (object)DBNull.Value&lt;br /&gt;&lt;br /&gt;However, in VB.NET you do not need to cast.&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-8938674078765022812?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/8938674078765022812/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=8938674078765022812' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8938674078765022812'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8938674078765022812'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/08/adonet-c-common-error-dealing-with.html' title='ADO.NET C# common error dealing with inserting NULL value'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-1166609657030535947</id><published>2008-08-20T17:46:00.006+08:00</published><updated>2008-08-20T17:53:47.999+08:00</updated><title type='text'>Query data using sql and return results as datatable. Super fast method for ADO.NET!</title><content type='html'>You need to an easy way to query data from the database and fill into the datatable. Here is quick, dirty and secured trick&lt;br /&gt;&lt;br /&gt;The method:&lt;br /&gt;&lt;blockquote&gt;public static DataTable GetTable(string sql, Dictionary&lt;string,&gt; parameters)&lt;br /&gt;{&lt;br /&gt;    DataTable dt = new DataTable("DataTable");&lt;br /&gt;    using (SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["dbConnectionString"].ConnectionString))&lt;br /&gt;    {&lt;br /&gt;        myConnection.Open();&lt;br /&gt;        SqlCommand mySqlCommand = new SqlCommand(sql, myConnection);&lt;br /&gt;&lt;br /&gt;        if (parameters != null)&lt;br /&gt;        {&lt;br /&gt;            foreach (KeyValuePair&lt;string,&gt; p in parameters)&lt;br /&gt;            {&lt;br /&gt;                mySqlCommand.Parameters.AddWithValue(p.Key, p.Value);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        using (SqlDataReader datareader = mySqlCommand.ExecuteReader())&lt;br /&gt;        {&lt;br /&gt;            dt.Load(datareader);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    return dt;&lt;br /&gt;}&lt;/string,&gt;&lt;/string,&gt;&lt;/blockquote&gt;&lt;string,&gt;&lt;string,&gt;&lt;br /&gt;The query:&lt;br /&gt;&lt;blockquote&gt;                Dictionary&lt;string,&gt; sqlParams = new Dictionary&lt;string,&gt;();&lt;br /&gt;             sqlParams.Add("@id", 123);&lt;br /&gt;             devReview = DataHelper.GetTable("select * from sometable where id = @id", sqlParams).DefaultView;&lt;/string,&gt;&lt;/string,&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;/string,&gt;&lt;/string,&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-1166609657030535947?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/1166609657030535947/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=1166609657030535947' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1166609657030535947'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1166609657030535947'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/08/query-data-using-sql-and-return-results.html' title='Query data using sql and return results as datatable. Super fast method for ADO.NET!'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-8279857969570522221</id><published>2008-08-03T22:57:00.004+08:00</published><updated>2008-08-03T23:22:28.262+08:00</updated><title type='text'>Windows Vista Ultimate - bootmgr is compressed</title><content type='html'>Today i've tried to install the windows vista ultimate 64bit to build up a 64bit workstation so that i could test to program that runs 64bit. Guess what? A Mesaage shown to me after i finish my vista installation. It just&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;blockquote&gt;&lt;strong&gt;bootmgr is compressed&lt;/strong&gt;&lt;/blockquote&gt;&lt;/strong&gt;&lt;br /&gt;prompt a dummy message asking me to press ctrl+alt+del. This intruction does help because it just restarts my pc and appear the message next and over again.&lt;br /&gt;&lt;br /&gt;Luckly, i found a solution to this problem. If you encounter this, please use the Vista DVD to boot up your pc and wait until you will see a option that says "Repair your computer" Just click on that.&lt;br /&gt;&lt;br /&gt;Later you will see a button "Load Driver", click click on that and go to "My Computer". After all, just right click =&gt; Properties. And just make sure the drive is not compressed. Unchecked the "Compress drive to save more space" something like (&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;counld't&lt;/span&gt; remember &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;exactly&lt;/span&gt;). for just in case the drive is compressed. And you need to do it for each drive. This process take ages, which cause your &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;pc&lt;/span&gt; seem to be hang for a long period of time but wait don't restart it until it finishes. It will return you to the main menu. Trust me!&lt;br /&gt;&lt;br /&gt;Anyway, I am going to test out my new PC running &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;AMD&lt;/span&gt; 5000+ 2.6&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;Ghz&lt;/span&gt; dual core. Don't be &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_5"&gt;surprise&lt;/span&gt; to see more updates on the tips to make a program that utilizing the multi core &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_6"&gt;processor using PLINQ&lt;/span&gt;!&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-8279857969570522221?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/8279857969570522221/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=8279857969570522221' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8279857969570522221'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8279857969570522221'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/08/windows-vista-ultimate-64bit.html' title='Windows Vista Ultimate - bootmgr is compressed'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-371683099372567697</id><published>2008-06-06T00:04:00.002+08:00</published><updated>2008-06-06T00:12:38.290+08:00</updated><title type='text'>homepage takes too long to load</title><content type='html'>this is the most common problem we face and most often we keep the page small in size and use less images.&lt;br /&gt;&lt;br /&gt;But, what if my homepages a lot of stuffs to get loaded which is a must requirement? The only thing you can do it to Ajax it! you need to &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_0"&gt;separate&lt;/span&gt; a page into several html block of codes and load it &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;separately&lt;/span&gt;. &lt;br /&gt;&lt;br /&gt;What i did is using the ASP.NET AJAX  update panel to warp the html code and use timer to load it later. I think this is not really a correct why but it is better then doing nothing.&lt;br /&gt;&lt;br /&gt;What else i can do? do you have any solution suggest for me?&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-371683099372567697?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/371683099372567697/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=371683099372567697' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/371683099372567697'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/371683099372567697'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/06/homepage-takes-too-long-to-load.html' title='homepage takes too long to load'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-7499883447579644362</id><published>2008-06-01T03:48:00.002+08:00</published><updated>2008-06-01T03:51:01.423+08:00</updated><title type='text'>A simple way to get a content from an URL over the internet</title><content type='html'>sometimes we want to get the content over the internet and process the content, here is a super simple method that i discovered.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;using System.Net;&lt;br /&gt;using System.IO;&lt;br /&gt;&lt;br /&gt;public static string GetWebContentString(string&lt;br /&gt;url)&lt;br /&gt;{&lt;br /&gt;HttpWebRequest httpReq =&lt;br /&gt;(HttpWebRequest)WebRequest.Create(url);&lt;br /&gt;HttpWebResponse httpRes =&lt;br /&gt;(HttpWebResponse)httpReq.GetResponse();&lt;br /&gt;Stream fs =&lt;br /&gt;httpRes.GetResponseStream();&lt;br /&gt;StreamReader sr = new&lt;br /&gt;StreamReader(fs);&lt;br /&gt;return sr.ReadToEnd();&lt;br /&gt;}&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-7499883447579644362?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/7499883447579644362/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=7499883447579644362' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/7499883447579644362'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/7499883447579644362'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/06/simple-way-to-get-content-from-url-over.html' title='A simple way to get a content from an URL over the internet'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-4127072654792021061</id><published>2008-05-26T11:36:00.004+08:00</published><updated>2008-05-26T11:41:45.085+08:00</updated><title type='text'>How to call store procedure using .NET</title><content type='html'>&lt;p&gt;This is how I call store procedure using .NET having passing input value and return by output value&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;public static int GetSearchCount(string country)&lt;br /&gt;{&lt;br /&gt;int count = 0;&lt;br /&gt;using (SqlConnection conn = new&lt;br /&gt;SqlConnection(ConfigurationManager.ConnectionStrings["dbnamestr"].ConnectionString))&lt;br /&gt;{&lt;br /&gt;conn.Open();&lt;br /&gt;SqlCommand objCmd = new&lt;br /&gt;SqlCommand("sp_SearchCount", conn);&lt;br /&gt;objCmd.CommandType =&lt;br /&gt;CommandType.StoredProcedure;&lt;br /&gt;SqlParameter paramTotal = new&lt;br /&gt;SqlParameter("@Total", SqlDbType.Int);&lt;br /&gt;paramTotal.Direction =&lt;br /&gt;ParameterDirection.ReturnValue;&lt;br /&gt;objCmd.Parameters.Add(paramTotal);&lt;br /&gt;objCmd.Parameters.AddWithValue("@Country", country);&lt;br /&gt;objCmd.ExecuteScalar();&lt;br /&gt;count = (int)paramTotal.Value;&lt;br /&gt;}&lt;br /&gt;return&lt;br /&gt;count;&lt;br /&gt;}&lt;/p&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-4127072654792021061?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/4127072654792021061/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=4127072654792021061' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/4127072654792021061'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/4127072654792021061'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/05/how-to-call-store-procedure-using-net.html' title='How to call store procedure using .NET'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-3246481700187577795</id><published>2008-05-26T01:43:00.010+08:00</published><updated>2008-05-26T02:30:01.068+08:00</updated><title type='text'>Using stored procedure and inline sql in your application</title><content type='html'>Programmers always ask which is better and which should they choose. Is store procedure has better performance or &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;inline&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;sql&lt;/span&gt; with &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;ORM&lt;/span&gt; is better at gaining productivity? Well depends who you are, what applications you develop, the answers are very different from person to person.&lt;br /&gt;&lt;br /&gt;I use store procedure when I knew the query is complicated which requires multiple joins tables and I knew that i will query it very &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_3"&gt;often&lt;/span&gt;, hence using store procedure will make a significant different in &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_4"&gt;performance&lt;/span&gt; gains. For example, you run the optimized &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;precompile&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;sql&lt;/span&gt; statements. you delegate the computation of data within the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;sql&lt;/span&gt; server and minimize &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;sql&lt;/span&gt; query back and forth and also you make your query pretty secured by using SP&lt;br /&gt;&lt;br /&gt;Meanwhile using &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;inline&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;sql&lt;/span&gt; is not a good practise unless you are using Object Relational Mapping (&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;ORM&lt;/span&gt;) tools to generate those &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;inline&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;sql&lt;/span&gt; for you and all you need is to use the objects created. It is the fastest and simple way to query and manipulate the database with the power of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;OOP&lt;/span&gt;. If you are using &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;inline&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;sql&lt;/span&gt; as a short cut way to query data, you gotta &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_17"&gt;becareful&lt;/span&gt; and takes various precautions steps to overcome &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;sql&lt;/span&gt; injection attacks. Sometimes a string of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_19"&gt;sql&lt;/span&gt; statement hard coded in your program can be a &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_20"&gt;maintenance&lt;/span&gt; problem because it is quite &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_21"&gt;difficult&lt;/span&gt; to test the validity of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_22"&gt;sql&lt;/span&gt; statement.&lt;br /&gt;&lt;br /&gt;FYI, I use SP for complicated queries. I use &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_23"&gt;inline&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_24"&gt;sql&lt;/span&gt; (usually generated by &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_25"&gt;ORM&lt;/span&gt;) for simple CRUD to direct display data that do not involve calculations. Query using &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_26"&gt;ORM&lt;/span&gt; can be more complicated and requires more resources than using the SP, so just keep things simple and &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_27"&gt;understandable&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;I am not bias to one or another, I just want to point out that by using the right technology in your application will have a greater benefit of sticking to one technology. Tool is created for making us easier, if you found that the tool is great, just use it, otherwise get another alternative.&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-3246481700187577795?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/3246481700187577795/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=3246481700187577795' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3246481700187577795'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3246481700187577795'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/05/using-stored-procedure-and-inline-sql.html' title='Using stored procedure and inline sql in your application'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-3318799756029444463</id><published>2008-04-03T10:31:00.003+08:00</published><updated>2008-04-03T10:36:09.655+08:00</updated><title type='text'>Upload image to web server using webservice  .NET</title><content type='html'>To transfer a file to the web server, it is not necessary to use FTP to upload. You can use webservice to do so. Here is the trick:&lt;br /&gt;&lt;br /&gt;public string CreateFileToBase64String(string path)&lt;br /&gt;{&lt;br /&gt;Stream fs = new FileStream(path, FileMode.Open);&lt;br /&gt;MemoryStream ms = new MemoryStream();&lt;br /&gt;const int size = 4096;&lt;br /&gt;byte[] bytes = new byte[4096];&lt;br /&gt;int numBytes;&lt;br /&gt;while ((numBytes = fs.Read(bytes, 0, size)) &gt; 0)&lt;br /&gt;ms.Write(bytes, 0, numBytes);&lt;br /&gt;ms.Close();&lt;br /&gt;fs.Close();&lt;br /&gt;return Convert.ToBase64String(ms.GetBuffer());&lt;br /&gt;}&lt;br /&gt;public void CreateFileFromBase64String(string imageData, string path)&lt;br /&gt;{&lt;br /&gt;MemoryStream msf = new MemoryStream(Convert.FromBase64String(imageData));&lt;br /&gt;Stream stem = new FileStream(path, FileMode.Create);&lt;br /&gt;msf.WriteTo(stem);&lt;br /&gt;msf.Close();&lt;br /&gt;stem.Close();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;you see things is so simple.&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-3318799756029444463?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/3318799756029444463/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=3318799756029444463' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3318799756029444463'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3318799756029444463'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/04/upload-image-to-web-server-using.html' title='Upload image to web server using webservice  .NET'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-9149881464509970112</id><published>2008-04-03T10:01:00.002+08:00</published><updated>2008-04-03T10:04:27.339+08:00</updated><title type='text'>How to get web content from the web .NET</title><content type='html'>Sometimes I need to download  the html content from the internet, therefore this method is very useful.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public static void GetWebContent(string url, string saveToPath)&lt;br /&gt;{&lt;br /&gt;if (IsValidUrl(url))&lt;br /&gt;{&lt;br /&gt;HttpWebRequest httpReq = (HttpWebRequest)WebRequest.Create(url);&lt;br /&gt;HttpWebResponse httpRes = (HttpWebResponse)httpReq.GetResponse();&lt;br /&gt;Stream fs = httpRes.GetResponseStream();&lt;br /&gt;FileStream fss = new FileStream(saveToPath, FileMode.Create);&lt;br /&gt;const int size = 4096;&lt;br /&gt;byte[] bytes = new byte[4096];&lt;br /&gt;int numBytes;&lt;br /&gt;while ((numBytes = fs.Read(bytes, 0, size)) &gt; 0)&lt;br /&gt;fss.Write(bytes, 0, numBytes);&lt;br /&gt;fss.Close();&lt;br /&gt;}&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-9149881464509970112?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/9149881464509970112/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=9149881464509970112' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/9149881464509970112'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/9149881464509970112'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/04/how-to-get-web-content-from-web-net.html' title='How to get web content from the web .NET'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-6233789529484592122</id><published>2008-04-03T09:59:00.000+08:00</published><updated>2008-04-03T10:00:35.089+08:00</updated><title type='text'>Find the image height and width using .NET</title><content type='html'>See as simple as this:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;System.Drawing.Imaging.BitmapData bit = new&lt;br /&gt;System.Drawing.Imaging.BitmapData();&lt;br /&gt;int height = bit.Height;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-6233789529484592122?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/6233789529484592122/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=6233789529484592122' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6233789529484592122'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6233789529484592122'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/04/find-image-height-and-width-using-net.html' title='Find the image height and width using .NET'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-3374889454373005480</id><published>2008-03-26T01:03:00.002+08:00</published><updated>2008-03-26T01:07:26.157+08:00</updated><title type='text'>ConnectionStrings for SQL Server 2005</title><content type='html'>ConnectionString for sql server 2005 look like this. Please remember dude...&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;*connectionStrings&gt;&lt;br /&gt;&lt;*add name="lala"&lt;br /&gt;connectionString="server=user\sqlexpress;integrated&lt;br /&gt;security=true;database=test"/&gt;&lt;br /&gt;&lt;*/connectionStrings&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-3374889454373005480?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/3374889454373005480/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=3374889454373005480' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3374889454373005480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3374889454373005480'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/03/connectionstrings-for-sql-server-2005.html' title='ConnectionStrings for SQL Server 2005'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-2622461137550327586</id><published>2008-03-26T00:53:00.005+08:00</published><updated>2008-03-26T01:10:34.129+08:00</updated><title type='text'>How to create xml document from database ado.net</title><content type='html'>I hate to code with xml because i always forgotten the methods, therefore i blog it here so that i could help someone like me. :)&lt;br /&gt;&lt;br /&gt;The 0utput lala.xml&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;*Library&gt;&lt;br /&gt;&lt;*Book id="1"&gt;&lt;br /&gt;&lt;*Name&gt;Programming&lt;/name&gt;&lt;br /&gt;&lt;*Author&gt;L.L Yee&lt;/author&gt;&lt;br /&gt;&lt;/book&gt;&lt;*Book id="2"&gt;&lt;br /&gt;&lt;*Name&gt;Mathematics&lt;/name&gt;&lt;br /&gt;&lt;*Author&gt;Jason Lee&lt;/author&gt;&lt;br /&gt;&lt;/book&gt;&lt;/library&gt;&lt;*/Library&gt;&lt;br /&gt;&lt;/blockquote&gt;You need this code:&lt;br /&gt;&lt;blockquote&gt;using System;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;using&lt;br /&gt;System.Text;&lt;br /&gt;using System.Data.SqlClient;&lt;br /&gt;using&lt;br /&gt;System.Configuration;&lt;br /&gt;using System.Xml;&lt;br /&gt;namespace TobyXML&lt;br /&gt;{&lt;br /&gt;class&lt;br /&gt;Program&lt;br /&gt;{&lt;br /&gt;static void Main(string[]&lt;br /&gt;args)&lt;br /&gt;{&lt;br /&gt;ReadCustomerFromDB();&lt;br /&gt;}&lt;br /&gt;public static void&lt;br /&gt;ReadCustomerFromDB()&lt;br /&gt;{&lt;br /&gt;string sql = "Select * from library";&lt;br /&gt;string&lt;br /&gt;output = "";&lt;br /&gt;using (SqlConnection myConnection =&lt;br /&gt;new&lt;br /&gt;SqlConnection(ConfigurationManager.ConnectionStrings["lala"].ConnectionString))&lt;br /&gt;{&lt;br /&gt;myConnection.Open();&lt;br /&gt;SqlCommand&lt;br /&gt;mySqlCommand = new SqlCommand(sql, myConnection);&lt;br /&gt;SqlDataReader datareader =&lt;br /&gt;mySqlCommand.ExecuteReader();&lt;br /&gt;XmlDocument xmlDoc = new&lt;br /&gt;XmlDocument();&lt;br /&gt;xmlDoc.CreateXmlDeclaration("1.0", "UTF-8", null);&lt;br /&gt;XmlNode&lt;br /&gt;nodeLibrary =&lt;br /&gt;xmlDoc.CreateElement("Library");&lt;br /&gt;xmlDoc.AppendChild(nodeLibrary);&lt;br /&gt;while(datareader.Read())&lt;br /&gt;{&lt;br /&gt;XmlNode&lt;br /&gt;nodeBook = xmlDoc.CreateElement("Book");&lt;br /&gt;XmlAttribute attId =&lt;br /&gt;xmlDoc.CreateAttribute("id");&lt;br /&gt;attId.Value =&lt;br /&gt;datareader["bookid"].ToString();&lt;br /&gt;nodeBook.Attributes.Append(attId);&lt;br /&gt;XmlNode&lt;br /&gt;nodeName =&lt;br /&gt;xmlDoc.CreateElement("Name");&lt;br /&gt;nodeName.AppendChild(xmlDoc.CreateTextNode(datareader["bookName"].ToString()));&lt;br /&gt;nodeBook.AppendChild(nodeName);&lt;br /&gt;XmlNode&lt;br /&gt;nodeAuthor =&lt;br /&gt;xmlDoc.CreateElement("Author");&lt;br /&gt;nodeBook.AppendChild(nodeAuthor);&lt;br /&gt;nodeAuthor.AppendChild(xmlDoc.CreateTextNode(datareader["author"].ToString()));&lt;br /&gt;nodeLibrary.AppendChild(nodeBook);&lt;br /&gt;}&lt;br /&gt;datareader.Close();&lt;br /&gt;xmlDoc.Save(@"c:\lala.xml");&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-2622461137550327586?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/2622461137550327586/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=2622461137550327586' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/2622461137550327586'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/2622461137550327586'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/03/how-to-create-xml-document-from.html' title='How to create xml document from database ado.net'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-4380643389349873351</id><published>2008-03-18T18:49:00.003+08:00</published><updated>2008-03-18T18:52:34.787+08:00</updated><title type='text'>How to get HTML tag with regex?</title><content type='html'>Regex this is the best one!&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;/?\W+((\S+\W+(\S*=\S*(?:".*?"'.*?'[^'"&gt;&lt;*/?\w+((\s+\w+(\s*=\s*(?:".*?"'.*?'[^'"&gt;\s]+))?)+\s*\s*)/?&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;please ignore the * at the &lt;*&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-4380643389349873351?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/4380643389349873351/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=4380643389349873351' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/4380643389349873351'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/4380643389349873351'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/03/how-to-get-html-tag-with-regex.html' title='How to get HTML tag with regex?'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-8512339796842151829</id><published>2008-03-18T18:43:00.002+08:00</published><updated>2008-03-18T18:46:50.777+08:00</updated><title type='text'>Get data from the database stright away! .NET</title><content type='html'>Sometimes you want the most strightforward way to get data from the database without going through the N-tiers stuffs.&lt;br /&gt;&lt;br /&gt;This technique have advantages and disadvantages,&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Advantage:&lt;br /&gt;&lt;/strong&gt;The fastest data access beside store procedures.&lt;br /&gt;Simple and strighforward.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Disadvantage:&lt;/strong&gt;&lt;br /&gt;Not strongly typed,&lt;br /&gt;Possible of memory leak if not code propertly&lt;br /&gt;Things get complicated if involve insert record or large table which have many columns.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;public string ReadCustomerFromDB()&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;string sql = "Select&lt;br /&gt;name, phone, age from Customers where customerid =&lt;br /&gt;@customerId";&lt;br /&gt;&lt;br /&gt;string output = "";&lt;br /&gt;&lt;br /&gt;using (SqlConnection myConnection = new&lt;br /&gt;SqlConnection(ConfigurationManager.ConnectionStrings["Northwind"].ConnectionString))&lt;br /&gt;{&lt;br /&gt;myConnection.Open();&lt;br /&gt;&lt;br /&gt;SqlCommand mySqlCommand = new SqlCommand(sql,&lt;br /&gt;myConnection);&lt;br /&gt;&lt;br /&gt;mySqlCommand.Parameters.AddWithValue("@customerId", 123456);&lt;br /&gt;&lt;br /&gt;SqlDataReader datareader =&lt;br /&gt;mySqlCommand.ExecuteReader();&lt;br /&gt;&lt;br /&gt;while&lt;br /&gt;(datareader.Read())&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;Output +=&lt;br /&gt;datareader["name"];&lt;br /&gt;&lt;br /&gt;Output +=&lt;br /&gt;datareader["age"];&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;datareader.Close();&lt;br /&gt;}&lt;br /&gt;return output;&lt;br /&gt;}&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-8512339796842151829?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/8512339796842151829/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=8512339796842151829' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8512339796842151829'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8512339796842151829'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/03/get-data-from-database-stright-away-net.html' title='Get data from the database stright away! .NET'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-1764398396453040816</id><published>2008-03-18T18:36:00.005+08:00</published><updated>2008-03-18T21:54:57.174+08:00</updated><title type='text'>Format currency using Globalization .NET</title><content type='html'>There are some elegant way to format the currency such as&lt;br /&gt;&lt;br /&gt;String.Format(“{0:c}”,100000”)&lt;br /&gt;&lt;br /&gt;The output will be RM100,000.00 if your web.config file set as&lt;br /&gt;&lt;br /&gt;&lt;system.web&gt;&lt;*system.web*&gt;&lt;br /&gt;&lt;*globalization uiCulture="en" culture="en-MY" /*&gt;&lt;br /&gt;&lt;br /&gt;However this will not throw you an error if you are using windows vista.  such as&lt;br /&gt;&lt;/system.web&gt;&lt;blockquote&gt;The &lt;globalization&gt; tag contains an invalid value for the 'culture' attribute. &lt;/globalization&gt;&lt;/blockquote&gt; if there is an error please refer to &lt;system.web&gt;&lt;a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemGlobalizationCultureInfoClassTopic.asp"&gt;http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemGlobalizationCultureInfoClassTopic.asp&lt;/a&gt; to find out your own culture code.&lt;br /&gt;&lt;br /&gt;in this case i should change it to&lt;br /&gt;&lt;br /&gt;&lt;*globalization uiCulture="ms" culture="ms-MY" /*&gt;&lt;br /&gt;&lt;br /&gt;....&lt;br /&gt;If you set the culture to “en-US” then the output will changed to&lt;br /&gt;$100,000.00&lt;br /&gt;You can check your currency symbol by using this code&lt;br /&gt;&lt;br /&gt;System.Globalization.RegionInfo myRI2 = new System.Globalization.RegionInfo(new CultureInfo("en-my", false).LCID);&lt;br /&gt;Console.Write(myRI2.CurrencySymbol);&lt;br /&gt;&lt;br /&gt;For more information on setting the culture for specific to your country, please refer the code from this website:&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/system.globalization.regioninfo.aspx"&gt;http://msdn2.microsoft.com/en-us/library/system.globalization.regioninfo.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Alternatively, you can specify use string. Format (“{0:$#,##0.##}”,50000), you can replace the ‘$’ whaterver you like. however this is not a good practice.&lt;/system.web&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-1764398396453040816?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/1764398396453040816/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=1764398396453040816' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1764398396453040816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1764398396453040816'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/03/format-currency-c.html' title='Format currency using Globalization .NET'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-2812188478006344715</id><published>2008-03-15T22:26:00.004+08:00</published><updated>2008-03-15T22:42:59.217+08:00</updated><title type='text'>How to customize community server 2007?</title><content type='html'>&lt;p&gt;Ever think of customize community server 2007? Yes, you can. However to teach you the whole thing will be long story, therefore keep thing simple. Just follow this guideline and try it yourself. Here the steps:&lt;br /&gt;&lt;br /&gt;1. Download the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SDK&lt;/span&gt; cs2007.1 from &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;communityserver&lt;/span&gt;.org&lt;br /&gt;&lt;br /&gt;2. Refer to short and tested step from doc.communityserver.org/wiki/page.aspx/399/how-to-create-new-themes/ (please &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_2"&gt;follow&lt;/span&gt; the step from 1,2 and 3 only)&lt;br /&gt;&lt;br /&gt;3. Install your cs2007.1 database&lt;br /&gt;&lt;br /&gt;&lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_3"&gt;4. Compile&lt;/span&gt; and Run the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;SDK&lt;/span&gt; source code from VS 2005, note you have to do some setting in the property page such as &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_5"&gt;running&lt;/span&gt; it from dynamic port rather than &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;localhost&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;ISS&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;5 .Copy the created theme from step 2 and paste the dir into the cs theme directory.&lt;br /&gt;&lt;br /&gt;6. refresh and include the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;dir&lt;/span&gt;. Edit the pasted &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;dir&lt;/span&gt; only.&lt;br /&gt;&lt;br /&gt;7. try to edit the master.master such as remove the logo and run it and feel the different.&lt;br /&gt;&lt;br /&gt;Good luck, i have tested it and it works!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-2812188478006344715?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/2812188478006344715/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=2812188478006344715' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/2812188478006344715'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/2812188478006344715'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/03/how-to-customize-community-server-2007.html' title='How to customize community server 2007?'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-8015597259273511697</id><published>2008-03-02T09:00:00.007+08:00</published><updated>2008-03-02T10:08:47.235+08:00</updated><title type='text'>good design determine programmer productivity that create reliable system</title><content type='html'>An enterprise system is complex and it has to be able to handle day to day business processes and activities. The reliability of the system is so much dependent on how the system was designed and developed by the programmer. Programmer need to code well and able to create a system with the most reliable code. However, in practical to be able to achieve a highly reliable system is very costly to the organization. The reason is because a lot of testing need to be done to ensure that every source code is validated. Microsoft particuallary has been trying to improve the reliability of Windows by patches and patches after the final release. Why need to do in that way? Why not to produce a system which is 100% free of bugs? The answer of this question is too simple to say that it is very time consuming and costly to examine every possiblility of the failure in the system. We have no choice but keep complaining about the reliability of the system and luckly there are software developers who are keeps fixing it. This is how the software industry works. If some one were to change it, it is the last breakthrough of information technology.&lt;br /&gt;&lt;br /&gt;To start to design a stable and reliable system, 3 things need to keep in mind at first. 3 rules: guidelines need to be followed, always keep things simple and last but not lease always keeps design a good database structure by having 3rd NF.&lt;br /&gt;&lt;br /&gt;Guidelines are the findings and experinces of the system designer in which makes the best to design the system. It also covers the rules that draw the requirements. Guidelines are important because the things to be followed and the things to be avoided during the system development cycle, guideline are very depending on each organization, therefore you set your own rules.&lt;br /&gt;&lt;br /&gt;KISS, keep it simple, the secret that always work in every situation in our life. Keep it simple does not means to ignore requirements but to avoid doing things in a hard way. We need to be smart in finding alternative which is elegant and simple enough to &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_0"&gt;our self&lt;/span&gt; to accomplish thing. For example, i can save time by having alble to find 5Min's solution using Google. Smart isn't it?&lt;br /&gt;&lt;br /&gt;Database design is very very important. We hardly see an enterprise system without using database. A large system particularly are very used to having a database server to serve everyday data intensive client. Moreover, an efficient and high performance database system is critical to the success of the system as a whole. Therefore database design is extremely critical to determine the reliability of the system and the productivity of the programmers. Why? The reasons are, programmer need to code less and perhaps it is easier to code if the database design is in properly designed. I once experience to do develop a system in which the database design is not in the proper way. In this case i had to write additional code which is not necessary to make it work and i had to spend much my time to check the data to ensure it was consistent across the system. Why we need to check by us since a relational database system is so good in enforcing constrain in every database manipulation that keep data integrity. Therefore a good database design must have this 3 things, 3rd NF, one primary key for each table and have relational constrain.&lt;br /&gt;&lt;br /&gt;A lot of problem will happen during the system development if the initial system design is not good enough. The worst thing is that the database design is in bad shape, i wonder how many debugging time has been wasted during the system development.&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-8015597259273511697?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/8015597259273511697/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=8015597259273511697' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8015597259273511697'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8015597259273511697'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/03/good-design-determine-programmer.html' title='good design determine programmer productivity that create reliable system'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-4905895346517604831</id><published>2008-02-15T19:22:00.005+08:00</published><updated>2008-03-15T22:20:40.220+08:00</updated><title type='text'>check if url is valid and accessible .NET</title><content type='html'>This is a common problem for most of ASP.NET developer when we try to check if the url is valid or not. Here is a tip for you. :)&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;public static bool IsValidUrl(string url)&lt;br /&gt;{&lt;br /&gt;HttpWebRequest httpReq =&lt;br /&gt;(HttpWebRequest)WebRequest.Create(url);&lt;br /&gt;httpReq.AllowAutoRedirect =&lt;br /&gt;false;&lt;br /&gt;httpReq.Method = "HEAD";&lt;br /&gt;httpReq.KeepAlive =&lt;br /&gt;false;&lt;br /&gt;httpReq.Timeout = 2000;&lt;br /&gt;HttpWebResponse httpRes;&lt;br /&gt;bool exists =&lt;br /&gt;false;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;httpRes = (HttpWebResponse)httpReq.GetResponse();&lt;br /&gt;if&lt;br /&gt;(httpRes.StatusCode == HttpStatusCode.OK)&lt;br /&gt;{&lt;br /&gt;exists =&lt;br /&gt;true;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;catch (Exception ex)&lt;br /&gt;{&lt;br /&gt;}&lt;br /&gt;return exists;&lt;br /&gt;}&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-4905895346517604831?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/4905895346517604831/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=4905895346517604831' title='25 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/4905895346517604831'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/4905895346517604831'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/02/check-if-url-is-valid-and-accessible.html' title='check if url is valid and accessible .NET'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>25</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-6860955184052085867</id><published>2008-02-10T02:24:00.004+08:00</published><updated>2008-03-15T22:21:39.504+08:00</updated><title type='text'>Google map program using .net</title><content type='html'>You can create a custom google map by using Google Maps Api which example found in &lt;a href="http://code.google.com/apis/maps/documentation/examples/"&gt;http://code.google.com/apis/maps/documentation/examples/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;However, those example is written in java script and it is not so stright forward to be used in ASP.NET code.... Anyway, to work with java script code with ASP.NET keep these in mind&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;let txtLongitude is a control which can be used inside javascript, u can called the txtLongitude by&lt;br /&gt;""&lt;br /&gt;&lt;p&gt;txtLatitude.ClientID is used because is require if you are using ASP.NET master pages.&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-6860955184052085867?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/6860955184052085867/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=6860955184052085867' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6860955184052085867'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6860955184052085867'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/02/google-map-program-using-net.html' title='Google map program using .net'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-108412792985825741</id><published>2008-02-07T18:38:00.000+08:00</published><updated>2008-02-07T21:49:33.990+08:00</updated><title type='text'>confusing file path for web developer .net</title><content type='html'>Are you one of the developer always confuse whith this kind of path e "games/alien.jpg" or "../games/alien.jpg" or "/games/alien.jpg" ? Even if you know the meaning, i am sure you still have problem of this because the path is constructed as it depends how the caller is located. Seem to be over complicated here. :)&lt;br /&gt;&lt;br /&gt;I am one of the developer that alwasys confuse with file path that looks like &lt;*img src=".../love/app/basic.jpg" /*&gt;". i really do not like because it can be problematic especially if you are ASP.NET developer that uses master pages across the pages.&lt;br /&gt;&lt;br /&gt;if you are one of those guy that always experince broken links, I have an elegant solution to this problem.&lt;br /&gt;&lt;br /&gt;Given a virtual directory named site, which can be accessibled as http://localhost/site and you have a file which located at http://localhost/site/games/alien.jpg&lt;br /&gt;&lt;br /&gt;to effectively locate the alien.jpg, you got to use this&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;ResolveUrl("~/games/alien.jpg")&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/blockquote&gt;In this way, you won't be confused how the file is located. ~ represents the parent virtual path.&lt;br /&gt;&lt;br /&gt;Ok, if you wish to upload the file to the server using the ResolveUrl don't give you the real path... in this case, replace the ResolveUrl method to MapPath method.&lt;br /&gt;&lt;br /&gt;e.g:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;MapPath("~/games/alien.jpg"). The file will be uploaded to the location of '~'.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;Got it?&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-108412792985825741?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/108412792985825741/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=108412792985825741' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/108412792985825741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/108412792985825741'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/02/confusing-file-path-for-web-developer.html' title='confusing file path for web developer .net'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-4253102058113759170</id><published>2008-02-07T18:07:00.000+08:00</published><updated>2008-02-07T18:37:43.989+08:00</updated><title type='text'>Different between web application and windows application</title><content type='html'>Obviously, by the name itself web application is built for web and can be viewed by internet browser. Whereas windows application is a program that runs under windows. People choose web application because web app can relatively easy to deloy and once deloy it is readily widely available to anywhere and anytime. The design itself is distrbuted and programmers do not need to worry so much about complicated deloyment consideration. Sometimes, programmers choose to write in windows application is because somethings cannot be possibly done by having web application. For example, extensive use of processing power such as graphic randering program, e.g 3D designer program. A special program that deals with hardware such as printer driver, have to be written in windows application. Usually "designer program" oftens built as windows application. Whereas business application that requires multi users such as inventory system is oftenly built as web application.&lt;br /&gt;&lt;br /&gt;If you are unsure of which is the best choice to go with, please follow my guildline, -&lt;br /&gt;&lt;br /&gt;first think of if the program can be easily built and deployed by having web application, if the answer meet these criteria, then go for web application.&lt;br /&gt;&lt;br /&gt;Otherwise go for windows application. or perhaps a combination of web and windows which known as smart application which combinethe best of both.&lt;br /&gt;&lt;br /&gt;As my own preference, i like web application because it is relatively easy to manage the communication between modules and because it support css which makes styling much easier and faster.&lt;br /&gt;&lt;br /&gt;I had been building windows application by using the composite application block CAB... The framework is cool but deployment can be much hassle because you have to worry the security issues ( you do not want your files be hacked by the user because he got your files).&lt;br /&gt;&lt;br /&gt;Last but not least, go for web if possible for business realated appplication.&lt;br /&gt;&lt;br /&gt;Post me a comment if you are disaggree with me :)&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-4253102058113759170?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/4253102058113759170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=4253102058113759170' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/4253102058113759170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/4253102058113759170'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/02/different-between-web-application-and.html' title='Different between web application and windows application'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-8893084004945908082</id><published>2008-02-04T11:10:00.000+08:00</published><updated>2008-02-04T11:13:08.802+08:00</updated><title type='text'>Split camel casing using regex .NET</title><content type='html'>ever wonder any better apporoch to convert "BeMyLover" to "Be My Lover"? Here the function in C#.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;span style="font-family:courier new;font-size:85%;"&gt;private string SplitCamelCasing(string input)&lt;br /&gt;{&lt;br /&gt;string output =&lt;br /&gt;"";&lt;br /&gt;return output =&lt;br /&gt;System.Text.RegularExpressions.Regex.Replace(&lt;br /&gt;input,&lt;br /&gt;"([A-Z])",&lt;br /&gt;"&lt;br /&gt;$1",&lt;br /&gt;System.Text.RegularExpressions.RegexOptions.Compiled).Trim();&lt;br /&gt;}&lt;/span&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-8893084004945908082?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/8893084004945908082/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=8893084004945908082' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8893084004945908082'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8893084004945908082'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/02/split-camel-casing-using-regex-net.html' title='Split camel casing using regex .NET'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-4944638624593166008</id><published>2008-02-03T19:40:00.000+08:00</published><updated>2008-02-03T20:02:46.647+08:00</updated><title type='text'>An easy way to manipulate database using Subsonic</title><content type='html'>I had been using various tools to manipulate database. The only tool that i find very simple so far .net web development is subsonic. &lt;a href="http://www.subsonicproject.com/"&gt;http://www.subsonicproject.com/&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Subsonic is really powerful to CRUD your database. SQL is not nessary and it is all object oriented. The best object realtional mapper for .net 2.0&lt;br /&gt;&lt;br /&gt;Give a try :)&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-4944638624593166008?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/4944638624593166008/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=4944638624593166008' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/4944638624593166008'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/4944638624593166008'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/02/easy-way-to-manipulate-database-using.html' title='An easy way to manipulate database using Subsonic'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-3371731295154949247</id><published>2008-01-17T21:52:00.000+08:00</published><updated>2008-01-17T22:14:03.375+08:00</updated><title type='text'>dropdownlist postback problem ASP.NET</title><content type='html'>have you encounter that ASP.NET dropdownlist control have a problem of persistent the data in the items list after you had make a postback? The problem is actually you have disabled the EnableViewState. Therefore the control will not persist any data after an postback. To enable it back, just - &lt;strong&gt;EnableViewState="true".&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;This is a super tips, because you might disabled it, in this case turn it on!&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-3371731295154949247?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/3371731295154949247/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=3371731295154949247' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3371731295154949247'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3371731295154949247'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2008/01/dropdownlist-postback-problem-aspnet.html' title='dropdownlist postback problem ASP.NET'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-2381462411945951819</id><published>2007-11-29T17:56:00.000+08:00</published><updated>2007-11-29T18:04:56.788+08:00</updated><title type='text'>Export table and data using SqlBulkCopy</title><content type='html'>i have one database to be exported and i try to use the import and export features from the sqlserver 2005. However i enconter one problem which is the primary key of the enabled indentity insert is all mess up after the importing to my new database. I just found and tested a utility and it works quite well.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;method to export&lt;br /&gt;&lt;br /&gt;generate a sql script with having the sql schema&lt;br /&gt;use this program  simple sql bulk copy downloadable from &lt;a href="http://projects.c3o.com/files/default.aspx"&gt;http://projects.c3o.com/files/default.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;ref:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx"&gt;http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-2381462411945951819?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/2381462411945951819/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=2381462411945951819' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/2381462411945951819'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/2381462411945951819'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/11/export-table-and-data-using-sqlbulkcopy.html' title='Export table and data using SqlBulkCopy'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-4143248464424581521</id><published>2007-10-14T22:54:00.000+08:00</published><updated>2007-10-14T23:36:04.027+08:00</updated><title type='text'>What programming language is the best?</title><content type='html'>Every programmer will ask this very common question What programming language is the best? C#? Java? C++? C? Perl? or ...??? In order to answer this question, you have to ask yourself what programming language you like most. Next, think about does the language &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_0"&gt;powerful&lt;/span&gt; enough to be used in the type of application your are doing. Finally, some language is designed specifically and targeted to certain type of application. If the type of application you are doing match the language you are using, development &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;productivity&lt;/span&gt; will improve and it is more easier to program. Likewise, you will get crazy in the middle of development if you choose the wrong language. For me, I want simple and &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_2"&gt;powerfully&lt;/span&gt; high &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_3"&gt;level&lt;/span&gt; language... I believe C# and it is my only choice.&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-4143248464424581521?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/4143248464424581521/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=4143248464424581521' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/4143248464424581521'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/4143248464424581521'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/10/what-programming-language-is-best.html' title='What programming language is the best?'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-2131534190136739604</id><published>2007-08-14T00:10:00.000+08:00</published><updated>2007-08-14T00:16:54.604+08:00</updated><title type='text'>Create a serch engine with linq</title><content type='html'>I always amazed by how search engine works and it seem so wonderful that google has created the most amazing search engine to put infomation on our finger tips. Would you like to create a simple search engine? Here you can do it pretty easy with Linq.&lt;br /&gt;&lt;br /&gt;The techniques needed in constructing search engine are regular expression, Linq, Generic, C#, sort and ranking algorithm.&lt;br /&gt;&lt;br /&gt;Here is the code:&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;using&lt;br /&gt;System.Text;&lt;br /&gt;using System.Text.RegularExpressions;&lt;br /&gt;using&lt;br /&gt;System.Query;&lt;br /&gt;namespace search&lt;br /&gt;{&lt;br /&gt;public class Search&lt;br /&gt;{&lt;br /&gt;private&lt;br /&gt;List&lt;searchrelevance&gt; _SearchRelevance = new&lt;br /&gt;List&lt;searchrelevance&gt;();&lt;br /&gt;public List&lt;searchrelevance&gt;&lt;br /&gt;SearchRelevence&lt;br /&gt;{&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;return&lt;br /&gt;_SearchRelevance;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;private List&lt;searchrelevance&gt; _Results =&lt;br /&gt;new List&lt;searchrelevance&gt;();&lt;br /&gt;public List&lt;searchrelevance&gt;&lt;br /&gt;Results&lt;br /&gt;{&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;return&lt;br /&gt;_Results;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public Search(string input, string[]&lt;br /&gt;text)&lt;br /&gt;{&lt;br /&gt;for (int i = 0; i &lt; text.Length; i++)&lt;br /&gt;{&lt;br /&gt;SearchRelevance&lt;br /&gt;sr = new SearchRelevance(input,&lt;br /&gt;text[i]);&lt;br /&gt;sr.Calculate();&lt;br /&gt;_SearchRelevance.Add(sr);&lt;br /&gt;}&lt;br /&gt;Sort();&lt;br /&gt;}&lt;br /&gt;private&lt;br /&gt;void Sort()&lt;br /&gt;{&lt;br /&gt;var relevences =&lt;br /&gt;from w in _SearchRelevance&lt;br /&gt;orderby&lt;br /&gt;w.RelevancePoint descending&lt;br /&gt;select w;&lt;br /&gt;foreach (SearchRelevance sri in&lt;br /&gt;relevences)&lt;br /&gt;{&lt;br /&gt;_Results.Add(sri);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;public class&lt;br /&gt;SearchRelevance&lt;br /&gt;{&lt;br /&gt;public SearchRelevance(string input, string&lt;br /&gt;text)&lt;br /&gt;{&lt;br /&gt;_OriginalText = text;&lt;br /&gt;_UserInput = input;&lt;br /&gt;}&lt;br /&gt;public&lt;br /&gt;override string ToString()&lt;br /&gt;{&lt;br /&gt;return _RelevancePoint.ToString() +" "+&lt;br /&gt;_OriginalText ;&lt;br /&gt;}&lt;br /&gt;internal void Calculate()&lt;br /&gt;{&lt;br /&gt;string[] splitedinput&lt;br /&gt;= UserInput.Split(new char[] { ' ' });&lt;br /&gt;Dictionary&lt;string,&gt;&lt;br /&gt;relevency = new Dictionary&lt;string,&gt;();&lt;br /&gt;//initialize the relevency&lt;br /&gt;dic.&lt;br /&gt;for (int i = 0; i &lt; splitedinput.Length;&lt;br /&gt;i++)&lt;br /&gt;{&lt;br /&gt;relevency.Add(splitedinput[i], 0);&lt;br /&gt;}&lt;br /&gt;for (int i = 0; i &lt;&lt;br /&gt;splitedinput.Length; i++)&lt;br /&gt;{&lt;br /&gt;Regex reg = new Regex(splitedinput[i],&lt;br /&gt;RegexOptions.IgnoreCase);&lt;br /&gt;if (reg.IsMatch(OriginalText))&lt;br /&gt;{&lt;br /&gt;int&lt;br /&gt;point;&lt;br /&gt;relevency.TryGetValue(splitedinput[i], out&lt;br /&gt;point);&lt;br /&gt;relevency.Remove(splitedinput[i]);&lt;br /&gt;relevency.Add(splitedinput[i],&lt;br /&gt;++point);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;_Relevancy = relevency;&lt;br /&gt;//sum the relevency&lt;br /&gt;int&lt;br /&gt;rpoint = 0;&lt;br /&gt;foreach (KeyValuePair&lt;string,&gt; kv in&lt;br /&gt;relevency)&lt;br /&gt;{&lt;br /&gt;rpoint += kv.Value;&lt;br /&gt;}&lt;br /&gt;_RelevancePoint =&lt;br /&gt;rpoint;&lt;br /&gt;}&lt;br /&gt;private string _UserInput;&lt;br /&gt;public string&lt;br /&gt;UserInput&lt;br /&gt;{&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;return _UserInput;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;private string&lt;br /&gt;_OriginalText;&lt;br /&gt;public string OriginalText&lt;br /&gt;{&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;return&lt;br /&gt;_OriginalText;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;private int _RelevancePoint;&lt;br /&gt;public int&lt;br /&gt;RelevancePoint&lt;br /&gt;{&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;return _RelevancePoint;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;private&lt;br /&gt;Dictionary&lt;string,&gt; _Relevancy = new Dictionary&lt;string,&lt;br /&gt;int&gt;();&lt;br /&gt;public Dictionary&lt;string,&gt;&lt;br /&gt;Relevancy&lt;br /&gt;{&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;return _Relevancy;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;public class&lt;br /&gt;Program&lt;br /&gt;{&lt;br /&gt;static void Main(string[] args)&lt;br /&gt;{&lt;br /&gt;string[] sb = new&lt;br /&gt;string[4];&lt;br /&gt;sb[0] = "Relevance cassida shell theory may be seen as an&lt;br /&gt;attempt";&lt;br /&gt;sb[1] = "registered by NSF (Class H1) cassida for use&lt;br /&gt;where";&lt;br /&gt;sb[2] = "Shell Cassida Silicone Fluid is";&lt;br /&gt;sb[3] = "to work out in&lt;br /&gt;detail one of Grice’s central claims";&lt;br /&gt;string input = "nsf shell central h1&lt;br /&gt;sillicone fluid";&lt;br /&gt;Search sr = new Search(input, sb);&lt;br /&gt;SearchRelevance[] res&lt;br /&gt;= sr.Results.ToArray();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-2131534190136739604?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/2131534190136739604/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=2131534190136739604' title='13 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/2131534190136739604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/2131534190136739604'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/08/create-serch-engine-with-linq.html' title='Create a serch engine with linq'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>13</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-2074662604570171738</id><published>2007-08-09T21:16:00.000+08:00</published><updated>2007-08-09T22:36:06.333+08:00</updated><title type='text'>XML as data storage, query with Linq</title><content type='html'>Most of the time data is stored as database but how about data stored as a file format? If data is stored as file format meaning that we have much more power to decide the storage however file as storage is not always the ideal situation if data is too complex to store and &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;difficute&lt;/span&gt; to manage. Today we see relational database is so &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_0"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;successfull&lt;/span&gt;&lt;/span&gt; because of the database management design. We use &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;SQL&lt;/span&gt;&lt;/span&gt; to manipulate data and we are happy with the power and the flexibility that &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;SQL&lt;/span&gt; could give.&lt;br /&gt;&lt;br /&gt;However, there is a problem that storing data in database always seem to be bulky for small application. Imagine that, you are creating a subsystem as a service of a larger system, which has is own database implementation. Logically, it is not advisable that the sub system use it own database or share the data store with the larger system mainly because having a it own database is too bulky and has environment limitation. And, if data store is shared meaning that integration will be too costly and complicated.&lt;br /&gt;&lt;br /&gt;The solution is to use XML as isolated data storage. We have to build services around the data and expose it as interface for larger system integration. Having using &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;xml&lt;/span&gt;&lt;/span&gt; as data, the integration is much simpler and less impact on the overall larger system.&lt;br /&gt;&lt;br /&gt;Most people i would say do not like to query XML data because of the complicated query and it is not &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;SQL&lt;/span&gt;&lt;/span&gt; liked. However, now the situation has changed, you can query data having &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;SQL&lt;/span&gt;&lt;/span&gt; liked by using &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;linq&lt;/span&gt;&lt;/span&gt; to XML. Developer can use &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;linq&lt;/span&gt;&lt;/span&gt; to query XML data. In the next discussion, I will show you how you can play around with this &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;Linq&lt;/span&gt;&lt;/span&gt; to XML technique.&lt;br /&gt;&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;Frackyly&lt;/span&gt;, i do not like XML as data store until i found that &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;Linq&lt;/span&gt; has so much to promise.&lt;br /&gt;&lt;br /&gt;for more &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_12"&gt;information&lt;/span&gt; on the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;linq&lt;/span&gt; &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_14"&gt;technology&lt;/span&gt;, please visit&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/netframework/aa904594.aspx"&gt;http://msdn2.microsoft.com/en-us/netframework/aa904594.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-2074662604570171738?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/2074662604570171738/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=2074662604570171738' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/2074662604570171738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/2074662604570171738'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/08/xml-as-data-storage-query-with-linq.html' title='XML as data storage, query with Linq'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-3720994258650589580</id><published>2007-08-09T17:30:00.000+08:00</published><updated>2007-08-09T17:47:50.310+08:00</updated><title type='text'>Read XML data and bind to datagridview .NET</title><content type='html'>if you want to bind xml data to your datagrid, you need do as below:&lt;br /&gt;&lt;br /&gt;dataSet1.ReadXml("kwyProducts.xml");&lt;br /&gt;dataGridView1.DataSource =&lt;br /&gt;dataSet1;&lt;br /&gt;dataGridView1.DataMember = "KWYProducts";&lt;br /&gt;&lt;br /&gt;Notes: please specify your DataMember correctly else will throw you this error:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;&lt;blockquote&gt;&lt;p&gt;&lt;em&gt;Child list for field KWYProduscts cannot be created.&lt;/em&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;/blockquote&gt;&lt;/em&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-3720994258650589580?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/3720994258650589580/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=3720994258650589580' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3720994258650589580'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3720994258650589580'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/08/read-xml-data-and-bind-to-datagridview.html' title='Read XML data and bind to datagridview .NET'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-5290788732718060699</id><published>2007-07-25T09:58:00.000+08:00</published><updated>2007-07-25T10:01:27.755+08:00</updated><title type='text'>How to restore a sql server database backup?</title><content type='html'>I had backup a database of my &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SQL&lt;/span&gt; Server 2005, however it can't be restore due to the drive location issue, therefore here is the method to overcome this problem:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;blockquote&gt;&lt;span style="font-family:courier new;"&gt;Use Master&lt;br /&gt;RESTORE DATABASE &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;DinnerNow&lt;/span&gt;   FROM&lt;br /&gt;DISK = 'C:\&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;DinnerNow&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;bak&lt;/span&gt;'   WITH MOVE&lt;br /&gt;'&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;DinnerNownew&lt;/span&gt;' TO&lt;br /&gt;'F:\Program Files\Microsoft &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;SQL&lt;/span&gt;&lt;br /&gt;Server\MSSQL.4\MSSQL\Data\DinnerNownew.mdf',   MOVE '&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;DinnerNownew&lt;/span&gt;_log' TO&lt;br /&gt;'F:\Program Files\Microsoft &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;SQL&lt;/span&gt;&lt;br /&gt;Server\MSSQL.4\MSSQL\Data\DinnerNownew.ldf'&lt;br /&gt;GO&lt;/span&gt;&lt;/blockquote&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-5290788732718060699?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/5290788732718060699/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=5290788732718060699' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/5290788732718060699'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/5290788732718060699'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/07/how-to-restore-sql-server-database.html' title='How to restore a sql server database backup?'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-6993499810381901435</id><published>2007-07-25T09:42:00.000+08:00</published><updated>2007-07-25T10:02:31.642+08:00</updated><title type='text'>How to enumerate Generic Dictionary .NET list</title><content type='html'>At first i found that enumerating a .net Dictionary class seem to be &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_0"&gt;difficult&lt;/span&gt; but later i found that there is a way of doing this for example:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;&lt;span style="font-family:courier new;"&gt;//&lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;instantiate&lt;/span&gt; a dictionary list&lt;br /&gt;Dictionary&lt;string,&gt; _&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;PointDic&lt;/span&gt; = new&lt;br /&gt;Dictionary&lt;string,&gt;();&lt;br /&gt;public Dictionary&lt;string,&gt;&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;PointDic&lt;/span&gt;&lt;br /&gt;{&lt;br /&gt;get { return _&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;PointDic&lt;/span&gt;; }&lt;br /&gt;set { _&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;PointDic&lt;/span&gt; = value; }&lt;br /&gt;}&lt;br /&gt;//add value to named key&lt;br /&gt;public void &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;AddPoints&lt;/span&gt;(int point, string&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;ruleName&lt;/span&gt;)&lt;br /&gt;{&lt;br /&gt;int temp = 0;&lt;br /&gt;if (!_&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;PointDic&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;TryGetValue&lt;/span&gt;(&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;ruleName&lt;/span&gt;, out&lt;br /&gt;temp))&lt;br /&gt;{&lt;br /&gt;_&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;PointDic&lt;/span&gt;.Add(&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;ruleName&lt;/span&gt;,&lt;br /&gt;point);&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;_&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;PointDic&lt;/span&gt;.Remove(&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;ruleName&lt;/span&gt;);&lt;br /&gt;_&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;PointDic&lt;/span&gt;.Add(&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;ruleName&lt;/span&gt;,&lt;br /&gt;point);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;//sum up the values in the dictionary list&lt;br /&gt;public int&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17"&gt;CalculatePoints&lt;/span&gt;()&lt;br /&gt;{&lt;br /&gt;int &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;totalpoints&lt;/span&gt; = 0;&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_19"&gt;foreach&lt;/span&gt;&lt;br /&gt;(&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_20"&gt;KeyValuePair&lt;/span&gt;&lt;string,int&gt; s in _&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_21"&gt;PointDic&lt;/span&gt;)&lt;br /&gt;{&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_22"&gt;totalpoints&lt;/span&gt; +=&lt;br /&gt;(int)s.Value;&lt;br /&gt;}&lt;br /&gt;return &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_23"&gt;totalpoints&lt;/span&gt;;&lt;br /&gt;}&lt;/span&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-6993499810381901435?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/6993499810381901435/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=6993499810381901435' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6993499810381901435'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6993499810381901435'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/07/how-to-enumerate-generic-dictionary-net.html' title='How to enumerate Generic Dictionary .NET list'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-5093845034581190971</id><published>2007-07-16T00:02:00.000+08:00</published><updated>2007-07-16T00:05:48.863+08:00</updated><title type='text'>ConfigurationManager .Net</title><content type='html'>How you read your custom setting in your application configuration file.&lt;br /&gt;&lt;br /&gt;//Read settings&lt;br /&gt;public static string &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;ReadConfig&lt;/span&gt;(string key)&lt;br /&gt;{&lt;br /&gt;return ConfigurationManager.AppSettings.GetValues(key)[0];&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//Update Settings &amp; get &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;immediate&lt;/span&gt; changes&lt;br /&gt;public static void &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;SetConfig&lt;/span&gt;(string key, string value)&lt;br /&gt;{&lt;br /&gt;Configuration con = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);&lt;br /&gt;con.AppSettings.Settings[key].Value = value;&lt;br /&gt;con.Save(ConfigurationSaveMode.Full);&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;ConfigurationManager&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;RefreshSection&lt;/span&gt;("&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;appSettings&lt;/span&gt;");&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-5093845034581190971?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/5093845034581190971/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=5093845034581190971' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/5093845034581190971'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/5093845034581190971'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/07/configurationmanager-net.html' title='ConfigurationManager .Net'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-1577312994219909076</id><published>2007-06-14T11:27:00.000+08:00</published><updated>2007-06-14T11:45:12.798+08:00</updated><title type='text'>Create a distributable workflow enabled smart client</title><content type='html'>We want to develop a windows application with &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;workflow&lt;/span&gt; enabled. The easiest and fastest way is to use Microsoft &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;Workflow&lt;/span&gt; Foundation which give you a complete &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;API&lt;/span&gt; for designing any &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;workflow&lt;/span&gt; application that you can think of.&lt;br /&gt;&lt;br /&gt;We wanted to develop a windows application which has to be distributed to multiple computers and having multiple users. Here we have one challenge, we need to host the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;Workflow&lt;/span&gt;. The most simple implementation is to host &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;workflow&lt;/span&gt; in a dedicated server where many clients can access to it. Next we have to expose the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;workflow&lt;/span&gt; as &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;webservice&lt;/span&gt;, this is important because &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;workflow&lt;/span&gt; as &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;webservice&lt;/span&gt; can give you the maximum flexibility in connectivity and &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_10"&gt;interoperability&lt;/span&gt;. For example, connect a mobile device that runs java application. Sound interesting?&lt;br /&gt;&lt;br /&gt;I will post the tutorial on building your first smart client &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;workflow&lt;/span&gt; enabled application here for your reference.&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-1577312994219909076?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/1577312994219909076/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=1577312994219909076' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1577312994219909076'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1577312994219909076'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/06/create-distributable-workflow-enabled.html' title='Create a distributable workflow enabled smart client'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-1630865046041508052</id><published>2007-06-06T13:47:00.000+08:00</published><updated>2007-06-06T13:49:11.448+08:00</updated><title type='text'>Short hand using if else for ADO.NET</title><content type='html'>SqlCeCommand command = new SqlCeCommand(queryString, connection);&lt;br /&gt;command.Connection.Open();&lt;br /&gt;ccommand.Parameters.Add("@AddressID", (object)AddressID?? DBNull.Value );&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-1630865046041508052?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/1630865046041508052/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=1630865046041508052' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1630865046041508052'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1630865046041508052'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/06/short-hand-using-if-else-for-adonet.html' title='Short hand using if else for ADO.NET'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-5795537245580012699</id><published>2007-06-06T13:44:00.000+08:00</published><updated>2007-06-06T13:47:05.359+08:00</updated><title type='text'>SQL Compact return new insertion identity</title><content type='html'>&lt;blockquote&gt;&lt;p&gt;Try this code it will help. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;public Int64 AddCustomer(string LastName, string FirstName, int?&lt;br /&gt;AddressID, string MembershipUsername, string PhoneNumber, string&lt;br /&gt;MobilePhoneNumber)&lt;br /&gt;{&lt;br /&gt;SQLCeHelper sqlce = new&lt;br /&gt;SQLCeHelper(Properties.Settings.Default.CarServ3DB4ConnectionString);&lt;br /&gt;string&lt;br /&gt;queryString =&lt;br /&gt;"INSERT INTO Customer" +&lt;br /&gt;"(LastName, FirstName, AddressID,&lt;br /&gt;MembershipUsername, PhoneNumber, MobilePhoneNumber)" +&lt;br /&gt;"VALUES&lt;br /&gt;(@LastName,@FirstName,@AddressID,@MembershipUsername,@PhoneNumber,@MobilePhoneNumber)";&lt;br /&gt;Int64&lt;br /&gt;newIdentity = 0;&lt;br /&gt;using (SqlCeConnection connection = new&lt;br /&gt;SqlCeConnection(&lt;br /&gt;Properties.Settings.Default.CarServ3DB4ConnectionString))&lt;br /&gt;{&lt;br /&gt;SqlCeCommand&lt;br /&gt;command = new SqlCeCommand(queryString,&lt;br /&gt;connection);&lt;br /&gt;command.Connection.Open();&lt;br /&gt;command.Parameters.Add("@LastName",&lt;br /&gt;LastName);&lt;br /&gt;command.Parameters.Add("@FirstName",&lt;br /&gt;FirstName);&lt;br /&gt;command.Parameters.Add("@AddressID", (object)AddressID??&lt;br /&gt;DBNull.Value );&lt;br /&gt;command.Parameters.Add("@MembershipUsername",&lt;br /&gt;MembershipUsername);&lt;br /&gt;command.Parameters.Add("@PhoneNumber",&lt;br /&gt;PhoneNumber);&lt;br /&gt;command.Parameters.Add("@MobilePhoneNumber",&lt;br /&gt;MobilePhoneNumber);&lt;br /&gt;command.ExecuteNonQuery();&lt;br /&gt;SqlCeCommand command1 = new&lt;br /&gt;SqlCeCommand("select @@identity ", connection);&lt;br /&gt;newIdentity =&lt;br /&gt;Convert.ToInt32(command1.ExecuteScalar());&lt;br /&gt;}&lt;br /&gt;return&lt;br /&gt;newIdentity;&lt;br /&gt;}&lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-5795537245580012699?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/5795537245580012699/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=5795537245580012699' title='78 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/5795537245580012699'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/5795537245580012699'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/06/sql-compact-return-new-insertion.html' title='SQL Compact return new insertion identity'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>78</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-1595160495639832833</id><published>2007-05-31T09:44:00.000+08:00</published><updated>2007-05-31T10:10:04.326+08:00</updated><title type='text'>FileNotFoundException was unhandled</title><content type='html'>&lt;blockquote&gt;&lt;p&gt;Could not load file or assembly 'System.Data.SqlServerCe, Version=9.0.242.0,&lt;br /&gt;Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies.&lt;br /&gt;The system cannot find the file specified.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;br /&gt;You might encountered this error when the System.Data.SqlServerCe version has redirected to another newer version due Visual Studio 2005 generated code on your application config file.&lt;/p&gt;&lt;p&gt;To solve this problem, you have to delete something like below in you app.config file.&lt;br /&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;runtime&gt;&lt;br /&gt;&lt;assemblyBinding&lt;br /&gt;xmlns="urn:schemas-microsoft-com:asm.v1"&gt;&lt;br /&gt;&lt;dependentassembly&gt;&lt;br /&gt;&lt;assemblyIdentity&lt;br /&gt;name="System.Data.SqlServerCe" publicKeyToken="89845DCD8080CC91"&lt;br /&gt;culture="neutral"/&gt;&lt;br /&gt;&lt;bindingRedirect oldVersion="0.0.0.0-9.0.242.0"&lt;br /&gt;newVersion="9.0.242.0"/&gt;&lt;br /&gt;&lt;/dependentassembly&gt;&lt;br /&gt;&lt;/assemblybinding&gt;&lt;br /&gt;&lt;/runtime&gt;&lt;/blockquote&gt;&lt;p&gt;hope this helps&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-1595160495639832833?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/1595160495639832833/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=1595160495639832833' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1595160495639832833'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1595160495639832833'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/05/filenotfoundexception-was-unhandled.html' title='FileNotFoundException was unhandled'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-7297655443080120459</id><published>2007-05-26T09:29:00.000+08:00</published><updated>2007-05-26T09:49:11.887+08:00</updated><title type='text'>You are trying to access an older version of a SQL Server Compact Edition database. If this is a SQL Server CE 1.0 or 2.0 database, run upgrade.exe.</title><content type='html'>This happens when your .&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;sdf&lt;/span&gt; database version changed and perhaps corrupted. It might due to merge replication of using &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;SQL&lt;/span&gt; Server 2005. Therefore the only solution is to repair it.&lt;br /&gt;&lt;br /&gt;To repair it you must use the&lt;br /&gt;System.Data.SqlServerCe.SqlCeEngine class, version 9.0.242.0 or 3.5.0.0&lt;br /&gt;&lt;br /&gt;Here is the example of the implementation.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;File.Copy(@"F:\&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;northwind&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;sdf&lt;/span&gt;",@"F:\northwind.sdf.temp");&lt;br /&gt;File.Delete(@"F:\&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;northwind&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;sdf&lt;/span&gt;");&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;SqlCeEngine&lt;/span&gt;&lt;br /&gt;engine = new &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;SqlCeEngine&lt;/span&gt;(@"Data Source&lt;br /&gt;=F:northwind.sdf.temp");&lt;br /&gt;engine.Compact(@"Data&lt;br /&gt;Source=F:\&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;northwind&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;sdf&lt;/span&gt;");&lt;br /&gt;File.Delete(@"F:\northwind.sdf.temp"); &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;A repaired &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;northwind&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;sdf&lt;/span&gt; is produced and now you should not be getting this error again. Any other alternative? Please let me know. :)&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-7297655443080120459?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/7297655443080120459/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=7297655443080120459' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/7297655443080120459'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/7297655443080120459'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/05/you-are-trying-to-access-older-version.html' title='You are trying to access an older version of a SQL Server Compact Edition database. If this is a SQL Server CE 1.0 or 2.0 database, run upgrade.exe.'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-7325151267358396674</id><published>2007-05-25T23:14:00.000+08:00</published><updated>2007-05-25T23:28:27.792+08:00</updated><title type='text'>Before trying to solve, think first</title><content type='html'>most of us solve problem as &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_0"&gt;straight&lt;/span&gt; away try to do it without thinking or planning when given a problem. This often lead to slow productivity because the method used is not effective enough to solve the a given problem. Perhaps there is a better way solving the problem, you might not know it. Therefore just keep these checklists in mind before starting any problem solving:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;Do your research and gather as much &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;information&lt;/span&gt; as you can.&lt;br /&gt;Any question, don't wait... ask G&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;oogle&lt;/span&gt;.&lt;br /&gt;Give yourself various alternative solutions.&lt;br /&gt;Be creative and don't afraid to break the rules.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;If you could follow all these mention above, you could be a better problem solver.&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-7325151267358396674?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/7325151267358396674/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=7325151267358396674' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/7325151267358396674'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/7325151267358396674'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/05/before-trying-to-solve-think-first.html' title='Before trying to solve, think first'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-6766623746891032376</id><published>2007-05-23T22:16:00.000+08:00</published><updated>2007-05-23T22:31:59.547+08:00</updated><title type='text'>software user interface design.</title><content type='html'>User interface is very important to improve the usability of the software. Software application failed to meet user expectations and requirements are often due to the lack of proper &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;UI&lt;/span&gt; design. Simple &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;UI&lt;/span&gt; often impress user whereas complex &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;UI&lt;/span&gt; often frighten user away. When design &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;UI&lt;/span&gt;, the first thing have to come to every developer mind; always design in user perspective.&lt;br /&gt;&lt;br /&gt;A great &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;UI&lt;/span&gt; must always have these criteria:&lt;br /&gt;&lt;br /&gt;simple and does the job right.&lt;br /&gt;good navigation and proper &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;UI&lt;/span&gt; arrangement&lt;br /&gt;easy accessible functions and customized menu for the user&lt;br /&gt;fast and responsive &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;UI&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;please keep in mind that &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;UI&lt;/span&gt; design is the first user impression of the software.&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-6766623746891032376?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/6766623746891032376/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=6766623746891032376' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6766623746891032376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6766623746891032376'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/05/windows-ui-design.html' title='software user interface design.'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-6026122144687770278</id><published>2007-04-05T00:43:00.000+08:00</published><updated>2007-04-05T01:21:06.033+08:00</updated><title type='text'>Keep application performance design in first place.</title><content type='html'>Most often when we write a piece of software we often lack of consideration thanking about designing a fast loading program and this is always true if we designed a small program. Actually there are various of ways to improve the performance of program, for example keep the program initialization as light weight as possible, &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_0"&gt;be careful&lt;/span&gt; when we allocate memory, and always think of threaded programming design. Sometimes, we feel demotivated because of the expensive cost involve in having putting performance design in the first place, however, investment will be well worth if the customer don't feel your software is slow and underperformed in average.&lt;br /&gt;&lt;br /&gt;Assume that we design a small program called Sales Reporting to be used in an organization. Since the program has just only a few modules, we ignore the performance design. Over the time, we might be adding some functionality, hence the complexity of the program increase. Maintainability of the program also an issue if the program is not well designed. One day, you are requested to improve the performance of the program because users are keep complaining that the slow loading program keep them not be patient anymore. Users are fed up and their work is always distracted. The company are not going to invest to redesigned the program because over the year many time and money was spent in maintaining the program. The program is reliable and the problem is just lack of performance. You as a software consultant is hired to perform this task, what is the first thing you would do?&lt;br /&gt;&lt;br /&gt;You might be run test the program at the first place to see which area need to be improved. You had identify that some areas need to be redesigned for significant performance gain. You had just planned the  initial  strategy.  Secondly, you are looking to the source code, you are over surprise that most part of the code could be very difficult to be modify for performance gain because the original designer do not keep the best practise in coding hence lead to performance issue. Another concern is that the application is extremely tedious to convert to threaded application because initially the program is very difficult to maintain and the structure the application is not well understood by anyone.&lt;br /&gt;&lt;br /&gt;You see, the scenario above has demonstrated that application tend to be extremely difficult to gain performance when the application aged. To solve this problem we must keep performance design in the first place during application planning and design phase.&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-6026122144687770278?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/6026122144687770278/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=6026122144687770278' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6026122144687770278'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6026122144687770278'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/04/keep-application-performance-design-in.html' title='Keep application performance design in first place.'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-8154210578296661460</id><published>2007-04-04T09:18:00.000+08:00</published><updated>2007-04-04T09:21:51.876+08:00</updated><title type='text'>Format default date in SQL Server 2005</title><content type='html'>Normally the default date for sql server is shown as 1/1/2007 12:00:00, however i feel the format of the date is too long and it would be better to be formatted as 1 Jan 2007. In order to create this effect, here the tip.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;CONVERT(CHAR(11), getdate(), 106) AS Date&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-8154210578296661460?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/8154210578296661460/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=8154210578296661460' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8154210578296661460'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8154210578296661460'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/04/format-default-date-in-sql-server-2005.html' title='Format default date in SQL Server 2005'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-3300558127781717499</id><published>2007-03-08T14:42:00.000+08:00</published><updated>2007-03-08T14:50:45.241+08:00</updated><title type='text'>Framework 3.5 linq rocks inside .NET 2.0</title><content type='html'>Today i have tested the Visual Studio &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;Orcas&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;CTP&lt;/span&gt; and I &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;found&lt;/span&gt; the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;linq&lt;/span&gt; feature is really cool. I did some testing whereby i tried to create a class which uses some &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;linq&lt;/span&gt; features. I compiled it with the framework 3.5 and finally i tried to reference it in my Visual Studio 2005. Guess what i managed to call the assembly compiled in framework 3.5 inside my framework 2.0 project. Therefore, this &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_5"&gt;concluded&lt;/span&gt; that i could create my signed business logic classes using &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;linq&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Great job!&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-3300558127781717499?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/3300558127781717499/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=3300558127781717499' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3300558127781717499'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3300558127781717499'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/03/framework-35-linq-rocks-in-side-net-20.html' title='Framework 3.5 linq rocks inside .NET 2.0'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-7087077879449376099</id><published>2007-03-01T13:48:00.000+08:00</published><updated>2007-03-01T13:54:42.961+08:00</updated><title type='text'>SQL Server 2005 Compact Edition - Internal Error: Invalid reconciler parameter</title><content type='html'>If you are experiencing this error "Internal Error: Invalid &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;reconciler&lt;/span&gt; parameter" when you are doing merge replication or sync stuffs, don't worry because the error is due to the directory path is too long to be supported in .NET, therefore you need to copy your solution folder and paste it to C:\ for instance so that the directory path could be recognized by .NET.&lt;br /&gt;&lt;br /&gt;For more detail &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;explanation&lt;/span&gt;, please go to&lt;br /&gt;&lt;a href="http://pluralsight.com/blogs/jimw/archive/2006/06/18/28427.aspx"&gt;http://pluralsight.com/blogs/jimw/archive/2006/06/18/28427.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-7087077879449376099?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/7087077879449376099/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=7087077879449376099' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/7087077879449376099'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/7087077879449376099'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/03/sql-server-2005-compact-edition_01.html' title='SQL Server 2005 Compact Edition - Internal Error: Invalid reconciler parameter'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-7084675252816150476</id><published>2007-03-01T13:38:00.000+08:00</published><updated>2007-03-01T13:45:08.199+08:00</updated><title type='text'>SQL Server 2005 Compact Edition Tutorial</title><content type='html'>Developing mobile application never been so easier with Visual Studio 2005. The SQL Server 2005 Compact Edition also comes with free. With a lot of support, there is no reason that I want to get started with my own written mobile application. To learn more about the SQL Server 2005 Compact Edition, please visit the &lt;a href="http://msdn2.microsoft.com/en-us/sql/bb219480.aspx"&gt;http://msdn2.microsoft.com/en-us/sql/bb219480.aspx&lt;/a&gt; to quickly get started the tutorials to experience the most advance features.&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-7084675252816150476?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/7084675252816150476/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=7084675252816150476' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/7084675252816150476'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/7084675252816150476'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/03/sql-server-2005-compact-edition.html' title='SQL Server 2005 Compact Edition Tutorial'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-1117231979851554520</id><published>2007-03-01T01:54:00.000+08:00</published><updated>2007-03-01T02:58:17.805+08:00</updated><title type='text'>N Computing vs Personal Computing - my point of view</title><content type='html'>My company recently have a plan to improve existing IT infrastructure by replacing those old PCs so that our staffs could be happier and more productive. However, my manager was asking me to give him some advice and recommendation of it and he also did suggest me about the N Computing solution (&lt;a href="http://www.ncomputing.com/"&gt;http://www.ncomputing.com/&lt;/a&gt;). I was very impress with the technology because it could save us tons of money off from buying "duplicated" hardware and software licences.&lt;br /&gt;&lt;br /&gt;After i had done my researches and I found that the device is not as cheap as i thought. In the US it is sold at &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;USD&lt;/span&gt;50 per device however in Malaysia, it is sold at &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;USD&lt;/span&gt;162. NComputing in Malaysia pricing is so ridiculous and unreasonable since today computing is so cheap that i could built a PC with a 2.8GHz processor, motherboard V+L+S, 512 RAM, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;DVDRW&lt;/span&gt; drive and casing (a PC really need a protection), which cost me at &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;USD&lt;/span&gt;151 only. That is US10 cheaper and I could get a real computer rather that just a simple station box. I could upgrade my PC over time with more functionality but I have limited or no upgradable ability with the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;NComputing&lt;/span&gt; station box.&lt;br /&gt;&lt;br /&gt;Are you wondering how i could built the PC so cheap? The reason is the PC has no hard disk inside because i want to compare between "Apple X" and "Apple Y". The concept of using N computing is to connect the station box (client) with the host (server) in &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;multi&lt;/span&gt;-user session scenario using a network connection. However it also can be done by a PC without a hard disk since I could use a open source Linux OS distribution such as &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;KNOPPIX&lt;/span&gt; (&lt;a href="http://www.knopper.com/"&gt;http://www.knopper.com/&lt;/a&gt;) to be loaded by just a CD or DVD!. Inside the distribution DVD, it comes with plenty of useful software including Open Office 2.1 and a FireFox Internet browser. In this case I could remote access to my Windows Server 2003 host which supports &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;multi&lt;/span&gt;-concurrent user via the &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_8"&gt;Internet&lt;/span&gt; browser. Therefore, I have no problem running Windows application such as Ms Office 2007.&lt;br /&gt;&lt;br /&gt;As my conclusion, I would consider the station box if it is less than US50 else it should be an obsolete technology if the cost of making it is too high. Since today computing is so cheap, in which an unused CPU &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_9"&gt;resources&lt;/span&gt; could be used as distributed computing &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_10"&gt;purposes&lt;/span&gt; but not the station box.&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-1117231979851554520?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/1117231979851554520/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=1117231979851554520' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1117231979851554520'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1117231979851554520'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/03/n-computing-vs-personal-computer.html' title='N Computing vs Personal Computing - my point of view'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-3964623539752124481</id><published>2007-02-28T08:48:00.000+08:00</published><updated>2007-02-28T09:12:52.294+08:00</updated><title type='text'>Extreme Programming Part 1 - Introduction</title><content type='html'>&lt;blockquote&gt;&lt;/blockquote&gt;Extreme programming or &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;XP&lt;/span&gt; is a software development methodology that aim to improve software development productivity, reduce risk and cost. The main focus is to develop software in incrementally, rapid prototyping and communicate frequently that lead to accept requirement changes frequently ( most programmers hate it) and However &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;XP&lt;/span&gt; doesn't work for all scenario specially for mission critical system and large system because those system normally needs highly formal specification whereas &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;XP&lt;/span&gt; programming is just the opposite.&lt;br /&gt;&lt;br /&gt;The main challenge of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;XP&lt;/span&gt; is real fun because you need to do everything yourself and you will deal with customers frequently and communicate with your peers frequently. You got to work out with a prototype very fast an usually you need a code generator to generate the whole application for you. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;Eg&lt;/span&gt;. Iron Speed &lt;a href="http://www.ironspeed.com/"&gt;http://www.ironspeed.com/&lt;/a&gt; does the job. You got to test it and evaluate it for whatever reason to meet the requirements. XP is great if you have a small team around 2-6 people.&lt;br /&gt;&lt;br /&gt;To be continued...&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-3964623539752124481?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/3964623539752124481/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=3964623539752124481' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3964623539752124481'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3964623539752124481'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/02/extreme-programming-part-1-introduction.html' title='Extreme Programming Part 1 - Introduction'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-8677730998151154090</id><published>2007-02-27T16:40:00.000+08:00</published><updated>2007-03-02T02:50:01.282+08:00</updated><title type='text'>Concurrent Remote Desktop Sessions in Windows XP SP2</title><content type='html'>Since Windows &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;XP&lt;/span&gt; does not allow multiple &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;concurrent&lt;/span&gt; access at the same time using the remote desktop server, however here the link to workaround with.&lt;br /&gt;&lt;br /&gt;As for me i applied the terminal server patch (Please follow the link to download the patch below) to the Windows XP pro and i works after restarted. However you need to do one extra step in order you can remote the client user.&lt;br /&gt;&lt;br /&gt;Here the extra step&lt;br /&gt;&lt;br /&gt;Go to Control Panel &gt; Administrative Tools &gt; Computer Management &gt; Local User and Groups &gt; right click the selected user (create a new user if you want) &gt; properties &gt; Member Of &gt; Add &gt; Advance &gt; Find now &gt; Choose Remote Desktop User &gt; Click Apply and finally OK.&lt;br /&gt;&lt;br /&gt;You migh need to change to different port by editing HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\PortNumber&lt;br /&gt;&lt;br /&gt;Now you have successfully turn your Windows XP pro into a terminal server which could support multi concurrent user using Remote Desktop.&lt;br /&gt;&lt;br /&gt;Cheers!&lt;br /&gt;&lt;br /&gt;&lt;a href="http://sig9.com/articles/concurrent-remote-desktop"&gt;http://sig9.com/articles/concurrent-remote-desktop&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.kood.org/terminal-server-patch/"&gt;http://www.kood.org/terminal-server-patch/&lt;/a&gt; (Recommended)&lt;br /&gt;&lt;br /&gt;&lt;a href="http://riccardo.raneri.it/blog/eng/index.php/2006/04/24/windows-xp-multiuser-remote-desktop/"&gt;http://riccardo.raneri.it/blog/eng/index.php/2006/04/24/windows-xp-multiuser-remote-desktop/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.golod.com/2005/10/enabling-multiple-remote-desktop-sessions-in-windows-xp-professional-and-media-center-edition-2005/"&gt;http://www.golod.com/2005/10/enabling-multiple-remote-desktop-sessions-in-windows-xp-professional-and-media-center-edition-2005/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-8677730998151154090?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/8677730998151154090/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=8677730998151154090' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8677730998151154090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8677730998151154090'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/02/concurrent-remote-desktop-sessions-in.html' title='Concurrent Remote Desktop Sessions in Windows XP SP2'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-6600114181606743637</id><published>2007-02-26T09:58:00.000+08:00</published><updated>2007-02-27T10:45:46.588+08:00</updated><title type='text'>Get ready with your ASP.NET app using ADAM Membership using ActiveDirectoryMembershipProvider Class</title><content type='html'>If you want to manage storage of membership information for an ASP.NET application in Active Directory and Active Directory Application Mode servers, you need to do these thing:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Install ADAM. Download ADAM from &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=9688F8B9-1034-4EF6-A3E5-2A2A57B5C8E4&amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyId=9688F8B9-1034-4EF6-A3E5-2A2A57B5C8E4&amp;amp;displaylang=en&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Install into your Windows Server 2003 (recommended).&lt;/li&gt;&lt;li&gt;After the installation you need to follow this tutorial presented here. [Download Pdf]&lt;/li&gt;&lt;li&gt;You need to configure web.config, please follow the &lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.security.activedirectorymembershipprovider(VS.80).aspx"&gt;http://msdn2.microsoft.com/en-us/library/system.web.security.activedirectorymembershipprovider(VS.80).aspx&lt;/a&gt;&lt;/li&gt;&lt;li&gt;That's it and you are ready to test drive! &lt;/li&gt;&lt;/ol&gt;&lt;p&gt;Have you encountered this error before?&lt;/p&gt;&lt;blockquote&gt;Unable to establish secure connection with the server using SSL&lt;/blockquote&gt;&lt;p&gt;The reason is because you did not follow my tutorial. :)&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-6600114181606743637?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/6600114181606743637/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=6600114181606743637' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6600114181606743637'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6600114181606743637'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/02/activedirectorymembership-aspnet.html' title='Get ready with your ASP.NET app using ADAM Membership using ActiveDirectoryMembershipProvider Class'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-6937697827908145794</id><published>2007-02-26T00:47:00.000+08:00</published><updated>2007-02-26T01:03:28.998+08:00</updated><title type='text'>Linq to SQL get started snippet example</title><content type='html'>Well, here the problem:&lt;br /&gt;&lt;br /&gt;Given that you have 2 table in many to many relationship, how create using Linq?&lt;br /&gt;&lt;br /&gt;First of all you need to normalize it to 1 to many format. Since you are using Linq, it is safer that each and every table has 1 identity autonumbered column to prevent any CRUD failures (Hope this will be fixed soon).&lt;br /&gt;&lt;br /&gt;Now you got 3 tables, since you are dealing with &gt; 1 table therefore you're recommended to create a transaction to perform any CRUD.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here are the code snippet&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;using (System.Transactions.TransactionScope scope = new&lt;br /&gt;System.Transactions.TransactionScope())&lt;br /&gt;{&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;//initialize it and&lt;br /&gt;the connection created&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;pfData&lt;/span&gt; = new &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;PersonalFinanceDataContext&lt;/span&gt;();&lt;br /&gt;&lt;br /&gt;//Create spending type, &lt;em&gt;the first table&lt;br /&gt;&lt;/em&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;SpendingType&lt;/span&gt;&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;spendingType&lt;/span&gt; = new &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;SpendingType&lt;/span&gt;();&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;spendingType&lt;/span&gt;.Name = &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;accountName&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//Create Account, &lt;em&gt;the second table&lt;/em&gt;&lt;br /&gt;Account &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;accPayable&lt;/span&gt; = new&lt;br /&gt;Account();&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;accPayable&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;AccountName&lt;/span&gt; = &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;accountName&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//Map them together, &lt;em&gt;by a mapper table&lt;br /&gt;&lt;/em&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;SpendingAccount&lt;/span&gt;&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;spendingAccount&lt;/span&gt; = new &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13"&gt;SpendingAccount&lt;/span&gt;();&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;spendingAccount&lt;/span&gt;.Account =&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;accPayable&lt;/span&gt;;&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;spendingAccount&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17"&gt;SpendingType&lt;/span&gt; = &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;spendingType&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;//remember to add into database context else everything will be&lt;br /&gt;lost!&lt;br /&gt;pfData.SpendingAccounts.Add(spendingAccount);&lt;br /&gt;&lt;br /&gt;//Save it&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_19"&gt;pfData&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_20"&gt;SubmitChanges&lt;/span&gt;();&lt;br /&gt;&lt;br /&gt;//commit it, &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_21"&gt;everything&lt;/span&gt; is successfully done!&lt;br /&gt;scope.Complete();&lt;br /&gt;}&lt;br /&gt;catch(Exception ex)&lt;br /&gt;{&lt;br /&gt;throw "Bad &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_22"&gt;linq&lt;/span&gt;" + ex;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;hope you have some basic idea of how easy that &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_23"&gt;linq&lt;/span&gt; to &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_24"&gt;sql&lt;/span&gt; could do for you.&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-6937697827908145794?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/6937697827908145794/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=6937697827908145794' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6937697827908145794'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6937697827908145794'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/02/linq-to-sql-snippet.html' title='Linq to SQL get started snippet example'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-8045880952077768172</id><published>2007-02-25T19:23:00.000+08:00</published><updated>2007-02-25T19:25:13.769+08:00</updated><title type='text'>ASP.NET skinning</title><content type='html'>I found this website really helps in skinning ASP.NET application. &lt;a href="http://www.dotnettreats.com/SampleThemes/"&gt;http://www.dotnettreats.com/SampleThemes/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-8045880952077768172?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/8045880952077768172/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=8045880952077768172' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8045880952077768172'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/8045880952077768172'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/02/aspnet-skinning.html' title='ASP.NET skinning'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-3631003754764440473</id><published>2007-02-25T17:18:00.000+08:00</published><updated>2007-02-25T18:04:04.464+08:00</updated><title type='text'>Carso Virtual University Proposal</title><content type='html'>&lt;p&gt;These are the proposed features of this project and I would invite you who are interested in realizing the Open Virtual University Program. &lt;/p&gt;&lt;p&gt;Core features:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Students and tutor membership management&lt;/li&gt;&lt;li&gt;Class scheduling, course booking and students &amp;amp; tutors' timetable management.&lt;/li&gt;&lt;li&gt;Students performance ranking and enrollment statistics.&lt;/li&gt;&lt;li&gt;Automated e-exam creation by selecting question from questions' bank.&lt;/li&gt;&lt;li&gt;Custom personal web pages for students and tutors.&lt;/li&gt;&lt;li&gt;Course materials management. File sharing, upload and download facilities. &lt;/li&gt;&lt;li&gt;Course enrollment system.&lt;/li&gt;&lt;li&gt;Voting and suggestion system.&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;Optional features.&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Thesis plagiarism detection. &lt;/li&gt;&lt;li&gt;Automated timetable scheduling system.&lt;/li&gt;&lt;li&gt;Subject's advisor expert&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;All these features would be implemented in &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;Dotnetnuke&lt;/span&gt;&lt;/span&gt; module. Any other web framework such as using community server 2.1 is under consideration. Custom ASP.NET framework maybe suggested.&lt;/p&gt;&lt;p&gt;I need 2 web designers specializing in skinning ASP.NET user interface. 5 software developers, 1 database designer. i will be your project manager i this &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;Carso's&lt;/span&gt;&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;VU&lt;/span&gt;&lt;/span&gt; project.&lt;/p&gt;&lt;p&gt;Please drop me a line if you wish to participate.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-3631003754764440473?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/3631003754764440473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=3631003754764440473' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3631003754764440473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3631003754764440473'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/02/carso-virtual-university-proposal.html' title='Carso Virtual University Proposal'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-2635260491151021222</id><published>2007-02-25T16:36:00.000+08:00</published><updated>2007-02-25T16:51:50.674+08:00</updated><title type='text'>Great codeproject articles for those interested in artificial intelligent</title><content type='html'>Today i came across this link &lt;a href="http://www.codeproject.com/script/Articles/list_articles.asp?userid=1181072"&gt;http://www.codeproject.com/script/Articles/list_articles.asp?userid=1181072&lt;/a&gt; and i found that the author Andrew Kirillov is wonderful in his those written articles. I have been a fan of artificial intelligent science since i was in high school. I would like to invite you guys 2-5 to work along with me a project called car parking system which is useful for finding empty car parking spaces. Besides, the system also suggest the shortest path and the most minimum time to obtain car parking space. The project would be implemented in Windows Mobile 5.0 and ASP.NET web application. Those who are interested please write some comment on this post.&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-2635260491151021222?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/2635260491151021222/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=2635260491151021222' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/2635260491151021222'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/2635260491151021222'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/02/great-codeproject-articles-for-those.html' title='Great codeproject articles for those interested in artificial intelligent'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-6240796391305380090</id><published>2007-02-23T18:11:00.000+08:00</published><updated>2007-02-23T18:50:23.094+08:00</updated><title type='text'>How to enable Secure Soket Layer SSL in IIS 5.0/6.0 Server using VeriSign?</title><content type='html'>If you are a web developer or web administrator, you often ask this common question. How to enable Secure Soket Layer SSL in IIS 5.0/6.0 Server using VeriSign's certificates? What is SSL? Simply we can say that SSL is a security technology that secure the communication between the sender and the receiver by protecting the data with strong encrytion that hopefully no body could read the encypted data.&lt;br /&gt;&lt;br /&gt;to enable the SSL in your IIS 5.0/6.0, you must follow these 10 steps shown below, no less and no more.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 1: &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Click "Server Certificates" under IIS &gt; Directory Security Tab&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;img id="BLOGGER_PHOTO_ID_5034672752459819506" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_ZJX-9msraUM/Rd7AMYq0qfI/AAAAAAAAAA0/_RnfTlAVHbY/s400/step1.jpg" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 2:&lt;/strong&gt; &lt;/p&gt;Please look at the screen which self explained.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;img id="BLOGGER_PHOTO_ID_5034673078877334018" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_ZJX-9msraUM/Rd7AfYq0qgI/AAAAAAAAAA8/n-Yf30I406I/s400/step002.jpg" border="0" /&gt;&lt;/p&gt;&lt;br /&gt;&lt;strong&gt;Step 3:&lt;/strong&gt;&lt;br /&gt;&lt;p&gt;Click Next, Next until you see this&lt;/p&gt;&lt;p&gt;&lt;img id="BLOGGER_PHOTO_ID_5034673718827461138" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_ZJX-9msraUM/Rd7BEoq0qhI/AAAAAAAAABE/U9XrSnPJ7As/s400/step003.jpg" border="0" /&gt; &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt;&lt;img id="BLOGGER_PHOTO_ID_5034674363072555554" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_ZJX-9msraUM/Rd7BqIq0qiI/AAAAAAAAABM/PjRP85DyFdU/s400/step004.jpg" border="0" /&gt;&lt;br /&gt;&lt;strong&gt;Step 5:&lt;/strong&gt;&lt;img id="BLOGGER_PHOTO_ID_5034674693785037362" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_ZJX-9msraUM/Rd7B9Yq0qjI/AAAAAAAAABU/J2hTlKGEgHc/s400/step005.jpg" border="0" /&gt;&lt;/p&gt;&lt;br /&gt;&lt;strong&gt;Step 6:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;After you have finished, you have to go to &lt;a href="http://www.verisign.com/"&gt;http://www.verisign.com/&lt;/a&gt; to create your &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;SSL&lt;/span&gt; certificate. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;Verisign&lt;/span&gt; 's &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;SSL&lt;/span&gt; certificate is not &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;FOC&lt;/span&gt;, however you could obtain a free 14 days trial for testing purposes. Please follow the instructions provided by &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;verisign&lt;/span&gt;, you have to sign up as member before you could create your &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;SSL&lt;/span&gt; certificate.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 7:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Assume that you are half way setup your &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6"&gt;SSL&lt;/span&gt; cert, you need to upload the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7"&gt;certreg&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8"&gt;txt&lt;/span&gt; which you just created in your &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9"&gt;IIS&lt;/span&gt;. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10"&gt;Verisign&lt;/span&gt; will read your &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11"&gt;certreg&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12"&gt;txt&lt;/span&gt; and confirm the &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_13"&gt;information&lt;/span&gt; to you. After all, &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14"&gt;Verisign&lt;/span&gt; will send you an e-mail to you.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Step 8:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;After you have received your e-mail, you will find that there is a funny string which look something like Ky456&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15"&gt;hJKLsM&lt;/span&gt;... printed at the end of your e-mail. Please copy and paste to a notepad and save it as &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16"&gt;vericert&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17"&gt;cer&lt;/span&gt;. You will need this later.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Step 9:&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;You will see this screen and just click next.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;img id="BLOGGER_PHOTO_ID_5034677781866523202" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_ZJX-9msraUM/Rd7ExIq0qkI/AAAAAAAAABc/GYfPiC-m8aI/s400/step006.jpg" border="0" /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Step 10:&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Browse the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18"&gt;vericert&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_19"&gt;cer&lt;/span&gt; which you had created in step 8:&lt;/p&gt;&lt;img id="BLOGGER_PHOTO_ID_5034678288672664146" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_ZJX-9msraUM/Rd7FOoq0qlI/AAAAAAAAABk/fJVSTm2x01E/s400/step007.jpg" border="0" /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Click next and you are done!&lt;/p&gt;&lt;p&gt;You can test drive your &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_20"&gt;IIS&lt;/span&gt; server by typing &lt;a href="https://localhost/"&gt;https://localhost/&lt;/a&gt; in your browser and please double click the security yellow color lock icon to preview the certificate &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_21"&gt;information&lt;/span&gt;.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-6240796391305380090?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/6240796391305380090/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=6240796391305380090' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6240796391305380090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6240796391305380090'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/02/how-to-enable-secure-soket-layer-ssl-in.html' title='How to enable Secure Soket Layer SSL in IIS 5.0/6.0 Server using VeriSign?'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_ZJX-9msraUM/Rd7AMYq0qfI/AAAAAAAAAA0/_RnfTlAVHbY/s72-c/step1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-4044386470466413060</id><published>2007-02-13T18:20:00.000+08:00</published><updated>2007-02-13T18:26:00.560+08:00</updated><title type='text'>Send e-mail by c# coding</title><content type='html'>So simple as this:&lt;br /&gt;&lt;br /&gt;using System.Net.Mail;&lt;br /&gt;&lt;br /&gt;MailMessage msgMail = new MailMessage("spammer@haqckers.net","carso@cheeweng.com","Your subject","your message");&lt;br /&gt;SmtpClient smtpC = new SmtpClient("localhost");&lt;br /&gt;smtpC.Send(msgMail);&lt;br /&gt;&lt;br /&gt;but you need to set your IIS smtp mail correctly. Check out below&lt;br /&gt;&lt;br /&gt;&lt;a href="http://codebetter.com/blogs/peter.van.ooijen/archive/2006/04/05/142331.aspx"&gt;http://codebetter.com/blogs/peter.van.ooijen/archive/2006/04/05/142331.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-4044386470466413060?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/4044386470466413060/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=4044386470466413060' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/4044386470466413060'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/4044386470466413060'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/02/send-e-mail-by-c-coding.html' title='Send e-mail by c# coding'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-54127943357309601</id><published>2007-02-13T17:34:00.000+08:00</published><updated>2007-02-13T02:21:18.354+08:00</updated><title type='text'>How to get my motherboard serial number using C#?</title><content type='html'>&lt;p&gt;Sometimes we might want to identity the unique user for some purposes by knowing the machine identity they are using. Software licensing for instance, we could use his machine processor Id or motherboard id to uniquely identify them. &lt;/p&gt;&lt;p&gt;&lt;br /&gt;So here are the tricks:&lt;/p&gt;&lt;p&gt;&lt;a href="http://carsolife.blogspot.com/2007/02/how-to-get-my-motherboard-serial-number.html"&gt;http://carsolife.blogspot.com/2007/02/how-to-get-my-motherboard-serial-number.html&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-54127943357309601?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/54127943357309601/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=54127943357309601' title='36 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/54127943357309601'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/54127943357309601'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/02/how-to-get-my-motherboard-serial-number.html' title='How to get my motherboard serial number using C#?'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>36</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-1128814741010260020</id><published>2007-02-13T01:44:00.000+08:00</published><updated>2007-02-13T00:39:03.878+08:00</updated><title type='text'>Are you interested in taking part in open virtual university program?</title><content type='html'>This virtual university project had started about a year and the project is written in ASP.NET C#. We want to take one step further to port this whole project to dotnetnuke's modules. If you are interested in joining this program, please go to this link for more infomation.&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&lt;a href="http://babi.myftp.org/bbs/blogs/artifician/archive/2007/02/13/carso-s-open-virtual-university.aspx"&gt;http://babi.myftp.org/bbs/blogs/artifician/archive/2007/02/13/carso-s-open-virtual-university.aspx&lt;/a&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-1128814741010260020?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://babi.myftp.org/bbs/blogs/artifician/archive/2007/02/13/carso-s-open-virtual-university.aspx' title='Are you interested in taking part in open virtual university program?'/><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/1128814741010260020/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=1128814741010260020' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1128814741010260020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1128814741010260020'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/02/are-you-interested-in-taking-part-in.html' title='Are you interested in taking part in open virtual university program?'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-5049477504752090284</id><published>2007-02-13T00:26:00.000+08:00</published><updated>2007-02-13T00:36:05.487+08:00</updated><title type='text'>EnableSessionState, ASP.NET most common error</title><content type='html'>&lt;blockquote&gt;&lt;p&gt;Session state can only be used when &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;enableSessionState&lt;/span&gt; is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the &lt;*configuration*&gt;*\*&lt;system.web&gt;*\*&lt;*httpModules*&gt; section in the application configuration. &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;br /&gt;When you'll encounter this kind of error? This &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;occur&lt;/span&gt; when u are using state in your ASP.NET pages. For instance, you might be using &lt;/p&gt;&lt;p&gt;Session["&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;Username&lt;/span&gt;"] = "&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3"&gt;Carso&lt;/span&gt; Owen"; //in your c# code&lt;/p&gt;&lt;p&gt;The solution is you need to do these 3 things in your ASP.NET web.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4"&gt;config&lt;/span&gt;:&lt;/p&gt;&lt;p&gt;1. locate under the &lt;*system.web*&gt; &lt;*sessionState mode = "InProc"/*&gt; ... &lt;*/system.web*&gt;&lt;/p&gt;&lt;p&gt;2.  modify the &lt;*httpModules*&gt;&lt;*add name="session" type="System.Web.SessionState.SessionStateModule"/*&gt;&lt;/p&gt;&lt;p&gt;3. modify &lt;*pages enableSessionState="true" */&gt;&lt;/p&gt;&lt;p&gt;P/s : &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;plz&lt;/span&gt; ignore the those * in the above.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-5049477504752090284?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/5049477504752090284/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=5049477504752090284' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/5049477504752090284'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/5049477504752090284'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/02/enablesessionstate-aspnet-most-common.html' title='EnableSessionState, ASP.NET most common error'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-3271926397162574976</id><published>2007-02-11T19:07:00.000+08:00</published><updated>2007-02-11T16:50:13.576+08:00</updated><title type='text'>Before you start your software project, what's the first thing you do?</title><content type='html'>Before you start your software project, what's the first thing you do? For me i will backup my project first before continuing. Why, simply because i could undo it if something goes wrong, at least i could save my preciuos time. Let say, you are hadling a project A and you have spend the first 2 hours doing something wonderful, later on you did something funny and your whole project corrupted. fortunetly after spending 20minutes to find the the cause of the problems, you got the solution and then you spend another 30minutes to fix it, complile it and test it. You almost got there just a few step to fully recover it and it takes another 30 minutes for through testing. Finally you just got to recover the whole thing. In this senario how much time you have spend to recover it? it is almost 1 and a half hour doing something which is not productive. imagine that if you had "rar" (backup) the project at the first place and later you recover it via unrar it. how long does "unrar" takes? 2minutes vs 90minutes. Got it?&lt;br /&gt;&lt;br /&gt;Let me show you the simple and yet effective way of backup your software project.&lt;br /&gt;&lt;br /&gt;Let say your project is save under ProjectA, now you pretty sure that ProjectA iteration task is completed and you wish to backup it. So just rar it to ProjectA_V1.rar, well this is your first version of backup. You continue again your development iteration, after each successful task is done you rar it again, and now you rar it as ProjectA_V2 and so on and so forth.&lt;br /&gt;&lt;br /&gt;When you encountered a corruption on your project and now you wish to recover it, therefore you look for the lastest .rar that you have backup.&lt;br /&gt;&lt;br /&gt;One interesting question, why rar it? rar it could save your disk space but this is not the main reason. The only reason is because you pretty sure that you do not accidently modify the file inside the folder in case you did not rar it.&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-3271926397162574976?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/3271926397162574976/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=3271926397162574976' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3271926397162574976'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/3271926397162574976'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/02/before-you-start-your-software-project.html' title='Before you start your software project, what&apos;s the first thing you do?'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-592460067375894994</id><published>2007-02-11T02:54:00.000+08:00</published><updated>2007-02-28T09:10:40.851+08:00</updated><title type='text'>A personal accounting needed is to keep track your money</title><content type='html'>I have a great and yet simple proposal to create a website to manage our personal accounting because i found that it is too tedious to enter my spending records in &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_0"&gt;excel&lt;/span&gt; file. What is your opinion? I need a program that could validate data entries, tracking my spending and show some useful &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;information&lt;/span&gt; regarding my spending habits. It must be web ready of course so that you all can be able to take advantage of it. &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2" onclick="BLOG_clickHandler(this)"&gt;Btw&lt;/span&gt;, it must be able to generate a report of account transactions at the end of the month. Any suggestion of my idea, please comment it. &lt;blockquote&gt;&lt;p&gt;FYI, I would like to invite you to have a preview of this project which is still in pre-release stage.&lt;/p&gt;&lt;p&gt;&lt;a href="http://babi.myftp.org/bbs/PersonalSpending/"&gt;http://babi.myftp.org/bbs/PersonalSpending/&lt;/a&gt; ( Beta 1 release)&lt;/p&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-592460067375894994?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/592460067375894994/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=592460067375894994' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/592460067375894994'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/592460067375894994'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/02/personal-accounting-needed-is-to-keep.html' title='A personal accounting needed is to keep track your money'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-5336289292127151216</id><published>2007-02-10T14:16:00.000+08:00</published><updated>2007-02-10T15:30:17.138+08:00</updated><title type='text'>My ASP.NET pages corrupted when i changed my database structure.</title><content type='html'>We often heard about N-tier designs in software development and the reason of having this design is because we want to achieve the highest degree of software scalability. This comes with a price which means more development time has to be invested. Sometimes, because of budget and time constrains, we have to sacrifice in some way to trade of to productivity. Visual Studio 2005 has a very nice features which is known as table adapter and dataset that actually helps developers to gain significant productivity in data binding over user interface (UI) design. You will be amazed that only a few lines of code or without any coding, you could bind data from your database's table to your UI's control. This also means that, any changes in your database structure, it will actually corrupts or malfunctions your UI.&lt;br /&gt;&lt;br /&gt;In my own experince, i was writting an ASP.NET application which uses SQL Server 2005 &amp; Visual Studio 2005. Later, i discovered that i needed to update my database structure because i wanted to add some extra functionalities, so i need to add and delete a few database (db) tables, renaming some of my existing db's tables. Some changes had significant impact on my application while some had not. Therefore i needed to take this into consideration as well. After i had made the changes, I found that my data access logic layer seem to be useless because data access code actually maps back to the database structure, therefore it was no suprise. Luckly, my web application is 3-Tiers design which allows me to replace it with a new code generated data access layer (DAL). This is the most simplest part. Now it comes for modifying the business logic layer (BLL), because this layer actually calls your DAL, therefore changes need to be performed , you can't throw away your BLL and replaced it, you just need to spend your time modifying the calling object to your database.&lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;&lt;br /&gt;Notes, renaming your tables and column names or deleting tables have the most&lt;br /&gt;significant impact on yur BLL, on the other hand, adding new columns or tables&lt;br /&gt;are not. (it depends how smart your ORM generator) . &lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;p&gt;After i'd made the changes and to make sure my BLL talks well with my DAL, then I need to make sure my UI calls my BLL well. Do i need to make changes to my UI code to make sure it talks well with my BLL? The answer is yes and no. if you expose your BLL as services interface then no changes nessary to your UI code, The answer is no and assuming that you want to preserve your previous functionality. If  you do not have interface class, method overloading and constructor overloading presented in your BLL design, then the answer is yes and most problably that you need to make some changes to reflex your BLL :)&lt;br /&gt;&lt;br /&gt;Finally, what if i am using this VS table adapter and dataset to bind data? The best answer is you have to check and make sure they are actually maps to your database's tables correctly, otherwise you need to regenerate or redesign your databinding again. However, this modification is not tredius and time consuming as you might think.&lt;br /&gt;&lt;br /&gt;The question is how to eliminate these problems of code changes when database structure is being modified? In my personal opinion, i don't think we have the economically way to eliminate these problems. What we really care is try to make your UI design as simple as possible by abstracting the object calling either business layer or database layer. By this means, you are pretty save when disaster comes, you could easily solve it because you just made it simple.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-5336289292127151216?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/5336289292127151216/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=5336289292127151216' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/5336289292127151216'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/5336289292127151216'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/02/my-aspnet-pages-corrupted-when-i.html' title='My ASP.NET pages corrupted when i changed my database structure.'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-7223020644787313433</id><published>2007-02-08T19:58:00.000+08:00</published><updated>2007-02-08T20:52:24.172+08:00</updated><title type='text'>.NET deployment, i am stuck</title><content type='html'>Today i was nearly mad when i tried to deploy a CAB module. Initially, i need to deploy all the 10 modules however one of the module nearly make me crazy the whole day. What had happened was the module which I was deploying, could be installed successfully, however it was causing my application not to be loaded. I tried to figure out the causes of the problem and i found that during installation, some of my assemblies are replaced and therefore my application couldn't linked. Therefore i tried to deploy only those assemblies which are needed manually ( by default VS.NET will auto take care of it). There came another problem, the problem was that when i tried to deploy a assembly, let say &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0" onclick="BLOG_clickHandler(this)"&gt;moduleA&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1" onclick="BLOG_clickHandler(this)"&gt;dll&lt;/span&gt;, all those dependencies of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2" onclick="BLOG_clickHandler(this)"&gt;moduleA&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3" onclick="BLOG_clickHandler(this)"&gt;dll&lt;/span&gt; will be auto deployed together with the &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4" onclick="BLOG_clickHandler(this)"&gt;moduleA&lt;/span&gt;. This is not what I wanted because the reason behind are those dependencies that causes the failure. I had tried various ways and I nearly going crazy. Suddenly i thought of one idea, what if i copied the assembly into another directory, let say I placed my &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5" onclick="BLOG_clickHandler(this)"&gt;moduleA&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6" onclick="BLOG_clickHandler(this)"&gt;dll&lt;/span&gt; on to my desktop, and in hope that VS.NET is not so intelligent enough to detect those dependencies .&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7" onclick="BLOG_clickHandler(this)"&gt;dlls&lt;/span&gt; of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8" onclick="BLOG_clickHandler(this)"&gt;moduleA&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9" onclick="BLOG_clickHandler(this)"&gt;dll&lt;/span&gt;. Yahoo0o... now i managed to deploy those assembly that i want.&lt;br /&gt;&lt;br /&gt;The conclusion is, way is always there, just be a bit creative when finding solutions. :) &lt;blockquote&gt;&lt;/blockquote&gt;&lt;blockquote&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-7223020644787313433?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/7223020644787313433/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=7223020644787313433' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/7223020644787313433'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/7223020644787313433'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/02/net-deployment-project.html' title='.NET deployment, i am stuck'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-1001485690904361751</id><published>2007-02-07T21:48:00.000+08:00</published><updated>2007-02-07T23:43:52.903+08:00</updated><title type='text'>Hash code, what the hack of that?</title><content type='html'>well u always heard of encryption and hashing in security context, if we have encryption to protect our data, then why we need to hash?&lt;br /&gt;&lt;br /&gt;FYI, we use hash code for 2 most common things, which are&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;li&gt;Verify data integrity, to make sure the the data is always original and the right data&lt;/li&gt;&lt;li&gt;Used to store password, not original password but hashed&lt;br /&gt;password. &lt;/li&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;em&gt;Verify data integrity (use keyed hash code for better security)&lt;/em&gt;&lt;/p&gt;&lt;p&gt;let say a person A wants to send a file via e-mail to person B. person B wants to ensure that the file in the e-mail has not been intercepted, therefore person B need to generate hash code of the file received by him (person B) and compare it with the hash code of the file generated which sent &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_0"&gt;together&lt;/span&gt; &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;with&lt;/span&gt; the original text by the person A. if both the hash codes are equal in comparison, then the file is original and had not been altered, otherwise the data had been corrupted or intercepted. &lt;/p&gt;&lt;p&gt;example of keyed hash code :&lt;/p&gt;&lt;p&gt;you can use &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0" onclick="BLOG_clickHandler(this)"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2" onclick="BLOG_clickHandler(this)"&gt;HMACSHA&lt;/span&gt;&lt;/span&gt;1 or &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1" onclick="BLOG_clickHandler(this)"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3" onclick="BLOG_clickHandler(this)"&gt;MACTripleDES&lt;/span&gt;&lt;/span&gt;, using &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2" onclick="BLOG_clickHandler(this)"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4" onclick="BLOG_clickHandler(this)"&gt;HMACSHA&lt;/span&gt;&lt;/span&gt;1 has better flexibility since it can support any key size in bits and up to 160bits of hash code size.&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3" onclick="BLOG_clickHandler(this)"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5" onclick="BLOG_clickHandler(this)"&gt;HMACSHA&lt;/span&gt;&lt;/span&gt;1 &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4" onclick="BLOG_clickHandler(this)"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6" onclick="BLOG_clickHandler(this)"&gt;haHMACSHA&lt;/span&gt;&lt;/span&gt;1 = new&lt;br /&gt;HMACSHA1(Encoding.Unicode.GetBytes("&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5" onclick="BLOG_clickHandler(this)"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7" onclick="BLOG_clickHandler(this)"&gt;secretKey&lt;/span&gt;&lt;/span&gt;"));&lt;br /&gt;byte[] &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6" onclick="BLOG_clickHandler(this)"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8" onclick="BLOG_clickHandler(this)"&gt;hashedData&lt;/span&gt;&lt;/span&gt; =&lt;br /&gt;haHMACSHA1.ComputeHash(Encoding.Default.GetBytes("My important&lt;br /&gt;data."));&lt;br /&gt;string &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7" onclick="BLOG_clickHandler(this)"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9" onclick="BLOG_clickHandler(this)"&gt;hashedCode&lt;/span&gt;&lt;/span&gt; = &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8" onclick="BLOG_clickHandler(this)"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10" onclick="BLOG_clickHandler(this)"&gt;BitConverter&lt;/span&gt;&lt;/span&gt;.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9" onclick="BLOG_clickHandler(this)"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11" onclick="BLOG_clickHandler(this)"&gt;ToString&lt;/span&gt;&lt;/span&gt;(&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10" onclick="BLOG_clickHandler(this)"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12" onclick="BLOG_clickHandler(this)"&gt;hashedData&lt;/span&gt;&lt;/span&gt;); &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;since the sender and the receiver knows the "&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11" onclick="BLOG_clickHandler(this)"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_13" onclick="BLOG_clickHandler(this)"&gt;secretKey&lt;/span&gt;&lt;/span&gt;"; only the right "&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12" onclick="BLOG_clickHandler(this)"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14" onclick="BLOG_clickHandler(this)"&gt;secretKey&lt;/span&gt;"&lt;/span&gt; can produce the right hash code comparing the hash code of the file from the sender, &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_13"&gt;therefore&lt;/span&gt; transmitting file will be more secure to avoid someone intercepting the file in case the hacker had created a faked data with hash code of its faked data. In this way, you not only be able to ensure the data is unchanged during transmission and it also ensure you that the data integrity.&lt;/p&gt;&lt;p&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt;&lt;p&gt;&lt;em&gt;Used to store password&lt;/em&gt;&lt;/p&gt;&lt;p&gt;Do you know that hashed password is quite impossible to compute back to original password? How to derive this&lt;br /&gt;4B-E1-ED-D7-38-8A-AF-D5-A4-&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_14" onclick="BLOG_clickHandler(this)"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_15" onclick="BLOG_clickHandler(this)"&gt;BD&lt;/span&gt;&lt;/span&gt;-D0-30-41-A8-34-7E-A1-84-E1-79-87-E8-7A-AA-79-2F-6D-7B-71-BA-01-A7 back to original data? The fact it is nearly impossible with any advance algorithm. Hash code is one way cryptographic functions. Therefore, if your customer said that he has lost the password and would like to &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_15"&gt;retrieve&lt;/span&gt; it, the solution is to create a new password for him. That's all.&lt;/p&gt;&lt;p&gt;In real world, security expert will suggests that storing hashed password instead of plain text password in their database for security reason; system uses the stored hash code to compare with the computed hash code of password by the user. First the reason is because, no one could know what the user real password in the database even the database administrator. &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_16"&gt;Secondly&lt;/span&gt;, a small different in password will result significant different in hash code of password, therefore it will be very hard to guess the hash code pattern given the relationship between a list of hash codes.&lt;/p&gt;&lt;p&gt;example of hash code :&lt;/p&gt;&lt;p&gt;you can use MD5 (128bits), &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17" onclick="BLOG_clickHandler(this)"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_16" onclick="BLOG_clickHandler(this)"&gt;SHA&lt;/span&gt;&lt;/span&gt;1(160bits), &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18" onclick="BLOG_clickHandler(this)"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_17" onclick="BLOG_clickHandler(this)"&gt;SHA&lt;/span&gt;&lt;/span&gt;256(256bits)....&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_19" onclick="BLOG_clickHandler(this)"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_18" onclick="BLOG_clickHandler(this)"&gt;SHA&lt;/span&gt;&lt;/span&gt;512(512bits) algorithms. &lt;/p&gt;&lt;blockquote&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_21" onclick="BLOG_clickHandler(this)"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_20" onclick="BLOG_clickHandler(this)"&gt;HashAlgorithm&lt;/span&gt;&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_22" onclick="BLOG_clickHandler(this)"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_21" onclick="BLOG_clickHandler(this)"&gt;haSHA&lt;/span&gt;&lt;/span&gt;256 = &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_23" onclick="BLOG_clickHandler(this)"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_22" onclick="BLOG_clickHandler(this)"&gt;HashAlgorithm&lt;/span&gt;&lt;/span&gt;.Create("&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_24" onclick="BLOG_clickHandler(this)"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_23" onclick="BLOG_clickHandler(this)"&gt;SHA&lt;/span&gt;&lt;/span&gt;256");&lt;br /&gt;byte[] password =&lt;br /&gt;Encoding.Default.GetBytes("MyPasSWoRd");&lt;br /&gt;string &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_25" onclick="BLOG_clickHandler(this)"&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_24" onclick="BLOG_clickHandler(this)"&gt;hashedPassword&lt;/span&gt;&lt;/span&gt; =&lt;br /&gt;BitConverter.ToString(haSHA256.ComputeHash(password)); &lt;/blockquote&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;simple? Next i will discuss about applying encryption into your code.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-1001485690904361751?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/1001485690904361751/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=1001485690904361751' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1001485690904361751'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/1001485690904361751'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/02/hash-code-what-hack-of-that.html' title='Hash code, what the hack of that?'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-2684853643237161023</id><published>2007-02-07T17:34:00.000+08:00</published><updated>2007-02-07T17:38:06.845+08:00</updated><title type='text'>How to start a command prompt by coding using C# .NET?</title><content type='html'>Try this:&lt;br /&gt;&lt;br /&gt;using System.Diagnostics;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;ProcessStartInfo psi = new ProcessStartInfo("sqlcmd", "calc");&lt;br /&gt;Process proc&lt;br /&gt;= Process.Start(psi);&lt;br /&gt;proc.Start();&lt;br /&gt;proc.Close(); &lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Guess what program will show up?&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-2684853643237161023?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/2684853643237161023/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=2684853643237161023' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/2684853643237161023'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/2684853643237161023'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/02/how-to-start-command-prompt-by-coding.html' title='How to start a command prompt by coding using C# .NET?'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-7867425488223730386</id><published>2007-02-07T14:50:00.000+08:00</published><updated>2007-02-07T15:23:43.796+08:00</updated><title type='text'>Why toggling control?</title><content type='html'>A good software need be simple and able to hide those complexity contains in the software. User interface (UI) design is &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_0"&gt;extremely&lt;/span&gt; important to make sure your software look simple. One of the tips that i find very &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_1"&gt;useful&lt;/span&gt; technique is 'toggling control' to be applied in your &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2" onclick="BLOG_clickHandler(this)"&gt;UI&lt;/span&gt; design. What does this means? We toggle control because we want to limit a user to access of some controls (mind his business). if fewer choices means fewer mistakes made by user. We can either disable or enable those controls ; or we can visible or invisible them.&lt;br /&gt;&lt;br /&gt;Here is a good example:&lt;br /&gt;&lt;br /&gt;Create a method so that it can be used again and again&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;public void &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3" onclick="BLOG_clickHandler(this)"&gt;ToggleControl&lt;/span&gt;(&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4" onclick="BLOG_clickHandler(this)"&gt;bool&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5" onclick="BLOG_clickHandler(this)"&gt;enableToggle&lt;/span&gt;)&lt;br /&gt;{&lt;br /&gt;if (&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6" onclick="BLOG_clickHandler(this)"&gt;enableToggle&lt;/span&gt;)&lt;br /&gt;{&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7" onclick="BLOG_clickHandler(this)"&gt;txtEmail&lt;/span&gt;.Enabled = true;&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8" onclick="BLOG_clickHandler(this)"&gt;txtUsername&lt;/span&gt;.Enabled =&lt;br /&gt;true;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9" onclick="BLOG_clickHandler(this)"&gt;txtEmail&lt;/span&gt;.Enabled = false;&lt;/p&gt;&lt;p&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10" onclick="BLOG_clickHandler(this)"&gt;txtUsername&lt;/span&gt;.Enabled = false;&lt;br /&gt;}&lt;br /&gt;} &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;so u can call this method as simple as &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11" onclick="BLOG_clickHandler(this)"&gt;ToggleControl&lt;/span&gt;(true) to enable the control otherwise &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_12" onclick="BLOG_clickHandler(this)"&gt;ToggleControl&lt;/span&gt;(false) to disable it.&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-7867425488223730386?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/7867425488223730386/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=7867425488223730386' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/7867425488223730386'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/7867425488223730386'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/02/why-toggling-control.html' title='Why toggling control?'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5705257284633178319.post-6699142986703258022</id><published>2007-02-07T13:38:00.000+08:00</published><updated>2007-02-07T19:46:49.996+08:00</updated><title type='text'>How to get the file from OpenFileDialog and copy the file in another directory?</title><content type='html'>Sometimes, your boss might ask you to read a product pricing file and manipulate it such as extracting the infomation and format it accordingly and save it back to a text file. In this case, the code below show you how u can use the .NET win control using OpenFileDialog class to provide a standard windows' open file dialog for your user to select a file and use the file to be manipulated. Here is the example:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;using System.IO;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;private void CopyFile2DirA()&lt;br /&gt;{&lt;/p&gt;&lt;p&gt;&lt;br /&gt;// Create an OpenFileDialog&lt;br /&gt;to request a file to open.&lt;br /&gt;OpenFileDialog openFile1 =&lt;br /&gt;openFileDialog1; &lt;/p&gt;&lt;p&gt;&lt;br /&gt;//Open the file and extract the infomation into tempstr&lt;/p&gt;&lt;p&gt;string tempstr = "";&lt;br /&gt;using&lt;br /&gt;(FileStream fs = (FileStream)openFile1.OpenFile())&lt;br /&gt;{&lt;br /&gt;byte[] b = new&lt;br /&gt;byte[fs.Length];&lt;br /&gt;UTF8Encoding temp = new UTF8Encoding(true);&lt;br /&gt;while&lt;br /&gt;(fs.Read(b, 0, b.Length) &gt; 0)&lt;br /&gt;{&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0" onclick="BLOG_clickHandler(this)"&gt;tempstr&lt;/span&gt; += temp.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1" onclick="BLOG_clickHandler(this)"&gt;GetString&lt;/span&gt;(b);&lt;br /&gt;}&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2" onclick="BLOG_clickHandler(this)"&gt;fs&lt;/span&gt;.Close();&lt;br /&gt;}&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;//update the extracted data&lt;/p&gt;&lt;p&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_3" onclick="BLOG_clickHandler(this)"&gt;tempstr&lt;/span&gt; += &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_4" onclick="BLOG_clickHandler(this)"&gt;tempstr&lt;/span&gt; + " here some modified data.";&lt;/p&gt;&lt;p&gt;//save the file inside your executing directory&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5" onclick="BLOG_clickHandler(this)"&gt;DirectoryInfo&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_6" onclick="BLOG_clickHandler(this)"&gt;dinfo&lt;/span&gt; =&lt;br /&gt;new&lt;br /&gt;&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_7" onclick="BLOG_clickHandler(this)"&gt;DirectoryInfo&lt;/span&gt;(&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_8" onclick="BLOG_clickHandler(this)"&gt;openFile&lt;/span&gt;1.&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_9" onclick="BLOG_clickHandler(this)"&gt;FileName&lt;/span&gt;);&lt;br /&gt;File.WriteAllText(AppDomain.CurrentDomain.BaseDirectory&lt;br /&gt;+ "\\" + &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_10" onclick="BLOG_clickHandler(this)"&gt;dinfo&lt;/span&gt;.Name,&lt;span class="blsp-spelling-error" id="SPELLING_ERROR_11" onclick="BLOG_clickHandler(this)"&gt;tempstr&lt;/span&gt;);&lt;br /&gt;}&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;That's it, now check the newly created file.&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;xml&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5705257284633178319-6699142986703258022?l=carso-owen.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://carso-owen.blogspot.com/feeds/6699142986703258022/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=5705257284633178319&amp;postID=6699142986703258022' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6699142986703258022'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5705257284633178319/posts/default/6699142986703258022'/><link rel='alternate' type='text/html' href='http://carso-owen.blogspot.com/2007/02/how-to-get-file-from-openfiledialog-and.html' title='How to get the file from OpenFileDialog and copy the file in another directory?'/><author><name>Carso Leong</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://3.bp.blogspot.com/_ZJX-9msraUM/ScTid-R5omI/AAAAAAAAAJM/TBrdarAntWM/S220/haagen-dazs.JPG'/></author><thr:total>0</thr:total></entry></feed>
