<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://bloggingabout.net/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Fadzai Chamba</title><subtitle type="html">I disagree with everything I just said</subtitle><id>http://bloggingabout.net/blogs/fadzai/atom.aspx</id><link rel="alternate" type="text/html" href="http://bloggingabout.net/blogs/fadzai/default.aspx" /><link rel="self" type="application/atom+xml" href="http://bloggingabout.net/blogs/fadzai/atom.aspx" /><generator uri="http://communityserver.org" version="4.1.40407.4157">Community Server</generator><updated>2009-08-31T18:51:00Z</updated><entry><title>Record Skype</title><link rel="alternate" type="text/html" href="/blogs/fadzai/archive/2011/09/07/record-skype.aspx" /><id>/blogs/fadzai/archive/2011/09/07/record-skype.aspx</id><published>2011-09-07T13:54:49Z</published><updated>2011-09-07T13:54:49Z</updated><content type="html">&lt;p&gt;Just saw this on Channel 9 - &lt;a title="http://bit.ly/ojq6Hk" href="http://bit.ly/ojq6Hk"&gt;http://bit.ly/ojq6Hk&lt;/a&gt;. It refers to a blog post by &lt;a href="http://galratner.com/blogs/" target="_blank"&gt;Gal Ratner&lt;/a&gt;, &lt;a title="http://bit.ly/p093H7" href="http://bit.ly/p093H7"&gt;http://bit.ly/p093H7&lt;/a&gt;. Discussion on Skype API and source code for how to attach to Skype process and redirect conversations allowing you to record them. Check it out.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=567999" width="1" height="1"&gt;</content><author><name>fabulous</name><uri>http://bloggingabout.net/members/fabulous/default.aspx</uri></author><category term=".NET" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/.NET/default.aspx" /><category term="Coding 4 Fun" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/Coding+4+Fun/default.aspx" /></entry><entry><title>Just Decompile</title><link rel="alternate" type="text/html" href="/blogs/fadzai/archive/2011/08/13/just-decompile.aspx" /><id>/blogs/fadzai/archive/2011/08/13/just-decompile.aspx</id><published>2011-08-12T23:54:00Z</published><updated>2011-08-12T23:54:00Z</updated><content type="html">&lt;p align="justify"&gt;Among its many qualities, I found that reflector! always had a remarkable ability to just disappear from my machine when I called upon it. It’s not every day that one needs to view the source code of some binary, but occasionally I would find myself looking at the IL generated by my code, and I’m not a big fan of viewing it from ildasm. I never figured out the interval, but it seemed that when a new version of reflector came out, the one you had would leave you stranded. And one day, it never came back.&lt;/p&gt;  &lt;p align="justify"&gt;It so happens that Telerik has a similar tool still in beta called Just Decompile. I just installed it this afternoon and have been playing around with it, seeing how it presents the code in the different languages. It doesn’t support all the languages that reflector did, but the most obvious choices, IL, C# and VB are there. From the feel of the app, I think it was written using WPF, but if you take that point to the bank, you might not redeem it for money.&lt;/p&gt;  &lt;p align="justify"&gt;&lt;a href="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/fadzai.metablogapi/8371.Tuple_5F00_506C7B85.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="JustCompile showing one of the variations of System.Tuple" border="0" alt="JustCompile showing one of the variations of System.Tuple" src="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/fadzai.metablogapi/8510.Tuple_5F00_thumb_5F00_4084E8D4.png" width="644" height="272" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;h6&gt;Interface&lt;/h6&gt;  &lt;p align="justify"&gt;The UI is quite simple to understand, with just one toolbar and a collapsible menu bar. &lt;/p&gt;  &lt;p align="justify"&gt;&amp;#160;&lt;/p&gt;  &lt;p align="justify"&gt;&lt;a href="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/fadzai.metablogapi/5078.JustDecompileMenubar_5F00_29170818.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="JustDecompile Menu and Toolbar" border="0" alt="JustDecompile Menu and Toolbar" src="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/fadzai.metablogapi/5482.JustDecompileMenubar_5F00_thumb_5F00_2E88096D.png" width="624" height="75" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p align="justify"&gt;The Load Framework menu includes options to load a framework of your choice, defaults are .NET 2.0, .NET 4.0 and the Silverlight assemblies. The assembly list option allows you to load or create custom assembly lists.&lt;/p&gt;  &lt;p align="justify"&gt;An interesting command on the toolbar is the Create Project button next to the Language selection combo box. This allows you to decompile an assembly and save the code in a new .NET project. This feature is only available when you select C# as your language.&lt;/p&gt;  &lt;h1&gt;&lt;/h1&gt;  &lt;h6&gt;Issues&lt;/h6&gt;  &lt;p align="justify"&gt;Just Decompile seems stable enough, but I have seen some error messages when trying to open some methods in VB or C#. So far there hasn’t been a problem in IL though. Following are some of the issues I’ll be reporting soon. The classes that cause errors in C# will still raise errors in the project creation process, but the process itself is unaffected because it will just continue decompiling the ones it can.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/fadzai.metablogapi/3157.ErrorMessage_5F00_60189864.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="The Error Message displayed on some methods." border="0" alt="The Error Message displayed on some methods." src="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/fadzai.metablogapi/6813.ErrorMessage_5F00_thumb_5F00_5B5A8FFD.png" width="644" height="309" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p align="justify"&gt;It also seems the C# code generator (if I can call it that) works better than the VB one. As some methods I tried work in IL and C# but not VB. It also displays auto implement properties fully expanded in VB. &lt;/p&gt;  &lt;p align="justify"&gt;Because of a rather curious issue, I haven’t been able to view Interface definitions in VB for interfaces that have properties. Anyway as this is still in beta, I’m pretty sure it will get fixed by the time it gets released. Despite these issues, there are no show stoppers to worry about.&lt;/p&gt;  &lt;h6&gt;Conclusion&lt;/h6&gt;  &lt;p align="justify"&gt;All in all, this is looking like a great product and the best part about it is that Telerik guarantees that it will remain free &lt;strong&gt;forever!&lt;/strong&gt; Now, there is no definitive evaluation of how long forever is, but I take it to mean a very long time indeed. And finally I must say thanks to Telerik for supporting my favorite podcast, .NET Rocks! &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=549430" width="1" height="1"&gt;</content><author><name>fabulous</name><uri>http://bloggingabout.net/members/fabulous/default.aspx</uri></author><category term=".NET" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/.NET/default.aspx" /><category term="Tools" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/Tools/default.aspx" /></entry><entry><title>UpTo – Enumerating Characters with Extension Methods.</title><link rel="alternate" type="text/html" href="/blogs/fadzai/archive/2010/07/16/upto-enumerating-characters-with-extension-methods.aspx" /><id>/blogs/fadzai/archive/2010/07/16/upto-enumerating-characters-with-extension-methods.aspx</id><published>2010-07-15T23:31:38Z</published><updated>2010-07-15T23:31:38Z</updated><content type="html">&lt;p&gt;While randomly clicking through links online, I chanced upon an interesting piece of code at &lt;a href="http://www.dreamincode.net/forums/blog/217/entry-2731-a-couple-of-new-extension-methods/" target="_blank"&gt;The Madman Scribblings&lt;/a&gt;. The first thing that interested me was that he had come up with an interesting variation to the If(Condition, Expression, Expression) operator that used Delegates for the expressions.&lt;/p&gt;  &lt;p&gt;While I was try to think of ways this would be useful, I then came to the end of the short blog post, where he re-writes another method he had come up with, UpTo. This calculates a range of characters similar to how you can loop through a character range in C# using a for statement.&lt;/p&gt;  &lt;p&gt;For those who haven&amp;#39;t tried, C# treats &lt;strong&gt;Char&lt;/strong&gt;s like integers and they can be traversed as such using code like this:&lt;/p&gt;  &lt;pre class="brush: csharp;"&gt;class Program
{
    static void Main(string[] args)
    {
        for (char c = &amp;#39;a&amp;#39;; c &amp;lt;= &amp;#39;z&amp;#39;; c++)
            Console.Write(c);
        Console.WriteLine();
    }
}&lt;/pre&gt;

&lt;p&gt;in VB, code like this does not work. I suppose the decision was made because historically the way to deal with characters and integers has always been using Chr and ChrW for finding the character corresponding to a particular integer value, and Asc and AscW for finding the numeric value that represents a particular character. Whatever the reasons, to achieve the same, one would have had to write code like this:&lt;/p&gt;

&lt;pre class="brush: vb;"&gt;For c = AscW(&amp;quot;a&amp;quot;c) To AscW(&amp;quot;b&amp;quot;c)
    Console.Write(ChrW(c))
Next
Console.WriteLine()&lt;/pre&gt;

&lt;p&gt;As you can see, you must first get the numeric values representing the characters, and in each iteration, you then calculate the corresponding character from the values you&amp;#39;d have obtained in the first step. C# is doing this for you in the background but this way of writing isn&amp;#39;t too pretty, and this isn&amp;#39;t the sort of thing you&amp;#39;d want to write multiple times if you need to calculate character ranges a lot. It&amp;#39;s not something I do a lot so I just accepted the way VB does it, and just thought there must be some other way of doing it without writing this kind of loop all the time.&lt;/p&gt;

&lt;p&gt;The UpTo extension method provides this very thing. It was so relevant to something I had long seen but never tackled that I was more interested in it than the main topic of the blog, the nifty If and IfElse extension methods. &lt;/p&gt;

&lt;p&gt;Needless to say, I tried the code on my computer and came upon these minor issues.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;In UpTo, Math.Abs() was generating an overflow because the calculation handed to it resulted in a negative value which is invalid for a Byte. I figured he must have been using Option Strict Off so I used Type inference to make the types Integers instead of removing Option Strict. &lt;/li&gt;

  &lt;li&gt;Inside IfElse, there was a&amp;#160; syntax error at ElseThis) which I corrected this way elseThis(source) &lt;/li&gt;

  &lt;li&gt;And the naming convention I use disallows underscores in method names so I removed these and the methods became If and IfElse instead of _If and _IfElse. &lt;/li&gt;

  &lt;li&gt;I also shortened the code by using one line Lambda expressions instead of the multi-line versions. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is the result of my changes:&lt;/p&gt;

&lt;pre class="brush: vb;"&gt;&amp;#39;&amp;#39;&amp;#39; &amp;lt;summary&amp;gt;
&amp;#39;&amp;#39;&amp;#39; Provides If(Boolean, Object) like functionality for IEnumerable(Of T) using a Delegate as the expression.
&amp;#39;&amp;#39;&amp;#39; &amp;lt;/summary&amp;gt;
&amp;#39;&amp;#39;&amp;#39; &amp;lt;typeparam name=&amp;quot;T&amp;quot;&amp;gt;The type in the IEnumerable.&amp;lt;/typeparam&amp;gt;
&amp;#39;&amp;#39;&amp;#39; &amp;lt;param name=&amp;quot;source&amp;quot;&amp;gt;The source collection that we are looking at.&amp;lt;/param&amp;gt;
&amp;#39;&amp;#39;&amp;#39; &amp;lt;param name=&amp;quot;condition&amp;quot;&amp;gt;The condition with which to evaluate the source collection.&amp;lt;/param&amp;gt;
&amp;#39;&amp;#39;&amp;#39; &amp;lt;param name=&amp;quot;doThis&amp;quot;&amp;gt;Operation to perform if the condition is True.&amp;lt;/param&amp;gt;
&amp;#39;&amp;#39;&amp;#39; &amp;lt;returns&amp;gt;Result of doThis(source) if condition is True, source otherwise.&amp;lt;/returns&amp;gt;
&amp;lt;Extension()&amp;gt;
Public Function [If](Of T)(ByVal source As IEnumerable(Of T), ByVal condition As Func(Of Boolean),
                           ByVal doThis As Func(Of IEnumerable(Of T), IEnumerable(Of T))) As IEnumerable(Of T)
    Return If(condition(), doThis(source), source)
End Function

&amp;#39;&amp;#39;&amp;#39; &amp;lt;summary&amp;gt;
&amp;#39;&amp;#39;&amp;#39; Provides If(Boolean, Object, Object) like functionality for IEnumerable(Of T) using a Delegate as the expressions.
&amp;#39;&amp;#39;&amp;#39; &amp;lt;/summary&amp;gt;
&amp;#39;&amp;#39;&amp;#39; &amp;lt;typeparam name=&amp;quot;T&amp;quot;&amp;gt;The type in the IEnumerable.&amp;lt;/typeparam&amp;gt;
&amp;#39;&amp;#39;&amp;#39; &amp;lt;param name=&amp;quot;source&amp;quot;&amp;gt;The source collection that we are evaluating.&amp;lt;/param&amp;gt;
&amp;#39;&amp;#39;&amp;#39; &amp;lt;param name=&amp;quot;condition&amp;quot;&amp;gt;The condition with which to evaluate the source collection.&amp;lt;/param&amp;gt;
&amp;#39;&amp;#39;&amp;#39; &amp;lt;param name=&amp;quot;doThis&amp;quot;&amp;gt;Operation to perform if the condition is True.&amp;lt;/param&amp;gt;
&amp;#39;&amp;#39;&amp;#39; &amp;lt;param name=&amp;quot;elseThis&amp;quot;&amp;gt;Operation to perform if the condition is False.&amp;lt;/param&amp;gt;
&amp;#39;&amp;#39;&amp;#39; &amp;lt;returns&amp;gt;Result of doThis(source) if condition evaluates to True, else the result of elseThis(source) is returned.&amp;lt;/returns&amp;gt;
&amp;lt;Extension()&amp;gt;
Public Function IfElse(Of T)(ByVal source As IEnumerable(Of T), ByVal condition As Func(Of Boolean),
                             ByVal doThis As Func(Of IEnumerable(Of T), IEnumerable(Of T)),
                             ByVal elseThis As Func(Of IEnumerable(Of T), IEnumerable(Of T))) As IEnumerable(Of T)
    Return If(condition(), doThis(source), elseThis(source))
End Function

&amp;#39;&amp;#39;&amp;#39; &amp;lt;summary&amp;gt;
&amp;#39;&amp;#39;&amp;#39; Calculates all the characters in the range fromChar to toChar inclusive.
&amp;#39;&amp;#39;&amp;#39; &amp;lt;/summary&amp;gt;
&amp;#39;&amp;#39;&amp;#39; &amp;lt;param name=&amp;quot;fromChar&amp;quot;&amp;gt;The start character in the sequence.&amp;lt;/param&amp;gt;
&amp;#39;&amp;#39;&amp;#39; &amp;lt;param name=&amp;quot;upToChar&amp;quot;&amp;gt;The last character in the sequence.&amp;lt;/param&amp;gt;
&amp;#39;&amp;#39;&amp;#39; &amp;lt;returns&amp;gt;A string containing all the characters in the range.&amp;lt;/returns&amp;gt;
&amp;#39;&amp;#39;&amp;#39; &amp;lt;remarks&amp;gt;
&amp;#39;&amp;#39;&amp;#39; If fromChar appears after upToChar in alphabetic order, the values are switched around so that an ordered list comes.
&amp;#39;&amp;#39;&amp;#39; &amp;lt;/remarks&amp;gt;
&amp;lt;Extension()&amp;gt;
Public Function UpTo(ByVal fromChar As Char, ByVal upToChar As Char) As String
    Dim f = AscW(fromChar)
    Dim u = AscW(upToChar)

    Return Enumerable.Range({f, u}.Min, Math.Abs(u - f) + 1).
        Select(Function(c) ChrW(c)).If(Function() f &amp;gt; u, Function(x) x.Reverse()).ToArray()
End Function&lt;/pre&gt;

&lt;p&gt;The above should be placed inside a Module. The following is an example of how to call this method.&lt;/p&gt;

&lt;pre class="brush: vb;"&gt;Sub Main()
    Dim startChar = &amp;quot;Z&amp;quot;c

    Console.WriteLine(startChar.UpTo(&amp;quot;A&amp;quot;c))
End Sub&lt;/pre&gt;

&lt;p&gt;I hope you find this as interesting as I did. Happy coding.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=483721" width="1" height="1"&gt;</content><author><name>fabulous</name><uri>http://bloggingabout.net/members/fabulous/default.aspx</uri></author><category term=".NET" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/.NET/default.aspx" /><category term="Lambda Expressions" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/Lambda+Expressions/default.aspx" /><category term="Extension Methods" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/Extension+Methods/default.aspx" /></entry><entry><title>Improved Jump Lists Post – and a bit more</title><link rel="alternate" type="text/html" href="/blogs/fadzai/archive/2010/06/08/improved-jump-lists-and-a-bit-more.aspx" /><id>/blogs/fadzai/archive/2010/06/08/improved-jump-lists-and-a-bit-more.aspx</id><published>2010-06-08T14:32:00Z</published><updated>2010-06-08T14:32:00Z</updated><content type="html">&lt;p&gt;Well, I&amp;#39;ve used up all my sick days so tomorrow I&amp;#39;m calling in dead. In the meantime, I thought of posting a review on a couple of things I have learned over the past few months. The first thing I will work on is code to deal with Jump Lists. My first post on the subject was after my first attempt and doing things the old way, in code. Code junkies like me who&amp;#39;ve been coding since the green screen days of MS-DOS will probably attack a problem in code first. WPF has changed that in that you can achieve a lot of the same results without writing a single line of executable code. XAML is the answer. &lt;/p&gt;
&lt;p&gt;Well, I finally worked on a real app that would benefit a lot from jump lists. And this time, I approached it using XAML. The application even had an overlay icon to notify the user when a long running asynchronous operation was in progress.&amp;nbsp; &lt;/p&gt;
&lt;h1&gt;Jump Lists&lt;/h1&gt;
&lt;p&gt;The first file I edited when trying this in XAML is the Application.xaml (app.xaml for C#). This is because the Jump List belongs to the application. &lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;JumpList.JumpList&amp;gt;
    &amp;lt;JumpList JumpItemsRejected=&amp;quot;JumpList_JumpItemsRejected&amp;quot; JumpItemsRemovedByUser=&amp;quot;JumpList_JumpItemsRemovedByUser&amp;quot;&amp;gt;
        &amp;lt;!-- Add ApplicationPath attributes to point to the app you wish to run when your task is clicked.
             You can also place an Arguments attribute which can specify command line arguments for the app.
             You can also assign an Icon to the task by specifying an IconResourcePath attribute. --&amp;gt;
        &amp;lt;JumpTask Title=&amp;quot;Calculator&amp;quot; Description=&amp;quot;Launch the windows calculator&amp;quot;
                  IconResourcePath=&amp;quot;C:\Windows\System32\Calc.exe&amp;quot; ApplicationPath=&amp;quot;C:\Windows\System32\Calc.exe&amp;quot; /&amp;gt;
        
        &amp;lt;JumpPath Path=&amp;quot;C:\Users\Public\Readme.txt&amp;quot; /&amp;gt;
    &amp;lt;/JumpList&amp;gt;
&amp;lt;/JumpList.JumpList&amp;gt;&lt;/pre&gt;
&lt;p&gt;This piece of XAML registers event handlers to deal with the scenarios when a jump item is rejected, or when a user removes it from the list. In the second scenario it is recommended that you skip loading the item the next time your app runs to respect the user&amp;#39;s wishes.&lt;/p&gt;
&lt;p&gt;It then adds a JumpTask that runs the windows calculator, and a JumpPath. For the jump path to register, you should register your application to open the file type in question. &lt;/p&gt;
&lt;h1&gt;Overlay Icon&lt;/h1&gt;
&lt;p&gt;The overlay icon is very simple too. In this case, I wrote one line of code to remove the icon, and one other to remove it. Here is the XAML for it.&lt;/p&gt;
&lt;pre class="brush: xml;"&gt;&amp;lt;Window.TaskbarItemInfo&amp;gt;
    &amp;lt;TaskbarItemInfo /&amp;gt;
&amp;lt;/Window.TaskbarItemInfo&amp;gt;

&amp;lt;Window.Resources&amp;gt;
    &amp;lt;DrawingImage x:Key=&amp;quot;IconOverlay&amp;quot; &amp;gt;
        &amp;lt;DrawingImage.Drawing&amp;gt;
            &amp;lt;ImageDrawing ImageSource=&amp;quot;Offline.png&amp;quot; Rect=&amp;quot;0 0 32 32&amp;quot; /&amp;gt;
        &amp;lt;/DrawingImage.Drawing&amp;gt;
    &amp;lt;/DrawingImage&amp;gt;
&amp;lt;/Window.Resources&amp;gt;&lt;/pre&gt;
&lt;p&gt;You place this in the .xaml file for the main window. In this case, the source is a png, but it can be an icon. The code to show and hide the icon in the task bar follows:&lt;/p&gt;
&lt;pre class="brush: vb;"&gt;&amp;#39; To add the overlay icon.
Me.TaskbarItemInfo.Overlay = CType(Me.Resources(&amp;quot;IconOverlay&amp;quot;), ImageSource)&lt;/pre&gt;
&lt;pre class="brush: vb;"&gt;&amp;#39; To remove the overlay icon.
Me.TaskbarItemInfo.Overlay = Nothing&lt;/pre&gt;
&lt;p&gt;That&amp;#39;s it. Here is the same in C#.&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;// Add the overlay icon.
this.TaskbarItemInfo.Overlay = (ImageSource)this.Resources[&amp;quot;IconOverlay&amp;quot;];

// Remove the thing.
this.TaskbarItemInfo.Overlay = null;&lt;/pre&gt;
&lt;p&gt;That&amp;#39;s really all you have to do. &lt;/p&gt;
&lt;h1&gt;&lt;/h1&gt;
&lt;h1&gt;Conclusion&lt;/h1&gt;
&lt;p&gt;In a production app you&amp;#39;ll need to do more however. You may have more than one scenario in which you&amp;#39;d want to show an overlay icon, in this case, you&amp;#39;ll need to handle the various events or situations that fit your application. In the case of the jump list, you may want to load your jump items dynamically so you can determine what the user wishes to see or to reflect the overall status of the application. There&amp;#39;s no point in having a &amp;quot;Publish Local Data&amp;quot; if there is no local data to publish. &lt;/p&gt;
&lt;p&gt;Hope this helps. Happy coding.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=483476" width="1" height="1"&gt;</content><author><name>fabulous</name><uri>http://bloggingabout.net/members/fabulous/default.aspx</uri></author><category term="Windows 7" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/Windows+7/default.aspx" /><category term=".NET 4.0" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/.NET+4.0/default.aspx" /><category term="XAML" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/XAML/default.aspx" /></entry><entry><title>Visual Studio 2010 Release Candidate Has Arrived</title><link rel="alternate" type="text/html" href="/blogs/fadzai/archive/2010/02/15/visual-studio-2010-release-candidate-has-arrived.aspx" /><id>/blogs/fadzai/archive/2010/02/15/visual-studio-2010-release-candidate-has-arrived.aspx</id><published>2010-02-15T11:27:00Z</published><updated>2010-02-15T11:27:00Z</updated><content type="html">&lt;p&gt;Boy, doesn&amp;#39;t time move fast. It seems like only a few months ago when I downloaded VS2010 Beta 2 and now the release candidate is here. Okay, so it actually was a few months ago when I did the download, but you get the point don&amp;#39;t you? I haven&amp;#39;t done any coding in almost a month so I missed this when it came out and only saw it it this morning when I opened Beta 2. This has come out sooner than I expected, and that&amp;#39;s a good thing.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m just looking at some of the new features available in it (from the MSDN website), and it appears they have a prototyping tool, and from the screen shot available, it seems it has similar functionality to sketchflow. But this works from inside Visual Studio, which is great for left-brained developers like me who know how to use Blend through and through, but still cannot create something appealing to the eye with the tool. The &lt;a target="_blank" href="http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx" title="The MSDN page"&gt;page&lt;/a&gt; is offering new integration capabilities for the various roles we have to fill, (developer, designer, tester, etc.),&amp;nbsp;which if improved will totally rock because I think they are great already.&lt;/p&gt;
&lt;p&gt;You can aslo see from the MSDN site that as expected, there is a lot of chatter about it on twitter. I don&amp;#39;t know about you, but I&amp;#39;m game, and will be downloading this to see what new things it has to offer.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=482836" width="1" height="1"&gt;</content><author><name>fabulous</name><uri>http://bloggingabout.net/members/fabulous/default.aspx</uri></author><category term=".NET" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/.NET/default.aspx" /><category term="VS2010" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/VS2010/default.aspx" /><category term=".NET 4.0" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/.NET+4.0/default.aspx" /></entry><entry><title>No longer anonymous types</title><link rel="alternate" type="text/html" href="/blogs/fadzai/archive/2010/01/11/no-longer-anonymous-types.aspx" /><id>/blogs/fadzai/archive/2010/01/11/no-longer-anonymous-types.aspx</id><published>2010-01-11T09:50:08Z</published><updated>2010-01-11T09:50:08Z</updated><content type="html">&lt;p&gt;I’m thoroughly enjoying the nice new features in VS2010 and the little features offer the best wow moments for me.&lt;/p&gt;  &lt;p&gt;I was working on an app a couple of days ago that used LINQ and anonymous types and I now had to pass the result of the query to a procedure in another class for storage. This meant I had to write out a class and replace the reference to the anonymous type with the name of the class I had been using.&lt;/p&gt;  &lt;p&gt;I tried something new first, by writing the intended name of the class, and generating the class from usage. Doing this was a breeze as I accomplished everything in one step from VB. It generated auto implement properties based on the object initializer and I thought this was cool.&lt;/p&gt;  &lt;p&gt;Here is a step-by-step guide on how to accomplish this…&lt;/p&gt;  &lt;p&gt;&lt;a href="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/fadzai.metablogapi/8360.anonystep1_5F00_3FA490DF.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="anony-step1" border="0" alt="anony-step1" src="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/fadzai.metablogapi/7271.anonystep1_5F00_thumb_5F00_7736FF75.png" width="660" height="82" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;At this point, you add the name of the class….&lt;/p&gt;  &lt;p&gt;&lt;a href="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/fadzai.metablogapi/6866.anonystep2_5F00_2A77989A.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="anony-step2" border="0" alt="anony-step2" src="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/fadzai.metablogapi/2134.anonystep2_5F00_thumb_5F00_646B3B41.png" width="666" height="101" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;then invoke the generate from usage smart tag&lt;/p&gt;  &lt;p&gt;&lt;a href="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/fadzai.metablogapi/4064.anonystep3_5F00_52BA4335.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="anony-step3" border="0" alt="anony-step3" src="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/fadzai.metablogapi/2860.anonystep3_5F00_thumb_5F00_5569EF52.png" width="670" height="162" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;At which point we are done. Here is the class that VB generated…&lt;/p&gt;  &lt;p&gt;&lt;a href="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/fadzai.metablogapi/6560.anonystep4_5F00_1203BCFA.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="anony-step4" border="0" alt="anony-step4" src="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/fadzai.metablogapi/7446.anonystep4_5F00_thumb_5F00_0DB47839.png" width="395" height="153" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I think it is so cool, the way VS2010 makes you more productive. All I had to do was 4 keystrokes, A-p-p-&amp;lt;space&amp;gt; (in the context of the example I am using) and then all was well. The method in the class I was working on now had to reference the name of the class that I specified.&lt;/p&gt;  &lt;p&gt;There are some differences however in that there is one method of anonymous types in VB that makes the type immutable, and you can have another way that you can edit the values. C# generates immutable anonymous types only. If you want similar semantics for your generated class, you will have to expand the properties and implement them as write-once, read-only (in which case you will have to call a constructor as opposed to using object initializers). I’ll get around to doing this in C# and posting on how to do it in that language although I can’t imagine the process being too different.&lt;/p&gt;  &lt;p&gt;Hope this helps, happy coding.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=482673" width="1" height="1"&gt;</content><author><name>fabulous</name><uri>http://bloggingabout.net/members/fabulous/default.aspx</uri></author><category term="VS2010" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/VS2010/default.aspx" /><category term="Generate from Usage" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/Generate+from+Usage/default.aspx" /></entry><entry><title>Jump List – Post Fixed</title><link rel="alternate" type="text/html" href="/blogs/fadzai/archive/2010/01/09/jump-list-post-fixed.aspx" /><id>/blogs/fadzai/archive/2010/01/09/jump-list-post-fixed.aspx</id><published>2010-01-09T08:31:29Z</published><updated>2010-01-09T08:31:29Z</updated><content type="html">&lt;p&gt;After the formatting disaster that was &lt;a href="http://bloggingabout.net/blogs/fadzai/archive/2009/11/21/jump-lists.aspx" target="_blank"&gt;my attempt at posting about JumpLists in Windows 7&lt;/a&gt;, I tried in vain to change the font and other attributes. It turned out that even the attached download didn’t work properly. &lt;/p&gt;  &lt;p&gt;I have had to start afresh on a new PC and re-typed the whole document in Windows Live Writer to get the formatting anywhere near correct. I re-uploaded the download and have tested to see that it does work. Hopefully now it will be easier to read.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=482668" width="1" height="1"&gt;</content><author><name>fabulous</name><uri>http://bloggingabout.net/members/fabulous/default.aspx</uri></author></entry><entry><title>Jump Lists</title><link rel="alternate" type="text/html" href="/blogs/fadzai/archive/2009/11/21/jump-lists.aspx" /><id>/blogs/fadzai/archive/2009/11/21/jump-lists.aspx</id><published>2009-11-21T08:00:00Z</published><updated>2009-11-21T08:00:00Z</updated><content type="html">&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;andale mono&amp;#39;, &amp;#39;times&amp;#39;;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;font size="3" face="Calibri"&gt;I’m a firm believer in the mantra “When all else fails, read the instructions.” For most items, I just get stuck into what I need to do and figure out the details on the way. This is what I did when I started using VS2010 beta 2. I have never used a beta 1 product before, and I’m usually hesitant to try out beta 2 products, but I wasted no time with VS2008 and VS2010 because of the huge potential they carry.&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;span style="font-family:&amp;#39;andale mono&amp;#39;, &amp;#39;times&amp;#39;;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;/span&gt;&lt;/span&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;andale mono&amp;#39;, &amp;#39;times&amp;#39;;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;font size="3" face="Calibri"&gt;As soon as my installation was done I opened Visual Studio and started to write some code. This was cool. I then unpacked the samples to see how some of the new things were done, and then finally I started to apply some of the new techniques to some applications that I already have.&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;span style="font-family:&amp;#39;andale mono&amp;#39;, &amp;#39;times&amp;#39;;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;/span&gt;&lt;/span&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;andale mono&amp;#39;, &amp;#39;times&amp;#39;;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;font size="3" face="Calibri"&gt;One thing I tried this morning on Windows 7 was to add a jump list to my app. I wanted to add two tasks, and a recent file list. Piece of cake; to be exact, piece of cake without the flour to bake the cake with in the first place. After finding the namespace in Object Browser, I started playing around with the various classes to make the application work but there was no feedback; no jump list, no crash, no error message, Nothing (or null in C#). So I added a handler for JumpItemsRejected event.&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;span style="font-family:&amp;#39;andale mono&amp;#39;, &amp;#39;times&amp;#39;;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;/span&gt;&lt;/span&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;andale mono&amp;#39;, &amp;#39;times&amp;#39;;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;font size="3" face="Calibri"&gt;The first bit of luck I got was a message telling me that there is no registered handler when I tried to add a JumpPath object. I figured this is because the file type used by my application hasn’t been registered on Windows so I associated this with my program by using Open With in Windows Explorer and tried again; then the weirdness began. I got the same message from my code, there is no registered handler. Meanwhile, I right clicked the task bar button and lo and behold, my JumpPath was right there.&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;span style="font-family:&amp;#39;andale mono&amp;#39;, &amp;#39;times&amp;#39;;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;/span&gt;&lt;/span&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;andale mono&amp;#39;, &amp;#39;times&amp;#39;;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;font size="3" face="Calibri"&gt;I ran the code again, and again, and again, and again. But this time there was no joy, in place of the JumpPath, I got the message box. I changed the code multiple times to see if anything would change. But the definition of insanity is trying the same thing over and over again, without a Catch block. At this point, I mounted the VS2010 iso and installed the documentation for the first time. When that was done I searched for JumpList and got 33 results which helped me not one bit. It was the same info as what you would find in the Object Browser, no example code. So I went back to the insanity.&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;andale mono&amp;#39;, &amp;#39;times&amp;#39;;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;font size="3" face="Calibri"&gt;I added a task to the JumpList and that worked, only the JumpPath was rejected. All this was in a sample application that opens a .csv file, and the task was calling the same app with an argument of ”-doNothing”. The code in the startup procedure checks for an argument and displays it in a message box,or loads as normal if there is no command line argument. I invoked the task and take a wild guess what I got! The jump list with the JumpPath included.&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;andale mono&amp;#39;, &amp;#39;times&amp;#39;;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height:115%;font-size:11pt;"&gt;&lt;span style="font-family:&amp;#39;andale mono&amp;#39;, &amp;#39;times&amp;#39;;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;a href="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/fadzai/6305.Jump-List-_2D00_-Candy.png"&gt;&lt;font size="3" face="Calibri"&gt;&lt;img border="0" src="http://bloggingabout.net/resized-image.ashx/__size/550x0/__key/CommunityServer.Blogs.Components.WeblogFiles/fadzai/6305.Jump-List-_2D00_-Candy.png" alt="" /&gt;&lt;/font&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;font size="3" face="Calibri"&gt;&amp;#160;&lt;/font&gt;   &lt;p&gt;&lt;span style="font-family:&amp;#39;andale mono&amp;#39;, &amp;#39;times&amp;#39;;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;font size="3" face="Calibri"&gt;It’s a conspiracy I tell you. It didn’t take me long to get to the bottom of it, the program that was registered to handle the file type is Jump.exe, the build result. The program that was running when I pressed F5 in the IDE is Jump.vshost32.exe (I am on Windows 7 64 bit). After spending a large part of the morning trying to get rid of the error in my code, I discovered that there wasn’t one; how annoying.&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;andale mono&amp;#39;, &amp;#39;times&amp;#39;;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;font size="3" face="Calibri"&gt;I don’t know if this is a known issue, it it isn’t then it is an unknown issue isn’t it. But I think the documentation for the final version should tell us that you should &lt;strong&gt;run the registered application for a Jump path from Windows Explorer or run without debugging from the IDE . &lt;/strong&gt;This of course is assuming that the application you are writing has been registered with Windows for the file type you want. And something else for my wish list, give us some samples please. This isn’t an issue big enough that we have to try to figure out ourselves in the morning before heading to the office.&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family:&amp;#39;andale mono&amp;#39;, &amp;#39;times&amp;#39;;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height:115%;font-size:11pt;"&gt;&lt;span style="font-family:&amp;#39;andale mono&amp;#39;, &amp;#39;times&amp;#39;;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;font size="3" face="Calibri"&gt;If you want to see the VS2010 code for creating Jump Lists, &lt;a title="Attached download" href="http://bloggingabout.net/media/p/482667/download.aspx" target="_blank"&gt;click here&lt;/a&gt;&lt;/font&gt;&lt;font size="3" face="Calibri"&gt;&lt;/font&gt;&lt;font size="3" face="Calibri"&gt;. Remember to register the .code file type before running this code (see the sample.code file inside the solution for instructions). Or better yet, run it without registering and have fun trying to figure out what went wrong. Happy&lt;/font&gt;&lt;/span&gt;&lt;font size="3" face="Calibri"&gt; coding.&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="line-height:115%;font-size:11pt;"&gt;&lt;span style="font-family:&amp;#39;andale mono&amp;#39;, &amp;#39;times&amp;#39;;"&gt;&lt;span style="font-size:x-small;"&gt;&lt;font size="3" face="Calibri"&gt;&amp;#160;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=482491" width="1" height="1"&gt;</content><author><name>fabulous</name><uri>http://bloggingabout.net/members/fabulous/default.aspx</uri></author><category term=".NET" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/.NET/default.aspx" /><category term="Windows 7" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/Windows+7/default.aspx" /><category term="VS2010" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/VS2010/default.aspx" /></entry><entry><title>PowerTab revisited</title><link rel="alternate" type="text/html" href="/blogs/fadzai/archive/2009/11/17/powertab-revisited.aspx" /><id>/blogs/fadzai/archive/2009/11/17/powertab-revisited.aspx</id><published>2009-11-17T15:03:00Z</published><updated>2009-11-17T15:03:00Z</updated><content type="html">&lt;p&gt;Last week &lt;a target="_blank" href="http://bloggingabout.net/blogs/fadzai/archive/2009/11/13/power-tab.aspx" title="PowerTab article"&gt;I wrote&lt;/a&gt; about PowerTab and how it can be helpful. I went to &lt;a href="http://www.dnrtv.com"&gt;www.dnrtv.com&lt;/a&gt; and saw something about PowerShell so I downloaded it since I have recently taken an interest in it. To my surprise, I then saw PowerTab in action, the guest actually recommended PowerTab. &lt;/p&gt;
&lt;p&gt;Granted it is an old show (from 2007), but I think it is good. Anyone like me who never took notice of PowerShell when it first came out will find it valuable. In my case, I downloaded SQL Server 2008 Express and when installing it, it said I needed to get PowerShell. As a result I didn&amp;#39;t check out SQL2008 as I kept forgetting to get PowerShell. Then recently at a developer conference, the speaker spoke of many possibilities with PowerShell. And now I&amp;#39;m game.&lt;/p&gt;
&lt;p&gt;Been playing around with it and it is really cool. If you want to check out the video I found you can go to &lt;a target="_blank" href="http://www.dnrtv.com/default.aspx?showNum=82" title="PowerShell demo"&gt;dot net rocks tv&lt;/a&gt;&amp;nbsp;and there you will see PowerTab in action.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=482472" width="1" height="1"&gt;</content><author><name>fabulous</name><uri>http://bloggingabout.net/members/fabulous/default.aspx</uri></author><category term="PowerShell" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/PowerShell/default.aspx" /><category term="PowerTab" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/PowerTab/default.aspx" /></entry><entry><title>Power Tab</title><link rel="alternate" type="text/html" href="/blogs/fadzai/archive/2009/11/13/power-tab.aspx" /><id>/blogs/fadzai/archive/2009/11/13/power-tab.aspx</id><published>2009-11-13T14:10:00Z</published><updated>2009-11-13T14:10:00Z</updated><content type="html">&lt;p&gt;I came across a great add-on for PowerShell, PowerTab which you can find at&amp;nbsp;&lt;a target="_blank" title="Power Tab blog" href="http://thepowershellguy.com/blogs/posh/default.aspx"&gt;the power shell guy&amp;#39;s site&lt;/a&gt;. This provides you with intellisense when accessing the .NET framework in PowerShell. I know that PowerShell in Windows 7 has a script editor, but I haven&amp;#39;t used it so I don&amp;#39;t know if it has intellisense or not. I will update shrotly in that regard.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you find yourself writing any scripts that access the .NET framework, or if you occasionally touch the framework from a powershell session, you will find PowerTab useful. Head on over to&amp;nbsp;http://shrinkster.com/1bgc and check out PowerTab.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=482460" width="1" height="1"&gt;</content><author><name>fabulous</name><uri>http://bloggingabout.net/members/fabulous/default.aspx</uri></author><category term="Scripts" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/Scripts/default.aspx" /><category term="PowerShell" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/PowerShell/default.aspx" /><category term="PowerTab" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/PowerTab/default.aspx" /></entry><entry><title>Federated Search in Windows 7</title><link rel="alternate" type="text/html" href="/blogs/fadzai/archive/2009/11/01/federated-search-in-windows-7.aspx" /><id>/blogs/fadzai/archive/2009/11/01/federated-search-in-windows-7.aspx</id><published>2009-11-01T11:56:00Z</published><updated>2009-11-01T11:56:00Z</updated><content type="html">&lt;p&gt;I wrote some software some time ago that is used by a mining company for maintaining their stores, HR, and monitoring production. I have been discussing with the MD about ways to give him reports in a centralised manner.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Earlier, I had written a reporting app which can be plugged into the main app for his managers, or can run stand-alone for his own use. The problem is, he doesn&amp;#39;t need all the reports it serves, and there are now a bunch of mine shafts and offices that he will need information from, since the company has expanded from mining chrome in one town, to mining gold and chrome in different towns. Seeing as he has a lot of work and a number of other concerns I am not involved in, I couldn&amp;#39;t place a whole lot of apps on his machine just for reporting when all he wants to do is see some bottom line figures.&lt;/p&gt;
&lt;p&gt;While I was thinking of a solution, I happened to attend a conference on Developing for Windows 7 about 2 weeks ago. One demo the speaker gave was on federated search. He searched for a Steve Balmer video and got a bunch of YouTube results right there in the Windows Explorer shell (in a similar format to the picture below) and I thought, &lt;strong&gt;&lt;i&gt;whoa!&lt;/i&gt;&lt;/strong&gt;&amp;nbsp;I had been thinking of writing a shell extension for him to use which would go and search for his data from the various sources and he could see them all unified but this demo saved me a lot of time and effort. After the conference I asked how this works, and was told all I have to do is create an .osdx (Open Search Description) file, and Windows can use that as a search provider.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-width:550px;border:0;vertical-align:middle;" border="0" src="http://i.msdn.microsoft.com/Dd742951.AreasofWindowsExplorerthatyoucancontrolwithproplists(en-us,VS.85).png" alt="Screenshot of Windows 7&amp;#39;s Federated Search feature at work." /&gt;&lt;/p&gt;
&lt;p&gt;My main concern was how much code I&amp;#39;d have to write but was happy to hear that I didn&amp;#39;t have to re-write a single line of code. The osdx file can specify a service that I have already written that aggregates the data from all the various sites and the results can be displayed in the explorer window.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This is what I am reseraching now, to see how best I can present these results in detail when he finds something he wants info on. I haven&amp;#39;t isntalled the Windows 7 beta so this is something I was completely unaware of. For those like me who haven&amp;#39;t heard of this, it is a feature that allows you to search multiple locations from within the Windows environment. For instance, if you want to find something on Bing, Youtube and amazon, you select search providers for these locations and type your search once, and you will have your results displayed right in there.&lt;/p&gt;
&lt;p&gt;I will be updating you on my findings in the next couple of weeks. In the meantime, here is something that I found on MSDN that I think will be useful for understanding the schema for the osdx file (XML based) and how this works under the hood.&lt;/p&gt;
&lt;p&gt;&lt;a title="Read the article from MSDN" href="http://msdn.microsoft.com/en-us/library/dd742951(VS.85).aspx"&gt;MSDN article for Federated Search&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=482408" width="1" height="1"&gt;</content><author><name>fabulous</name><uri>http://bloggingabout.net/members/fabulous/default.aspx</uri></author><category term="Windows 7" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/Windows+7/default.aspx" /><category term="Federated Search" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/Federated+Search/default.aspx" /></entry><entry><title>Predicates and Lambda functions for filtering and searching </title><link rel="alternate" type="text/html" href="/blogs/fadzai/archive/2009/10/11/predicates-and-lambda-functions-for-filtering-and-searching.aspx" /><id>/blogs/fadzai/archive/2009/10/11/predicates-and-lambda-functions-for-filtering-and-searching.aspx</id><published>2009-10-11T13:15:00Z</published><updated>2009-10-11T13:15:00Z</updated><content type="html">&lt;p&gt;One of the first things I looked for in the DataSet after I moved to .NET was the equivalent of the Filter property of the ADO recordset. I relied on such functionality a lot, and in many cases I still do. It took just a short time for me to find out that you have to access the RowFilter property of the DataSet&amp;#39;s DataView. The syntax in both cases was similar, you construct an SQL like string (similar to what would go into the WHERE clause of a SELECT query). So with this, you could get all the rows from a table and then as the user enters some filter criteria, you can narrow the results down to what matches the user&amp;#39;s filter.&lt;/p&gt;
&lt;p class="MsoNormal"&gt;Before I go into this, I must say it isn&amp;rsquo;t advisable to get all the rows from every table, you must get only what you need. But there are some cases where it isn&amp;rsquo;t too expensive to get all the rows, typically for lookup fields (think Account Types, States, Cities etc.), but it could be inefficient to repeatedly go to the database for just what you want. After my first .NET project I started to look for better ways of achieving this, at least ways to do so without relying on a DataTable, DataSet or DataView.&lt;/p&gt;
&lt;p class="MsoNormal"&gt;One such way is using Delegates against a method you can find on some of the IEnumerable(Of T)/IEnumerable&amp;lt;T&amp;gt; classes, such as a List. The delegate in question is Predicate(Of T)/Predicate&amp;lt;T&amp;gt;. Anyone who has done some PROLOG before could be thinking, &amp;quot;Hmm, predicates hey?&amp;quot; these are not quite the same thing. The predicate delegate is simple enough; it takes an argument of type T, and returns a Boolean value. Your preferred IEnumerable class will call your method each time it needs to make a comparison when searching for something.&lt;/p&gt;
&lt;p&gt;There are two methods I will cover here, the Find() and FindAll() methods. Find will return only one item, the first item in your List that matches your criteria, and FindAll is what you would use when filtering, it returns everything that is a match. Before LINQ came about, and if you weren&amp;rsquo;t using anonymous methods in C#, you had to write a full method body for this comparison. That is the technique I will show first. Don&amp;rsquo;t fret if you don&amp;rsquo;t see your favorite language, my samples are always in both C# and VB, though my articles may have only VB because that is my favorite language.&lt;/p&gt;
&lt;h3&gt;Full Method Body&lt;/h3&gt;
&lt;p&gt;&lt;span style="font-weight:normal;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;Private Function CompareName(ByVal prod As Filter.Common.Product) As Boolean&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If MethodNameFilter.Text = &amp;quot;&amp;quot; Then Return True&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39;do the the filter...&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return prod.ProductName.StartsWith(MethodNameFilter.Text, _ &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;StringComparison.InvariantCultureIgnoreCase)&lt;/p&gt;
&lt;p&gt;End Function&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span lang="EN-ZW"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;The code above is an example of how a VB method that conforms to the Predicate(Of Filter.Common.Product) will look like. In this case, I am looking for products with a name starting with the text inside a textbox named MethodNameFilter. The method is called like so:&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-ZW"&gt;filtered = filtered.FindAll(AddressOf CompareName)&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-ZW"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-ZW"&gt;In C#, the equivalent code to call the method is slightly different:&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-ZW"&gt;filtered = filtered.FindAll(new Predicate&amp;lt;Filter.Common.Product&amp;gt;(CompareName));&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-ZW"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-ZW"&gt;VB allows you to write code just like this, where you create an instance of the Predicate&amp;lt;T&amp;gt; for some T, and then specify the method, but it has the convenient syntax of just saying AddressOf and then it will do the rest because it will know what delegate to use, and it can verify the method signature as you type.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;By specifying the method in the call to FindAll(), you are telling the List (in this case I used List&amp;lt;T&amp;gt;) to use the specified method to qualify any objects for the new filtered list. I used the variable name filtered to store my copy of the filtered down list, while preserving a copy of the original list in case the user cleared the filter text. Here is a screenshot to show you what it looks like at runtime.&lt;/p&gt;
&lt;p&gt;&lt;span lang="EN-ZW"&gt;&lt;span lang="EN-ZW"&gt;&lt;/span&gt;&lt;span lang="EN-ZW"&gt;&lt;/span&gt;&lt;a href="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Components.PostAttachments/00.00.48.22.98/Filtering-by-supplier.jpg"&gt;&lt;img src="http://bloggingabout.net/resized-image.ashx/__size/550x0/__key/CommunityServer.Components.PostAttachments/00.00.48.22.98/Filtering-by-supplier.jpg" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-ZW"&gt;I allow the user to specifying any combination of two filter criteria, Name and Supplier for the Method body, and Name and Category for the Lambda expression tab, and in both cases I then filter the list down to show only what is a match. As you can see from the screenshot, there is an auto complete list for the Supplier textbox. I included code to create that in the attached download to show how you could assist a user. The Category textbox also has one. I&amp;#39;ve had to do that with info that was not normalised in the database, I get a list of all existing values for a column and then suggest to the user, as they are typing, what values to pick from.&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;&lt;span lang="EN-ZW"&gt;Using a Lambda Expression&lt;/span&gt;&lt;/h3&gt;
&lt;p&gt;&lt;span lang="EN-ZW"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-ZW"&gt;Doing the same thing in VB using a lambda expression is like this:&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-ZW"&gt;filtered = filtered.FindAll(Function(prod) _ &lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-ZW"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; prod.ProductName.StartsWith(LambdaNameFilter.Text, _&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-ZW"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; StringComparison.InvariantCultureIgnoreCase))&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-ZW"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-ZW"&gt;And in C#,&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-ZW"&gt;filtered = filtered.FindAll(prod =&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-ZW"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; prod.ProductName.StartsWith(LambdaNameFilter.Text,&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-ZW"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; StringComparison.InvariantCultureIgnoreCase));&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-ZW"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-ZW"&gt;In both cases, I use the inference capacities of both compilers to avoid typing a lot of code; you can see an example of how to do so without Local Type Inference in the comments in the attached download.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-ZW"&gt;These lambdas do the same thing as the method body, and they both match the signature of the Predicate(Of T)/Predicate&amp;lt;T&amp;gt; delegate.&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;&lt;span lang="EN-ZW"&gt;Searching for a specific item&lt;/span&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-ZW"&gt;The above examples covered how to use this technique to get all matching items. There are times however when you may want to get only one item. The List class comes with a corresponding Find() method that accepts a Predicate(Of T) argument, and then returns a single result of type T. the return value can be Nothing (null in C#) if there is no match, it if there is more than one item satisfying the criteria, the method will return only the first one. The method bodies and lambdas look exactly the same as before, because it is the same type of comparison using the very same Delegate, so I will not include the code here.&lt;/span&gt;&lt;/p&gt;
&lt;h3&gt;&lt;strong&gt;&lt;span lang="EN-ZW"&gt;Conclusion&lt;/span&gt;&lt;/strong&gt;&lt;/h3&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-ZW"&gt;The data in this case as you can see from the screenshot is from the Northwind same database. Just in case someone out there has not installed the database, I included an XML file with the data that a shared library (shared between the VB and C# windows applications) reads to construct the list. I read the data using LINQ to XML in VB with the very sexy XML literals. I also included the project that created this XML file and you can run it by right-clicking on it, Selecting debug, and then Start New Instance. It runs, creates the file and loads it in IE, or your default XML viewer. You may have to change your connection string to get from your copy of Northwind.&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span lang="EN-ZW"&gt;Other List(Of T) methods that use the Predicate(Of T) delegate are, FindIndex, FindLast, FindLastIndex, RemoveAll and TrueForAll. FindIndex and FindLastIndex return the zero based index of the first or last occurrence of a matching element respectively. FindLast does the opposite of Find; it returns the last matching element in the list. RemoveAll will remove all elements that match the criteria that are matched by the predicate you have specified. And finally the TrueForAll method will return true if all items in the list match the given criteria. It will call the predicate for each element in order and will stop processing the first time false is returned.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span lang="EN-ZW"&gt;Have a look at the &lt;/span&gt;&lt;span lang="EN-ZW"&gt;&lt;a target="_blank" href="http://bloggingabout.net/media/p/482297.aspx" title="Click here to download sample application"&gt;attached download&lt;/a&gt;&lt;/span&gt;&lt;span lang="EN-ZW"&gt; project if you wish to see more about how to use this technique in your own code. Hope this helps, and happy coding.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=482299" width="1" height="1"&gt;</content><author><name>fabulous</name><uri>http://bloggingabout.net/members/fabulous/default.aspx</uri></author><category term=".NET" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/.NET/default.aspx" /><category term="Delegates" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/Delegates/default.aspx" /><category term="Lambda Expressions" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/Lambda+Expressions/default.aspx" /></entry><entry><title>Design patterns – easy ways to improve code quality</title><link rel="alternate" type="text/html" href="/blogs/fadzai/archive/2009/10/05/design-patterns-easy-ways-to-improve-code-quality.aspx" /><id>/blogs/fadzai/archive/2009/10/05/design-patterns-easy-ways-to-improve-code-quality.aspx</id><published>2009-10-05T16:33:00Z</published><updated>2009-10-05T16:33:00Z</updated><content type="html">&lt;p&gt;&lt;span style="font-size:medium;"&gt;I have spent the last couple of weeks going over an application I wrote 5 years ago, (the one I referred to &lt;/span&gt;&lt;a target="_blank" href="http://bloggingabout.net/blogs/fadzai/archive/2009/08/31/garbage-collection-for-newbies.aspx" title="Restaurant analogy of how the GC works"&gt;&lt;span style="font-size:medium;"&gt;in&amp;nbsp;my garbage collection blog&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:medium;"&gt;. There is nothing wrong with this application but I wanted to review some of the decisions I made then in light of what I know now so that I can see how far I&amp;#39;ve come and how I can make it perform better, because I know I definitely should have learnt enough about performance in the 5 years since to improve on it.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;
&lt;span style="font-size:medium;"&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:small;"&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:medium;"&gt;The reason I picked this particular application is that it was my first production application in .NET (started in April 2004, though I&amp;#39;d been using .NET since August/September 2003 &amp;ndash; can&amp;#39;t quite remember). It turns out that this application was a key stepping stone in my .NET education as I learned quite, not just about .NET. A note that I included in the code there is about patterns. Before starting on this project, I, like many people I still meet, knew very little about design and code patterns. My journey into studying patterns started when after the first release, I was reviewing some of the requirements against how the users used the system.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:medium;"&gt;One particular requirement kept gnawing at me. There was some data that had to be cached for regular access by the users and they didn&amp;rsquo;t have to wait for it. Customers could walk in and ask random questions and the user&amp;#39;s had to be on hand to answer these quickly to serve the next one in line. Different parts of the system itself had to refer to some of this info regularly based on customer activity on the hardware mentioned in the GC blog, and feedback had to be provided to the customer immediately by way of an LCD device.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:medium;"&gt;Following the instructions in the design spec, I loaded this info upfront so that by the time the user was presented with the UI, the data would be available. After the first few days of watching users in different roles interact with this software, I realized that not all roles needed all the information as the spec had said. Also, some of the information could be first required late in the day. This meant that I was loading and holding on to information that may never be used in the context of a particular user. I began thinking about how to deal with this.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:medium;"&gt;Some of this data I stored in simple collections, and the rest in datasets. I used datasets a lot in this application because a lot of the users would need the data displayed in a grid with a mechanism to filter it, and the only way I could filter stuff at in memory without using a refined database search at the time was using a DataView against a dataset/datatable. I re-wrote the custom collections to inherit from a base class that I wrote that served as a cache with a sliding timeout period. The client code would no longer search the database and populate the collections, but would just go to the collections for the info they required.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:medium;"&gt;My client provided telecommunication services to their customers and there was a need to provide international dial codes to allow the customers to make pre-paid calls to different parts of the world. Some roles however did not need this information at all, or would only need it for when making a report, which could be once a week, or once a month. The initial strategy would get the data as soon as the application started in Sub Main (void Main() for C# developers). After a little refactoring, the startup code created empty instances of the collections. This data was then loaded the first time any client code referred to it and for the data that wouldn&amp;#39;t be accessed the entire day, the sliding timeout would then be activated at this point, and would be moved forward 10 minutes at each access.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-size:medium;"&gt;I called this the &amp;quot;Delayed Reading Strategy&amp;quot;, and in a discussion with someone from Ukraine I &lt;/span&gt;&lt;i&gt;&lt;span style="font-size:medium;"&gt;met&lt;/span&gt;&lt;/i&gt;&lt;span style="font-size:medium;"&gt; on a programmer&amp;#39;s forum, I described this. He then gave me a link to what is now a vital resource for me, the Microsoft Patterns and Practices team website. I discovered this was known as the lazy-load pattern and through some reading material I found on MSDN, and other places, I learned a lot of patters that I used to improve the performance of this application. The result was that after about two weeks of use, users suddenly experience faster start up time because nothing was loaded until it was first needed. Other applications worked better when this application was running now because it required less memory. Anything it didn&amp;rsquo;t access or refer to in 10 minutes would be disposed to free the RAM.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:medium;"&gt;There were also two tables whose runtime collections were indeterministic. There was never a time I would need to load all the rows, neither would there be a need to say get me all the rows where such a field was equal to blah. The collections would be created based on user and customer activity against specific rows in the table. The corresponding collection would then build itself by adding any row/object to the internal list whenever it was referred to specifically.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:medium;"&gt;I now do a lot of mentoring to students and interns in some companies and find that a lot of them are unaware of code patterns. One thing I tell them when introducing them is that this is a very easy way, and very important way of reducing the bug-count of an application because you can approach problems in a predictable way. I&amp;#39;ve seen some weird code over the years to implement things like the singleton pattern, software factories and extensibility, all because the programmers were not aware of design and code patterns.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:small;"&gt;&lt;span style="font-size:medium;"&gt;A year later when I decided to specialize in integrating systems, I started to study integration patterns and there is a good e-book available from the patterns and practices team called Integration Patterns, &lt;a target="_blank" title="Integration Patterns book on Amazon" href="http://www.amazon.com/Integration-Patterns-Practices-Microsoft-Corporation/dp/073561850X/ref=sr_1_1?ie=UTF8&amp;amp;qid=1255262283&amp;amp;sr=8-1"&gt;ISBN&amp;nbsp;&lt;/a&gt;&lt;/span&gt;&lt;span style="font-size:medium;"&gt;&lt;a target="_blank" title="Integration Patterns book on Amazon" href="http://www.amazon.com/Integration-Patterns-Practices-Microsoft-Corporation/dp/073561850X/ref=sr_1_1?ie=UTF8&amp;amp;qid=1255262283&amp;amp;sr=8-1"&gt;0-7356-1850-X&lt;/a&gt;. I found this book very valuable and instrumental flattening my learning curve. If anyone out there hasn&amp;#39;t venture into patterns, or hasn&amp;#39;t heard of them, head over to the Patterns and Practices team site, or download some of their screencasts and you will be amazed at what you learn. This is a topic on which there is a lot of materials so I will not post examples right now but I am currently finishing off a few articles to post over the next couple of weeks that touch on some basic and some not so basic patterns to get people started on patterns.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:medium;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:small;"&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size:medium;"&gt;Conclusion&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:medium;"&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size:medium;"&gt;In conclusion I will point out what I can do to improve my application. Having been performance conscious even back then, the main thing I can do is to change some of DataSet code to use other structures, like Custom Collections. There are other ways I now know to filter through a collection in .NET without the overhead of hanging on to a DataSet. My next blog will be covering some of these ways, which include using predicates with Lambda Expressions or full blown methods satisfying the Delegate signature against an IEnumerable(Of T)/IEnumerable&amp;lt;T&amp;gt; collection. I will also write about the biggest problem I faced once the service this application was providing became popular and it had a heavy load I couldn&amp;#39;t simulate on my development machine. Happy coding.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=482261" width="1" height="1"&gt;</content><author><name>fabulous</name><uri>http://bloggingabout.net/members/fabulous/default.aspx</uri></author><category term="Patterns" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/Patterns/default.aspx" /><category term="Coding regulations" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/Coding+regulations/default.aspx" /></entry><entry><title>Garbage Collection for Newbies</title><link rel="alternate" type="text/html" href="/blogs/fadzai/archive/2009/08/31/garbage-collection-for-newbies.aspx" /><id>/blogs/fadzai/archive/2009/08/31/garbage-collection-for-newbies.aspx</id><published>2009-08-31T15:51:00Z</published><updated>2009-08-31T15:51:00Z</updated><content type="html">&lt;p&gt;A simple explanation of the garbage collector for beginners, and those who don&amp;#39;t get &amp;quot;when we use this GC thing&amp;quot;.&lt;/p&gt;...(&lt;a href="http://bloggingabout.net/blogs/fadzai/archive/2009/08/31/garbage-collection-for-newbies.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=482142" width="1" height="1"&gt;</content><author><name>fabulous</name><uri>http://bloggingabout.net/members/fabulous/default.aspx</uri></author><category term="Garbage Collection" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/Garbage+Collection/default.aspx" /><category term=".NET" scheme="http://bloggingabout.net/blogs/fadzai/archive/tags/.NET/default.aspx" /></entry></feed>