<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.windowsclient.net/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Zuker On Foundations</title><subtitle type="html">The realm of .NET (WPF, WCF and all around)</subtitle><id>http://blogs.windowsclient.net/zuker/atom.aspx</id><link rel="alternate" type="text/html" href="http://blogs.windowsclient.net/zuker/default.aspx" /><link rel="self" type="application/atom+xml" href="http://blogs.windowsclient.net/zuker/atom.aspx" /><generator uri="http://communityserver.org" version="3.0.20423.869">Community Server</generator><updated>2008-07-29T14:44:00Z</updated><entry><title>C# Lambda and Extensions to help around Casting</title><link rel="alternate" type="text/html" href="http://blogs.windowsclient.net/zuker/archive/2008/10/07/c-lambda-and-extensions-to-help-around-casting.aspx" /><link rel="enclosure" type="application/x-zip-compressed" length="24692" href="http://blogs.windowsclient.net/zuker/attachment/69822.ashx" /><id>http://blogs.windowsclient.net/zuker/archive/2008/10/07/c-lambda-and-extensions-to-help-around-casting.aspx</id><published>2008-10-07T05:33:00Z</published><updated>2008-10-07T05:33:00Z</updated><content type="html">&lt;p&gt;One of the common scenarios of casting in daily use of code is the need to check if an instance is of a given type, if so - perform actions on it.&lt;/p&gt;
&lt;p&gt;Some developers tend to do as following:&lt;/p&gt;
&lt;p&gt;&lt;font size="2" color="#0000ff"&gt;if&lt;/font&gt;&lt;font size="2"&gt; (foo &lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;is&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font size="2" color="#2b91af"&gt;Bar&lt;/font&gt;&lt;font size="2"&gt;)&lt;br /&gt;{&lt;br /&gt;&lt;/font&gt;&lt;font size="2" color="#2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Bar&lt;/font&gt;&lt;font size="2"&gt; b1 = (&lt;/font&gt;&lt;font size="2" color="#2b91af"&gt;Bar&lt;/font&gt;&lt;font size="2"&gt;)foo;&lt;br /&gt;&lt;/font&gt;&lt;font size="2" color="#008000"&gt;&lt;font color="#2b91af"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;//Do Stuff..&lt;/font&gt;&lt;font size="2"&gt;&lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;&lt;/font&gt;
&lt;p&gt;A word about it - this approach is condered &lt;b&gt;wasteful&lt;/b&gt; in this case.&lt;br /&gt;This is because the result of whether the instance is of a &amp;#39;Bar&amp;#39; type is not the only thing that matters in this case, meaning I still need to cast it and perform actions on it as &amp;#39;Bar&amp;#39; type.&lt;/p&gt;
&lt;p&gt;This is better in this case:&lt;/p&gt;&lt;font size="2" color="#2b91af"&gt;
&lt;/font&gt;&lt;p&gt;&lt;font size="2" color="#2b91af"&gt;Bar&lt;/font&gt;&lt;font size="2"&gt; b2 = foo &lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;as&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font size="2" color="#2b91af"&gt;Bar&lt;/font&gt;&lt;font size="2"&gt;;&lt;br /&gt;&lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;if&lt;/font&gt;&lt;font size="2"&gt; (b2 != &lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;null&lt;/font&gt;&lt;font size="2"&gt;)&lt;br /&gt;{&lt;br /&gt;&lt;/font&gt;&lt;font size="2" color="#008000"&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;//Do Stuff&lt;/font&gt;&lt;font size="2"&gt;&lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;In this example, we first perform the cast, next we then simpy check if the casting succeeded.&lt;/p&gt;
&lt;p&gt;I decided to write a small helper for this common thing.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Step 1 - Try Cast&lt;/b&gt;&lt;/p&gt;&lt;font size="2" color="#0000ff"&gt;
&lt;/font&gt;&lt;p&gt;&lt;font size="2" color="#0000ff"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;static&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;bool&lt;/font&gt;&lt;font size="2"&gt; TryCast&amp;lt;T&amp;gt;(&lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;object&lt;/font&gt;&lt;font size="2"&gt; source, &lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;out&lt;/font&gt;&lt;font size="2"&gt; T target) &lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;where&lt;/font&gt;&lt;font size="2"&gt; T : &lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;class&lt;br /&gt;&lt;/font&gt;&lt;font size="2"&gt;{&lt;br /&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;target = source &lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;as&lt;/font&gt;&lt;font size="2"&gt; T;&lt;br /&gt;&lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return&lt;/font&gt;&lt;font size="2"&gt; (target != &lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;null&lt;/font&gt;&lt;font size="2"&gt;);&lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;&lt;font size="2" color="#008000"&gt;//playing around - step 1&lt;br /&gt;&lt;/font&gt;&lt;font size="2" color="#2b91af"&gt;Bar&lt;/font&gt;&lt;font size="2"&gt; b3;&lt;br /&gt;&lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;if&lt;/font&gt;&lt;font size="2"&gt; (&lt;/font&gt;&lt;font size="2" color="#2b91af"&gt;Extensions&lt;/font&gt;&lt;font size="2"&gt;.TryCast&amp;lt;&lt;/font&gt;&lt;font size="2" color="#2b91af"&gt;Bar&lt;/font&gt;&lt;font size="2"&gt;&amp;gt;(foo, &lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;out&lt;/font&gt;&lt;font size="2"&gt; b3))&lt;br /&gt;{&lt;br /&gt;&lt;/font&gt;&lt;font size="2" color="#008000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Do stuff&lt;/font&gt;&lt;font size="2"&gt;&lt;br /&gt;}&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; 
&lt;p&gt;&lt;b&gt;Step 2 - Try Cast &amp;amp; Perform&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2" color="#0000ff"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;static&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;void&lt;/font&gt;&lt;font size="2"&gt; TryCastPerform&amp;lt;T&amp;gt;(&lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;object&lt;/font&gt;&lt;font size="2"&gt; source, &lt;/font&gt;&lt;font size="2" color="#2b91af"&gt;Action&lt;/font&gt;&lt;font size="2"&gt;&amp;lt;T&amp;gt; action) &lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;where&lt;/font&gt;&lt;font size="2"&gt; T : &lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;class&lt;br /&gt;&lt;/font&gt;&lt;font size="2"&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; T cast;&lt;br /&gt;&lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;&lt;font color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;if&lt;/font&gt;&lt;font size="2"&gt; (TryCast&amp;lt;T&amp;gt;(source, &lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;out&lt;/font&gt;&lt;font size="2"&gt; cast))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; action(cast);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;&lt;font size="2" color="#008000"&gt;
&lt;/font&gt;&lt;p&gt;&lt;font size="2" color="#008000"&gt;//playing around - step 2&lt;br /&gt;&lt;/font&gt;&lt;font size="2" color="#2b91af"&gt;Extensions&lt;/font&gt;&lt;font size="2"&gt;.TryCastPerform(foo,&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;/font&gt;&lt;font size="2" color="#2b91af"&gt;Bar&lt;/font&gt;&lt;font size="2"&gt; b4) =&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&lt;/font&gt;&lt;font size="2" color="#008000"&gt;&lt;font color="#0000ff"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &lt;/font&gt;//Do Stuff&lt;/font&gt;&lt;font size="2"&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/font&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;b&gt;Using Extensions:&lt;br /&gt;&lt;/b&gt;&lt;/font&gt;&lt;b&gt;Step 3 - Try Cast &amp;amp; Perform Extension&lt;/b&gt;&lt;/p&gt;&lt;font size="2" color="#0000ff"&gt;
&lt;/font&gt;&lt;p&gt;&lt;font size="2" color="#0000ff"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;static&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;void&lt;/font&gt;&lt;font size="2"&gt; TryCastPerformExt&amp;lt;T&amp;gt;(&lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;this&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;object&lt;/font&gt;&lt;font size="2"&gt; source, &lt;/font&gt;&lt;font size="2" color="#2b91af"&gt;Action&lt;/font&gt;&lt;font size="2"&gt;&amp;lt;T&amp;gt; action) &lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;where&lt;/font&gt;&lt;font size="2"&gt; T : &lt;/font&gt;&lt;font size="2" color="#0000ff"&gt;class&lt;br /&gt;&lt;/font&gt;&lt;font size="2"&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TryCastPerform&amp;lt;T&amp;gt;(source, action);&lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font size="2" color="#008000"&gt;
&lt;/font&gt;&lt;p&gt;&lt;font size="2" color="#008000"&gt;//playing around - step 3&lt;br /&gt;&lt;/font&gt;&lt;font size="2"&gt;foo.TryCastPerformExt((&lt;/font&gt;&lt;font size="2" color="#2b91af"&gt;Bar&lt;/font&gt;&lt;font size="2"&gt; b5) =&amp;gt;&lt;br /&gt;{&lt;br /&gt;&lt;/font&gt;&lt;font&gt;&lt;font size="2"&gt;&lt;font size="2" color="#008000"&gt;&lt;font color="#0000ff"&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;//Do Stuff&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;br /&gt;});&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Sample code is attached&lt;br /&gt;&lt;/b&gt;&lt;font size="2"&gt;In order to view the attached files, make sure you enter the specifc post page.&lt;/font&gt;&lt;/p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/font&gt;&lt;img src="http://blogs.windowsclient.net/aggbug.aspx?PostID=69822" width="1" height="1"&gt;</content><author><name>zuker</name><uri>http://blogs.windowsclient.net/members/zuker.aspx</uri></author><category term=".NET" scheme="http://blogs.windowsclient.net/zuker/archive/tags/.NET/default.aspx" /></entry><entry><title>What is new in .NET 4.0?</title><link rel="alternate" type="text/html" href="http://blogs.windowsclient.net/zuker/archive/2008/10/06/what-is-new-in-net-4-0.aspx" /><id>http://blogs.windowsclient.net/zuker/archive/2008/10/06/what-is-new-in-net-4-0.aspx</id><published>2008-10-06T08:32:00Z</published><updated>2008-10-06T08:32:00Z</updated><content type="html">&lt;p&gt;There&amp;#39;s a whole buzz about the .NET Framework 4.0, sweet stuff is coming.&lt;/p&gt;
&lt;p&gt;Read &lt;a class="" href="http://developers.de/blogs/damir_dobric/archive/2008/10/05/what-is-new-in-net-4-0.aspx"&gt;Damir&amp;#39;s post&lt;/a&gt; for more information.&lt;/p&gt;
&lt;p&gt;Obviously, this isn&amp;#39;t everything..&lt;br /&gt;- There will be new modeling and architecture tools for working against the code&lt;br /&gt;- The Team Developer and Database suites will be combined together - Love that!&lt;br /&gt;And much more of course&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://blogs.windowsclient.net/aggbug.aspx?PostID=69380" width="1" height="1"&gt;</content><author><name>zuker</name><uri>http://blogs.windowsclient.net/members/zuker.aspx</uri></author><category term=".NET" scheme="http://blogs.windowsclient.net/zuker/archive/tags/.NET/default.aspx" /></entry><entry><title>Dynamite: High Performace Dynamic Sorting Using Expressions</title><link rel="alternate" type="text/html" href="http://blogs.windowsclient.net/zuker/archive/2008/10/02/dynamite-high-performace-dynamic-sorting-using-expressions.aspx" /><id>http://blogs.windowsclient.net/zuker/archive/2008/10/02/dynamite-high-performace-dynamic-sorting-using-expressions.aspx</id><published>2008-10-02T06:32:00Z</published><updated>2008-10-02T06:32:00Z</updated><content type="html">&lt;p&gt;Visit the &lt;a class="" href="http://www.codeproject.com/KB/linq/dynamite_dynamic_sorting.aspx"&gt;CodeProject article&lt;/a&gt; for futher details.&lt;/p&gt;
&lt;p&gt;Download &lt;a class="" href="http://www.codeproject.com/KB/linq/dynamite_dynamic_sorting/Dynamite_1_0_0.zip"&gt;Dynamite library (including demo)&lt;/a&gt; - 35.7KB&lt;/p&gt;
&lt;p&gt;The library proides easy way for sorting arrays, enumerables, queryables and dataset as well.&lt;br /&gt;The sweet gem about it is the ability to integrate it into actual runtime needs since it works with string manipulations.&lt;/p&gt;&lt;img src="http://blogs.windowsclient.net/aggbug.aspx?PostID=68068" width="1" height="1"&gt;</content><author><name>zuker</name><uri>http://blogs.windowsclient.net/members/zuker.aspx</uri></author><category term=".NET" scheme="http://blogs.windowsclient.net/zuker/archive/tags/.NET/default.aspx" /></entry><entry><title>Silverlight 2 RC is now available</title><link rel="alternate" type="text/html" href="http://blogs.windowsclient.net/zuker/archive/2008/09/28/silverlight-2-rc-is-now-available.aspx" /><id>http://blogs.windowsclient.net/zuker/archive/2008/09/28/silverlight-2-rc-is-now-available.aspx</id><published>2008-09-28T12:14:00Z</published><updated>2008-09-28T12:14:00Z</updated><content type="html">&lt;p&gt;The RC version is out and ready for use.&lt;/p&gt;&lt;p&gt;Read &lt;a href="http://weblogs.asp.net/scottgu/archive/2008/09/25/silverlight-2-release-candidate-now-available.aspx"&gt;Scott&amp;#39;s post&lt;/a&gt; &amp;amp; &lt;a href="http://blogs.msdn.com/drnick/archive/2008/09/26/silverlight-2-release-candidate.aspx"&gt;Nicholas&lt;/a&gt; for what&amp;#39;s out there. &lt;/p&gt;&lt;p&gt;&lt;b&gt;Download Resources&lt;/b&gt;: &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;a href="http://go.microsoft.com/fwlink/?LinkId=129043"&gt;Visual Studio 2008 Tools RC0&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;a href="http://blogs.msdn.com/expression/archive/2008/09/25/expression-blend-2-sp1-preview-released.aspx"&gt;Expression Blend SP1 RC0&lt;/a&gt;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&lt;a href="http://go.microsoft.com/fwlink/?linkid=129011"&gt;Windows Silverlight 2 Dev Runtime RC0&lt;/a&gt;&lt;/strong&gt;  &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://blogs.windowsclient.net/aggbug.aspx?PostID=66579" width="1" height="1"&gt;</content><author><name>zuker</name><uri>http://blogs.windowsclient.net/members/zuker.aspx</uri></author><category term="Silverlight" scheme="http://blogs.windowsclient.net/zuker/archive/tags/Silverlight/default.aspx" /></entry><entry><title>SilverLight UI Resources</title><link rel="alternate" type="text/html" href="http://blogs.windowsclient.net/zuker/archive/2008/09/18/silverlight-ui-resources.aspx" /><id>http://blogs.windowsclient.net/zuker/archive/2008/09/18/silverlight-ui-resources.aspx</id><published>2008-09-18T07:28:00Z</published><updated>2008-09-18T07:28:00Z</updated><content type="html">&lt;p&gt;Following are useful links to visit before writing a SilverLight application.&lt;/p&gt;
&lt;p&gt;&lt;a class="" href="http://timheuer.com/blog/archive/2008/09/09/silverlight-effects-libraries.aspx"&gt;Some Silverlight effects libraries&lt;/a&gt;&lt;br /&gt;&lt;em&gt;SvLite Effects from Cellbi,&lt;br /&gt;Silerlight.FX from Nikhil&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class="" href="http://www.codeplex.com/blacklight"&gt;Blacklight&lt;/a&gt;&lt;br /&gt;&lt;em&gt;Blacklight is a UX focused code sharing project. Microsoft has released a bunch of technologies that allow designers and developers to work closely together to make beautiful software. This project is a collection of controls, samples, visual assets and ideas that has been put together by User Experience designers and developers to both show you what the technology is capable of (from a UX point of view), and give you code and samples that you can use in your own projects, completely free of charge (see the License tab above). Check out the showcase to see what is currently available...&lt;/em&gt;&lt;/p&gt;&lt;img src="http://blogs.windowsclient.net/aggbug.aspx?PostID=62413" width="1" height="1"&gt;</content><author><name>zuker</name><uri>http://blogs.windowsclient.net/members/zuker.aspx</uri></author><category term="Silverlight" scheme="http://blogs.windowsclient.net/zuker/archive/tags/Silverlight/default.aspx" /></entry><entry><title>T-SQL - Create Unique Constraint</title><link rel="alternate" type="text/html" href="http://blogs.windowsclient.net/zuker/archive/2008/09/10/t-sql-create-unique-constraint.aspx" /><id>http://blogs.windowsclient.net/zuker/archive/2008/09/10/t-sql-create-unique-constraint.aspx</id><published>2008-09-10T04:44:00Z</published><updated>2008-09-10T04:44:00Z</updated><content type="html">&lt;p&gt;Searched it for a while, thought it might be worth sharing.&lt;/p&gt;
&lt;p&gt;Following is the T-SQL script to alter a table to apply a UNIQUE constraint on a certain column:&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;
&lt;p&gt;&lt;em&gt;ALTER&lt;/em&gt;&lt;/font&gt;&lt;em&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;TABLE&lt;/font&gt;&lt;font size="2"&gt; [TableName] &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;WITH&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;NOCHECK&lt;/font&gt;&lt;/em&gt;&lt;em&gt;&lt;font size="2"&gt; &lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;ADD&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;CONSTRAINT&lt;/font&gt;&lt;font size="2"&gt; UniqueConstraintName &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;UNIQUE&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#808080" size="2"&gt;(&lt;/font&gt;&lt;font size="2"&gt;[ColumnName]&lt;/font&gt;&lt;font color="#808080" size="2"&gt;)&lt;/p&gt;&lt;/font&gt;&lt;/em&gt;&lt;img src="http://blogs.windowsclient.net/aggbug.aspx?PostID=59076" width="1" height="1"&gt;</content><author><name>zuker</name><uri>http://blogs.windowsclient.net/members/zuker.aspx</uri></author><category term="Database" scheme="http://blogs.windowsclient.net/zuker/archive/tags/Database/default.aspx" /></entry><entry><title>Custom Window Chrome in WPF</title><link rel="alternate" type="text/html" href="http://blogs.windowsclient.net/zuker/archive/2008/09/10/custom-window-chrome-in-wpf.aspx" /><id>http://blogs.windowsclient.net/zuker/archive/2008/09/10/custom-window-chrome-in-wpf.aspx</id><published>2008-09-10T04:25:00Z</published><updated>2008-09-10T04:25:00Z</updated><content type="html">&lt;p&gt;Via this &lt;a class="" href="http://blogs.msdn.com/wpfsdk/archive/2008/09/08/custom-window-chrome-in-wpf.aspx"&gt;post&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&amp;quot;This document covers the design and some implementation details of getting WPF windows wrapped in custom chrome. Currently WPF supports standard windows, with an icon, title-text, and caption buttons, as well as borderless windows, which when combined with transparency allow arbitrary top-level shapes but the application loses system support for behaviors associated with having a standard caption area, such as maximize. There is a desire to create applications that fill a middle-ground here: the appearance and behavior of a standard window with a more complete branding experience&amp;quot;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class="" href="http://code.msdn.microsoft.com/chrome"&gt;Get the code here&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://blogs.windowsclient.net/aggbug.aspx?PostID=59070" width="1" height="1"&gt;</content><author><name>zuker</name><uri>http://blogs.windowsclient.net/members/zuker.aspx</uri></author><category term="WPF" scheme="http://blogs.windowsclient.net/zuker/archive/tags/WPF/default.aspx" /></entry><entry><title>SQL 2005 - Save File into Image/VarBinary columns</title><link rel="alternate" type="text/html" href="http://blogs.windowsclient.net/zuker/archive/2008/09/03/sql-2005-save-file-into-image-varbinary-columns.aspx" /><id>http://blogs.windowsclient.net/zuker/archive/2008/09/03/sql-2005-save-file-into-image-varbinary-columns.aspx</id><published>2008-09-03T12:43:00Z</published><updated>2008-09-03T12:43:00Z</updated><content type="html">&lt;p&gt;Via this &lt;a class="" href="http://www.softwareandtools.com/index.php/2005/11/28/saving_images_as_blob_into_sql_server_2005?blog=7"&gt;post&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I created a column in a certain table to contain various files with &amp;quot;VarBinary(MAX)&amp;quot; as its data type.&lt;/p&gt;
&lt;p&gt;I wanted to test stuff, so I needed data in the tables.&lt;/p&gt;
&lt;p&gt;But Oh My, Now What? Should I really write C# Project to insert a file?&lt;/p&gt;
&lt;p&gt;Well, no, not needed, you can do it directly from SQL.&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;&lt;em&gt;Create Table EmployeeProfile&lt;br /&gt;( &lt;br /&gt;EmpId int, &lt;br /&gt;EmpName varchar(50) not null, &lt;br /&gt;EmpPhoto varbinary(max) not null&lt;br /&gt;)&lt;br /&gt;Go&amp;nbsp;&lt;/em&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Courier New"&gt;&lt;em&gt;Insert EmployeeProfile (EmpId, EmpName, EmpPhoto) &lt;br /&gt;Select 1001, &amp;#39;Vadivel&amp;#39;, &lt;br /&gt;BulkColumn from Openrowset( Bulk &amp;#39;C:\Blue Lace 16.bmp&amp;#39;, Single_Blob) as EmployeePicture&lt;/em&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.windowsclient.net/aggbug.aspx?PostID=56734" width="1" height="1"&gt;</content><author><name>zuker</name><uri>http://blogs.windowsclient.net/members/zuker.aspx</uri></author><category term="Database" scheme="http://blogs.windowsclient.net/zuker/archive/tags/Database/default.aspx" /></entry><entry><title>Execute code within timeout using threads</title><link rel="alternate" type="text/html" href="http://blogs.windowsclient.net/zuker/archive/2008/08/21/execute-code-within-timeout-using-threads-and-lambda.aspx" /><id>http://blogs.windowsclient.net/zuker/archive/2008/08/21/execute-code-within-timeout-using-threads-and-lambda.aspx</id><published>2008-08-21T06:20:00Z</published><updated>2008-08-21T06:20:00Z</updated><content type="html">&lt;p&gt;Via this &lt;a class="" href="http://weblogs.asp.net/avnerk/archive/2007/07/24/waiting-for-a-return-value-from-an-asynchronous-method.aspx"&gt;post&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Following is a quick way to execute code and limiting it within a certain timeout.&lt;/p&gt;
&lt;p&gt;Note that the code spawns a new thread.&lt;br /&gt;A better safer code would be using the ThreadPool and wait on the WaitHandle.&lt;/p&gt;
&lt;p&gt;&lt;font color="#2b91af" size="2"&gt;Thread&lt;/font&gt;&lt;font size="2"&gt; t = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;Thread&lt;/font&gt;&lt;font size="2"&gt;(&lt;br /&gt;&amp;nbsp;&amp;nbsp; () =&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;//Do Stuff Here&lt;br /&gt;&lt;/font&gt;&lt;font size="2"&gt;&amp;nbsp;&amp;nbsp; });&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&amp;nbsp;&amp;nbsp; t.Start();&lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#000000"&gt;&amp;nbsp;&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#000000"&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;bool&lt;/font&gt;&lt;font size="2"&gt; success = t.Join(&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;TimeSpan&lt;/font&gt;&lt;font size="2"&gt;.FromSeconds(10));&lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#000000"&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;if&lt;/font&gt;&lt;font size="2"&gt; (success)&lt;br /&gt;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&lt;/font&gt;&lt;font color="#008000" size="2"&gt;&lt;font color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;//Thread completed successfully&lt;br /&gt;&lt;/font&gt;&lt;font size="2"&gt;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#000000"&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;else&lt;br /&gt;&lt;/font&gt;&lt;font size="2"&gt;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#000000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;throw&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;new&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;TimeoutException&lt;/font&gt;&lt;font size="2"&gt;();&lt;br /&gt;&amp;nbsp;&amp;nbsp; }&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.windowsclient.net/aggbug.aspx?PostID=52660" width="1" height="1"&gt;</content><author><name>zuker</name><uri>http://blogs.windowsclient.net/members/zuker.aspx</uri></author><category term=".NET" scheme="http://blogs.windowsclient.net/zuker/archive/tags/.NET/default.aspx" /></entry><entry><title>PNG Transparency for IE6</title><link rel="alternate" type="text/html" href="http://blogs.windowsclient.net/zuker/archive/2008/08/11/png-transparency-for-ie6.aspx" /><id>http://blogs.windowsclient.net/zuker/archive/2008/08/11/png-transparency-for-ie6.aspx</id><published>2008-08-11T08:09:00Z</published><updated>2008-08-11T08:09:00Z</updated><content type="html">&lt;p&gt;Internet Explorer 6 has problems displaying a PNG image with alpha transparency.&lt;/p&gt;
&lt;p&gt;Follow the instructions detailed in &lt;a class="" href="http://christopherschmitt.com/2007/10/30/png-transparency-for-internet-explorer-ie6-and-beyond/"&gt;this post&lt;/a&gt; to solve the issue.&lt;/p&gt;
&lt;p&gt;Note that you should apply width &amp;amp; height for every image you apply the style to. (At least from my experience)&lt;/p&gt;&lt;img src="http://blogs.windowsclient.net/aggbug.aspx?PostID=49353" width="1" height="1"&gt;</content><author><name>zuker</name><uri>http://blogs.windowsclient.net/members/zuker.aspx</uri></author><category term="Web" scheme="http://blogs.windowsclient.net/zuker/archive/tags/Web/default.aspx" /></entry><entry><title>Hosting WCF Service in IIS w/ Windows Authentication</title><link rel="alternate" type="text/html" href="http://blogs.windowsclient.net/zuker/archive/2008/08/10/hosting-wcf-service-in-iis-w-windows-authentication.aspx" /><id>http://blogs.windowsclient.net/zuker/archive/2008/08/10/hosting-wcf-service-in-iis-w-windows-authentication.aspx</id><published>2008-08-10T11:00:00Z</published><updated>2008-08-10T11:00:00Z</updated><content type="html">&lt;p&gt;I can&amp;#39;t believe I wasted 10minutes on something that should be the simplest ever.&lt;/p&gt;
&lt;p&gt;You might encounter an exception when trying to host a WCF service in IIS with windows authentication where it would say the IIS isn&amp;#39;t configured with windows auth so the service itself can&amp;#39;t be configured with windows auth.&lt;/p&gt;
&lt;p&gt;I had that exception.&lt;/p&gt;
&lt;p&gt;The problem is that the IIS vdir was configured with windows auth! and it still blew up.&lt;/p&gt;
&lt;p&gt;After a quick searching, I found this &lt;a class="" href="http://blogs.msdn.com/appsec/archive/2007/05/21/what-to-do-when-iis-mmc-doesn-t-do-the-work.aspx"&gt;post&lt;/a&gt; which did the trick.&lt;/p&gt;
&lt;p&gt;So.. if you do encounter this, I hope I saved you some time.&lt;/p&gt;&lt;img src="http://blogs.windowsclient.net/aggbug.aspx?PostID=49212" width="1" height="1"&gt;</content><author><name>zuker</name><uri>http://blogs.windowsclient.net/members/zuker.aspx</uri></author><category term="WCF" scheme="http://blogs.windowsclient.net/zuker/archive/tags/WCF/default.aspx" /></entry><entry><title>LINQ to SQL Dynamic Mapping</title><link rel="alternate" type="text/html" href="http://blogs.windowsclient.net/zuker/archive/2008/08/10/linq-to-sql-dynamic-mapping.aspx" /><id>http://blogs.windowsclient.net/zuker/archive/2008/08/10/linq-to-sql-dynamic-mapping.aspx</id><published>2008-08-10T08:18:00Z</published><updated>2008-08-10T08:18:00Z</updated><content type="html">&lt;p&gt;Via this &lt;a class="" href="http://weblogs.asp.net/guybarrette/archive/2008/07/23/linq-to-sql-dynamic-mapping.aspx"&gt;post&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The post discusses the issue of using LINQ-to-SQL with dynamic mappings.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;The problem&lt;br /&gt;&lt;/strong&gt;You have SQL Servers for each of your environments (development, test, pre-prod, production) and in each one, the table names are different.&amp;nbsp; In fact, it’s not the table names that are different but the schema names but since the schema name is part of the table name, it must be specified.&lt;br /&gt;Ex : dev.ZeTable et prod.ZeTable&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Easy to solve, right?&amp;nbsp; Just put the schema value in the config file and do a simple concatenation at runtime.&amp;nbsp; Well, it’s not as easy as it seams because the table name is stored in an attribute of the partial class generated by the LINQ to SQL designer and Microsoft didn’t provide a way or method to change it at runtime.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;[Table(Name=&amp;quot;dev.ZeTable&amp;quot;)]&lt;br /&gt;public partial class TheTable &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;br /&gt;The solution is to dynamically load at runtime a mapping specific for each environment.&lt;br /&gt;Here’s how to do it:. (Go to the post..)&lt;/em&gt;&lt;/p&gt;&lt;img src="http://blogs.windowsclient.net/aggbug.aspx?PostID=49204" width="1" height="1"&gt;</content><author><name>zuker</name><uri>http://blogs.windowsclient.net/members/zuker.aspx</uri></author><category term="LINQ" scheme="http://blogs.windowsclient.net/zuker/archive/tags/LINQ/default.aspx" /></entry><entry><title>Hosting WCF Service in IIS - 404 / Get Plain Text</title><link rel="alternate" type="text/html" href="http://blogs.windowsclient.net/zuker/archive/2008/08/06/hosting-wcf-service-in-iis-404-get-plain-text.aspx" /><id>http://blogs.windowsclient.net/zuker/archive/2008/08/06/hosting-wcf-service-in-iis-404-get-plain-text.aspx</id><published>2008-08-06T07:42:00Z</published><updated>2008-08-06T07:42:00Z</updated><content type="html">&lt;p&gt;If you&amp;#39;re trying to host a WCF service with a .svc extension and you get a 404 response or get plain text, it means your IIS had not been configured with the .svc extension.&lt;/p&gt;
&lt;p&gt;Follow &lt;a class="" href="http://blogs.msdn.com/wenlong/archive/2006/09/10/748294.aspx"&gt;this post&lt;/a&gt; instructions.&lt;/p&gt;&lt;img src="http://blogs.windowsclient.net/aggbug.aspx?PostID=47988" width="1" height="1"&gt;</content><author><name>zuker</name><uri>http://blogs.windowsclient.net/members/zuker.aspx</uri></author><category term="WCF" scheme="http://blogs.windowsclient.net/zuker/archive/tags/WCF/default.aspx" /></entry><entry><title>IntelliSense for Expression Blend </title><link rel="alternate" type="text/html" href="http://blogs.windowsclient.net/zuker/archive/2008/08/05/intellisense-for-expression-blend.aspx" /><id>http://blogs.windowsclient.net/zuker/archive/2008/08/05/intellisense-for-expression-blend.aspx</id><published>2008-08-05T05:48:00Z</published><updated>2008-08-05T05:48:00Z</updated><content type="html">&lt;p&gt;Via &lt;a class="" href="http://blogs.telerik.com/StefanDobrev/Posts/08-08-04/IntelliSense_for_Expression_Blend.aspx"&gt;Stefan&amp;#39;s post&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Wonderful News! You can enable intellisense in blend&lt;/p&gt;
&lt;p&gt;You need to install a plug-in and there&amp;#39;s a few gotcha&amp;#39;s so do read Stefan&amp;#39;s post for all the details.&lt;/p&gt;
&lt;p&gt;A&amp;nbsp;great discovery :)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://blogs.windowsclient.net/aggbug.aspx?PostID=47636" width="1" height="1"&gt;</content><author><name>zuker</name><uri>http://blogs.windowsclient.net/members/zuker.aspx</uri></author><category term="WPF" scheme="http://blogs.windowsclient.net/zuker/archive/tags/WPF/default.aspx" /><category term="Silverlight" scheme="http://blogs.windowsclient.net/zuker/archive/tags/Silverlight/default.aspx" /></entry><entry><title>Text Trimming Using CSS</title><link rel="alternate" type="text/html" href="http://blogs.windowsclient.net/zuker/archive/2008/07/29/text-trimming-using-css.aspx" /><id>http://blogs.windowsclient.net/zuker/archive/2008/07/29/text-trimming-using-css.aspx</id><published>2008-07-29T11:44:00Z</published><updated>2008-07-29T11:44:00Z</updated><content type="html">&lt;p&gt;There is a non-so-familiar way to apply trimming to text in HTML using simple CSS.&lt;/p&gt;
&lt;p&gt;In order to apply a certain width on&amp;nbsp;an element and together ensure that its innerText will be bound to that and will be trimmed accordingly, we can do the following:&lt;/p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;span&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;class&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;=&amp;quot;LongTextContainer&amp;quot;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;Very long text here.. Bla Bla Bla&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;lt;/&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;span&lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" size="2"&gt;&lt;font color="#a31515" size="2"&gt; 
&lt;p&gt;.LongTextContainer&lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;{&lt;br /&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;&amp;nbsp;&amp;nbsp; width&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;: &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;300px&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;;&lt;br /&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;&amp;nbsp;&amp;nbsp; position&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;: &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;fixed&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;;&lt;br /&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;&amp;nbsp;&amp;nbsp; overflow&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;: &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;hidden&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;;&lt;br /&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;&amp;nbsp;&amp;nbsp; text-overflow&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;: &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;ellipsis&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;;&lt;br /&gt;&lt;/font&gt;&lt;font color="#ff0000" size="2"&gt;&lt;font color="#ff0000" size="2"&gt;&amp;nbsp;&amp;nbsp; white-space&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;: &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#0000ff" size="2"&gt;nowrap&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;;&lt;br /&gt;}&lt;/p&gt;&lt;/font&gt;
&lt;p&gt;The text-overflow determines that the text will be trimmed while showing ellipsis in the end.&lt;/p&gt;
&lt;p&gt;This seems to do the trick quite perfect.&lt;/p&gt;
&lt;p&gt;Read additional information in this &lt;a class="" href="http://blogs.atlassian.com/developer/2007/08/post.html"&gt;post&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://blogs.windowsclient.net/aggbug.aspx?PostID=45663" width="1" height="1"&gt;</content><author><name>zuker</name><uri>http://blogs.windowsclient.net/members/zuker.aspx</uri></author><category term="Web" scheme="http://blogs.windowsclient.net/zuker/archive/tags/Web/default.aspx" /></entry></feed>