<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Erik's Misadventures on BizTalk, .NET and Life</title>
        <link>http://geekswithblogs.net/Erik/Default.aspx</link>
        <description> [ vb .. C# .. F# ]  |&gt; List.filter(fun lang -&gt; isBothElegantAndPowerful lang) </description>
        <language>en-US</language>
        <copyright>Erik Araojo</copyright>
        <managingEditor>erik_araojo@yahoo.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <image>
            <title>Erik's Misadventures on BizTalk, .NET and Life</title>
            <url>http://geekswithblogs.net/images/RSS2Image.gif</url>
            <link>http://geekswithblogs.net/Erik/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <item>
            <title>Observer Pattern in F# : Simplified/Enhanced</title>
            <link>http://geekswithblogs.net/Erik/archive/2008/05/22/122302.aspx</link>
            <description>&lt;p&gt;One of the commonly used design pattern is the &lt;strong&gt;Observer Pattern&lt;/strong&gt; because its just so easy to use and implement.  The classic OO way of implementing it is to have a Subject class having the methods "Attach", "Detach"  and "Notify". The Subject class usually stores the observers in an ArrayList and then when it needs to update the observers then iterates on the list and invokes the "Update" method of each observer. See diagram below.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://dofactory.com/Patterns/Diagrams/observer.gif"&gt;&lt;img alt="Classic Observer Pattern" src="http://dofactory.com/Patterns/Diagrams/observer.gif" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;In C#, a more elegant way of implementing this is with &lt;strong&gt;Events and Delegates&lt;/strong&gt;.  Here's a nice &lt;a href="http://spellcoder.com/blogs/bashmohandes/archive/2007/03/10/6212.aspx"&gt;sample&lt;/a&gt; implementation.  By using using events and delegates, the code became a lot shorter and straight-forward &lt;/p&gt;
&lt;p&gt;In F#, implementation of the observer pattern became even more concise and elegant.  How come? Take a look at the code below.&lt;/p&gt;
&lt;p&gt;&lt;u&gt;&lt;font color="#333399"&gt;line 11&lt;/font&gt;&lt;/u&gt; : A clean and simple (&lt;strong&gt;one-liner!&lt;/strong&gt;) way of creating events and triggers.  A call to IEvent.create is all it takes&lt;/p&gt;
&lt;p&gt;&lt;font color="#333399"&gt;&lt;u&gt;lines 16 &amp;amp; 17&lt;/u&gt; &lt;/font&gt;: calling "trigger" and passing the correct parameters notifies all listeners of the changeEvent.  We don't even need to check if there are listeners attached. If this is in C# we need to make &lt;em&gt;changeEvent  != null&lt;/em&gt; otherwise a NullReferenceException will be raised.&lt;/p&gt;
&lt;p&gt;&lt;font color="#333399"&gt;&lt;u&gt;lines 28 &amp;amp; 30&lt;/u&gt;.&lt;/font&gt;  In F# Events are &lt;strong&gt;first-class values &lt;/strong&gt;, that means we can pass it around and more importantly we can do all sorts of wonderful things with it using the IEvent module.  For example,  in line 28, we filtered the event, basically saying that we are only interested in events of the &lt;em&gt;Remove&lt;/em&gt; operation.  Now imagine if the Operation type (an enum actually, lines 5-7 ) contains more items such as Update, Delete, AddedThenRemoved, AddedThenUpdated, RemovedAddedAgainThenFinallyUpdated ... (you get what I mean).  If we want to a handle only the Remove operation then we'd have no choice but to break it down using an if-elseif-else or switch-case construct.  It would work but its not going to be pretty.  And this is where &lt;em&gt;IEvent.filter&lt;/em&gt; shines. With just a single line of code (line 28, please ignore the comment above it.), we were able to filter out the event that we are only interested in. Apart from filtering, IEvent also allows us to map, partition, fold, split etc. events.&lt;/p&gt;
&lt;p&gt;&lt;u&gt;&lt;font color="#333399"&gt;lines 25 &amp;amp; 30&lt;/font&gt;&lt;/u&gt; : 2 ways of attaching to an Event.  I'm not very sure what's the difference between these 2. (TODO : Investigate)&lt;/p&gt;
&lt;p&gt;&lt;img height="564" alt="F# Observer Pattern Code" width="622" src="/images/geekswithblogs_net/Erik/fsharpOberserverPatern.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;Here's the output! Notice that the "observerForRemove" printed out only the message related to the Remove operation even though the Subject class raised 2 events (one for Add, another one for Remove) in the Notify() method at line 15.  Sweet.&lt;/p&gt;
&lt;p&gt;&lt;img height="138" alt="output" width="613" src="/images/geekswithblogs_net/Erik/fsharpOberserverPaternOutput.PNG" /&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=122302"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=122302" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Erik/aggbug/122302.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Erik Araojo</dc:creator>
            <guid>http://geekswithblogs.net/Erik/archive/2008/05/22/122302.aspx</guid>
            <pubDate>Thu, 22 May 2008 07:36:52 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Erik/comments/122302.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Erik/archive/2008/05/22/122302.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/Erik/comments/commentRss/122302.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Erik/services/trackbacks/122302.aspx</trackback:ping>
        </item>
        <item>
            <title>SoapBits is now open source!</title>
            <link>http://geekswithblogs.net/Erik/archive/2008/05/10/122038.aspx</link>
            <description>To everyone who've either sent me an email  or posted a comment asking whether &lt;a href="http://geekswithblogs.net/Erik/archive/2007/09/01/115109.aspx"&gt;SoapBits &lt;/a&gt;can be made into an open source project, well here I am pleased to let you all know that finally it has happened! &lt;br /&gt;
&lt;br /&gt;
SoapBits is now open source and is available at codeplex!&lt;br /&gt;
&lt;br /&gt;
In line with this change, it have given it a new name,&lt;span style="font-weight: bold;"&gt;STORM&lt;/span&gt;. (I meant "STORM"  to be an acronym but I can only come up with &lt;span style="font-weight: bold;"&gt;S&lt;/span&gt;oap &lt;span style="font-weight: bold;"&gt;T&lt;/span&gt;esting for "ST" .  The "ORM"  part I have yet to figure out, so please do suggest if you think of a clever meaning. ;)  )  Another major change is that the tool is now written &lt;span style="font-style: italic;"&gt;mostly&lt;/span&gt; in &lt;span style="font-weight: bold;"&gt;F#&lt;/span&gt;, a language which I believe is a lot more expressive and powerful than C# because of the ease with which it has combined Object Oriented and Functional programming. The user interface part though is still written in C# mainly because F# is not yet fully integrated into Visual Studio.&lt;br /&gt;
&lt;br /&gt;
STORM site : &lt;a href="http://codeplex.com/storm"&gt;http://codeplex.com/storm&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
As you all can see below, the UI has also changed a bit but the old functionalities are still there&lt;br /&gt;
&lt;br /&gt;
&lt;img src="http://www.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=storm&amp;amp;DownloadId=34052" alt="" /&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Enjoy the tool everyone! And don't forget to give back and contribute to the project.&lt;br /&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=122038"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=122038" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Erik/aggbug/122038.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Erik Araojo</dc:creator>
            <guid>http://geekswithblogs.net/Erik/archive/2008/05/10/122038.aspx</guid>
            <pubDate>Sat, 10 May 2008 15:12:25 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Erik/comments/122038.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Erik/archive/2008/05/10/122038.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/Erik/comments/commentRss/122038.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Erik/services/trackbacks/122038.aspx</trackback:ping>
        </item>
        <item>
            <title>String.Replace() in XSLT</title>
            <link>http://geekswithblogs.net/Erik/archive/2008/04/01/120915.aspx</link>
            <description>&lt;p&gt;Here's a sample template that lets you have the String.Replace() functionality in XSLT 1.0.   The template "string-replace-all" takes 3 parameters and recursively processes the input text string.&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;     text         : main string &lt;/li&gt;
    &lt;li&gt;     replace : the string fragment to be replaced &lt;/li&gt;
    &lt;li&gt;    by           :  the replacement string  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;img height="350" alt="" width="610" src="/images/geekswithblogs_net/Erik/xsl-str-replace.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;Here's how it is called:  &lt;/p&gt;
&lt;p&gt;&lt;img height="162" alt="" width="667" src="/images/geekswithblogs_net/Erik/xsl-str-replaceCalling.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;The resulting value of $myVar after {ReplaceMe} is replaced is &lt;em&gt;&lt;strong&gt;"This is a sample text : &lt;font style="BACKGROUND-COLOR: #ccffcc"&gt;String.Replace() in XSLT&lt;/font&gt; and &lt;font style="BACKGROUND-COLOR: #ccffcc"&gt;String.Replace() in XSLT&lt;/font&gt;"&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;For those who are not familiar with XSLT syntax and here's the C# equivalent.  An excellent material for the &lt;a href="http://thedailywtf.com"&gt;thedailywtf!&lt;/a&gt; :)&lt;/p&gt;
&lt;p&gt;&lt;img height="177" alt="" width="727" src="/images/geekswithblogs_net/Erik/xsl-str-replaceCallingCSharpTWF.PNG" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt; (Note: I'm not so sure, but I think in XSL 2.0 there is already a built-in replace function on strings)&lt;/em&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=120915"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=120915" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Erik/aggbug/120915.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Erik Araojo</dc:creator>
            <guid>http://geekswithblogs.net/Erik/archive/2008/04/01/120915.aspx</guid>
            <pubDate>Tue, 01 Apr 2008 12:36:09 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Erik/comments/120915.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Erik/archive/2008/04/01/120915.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/Erik/comments/commentRss/120915.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Erik/services/trackbacks/120915.aspx</trackback:ping>
        </item>
        <item>
            <title>F# Solution (By Factorization) : Project Euler Problems 5</title>
            <link>http://geekswithblogs.net/Erik/archive/2008/02/19/119734.aspx</link>
            <description>&lt;p&gt;&lt;strong&gt;&lt;u&gt;Problem&lt;/u&gt;&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&lt;em&gt; 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;What is the smallest number that is &lt;dfn title="divisible with no remainder"&gt;evenly divisible&lt;/dfn&gt; by all of the numbers from 1 to 20?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;u&gt;Solution:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Finding the LCM can be done via factorization.  Below is an excerpt from the wikipedia article.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;The &lt;a title="Fundamental theorem of arithmetic" href="http://en.wikipedia.org/wiki/Fundamental_theorem_of_arithmetic"&gt;unique factorization theorem&lt;/a&gt; says that every positive integer number greater than 1 can be written in only one way as a product of &lt;a title="Prime number" href="http://en.wikipedia.org/wiki/Prime_number"&gt;prime numbers&lt;/a&gt;. The prime numbers can be considered as the atomic elements which, when combined together, make up a &lt;a title="Composite number" href="http://en.wikipedia.org/wiki/Composite_number"&gt;composite number&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;dl&gt;&lt;dd&gt;&lt;img class="tex" alt="90 = 2^1 \cdot 3^2 \cdot 5^1 = 2 \cdot 9 \cdot 5. \,\!" src="http://upload.wikimedia.org/math/e/b/c/ebc4693ad71eeca52e4700c6d627385b.png" /&gt; &lt;/dd&gt;&lt;/dl&gt;
&lt;p&gt;Here we have the composite number 90 made up of one atom of the prime number &lt;strong&gt;2&lt;/strong&gt;, two atoms of the prime number &lt;strong&gt;3&lt;/strong&gt; and one atom of the prime number &lt;strong&gt;5&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;This knowledge can be used to find the lcm of a set of numbers.&lt;/p&gt;
&lt;p&gt;Example: Find the value of lcm(8,9,21).&lt;/p&gt;
&lt;p&gt;First, factor out each number and express it as a product of prime number &lt;a class="mw-redirect" title="Power (mathematics)" href="http://en.wikipedia.org/wiki/Power_%28mathematics%29"&gt;powers&lt;/a&gt;.&lt;/p&gt;
&lt;dl&gt;&lt;dd&gt;&lt;img class="tex" alt="8\; \, \; \,= 2^3 \cdot 3^0 \cdot 5^0 \cdot 7^0 \,\!" src="http://upload.wikimedia.org/math/5/9/7/597afba824704eb2657be1ceb07952a5.png" /&gt; &lt;/dd&gt;&lt;dd&gt;&lt;img class="tex" alt="9\; \, \; \,= 2^0 \cdot 3^2 \cdot 5^0 \cdot 7^0 \,\!" src="http://upload.wikimedia.org/math/8/1/2/8129b6f619af1cb23f83f569a33159e1.png" /&gt; &lt;/dd&gt;&lt;dd&gt;&lt;img class="tex" alt="21\; \,= 2^0 \cdot 3^1 \cdot 5^0 \cdot 7^1. \,\!" src="http://upload.wikimedia.org/math/2/8/6/286e62edc6d8e5f63a6480f0d16a2b68.png" /&gt; &lt;/dd&gt;&lt;/dl&gt;
&lt;p&gt;The lcm will be the product of multiplying the highest power in each prime factor category together. Out of the 4 prime factor categories 2, 3, 5, and 7, the highest powers from each are 2&lt;sup&gt;3&lt;/sup&gt;, 3&lt;sup&gt;2&lt;/sup&gt;, 5&lt;sup&gt;0&lt;/sup&gt;, and 7&lt;sup&gt;1&lt;/sup&gt;. Thus,&lt;/p&gt;
&lt;dl&gt;&lt;dd&gt;&lt;img class="tex" alt="\operatorname{lcm}(8,9,21) = 2^3 \cdot 3^2 \cdot 5^0 \cdot 7^1 = 8 \cdot 9 \cdot 1 \cdot 7 = 504. \,\!" src="http://upload.wikimedia.org/math/b/4/7/b47946164dbb6cb560b13571f9adfa5c.png" /&gt; &lt;/dd&gt;&lt;/dl&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;strong&gt;Code:&lt;/strong&gt;&lt;/p&gt;
&lt;div style="OVERFLOW: auto; WIDTH: 600px; HEIGHT: 600px; BACKGROUND-COLOR: #ffffcc"&gt;  module Prob5 = begin &lt;br /&gt;
  open System&lt;br /&gt;
  open Microsoft.FSharp.Math&lt;br /&gt;
  &lt;br /&gt;
  let primeFactors (num:float) =&lt;br /&gt;
    //let num = 50.0&lt;br /&gt;
    let divSeq = num |&amp;gt; Seq.unfold (fun x -&amp;gt;&lt;br /&gt;
      let rec get num2  =&lt;br /&gt;
        let sq = Math.Sqrt (num2)&lt;br /&gt;
        let div = ref 2.0 &lt;br /&gt;
        while( (not(num2 % !div = 0.0)) &amp;amp;&amp;amp; (!div &amp;lt; sq) ) do&lt;br /&gt;
          if (!div = 2.0) then&lt;br /&gt;
            div  := !div + 1.0&lt;br /&gt;
          else&lt;br /&gt;
            div  := !div + 2.0&lt;br /&gt;
        div&lt;br /&gt;
               let sq = Math.Sqrt (x) &lt;br /&gt;
      let divisor = get x &lt;br /&gt;
             if (x = 1.0) then&lt;br /&gt;
         None&lt;br /&gt;
      else if (sq &amp;lt; !divisor) then&lt;br /&gt;
        Some (x, 1.0)  // x is prime!&lt;br /&gt;
      else&lt;br /&gt;
        Some(!divisor, x/(!divisor))&lt;br /&gt;
      )&lt;br /&gt;
           divSeq&lt;br /&gt;
       let pFactors = (2,20) |&amp;gt; Seq.unfold (fun (x,limit) -&amp;gt; &lt;br /&gt;
    let y = float_of_int x&lt;br /&gt;
    let s =  (primeFactors y) |&amp;gt; Seq.map (fun x -&amp;gt; Convert.ToInt32(x))&lt;br /&gt;
           if x &amp;lt;=limit then &lt;br /&gt;
      Some ( (x,s), (x+1, limit))&lt;br /&gt;
    else&lt;br /&gt;
      None&lt;br /&gt;
    )&lt;br /&gt;
    &lt;br /&gt;
  let factorSort x y = &lt;br /&gt;
    let (num1, _) = x&lt;br /&gt;
    let (num2,_) = y&lt;br /&gt;
      &lt;br /&gt;
    if (num1 &amp;lt; num2)  then&lt;br /&gt;
      -1&lt;br /&gt;
    else if num1 &amp;gt; num2 then&lt;br /&gt;
      1&lt;br /&gt;
    else&lt;br /&gt;
      0&lt;br /&gt;
       let powSort x y = &lt;br /&gt;
    let (_,num1) = x&lt;br /&gt;
    let (_,num2) = y&lt;br /&gt;
    &lt;br /&gt;
    if num1 &amp;lt; num2 then&lt;br /&gt;
      1&lt;br /&gt;
    else if num1 &amp;gt; num2 then       -1&lt;br /&gt;
    else&lt;br /&gt;
      0&lt;br /&gt;
     &lt;br /&gt;
    &lt;br /&gt;
  let all =   pFactors |&amp;gt; Seq.map (fun (num,s) -&amp;gt; s |&amp;gt;  Seq.countBy (fun x -&amp;gt; x ) )  |&amp;gt; Seq.concat&lt;br /&gt;
  let allList =  (Seq.to_list all) |&amp;gt; List.sort factorSort |&amp;gt; List.sort powSort&lt;br /&gt;
    &lt;br /&gt;
  let a = ref 0&lt;br /&gt;
  let b = ref 0&lt;br /&gt;
  let filtered = allList |&amp;gt; List.filter (fun (x,y) -&amp;gt; &lt;br /&gt;
          let (factor,pow) = allList |&amp;gt;  List.find (fun (r,s) -&amp;gt; r=x ) &lt;br /&gt;
            &lt;br /&gt;
          if (factor = x ) &amp;amp;&amp;amp; (pow = y) &amp;amp;&amp;amp; ( (!a &amp;lt;&amp;gt; x) || (!b &amp;lt;&amp;gt; y) ) then&lt;br /&gt;
            a := factor&lt;br /&gt;
            b := pow          &lt;br /&gt;
            true&lt;br /&gt;
          else&lt;br /&gt;
            false&lt;br /&gt;
        &lt;br /&gt;
      )&lt;br /&gt;
      &lt;br /&gt;
  let main() =&lt;br /&gt;
    let lcm = filtered |&amp;gt; List.fold_left (fun a (x,y) -&amp;gt; a * Math.Pow(float_of_int x, float_of_int y ) ) 1.0&lt;br /&gt;
    printfn "\n\nLCM = %f" lcm&lt;br /&gt;
    &lt;br /&gt;
  end&lt;br /&gt;
&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;My solution for this one follows the steps outlined in the wikipedia excerpt above. It is a bit long but essentially it can be broken down into the following stages...&lt;/p&gt;
&lt;p&gt;1 - &lt;strong&gt;Factor out the number 1 to 20.&lt;/strong&gt;   &lt;/p&gt;
&lt;p&gt;      This is done on function &lt;em&gt;pFactors.  pFactors &lt;/em&gt;outputs a sequenct of tuples wherein the first value is the number being factored while the second value is a sequence of its prime factors. For example, the output of this function when applied to the numbers 2 to 20&lt;/p&gt;
&lt;p&gt;      { (2, {2}); (3, {3}; (4, {2;2}) ; (5, {5}) ...,&amp;lt;snip&amp;gt; .. (12, {2;2;3}) ...&amp;lt;snip&amp;gt; .. (20, {2;2;5})       }  &lt;/p&gt;
&lt;p&gt;    type : seq&amp;lt; int * seq&amp;lt;int&amp;gt;&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2 - Count the number of occurrences of each prime factor and consolidate into just one sequence&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;    This is done on line  &lt;font color="#0000ff" size="2"&gt;let&lt;/font&gt;&lt;font size="2"&gt; all = pFactors |&amp;gt; Seq.map (&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;fun&lt;/font&gt;&lt;font size="2"&gt; (num,s) &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;-&amp;gt;&lt;/font&gt;&lt;font size="2"&gt; s |&amp;gt; Seq.countBy (&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;fun&lt;/font&gt;&lt;font size="2"&gt; x &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;-&amp;gt;&lt;/font&gt;&lt;font size="2"&gt; x ) ) |&amp;gt; Seq.concat&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;   Seq.countBy counts the number of occurences of an item in a sequence.  For example, if we apply to the sequence of prime factors of the number 20, the output will be&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;   (20, {2;2;5} ) -&amp;gt; (2,2),(5,1) : where the 2nd value of the tuple is the number of occurences&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;   So for the number 2 to 20 the output is&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font face="Arial"&gt;  (2, 1)(3, 1)(2, 2)(5, 1)(2, 1)(3, 1)(7, 1)(2, 3)(3, 2)(2, 1)(5, 1)(11, 1)(2, 2)(3, 1)(13, 1)(2, 1)(7, 1)(3, 1)(5, 1)(2, 4)(17, 1)  &lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font face="Arial"&gt;  (2, 1)(3, 2)(19, 1)(2, 2)(5, 1)&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;  type : seq&amp;lt;int * int &amp;gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;3 - Sort the output of stage 2.&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;    &lt;/strong&gt;The output of stage 2 obviously contains duplicates.  Referring back to the wikipedia excerpt above, what we need only are those factors with the highest power (or most number of occurences).  So in order for us to identify those factors, first we sort the sequence.  This is done on line &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;         &lt;font color="#0000ff" size="2"&gt;let&lt;/font&gt;&lt;font size="2"&gt; allList = (Seq.to_list all) |&amp;gt; List.sort factorSort |&amp;gt; List.sort powSort&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font size="2"&gt;     The output (though a bit confusing) guarantees that the for any number, the one with the highest number of occurences comes out on top.  For example (2,4) is on top of all the other tuple entries with first value of 2. And so is (3,2) for tuple values with first value of 3.&lt;/font&gt;&lt;/font&gt;&lt;font face="Arial"&gt;                        &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;                         (2, 4)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(2, 3)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(2, 2)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(2, 2)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(2, 2)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(3, 2)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(3, 2)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(2, 1)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(2, 1)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(2, 1)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(2, 1)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(2, 1)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(3, 1)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(3, 1)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(3, 1)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(3, 1)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(5, 1)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(5, 1)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(5, 1)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(5, 1)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(7, 1)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(7, 1)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(11, 1)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(13, 1)&lt;br /&gt;
&lt;font face="Arial"&gt;                         &lt;/font&gt;(17, 1)&lt;br /&gt;
&lt;font face="Arial"&gt;&lt;font face="Arial"&gt;                         &lt;/font&gt; &lt;/font&gt;(19, 1)&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;             type : seq&amp;lt;int * int&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;4.  Filter the resulting sequence of stage 3 and take only those with the highest 2nd element.&lt;/strong&gt;  This is done on line&lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;   let &lt;font color="#0000ff" size="2"&gt;&lt;/font&gt;&lt;font size="2"&gt;filtered = allList |&amp;gt; List.filter (&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;fun&lt;/font&gt;&lt;font size="2"&gt; (x,y) &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;-&amp;gt; ...&lt;/font&gt;&lt;font size="2"&gt;  &amp;lt;snip&amp;gt;...&lt;/font&gt; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#000000"&gt;     output is :  seq&amp;lt;int*int&amp;gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#000000"&gt;                   &lt;/font&gt;&lt;font face="Arial" color="#000000"&gt;(2, 4)&lt;br /&gt;
                   (3, 2)&lt;br /&gt;
                   (5, 1)&lt;br /&gt;
                   (7, 1)&lt;br /&gt;
                   (11, 1)&lt;br /&gt;
                   (13, 1)&lt;br /&gt;
                   (17, 1)&lt;br /&gt;
                   (19, 1)&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#000000"&gt;5.&lt;/font&gt; &lt;font color="#000000"&gt;And finally we can compute the LCM.  This is done on the line&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font color="#000000"&gt;   let&lt;/font&gt; &lt;font color="#0000ff" size="2"&gt;&lt;/font&gt;&lt;font size="2"&gt;lcm = filtered |&amp;gt; List.fold_left (&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;fun&lt;/font&gt;&lt;font size="2"&gt; a (x,y) &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;-&amp;gt;&lt;/font&gt;&lt;font size="2"&gt; a * Math.Pow(float_of_int x, float_of_int y ) ) 1.0&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt;Total execution time on my machine is &lt;strong&gt;0.17 seconds&lt;/strong&gt;  which a great improvement from the &lt;strong&gt;25 seconds&lt;/strong&gt; using the brute force approach described &lt;/font&gt;&lt;a href="http://www.fsharp.it/2008/02/07/project-euler-in-f-problem-5/"&gt;here&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=119734"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=119734" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Erik/aggbug/119734.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Erik Araojo</dc:creator>
            <guid>http://geekswithblogs.net/Erik/archive/2008/02/19/119734.aspx</guid>
            <pubDate>Mon, 18 Feb 2008 17:15:57 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Erik/comments/119734.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Erik/archive/2008/02/19/119734.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/Erik/comments/commentRss/119734.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Erik/services/trackbacks/119734.aspx</trackback:ping>
        </item>
        <item>
            <title>F# Solution : Project Euler Problems 4 &amp; 6</title>
            <link>http://geekswithblogs.net/Erik/archive/2008/02/18/119727.aspx</link>
            <description>&lt;p&gt;These 2 problems have very short solutions so I'll put them together &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;u&gt;Problem 3:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Find the largest palindrome made from the product of two 3-digit numbers.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;div style="OVERFLOW: auto; WIDTH: 600px; HEIGHT: 200px; BACKGROUND-COLOR: #ffffcc"&gt;  let prodOf3digit = &lt;br /&gt;
     (100,100) |&amp;gt; Seq.unfold (fun (x,y) -&amp;gt; &lt;br /&gt;
             match y with &lt;br /&gt;
             | y when y &amp;lt; 0 -&amp;gt; None&lt;br /&gt;
             | y when x &amp;lt;= 999-&amp;gt; &lt;br /&gt;
                  if (y &amp;lt;= 999) then&lt;br /&gt;
                    Some(x*y, (x,y+1))&lt;br /&gt;
                  else if (x+1) &amp;lt;= 999 then&lt;br /&gt;
                    Some ( (x+1)*(x+1), (x+1, x+2) )&lt;br /&gt;
                  else&lt;br /&gt;
                    None&lt;br /&gt;
             | y -&amp;gt; None )&lt;br /&gt;
     &lt;br /&gt;
           &lt;br /&gt;
  let palindromes = &lt;br /&gt;
   prodOf3digit &lt;br /&gt;
    |&amp;gt; Seq.filter (fun x -&amp;gt;&lt;br /&gt;
     let intStr = Int32.to_string x&lt;br /&gt;
     let rev (s:string) =&lt;br /&gt;
       let chunks =s.ToCharArray()&lt;br /&gt;
       let reversed = Array.rev chunks&lt;br /&gt;
       let r = new string(reversed)&lt;br /&gt;
       r&lt;br /&gt;
     let newNum = System.Convert.ToInt32 ( rev intStr )&lt;br /&gt;
      &lt;br /&gt;
     newNum = x &lt;br /&gt;
    )&lt;br /&gt;
let largest = &lt;br /&gt;
    palindromes |&amp;gt; Seq.fold (fun a x -&amp;gt; if x &amp;gt; a then x else a) 0 &lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;The problem asked for the largest palindrome of 3-digit numbers, hence the magic number 100 and 999.  The rest of the code is pretty much self-explanatory&lt;strong&gt;&lt;u&gt;.&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;u&gt;Problem 6:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;The sum of the squares of the first ten natural numbers is,&lt;/em&gt;&lt;em&gt;1&lt;sup&gt;2 &lt;/sup&gt;+ 2&lt;sup&gt;2 &lt;/sup&gt; + ... + 10&lt;sup&gt;2 &lt;/sup&gt;= 385&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;The square of the sum of the first ten natural numbers is, &lt;/em&gt;&lt;em&gt;(1 + 2 + ... + 10)&lt;sup&gt;2 &lt;/sup&gt; = 55&lt;sup&gt;2 &lt;/sup&gt;= 3025&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 − 385 = 2640.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div style="OVERFLOW: auto; WIDTH: 600px; HEIGHT: 150px; BACKGROUND-COLOR: #ffffcc"&gt;let sumOfSq (n:bigint) =&lt;br /&gt;
   let rec getSum (x:bigint) =&lt;br /&gt;
     match x with&lt;br /&gt;
     | x when x = 1I -&amp;gt; 1I&lt;br /&gt;
     | x -&amp;gt; x*x + getSum (x - 1I)&lt;br /&gt;
    getSum n&lt;br /&gt;
 &lt;br /&gt;
 let sqOfSum n =&lt;br /&gt;
   let s = [ 1I .. n ] |&amp;gt; Seq.fold (fun a x -&amp;gt; a+x) 0I&lt;br /&gt;
   s*s&lt;br /&gt;
   &lt;br /&gt;
 let main2() =&lt;br /&gt;
   let diff = (sqOfSum 100I) - (sumOfSq 100I) &lt;br /&gt;
   print_any diff&lt;br /&gt;
&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;To compute the sum of squares, I've decided to use recursion,  which apart from lists and sequences, is another workhorse of functional programming.   One thing to remeber when using recursion is to always make sure you cover the base case in order to avoid looping indefinitely.  In this case it is the line &lt;font size="2"&gt;x &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;when&lt;/font&gt;&lt;font size="2"&gt; x = 1I &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;-&amp;gt;&lt;/font&gt;&lt;font size="2"&gt; 1I&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;Because of the large resulting values, the type used was BigInt.&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=119727"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=119727" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Erik/aggbug/119727.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Erik Araojo</dc:creator>
            <guid>http://geekswithblogs.net/Erik/archive/2008/02/18/119727.aspx</guid>
            <pubDate>Mon, 18 Feb 2008 15:36:37 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Erik/comments/119727.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Erik/archive/2008/02/18/119727.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/Erik/comments/commentRss/119727.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Erik/services/trackbacks/119727.aspx</trackback:ping>
        </item>
        <item>
            <title>F# Solution : Project Euler Problems 1-3</title>
            <link>http://geekswithblogs.net/Erik/archive/2008/02/11/119454.aspx</link>
            <description>&lt;p&gt;&lt;strong&gt;&lt;u&gt;Problem 1 :&lt;/u&gt;&lt;/strong&gt;  &lt;/p&gt;
&lt;p&gt;&lt;font face="Arial"&gt;&lt;em&gt;If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. &lt;/em&gt;&lt;/font&gt;&lt;font face="Arial"&gt;&lt;em&gt;Find the sum of all the multiples of 3 or 5 below 1000.&lt;/em&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;u&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;/u&gt; :&lt;/p&gt;
&lt;div style="OVERFLOW: auto; WIDTH: 600px; HEIGHT: 50px; BACKGROUND-COLOR: #ffffcc"&gt;
&lt;p&gt;let mySeqP1 = [ 1 .. 999 ] |&amp;gt; Seq.filter (fun x -&amp;gt; ( (x % 5 = 0) || (x % 3 = 0)) ) |&amp;gt; Seq.fold(+) 0 &lt;br /&gt;
printfn "sum = %i" mySeqP1 &lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;&lt;u&gt;Problem 2:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt; &lt;/em&gt;&lt;font face="Arial"&gt;&lt;em&gt;Find the sum of all the even-valued terms in the Fibonacci sequence which do not exceed one million.&lt;/em&gt; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;u&gt;&lt;strong&gt;Solution :&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;
&lt;div style="OVERFLOW: auto; WIDTH: 600px; HEIGHT: 150px; BACKGROUND-COLOR: #ffffcc"&gt;
&lt;p&gt;let sumofEven =   (1,1) |&amp;gt; Seq.unfold (fun (x,y) -&amp;gt; &lt;br /&gt;
     match y with&lt;br /&gt;
     | y when y &amp;lt; 0 -&amp;gt; None&lt;br /&gt;
     | _ -&amp;gt; Some(y, (y, x+y)))&lt;br /&gt;
     |&amp;gt; Seq.filter ( fun x -&amp;gt;      x &amp;gt; 0 &amp;amp;&amp;amp; x &amp;lt; 1000000 &amp;amp;&amp;amp; (x % 2 = 0)) &lt;br /&gt;
     |&amp;gt; Seq.fold (+) 0&lt;br /&gt;
&lt;br /&gt;
   printfn "Sum of even = %i" sumofEven &lt;/p&gt;
&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;For this solution I had to put the guard statement "when y &amp;lt;  0" so that negative numbers won't be included in the generated sequence.  If that guard istatement s not there, negative numbers will be included when it goes over the maximum value of Int32.&lt;/p&gt;
&lt;p&gt; &lt;strong&gt;&lt;u&gt;Problem 3:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt; &lt;font face="Arial"&gt;Find the largest prime factor of 317584931803.&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;u&gt;Solution:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;div style="OVERFLOW: auto; WIDTH: 600px; HEIGHT: 470px; BACKGROUND-COLOR: #ffffcc"&gt;
&lt;p&gt;let primefactorsOf (num:float)=&lt;br /&gt;
    let divSeq = num |&amp;gt; Seq.unfold (fun x -&amp;gt;&lt;br /&gt;
      let rec get num2  =&lt;br /&gt;
        let sq = Math.Sqrt (num2)&lt;br /&gt;
        let div = ref 2.0 &lt;br /&gt;
        while( (not(num2 % !div = 0.0)) &amp;amp;&amp;amp; (!div &amp;lt; sq) ) do&lt;br /&gt;
          if (!div = 2.0) then&lt;br /&gt;
            div  := !div + 1.0&lt;br /&gt;
          else&lt;br /&gt;
            div  := !div + 2.0&lt;br /&gt;
        div&lt;br /&gt;
        &lt;br /&gt;
      let sq = Math.Sqrt (x) &lt;br /&gt;
      let divisor = get x &lt;br /&gt;
      &lt;br /&gt;
      if (Int32.of_float(x) = 1) then&lt;br /&gt;
         None&lt;br /&gt;
      else if (Int32.of_float( sq ) &amp;lt; Int32.of_float( !divisor )) then&lt;br /&gt;
        Some ( Int32.of_float( x ) , 1.0)  // x is prime!&lt;br /&gt;
      else&lt;br /&gt;
        Some(Int32.of_float !divisor, x/(!divisor))&lt;br /&gt;
      )&lt;br /&gt;
      &lt;br /&gt;
    divSeq&lt;br /&gt;
    &lt;br /&gt;
  let primefactors =  (primefactorsOf 317584931803.0)   &lt;br /&gt;
  &lt;br /&gt;
  let mainp3() = &lt;br /&gt;
    primefactors |&amp;gt; Seq.iter (fun x -&amp;gt; printfn "%i " x)&lt;br /&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;The function "&lt;strong&gt;primefactorsOf&lt;/strong&gt;" takes a number and returns a sequence containing the prime factors of that number.  The prime factors are determined using Trial Division.  This of course is not very fast for ver large numbers but is sufficient enough for &lt;font face="Arial"&gt;317584931803.0 &lt;/font&gt;If it's not clear why the square root of the number being factored out was used instead of directly using the number itself, the wikipedia article explaining Trial Division is &lt;a href="http://en.wikipedia.org/wiki/Trial_division"&gt;here&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;If you want to output only the largest primefactor you can just pass the value &lt;em&gt;primefactors&lt;/em&gt; to &lt;strong&gt;Seq.fold&lt;/strong&gt; like so&lt;/p&gt;
&lt;p&gt;&lt;font color="#0000ff" size="2"&gt;let&lt;/font&gt;&lt;font size="2"&gt; largestFactor = primefactors |&amp;gt; Seq.fold (&lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;fun&lt;/font&gt;&lt;font size="2"&gt; a x &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;-&amp;gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;if&lt;/font&gt;&lt;font size="2"&gt; x &amp;gt; a &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;then&lt;/font&gt;&lt;font size="2"&gt; x &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;else&lt;/font&gt;&lt;font size="2"&gt; a ) 0&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;Next time I'll post my solution to problems 4-6. &lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=119454"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=119454" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Erik/aggbug/119454.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Erik Araojo</dc:creator>
            <guid>http://geekswithblogs.net/Erik/archive/2008/02/11/119454.aspx</guid>
            <pubDate>Mon, 11 Feb 2008 15:58:38 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Erik/comments/119454.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Erik/archive/2008/02/11/119454.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/Erik/comments/commentRss/119454.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Erik/services/trackbacks/119454.aspx</trackback:ping>
        </item>
        <item>
            <title>F# Solution : Project Euler Problem 25</title>
            <link>http://geekswithblogs.net/Erik/archive/2008/01/18/118664.aspx</link>
            <description>&lt;p&gt;&lt;font face="Arial"&gt;&lt;font size="2"&gt;The Problem :  &lt;strong&gt;&lt;em&gt;What is the first term in the Fibonacci sequence to contain 1000 digits?&lt;/em&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;The sweet solution : &lt;/font&gt;&lt;/p&gt;
&lt;div style="OVERFLOW: auto; WIDTH: 600px; HEIGHT: 180px; BACKGROUND-COLOR: #ffffcc"&gt;
&lt;p&gt;&lt;font size="2"&gt;#light&lt;br /&gt;
&lt;br /&gt;
open System&lt;br /&gt;
&lt;br /&gt;
let fib = &lt;br /&gt;
   (1I,1I) |&amp;gt; Seq.unfold ( fun (sqEntry, acc) -&amp;gt; Some (acc, (acc, acc + sqEntry)) )&lt;br /&gt;
              |&amp;gt; Seq.filter (fun x -&amp;gt; x.ToString().Length = 1000) &lt;br /&gt;
              |&amp;gt; Seq.nth 0&lt;br /&gt;
&lt;br /&gt;
print_any fib&lt;br /&gt;
Console.ReadLine()&lt;br /&gt;
&lt;/font&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;ahh... such power and elegance....&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;Let me breakdown the solution&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;em&gt;(1I,1I) |&amp;gt; Seq.unfold ( fun (sqEntry, acc) -&amp;gt; Some (acc, (acc, acc + sqEntry)) )&lt;/em&gt; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;This line creates an &lt;strong&gt;inifinite&lt;/strong&gt; list of fibonacci numbers using Seq.unfold.  Let me say that again, it creates a in &lt;strong&gt;INFINITE&lt;/strong&gt; list.  How is that possible, you'd ask ? The reason is that F# performs &lt;em&gt;Lazy Evaluation&lt;/em&gt;. By that, I mean the program will perform only the computation it needs to do. So in our case, the program will actually compute only the parts of the list that it will need.   Here we used &lt;em&gt;&lt;strong&gt;Seq.unfold&lt;/strong&gt;&lt;/em&gt; to perform the computation.  The unfold function creates a list and uses an accumulator to maintain the state between computations.  The accumulator in this case is the tuple that contains the last 2 entries of the sequence&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;font size="2"&gt;Seq.filter( fun x -&amp;gt; x.ToString().Length = 1000&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;This line applies the filter function to the sequence.  This function returns a subset of the original list that matches the condition.  In this case, the resulting list will contain only those numbers that is made up 1000 digits.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;font size="2"&gt;Seq.nth 0&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;This line retrieves the nth element in the sequence.  Since the problem ask for the 1st term, naturally we retrieved the 0th element.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;And finally the construct that ties everything together and makes the code such a wonder to look at is the&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;font size="2"&gt;&lt;strong&gt;|&amp;gt;  &lt;/strong&gt;(the Pass-forward operator)&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;As its name implies, it passes forward the argument behind it to the function in front of it.  So the solution in essence means&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;font size="2"&gt;Pass the tuple (1I, 1I) to Seq.Unfold, then pass the resulting infinite list to Seq.filter, then pass the filtered list to Seq.nth which finally retrieves the 1st element!&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=118664"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=118664" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Erik/aggbug/118664.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Erik Araojo</dc:creator>
            <guid>http://geekswithblogs.net/Erik/archive/2008/01/18/118664.aspx</guid>
            <pubDate>Fri, 18 Jan 2008 09:24:03 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Erik/comments/118664.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Erik/archive/2008/01/18/118664.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/Erik/comments/commentRss/118664.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Erik/services/trackbacks/118664.aspx</trackback:ping>
        </item>
        <item>
            <title>Extracting Raw Schemas from BizTalk 2004 and 2006 Assemblies</title>
            <link>http://geekswithblogs.net/Erik/archive/2007/11/09/116734.aspx</link>
            <description>&lt;p&gt;When BizTalk compiles a project that contains a schema it generates a wrapper class for each schema.  Take for example the typical Biztalk Project below.  It contains a PropertySchema + 4 other schemas. &lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt; &lt;img height="118" alt="" width="161" src="/images/geekswithblogs_net/Erik/BtsSchemProj.jpg" /&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Compiling this project and opening it up with .NET Reflector, we'll get the following.  The important stuff to note from this are &lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;A class was generated for each schema (including the Property schema) &lt;/li&gt;
    &lt;li&gt;The generated classes inherit from "Microsoft.XLANGs.BaseTypes.SchemaBase" &lt;/li&gt;
    &lt;li&gt;(See Figure 2) SchemaBase has a property called "XmlContent" which is overriden by the generated class.  This property contains the raw schema string! &lt;/li&gt;
&lt;/ul&gt;
&lt;hr /&gt;
&lt;p align="center"&gt;&lt;img height="363" width="780" alt="" src="/images/geekswithblogs_net/Erik/BTsXsdLutz2.JPG" /&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;strong&gt;Figure 1.  Reflector output&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;img height="384" width="600" alt="" src="/images/geekswithblogs_net/Erik/BtzLutzProp.jpg" /&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;strong&gt;Figure 2. Properties Overriden by the Generated Class &lt;/strong&gt;&lt;/p&gt;
&lt;p align="left"&gt; &lt;/p&gt;&lt;hr /&gt;

&lt;p&gt; So to get the raw schema, all we need to do is open up the dll in .NET Reflector and do some copy-paste magic. :) But what if you have a huge schema project?  Extracting them all will be very painful (at least for me).   So being the kind of programmer that hates repetitive work,  and aside from the fact that I'm currently learning and loving F#, I hacked up this code to do everything automatically.  Here's the tool in action.  It creates the XSD files in the same folder where the tool was ran.&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt; &lt;img height="196" alt="" width="644" src="/images/geekswithblogs_net/Erik/btsxsd2.JPG" /&gt;&lt;/p&gt;
&lt;p align="left"&gt;&lt;/p&gt;&lt;hr /&gt;

&lt;p align="left"&gt;The tool can be downloaded &lt;a href="http://w15.easy-share.com/9631401.html"&gt;here&lt;/a&gt;.  (p.s. easy-share.com deletes the file if it has not been downloaded for within 30 days.  Just drop me an email if you want me to send the file directly)&lt;/p&gt;
&lt;p align="left"&gt;and here's the &lt;font style="BACKGROUND-COLOR: #ffff99"&gt;code&lt;/font&gt;  (How it works will be topic in a future post )&lt;/p&gt;
&lt;div style="OVERFLOW: auto; WIDTH: 500px; HEIGHT: 400px; BACKGROUND-COLOR: #ffff99"&gt;
&lt;p style="WHITE-SPACE: pre"&gt;#light
module BtXsd
open System
open System.Windows.Forms
open System.ComponentModel
open BtsXsdExtractorUI
open System.IO
open System.Reflection
open System.Text
open Microsoft.FSharp.Reflection
open Microsoft.FSharp.Core
open Microsoft.XLANGs.BaseTypes
let schemaPropertyName = "XmlContent"
let btsSchemas file =
if (not (String.IsNullOrEmpty(file))) then
let btsAssembly  = Assembly.LoadFile(file)
let types =  btsAssembly.GetTypes()
let schemabaseType = typeof&lt;schemabase&gt;&lt;/schemabase&gt;
let btsSchemaTypes = types |&amp;gt; Array.filter (fun x -&amp;gt; schemabaseType.IsAssignableFrom(x))
btsSchemaTypes
else
[||]
let rec generateFileName rootDir name =
let ext = ".xsd"
let temp = Path.Combine(rootDir, name + ext)
if File.Exists(temp) then
let newName = name +"_("+ int_to_string (Directory.GetFiles(rootDir, name + "*", SearchOption.TopDirectoryOnly).Length) + ")"
generateFileName rootDir newName
else
temp
type Form1 =
inherit Form as base
val mutable components: System.ComponentModel.Container
override this.Dispose(disposing) =
if (disposing &amp;amp;&amp;amp; (match this.components with null -&amp;gt; false | _ -&amp;gt; true)) then
this.components.Dispose()
base.Dispose(disposing)
val mutable tbDllFile: System.Windows.Forms.TextBox
val mutable btnBrowse: Button
val mutable btnExtract: Button
val mutable label1: Label
val mutable bgwExtract: BackgroundWorker
val mutable progressBar1: ProgressBar
val mutable openFileDialog1: OpenFileDialog
member this.InitializeComponent() =
this.tbDllFile &amp;lt;- new System.Windows.Forms.TextBox();
this.btnBrowse &amp;lt;- new System.Windows.Forms.Button();
this.btnExtract &amp;lt;- new System.Windows.Forms.Button();
this.label1 &amp;lt;- new System.Windows.Forms.Label();
this.bgwExtract &amp;lt;- new System.ComponentModel.BackgroundWorker();
this.progressBar1 &amp;lt;- new System.Windows.Forms.ProgressBar();
this.openFileDialog1 &amp;lt;- new System.Windows.Forms.OpenFileDialog();
this.SuspendLayout();
//
// tbDllFile
//
this.tbDllFile.Location &amp;lt;- new System.Drawing.Point(13, 33);
this.tbDllFile.Name &amp;lt;- "tbDllFile";
this.tbDllFile.Size &amp;lt;- new System.Drawing.Size(336, 20);
this.tbDllFile.TabIndex &amp;lt;- 0;
this.tbDllFile.Text &amp;lt;- "Erik:\\VS 2005 Projects\\FSharp\\FSoapBits\\ValidationSchemas.dll";
//
// btnBrowse
//
this.btnBrowse.Location &amp;lt;- new System.Drawing.Point(355, 30);
this.btnBrowse.Name &amp;lt;- "btnBrowse";
this.btnBrowse.Size &amp;lt;- new System.Drawing.Size(34, 23);
this.btnBrowse.TabIndex &amp;lt;- 1;
this.btnBrowse.Text &amp;lt;- "...";
this.btnBrowse.UseVisualStyleBackColor &amp;lt;- true;
this.btnBrowse.Click.Add(fun _ -&amp;gt;
if (DialogResult.OK == this.openFileDialog1.ShowDialog()) then
this.tbDllFile.Text &amp;lt;- this.openFileDialog1.FileName
else
this.tbDllFile.Text &amp;lt;- "")
//
// btnExtract
//
this.btnExtract.Location &amp;lt;- new System.Drawing.Point(314, 64);
this.btnExtract.Name &amp;lt;- "btnExtract";
this.btnExtract.Size &amp;lt;- new System.Drawing.Size(75, 23);
this.btnExtract.TabIndex &amp;lt;- 2;
this.btnExtract.Text &amp;lt;- "Extract";
this.btnExtract.UseVisualStyleBackColor &amp;lt;- true;
this.btnExtract.Click.Add(fun e -&amp;gt;
//let max = ref 0
let justTheFileName = Path.GetFileName(this.tbDllFile.Text);
if File.Exists(this.tbDllFile.Text) then
let temp = btsSchemas this.tbDllFile.Text
(*if not (temp.Length % 2 = 0) then
max := temp.Length + 1
else
max := temp.Length*)
this.progressBar1.Maximum &amp;lt;- temp.Length
this.progressBar1.Minimum &amp;lt;- 0
this.progressBar1.Step &amp;lt;- 1
this.progressBar1.Value &amp;lt;- 0
this.progressBar1.Refresh()
if temp.Length &amp;gt; 0 then
temp |&amp;gt;  Array.iter (fun typ -&amp;gt;
let instance = Activator.CreateInstance(typ) :?&amp;gt; SchemaBase
let xsd = instance.XmlContent
let curAssm = Assembly.GetExecutingAssembly()
let curDir = Path.GetDirectoryName(curAssm.Location)
//let curDir = Directory.GetCurrentDirectory()
let fullFileName = generateFileName curDir typ.Name
//Path.Combine(curDir, typ.Name + ".xsd")
using(new StreamWriter(fullFileName, false, Encoding.Unicode)) (fun sw -&amp;gt; sw.Write(xsd))
this.progressBar1.Increment(1)
)
else
MessageBox.Show(justTheFileName + " does not contain BizTalk schemas") |&amp;gt; ignore
else
MessageBox.Show(justTheFileName + " file does not exist") |&amp;gt; ignore
)
//
// label1
//
this.label1.AutoSize &amp;lt;- true
this.label1.Location &amp;lt;- new System.Drawing.Point(10, 9)
this.label1.Name &amp;lt;- "label1"
this.label1.Size &amp;lt;- new System.Drawing.Size(85, 13);
this.label1.TabIndex &amp;lt;- 3;
this.label1.Text &amp;lt;- "Biztalk Assembly";
//
// progressBar1
//
this.progressBar1.Location &amp;lt;- new System.Drawing.Point(12, 64);
this.progressBar1.Name &amp;lt;- "progressBar1";
this.progressBar1.Size &amp;lt;- new System.Drawing.Size(296, 23);
this.progressBar1.TabIndex &amp;lt;- 4;
//
// openFileDialog1
//
this.openFileDialog1.FileName &amp;lt;- "openFileDialog1";
this.openFileDialog1.Filter &amp;lt;- "Dll files|*.dll"
//
// BtsXsdExtractorForm
//
this.AutoScaleDimensions &amp;lt;- new System.Drawing.SizeF(6.0F, 13.0F);
this.AutoScaleMode &amp;lt;- System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize &amp;lt;- new System.Drawing.Size(401, 113);
this.Controls.Add(this.progressBar1);
this.Controls.Add(this.label1);
this.Controls.Add(this.btnExtract);
this.Controls.Add(this.btnBrowse);
this.Controls.Add(this.tbDllFile);
this.Name &amp;lt;- "BtsXsdExtractorForm";
this.Text &amp;lt;- "BizTalk Assembly Schema Extractor";
this.ResumeLayout(false);
this.PerformLayout();
new () as this =
{
tbDllFile = null
btnBrowse = null
btnExtract = null
label1 = null
bgwExtract = null
progressBar1 = null
openFileDialog1 = null
components = null
}
then
this.InitializeComponent()
let main() =
Application.EnableVisualStyles() |&amp;gt; ignore
//Application.SetCompatibleTextRenderingDefault(false) |&amp;gt; ignore
let form1 = new Form1()
Application.Run(form1)// |&amp;gt; ignore
[&lt;stathread&gt;&lt;/stathread&gt;]
do main ()
&lt;/p&gt;
&lt;/div&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=116734"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=116734" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Erik/aggbug/116734.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Erik Araojo</dc:creator>
            <guid>http://geekswithblogs.net/Erik/archive/2007/11/09/116734.aspx</guid>
            <pubDate>Fri, 09 Nov 2007 05:22:23 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Erik/comments/116734.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Erik/archive/2007/11/09/116734.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/Erik/comments/commentRss/116734.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Erik/services/trackbacks/116734.aspx</trackback:ping>
        </item>
        <item>
            <title>10 Types of Programmers : TechRepublic</title>
            <link>http://geekswithblogs.net/Erik/archive/2007/11/06/116627.aspx</link>
            <description>&lt;p&gt;Funny (but true) article from TechRepublic.  I gotta start looking for the Code Ninja in my team(!) but where do i start...&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.techrepublic.com.com/10things/?p=262"&gt;10 types of programmers you’ll encounter in the field&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=116627"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=116627" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Erik/aggbug/116627.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Erik Araojo</dc:creator>
            <guid>http://geekswithblogs.net/Erik/archive/2007/11/06/116627.aspx</guid>
            <pubDate>Tue, 06 Nov 2007 02:25:39 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Erik/comments/116627.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Erik/archive/2007/11/06/116627.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/Erik/comments/commentRss/116627.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Erik/services/trackbacks/116627.aspx</trackback:ping>
        </item>
        <item>
            <title>Hello F#!</title>
            <link>http://geekswithblogs.net/Erik/archive/2007/11/05/116592.aspx</link>
            <description>&lt;p&gt;I don't remember exactly where, but some years ago I've come across a book that said something like -- A "complete" programmer must know the 3 main programming styles, 1. C-based (C#, Java C++ etc) 2. Scripting (Perl etc) and 3. Functional (Haskell, OCaml etc).  Each style requires a different mind- set when writing code.    I started out as a Perl programmer (i know it's weird that my first language was Perl... ), moved on to C++ and now I'm doing .NET (C# and BizTalk mainly).  So, I've covered the first 2 "styles" and that leaves just functional programming. &lt;/p&gt;
&lt;p&gt;I've always been interested with functional programming but I somehow I've always found an excuse not to try it.  Add to that the facts that &lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;Going from OO to functional programming is hard. By that I mean the learning curve is very steep!!! &lt;/li&gt;
    &lt;li&gt;I didn't want to throw away my existing knowledge on C# &lt;/li&gt;
    &lt;li&gt;I didn't want to throw away the libraries I've compiled and written over the years. &lt;/li&gt;
    &lt;li&gt;There are no F# jobs!! (at least there's none in Singapore) &lt;/li&gt;
&lt;/ol&gt;
&lt;p align="center"&gt;&lt;img height="205" alt="" width="495" src="/images/geekswithblogs_net/Erik/FSharpJobSearch.JPG" /&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;A few weeks back &lt;a href="http://arstechnica.com/news.ars/post/20071023-microsoft-to-push-functional-programming-into-the-mainstream-with-f.html"&gt;Microsoft announced&lt;/a&gt; that it is productizing F#.  It is now going to be a supported .NET language. That is really great because now my excuses #2 and #3 are no longer valid!  Excuses #1 and #4 though it still has some weight, it is not enough anymore to keep me from learning functional programming with F#.  Yes, there will always be a learning curve.  And, the jobs...well, hopefully the bio-tech companies will soon adapt F# given that because of its functional nature, Microsoft is marketing it as a language for scientific reasearch and development.&lt;/p&gt;
&lt;p&gt;F# is not a pure functional language like Haskell i.e. it allows side-effects.  This is perfectly fine (I'm not a purist) because this is actually allows interoperability with other .NET libraries.  Which means coding in F# will in no way greatly reduce my productivity.&lt;/p&gt;
&lt;p&gt;For 2 weeks now, I've been reading up on F# while travelling to and from the office. Below is my first F# code.  Check out how System.Windows.Forms controls are available from the code.&lt;/p&gt;
&lt;p&gt;&lt;img height="97" alt="" width="143" src="/images/geekswithblogs_net/Erik/firstFSharpCode.JPG" /&gt;&lt;/p&gt;
&lt;p style="BACKGROUND-COLOR: #ffffcc"&gt;#light &lt;br /&gt;
open System&lt;br /&gt;
open System.Drawing&lt;br /&gt;
open System.Windows.Forms&lt;br /&gt;
open System.Windows.Forms.Design&lt;br /&gt;
&lt;br /&gt;
let label =&lt;br /&gt;
  let temp = new Label()&lt;br /&gt;
  do temp.Name &amp;lt;- "label1"&lt;br /&gt;
  do temp.Size &amp;lt;- new System.Drawing.Size(35, 13);&lt;br /&gt;
  do temp.Text &amp;lt;- "Hello F#"&lt;br /&gt;
  do temp.AutoSize &amp;lt;- true&lt;br /&gt;
  do temp.Location &amp;lt;- new Drawing.Point(26,27)&lt;br /&gt;
  temp&lt;br /&gt;
&lt;br /&gt;
let form =&lt;br /&gt;
  let temp = new Form()&lt;br /&gt;
  do temp.Name &amp;lt;- "ErikForm"&lt;br /&gt;
  do temp.Text &amp;lt;- "EriKForm"&lt;br /&gt;
  do temp.ClientSize &amp;lt;- new System.Drawing.Size(292, 266);&lt;br /&gt;
  do temp.Controls.Add(label)&lt;br /&gt;
  temp&lt;br /&gt;
&lt;br /&gt;
let ticker = &lt;br /&gt;
  let temp = new Timer()&lt;br /&gt;
  temp.Enabled &amp;lt;- true&lt;br /&gt;
  temp.Interval &amp;lt;- 1000&lt;br /&gt;
  temp.Tick.Add(fun _ -&amp;gt; label.Text &amp;lt;- DateTime.Now.ToLongTimeString())&lt;br /&gt;
&lt;br /&gt;
do Application.Run(form)&lt;br /&gt;
&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=116592"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=116592" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Erik/aggbug/116592.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Erik Araojo</dc:creator>
            <guid>http://geekswithblogs.net/Erik/archive/2007/11/05/116592.aspx</guid>
            <pubDate>Mon, 05 Nov 2007 10:14:36 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Erik/comments/116592.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Erik/archive/2007/11/05/116592.aspx#feedback</comments>
            <slash:comments>6</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/Erik/comments/commentRss/116592.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Erik/services/trackbacks/116592.aspx</trackback:ping>
        </item>
        <item>
            <title>SoapBits - A .NET Tool to Dynamically Invoke Web Services</title>
            <link>http://geekswithblogs.net/Erik/archive/2007/09/01/115109.aspx</link>
            <description>&lt;p&gt;&lt;font size="3"&gt; November 1 2007&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;          &lt;font size="2"&gt;It's been 2 months now since I've made SoapBits available on this blog.  And I'm genuinely surprised that people had stumbled into it!  Google you're the king!! &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;         Here are some download stats from easy-share.com.  On the average, the tool gets downloaded twice a day.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;img width="511" height="82" src="/images/geekswithblogs_net/Erik/SoapBits/2monthsDownloadStats(1).jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;         &lt;font size="2"&gt;I've also received some emails regarding difficulties downloading from easy-share.  This most probaly because of the layout of the easy-share web site.  You need to scroll down a bit to get past the ads until you see the download part.  I know, this s*cks a bit but its still better than hosting it at rapidshare where you have to wait for ages.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;img width="545" height="159" src="/images/geekswithblogs_net/Erik/SoapBits/easy-shareDownload(1).jpg" alt="" /&gt;&lt;/font&gt; &lt;/p&gt;
&lt;p&gt;   &lt;font size="2"&gt;The latest version can be downloaded here : &lt;strong&gt; &lt;/strong&gt;&lt;strong&gt;&lt;a href="http://w15.easy-share.com/7505511.html"&gt;SoapBits v.1.1.1&lt;/a&gt;&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;font size="3"&gt;October 13 2007 UPDATE - &lt;font color="#000080"&gt;&lt;strong&gt;SoapBits v1.1.1&lt;/strong&gt;&lt;/font&gt; Released!&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;     &lt;font size="2"&gt;This release contains fixes to the following bugs&lt;/font&gt;&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;&lt;font size="2"&gt;Fails to process web services whose WSDL had included external schemas wherein the schemaLocation is in the URI format. Something like: &amp;lt;&lt;strong&gt;xs:include schemaLocation&lt;/strong&gt;="http://MyCentralRepository/MyExternalTypes.xsd"/&amp;gt;&lt;/font&gt; &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;font size="2"&gt;             Fix: added to code to download the schema into the temp folder where all the other temporay files (wsdl, request and responses) are kept.  This temp folder is deleted when the tool is closed.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;      2.   Response Tab fails to display very large soap responses.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;             Fix:  Modified the way the http response is read so that the entire response can be displayed.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;     3.   Cannot send cookies.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;            Fix: Cookies are supported only via the "Send Raw Request" option.  I've added code to make this easier . Please see the modified the documentation (part of the download) on how sending/receiving cookies can be done.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;          &lt;font size="2"&gt;You can download&lt;strong&gt; &lt;/strong&gt;&lt;/font&gt;&lt;a href="http://geekswithblogs.net/Erik/archive/2008/05/10/122038.aspx"&gt;&lt;font size="2"&gt;&lt;strong&gt;SoapBits v.1.1.1&lt;/strong&gt;&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; here.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="3"&gt;Sept 25 2007/UPDATE&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;            &lt;font size="2"&gt;Just got back from vacation and is now working on fixing a bug relating to "included" schemas in the WSDL.  I am also looking into implementing some feature requests.&lt;/font&gt;  &lt;/p&gt;
&lt;p&gt;         &lt;font size="2"&gt;    I don't have specific date in mind yet for the new release but I promise I'll get to work on it whenever I'm free.&lt;/font&gt;   &lt;/p&gt;
&lt;p&gt;            Guys thank you very much for reporting bugs and submitting feature requests.  This will make SoapBits a much better app than I hoped it would be.&lt;/p&gt;
&lt;p&gt;        &lt;/p&gt;
&lt;p&gt;&lt;font size="3"&gt;Sept 8 2007 /UPDATE -&lt;font color="#000080"&gt; &lt;strong&gt;SoapBits v1.1.0 Released&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;As promised, here's the new release of SoapBits! This release contains the following changes&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;1. More robust exception handling.  The reported bug(s) on unhandled exceptions are no more.  Plus, I've added a feature that automatically unhides the Logging Pane whenever an exception is written to it.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;2. The "Quick Edit" tab Response pane is now synchronized with the current selected method.  Taking this synchronization fix further, I also synchonized the current selected web method with the" Test Data" tab Request and Response sub tabs.  To illustrate, Say you are testing a web service that has 2 web methods, method1 and method 2. If you invoke &lt;em&gt;method1&lt;/em&gt; first, then &lt;em&gt;method2&lt;/em&gt; and then you selected method1 again from the "Web Methods" pane the data that will be shown in the "Test Data" tab will be for method1 even though the last method that was executed was method2.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;3.  "Quick Options" now includes  a) Toggling the Logging Pane, b) Viewing the WSDL and c) Viewing the Soap Request Properties&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;4.  The UI has a bit of an "MS Outlook" feel now.  &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;5. I've also added a label to display the time!  This is for my fellow devs who frequently forgets to have lunch or dinner!  &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;6. "Help/About" now contains more info.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;Check out the new look!&lt;/font&gt;&lt;/p&gt;
&lt;p&gt; &lt;img width="561" height="399" src="/images/geekswithblogs_net/Erik/SoapBits/SoapBits.new(3).JPG" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;As always, for any bugs or enhancement requests please let me know. &lt;/font&gt;&lt;font size="2"&gt;&lt;img src="/Providers/BlogEntryEditor/FCKeditor/editor/images/smiley/msn/envelope.gif" alt="" /&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;You can download&lt;a href="http://geekswithblogs.net/Erik/archive/2008/05/10/122038.aspx"&gt; &lt;strong&gt;SoapBits v1.1.0&lt;/strong&gt;&lt;/a&gt; here&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt; &lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Sept 4, 2007/ UPDATE&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;        I have received the following comments regarding the tool and i'll be fixing these over the weekend.  Let me know if there are more.&lt;/font&gt;&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;&lt;font size="2"&gt;Unhandled exception is generated when the URL passed is incorrect.&lt;/font&gt; &lt;/li&gt;
    &lt;li&gt;&lt;font size="2"&gt;The response output tree should refresh when another web method is selected&lt;/font&gt; &lt;/li&gt;
    &lt;li&gt;&lt;font size="2"&gt;Add to "Quick Options" a link to the Soap request properties.&lt;/font&gt; &lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt; &lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;Sept 1/ Initial Release&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;SoapBits is an application used to dynamically invoke any type of web service. The inspiration for this tool is the amazing &lt;strong&gt;.NET Web Service Studio&lt;/strong&gt; tool written by Sowmys of Microsoft at GotDotNet. That tool has been a great help to me.&lt;/font&gt;&lt;/p&gt;
&lt;div style="margin: 0in 0in 0pt;"&gt;&lt;font size="2"&gt;I have been using .&lt;strong&gt;NET Web Service Studio &lt;/strong&gt;for a few years now and I have found that though it works great it needed a few enhancements. So basically what I did here is to take .&lt;strong&gt;NET Web Service Studio &lt;/strong&gt;and add the enhancements I wanted.&lt;/font&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt;"&gt;&lt;font size="2"&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt;"&gt;&lt;font size="2"&gt;Sowmys, if you object to me using your tool this way, just let me know. I’ll immediately discontinue distributing the tool.&lt;/font&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt;"&gt;&lt;font size="2"&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt;"&gt;&lt;font size="2"&gt;OK so here we go...&lt;/font&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt;"&gt;&lt;font size="2"&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt;"&gt;&lt;strong&gt;&lt;font size="3"&gt;Installation&lt;/font&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt;"&gt;&lt;font size="2"&gt;&lt;strong&gt;    &lt;/strong&gt;Prerequisite : .NET Framework 2.0&lt;/font&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt;"&gt;&lt;font size="2"&gt;    Platforms supported : XP and Windows Server 2000.  I haven't tried on Vista because I don't have one (...yet). &lt;/font&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt;"&gt;&lt;font size="2"&gt;    Instructions: Just extract the zip file into any directory&lt;/font&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt;"&gt;&lt;font size="2"&gt;&lt;/font&gt; &lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt;"&gt;&lt;strong&gt;&lt;font size="3"&gt;Tool Sections&lt;/font&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt;"&gt;&lt;strong&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt;"&gt;&lt;strong&gt;&lt;font size="2"&gt;* Quick Edit Tab&lt;/font&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;p&gt;&lt;img width="410" height="320" src="/images/geekswithblogs_net/Erik/SoapBits/CropperCapture[1]_small.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;strong&gt;* Test Data Tab&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;&lt;img width="410" height="320" src="/images/geekswithblogs_net/Erik/SoapBits/CropperCapture[3].jpg" alt="" /&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;&lt;/font&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;font size="3"&gt;QuickStart Guide.&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;div style="margin: 12pt 0in 3pt;"&gt;&lt;strong&gt;&lt;font size="2"&gt;* Invoking a web service using &lt;u&gt;Quick Edit Option&lt;/u&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;font size="2"&gt;1.&lt;span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt;      &lt;/span&gt;Provide a wsdl in the address bar. Click Go. Select a web method&lt;/font&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;img width="416" height="332" src="/images/geekswithblogs_net/Erik/SoapBits/step 1.jpg" alt="" /&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt; &lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;font size="2"&gt;2. &lt;span style="font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt;     &lt;/span&gt;Provide values to the input parameters of the web method. Click Send Soap request button. &lt;/font&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt; &lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt; &lt;img width="457" height="294" src="/images/geekswithblogs_net/Erik/SoapBits/step2.jpg" alt="" /&gt;&lt;/div&gt;
&lt;div style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;  &lt;/div&gt;
&lt;p&gt; &lt;strong&gt;&lt;font size="2"&gt;* Invoking a web service by using the "&lt;u&gt;Raw Soap mesage" option&lt;/u&gt;&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;div style="margin: 0in 0in 0pt 0.75in; text-indent: -0.25in;"&gt;&lt;font size="2"&gt;Another way to invoke a web service is to edit directly the raw soap message.  Instructions on how to do this is in the document &lt;/font&gt;&lt;font size="2"&gt; that is included in the download&lt;/font&gt;&lt;/div&gt;
&lt;p&gt;&lt;font size="2"&gt; You can &lt;/font&gt;&lt;a href="http://geekswithblogs.net/Erik/archive/2008/05/10/122038.aspx"&gt;&lt;font size="2"&gt;download&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;&lt;a href="javascript:void(0);/*1210432964501*/"&gt; &lt;/a&gt;SoapBits here.  Try it out and let me know how it goes! &lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=115109"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=115109" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Erik/aggbug/115109.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Erik Araojo</dc:creator>
            <guid>http://geekswithblogs.net/Erik/archive/2007/09/01/115109.aspx</guid>
            <pubDate>Sat, 01 Sep 2007 04:13:57 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Erik/comments/115109.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Erik/archive/2007/09/01/115109.aspx#feedback</comments>
            <slash:comments>15</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/Erik/comments/commentRss/115109.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Erik/services/trackbacks/115109.aspx</trackback:ping>
        </item>
        <item>
            <title>Configuring SubSonic for BizTalk</title>
            <link>http://geekswithblogs.net/Erik/archive/2007/06/14/113222.aspx</link>
            <description>&lt;p&gt;&lt;font size="2"&gt;Every BizTalk developer knows that assemblies used by BizTalk must reside in the Global Assembly Cache and hence must be strong-named.  As such, if you are using an assembly that reads a config section then in the BTSNTSvc.exe.config, you must specify the specific type of assembly in the GAC that will be used to read that section. &lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font size="2"&gt;Taking SubSonic for example. the config section should read like:&lt;/font&gt; &lt;/p&gt;
&lt;div style="TEXT-INDENT: 0.5in"&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: 0.5in"&gt;&lt;font size="1"&gt;&lt;span style="FONT-SIZE: 8pt"&gt;&amp;lt;configSections&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: 0.5in"&gt;&lt;font size="1"&gt;&lt;span style="FONT-SIZE: 8pt"&gt;   &amp;lt;section name="SubSonicService" type="SubSonic.SubSonicSection, &lt;strong&gt;&lt;font color="#ff0000"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: red"&gt;SubSonic, Version=2.0.0.1, Culture=neutral, PublicKeyToken=3db15eb857a3cee5&lt;/span&gt;&lt;/font&gt;&lt;/strong&gt;" allowDefinition="MachineToApplication" restartOnExternalChanges="true" requirePermission="false"/&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: 0.5in"&gt;&lt;font size="1"&gt;&lt;span style="FONT-SIZE: 8pt"&gt;  &amp;lt;/configSections&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: 0.5in"&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: 0.5in"&gt;&lt;font size="2"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;And the SubSonicService section should be:&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: 0.5in"&gt;&lt;font size="1"&gt; &lt;/font&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: 0.5in"&gt;&lt;font size="1"&gt;&lt;span style="FONT-SIZE: 8pt"&gt;&amp;lt;SubSonicService defaultProvider="TestProvider"&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: 0.5in"&gt;&lt;font size="1"&gt;&lt;span style="FONT-SIZE: 8pt"&gt;  &amp;lt;providers&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: 0.5in"&gt;&lt;font size="1"&gt;&lt;span style="FONT-SIZE: 8pt"&gt;    &amp;lt;add name="TestProvider" type="SubSonic.SqlDataProvider, &lt;strong&gt;&lt;font color="#ff0000"&gt;&lt;span style="FONT-WEIGHT: bold; COLOR: red"&gt;SubSonic, Version=2.0.0.1, Culture=neutral, PublicKeyToken=3db15eb857a3cee5&lt;/span&gt;&lt;/font&gt;&lt;/strong&gt;"      &lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: 0.5in"&gt;&lt;font size="1"&gt;&lt;span style="FONT-SIZE: 8pt"&gt;         connectionStringName="ConnectionString" &lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: 0.5in"&gt;&lt;font size="1"&gt;&lt;span style="FONT-SIZE: 8pt"&gt;         generatedNamespace="Test.DataAccess"/&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: 0.5in"&gt;&lt;font size="1"&gt;&lt;span style="FONT-SIZE: 8pt"&gt;  &amp;lt;/providers&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div style="TEXT-INDENT: 0.5in"&gt;&lt;font size="1"&gt;&lt;span style="FONT-SIZE: 8pt"&gt;&amp;lt;/SubSonicService&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;The Version, Culture and PublicKeyToken must be specified.  If not, BizTalk won’t be able to find the assembly and will report an error saying something like “it could not load assembly or file”. &lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;div&gt;&lt;font size="2"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;To find out the version and PublicKeyToken of any assembly in the gac, simply go to C:\windows\assembly&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;
&lt;p align="center"&gt;&lt;img alt="" border="1" src="/images/geekswithblogs_net/Erik/Test/susbsonicgac.jpg" /&gt;&lt;/p&gt;
&lt;p align="center"&gt; &lt;/p&gt;
&lt;p align="left"&gt;&lt;font size="2"&gt;You can download SubSonic &lt;/font&gt;&lt;a href="http://www.codeplex.com/actionpack/Release/ProjectReleases.aspx?ReleaseId=3969"&gt;&lt;font size="2"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;. Generate your own snk file, compile it, then off you go!&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113222"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=113222" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Erik/aggbug/113222.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Erik Araojo</dc:creator>
            <guid>http://geekswithblogs.net/Erik/archive/2007/06/14/113222.aspx</guid>
            <pubDate>Wed, 13 Jun 2007 22:48:35 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Erik/comments/113222.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Erik/archive/2007/06/14/113222.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/Erik/comments/commentRss/113222.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Erik/services/trackbacks/113222.aspx</trackback:ping>
        </item>
        <item>
            <title>Turning point</title>
            <link>http://geekswithblogs.net/Erik/archive/2006/12/14/101141.aspx</link>
            <description>&lt;P&gt;&lt;FONT size=2&gt;Each one of us experience this at some point in our lives;&amp;nbsp;a defining moment, a sudden unexpected event, a&amp;nbsp;turning point&amp;nbsp;-&amp;nbsp;beyond which we are never the same again.&amp;nbsp;&amp;nbsp;I just had mine a few days back and I'm still reeling from its effects.&lt;/FONT&gt;&amp;nbsp; &lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=101141"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=101141" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Erik/aggbug/101141.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Erik Araojo</dc:creator>
            <guid>http://geekswithblogs.net/Erik/archive/2006/12/14/101141.aspx</guid>
            <pubDate>Thu, 14 Dec 2006 07:49:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Erik/comments/101141.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Erik/archive/2006/12/14/101141.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/Erik/comments/commentRss/101141.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Erik/services/trackbacks/101141.aspx</trackback:ping>
        </item>
        <item>
            <title>Ramblings over coffee</title>
            <link>http://geekswithblogs.net/Erik/archive/2006/11/14/97080.aspx</link>
            <description>&lt;P&gt;Last night a friend and I were at Changi international airport having coffee and just wiling away the time. And of all the topics that we could have talked about, we ended up talking about love. Hahaha! yeah, love.&amp;nbsp;Well.. I&amp;nbsp;suppose its not that surprising&amp;nbsp; given that most of the people we know who came here to Singapore&amp;nbsp;ended up with a messed-up love life.&amp;nbsp; That of course includes me.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So&amp;nbsp;how does moving to another country relate to &amp;nbsp;breakups?&amp;nbsp; Was it the distance?&amp;nbsp;Was it the breakdown in communication caused by multitude of factors, primary of which is distance?&amp;nbsp; Was it because both persons are now living "separate" lives?&amp;nbsp; Or was it because they now are able to see the relationship from a different perspective now that their partner is no longer always around?&lt;/P&gt;
&lt;P&gt;... *Sigh* ...&lt;/P&gt;
&lt;P&gt;I wish I know the answer.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;I wish my friend knew the answer.&lt;/P&gt;
&lt;P&gt;But sadly, &amp;nbsp;we were as just as clueless as everyone else.&amp;nbsp; When love happens, when it hits you, you just know it.&amp;nbsp;You just feel it.&amp;nbsp;No matter how hard you try to find a logical reason as to why you have this feeling, you'll just never find it.&amp;nbsp; It just happens.&amp;nbsp; Ironically, the same argument can be applied as to why love disappears.&amp;nbsp; One day you just realize that the feelings you had before is gone (or dying) without really knowing why.&amp;nbsp; Again, you just feel it.&amp;nbsp;The realization hits you just as hard as when you realized you were in love.&lt;/P&gt;
&lt;P&gt;Love it seems is a creature of whim. It comes and goes as it pleases.&amp;nbsp; And it doesn't even bother to explain.&lt;/P&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=97080"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=97080" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Erik/aggbug/97080.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Erik Araojo</dc:creator>
            <guid>http://geekswithblogs.net/Erik/archive/2006/11/14/97080.aspx</guid>
            <pubDate>Tue, 14 Nov 2006 05:09:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Erik/comments/97080.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Erik/archive/2006/11/14/97080.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/Erik/comments/commentRss/97080.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Erik/services/trackbacks/97080.aspx</trackback:ping>
        </item>
        <item>
            <title>Removing Parties Programatically</title>
            <link>http://geekswithblogs.net/Erik/archive/2006/05/03/77066.aspx</link>
            <description>&lt;P&gt;&lt;FONT size=1&gt;Here's how you can remove parties programatically.&amp;nbsp; It's quite easy.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=1&gt;I.&amp;nbsp; First, you need a reference to the Microsoft.BizTalk.ExplorerOM assembly.&amp;nbsp; You can find this assembly in the Biztalk install folder&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=1&gt;II.. Create your code this way&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=1&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=1&gt;
&lt;HR id=null&gt;
&lt;/FONT&gt;
&lt;P&gt;&lt;/P&gt;&lt;FONT color=#0000ff&gt;
&lt;P&gt;&lt;FONT size=1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;try&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;BtsCatalogExplorer btsExp&amp;nbsp; = new BtsCatalogExplorer();&lt;BR&gt;&lt;STRONG&gt;&lt;FONT color=#000000&gt;&amp;nbsp;&amp;nbsp;1.&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; PartyCollection pc = (PartyCollection)btsExp.GetCollection(CollectionType.Party);&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;FONT size=1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;&lt;FONT color=#000000&gt;2.&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i=0; i&amp;lt;= pc.Count-1; i++)&lt;/FONT&gt;&lt;FONT size=1&gt;&lt;FONT color=#000000&gt;&lt;STRONG&gt;&lt;BR&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;FONT color=#000000&gt;&lt;STRONG&gt;3.&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (bindingFileParties.Contains(pc[i].Name))&lt;/FONT&gt;&lt;FONT size=1&gt;&lt;STRONG&gt;&lt;FONT color=#000000&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;&lt;FONT color=#000000&gt;4.&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;btsExp.RemoveParty(pc[i]);&amp;nbsp;&lt;/FONT&gt;&lt;FONT size=1&gt;&lt;STRONG&gt;&lt;FONT color=#000000&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;&lt;FONT color=#000000&gt;5.&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i--;&amp;nbsp;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=1&gt;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;&lt;FONT color=#000000&gt;6.&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; btsExp.SaveChanges();&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=1&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (Exception ex)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;&lt;FONT color=#000000&gt;7.&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;this.btsExp.DiscardChanges();&amp;nbsp;&lt;/FONT&gt;&lt;FONT size=1&gt;&lt;STRONG&gt;&lt;FONT color=#000000&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw ex;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=1&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=1&gt;
&lt;HR id=null&gt;
&lt;/FONT&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#000000 size=1&gt;line 1 : Create an instance of the BtsCatalogExplorer and retrieve the partycollection deployed in the Mgmt database&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#000000 size=1&gt;line 2 : loop through all parties&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#000000 size=1&gt;line 3: Here I process only those parties which are declared in a binding file.&amp;nbsp; The bindingFileParties variable here is an Arraylist which contains a list of all &amp;#8220;party&amp;#8221; values found in a binding file.&amp;nbsp;&amp;nbsp; This is just to make sure that I remove the parties which are mine.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#000000 size=1&gt;line 4:&amp;nbsp; This is the line where we actually remove the party.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#000000 size=1&gt;line 5:&amp;nbsp; Bring back the counter one step because we removed a party from&amp;nbsp;the collection&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#000000 size=1&gt;line 6: Commit the changes to the database&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#000000 size=1&gt;line 7:&amp;nbsp; Discard your changes if any exception occured.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#000000 size=1&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#000000 size=1&gt;You can also use this approach to remove ReceivePorts and Send ports.&amp;nbsp; Just replace PartyCollection with ReceivePortCollection or SendPortCollection and CollectionType.Party with CollectionType.ReceivePort or CollectionType.SendPort&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=77066"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=77066" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Erik/aggbug/77066.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Erik Araojo</dc:creator>
            <guid>http://geekswithblogs.net/Erik/archive/2006/05/03/77066.aspx</guid>
            <pubDate>Tue, 02 May 2006 23:25:00 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Erik/comments/77066.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Erik/archive/2006/05/03/77066.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/Erik/comments/commentRss/77066.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Erik/services/trackbacks/77066.aspx</trackback:ping>
        </item>
    </channel>
</rss>