<?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-1104336261586813151</id><updated>2011-07-28T15:33:20.196-07:00</updated><category term='LINQ'/><category term='Architecture'/><category term='SQL'/><category term='MS SQL Server'/><category term='Philosophy'/><category term='Object oriented programming'/><category term='.NET Framework'/><category term='ADO.NET Data Services'/><category term='Web development'/><category term='Java'/><category term='WPF'/><category term='ASP.NET'/><category term='Silverlight'/><title type='text'>2B || !2B (to be or not to be)</title><subtitle type='html'>Either write something worth reading or do something worth writing</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://tomasbosak.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://tomasbosak.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Tom!</name><uri>http://www.blogger.com/profile/03078924436861485668</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://1.bp.blogspot.com/_REiym_3H-dw/SZdOAltBVSI/AAAAAAAAAVk/OSlL3AgI6yo/S220/Don.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>21</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1104336261586813151.post-1033848956393821571</id><published>2009-12-10T11:50:00.001-08:00</published><updated>2009-12-10T11:54:06.804-08:00</updated><title type='text'>New blog on my own website</title><content type='html'>From now I will continue blogging on my own website - &lt;a href="http://tomi.developmententity.sk/"&gt;http://tomi.developmententity.sk/&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1104336261586813151-1033848956393821571?l=tomasbosak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomasbosak.blogspot.com/feeds/1033848956393821571/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1104336261586813151&amp;postID=1033848956393821571' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/1033848956393821571'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/1033848956393821571'/><link rel='alternate' type='text/html' href='http://tomasbosak.blogspot.com/2009/12/new-blog-on-my-own-website.html' title='New blog on my own website'/><author><name>Tom!</name><uri>http://www.blogger.com/profile/03078924436861485668</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://1.bp.blogspot.com/_REiym_3H-dw/SZdOAltBVSI/AAAAAAAAAVk/OSlL3AgI6yo/S220/Don.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1104336261586813151.post-710433101411296175</id><published>2009-08-31T08:52:00.000-07:00</published><updated>2009-08-31T09:12:45.547-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web development'/><category scheme='http://www.blogger.com/atom/ns#' term='Silverlight'/><category scheme='http://www.blogger.com/atom/ns#' term='ADO.NET Data Services'/><title type='text'>Calling service operation in ADO.NET Data Services from Silverlight</title><content type='html'>&lt;p&gt;&lt;br /&gt;&lt;b&gt;Goal:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Call service operation for user authentication programatically from Silverlight codebehind file. &lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Setting rules for service operation:&lt;/b&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public static void InitializeService(IDataServiceConfiguration config)&lt;br /&gt;{&lt;br /&gt;    config.SetEntitySetAccessRule("*", EntitySetRights.None);&lt;br /&gt;    config.SetServiceOperationAccessRule("Authenticate", ServiceOperationRights.AllRead);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Service operation in ADO.NET Data Service:&lt;/b&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;[SingleResult]&lt;br /&gt;[WebGet]&lt;br /&gt;public bool Authenticate(string login, string password)&lt;br /&gt;{&lt;br /&gt;    var result = from q in this.CurrentDataSource.Users&lt;br /&gt;                 where q.Login == login &amp;&amp; q.Password == password&lt;br /&gt;                 select q.Login;&lt;br /&gt;&lt;br /&gt;    if (result.Count() == 1)&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;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Calling the service operation from Silverlight:&lt;/b&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;private PublicService.MyEntities _publicService;&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;private void Button_Login_Click(object sender, RoutedEventArgs e)&lt;br /&gt;{&lt;br /&gt;    _publicService = new PublicService.MyEntities(new Uri("PublicService.svc", UriKind.Relative));&lt;br /&gt;&lt;br /&gt;    _publicService.BeginExecute&lt;bool&gt;(new Uri("Authenticate?login='username'&amp;password='password'", UriKind.RelativeOrAbsolute), OnAuthenticationComplete, null);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private void OnAuthenticationComplete(IAsyncResult result)&lt;br /&gt;{&lt;br /&gt;    bool isAuthenticated = _publicService.EndExecute&lt;bool&gt;(result).ToList().First();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1104336261586813151-710433101411296175?l=tomasbosak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomasbosak.blogspot.com/feeds/710433101411296175/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1104336261586813151&amp;postID=710433101411296175' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/710433101411296175'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/710433101411296175'/><link rel='alternate' type='text/html' href='http://tomasbosak.blogspot.com/2009/08/calling-service-operation-in-adonet.html' title='Calling service operation in ADO.NET Data Services from Silverlight'/><author><name>Tom!</name><uri>http://www.blogger.com/profile/03078924436861485668</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://1.bp.blogspot.com/_REiym_3H-dw/SZdOAltBVSI/AAAAAAAAAVk/OSlL3AgI6yo/S220/Don.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1104336261586813151.post-6753498028491215918</id><published>2009-02-15T06:32:00.000-08:00</published><updated>2009-02-15T07:14:43.691-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LINQ'/><title type='text'>JOIN in LINQ</title><content type='html'>&lt;b&gt;Model situation:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_REiym_3H-dw/SZgpL6J8SEI/AAAAAAAAAV8/0ARIdFwwq7Q/s1600-h/LINQJOIN.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 75px;" src="http://2.bp.blogspot.com/_REiym_3H-dw/SZgpL6J8SEI/AAAAAAAAAV8/0ARIdFwwq7Q/s400/LINQJOIN.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5303033845795014722" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;b&gt;Goal:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Get list of all products with lookup names of its categories, catalogs, subdomains and domains.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;LINQ code:&lt;/b&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;from q in Products &lt;br /&gt;join q1 in Categories on q.CategoryID equals q1.ID &lt;br /&gt;join q2 in Catalogs on q1.CatalogID equals q2.ID&lt;br /&gt;join q3 in SubDomains on q2.SubDomainID equals q3.ID&lt;br /&gt;join q4 in Domains on q3.DomainID equals q4.ID&lt;br /&gt;select new &lt;br /&gt;{ &lt;br /&gt;    Domain = q4.Domain,&lt;br /&gt;    SubDomanin = q3.SubDomain, &lt;br /&gt;    Catalog = q2.Catalog, &lt;br /&gt;    Category = q1.Category, &lt;br /&gt;    Product = q.Title &lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Result&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_REiym_3H-dw/SZgvb-ERD3I/AAAAAAAAAWE/ib8JwnzcVN0/s1600-h/LINQJOINResult.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 166px;" src="http://3.bp.blogspot.com/_REiym_3H-dw/SZgvb-ERD3I/AAAAAAAAAWE/ib8JwnzcVN0/s400/LINQJOINResult.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5303040718792626034" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1104336261586813151-6753498028491215918?l=tomasbosak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomasbosak.blogspot.com/feeds/6753498028491215918/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1104336261586813151&amp;postID=6753498028491215918' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/6753498028491215918'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/6753498028491215918'/><link rel='alternate' type='text/html' href='http://tomasbosak.blogspot.com/2009/02/join-in-linq.html' title='JOIN in LINQ'/><author><name>Tom!</name><uri>http://www.blogger.com/profile/03078924436861485668</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://1.bp.blogspot.com/_REiym_3H-dw/SZdOAltBVSI/AAAAAAAAAVk/OSlL3AgI6yo/S220/Don.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_REiym_3H-dw/SZgpL6J8SEI/AAAAAAAAAV8/0ARIdFwwq7Q/s72-c/LINQJOIN.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1104336261586813151.post-5842359902888764770</id><published>2009-01-27T13:12:00.000-08:00</published><updated>2009-01-27T14:16:42.399-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET Framework'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Processing Eval in ASP.NET</title><content type='html'>&lt;div align="justify"&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Recently I was wondering how to process some databinded value inside ASP.NET ListView which datasource have already been set to generic list of news objects with properties like title, description and announced date. The problem was that I wanted to insert a picture before the title when the specific condition, involving processing of announced date property, is fulfilled. Below is the solution that uses method called ImageInsert with Eval parameter and which is defined in codebehind file.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;ASP.NET page code:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-size: 10px;"&gt;&lt;br /&gt;&amp;lt;asp:ListView runat="server" ID="ListView_News" DataSource="news"&amp;gt;&lt;br /&gt;    &amp;lt;LayoutTemplate&amp;gt;&lt;br /&gt;        &amp;lt;asp:PlaceHolder runat="server" ID="itemPlaceholder"&amp;gt;&amp;lt;/asp:PlaceHolder&amp;gt;&lt;br /&gt;    &amp;lt;/LayoutTemplate&amp;gt;&lt;br /&gt;    &lt;br /&gt;    &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;        &amp;lt;div class="announcementBlock"&amp;gt;&lt;br /&gt;            &amp;lt;span style="font-weight: bold; float: left;"&amp;gt;&lt;br /&gt;                &amp;lt;%# ImageInsert(Eval("DTAnnounced", "{0:d}"))%&amp;gt;&lt;br /&gt;                &amp;nbsp;&lt;br /&gt;                &amp;lt;%#Eval("Title") %&amp;gt;&lt;br /&gt;            &amp;lt;/span&amp;gt;&lt;br /&gt;            &amp;lt;span style="font-weight: bold; float: right;"&amp;gt;&lt;br /&gt;                &amp;lt;%#Eval("DTAnnounced", "{0:d}")%&amp;gt;&lt;br /&gt;            &amp;lt;/span&amp;gt;&lt;br /&gt;            &amp;lt;br /&amp;gt;&lt;br /&gt;            &amp;lt;br /&amp;gt;&lt;br /&gt;            &amp;lt;%#Eval("Description") %&amp;gt;&lt;br /&gt;            &amp;lt;br /&amp;gt;&lt;br /&gt;        &amp;lt;/div&amp;gt;&lt;br /&gt;        &amp;lt;br /&amp;gt;&lt;br /&gt;    &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;    &lt;br /&gt;    &amp;lt;EmptyDataTemplate&amp;gt;&lt;br /&gt;        No Data!&lt;br /&gt;    &amp;lt;/EmptyDataTemplate&amp;gt;&lt;br /&gt;&amp;lt;/asp:ListView&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;C# code in codebehing of ASP.NET page:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-size: 10px;"&gt;&lt;br /&gt;protected string ImageInsert(object date)&lt;br /&gt;{&lt;br /&gt;    if (Convert.ToDateTime(date).AddDays(4) &gt;= DateTime.Now)&lt;br /&gt;    {&lt;br /&gt;        return "&amp;lt;img alt=\"News image\" src=\"../Layout/Images/New.gif\" /&amp;gt;";&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;        return "";&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1104336261586813151-5842359902888764770?l=tomasbosak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomasbosak.blogspot.com/feeds/5842359902888764770/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1104336261586813151&amp;postID=5842359902888764770' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/5842359902888764770'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/5842359902888764770'/><link rel='alternate' type='text/html' href='http://tomasbosak.blogspot.com/2009/01/processing-eval-in-aspnet.html' title='Processing Eval in ASP.NET'/><author><name>Tom!</name><uri>http://www.blogger.com/profile/03078924436861485668</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://1.bp.blogspot.com/_REiym_3H-dw/SZdOAltBVSI/AAAAAAAAAVk/OSlL3AgI6yo/S220/Don.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1104336261586813151.post-3473760215236917620</id><published>2009-01-13T08:57:00.000-08:00</published><updated>2009-01-13T12:12:52.706-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET Framework'/><title type='text'>Simple web crawler in .NET</title><content type='html'>&lt;div align="justify"&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;This web crawler consist of three classes. Program class is used just for testing in console mode. Anchor class serves as a storage object for founded anchors and therefore provide some properties. Crawler class is using two methods:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;    &lt;li&gt;&lt;b&gt;GetHTML - &lt;/b&gt;returns HTML page in string format of website which is passed as a parameter.&lt;/li&gt;&lt;br /&gt;    &lt;li&gt;&lt;b&gt;GetAnchorsFromHTML - &lt;/b&gt;returns generic collection of anchor tags, which were founded by regular expressions in HTML page.&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;Some useful links: &lt;a href="http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx"&gt;HttpWebRequest&lt;/a&gt;, &lt;a href="http://msdn.microsoft.com/en-us/library/system.net.httpwebresponse.aspx"&gt;HttpWebResponse&lt;/a&gt;, &lt;a href="http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.aspx"&gt;Regex&lt;/a&gt;, &lt;a href="http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.match.aspx"&gt;Match&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Namespaces used:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;using System.Linq;&lt;br /&gt;using System.IO;&lt;br /&gt;using System.Net;&lt;br /&gt;using System.Text;&lt;br /&gt;using System.Text.RegularExpressions;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;class Program&lt;br /&gt;{&lt;br /&gt;    public static void Main()&lt;br /&gt;    {&lt;br /&gt;        Crawler crawler = new Crawler();&lt;br /&gt;&lt;br /&gt;        string htmlPage = crawler.GetHTML("http://www.infoq.com/");&lt;br /&gt;        List&lt;Anchor&gt; anchors = crawler.GetAnchorsFromHTML(htmlPage);&lt;br /&gt;        Console.WriteLine("Anchor collection: " + anchors.Count.ToString() + "\n\n");&lt;br /&gt;&lt;br /&gt;        foreach (Anchor anchor in anchors)&lt;br /&gt;        {&lt;br /&gt;            Console.WriteLine(anchor.RawAnchor + "\n");&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        Console.WriteLine("END");&lt;br /&gt;        Console.ReadLine();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class Crawler&lt;br /&gt;{&lt;br /&gt;    public string GetHTML(string website)&lt;br /&gt;    {&lt;br /&gt;        // send request and get response in form of stream&lt;br /&gt;        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(website);&lt;br /&gt;        HttpWebResponse response = (HttpWebResponse)request.GetResponse();&lt;br /&gt;        Stream responseStream = response.GetResponseStream();&lt;br /&gt;&lt;br /&gt;        // process stream to memory stream because basic returned stream is not reliable (issues with length...)&lt;br /&gt;        MemoryStream memoryStream = new MemoryStream();&lt;br /&gt;        byte[] buffer = new byte[2048];&lt;br /&gt;        int bytesRead = 0;&lt;br /&gt;&lt;br /&gt;        do&lt;br /&gt;        {&lt;br /&gt;            bytesRead = responseStream.Read(buffer, 0, buffer.Length);&lt;br /&gt;            memoryStream.Write(buffer, 0, bytesRead);&lt;br /&gt;        }&lt;br /&gt;        while (bytesRead != 0);&lt;br /&gt;&lt;br /&gt;        responseStream.Close();&lt;br /&gt;&lt;br /&gt;        // get string from byte array and encode it in readable format&lt;br /&gt;        string htmlPage = "";&lt;br /&gt;&lt;br /&gt;        if (response.CharacterSet.ToLower().Contains("iso-8859-1") || response.CharacterSet.ToLower().Contains("windows-1250"))&lt;br /&gt;        {&lt;br /&gt;            htmlPage = Encoding.Default.GetString(memoryStream.ToArray());&lt;br /&gt;        }&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;            htmlPage = Encoding.UTF8.GetString(memoryStream.ToArray());&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        return htmlPage;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public List&lt;Anchor&gt; GetAnchorsFromHTML(string htmlPage)&lt;br /&gt;    {&lt;br /&gt;        List&lt;Anchor&gt; anchors = new List&lt;Anchor&gt;();&lt;br /&gt;&lt;br /&gt;        // raw anchor&lt;br /&gt;        Regex regex = new Regex(@"&amp;lt;a.*?&amp;lt;/a&amp;gt;", RegexOptions.IgnoreCase);&lt;br /&gt;        // anchor href&lt;br /&gt;        Regex regexHref = new Regex("href=(\"|').*?(\"|')", RegexOptions.IgnoreCase);&lt;br /&gt;        // anchor text&lt;br /&gt;        Regex regexText = new Regex("&amp;gt;.*?&amp;lt;/a&amp;gt;", RegexOptions.IgnoreCase);&lt;br /&gt;&lt;br /&gt;        // matches&lt;br /&gt;        Match matchHref;&lt;br /&gt;        Match matchText;&lt;br /&gt;        Match match = regex.Match(htmlPage);&lt;br /&gt;&lt;br /&gt;        Anchor anchor;&lt;br /&gt;&lt;br /&gt;        while (match.Success)&lt;br /&gt;        {&lt;br /&gt;            anchor = new Anchor();&lt;br /&gt;&lt;br /&gt;            anchor.RawAnchor = match.Value;&lt;br /&gt;&lt;br /&gt;            matchHref = regexHref.Match(anchor.RawAnchor);&lt;br /&gt;&lt;br /&gt;            if (matchHref.Length &gt; 0)&lt;br /&gt;            {&lt;br /&gt;                anchor.Href = matchHref.Value.Substring(6, matchHref.Value.Length - 7);&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                anchor.Href = "";&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            matchText = regexText.Match(anchor.RawAnchor);&lt;br /&gt;&lt;br /&gt;            if (matchText.Length &gt; 0)&lt;br /&gt;            {&lt;br /&gt;                anchor.Text = matchText.Value.Substring(1, matchText.Value.Length - 5);&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                anchor.Text = "";&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            anchors.Add(anchor);&lt;br /&gt;&lt;br /&gt;            match = match.NextMatch();&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        return anchors;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class Anchor&lt;br /&gt;{&lt;br /&gt;    public string RawAnchor { get; set; }&lt;br /&gt;&lt;br /&gt;    public string Href { get; set; }&lt;br /&gt;&lt;br /&gt;    public string Text { get; set; }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1104336261586813151-3473760215236917620?l=tomasbosak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomasbosak.blogspot.com/feeds/3473760215236917620/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1104336261586813151&amp;postID=3473760215236917620' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/3473760215236917620'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/3473760215236917620'/><link rel='alternate' type='text/html' href='http://tomasbosak.blogspot.com/2009/01/simple-web-crawler-in-net.html' title='Simple web crawler in .NET'/><author><name>Tom!</name><uri>http://www.blogger.com/profile/03078924436861485668</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://1.bp.blogspot.com/_REiym_3H-dw/SZdOAltBVSI/AAAAAAAAAVk/OSlL3AgI6yo/S220/Don.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1104336261586813151.post-8624310815017310724</id><published>2008-10-25T11:53:00.000-07:00</published><updated>2008-10-25T14:45:04.133-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MS SQL Server'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>How to get list of primary and foreign keys from database (MS SQL Server 2005)</title><content type='html'>&lt;div align="justify"&gt;&lt;br /&gt;&lt;b&gt;Primary keys:&lt;/b&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms186778(SQL.90).aspx"&gt;Information Schema Views (Transact-SQL)&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms189789.aspx"&gt;KEY_COLUMN_USAGE (Transact-SQL)&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms174321.aspx"&gt;sys.key_constraints (Transact-SQL)&lt;/a&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;SELECT CONSTRAINT_NAME AS [Constraint Name], &lt;br /&gt;       TABLE_NAME AS [PK Table Name], &lt;br /&gt;       COLUMN_NAME AS [PK Column Name] &lt;br /&gt;FROM sys.key_constraints &lt;br /&gt;INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE &lt;br /&gt;ON INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME = sys.key_constraints.name&lt;br /&gt;WHERE sys.key_constraints.type = 'PK'&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Foreign keys:&lt;/b&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms186306.aspx"&gt;sys.foreign_key_columns (Transact-SQL)&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms186301.aspx"&gt;OBJECT_NAME (Transact-SQL)&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms174974.aspx"&gt;COL_NAME (Transact-SQL)&lt;/a&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;SELECT OBJECT_NAME(constraint_object_id) AS [Constraint Name], &lt;br /&gt;       OBJECT_NAME(parent_object_id) AS [FK Table Name], &lt;br /&gt;       COL_NAME(parent_object_id, parent_column_id) AS [FK Column Name], &lt;br /&gt;       OBJECT_NAME(referenced_object_id) AS [Referenced Table Name], &lt;br /&gt;       COL_NAME(referenced_object_id, referenced_column_id) AS [Referenced Column Name] &lt;br /&gt;FROM sys.foreign_key_columns&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1104336261586813151-8624310815017310724?l=tomasbosak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomasbosak.blogspot.com/feeds/8624310815017310724/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1104336261586813151&amp;postID=8624310815017310724' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/8624310815017310724'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/8624310815017310724'/><link rel='alternate' type='text/html' href='http://tomasbosak.blogspot.com/2008/10/how-to-get-list-of-primary-and-foreign.html' title='How to get list of primary and foreign keys from database (MS SQL Server 2005)'/><author><name>Tom!</name><uri>http://www.blogger.com/profile/03078924436861485668</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://1.bp.blogspot.com/_REiym_3H-dw/SZdOAltBVSI/AAAAAAAAAVk/OSlL3AgI6yo/S220/Don.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1104336261586813151.post-8105861805180195378</id><published>2008-09-02T11:56:00.000-07:00</published><updated>2008-09-02T12:35:18.569-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WPF'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET Framework'/><title type='text'>Image reflection in WPF</title><content type='html'>&lt;div align="justify"&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_REiym_3H-dw/SL2NyPDj2_I/AAAAAAAAAF4/0-eh7Xnchbg/s1600-h/Reflection.png"&gt;&lt;img style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_REiym_3H-dw/SL2NyPDj2_I/AAAAAAAAAF4/0-eh7Xnchbg/s400/Reflection.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5241501435503565810" /&gt;&lt;/a&gt;&lt;br /&gt;Eye catchy technique also known as "wet floor". Reflection is used on Image control in example but it can be almost any kind of control which can be reflected. Details:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/aa970263.aspx"&gt;How to: Create a Reflection&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.media.visualbrush.aspx"&gt;VisualBrush Class&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.media.gradientstop.aspx"&gt;GradientStop Class&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.media.lineargradientbrush.aspx"&gt;LinearGradientBrush Class&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.media.scaletransform.aspx"&gt;ScaleTransform Class&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;...&lt;br /&gt;&amp;lt;Image Name="image" Width="128" Height="128" Source="Calendar.png" /&amp;gt;&lt;br /&gt;&amp;lt;Rectangle Width="128" Height="128"&amp;gt;&lt;br /&gt;    &amp;lt;Rectangle.Fill&amp;gt;&lt;br /&gt;        &amp;lt;VisualBrush Visual="{Binding ElementName=image}" /&amp;gt;&lt;br /&gt;    &amp;lt;/Rectangle.Fill&amp;gt;&lt;br /&gt;    &amp;lt;Rectangle.OpacityMask&amp;gt;&lt;br /&gt;        &amp;lt;LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"&amp;gt;&lt;br /&gt;            &amp;lt;GradientStop Color="#FF000000" Offset="3" /&amp;gt;&lt;br /&gt;            &amp;lt;GradientStop Color="#00000000" Offset="0" /&amp;gt;&lt;br /&gt;        &amp;lt;/LinearGradientBrush&amp;gt;&lt;br /&gt;    &amp;lt;/Rectangle.OpacityMask&amp;gt;&lt;br /&gt;    &amp;lt;Rectangle.RenderTransform&amp;gt;&lt;br /&gt;        &amp;lt;TransformGroup&amp;gt;&lt;br /&gt;            &amp;lt;ScaleTransform ScaleX="1" ScaleY="-1" /&amp;gt;&lt;br /&gt;            &amp;lt;TranslateTransform  Y="128" /&amp;gt;&lt;br /&gt;        &amp;lt;/TransformGroup&amp;gt;&lt;br /&gt;    &amp;lt;/Rectangle.RenderTransform&amp;gt;&lt;br /&gt;&amp;lt;/Rectangle&amp;gt;&lt;br /&gt;...&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1104336261586813151-8105861805180195378?l=tomasbosak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomasbosak.blogspot.com/feeds/8105861805180195378/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1104336261586813151&amp;postID=8105861805180195378' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/8105861805180195378'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/8105861805180195378'/><link rel='alternate' type='text/html' href='http://tomasbosak.blogspot.com/2008/09/image-reflection-in-wpf.html' title='Image reflection in WPF'/><author><name>Tom!</name><uri>http://www.blogger.com/profile/03078924436861485668</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://1.bp.blogspot.com/_REiym_3H-dw/SZdOAltBVSI/AAAAAAAAAVk/OSlL3AgI6yo/S220/Don.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_REiym_3H-dw/SL2NyPDj2_I/AAAAAAAAAF4/0-eh7Xnchbg/s72-c/Reflection.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1104336261586813151.post-5633040498028678397</id><published>2008-09-01T07:08:00.000-07:00</published><updated>2008-09-01T09:05:11.534-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='WPF'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET Framework'/><title type='text'>Image enlarging on mouse event in WPF</title><content type='html'>&lt;div align="justify"&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Windows_Presentation_Foundation"&gt;WPF&lt;/a&gt; is a mighty graphical subsystem of .NET Framework where you can relatively easy and fast create rich desktop applications without much effort. Good example of these capabilities is enlarging some image inside button from simple menu on mouse event. Menu:&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_REiym_3H-dw/SLwEiO7NM2I/AAAAAAAAAFo/-V47I2OSSLg/s1600-h/Menu.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://4.bp.blogspot.com/_REiym_3H-dw/SLwEiO7NM2I/AAAAAAAAAFo/-V47I2OSSLg/s320/Menu.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5241069052520903522" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Upper menu consist of five buttons (each button have &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.image.aspx"&gt;Image&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.textblock.aspx"&gt;TextBlock&lt;/a&gt; controls inside &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.stackpanel.aspx"&gt;StackPanel&lt;/a&gt;) which style is stored in App.xaml file inside Application.Resources element. Buttons are in Window.xaml file.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;App.xaml&lt;/b&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;...&lt;br /&gt;&amp;lt;Application.Resources&amp;gt;  &lt;br /&gt;    &amp;lt;Style x:Key="Button_Module" TargetType="Button"&amp;gt;&lt;br /&gt;        &amp;lt;Setter Property="Background" Value="Transparent" /&amp;gt;&lt;br /&gt;        &amp;lt;Setter Property="Width" Value="100" /&amp;gt;&lt;br /&gt;        &amp;lt;Setter Property="Height" Value="100" /&amp;gt;&lt;br /&gt;        &amp;lt;Setter Property="Margin" Value="5, 0, 5, 0" /&amp;gt;&lt;br /&gt;    &amp;lt;/Style&amp;gt;&lt;br /&gt;        &lt;br /&gt;    &amp;lt;Style x:Key="TextBlock_Module" TargetType="TextBlock"&amp;gt;&lt;br /&gt;        &amp;lt;Setter Property="Foreground" Value="White" /&amp;gt;&lt;br /&gt;        &amp;lt;Setter Property="FontFamily" Value="Lucida Console" /&amp;gt;&lt;br /&gt;        &amp;lt;Setter Property="FontSize" Value="12" /&amp;gt;&lt;br /&gt;        &amp;lt;Setter Property="HorizontalAlignment" Value="Center" /&amp;gt;&lt;br /&gt;    &amp;lt;/Style&amp;gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;Style x:Key="Image_Module" TargetType="Image"&amp;gt;&lt;br /&gt;            &amp;lt;Setter Property="Width" Value="64" /&amp;gt;&lt;br /&gt;            &amp;lt;Setter Property="Height" Value="64" /&amp;gt;&lt;br /&gt;    &amp;lt;/Style&amp;gt;&lt;br /&gt;&amp;lt;/Application.Resources&amp;gt;&lt;br /&gt;...&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Buttons in Window.xaml file are designed to not to have borders and to have a style presented upper. Example of one button xaml code:&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Window.xaml&lt;/b&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;...&lt;br /&gt;&amp;lt;Button Style="{StaticResource Button_Module}" Click="Employees_Click"&amp;gt;&lt;br /&gt;    &amp;lt;Button.Template&amp;gt;&lt;br /&gt;        &amp;lt;ControlTemplate&amp;gt;&lt;br /&gt;            &amp;lt;Border Name="innerBorder" BorderThickness="0"&amp;gt;&lt;br /&gt;                &amp;lt;StackPanel&amp;gt;&lt;br /&gt;                    &amp;lt;Image Style="{StaticResource Image_Module}"  Source="Images/Employees.png"/&amp;gt;&lt;br /&gt;                    &amp;lt;TextBlock Style="{StaticResource TextBlock_Module}" Text="Employees" /&amp;gt;&lt;br /&gt;                &amp;lt;/StackPanel&amp;gt;&lt;br /&gt;            &amp;lt;/Border&amp;gt;&lt;br /&gt;        &amp;lt;/ControlTemplate&amp;gt;&lt;br /&gt;    &amp;lt;/Button.Template&amp;gt;&lt;br /&gt;&amp;lt;/Button&amp;gt;&lt;br /&gt;...&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;Until here it is a simple menu without any special features, but the result will be that image inside button will enlarge when mouse enters its area. To do this we need to play little around with &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.style.triggers.aspx"&gt;Style.Triggers&lt;/a&gt;, &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.eventtrigger.aspx"&gt;EventTrigger&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.media.animation.doubleanimation.aspx"&gt;DoubleAnimation&lt;/a&gt; in our App.xaml file where we can add these things to styles and apply them to controls. Below is App.xaml file with modified Image style section.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Modified Image style section in App.xaml&lt;/b&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;...&lt;br /&gt;&amp;lt;Style x:Key="Image_Module" TargetType="Image"&amp;gt;&lt;br /&gt;    &amp;lt;Setter Property="Width" Value="64" /&amp;gt;&lt;br /&gt;    &amp;lt;Setter Property="Height" Value="64" /&amp;gt;&lt;br /&gt;    &amp;lt;Style.Triggers&amp;gt;&lt;br /&gt;        &amp;lt;EventTrigger RoutedEvent="Image.MouseEnter"&amp;gt;&lt;br /&gt;            &amp;lt;EventTrigger.Actions&amp;gt;&lt;br /&gt;                &amp;lt;BeginStoryboard&amp;gt;&lt;br /&gt;                    &amp;lt;Storyboard&amp;gt;&lt;br /&gt;                        &amp;lt;DoubleAnimation Storyboard.TargetProperty="Width" Duration="0:0:0.25" To="84"/&amp;gt;&lt;br /&gt;                        &amp;lt;DoubleAnimation Storyboard.TargetProperty="Height" Duration="0:0:0.25" To="84"/&amp;gt;&lt;br /&gt;                    &amp;lt;/Storyboard&amp;gt;&lt;br /&gt;                &amp;lt;/BeginStoryboard&amp;gt;&lt;br /&gt;            &amp;lt;/EventTrigger.Actions&amp;gt;&lt;br /&gt;        &amp;lt;/EventTrigger&amp;gt;&lt;br /&gt;        &amp;lt;EventTrigger RoutedEvent="Image.MouseLeave"&amp;gt;&lt;br /&gt;            &amp;lt;EventTrigger.Actions&amp;gt;&lt;br /&gt;                &amp;lt;BeginStoryboard&amp;gt;&lt;br /&gt;                    &amp;lt;Storyboard&amp;gt;&lt;br /&gt;                        &amp;lt;DoubleAnimation Storyboard.TargetProperty="Width" Duration="0:0:0.25" To="64"/&amp;gt;&lt;br /&gt;                        &amp;lt;DoubleAnimation Storyboard.TargetProperty="Height" Duration="0:0:0.25" To="64"/&amp;gt;&lt;br /&gt;                    &amp;lt;/Storyboard&amp;gt;&lt;br /&gt;                &amp;lt;/BeginStoryboard&amp;gt;&lt;br /&gt;            &amp;lt;/EventTrigger.Actions&amp;gt;&lt;br /&gt;        &amp;lt;/EventTrigger&amp;gt;&lt;br /&gt;    &amp;lt;/Style.Triggers&amp;gt;&lt;br /&gt;&amp;lt;/Style&amp;gt;&lt;br /&gt;...&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;The point is that &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.mouseenter.aspx"&gt;MouseEnter&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.mouseleave.aspx"&gt;MouseLeave&lt;/a&gt; events triggers appropriate DoubleAnimation action and resize images inside buttons within specified duration. Result can be seen below where mouse pointer is over the projects image:&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_REiym_3H-dw/SLwRpcUCi0I/AAAAAAAAAFw/vtue-5zHdAA/s1600-h/EnlargedMenu.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_REiym_3H-dw/SLwRpcUCi0I/AAAAAAAAAFw/vtue-5zHdAA/s320/EnlargedMenu.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5241083470024969026" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1104336261586813151-5633040498028678397?l=tomasbosak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomasbosak.blogspot.com/feeds/5633040498028678397/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1104336261586813151&amp;postID=5633040498028678397' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/5633040498028678397'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/5633040498028678397'/><link rel='alternate' type='text/html' href='http://tomasbosak.blogspot.com/2008/09/image-enlarging-on-mouse-event-in-wpf.html' title='Image enlarging on mouse event in WPF'/><author><name>Tom!</name><uri>http://www.blogger.com/profile/03078924436861485668</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://1.bp.blogspot.com/_REiym_3H-dw/SZdOAltBVSI/AAAAAAAAAVk/OSlL3AgI6yo/S220/Don.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_REiym_3H-dw/SLwEiO7NM2I/AAAAAAAAAFo/-V47I2OSSLg/s72-c/Menu.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1104336261586813151.post-8423612447136893119</id><published>2008-05-26T11:33:00.000-07:00</published><updated>2009-01-24T12:29:38.999-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET Framework'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='LINQ'/><title type='text'>How to implement SQL LIKE in LinqDataSource</title><content type='html'>&lt;div align="justify"&gt;&lt;br /&gt;&lt;a href="http://www.1keydata.com/sql/sqllike.html"&gt;LIKE&lt;/a&gt; is very useful clause for searching or filtering data in SQL, for example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;SELECT * FROM Employees WHERE surename LIKE('xxx' + '%')&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;.NET Framework provides this function in the form of &lt;a href="http://msdn.microsoft.com/en-us/library/dy85x1sa.aspx"&gt;Contains&lt;/a&gt; or &lt;a href="http://msdn.microsoft.com/en-us/library/baketfxw.aspx"&gt;StartsWith&lt;/a&gt; methods (in the case of searching or filtering strings). Here is an example with &lt;a href="http://en.wikipedia.org/wiki/Language_Integrated_Query"&gt;LINQ&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;string[] employees = { "Johny", "Mike", "Jake", "Mark" };&lt;br /&gt;IEnumerable&amp;lt;string&amp;gt; searchResult = employees.Where(q =&gt; q.StartsWith("M"));&lt;br /&gt;&lt;br /&gt;foreach (string s in searchResult)&lt;br /&gt;{&lt;br /&gt;    Console.WriteLine(s);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linqdatasource.aspx"&gt;LinqDataSource&lt;/a&gt; is very handy control for using LINQ in ASP.NET pages especially with &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview(VS.85).aspx"&gt;GridView&lt;/a&gt; control, but little problem can arise when I want to implement searching based on textbox control. &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.aspx"&gt;SqlDataSource&lt;/a&gt; control SQL query can be modified directly or by wizard where is choice to select LIKE condition in WHERE clause but LinqDataSource do not have this functionality. Solution for this problem is to handle &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linqdatasource.selecting.aspx"&gt;Selecting&lt;/a&gt; event and perform search operation, for example:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;ASP.NET code:&lt;/b&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&amp;lt;asp:LinqDataSource ID="LinqDataSource1" runat="server" &lt;br /&gt;        ContextTypeName="DataClassesDataContext" Select="new (id, name, surename, Position)" &lt;br /&gt;        TableName="Employees" OnSelecting="LinqDataSource1_Selecting"&lt;br /&gt;        AutoGenerateWhereClause="true"&amp;gt;&lt;br /&gt;&amp;lt;/asp:LinqDataSource&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;C#:&lt;/b&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;protected void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e)&lt;br /&gt;{&lt;br /&gt;    DataClassesDataContext dataContext = new DataClassesDataContext();&lt;br /&gt;    &lt;br /&gt;    var searchResult = from query &lt;br /&gt;                       in dataContext.Employees &lt;br /&gt;                       where query.surename.StartsWith(textBox_Search.Text) &lt;br /&gt;                       select new { query.id, query.name, query.surename, query.Position };&lt;br /&gt;&lt;br /&gt;    e.Result = searchResult;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linqdatasourceselecteventargs.result.aspx"&gt;Result&lt;/a&gt; property of &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.linqdatasourceselecteventargs.aspx"&gt;LinqDataSourceSelectEventArgs&lt;/a&gt; class sets the new data object from query and search is completed.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1104336261586813151-8423612447136893119?l=tomasbosak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomasbosak.blogspot.com/feeds/8423612447136893119/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1104336261586813151&amp;postID=8423612447136893119' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/8423612447136893119'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/8423612447136893119'/><link rel='alternate' type='text/html' href='http://tomasbosak.blogspot.com/2008/05/how-to-implement-sql-like-in.html' title='How to implement SQL LIKE in LinqDataSource'/><author><name>Tom!</name><uri>http://www.blogger.com/profile/03078924436861485668</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://1.bp.blogspot.com/_REiym_3H-dw/SZdOAltBVSI/AAAAAAAAAVk/OSlL3AgI6yo/S220/Don.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1104336261586813151.post-2791039893232232658</id><published>2008-05-03T12:09:00.000-07:00</published><updated>2008-05-03T13:47:29.601-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET Framework'/><title type='text'>Simple traceroute in .NET</title><content type='html'>&lt;div align="justify"&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Traceroute"&gt;Traceroute&lt;/a&gt; is one of the most common &lt;a href="http://en.wikipedia.org/wiki/Internet_Control_Message_Protocol"&gt;ICMP&lt;/a&gt; tools which is used to determine the route of traversed packets until the destination is not reached (in ideal case). I decided to write this tool in .NET. Core consists of &lt;a href="http://msdn.microsoft.com/en-us/library/system.net.networkinformation.pingreply.aspx"&gt;PingReply&lt;/a&gt; class and &lt;a href="http://msdn.microsoft.com/en-us/library/ms144955.aspx"&gt;Send&lt;/a&gt; method of &lt;a href="http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ping.aspx"&gt;Ping&lt;/a&gt; class that sends ICMP echo message. Replied message contains host address which name is resolved by &lt;a href="http://msdn.microsoft.com/en-us/library/system.net.dns.aspx"&gt;GetHostEntry&lt;/a&gt; method of &lt;a href="http://msdn.microsoft.com/en-us/library/system.net.dns.aspx"&gt;Dns&lt;/a&gt; class. This process continues until the destination is not reached or hop count reaches TTL value.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;// site to be traced ...&lt;br /&gt;string tracertTarget = "www.google.com";&lt;br /&gt;Console.WriteLine("Traceroute of {0}:\n", tracertTarget);&lt;br /&gt;&lt;br /&gt;// resolves a host name or IP address to an IPHostEntry instance&lt;br /&gt;IPHostEntry ihn = Dns.GetHostEntry(tracertTarget);&lt;br /&gt;// get the first address&lt;br /&gt;IPAddress ip = ihn.AddressList[0];&lt;br /&gt;&lt;br /&gt;Ping ping = new Ping();&lt;br /&gt;PingReply reply;&lt;br /&gt;&lt;br /&gt;// maximum TTL value&lt;br /&gt;int ttl = 30;&lt;br /&gt;// actual hop count&lt;br /&gt;int hopCount = 1;&lt;br /&gt;// indicates if tracerouting reach its destination&lt;br /&gt;bool isFinished = false;&lt;br /&gt;// name of the host&lt;br /&gt;string hostName = null;&lt;br /&gt;&lt;br /&gt;do&lt;br /&gt;{&lt;br /&gt;    Console.Write("{0, 3}", hopCount);&lt;br /&gt;&lt;br /&gt;    // send ICMP echo message with parametres: IP address, timeout, buffer, options&lt;br /&gt;    reply = ping.Send(ip, 5000, new byte[0], new PingOptions(hopCount++, true));&lt;br /&gt;&lt;br /&gt;    // if ICMP echo reply host is e.g. unreachable&lt;br /&gt;    if (reply.Address == null)&lt;br /&gt;    {&lt;br /&gt;        Console.WriteLine("  Request timed out.");&lt;br /&gt;        continue;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    // if destination was reached&lt;br /&gt;    if(reply.Status == IPStatus.Success)&lt;br /&gt;    {&lt;br /&gt;        isFinished = true;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    hostName = null;&lt;br /&gt;&lt;br /&gt;    // tries to resolve name of the host&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;        IPHostEntry hostEntry = Dns.GetHostEntry(reply.Address);&lt;br /&gt;&lt;br /&gt;        if ((hostEntry.HostName != null) &amp;&amp; (hostEntry.HostName != string.Empty))&lt;br /&gt;        {&lt;br /&gt;            hostName = hostEntry.HostName;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    catch (Exception e)&lt;br /&gt;    {&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    if (hostName != null)&lt;br /&gt;    {&lt;br /&gt;        Console.WriteLine("  {0} [{1}]", hostName, reply.Address);&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;        Console.WriteLine("  {0}", reply.Address);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;// continue until destination is not reached or hop count reach TTL value&lt;br /&gt;while ((!isFinished) &amp;&amp; (hopCount &lt;= ttl));&lt;br /&gt;&lt;br /&gt;Console.WriteLine("\nEnd");&lt;br /&gt;Console.ReadLine();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1104336261586813151-2791039893232232658?l=tomasbosak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomasbosak.blogspot.com/feeds/2791039893232232658/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1104336261586813151&amp;postID=2791039893232232658' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/2791039893232232658'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/2791039893232232658'/><link rel='alternate' type='text/html' href='http://tomasbosak.blogspot.com/2008/05/simple-traceroute-in-net.html' title='Simple traceroute in .NET'/><author><name>Tom!</name><uri>http://www.blogger.com/profile/03078924436861485668</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://1.bp.blogspot.com/_REiym_3H-dw/SZdOAltBVSI/AAAAAAAAAVk/OSlL3AgI6yo/S220/Don.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1104336261586813151.post-8823564696933289615</id><published>2008-04-22T11:42:00.000-07:00</published><updated>2009-01-24T12:31:06.023-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET Framework'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Architecture'/><category scheme='http://www.blogger.com/atom/ns#' term='Web development'/><title type='text'>My MVC in .NET Framework (Architecture)</title><content type='html'>&lt;div align="justify"&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Model-view-controller"&gt;Model View Controller&lt;/a&gt; or MVC architectural pattern is used almost in every complex web application or even in application frameworks such as &lt;a href="http://en.wikipedia.org/wiki/Spring_Framework"&gt;Spring&lt;/a&gt;. The main advantage of this pattern is in distribution of application into three layers: Model - represents database logic, View - user interface, Controller - processing data from model layer and displaying them in view layer.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;My approach&lt;/h2&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_REiym_3H-dw/SA8BhOZFaqI/AAAAAAAAAFI/Sx8n2qG_jn4/s1600-h/MVC.PNG"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_REiym_3H-dw/SA8BhOZFaqI/AAAAAAAAAFI/Sx8n2qG_jn4/s320/MVC.PNG" border="0" alt=""id="BLOGGER_PHOTO_ID_5192370565692091042" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;h2&gt;Model&lt;/h2&gt;&lt;br /&gt;Basic idea of model tier in my approach is to create connection with database and load data into generic lists which consists of &lt;a href="http://en.wikipedia.org/wiki/Data_Access_Object"&gt;Data Access Objects&lt;/a&gt;. Single DAO represents one row in particular table. For example when you have a table consisting of students (columns - id, name, surename, ...), single DAO is a student object with properties (getters and setters) to his id, name, surename, ... This tier implements also SIDU methods (Select, Insert, Delete, Update). For example result of getting all students from table (in SQL: SELECT * FROM students_table) is stored into generic list which can be processed by controller tier.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;h2&gt;Controller&lt;/h2&gt;&lt;br /&gt;I'm using controller tier to process data which are obtained from model in raw format. Processing can be for example binding particular data (such as name or surename of student) into the &lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.listbox.aspx"&gt;ListBox&lt;/a&gt; control which is passed as a parameter or returned by the method. This tier acts as a middle layer between model and view which are isolated from each other.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;h2&gt;View&lt;/h2&gt;&lt;br /&gt;In classical MVC approach the controller tier processes and responds to events. ASP.NET has &lt;a href="http://en.wikipedia.org/wiki/Code-behind#Code-behind_model"&gt;code behind&lt;/a&gt; files along with user interface (for example .aspx or .ascx files) so the event handling such as button click can be caught in view tier then passed with parameters to controller and afterward processed. I would say that this approach relieves controller tier from implementing event processing methods (which are tied to user interface controls) and let it to handle data.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1104336261586813151-8823564696933289615?l=tomasbosak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomasbosak.blogspot.com/feeds/8823564696933289615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1104336261586813151&amp;postID=8823564696933289615' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/8823564696933289615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/8823564696933289615'/><link rel='alternate' type='text/html' href='http://tomasbosak.blogspot.com/2008/04/my-mvc-in-net-framework-architecture.html' title='My MVC in .NET Framework (Architecture)'/><author><name>Tom!</name><uri>http://www.blogger.com/profile/03078924436861485668</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://1.bp.blogspot.com/_REiym_3H-dw/SZdOAltBVSI/AAAAAAAAAVk/OSlL3AgI6yo/S220/Don.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_REiym_3H-dw/SA8BhOZFaqI/AAAAAAAAAFI/Sx8n2qG_jn4/s72-c/MVC.PNG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1104336261586813151.post-4319247123935599703</id><published>2008-03-23T12:03:00.000-07:00</published><updated>2008-03-23T14:18:53.236-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>Converting date values in SQL Server</title><content type='html'>&lt;div align="justify"&gt;&lt;br /&gt;Transact-SQL has a few &lt;a href="http://msdn2.microsoft.com/en-us/library/ms186724.aspx"&gt;Date and Time Functions&lt;/a&gt; which enables for example to divide whole date into smaller parts such as &lt;a href="http://msdn2.microsoft.com/en-us/library/ms176052.aspx"&gt;day&lt;/a&gt;, &lt;a href="http://msdn2.microsoft.com/en-us/library/ms187813.aspx"&gt;month&lt;/a&gt;, &lt;a href="http://msdn2.microsoft.com/en-us/library/ms186313.aspx"&gt;year&lt;/a&gt; or argument specific &lt;a href="http://msdn2.microsoft.com/en-us/library/ms174420.aspx"&gt;DATEPART&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;Problem - I want from actual date (for example 03.23.2008 00:00:00) pick only day, month and year without time. Solution with upper mentioned functions:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;SELECT&lt;br /&gt;DAY(GETDATE()) AS 'Day',&lt;br /&gt;MONTH(GETDATE()) AS 'Month',&lt;br /&gt;YEAR(GETDATE()) AS 'Year'&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;which is equivalent to:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;SELECT &lt;br /&gt;DATEPART(d, GETDATE()) AS 'Day', &lt;br /&gt;DATEPART(m, GETDATE()) AS 'Month',&lt;br /&gt;DATEPART(yy, GETDATE()) AS 'Year'&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The other solution is to use Transact-SQL &lt;a href="http://msdn2.microsoft.com/en-us/library/ms187928.aspx"&gt;CONVERT Function&lt;/a&gt; and convert date value into string. Example below outputs date separated by dash character in USA standard format (e.g. 03-23-2008) which is defined as third parameter of the function:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;SELECT CONVERT(VARCHAR(10), GETDATE(), 110) AS 'Date'&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This solution can be applied in conditional query with WHERE clause. Functions as DATEPART are useless in case of selecting only data with specific date (e.g. 03.23.2008), so CONVERT could be used to accomplish this task. Following example will demonstrate how to select data from table with specific date:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;SELECT *&lt;br /&gt;FROM table&lt;br /&gt;WHERE CONVERT(VARCHAR(10), dateColumn, 110) = '03-23-2008'&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Very useful link about this area: &lt;a href="http://www.sql-server-helper.com/tips/date-formats.aspx"&gt;SQL Server Date Formats&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1104336261586813151-4319247123935599703?l=tomasbosak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomasbosak.blogspot.com/feeds/4319247123935599703/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1104336261586813151&amp;postID=4319247123935599703' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/4319247123935599703'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/4319247123935599703'/><link rel='alternate' type='text/html' href='http://tomasbosak.blogspot.com/2008/03/converting-date-values-in-sql-server.html' title='Converting date values in SQL Server'/><author><name>Tom!</name><uri>http://www.blogger.com/profile/03078924436861485668</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://1.bp.blogspot.com/_REiym_3H-dw/SZdOAltBVSI/AAAAAAAAAVk/OSlL3AgI6yo/S220/Don.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1104336261586813151.post-5809975489720002771</id><published>2008-03-09T13:32:00.000-07:00</published><updated>2008-03-09T14:14:04.582-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web development'/><title type='text'>Web design inspiration</title><content type='html'>&lt;div align="justify"&gt;&lt;br /&gt;I spent this weekend with redesigning my old home page. I hate this part of web development because it takes me enormous amount of time to decide between designs. Even when I pick something, after some time (usually a day) it is unfitable for me. But now to the main subject of this article. Because I'm not good at creating new design I almost always try to inspire somewhere. So these are my sources of inspiration:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.webcreme.com/"&gt;http://www.webcreme.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.webdesignerwall.com/"&gt;http://www.webdesignerwall.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.digital-web.com/"&gt;http://www.digital-web.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/garrettdimoncom/"&gt;http://www.flickr.com/photos/garrettdimoncom/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/splat/sets/981332/"&gt;http://www.flickr.com/photos/splat/sets/981332/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/squaredeye/sets/72157594521152419/"&gt;http://www.flickr.com/photos/squaredeye/sets/72157594521152419/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.flickr.com/photos/guspim/collections/72157600047307884/"&gt;http://www.flickr.com/photos/guspim/collections/72157600047307884/&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1104336261586813151-5809975489720002771?l=tomasbosak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomasbosak.blogspot.com/feeds/5809975489720002771/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1104336261586813151&amp;postID=5809975489720002771' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/5809975489720002771'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/5809975489720002771'/><link rel='alternate' type='text/html' href='http://tomasbosak.blogspot.com/2008/03/web-design-inspiration.html' title='Web design inspiration'/><author><name>Tom!</name><uri>http://www.blogger.com/profile/03078924436861485668</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://1.bp.blogspot.com/_REiym_3H-dw/SZdOAltBVSI/AAAAAAAAAVk/OSlL3AgI6yo/S220/Don.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1104336261586813151.post-8574327327488105595</id><published>2008-02-22T08:32:00.000-08:00</published><updated>2008-02-22T10:22:24.275-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET Framework'/><title type='text'>Sorting generic list in C#</title><content type='html'>&lt;div align="justify"&gt;&lt;br /&gt;List as a &lt;a href="http://tomasbosak.blogspot.com/search/label/Object%20oriented%20programming"&gt;generic collection&lt;/a&gt; is a very powerful storage of objects or data types. I would say that one of the most common operation with these types of lists (when filled with data) is sorting. At first I will create some class which will represent for example single employee.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class Employee&lt;br /&gt;{&lt;br /&gt;    private long id;&lt;br /&gt;    private string name;&lt;br /&gt;    private string surename;&lt;br /&gt;&lt;br /&gt;    public long Id&lt;br /&gt;    {&lt;br /&gt;        get { return id; }&lt;br /&gt;        set { id = value; }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public string Name&lt;br /&gt;    {&lt;br /&gt;        get { return name; }&lt;br /&gt;        set { name = value; }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public string Surename&lt;br /&gt;    {&lt;br /&gt;        get { return surename; }&lt;br /&gt;        set { surename = value; }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If we want the generic list of Employee objects to be sortable, we need to inherit &lt;a href="http://msdn2.microsoft.com/en-us/library/system.icomparable.aspx"&gt;IComparable interface&lt;/a&gt; and implement &lt;a href="http://msdn2.microsoft.com/en-us/library/system.icomparable.compareto.aspx"&gt;CompareTo method&lt;/a&gt;. This method compares the current instance with another object of the same type. My CompareTo implementation compares two objects upon the surename of the employee.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;public class Employee : IComparable &lt;br /&gt;{&lt;br /&gt;    ... variables and properties as before ...&lt;br /&gt;&lt;br /&gt;    public int CompareTo(Object obj)&lt;br /&gt;    {&lt;br /&gt;        return this.Surename.CompareTo(((Employee)obj).Surename);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now the list of employees can be sorted by the generic list &lt;a href="http://msdn2.microsoft.com/en-us/library/b0zbh7b6.aspx"&gt;Sort method&lt;/a&gt;. The code below will at first create a generic list, fill it with sample data and then prints unsorted and sorted list of employees.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;List&amp;lt;Employee&amp;gt; empList = new List&amp;lt;Employee&amp;gt;();&lt;br /&gt;&lt;br /&gt;Employee emp = new Employee();&lt;br /&gt;emp.Id = 1;&lt;br /&gt;emp.Name = "Bill";&lt;br /&gt;emp.Surename = "Gates";&lt;br /&gt;empList.Add(emp);&lt;br /&gt;&lt;br /&gt;emp = new Employee();&lt;br /&gt;emp.Id = 2;&lt;br /&gt;emp.Name = "Steve";&lt;br /&gt;emp.Surename = "Jobs";&lt;br /&gt;empList.Add(emp);&lt;br /&gt;&lt;br /&gt;emp = new Employee();&lt;br /&gt;emp.Id = 3;&lt;br /&gt;emp.Name = "Johny";&lt;br /&gt;emp.Surename = "Bravo";&lt;br /&gt;empList.Add(emp);&lt;br /&gt;&lt;br /&gt;Console.WriteLine("Unsorted list:");&lt;br /&gt;foreach(Employee e in empList)&lt;br /&gt;{&lt;br /&gt;    Console.WriteLine(e.Id + "\t" + e.Name + "\t" + e.Surename);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// sorting&lt;br /&gt;empList.Sort();&lt;br /&gt;&lt;br /&gt;Console.WriteLine("\nSorted list:");&lt;br /&gt;foreach (Employee e in empList)&lt;br /&gt;{&lt;br /&gt;    Console.WriteLine(e.Id + "\t" + e.Name + "\t" + e.Surename);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This is not the only one way how to sort a generic list. The same result will be reached by &lt;a href="http://msdn2.microsoft.com/en-us/library/ms173171(vs.80).aspx"&gt;delegate&lt;/a&gt;. In following case the Employee class don't have to inherit IComparable interface and implement CompareTo method so the code will remain as is in the first example of Employee class. Comparing upon the surename will be accomplished by delegate placed within Sort method calling.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;empList.Sort(delegate(Employee e1, Employee e2) &lt;br /&gt;             { &lt;br /&gt;                 return e1.Surename.CompareTo(e2.Surename); &lt;br /&gt;             });&lt;br /&gt;&lt;br /&gt;Console.WriteLine("\nSorted list:");&lt;br /&gt;foreach (Employee e in empList)&lt;br /&gt;{&lt;br /&gt;    Console.WriteLine(e.Id + "\t" + e.Name + "\t" + e.Surename);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1104336261586813151-8574327327488105595?l=tomasbosak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomasbosak.blogspot.com/feeds/8574327327488105595/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1104336261586813151&amp;postID=8574327327488105595' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/8574327327488105595'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/8574327327488105595'/><link rel='alternate' type='text/html' href='http://tomasbosak.blogspot.com/2008/02/sorting-generic-list-in-c.html' title='Sorting generic list in C#'/><author><name>Tom!</name><uri>http://www.blogger.com/profile/03078924436861485668</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://1.bp.blogspot.com/_REiym_3H-dw/SZdOAltBVSI/AAAAAAAAAVk/OSlL3AgI6yo/S220/Don.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1104336261586813151.post-7674158318222019221</id><published>2008-02-12T13:01:00.000-08:00</published><updated>2008-02-12T14:30:06.910-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Philosophy'/><title type='text'>Ten lessons by Gian-Carlo Rota</title><content type='html'>&lt;div align="justify"&gt;&lt;br /&gt;I have read approximately a year ago an article which was about education at &lt;a href="http://en.wikipedia.org/wiki/MIT"&gt;Massachusetts Institute of Technology&lt;/a&gt; written by &lt;a href="http://en.wikipedia.org/wiki/Gian-Carlo_Rota"&gt;Gian-Carlo Rota&lt;/a&gt;. This article consist of ten lessons oriented on education at MIT, but I think it can be applied (or have benefits) in various areas, not only at MIT. Each lesson in the article is described individually and some of them with philosophical meaning because Rota was not only a mathematician but also a philosopher. Worth of reading.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Lesson One:&lt;/b&gt; You can and will work at a desk for seven hours straight, routinely.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Lesson Two:&lt;/b&gt; You learn what you don't know you are learning.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Lesson Three:&lt;/b&gt; By and large, "knowing how" matters more than "knowing what".&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Lesson Four:&lt;/b&gt; In science and engineering, you can fool very little of the time.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Lesson Five:&lt;/b&gt; You don't have to be a genius to do creative work.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Lesson Six:&lt;/b&gt; You must measure up to a very high level of performance.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Lesson Seven:&lt;/b&gt; The world and your career are unpredictable, so you are better off learning subjects of permanent value.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Lesson Eight:&lt;/b&gt; You are never going to catch up, and neither is anyone else.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Lesson Nine:&lt;/b&gt; The future belongs to the computer-literate-squared.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Lesson Ten:&lt;/b&gt; Mathematics is still the queen of the sciences.&lt;br /&gt;&lt;br /&gt;Whole article -&gt; &lt;a href="http://www.math.tamu.edu/~cyan/Rota/mitless.html"&gt;10 Lessons of an MIT Education&lt;/a&gt;.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1104336261586813151-7674158318222019221?l=tomasbosak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomasbosak.blogspot.com/feeds/7674158318222019221/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1104336261586813151&amp;postID=7674158318222019221' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/7674158318222019221'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/7674158318222019221'/><link rel='alternate' type='text/html' href='http://tomasbosak.blogspot.com/2008/02/ten-lessons-by-gian-carlo-rota.html' title='Ten lessons by Gian-Carlo Rota'/><author><name>Tom!</name><uri>http://www.blogger.com/profile/03078924436861485668</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://1.bp.blogspot.com/_REiym_3H-dw/SZdOAltBVSI/AAAAAAAAAVk/OSlL3AgI6yo/S220/Don.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1104336261586813151.post-1892422651464909982</id><published>2008-02-04T10:10:00.000-08:00</published><updated>2009-01-24T12:30:17.978-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET Framework'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Calculating page load time in ASP.NET</title><content type='html'>&lt;div align="justify"&gt;&lt;br /&gt;In general, the page load time represents how much time takes generating a page on the server side including for example connecting to database, binding data to controls, initializing controls. These and other stages are described in &lt;a href="http://msdn2.microsoft.com/en-us/library/ms178472.aspx"&gt;ASP.NET page life cycle&lt;/a&gt;. I will calculate this time by getting &lt;a href="http://msdn2.microsoft.com/en-us/library/system.environment.tickcount.aspx"&gt;Environment.TickCount&lt;/a&gt; time in page &lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.control.init.aspx"&gt;Init&lt;/a&gt; stage where the server controls are initialized. This will represent start time in miliseconds. End time will be set in &lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.control.prerender.aspx"&gt;PreRender&lt;/a&gt; phase along with calculation of page load time. The example print these times into &lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.label.aspx"&gt;Label&lt;/a&gt; control.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;private int startTime;&lt;br /&gt;private int endTime;&lt;br /&gt;private int pageLoadTime;&lt;br /&gt;&lt;br /&gt;protected void Page_Init(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;    startTime = Environment.TickCount;&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 Page_PreRender(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;    endTime = Environment.TickCount;&lt;br /&gt;&lt;br /&gt;    pageLoadTime = endTime - startTime;&lt;br /&gt;&lt;br /&gt;    label_PageLoadTime.Text = "Start: " + startTime + "&amp;lt;br /&amp;gt;";&lt;br /&gt;    label_PageLoadTime.Text += "End:   " + endTime + "&amp;lt;br /&amp;gt;";&lt;br /&gt;    label_PageLoadTime.Text += "Page load time (in miliseconds): " + pageLoadTime;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1104336261586813151-1892422651464909982?l=tomasbosak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomasbosak.blogspot.com/feeds/1892422651464909982/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1104336261586813151&amp;postID=1892422651464909982' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/1892422651464909982'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/1892422651464909982'/><link rel='alternate' type='text/html' href='http://tomasbosak.blogspot.com/2008/02/calculating-page-load-time-in-aspnet.html' title='Calculating page load time in ASP.NET'/><author><name>Tom!</name><uri>http://www.blogger.com/profile/03078924436861485668</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://1.bp.blogspot.com/_REiym_3H-dw/SZdOAltBVSI/AAAAAAAAAVk/OSlL3AgI6yo/S220/Don.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1104336261586813151.post-4721991718510642493</id><published>2008-02-03T08:58:00.000-08:00</published><updated>2008-02-03T09:53:28.626-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET Framework'/><title type='text'>Retrieving web server headers information in .NET</title><content type='html'>&lt;div align="justify"&gt;&lt;br /&gt;Web server headers could contain information such as server type, content type, connection, cache control and many others. This data can be provided by &lt;a href="http://msdn2.microsoft.com/en-us/library/system.net.webclient.aspx"&gt;WebClient&lt;/a&gt; class (System.Net namespace) through &lt;a href="http://msdn2.microsoft.com/en-us/library/system.net.webclient_members.aspx"&gt;DownloadData&lt;/a&gt; method which downloads data from specified &lt;a href="http://en.wikipedia.org/wiki/Uniform_Resource_Identifier"&gt;URI&lt;/a&gt; as a byte array. Then &lt;a href="http://msdn2.microsoft.com/en-us/library/system.net.webheadercollection.aspx"&gt;WebHeaderCollection&lt;/a&gt; class is used to access single headers in collection. Some or most of the information located in headers could be hidden and not allowed to read. This depends on web server configuration. Here is the example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;WebClient wc = new WebClient();&lt;br /&gt;&lt;br /&gt;byte[] response = wc.DownloadData("http://www.blogspot.com");&lt;br /&gt;&lt;br /&gt;WebHeaderCollection whc = wc.ResponseHeaders;&lt;br /&gt;&lt;br /&gt;Console.WriteLine("Number of headers: " + whc.Count + "\n");&lt;br /&gt;&lt;br /&gt;for (int i = 0; i &lt; whc.Count; i++)&lt;br /&gt;{&lt;br /&gt;    Console.WriteLine(whc.GetKey(i) + " = " + whc.Get(i));&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Output:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Number of headers: 7&lt;br /&gt;&lt;br /&gt;Pragma = no-cache&lt;br /&gt;Content-Length = 15051&lt;br /&gt;Cache-Control = private, no-cache, proxy-revalidate&lt;br /&gt;Content-Type = text/html; charset=UTF-8&lt;br /&gt;Date = Sun, 03 Feb 2008 17:50:07 GMT&lt;br /&gt;Set-Cookie = S=blogger=ibA8fXdlcSXv1IJKTxl1Zw; Domain=.blogger.com; Path=/&lt;br /&gt;Server = GFE/1.3&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1104336261586813151-4721991718510642493?l=tomasbosak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomasbosak.blogspot.com/feeds/4721991718510642493/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1104336261586813151&amp;postID=4721991718510642493' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/4721991718510642493'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/4721991718510642493'/><link rel='alternate' type='text/html' href='http://tomasbosak.blogspot.com/2008/02/retrieving-web-server-headers.html' title='Retrieving web server headers information in .NET'/><author><name>Tom!</name><uri>http://www.blogger.com/profile/03078924436861485668</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://1.bp.blogspot.com/_REiym_3H-dw/SZdOAltBVSI/AAAAAAAAAVk/OSlL3AgI6yo/S220/Don.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1104336261586813151.post-4032147970966035766</id><published>2008-02-01T10:50:00.000-08:00</published><updated>2008-02-01T14:43:45.260-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET Framework'/><title type='text'>LINQ vs SqlDataReader performance test</title><content type='html'>&lt;div align="justify"&gt;&lt;br /&gt;I recently read an older &lt;a href="http://aspnet.4guysfromrolla.com/demos/printPage.aspx?path=/articles/050405-1.aspx"&gt;article&lt;/a&gt; which was written about performance difference between &lt;a href="http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader(VS.80).aspx"&gt;SqlDataReader&lt;/a&gt; and &lt;a href="http://msdn2.microsoft.com/en-us/library/system.data.dataset.aspx"&gt;DataSet&lt;/a&gt; where the former was much more faster when reading 1000 records. Release of &lt;a href="http://en.wikipedia.org/wiki/.NET_Framework"&gt;.NET Framework&lt;/a&gt; 3.5 brought the new way of data querying capabilities - &lt;a href="http://en.wikipedia.org/wiki/Language_Integrated_Query"&gt;LINQ&lt;/a&gt;, so I wanted to know if it is better or worse than SqlDateReader in performance. This was my first database performance test so the system of measurement is not ideal, but I think it is relevant (critics is welcome).&lt;br /&gt;&lt;br /&gt;Core of this test is &lt;a href="http://en.wikipedia.org/wiki/Microsoft_SQL_Server"&gt;SQL Server&lt;/a&gt; 2005 Express Edition database filled by 4000 records representing employees. Each record has three columns. Measurement method is based on distinction between end and start time which are DateTime values. Start time is set at the beginning and end time at the end of both methods (either LINQ or SqlDataReader case). Method itself creates LINQ or SqlDataReader object, connect to database and retrieves all records to generic list. Connection to database in LINQ is created internally by LINQ to SQL class. SqlDataReader connection is created "manually" by &lt;a href="http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.aspx"&gt;SqlConnection&lt;/a&gt; class and connection string. Examples:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;LINQ&lt;/b&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;startTime = DateTime.Now;&lt;br /&gt;&lt;br /&gt;LinqDataContext linq = new LinqDataContext();&lt;br /&gt;&lt;br /&gt;var q =&lt;br /&gt;    from e in linq.EmployeeTable&lt;br /&gt;    select e;&lt;br /&gt;&lt;br /&gt;Employee employee;&lt;br /&gt;List&lt;Employee&gt; employees = new List&lt;Employee&gt;();&lt;br /&gt;&lt;br /&gt;foreach (var empl in q)&lt;br /&gt;{&lt;br /&gt;    employee = new Employee();&lt;br /&gt;&lt;br /&gt;    employee.Id = empl.id;&lt;br /&gt;    employee.Name = empl.name;&lt;br /&gt;    employee.Surename = empl.surename;&lt;br /&gt;&lt;br /&gt;    employees.Add(employee);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;endTime = DateTime.Now;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;SqlDataReader&lt;/b&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;private SqlConnection con;&lt;br /&gt;private SqlCommand cmd;&lt;br /&gt;private SqlDataReader reader;&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;startTime = DateTime.Now;&lt;br /&gt;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;    conString = ConfigurationManager.ConnectionStrings["DBSpeedTest.Properties.Settings.SpeedTestConnectionString"].ConnectionString;&lt;br /&gt;    con = new SqlConnection(conString);&lt;br /&gt;    con.Open();&lt;br /&gt;}&lt;br /&gt;catch (Exception ex)&lt;br /&gt;{&lt;br /&gt;    con.Close();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;cmd = new SqlCommand("SELECT * FROM Employees", con);&lt;br /&gt;cmd.CommandType = CommandType.Text;&lt;br /&gt;reader = cmd.ExecuteReader();&lt;br /&gt;&lt;br /&gt;Employee employee;&lt;br /&gt;List&lt;Employee&gt; employees = new List&lt;Employee&gt;();&lt;br /&gt;&lt;br /&gt;while (reader.Read())&lt;br /&gt;{&lt;br /&gt;    employee = new Employee();&lt;br /&gt;&lt;br /&gt;    employee.Id = reader.GetInt64(0);&lt;br /&gt;    employee.Name = reader.GetString(1);&lt;br /&gt;    employee.Surename = reader.GetString(2);&lt;br /&gt;&lt;br /&gt;    employees.Add(employee);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;reader.Close();&lt;br /&gt;con.Close();&lt;br /&gt;&lt;br /&gt;endTime = DateTime.Now;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Distinction between times is calculated through &lt;a href="http://msdn2.microsoft.com/en-us/library/system.timespan.aspx"&gt;TimeSpan structure&lt;/a&gt;. Methods are located in extra classes for better reading:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;SpeedTest_DataReader dataReader = new SpeedTest_DataReader();&lt;br /&gt;&lt;br /&gt;List&lt;Employee&gt; drList = dataReader.GetAllEmployees();&lt;br /&gt;&lt;br /&gt;SpeedTest_Linq linq = new SpeedTest_Linq();&lt;br /&gt;&lt;br /&gt;List&lt;Employee&gt; lqList = linq.GetAllEmployees();&lt;br /&gt;&lt;br /&gt;TimeSpan dr = dataReader.EndTime - dataReader.StartTime;&lt;br /&gt;&lt;br /&gt;Console.WriteLine("\nDataReader:\t{0} : {1}", dr.Seconds, dr.Milliseconds);&lt;br /&gt;&lt;br /&gt;TimeSpan lq = linq.EndTime - linq.StartTime;&lt;br /&gt;&lt;br /&gt;Console.WriteLine("Linq:\t\t{0} : {1}\n\n", lq.Seconds, lq.Milliseconds);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I run this test 30 times in loop and the result was that LINQ is in general slower than SqlDataReader approximately from some microseconds to 35 miliseconds except the first reading from database where is LINQ faster (appr. 200 miliseconds lower time than SqlDataReader). I think this is due to way of first time connecting to database and related procedures.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1104336261586813151-4032147970966035766?l=tomasbosak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomasbosak.blogspot.com/feeds/4032147970966035766/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1104336261586813151&amp;postID=4032147970966035766' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/4032147970966035766'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/4032147970966035766'/><link rel='alternate' type='text/html' href='http://tomasbosak.blogspot.com/2008/02/linq-vs-sqldatareader-performance-test.html' title='LINQ vs SqlDataReader performance test'/><author><name>Tom!</name><uri>http://www.blogger.com/profile/03078924436861485668</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://1.bp.blogspot.com/_REiym_3H-dw/SZdOAltBVSI/AAAAAAAAAVk/OSlL3AgI6yo/S220/Don.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1104336261586813151.post-3926032902948566428</id><published>2008-01-30T03:03:00.000-08:00</published><updated>2008-01-30T09:47:08.437-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Object oriented programming'/><title type='text'>Generic collections</title><content type='html'>&lt;div align="justify"&gt;&lt;br /&gt;Object oriented programming has in general three fundamental principles which contains &lt;a href="http://en.wikipedia.org/wiki/Encapsulation_(classes_-_computers)"&gt;encapsulation&lt;/a&gt;, &lt;a href="http://en.wikipedia.org/wiki/Inheritance_(computer_science)"&gt;inheritance&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming"&gt;polymorphism&lt;/a&gt;. Present time and the modern way of programming extends this principles with &lt;a href="http://en.wikipedia.org/wiki/Generic_programming"&gt;generics&lt;/a&gt;. As a parameterized types, generics provides pattern how to process the same algorithm with various types of parametres. This ability is very useful for example in &lt;a href="http://en.wikipedia.org/wiki/Collection_(computing)"&gt;list collection&lt;/a&gt;. With generic collections there is no longer need to create special implementation of list for different data types or objects (except special purposes). Example below will show generic list in C#. At first I will create a class which will represent single employee. This class will store id, name and surename:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;class Employee&lt;br /&gt;{&lt;br /&gt;    private long id;&lt;br /&gt;    private string name;&lt;br /&gt;    private string surename;&lt;br /&gt;&lt;br /&gt;    public long Id&lt;br /&gt;    {&lt;br /&gt;        get { return id; }&lt;br /&gt;        set { id = value; }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public string Name&lt;br /&gt;    {&lt;br /&gt;        get { return name; }&lt;br /&gt;        set { name = value; }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public string Surename&lt;br /&gt;    {&lt;br /&gt;        get { return surename; }&lt;br /&gt;        set { surename = value; }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Next lines will create simple &lt;a href="http://msdn2.microsoft.com/en-us/library/6sh2ey19.aspx"&gt;generic list&lt;/a&gt; of employees. Body of loop instantiate an Employee object and fills it up with sample data. &lt;a href="http://msdn2.microsoft.com/en-us/library/3wcytfd1.aspx"&gt;Add&lt;/a&gt; method is then used to append object to the end of the list.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;List&amp;lt;Employee&amp;gt; employees = new List&amp;lt;Employee&amp;gt;();&lt;br /&gt;Employee employee;&lt;br /&gt;&lt;br /&gt;for (int i = 0; i &lt; 10; i++)&lt;br /&gt;{&lt;br /&gt;    employee = new Employee();&lt;br /&gt;&lt;br /&gt;    employee.Id = i;&lt;br /&gt;    employee.Name = "name" + i.ToString();&lt;br /&gt;    employee.Surename = "surename" + i.ToString();&lt;br /&gt;&lt;br /&gt;    employees.Add(employee);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Reading from the list is also simple job. All the values of Employee object can be accessed through the foreach loop:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;foreach (Employee person in employees)&lt;br /&gt;{&lt;br /&gt;    Console.Write(person.Id);&lt;br /&gt;    Console.Write("   ");&lt;br /&gt;    Console.Write(person.Name);&lt;br /&gt;    Console.Write("   ");&lt;br /&gt;    Console.Write(person.Surename);&lt;br /&gt;    Console.WriteLine();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;More information and examples:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/512aeb7t(VS.80).aspx"&gt;Generics in C#&lt;/a&gt;&lt;br /&gt;&lt;a href="http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html"&gt;Generics in Java&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ybcx56wz(VS.80).aspx"&gt;Collection Classes (C# Programming Guide)&lt;/a&gt;&lt;br /&gt;&lt;a href="http://java.sun.com/docs/books/tutorial/collections/index.html"&gt;Collections in Java&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1104336261586813151-3926032902948566428?l=tomasbosak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomasbosak.blogspot.com/feeds/3926032902948566428/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1104336261586813151&amp;postID=3926032902948566428' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/3926032902948566428'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/3926032902948566428'/><link rel='alternate' type='text/html' href='http://tomasbosak.blogspot.com/2008/01/generic-collections.html' title='Generic collections'/><author><name>Tom!</name><uri>http://www.blogger.com/profile/03078924436861485668</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://1.bp.blogspot.com/_REiym_3H-dw/SZdOAltBVSI/AAAAAAAAAVk/OSlL3AgI6yo/S220/Don.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1104336261586813151.post-5789828264057093322</id><published>2008-01-28T09:14:00.000-08:00</published><updated>2008-01-28T12:25:03.823-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><title type='text'>Creating table programatically in Java</title><content type='html'>&lt;div align="justify"&gt;&lt;br /&gt;I would say that creating tables in nowadays is really simple job through visual designer in almost all IDEs. Creating them dynamically through the code needs little bit more work. I will create and explain this way using &lt;a href="http://en.wikipedia.org/wiki/Swing_(Java)"&gt;swing&lt;/a&gt; &lt;a href="http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JTable.html"&gt;JTable&lt;/a&gt; in example below:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;JTable javaTable = new JTable();&lt;br /&gt;&lt;br /&gt;DefaultTableModel tbm = new DefaultTableModel();&lt;br /&gt;tbm.addColumn("ID"); &lt;br /&gt;tbm.addColumn("Name");&lt;br /&gt;tbm.addColumn("Surename");&lt;br /&gt;&lt;br /&gt;javaTable.setModel(tbm);&lt;br /&gt;&lt;br /&gt;Vector&lt;String&gt; dataVector;&lt;br /&gt;        &lt;br /&gt;for (int i = 0; i &lt; 10; i++) {         &lt;br /&gt;    dataVector = new Vector&lt;String&gt;();&lt;br /&gt;    dataVector.addElement(String.valueOf(i));&lt;br /&gt;    dataVector.addElement("xxx");&lt;br /&gt;    dataVector.addElement("yyy");&lt;br /&gt;&lt;br /&gt;    tbm.addRow(dataVector);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/table/DefaultTableModel.html"&gt;DefaultTableModel&lt;/a&gt; is a class that is used as a model for JTable which contains columns and rows. There are three overloaded methods which are used to add columns to table model. I'm using &lt;a href="http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/table/DefaultTableModel.html#addColumn(java.lang.Object)"&gt;addColumn&lt;/a&gt; method which accepts string parameter in upper example as a column name. Next line set data model to table through &lt;a href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JTable.html#setModel(javax.swing.table.TableModel)"&gt;setModel&lt;/a&gt; method. &lt;a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/Vector.html"&gt;Vector&lt;/a&gt; class is used to store items which will be added to table model row in loop by &lt;a href="http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/table/DefaultTableModel.html#addRow(java.util.Vector)"&gt;addRow&lt;/a&gt; method that is also overloaded for various types of use. Result of this example is dynamically created table with three columns and 10 rows of sample data.&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1104336261586813151-5789828264057093322?l=tomasbosak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomasbosak.blogspot.com/feeds/5789828264057093322/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1104336261586813151&amp;postID=5789828264057093322' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/5789828264057093322'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/5789828264057093322'/><link rel='alternate' type='text/html' href='http://tomasbosak.blogspot.com/2008/01/creating-table-programatically-in-java.html' title='Creating table programatically in Java'/><author><name>Tom!</name><uri>http://www.blogger.com/profile/03078924436861485668</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://1.bp.blogspot.com/_REiym_3H-dw/SZdOAltBVSI/AAAAAAAAAVk/OSlL3AgI6yo/S220/Don.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1104336261586813151.post-44912843403557579</id><published>2008-01-26T10:28:00.000-08:00</published><updated>2008-02-10T03:32:18.337-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.NET Framework'/><title type='text'>Separating numeric values in C#</title><content type='html'>&lt;div align="justify"&gt;&lt;br /&gt;Strings has various types of inscription. We could often encounter during the development that for example we need to separate numeric value (10000000) by three digits (1 000 000). Most used methods that can be used to format some string(s) are &lt;a href="http://msdn2.microsoft.com/en-us/library/aa324760.aspx"&gt;Console.WriteLine&lt;/a&gt; or &lt;a href="http://msdn2.microsoft.com/en-us/library/system.string.format.aspx"&gt;String.Format&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;int income = 1000000;&lt;br /&gt;Console.WriteLine("{0}", income);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This example will print out value '1000000' in raw format without any distinction between digits that should be obvious separated by thousands. Solution for this issue is to add ':n0' specificator into the string.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;int income = 1000000;&lt;br /&gt;Console.WriteLine("{0:n0}", income);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now we have our value formatted '1 000 000' so it is more readable. This case will also work with String.Format method. In backward conversion is this value as a string. To convert it back to integer we need to use &lt;a href="http://msdn2.microsoft.com/en-us/library/aa328657.aspx"&gt;Parse&lt;/a&gt; method which is overloaded and can be used to solve our problem.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;string myString = "1 000 000";  &lt;br /&gt;Console.WriteLine(myString);  &lt;br /&gt;&lt;br /&gt;int myInteger = int.Parse(myString, System.Globalization.NumberStyles.AllowThousands);  &lt;br /&gt;Console.WriteLine(myInteger);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;C# provides many ways how to format values into custom format. Here are some examples:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blog.stevex.net/index.php/string-formatting-in-csharp/"&gt;String formatting in C#&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/txafckwd.aspx"&gt;Composite Formatting&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/dwhawy9k.aspx"&gt;Standard Numeric Format Strings&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/0c899ak8.aspx"&gt;Custom Numeric Format Strings&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/az4se3k1.aspx"&gt;Standard Date and Time Format Strings&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/8kb3ddd4.aspx"&gt;Custom Date and Time Format Strings&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1104336261586813151-44912843403557579?l=tomasbosak.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tomasbosak.blogspot.com/feeds/44912843403557579/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1104336261586813151&amp;postID=44912843403557579' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/44912843403557579'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1104336261586813151/posts/default/44912843403557579'/><link rel='alternate' type='text/html' href='http://tomasbosak.blogspot.com/2008/01/separating-numeric-values-in-c.html' title='Separating numeric values in C#'/><author><name>Tom!</name><uri>http://www.blogger.com/profile/03078924436861485668</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='31' height='32' src='http://1.bp.blogspot.com/_REiym_3H-dw/SZdOAltBVSI/AAAAAAAAAVk/OSlL3AgI6yo/S220/Don.jpg'/></author><thr:total>0</thr:total></entry></feed>
