<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Development</title>
        <link>http://geekswithblogs.net/kobush/category/1584.aspx</link>
        <description>Development</description>
        <language>pl-PL</language>
        <copyright>Szymon Kobalczyk</copyright>
        <managingEditor>skobalczyk@gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>How I won the Lab49 WPF in Finance Innovation Contest?</title>
            <link>http://geekswithblogs.net/kobush/archive/2008/03/17/120601.aspx</link>
            <description>&lt;p&gt;&lt;img style="margin: 0px 0px 5px 5px" src="http://www.lab49.com/files/logos/wpf_logo_blue3.gif" align="right" /&gt;Honestly, I still don't know how I did it. The LAB49 &lt;a href="http://wpfcontest.lab49.com/"&gt;WPF in Finance Innovation Contest&lt;/a&gt; was announced back in December and I think I first read about it on &lt;a href="http://blogs.msdn.com/tims/archive/2007/12/04/wpf-and-silverlight-contest-season-is-here.aspx"&gt;Tim Sneath blog&lt;/a&gt;. With &lt;a href="http://wpfcontest.lab49.com/prizes.aspx"&gt;all the cool prizes&lt;/a&gt; I was very inclined to participate, but it quickly turned out that its available only to US citizens. However that changed in the first week of February, so I started considering it again, but still didn't had any clue what to do. You see the goal of this contest was to create a WPF application that visualizes a set of provided financial data in some interesting way. While the first part was easy (writing the app in WPF) the hardest part was to figure out what to do with the data. Only after "last call to action" email from Daniel Chait I decided its about time to start coding.&lt;/p&gt; &lt;p&gt;Because I started working late on this project, initially I wanted to create only a charting control capable of displaying the line and candlestick plot of stock prices. But after the contest deadline was extended I started thinking of a better way to visualize the stock prices for a given day – something that goes beyond a simple listbox or a datagrid. The next option I considered was to create a heatmap – i.e. use color gradients to denote the change in stock prices relative to the previous day. But in all samples I’ve seen these symbols were placed on a regular grid and the placement didn’t correspond in any particular way with the data. I started thinking about how to sort the symbols so that those that experienced similar data change would be close to each other, and those with different data change remain further apart. This finally led me to the idea of applying &lt;a href="http://www.red3d.com/cwr/boids/"&gt;Craig Reynolds’ flocking algorithm&lt;/a&gt; to perform this clustering.  &lt;/p&gt;&lt;p&gt;Here is a screenshot from my final entry called &lt;strong&gt;Stock Information Boids&lt;/strong&gt;:  &lt;/p&gt;&lt;p align="center"&gt; &lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/HowIwontheLab49WPFinFinanceInnovationCon_11EC2/image_4.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="480" alt="Stock Information Boids WPF Application" src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/HowIwontheLab49WPFinFinanceInnovationCon_11EC2/image_thumb_1.png" width="591" border="0" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Also you can already download the source code for this application from &lt;a href="http://code.msdn.microsoft.com/KobushCode/Release/ProjectReleases.aspx?ReleaseId=667"&gt;my resource page at MSDN Code Gallery&lt;/a&gt;. Make sure to read the user guide that describes how the algorithm works and how to use the application.  &lt;/p&gt;&lt;p&gt;Turns out that for some reason the judges liked my solution, because last week at the closing keynote of 2008 &lt;a href="http://www.financialdevelopers.com"&gt;Microsoft Financial Services Developer Conference&lt;/a&gt; in New York, &lt;a href="http://blog.lab49.com/archives/1888"&gt;Daniel Chait announced&lt;/a&gt; that I won &lt;a href="http://blog.lab49.com/archives/1884"&gt;the grand prize in the contest&lt;/a&gt;!  &lt;/p&gt;&lt;p&gt;The two finalist were &lt;strong&gt;Jacob Carpenter&lt;/strong&gt; and &lt;strong&gt;Jobi K Joy&lt;/strong&gt;, while the honorable mention went to &lt;strong&gt;Paul Hounshell&lt;/strong&gt;. Congratulations guys, great work! You can download their very cool applications from here: &lt;/p&gt; &lt;p&gt;&lt;iframe style="border-right: #dde5e9 1px solid; padding-right: 0px; border-top: #dde5e9 1px solid; padding-left: 0px; padding-bottom: 0px; margin: 3px; border-left: #dde5e9 1px solid; width: 240px; padding-top: 0px; border-bottom: #dde5e9 1px solid; height: 66px; background-color: #ffffff" marginwidth="0" marginheight="0" src="http://cid-5b79e3a01fce9e08.skydrive.live.com/embedrowdetail.aspx/2008%20WPF%20in%20Finance%20Innovation%20Contest" frameborder="0" scrolling="no"&gt;&lt;/iframe&gt;&lt;/p&gt; &lt;p&gt;In following weeks I will try to share some details on my implementations (in particular about the Timeline and Flock controls). I was already told that &lt;a href="http://jobijoy.blogspot.com/"&gt;Jobi K Joy&lt;/a&gt; and &lt;a href="http://jacobcarpenter.wordpress.com/"&gt;Jacob Carpenter&lt;/a&gt; plan to do the same, so make sure to subscribe to their blogs too.  &lt;/p&gt;&lt;p&gt;I would like to thank &lt;a href="http://wpfcontest.lab49.com/judges.aspx"&gt;the judges&lt;/a&gt; for selecting my entry. And last but not least, big kisses for my wife Joanna for letting me work on the project all nights and weekends considering her present condition (L)&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=120601"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=120601" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/kobush/aggbug/120601.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Szymon Kobalczyk</dc:creator>
            <guid>http://geekswithblogs.net/kobush/archive/2008/03/17/120601.aspx</guid>
            <pubDate>Mon, 17 Mar 2008 20:39:06 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/kobush/comments/120601.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/kobush/archive/2008/03/17/120601.aspx#feedback</comments>
            <slash:comments>5</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/kobush/comments/commentRss/120601.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/kobush/services/trackbacks/120601.aspx</trackback:ping>
        </item>
        <item>
            <title>Moving my code samples to MSDN Code Gallery</title>
            <link>http://geekswithblogs.net/kobush/archive/2008/02/19/119752.aspx</link>
            <description>&lt;p&gt;When I started blogging here on GeeksWithBlogs it turned out that if want to publish any code samples I have to find yet another place to host the source code. I didn't own any web servers that I could use for this, so I started looking how other bloggers do this, and came across &lt;a href="http://www.projectdistributor.net/" target="_blank"&gt;ProjectDistributor.net&lt;/a&gt;. It did exactly what I was looking for:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;ProjectDistributor is a web application for distributing small pieces of software - such as tools, components, widgets and controls. Users create groups to store projects against and visitors can login to download those projects or to leave feedback about bugs or to request new features. &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Although it's quite simple and didn't offer many features it did a decent job hosting my samples. The projects can be grouped by author and category. &lt;/p&gt;  &lt;p&gt;However recently I got several comments that the download links don't work, and the site was down for some time (now it's up again). To fix this I decided to move my files to &lt;a href="skydrive.live.com" target="_blank"&gt;Windows Live SkyDrive&lt;/a&gt;. It's a generic service for hosting any files on internet. When you sign up you get 1GB of free space. The UI is very simple: you can create folders, setup the permissions (private, shared or public) and you then quickly upload your files. &lt;/p&gt;  &lt;p&gt;The nice addition is that when you publish a file on SkyDrive, it creates a nicely formatted HTML snippets that you can embed in your page (there is even a &lt;a href="http://gallery.live.com/liveItemDetail.aspx?li=27545581-4b54-4f6d-9007-ed3b168dab43&amp;amp;pl=8&amp;amp;bt=9" target="_blank"&gt;Windows Live Writer plugin&lt;/a&gt; that helps you with this):&lt;/p&gt;  &lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/MovingmysamplestoMSDNCodeGallery_12403/image_2.png" target="_blank"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="500" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/MovingmysamplestoMSDNCodeGallery_12403/image_thumb.png" width="567" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;These nice emblems is the only thing I really miss abut SkyDrive. They were just easier to find on the page then a simple download link.&lt;/p&gt;  &lt;p&gt;But as I said, SkyDrive is a generic service not really targeted to host programming samples. You don't get any ways to categorize, tag or search the projects. You don't even get the number of downloads or any other statistics. In addition some of my friends reported that they get redirected to Sign In page for Windows Live whenever they open my blog.&lt;/p&gt;  &lt;p&gt;That's why when I heard about CodePlex's younger brother – &lt;a href="http://code.msdn.microsoft.com/" target="_blank"&gt;MSDN Code Gallery&lt;/a&gt; on recent &lt;a href="http://www.dotnetrocks.com/default.aspx?showNum=316" target="_blank"&gt;.NET Rocks! interview with Matthew Manela&lt;/a&gt; I decided to give it a try and this weekend I moved all my samples there:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/MovingmysamplestoMSDNCodeGallery_12403/image_4.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="386" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/MovingmysamplestoMSDNCodeGallery_12403/image_thumb_1.png" width="660" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Here is the link to my resources page: &lt;a title="http://code.msdn.microsoft.com/KobushCode" href="http://code.msdn.microsoft.com/KobushCode"&gt;http://code.msdn.microsoft.com/KobushCode&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;My experience so far was very positive. It's basically a CodePlex (even shares the same codebase from what I heard) but without the TFS integration - so you don't get version control or project management features. But when you create a resource page you still get:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Home page &lt;/strong&gt;that you can edit with wiki syntax and supports comments. You can also create subpages to publish your articles or documentation. You can also &lt;strong&gt;tag&lt;/strong&gt; your project so it would be easier to find for others. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Rleases tab &lt;/strong&gt;where you publish your source code, binaries or stand alone documentation (and it has a downloads counter). &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Discussions forum &lt;/strong&gt;that your readers can use to publish questions or comments. &lt;/li&gt;    &lt;li&gt;You can even run an &lt;strong&gt;Issue Tracker &lt;/strong&gt;to record bugs or feature requests if you need to (it's optional and you can turn it on in the Resource Page Settings). &lt;/li&gt;    &lt;li&gt;If you find someone to help you out with the project you can manage your team on the &lt;strong&gt;People tab&lt;/strong&gt;. &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;License tab &lt;/strong&gt;shows the terms and conditions the user needs to agree when downloading your code. Note that currently it's the &lt;a href="http://www.microsoft.com/resources/sharedsource/licensingbasics/publiclicense.mspx" target="_blank"&gt;Microsoft Public License (Ms-PL)&lt;/a&gt; and you cannot change it (you can do this on CodePlex though). It's a basic "use it how you want - no guarantee" type of license, and personally I don't have any objections to it but you need to judge it for yourself. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Also note that while I decided to publish all my samples on a single resources page, nothing prevents you from creating more than one. You can then link them together using &lt;strong&gt;Related Resource Pages&lt;/strong&gt; sections. &lt;/p&gt;  &lt;p&gt;For me the site offers all I really need to host my code samples. But if your project eventually grows and you need more features you can move it to &lt;a href="http://www.codeplex.com/" target="_blank"&gt;CodePlex&lt;/a&gt; (I wonder if there will be any migration path for doing this). Also note that in many aspects it replaces now retired GotDotNet site and some popular samples &lt;a href="http://code.msdn.microsoft.com/GotDotNet.aspx" target="_blank"&gt;were migrated from it&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;Probably most bloggers that write about programming face the same problem that I had, and MSDN Code Gallery does a good job solving it. So if you are looking for a place to put your samples I strongly recommend to give it a try. &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=119752"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=119752" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/kobush/aggbug/119752.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Szymon Kobalczyk</dc:creator>
            <guid>http://geekswithblogs.net/kobush/archive/2008/02/19/119752.aspx</guid>
            <pubDate>Tue, 19 Feb 2008 06:14:13 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/kobush/comments/119752.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/kobush/archive/2008/02/19/119752.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/kobush/comments/commentRss/119752.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/kobush/services/trackbacks/119752.aspx</trackback:ping>
        </item>
        <item>
            <title>Introducing WikiSpider</title>
            <link>http://geekswithblogs.net/kobush/archive/2008/01/30/119101.aspx</link>
            <description>&lt;p&gt;About two weeks ago &lt;a href="http://www.microsoft.com/poland/developer/kontakt/dbiesiada.mspx"&gt;Daniel Biesiada&lt;/a&gt; (who is ISV DE here in Poland) announced on his blog a little &lt;a href="http://blogs.msdn.com/danieb/archive/2008/01/13/pl-geek-w-spos-b-na-nud-w-tym-konkurs.aspx"&gt;programming contest&lt;/a&gt;. The goal was to build a .NET application that would check if the the theory of &lt;a href="http://en.wikipedia.org/wiki/Six_degrees_of_separation"&gt;Six Degrees of separation&lt;/a&gt; applies to two given topics in Wikipedia. In order words to find a path from the source page to destination with no more then six links. At the time I had not much else to do (apart from setting up website for the &lt;a href="http://www.c2c2008.pl/"&gt;C2C Conference&lt;/a&gt;, helping out with the &lt;a href="http://poland.silverlightchallenge.eu/"&gt;European Silverlight Challenge&lt;/a&gt;, and preparing for the WPF Beta Exam) so I decided to give it a try. &lt;/p&gt; &lt;p&gt;Fast forward two weeks and I present you my WikiSpider:&lt;/p&gt; &lt;p align="center"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="534" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/e10a9ad47337_11C9E/image_3.png" width="600" border="0" /&gt; &lt;/p&gt; &lt;p&gt;As usual building this took me much more time than I initially anticipated (including few sleepless nights). And still I didn't make it before the deadline, so this even didn't count as a contest entry anymore (sigh!). However this was mainly because my personal goal was to throw in there every new piece of .NET 3.5 I could find fit - and most of them I never used before. &lt;/p&gt; &lt;p&gt;Here are some key technologies I managed to put into this:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;The UI is done in &lt;strong&gt;WPF&lt;/strong&gt; (and this was the only thing here I knew a bit about). However I borrowed the graph control from the excellent &lt;a href="http://j832.com/BagOTricks/"&gt;Kevin's WPF Bag-o-Tricks&lt;/a&gt;.  &lt;/li&gt;&lt;li&gt;The caching is done using &lt;strong&gt;SQL Server Express&lt;/strong&gt;. Initially I wanted to do this using &lt;strong&gt;SQL Compact &lt;/strong&gt;but I run into performance issues and had to switch to full SQL in order to run the queries in profiler. But since this was fixed (with big help from &lt;a href="http://zine.net.pl/blogs/sqlgeek/"&gt;Paweł Potasiński&lt;/a&gt;) I could try with SQL Compact again.  &lt;/li&gt;&lt;li&gt;Of course data-access is done using &lt;strong&gt;LINQ to SQL&lt;/strong&gt;. And of course this was the main source of my problems, as it was first time I've done anything in it, and so far I only read the &lt;a href="http://weblogs.asp.net/scottgu/archive/2007/08/27/linq-to-sql-part-8-executing-custom-sql-expressions.aspx"&gt;Scott Gu's tutorials&lt;/a&gt;. Still, I'm already in love with it.  &lt;/li&gt;&lt;li&gt;Speaking of LINQ. Initially we were screen scrapping the HTML pages to get all the links.  But turns out that Wikipedia has a little known about &lt;a href="http://en.wikipedia.org/w/query.php"&gt;Query API&lt;/a&gt; that enables to get the page content in XML. So the obvious move was to rewrite this part with &lt;strong&gt;LINQ to XML&lt;/strong&gt;.  &lt;/li&gt;&lt;li&gt;The path-finding algorithm was borrowed from &lt;a href="http://blogs.msdn.com/ericlippert/archive/2007/10/10/path-finding-using-a-in-c-3-0-part-four.aspx"&gt;Eric Lippert&lt;/a&gt;. The nice thing about it is that it uses lots of &lt;strong&gt;C# 3.0 language features&lt;/strong&gt;, so it is a great resource to learn from. The new C# syntax is so addictive that I already miss it in my other project.  &lt;/li&gt;&lt;li&gt;Finally, I wanted to publish the app with ClickOnce but run out of time. So maybe later. &lt;/li&gt;&lt;/ul&gt; &lt;p&gt;I learned many interesting things and tried out some new stuff that I wanted to check out anyway. I will try to share my discoveries in the next few days, but in the meantime feel free to download and take a look at may code (I know it's not prettiest piece of code you've seen but I was in a rush to finish this on time):&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;a title="SixDegreesOfWikipedia 1.0" href="http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=KobushCode&amp;amp;DownloadId=686"&gt;Download the source code&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Here you can also download the entries from other participants: &lt;a href="http://www.dbiesiada.com/projects/WikiPathFinding/wikiContest_LukaszSowa.zip"&gt;Łukasz Sowa&lt;/a&gt;, &lt;a href="http://www.dbiesiada.com/projects/WikiPathFinding/wikiContest_MaciejRutkowski.zip"&gt;Maciej Rutkowski&lt;/a&gt;, and &lt;a href="http://www.dbiesiada.com/projects/WikiPathFinding/WikiContest_ArkadiuszBenedykt.zip"&gt;Arkadiusz Benedykt&lt;/a&gt;. Congratulations to all of you!&lt;/p&gt; &lt;h3&gt;Installation&lt;/h3&gt; &lt;ol&gt; &lt;li&gt;Download the code from the above link and extract it.  &lt;/li&gt;&lt;li&gt;The application uses local SQL database for caching and unfortunately you need to create it yourself (now you know why I wanted to use SQL Compact). Simply launch SSMS and create empty database called WikiCache.  &lt;/li&gt;&lt;li&gt;Run the &lt;strong&gt;Create_WikiCacheDB.sql&lt;/strong&gt; script from the &lt;strong&gt;data &lt;/strong&gt;folder to create the database schema.  &lt;/li&gt;&lt;li&gt;By default the app is configured to look for the &lt;strong&gt;WikiCache &lt;/strong&gt;database on the local &lt;strong&gt;SQLEXPRESS &lt;/strong&gt;instance. If you installed it somewhere else update the connection string in &lt;strong&gt;app.config &lt;/strong&gt;accordingly.  &lt;/li&gt;&lt;li&gt;Run the &lt;strong&gt;build.bat &lt;/strong&gt;or open solution in Visual Studio 2008 and run from there.&lt;/li&gt;&lt;/ol&gt; &lt;h3&gt;Usage&lt;/h3&gt; &lt;ol&gt; &lt;li&gt;Enter the name of the Wikipedia page in the address bar at the top and press the Go! button. The entered topic and the pages it links to will be displayed as graph.  &lt;/li&gt;&lt;li&gt;Clicking on any topic will make it currently selected (put it in the center of the graph).  &lt;/li&gt;&lt;li&gt;Right-click on any topic to open the context menu. Select "&lt;em&gt;Open in browser&lt;/em&gt;" to.... load the page in browser.  &lt;/li&gt;&lt;li&gt;Select "&lt;em&gt;Set as source&lt;/em&gt;" or "&lt;em&gt;Set as destination&lt;/em&gt;" to put the topic name in appropriate field on the sidebar &lt;br /&gt;[Note: &lt;em&gt;Currently it's the only way to show the sidebar&lt;/em&gt;]  &lt;/li&gt;&lt;li&gt;You can also enter the source/destination topics manually.  &lt;/li&gt;&lt;li&gt;When both are set click on the &lt;em&gt;Start &lt;/em&gt;button to begin searching for the path. Few statistics are displayed on the bottom of the sidebar.  &lt;/li&gt;&lt;li&gt;During the search you can still use the graph or navigate to other pages (thanks to the BackgroundWorker magic).  &lt;/li&gt;&lt;li&gt;When path is found it is displayed on the sidebar, and you can click on each topic to center it on graph. &lt;/li&gt;&lt;/ol&gt; &lt;p&gt;Have fun! &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=119101"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=119101" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/kobush/aggbug/119101.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Szymon Kobalczyk</dc:creator>
            <guid>http://geekswithblogs.net/kobush/archive/2008/01/30/119101.aspx</guid>
            <pubDate>Wed, 30 Jan 2008 21:22:47 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/kobush/comments/119101.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/kobush/archive/2008/01/30/119101.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/kobush/comments/commentRss/119101.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/kobush/services/trackbacks/119101.aspx</trackback:ping>
        </item>
        <item>
            <title>Avoid common globalization errors in .NET</title>
            <link>http://geekswithblogs.net/kobush/archive/2007/09/16/avoidcommonglobalizationerrors.aspx</link>
            <description>&lt;p&gt;Last week I've been looking for a better RSS Reader (err... Aggregator). You see after certain number of feeds MS Outlook no longer works for me and I needed a better alternative. In my search I came a cross a product called &lt;a href="http://11011.net/software/rikreader"&gt;RikReader&lt;/a&gt; and decided to give it a try. Why? I've read some &lt;a href="http://learnwpf.com/Posts/Post.aspx?postId=7c0bda21-5061-47de-89df-358ff8e59308"&gt;good opinions&lt;/a&gt; about it, it's free, it uses &lt;a href="http://blogs.msdn.com/ie/archive/2006/02/01/522481.aspx"&gt;Windows RSS Platform&lt;/a&gt;, and is close to my heart because it is done entirely in WPF. &lt;/p&gt; &lt;p&gt;I promptly downloaded and installed the package. But instead of the expected welcome screen here is what I get every time I try to run it:&lt;/p&gt; &lt;p align="center"&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/33f3cac52dd9_8660/image_4.png"&gt;&lt;img height="249" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/33f3cac52dd9_8660/image_thumb_1.png" width="720" border="0" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;(The error message is in Polish but it says: The input string has incorrect format)&lt;/p&gt; &lt;p&gt;As you can see the application includes a very nice error reporting window (every modern application should have one!) so Douglas Stockwell, its author is probably already aware of the problem and hopefully working on the solution. But I think he wouldn't mind to give him a hand.&lt;/p&gt; &lt;p&gt;So what exactly is this problem here? From the stack trace above we can see that it all start in a custom binding converter called MultiplyConverter. My guess is that when this converter expects a decimal number, but encounters a String argument it first tries to convert it to a Double value by calling System.Convert.ToDouble. In the end this method rises exception to indicate that the given text doesn't seem to represent a valid decimal number. &lt;/p&gt; &lt;p&gt;Looks like a pretty obvious bug, so you may wonder why the author didn't fixed it already? You say he can't reproduce it? So what is so special about my system that I always get the same error? The answer is this: it uses different language settings! Should it matter?&lt;/p&gt; &lt;p&gt;Not all of my English-speaking fellow developers might realize this (and those who do sometimes "forget" about it) but not all cultures use the same format to write numbers or dates. You see in certain languages, like French (or in my case in Polish), we write decimal number where the decimal separator is not a &lt;strong&gt;dot&lt;/strong&gt; as in English but a &lt;strong&gt;coma&lt;/strong&gt;. So instead of 123.456 we would write 123,456. A subtle difference but with huge implications (at least for the dumb computer). &lt;/p&gt; &lt;p&gt;Here is a simple example to demonstrate this. The .NET library provides several ways to convert a number to a string:&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;double&lt;/span&gt; number = 123.456;
&lt;span class="kwrd"&gt;string&lt;/span&gt; convertToString = Convert.ToString(number);
&lt;span class="kwrd"&gt;string&lt;/span&gt; numberToString = number.ToString();
&lt;span class="kwrd"&gt;string&lt;/span&gt; stringFormat = String.Format(&lt;span class="str"&gt;"{0}"&lt;/span&gt;, number);&lt;/pre&gt;
&lt;p&gt;What do you think would be the value of each of these strings after running this code? The correct answer is it depends. For some systems this might be  "123.456", but for others this could as well be "123,456". This is because by default, each of these methods uses the current culture settings to produce the text representation of the numerical value.&lt;/p&gt;
&lt;p&gt;Similar there are several ways in .NET to parse the text to produce a decimal value:&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;string&lt;/span&gt; text = &lt;span class="str"&gt;"123.456"&lt;/span&gt;; 
&lt;span class="kwrd"&gt;double&lt;/span&gt; convertToDouble = Convert.ToDouble(text); 
&lt;span class="kwrd"&gt;double&lt;/span&gt; doubleParse = Double.Parse(text); 
&lt;span class="kwrd"&gt;double&lt;/span&gt; doubleTryParse; 
&lt;span class="kwrd"&gt;if&lt;/span&gt; (Double.TryParse(text, &lt;span class="kwrd"&gt;out&lt;/span&gt; doubleTryParse) == &lt;span class="kwrd"&gt;false&lt;/span&gt;) 
    Console.WriteLine(&lt;span class="str"&gt;"Can't parse string."&lt;/span&gt;);&lt;/pre&gt;
&lt;p&gt;Is this code correct? It also depends in which culture you run it. In some the code executes fine and each double variable gets the correct number. In others the first two methods would throw exceptions and the last one will return false to indicate the string is invalid. &lt;/p&gt;
&lt;p&gt;What this all means for you? If your application depends on storing decimal values in certain formats — for example attempts to read some settings from a text file — it can never depend on these methods alone. But not all is lost, and of course .NET provides means to handle such problem. &lt;/p&gt;
&lt;p&gt;Each of these methods has overrides that can take &lt;span style="color: rgb(43,145,175)"&gt;&lt;font face="Courier New"&gt;IFormatProvider&lt;/font&gt; &lt;/span&gt;as an argument. How do we find one?. It could be hard to guess at first but in this case you should use appropriate instance of &lt;font face="Courier New"&gt;&lt;span style="color: rgb(43,145,175)"&gt;CultureInfo &lt;/span&gt;&lt;/font&gt;class. So if you expect that the input value you need to parse will be formated in Polish use &lt;font face="Courier New"&gt;&lt;span style="color: rgb(43,145,175)"&gt;CultureInfo&lt;/span&gt;(&lt;span style="color: rgb(163,21,21)"&gt;"pl-pl"&lt;/span&gt;)&lt;/font&gt;. The same applies to output. Of course sometimes it might be hard to determine what culture you should use. But if you are in a lucky position that your application controls both input and output format then you can just pick any culture and use for both. Actually .NET already provides a nice shortcut for this via &lt;font face="Courier New"&gt;&lt;span style="color: rgb(43,145,175)"&gt;CultureInfo&lt;/span&gt;.InvariantCulture&lt;/font&gt;.&lt;/p&gt;
&lt;p&gt;I hope that by now you already know how to fix the above examples. Here is the corrected version that uses InvariantCulture:&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;string&lt;/span&gt; convertToString = Convert.ToString(number, CultureInfo.InvariantCulture); 
&lt;span class="kwrd"&gt;string&lt;/span&gt; numberToString = number.ToString(CultureInfo.InvariantCulture); 
&lt;span class="kwrd"&gt;string&lt;/span&gt; stringFormat = String.Format(CultureInfo.InvariantCulture, &lt;span class="str"&gt;"{0}"&lt;/span&gt;, number);

&lt;span class="kwrd"&gt;double&lt;/span&gt; convertToDouble = Convert.ToDouble(text, CultureInfo.InvariantCulture); 
&lt;span class="kwrd"&gt;double&lt;/span&gt; doubleParse = Double.Parse(text, CultureInfo.InvariantCulture); 
&lt;span class="kwrd"&gt;double&lt;/span&gt; doubleTryParse; 
&lt;span class="kwrd"&gt;if&lt;/span&gt; (Double.TryParse(text, NumberStyles.Any, CultureInfo.InvariantCulture, &lt;span class="kwrd"&gt;out&lt;/span&gt; doubleTryParse) == &lt;span class="kwrd"&gt;false&lt;/span&gt;) 
    Console.WriteLine(&lt;span class="str"&gt;"Can't parse string."&lt;/span&gt;);&lt;/pre&gt;
&lt;p&gt;As you see this change is fairly simple so I strongly encourage you to review your code and always consider what would be the proper format of the input or output value. The same rules apply to other decimal data types (&lt;font face="Courier New"&gt;Float&lt;/font&gt; and &lt;font face="Courier New"&gt;Decimal&lt;/font&gt;), but also to formating dates (&lt;font face="Courier New"&gt;DateTime&lt;/font&gt;). &lt;/p&gt;
&lt;p&gt;If you have a large, existing application reviewing it quickly can be bit cumbersome, but thankfully FxCop contains set of rules that can help find such spots. Here is the code analysis report obtained by running FxCop on the first version of the above examples:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/33f3cac52dd9_8660/image1.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="477" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/33f3cac52dd9_8660/image1_thumb.png" width="720" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;As you can see, it properly lists all lines with calls to methods that have overrides that take &lt;font face="Courier New"&gt;IFormatProvider&lt;/font&gt; (apart from &lt;font face="Courier New"&gt;Double.TryParse&lt;/font&gt;). With the corrected version of code all these warnings disappear. &lt;/p&gt;
&lt;p&gt;Also worth noting is that all methods used in the first example are actually shortcuts for passing the &lt;font face="Courier New"&gt;&lt;span style="color: rgb(43,145,175)"&gt;CultureInfo&lt;/span&gt;.CurrentCulture &lt;/font&gt;value that (if you haven't changed it in your code) holds the culture of your operating system. For most purposes, like displaying the value to the user, this works fine and you could leave it as it is. But when reading files or any external data-source you should always use exactly the same culture that was used to write it. &lt;/p&gt;
&lt;p&gt;Hopefully this information would help you avoid very common globalization errors that are quite annoying to many people living in this part of the world. If you need help ensuring that your application runs with no problems on non-English systems just e-mail me and we can test it together.&lt;/p&gt;
&lt;p&gt;You can &lt;a href="http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=KobushCode&amp;amp;DownloadId=687"&gt;download the sample project here&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=115394"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=115394" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/kobush/aggbug/115394.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Szymon Kobalczyk</dc:creator>
            <guid>http://geekswithblogs.net/kobush/archive/2007/09/16/avoidcommonglobalizationerrors.aspx</guid>
            <pubDate>Sun, 16 Sep 2007 18:50:57 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/kobush/comments/115394.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/kobush/archive/2007/09/16/avoidcommonglobalizationerrors.aspx#feedback</comments>
            <slash:comments>8</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/kobush/comments/commentRss/115394.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/kobush/services/trackbacks/115394.aspx</trackback:ping>
        </item>
        <item>
            <title>Getting started with ADO.NET Entity Framework. Part I: Mapping entities</title>
            <link>http://geekswithblogs.net/kobush/archive/2007/08/29/GettingStartedWithEntityFramework_1.aspx</link>
            <description>&lt;p&gt;Two months ago, after listening to &lt;a href="http://www.dotnetrocks.com/default.aspx?showNum=226"&gt;.NET Rocks! show with Daniel Simmons&lt;/a&gt;, I was really curious to learn more about ADO.NET Entity Framework (EF). As part of my learning I was ready to write a tutorial on how to get started with this framework. However there were no tools available at the time and with instructions on how to manually edit XML files the article turned very long, and quite frankly looked very boring. Hence I decided to postpone publishing it and wait for the tools to came out. &lt;/p&gt;
&lt;p&gt;This week Microsoft released &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=F1ADC5D1-A42E-40A6-A68C-A42EE11186F7&amp;amp;displaylang=en"&gt;ADO.NET Entity Framework Beta 2&lt;/a&gt;. You can find the complete release notes on the &lt;a href="http://blogs.msdn.com/adonet/archive/2007/08/27/entity-framework-beta-2-the-1st-entity-framework-tools-ctp-released.aspx"&gt;ADO.NET Team Blog&lt;/a&gt; so I won’t repeat it here. What’s more important we finally get &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=09A36081-5ED1-4648-B995-6239D0B77CB5&amp;amp;displaylang=en"&gt;the first CTP of Entity Framework Tools&lt;/a&gt;. So now I have all the pieces to attempt to write my tutorial again. &lt;/p&gt;
&lt;p align="center"&gt;• • •&lt;/p&gt;
&lt;p&gt;Microsoft went a long road to get into the ORM space starting with ObjectSpaces, then WinFS and now LINQ and Entity Framework. For those interested in the full story here is &lt;a href="http://blogs.msdn.com/mattwar/archive/2007/05/31/the-origin-of-linq-to-sql.aspx"&gt;nice article from one of the authors&lt;/a&gt;. Even though I'm by no means an ORM expert, I've worked before with number of both commercial and open source systems falling into this category. &lt;/p&gt;
&lt;p&gt;According to ADO.NET team Entity Framework is much more then just another ORM tool. The aim here is to solve a more generic problem of mapping conceptual model to application logic which is prevalent not only in storing programming objects but also in such areas as data replication, remoting and reporting. Which EF you maintain a single conceptual model of your domain objects (called entities here) that can be later mapped and reused with other representation.&lt;/p&gt;
&lt;p&gt;To learn new technology I usually develop a sample project so I have some well defined goal to achieve. This time again I choose to work with the &lt;a href="http://msdn2.microsoft.com/en-us/library/aa479071.aspx"&gt;PetShop 4.0 sample application&lt;/a&gt;. I prefer this sample for several reasons:&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;It contains existing entity model, so nice thing to try would if the whole data access code can be replaced with EF. &lt;/li&gt;
    &lt;li&gt;The application uses four databases in total, so it would test how to map the entity model to multiple data sources. &lt;/li&gt;
    &lt;li&gt;It is relatively simple and I worked with it before when &lt;a href="http://geekswithblogs.net/kobush/category/3702.aspx"&gt;learning CAB&lt;/a&gt;. &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Besides Northwind and Adventure Works are already mapped as EF samples so it would be no fun in using them. &lt;/p&gt;
&lt;h3&gt;Step 1. Generating entity model from database&lt;/h3&gt;
&lt;p&gt;Working with Entity Framework involves creating three schemas for your data: &lt;/p&gt;
&lt;p&gt;1. &lt;strong&gt;Conceptual Schema (CSDL)&lt;/strong&gt; — represents the conceptual model of your data, that is entities and their relationships (in current version this maps 1:1 to the generated object model).  &lt;/p&gt;
&lt;p&gt;2. &lt;strong&gt;Storage Metadata Schema (SSDL)&lt;/strong&gt; — describes the representation of your data when its stored in the database (or other storage media). &lt;/p&gt;
&lt;p&gt;3. &lt;strong&gt;Mapping Specification (MSL)&lt;/strong&gt; — as you can already guess this one describes how to map data from one of the above schemas to the another. &lt;/p&gt;
&lt;p&gt;All three are now defined as part of single XML document that will be part of your project (&lt;strong&gt;edmx&lt;/strong&gt;). &lt;/p&gt;
&lt;p&gt;The normal workflow for Entity Framework should start with first creating the concept model of entities and then work the storage and mapping schemas from there. However in many cases you will be working with existing applications, so it would be more convenient to start from the database schema instead. This release of EF targets this "data first" scenario with the &lt;strong&gt;EDM Wizard &lt;/strong&gt;built in Visual Studio. &lt;/p&gt;
&lt;p&gt;As I said before PetShop uses four databases: product inventory, orders, and two for ASP.NET users and profiles. For now I will concentrate on the first one. So to begin with let's see how this database looks like: &lt;/p&gt;
&lt;p align="center"&gt;&lt;img style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height="280" alt="PetShop 4 Inventory Database Diagram" width="680" border="0" src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/GettingstartedwithA.PartIMappingentities_BF5B/petshop_inventory_db_1.jpg" /&gt; &lt;/p&gt;
&lt;p&gt;As you see this database is extremely simple: each category has multiple products, that in turn hold multiple items. Each product item points to its supplier and there is additional table that holds current inventory count. &lt;/p&gt;
&lt;p&gt;Okay, I'm ready to create the entity model. First I've created a new C# class library project, and then from the &lt;strong&gt;Add New Item&lt;/strong&gt; dialog selected the &lt;strong&gt;ADO.NET Entity Data Model&lt;/strong&gt; template. This starts the &lt;strong&gt;Entity Data Model Wizard &lt;/strong&gt;where in first step we select either to generate model from database or to create empty one: &lt;/p&gt;
&lt;p align="center"&gt; &lt;img style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height="505" alt="EDM Wizard: Step 1" width="544" border="0" src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/GettingstartedwithA.PartIMappingentities_BF5B/image_7.png" /&gt; &lt;/p&gt;
&lt;p&gt;After selecting the first option we go to the next step when we need to specify the connection string to our database:&lt;/p&gt;
&lt;p align="center"&gt;&lt;img style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height="505" alt="EDM Wizard: Step 2" width="544" border="0" src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/GettingstartedwithA.PartIMappingentities_BF5B/image_8.png" /&gt; &lt;/p&gt;
&lt;p&gt;Note that the connection string used by the EF besides the typical settings for ADO.NET also contains paths to all three schema files.  &lt;/p&gt;
&lt;p&gt;In the last step we can select which tables, views and stored procedures should be included in the generated model (in this case I want to include all tables besides the &lt;strong&gt;AspNet_SqlCacheTablesForChangeNotification&lt;/strong&gt;). We can also specify the namespace for the generated classes:&lt;/p&gt;
&lt;a atomicselection="true" href="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/GettingstartedwithA.PartIMappingentities_BF5B/image_3.png"&gt;&lt;/a&gt;
&lt;p align="center"&gt;&lt;img style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height="505" alt="EDM Wizard: Step 3" width="544" border="0" src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/GettingstartedwithA.PartIMappingentities_BF5B/image_9.png" /&gt; &lt;/p&gt;
&lt;p&gt;After pressing the &lt;strong&gt;Finish &lt;/strong&gt;button the wizard generates the entity model (the PetShopModel.edmx file) and adds all required references to the project. In the previous version the wizard &lt;a href="http://www.sqlskills.com/blogs/bobb/2007/04/22/EDMWizardNotWorkingUseEDMGen.aspx"&gt;didn't worked very well&lt;/a&gt; and you'd had to use the command line tool called &lt;strong&gt;EDM Generator &lt;/strong&gt;(edmgen.exe) to get these files. This time things changed for good so lets look at what was generated. &lt;/p&gt;
&lt;p&gt;When we open this file from the Solution Explorer we can finally see our enities inside the &lt;strong&gt;EDM Designer &lt;/strong&gt;(click on image to enlarge):&lt;/p&gt;
&lt;p align="center"&gt;&lt;a target="_blank" atomicselection="true" href="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/GettingstartedwithA.PartIMappingentities_BF5B/image_6.png"&gt;&lt;img style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" height="476" alt="EDM Designer" width="640" border="0" src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/WindowsLiveWriter/GettingstartedwithA.PartIMappingentities_BF5B/image_thumb_6.png" /&gt; &lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Notice that although this model looks very similar to the database model shown earlier it actually shows entities not tables. So besides the &lt;strong&gt;scalar properties &lt;/strong&gt;that are mapped to the table columns we also have the &lt;strong&gt;navigational properties &lt;/strong&gt;mapped to table relationships. There is also a new tab next to the Solution Explorer called &lt;strong&gt;Entity Model Browser &lt;/strong&gt;that displays the structure of the model. We can see here that this model includes both the conceptual (entity) and storage schema. Finally at the bottom we see new window titled &lt;strong&gt;Entity Mapping Details&lt;/strong&gt; that displays how the two schemas are mapped. &lt;/p&gt;
&lt;p&gt;In the second part I will look at how we can modify the generated model to align it with our concept model and at the same time learn how to use this designer. Stay tuned!&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=115048"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=115048" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/kobush/aggbug/115048.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Szymon Kobalczyk</dc:creator>
            <guid>http://geekswithblogs.net/kobush/archive/2007/08/29/GettingStartedWithEntityFramework_1.aspx</guid>
            <pubDate>Wed, 29 Aug 2007 18:30:22 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/kobush/comments/115048.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/kobush/archive/2007/08/29/GettingStartedWithEntityFramework_1.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/kobush/comments/commentRss/115048.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/kobush/services/trackbacks/115048.aspx</trackback:ping>
        </item>
        <item>
            <title>UMPC + WPF = Audi Keyboard</title>
            <link>http://geekswithblogs.net/kobush/archive/2007/04/11/111454.aspx</link>
            <description>&lt;p&gt;&lt;img src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/1591/o_Tegatech_Australia_Audi_Keyboard.jpg" align="right"&gt; As time goes by I keep finding more and more &lt;a href="http://blogs.msdn.com/tims/archive/tags/portfolio/default.aspx"&gt;great WPF applications&lt;/a&gt;, but this one really&amp;nbsp;got my attention. The Audi Keyboard is a WPF application that was designed for UMPCs that was used during the Melbourne Motorshow to input customer data. I actually found it on the &lt;a href="http://ubertablet.blogspot.com/2007/03/audi-take-ultra-mobile-pc-to-new-level.html"&gt;Hugo Ortega's Uber Tablet blog&lt;/a&gt; (which I'm huge fan by now) so it might have been missed by pure .NET geeks. Hugo published &lt;a href="http://ubertablet.blogspot.com/2007/03/samsung-q1-and-audi-keyboard.html"&gt;video with overview of this project&lt;/a&gt; where you can learn more details.&amp;nbsp; &lt;/p&gt; &lt;p&gt;This project is great example of how WPF brings together designers and developers enabling them to work together on the same project. There is also very interesting &lt;a href="http://www.screenedit.co.uk/sevideo/9992/9992.htm"&gt;video interview&lt;/a&gt; up on &lt;a href="http://www.screenedit.com/"&gt;ScreenEdit.com&lt;/a&gt; with Richard Bassett (the designer) and &lt;a href="http://drneil.blogspot.com"&gt;Dr. Neil&lt;/a&gt;&amp;nbsp;(the programmer). As they point out the most important lesson they learned&amp;nbsp;is that with WPF each of&amp;nbsp;them can work in the environment they are comfortable with (designer = Expression Blend, developer = Visual Studio), but this would be still part of the same project (remember that Blend reads and creates .csproj files). Also worth noting are the first impressions of seasoned designer coming to the Expression suite, and&amp;nbsp;comparing it to&amp;nbsp;competitive technologies like Flash and Adobe Illustrator. &amp;nbsp;&lt;/p&gt; &lt;p&gt;After working with WPF for a while I can 100% agree with what they say. &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=111454"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=111454" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/kobush/aggbug/111454.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Szymon Kobalczyk</dc:creator>
            <guid>http://geekswithblogs.net/kobush/archive/2007/04/11/111454.aspx</guid>
            <pubDate>Wed, 11 Apr 2007 21:21:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/kobush/comments/111454.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/kobush/archive/2007/04/11/111454.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/kobush/comments/commentRss/111454.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/kobush/services/trackbacks/111454.aspx</trackback:ping>
        </item>
        <item>
            <title>WPF TabItems With Close Button</title>
            <link>http://geekswithblogs.net/kobush/archive/2007/04/08/closeabletabitem.aspx</link>
            <description>&lt;p&gt;One of the most common questions I've seen regarding the TabControl in Windows Forms was how to add a close button to each tab (similar to seen on tabs in Internet Explorer 7). &lt;/p&gt; &lt;p align="center"&gt;&lt;img src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/1591/o_ie_tabs.png" /&gt; &lt;/p&gt; &lt;p&gt;Although there were &lt;a href="http://www.codeproject.com/cs/miscctrl/closabletabcontrolpage.asp"&gt;some solutions available&lt;/a&gt; the results weren't quite satisfactory and often requiring to &lt;a href="http://www.codeproject.com/vb/net/MDITabControl.asp?msg=1973375"&gt;rewrite the whole control from scratch&lt;/a&gt;. Recently I faced the same challenge working on the &lt;a href="http://geekswithblogs.net/kobush/archive/2007/03/13/108614.aspx"&gt;TSRI project&lt;/a&gt;. It turned out that in WPF this pretty straightforward task and in this article I'm going to show all the steps required to complete it. &lt;/p&gt; &lt;p&gt;To follow the discussion you can download the demo code first:&lt;/p&gt; &lt;p&gt;&lt;a href="http://code.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=KobushCode&amp;amp;DownloadId=688"&gt;Download the source code&lt;/a&gt;&lt;/p&gt; &lt;p&gt;We start by creating a new custom control deriving from TabItem that implements this behavior. I'll name it &lt;font face="Courier New"&gt;CloseableTabItem&lt;/font&gt;.&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; CloseableTabItem : TabItem
{
    &lt;span class="kwrd"&gt;static&lt;/span&gt; CloseableTabItem()
    {
        DefaultStyleKeyProperty.OverrideMetadata(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(CloseableTabItem),
            &lt;span class="kwrd"&gt;new&lt;/span&gt; FrameworkPropertyMetadata(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(CloseableTabItem)));
    }
}&lt;/pre&gt;
&lt;p&gt;The instruction in static constructor informs the system that this element wants to use different style than it's parent. Since we are creating the default theme for the custom control it would be defined in &lt;font face="Courier New"&gt;generic\themes.xaml&lt;/font&gt;. &lt;/p&gt;
&lt;p&gt;Before we add more code let's create the control template first. With the aid of Expression Blend we can easily create a copy of the default template for TabItem control and start from there. The default template consists only of &lt;font face="Courier New"&gt;Grid&lt;/font&gt; and &lt;font face="Courier New"&gt;Border&lt;/font&gt; that wrap the &lt;font face="Courier New"&gt;ContentPresenter&lt;/font&gt;. We need to place additional DockPanel inside this &lt;font face="Courier New"&gt;Border&lt;/font&gt; to host both the Content and our close &lt;font face="Courier New"&gt;Button&lt;/font&gt;. Because we will reference this button from code later it's named &lt;font face="Courier New"&gt;PART_Close&lt;/font&gt; following the WPF naming convention. The button contains the "x" icon defined as &lt;font face="Courier New"&gt;Path&lt;/font&gt; element. You can see final hierarchy of elements on the image below:&lt;/p&gt;
&lt;p align="center"&gt;&lt;img src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/1591/o_tab_template.png" /&gt; &lt;/p&gt;
&lt;p&gt;The close button should only show it's border when mouse is over and it shouldn't accept keyboard focus, hence there is additional style called &lt;font face="Courier New"&gt;CloseableTabItemButtonStyle&lt;/font&gt;. This template consist of Border and ContentPresenter inside of a Grid. The Border is hidden by default and shows only when mouse is over the button. To be consistent with IE7 behavior I've also added triggers to change the "x" icon fill color to red when mouse is over the button or when it's pressed. &lt;/p&gt;
&lt;p&gt;We are now ready to test these templates. To use our new control first the containing namespace must be mapped to a XML namespace. We don't need to reference the resource dictionary because it is declared as default theme for the control. Here is example markup for the main window of the application: &lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Window&lt;/span&gt;
    &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt;
    &lt;span class="attr"&gt;xmlns:x&lt;/span&gt;&lt;span class="kwrd"&gt;="http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt;
    &lt;span class="attr"&gt;xmlns:local&lt;/span&gt;&lt;span class="kwrd"&gt;="clr-namespace:CloseableTabItemDemo"&lt;/span&gt;
    &lt;span class="attr"&gt;x:Class&lt;/span&gt;&lt;span class="kwrd"&gt;="CloseableTabItemDemo.MainWindow"&lt;/span&gt;
    &lt;span class="attr"&gt;Title&lt;/span&gt;&lt;span class="kwrd"&gt;="CloseableTabItem Demo"&lt;/span&gt; &lt;span class="attr"&gt;Height&lt;/span&gt;&lt;span class="kwrd"&gt;="300"&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;="500"&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;TabControl&lt;/span&gt; &lt;span class="attr"&gt;Margin&lt;/span&gt;&lt;span class="kwrd"&gt;="5"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;local:CloseableTabItem&lt;/span&gt; &lt;span class="attr"&gt;Header&lt;/span&gt;&lt;span class="kwrd"&gt;="TabItem 1"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;local:CloseableTabItem&lt;/span&gt; &lt;span class="attr"&gt;Header&lt;/span&gt;&lt;span class="kwrd"&gt;="TabItem 2"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;local:CloseableTabItem&lt;/span&gt; &lt;span class="attr"&gt;Header&lt;/span&gt;&lt;span class="kwrd"&gt;="TabItem 3"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;TabItem&lt;/span&gt; &lt;span class="attr"&gt;Header&lt;/span&gt;&lt;span class="kwrd"&gt;="TabItem 4"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;TabControl&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Grid&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Window&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Note that we can freely mix the regular TabItems with our custom controls. Here is the result when we run this application:&lt;/p&gt;
&lt;p align="center"&gt;&lt;img src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/1591/o_tab_demo.png" /&gt; &lt;/p&gt;
&lt;p&gt;Having all the visuals in place lets switch back to Visual Studio and finish the remining code. I choose to publish the Close button click event as the a routed event on the control. Of course I could handle it directly in the code of the control but this way I have more control on how to handle it in the application (for example I could display a confirmation dialog before closing the tab). Alternatively I could also create a custom Command and bind it directly to the close button. This would allow me to declare everything in XAML markup but I think event would be easier to use in this case. So below is the declaration for the CloseTab event:&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;readonly&lt;/span&gt; RoutedEvent CloseTabEvent =
    EventManager.RegisterRoutedEvent(&lt;span class="str"&gt;"CloseTab"&lt;/span&gt;, RoutingStrategy.Bubble,
        &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(RoutedEventHandler), &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(CloseableTabItem));

&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;event&lt;/span&gt; RoutedEventHandler CloseTab
{
    add { AddHandler(CloseTabEvent, &lt;span class="kwrd"&gt;value&lt;/span&gt;); }
    remove { RemoveHandler(CloseTabEvent, &lt;span class="kwrd"&gt;value&lt;/span&gt;); }
}&lt;/pre&gt;
&lt;p&gt;To raise the event I need first to attach a handler to the Button's Click event. I can do it easily by overriding the ... method. This is where I use the &lt;font face="Courier New"&gt;PART_Close&lt;/font&gt; name mentioned earlier to find the button declared in template by using the &lt;font face="Courier New"&gt;GetTemplateChild&lt;/font&gt; method. The event handler simply raises the new event. &lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; OnApplyTemplate()
{
    &lt;span class="kwrd"&gt;base&lt;/span&gt;.OnApplyTemplate();

    Button closeButton = &lt;span class="kwrd"&gt;base&lt;/span&gt;.GetTemplateChild(&lt;span class="str"&gt;"PART_Close"&lt;/span&gt;) &lt;span class="kwrd"&gt;as&lt;/span&gt; Button;
    &lt;span class="kwrd"&gt;if&lt;/span&gt; (closeButton != &lt;span class="kwrd"&gt;null&lt;/span&gt;)
        closeButton.Click += &lt;span class="kwrd"&gt;new&lt;/span&gt; System.Windows.RoutedEventHandler(closeButton_Click);
}

&lt;span class="kwrd"&gt;void&lt;/span&gt; closeButton_Click(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, System.Windows.RoutedEventArgs e)
{
    &lt;span class="kwrd"&gt;this&lt;/span&gt;.RaiseEvent(&lt;span class="kwrd"&gt;new&lt;/span&gt; RoutedEventArgs(CloseTabEvent, &lt;span class="kwrd"&gt;this&lt;/span&gt;));
}&lt;/pre&gt;
&lt;p&gt;So the only thing left is to actually handle this event. This will be done in the MainWindow's code behind. Normally I would have to attach handlers for this event to each tab I created but since this is a routed event (with bubble strategy) I can also attach it once on any of it's parents (up to the Window itself). Closing the tab is done by finding the parent TabControl removing the source tab from it's Items collection.&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;partial&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; MainWindow : System.Windows.Window
{
    &lt;span class="kwrd"&gt;public&lt;/span&gt; MainWindow()
    {
        InitializeComponent();

        &lt;span class="kwrd"&gt;this&lt;/span&gt;.AddHandler(CloseableTabItem.CloseTabEvent, &lt;span class="kwrd"&gt;new&lt;/span&gt; RoutedEventHandler(&lt;span class="kwrd"&gt;this&lt;/span&gt;.CloseTab));
    }

    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; CloseTab(&lt;span class="kwrd"&gt;object&lt;/span&gt; source, RoutedEventArgs args)
    {
        TabItem tabItem = args.Source &lt;span class="kwrd"&gt;as&lt;/span&gt; TabItem;
        &lt;span class="kwrd"&gt;if&lt;/span&gt; (tabItem != &lt;span class="kwrd"&gt;null&lt;/span&gt;)
        {
            TabControl tabControl = tabItem.Parent &lt;span class="kwrd"&gt;as&lt;/span&gt; TabControl;
            &lt;span class="kwrd"&gt;if&lt;/span&gt; (tabControl != &lt;span class="kwrd"&gt;null&lt;/span&gt;)
                tabControl.Items.Remove(tabItem);
        }
    }
}&lt;/pre&gt;
&lt;p&gt;That's all we need to do. Now we have customized tab items with fully working tab control. And as you can see this is relatively easy to implement so nothing prevents adding more buttons or other elements on the tabs. For example in the TSRI project we have additional button that opens the tab contents as floating window.  &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=111119"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=111119" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/kobush/aggbug/111119.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Szymon Kobalczyk</dc:creator>
            <guid>http://geekswithblogs.net/kobush/archive/2007/04/08/closeabletabitem.aspx</guid>
            <pubDate>Sun, 08 Apr 2007 14:48:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/kobush/comments/111119.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/kobush/archive/2007/04/08/closeabletabitem.aspx#feedback</comments>
            <slash:comments>25</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/kobush/comments/commentRss/111119.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/kobush/services/trackbacks/111119.aspx</trackback:ping>
        </item>
        <item>
            <title>Overriding default SystemColors in WPF</title>
            <link>http://geekswithblogs.net/kobush/archive/2007/03/25/109753.aspx</link>
            <description>&lt;p&gt;After working with WPF for a while I must say that it is wonderful platform for building complex user interfaces but sometimes it falls short in very simple scenarios.&amp;nbsp;Or in other words, it's easy to do complex things with it's powerful tools but often it lacks simple tools to do simple things.&amp;nbsp;At least from a perspective of Windows Forms developer who expects some familiar tools and quickly finds out that they are gone. &lt;/p&gt; &lt;p&gt;There are several examples of this, but one that I run across recently and find it very often in other forums is how to change default colors in more complex controls like &lt;strong&gt;ListBox&lt;/strong&gt; or &lt;strong&gt;ComboBox&lt;/strong&gt;. For example yesterday there was a question on the MSDN forum on&amp;nbsp;&lt;a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1388254&amp;amp;SiteID=1"&gt;how to change the highlight color in a popup of combobox&lt;/a&gt;. &lt;/p&gt; &lt;p&gt;All controls in WPF have only three properties to adjust their colors: &lt;strong&gt;Foreground&lt;/strong&gt;, &lt;strong&gt;Background&lt;/strong&gt; and &lt;strong&gt;BorderBrush&lt;/strong&gt; (keep in mind that all of these properties accept brushes instead of solid colors). But you won't find such properties as HighlightedItemBrush on ComboBox or SelectedItemBrush on ListBox. &lt;/p&gt; &lt;p&gt;I read somewhere, that primary reason for this is that Controls encapsulate logical elements and shouldn't have properties that depend on their visual representation. Instead the appearance of each control is defined through it's &lt;strong&gt;ControlTemplate&lt;/strong&gt; and with some alternative template these properties might make no sense at all. &lt;/p&gt; &lt;p&gt;So it might seem that the only option&amp;nbsp;to override these colors would be to recreate the &lt;strong&gt;ControlTemplate&lt;/strong&gt; for particular control and adjust the colors. Thankfully you don't have to do it manually. With Microsoft Expression Blend you can very easily create copy of the default ControlTemplate by selecting the control and then from menu invoking &lt;strong&gt;Object&lt;/strong&gt; &amp;gt; &lt;strong&gt;Edit Control Parts (Template)&lt;/strong&gt; &amp;gt; &lt;strong&gt;Edit a Copy...&lt;/strong&gt; &lt;/p&gt; &lt;p&gt;But this will only recreate the template for your current Windows Theme so if you have to preserve all other visual aspects of the control you need to put even more work to subclass your control and recreate all themes for the new control. This is quite a big effort to do such a small thing. &lt;/p&gt; &lt;p&gt;There is however much simpler solution if overriding the default colors is the only thing you want to change.&amp;nbsp;Because these colors are defined as resources you can try to override these resource for your control. &lt;/p&gt; &lt;p&gt;For example, to change the color of selected item in a ListBox (or highlighted item in ComboBox )&amp;nbsp;override following resource:&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;SolidColorBrush&lt;/span&gt; &lt;span class="attr"&gt;x:Key&lt;/span&gt;&lt;span class="kwrd"&gt;="{x:Static SystemColors.HighlightBrushKey}"&lt;/span&gt; &lt;span class="attr"&gt;Color&lt;/span&gt;&lt;span class="kwrd"&gt;="Orange"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;p&gt;And because I also wanted to have the same color when ListBox doesn't have focus I needed to override this resource as well:&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;SolidColorBrush&lt;/span&gt; &lt;span class="attr"&gt;x:Key&lt;/span&gt;&lt;span class="kwrd"&gt;="{x:Static SystemColors.ControlBrushKey}"&lt;/span&gt; &lt;span class="attr"&gt;Color&lt;/span&gt;&lt;span class="kwrd"&gt;="Orange"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;As with all resources you can do it either only for this particular control (using Style.Resources), whole window or even for the whole application depending on which ResourceDictionary you would use. And because these resources are referenced as DynamicResource you can even adjust them at runtime.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So now the only problem is to find out what resources you need to override to get the desired control. Once again the Microsoft Expression Designer comes in handy and you can find this out by recreating the default templates but this time only to read what colors it uses and what what purpose. &lt;/p&gt;
&lt;p&gt;I've started putting together a reference of which system colors are used in default templates for simple controls and will publish it shortly. &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=109753"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=109753" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/kobush/aggbug/109753.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Szymon Kobalczyk</dc:creator>
            <guid>http://geekswithblogs.net/kobush/archive/2007/03/25/109753.aspx</guid>
            <pubDate>Sun, 25 Mar 2007 11:46:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/kobush/comments/109753.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/kobush/archive/2007/03/25/109753.aspx#feedback</comments>
            <slash:comments>7</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/kobush/comments/commentRss/109753.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/kobush/services/trackbacks/109753.aspx</trackback:ping>
        </item>
        <item>
            <title>How to access SharePoint's Discussion Board using Web Services. Part 2.</title>
            <link>http://geekswithblogs.net/kobush/archive/2007/03/16/108974.aspx</link>
            <description>In my previous post I wrote how you can access the contents of discussion boards using web services. For reading existing discussions threads the Lists web service was all that we needed. However there were problems when creating discussions using the same service. After whole day of trial and error I finally gave up this approach and decided to first try using SharePoint's object model instead.&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=108974"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=108974" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/kobush/aggbug/108974.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Szymon Kobalczyk</dc:creator>
            <guid>http://geekswithblogs.net/kobush/archive/2007/03/16/108974.aspx</guid>
            <pubDate>Fri, 16 Mar 2007 09:01:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/kobush/comments/108974.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/kobush/archive/2007/03/16/108974.aspx#feedback</comments>
            <slash:comments>7</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/kobush/comments/commentRss/108974.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/kobush/services/trackbacks/108974.aspx</trackback:ping>
        </item>
        <item>
            <title>I work on the Scripps project!</title>
            <link>http://geekswithblogs.net/kobush/archive/2007/03/13/108614.aspx</link>
            <description>&lt;p&gt;&lt;img style="margin: 0px 10px 10px" src="http://geekswithblogs.net/images/geekswithblogs_net/kobush/1591/o_scripps_s.jpg" align="right"&gt;Usually I don't write about my current employer or work, but I think this time it deserves to make an exception. You read already it in the title:&amp;nbsp;I work now on The Collective Molecular Environment (C-ME) for The Scripps Research Institute (TSRI). &lt;/p&gt; &lt;p&gt;If you are following the news on Windows Vista or WPF you have probably seen this application already&amp;nbsp;(the screen on the right might remind it to you). &lt;a href="http://www.scripps.edu/e_index.html"&gt;The Scripps Research Institute&lt;/a&gt; is a biomedical research organization that is trying to find a cure for cancer and make cancer a managed disease. Scientist wanted a better way to organize and share the research information. To answer these needs&amp;nbsp;&lt;a href="http://www.interknowlogy.com/IKCorporate"&gt;InterKnowlogy&lt;/a&gt; developed application that uses .NET 3.0 Windows Presentation Foundation and Office 2007 SharePoint to visualize and annotate research results. &lt;/p&gt; &lt;p&gt;You can watch a &lt;a href="http://www.microsoft.com/winme/Bulk/PressPass/BV_Scripps_750k.asx"&gt;short video about the project&lt;/a&gt; that Microsoft produced. This was also the only third-party application shown by Steve Ballmer during &lt;a href="http://www.microsoft.com/winme/0611/29030/BV_Launch_Reencode_MBR.asx"&gt;Windows Vista and Office 2007 lunch event&lt;/a&gt; (the demo it's just after 30 minutes in it). And for some technical details I recommend the video interview with &lt;a href="http://channel9.msdn.com/Showpost.aspx?postid=213957"&gt;Tim Huckaby and Dr. Peter Kuhn&lt;/a&gt; on Channel 9. There is much more on the &lt;a href="http://interknowlogy.com/IKCorporate/News/Headlines/The+Scripps+Research+Institute+CME+Application+and+the+3D+Collaborator+for+AutoCad+Drawings+Applicat.htm"&gt;project site&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;In the beginning of February Stephen Forte posted a &lt;a href="http://www.stephenforte.net/owdasblog/PermaLink.aspx?guid=81b20029-dd37-4d0c-a9f2-8e9220eae12d"&gt;Call for Developers to participate in the Scripps project&lt;/a&gt; on his blog (big thanks for Tad for forwarding it to me): &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;em&gt;"Do you believe that software can change the world? How about the opportunity to work on an application that promises to help accelerate a cure for cancer?"&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;(Later I've learned that this was a joined initiative of Stephen, &lt;a href="http://blogs.interknowlogy.com/timhuckaby/archive/2007/02/01/11253.aspx"&gt;Tim Huckaby&lt;/a&gt;, and &lt;a href="http://blogs.msdn.com/not_only_technology/archive/2007/02/01/do-you-believe-that-software-can-change-the-world.aspx"&gt;Eileen Rumwell&lt;/a&gt;.)&lt;/p&gt; &lt;p&gt;After watching all this stuff and hearing all the buzz with this project I was really excited to join the team. I've sent my resume... and a week later I got response from Tim Huckaby&amp;nbsp;that I was accepted. I just couldn't believe it!&lt;/p&gt; &lt;p&gt;Altogether four developers were selected from all around the world. I have the pleasure to work with &lt;a href="http://msmvps.com/blogs/haarongonzalez/"&gt;Haaron&lt;/a&gt; (Mexico), Rania (Egypt) and Kandaiya G (India), as well as great people from InterKnowlogy (San Diego, California): Kevin, Russ, Dan and Tim.&lt;/p&gt; &lt;p&gt;So right now we are working on the next version of C-ME. The team is communicating remotely using IM, email and telephone (and we use TFS if anyone cares to ask). Each of us was assigned a specific task to build during this month. We are using cutting edge technologies like Windows Presentation Foundation and Microsoft Office SharePoint 2007. So it's a lot of new stuff to learn. &lt;/p&gt; &lt;p&gt;My first task is to add support for discussion annotations to the viewer application. The application already supports File, Note, Url and Screen Capture annotations and they are all stored in SharePoint site for given entity. The new type I'm adding will be using the Discussion Board lists in SharePoint but it renders the whole discussion desktop application using WPF (and bit of HTML). &lt;/p&gt; &lt;p&gt;Of course, I will keep you updated on our progress during this month.&lt;/p&gt; &lt;p&gt;(Actually you can read first post on &lt;a href="http://geekswithblogs.net/kobush/archive/2007/03/12/108545.aspx"&gt;accessing discussion lists from SharePoint&lt;/a&gt; already.) &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=108614"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=108614" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/kobush/aggbug/108614.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Szymon Kobalczyk</dc:creator>
            <guid>http://geekswithblogs.net/kobush/archive/2007/03/13/108614.aspx</guid>
            <pubDate>Tue, 13 Mar 2007 08:22:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/kobush/comments/108614.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/kobush/archive/2007/03/13/108614.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/kobush/comments/commentRss/108614.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/kobush/services/trackbacks/108614.aspx</trackback:ping>
        </item>
    </channel>
</rss>