<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jason Rowe &#187; Jason</title>
	<atom:link href="http://jasonrowe.com/author/Jason/feed/" rel="self" type="application/rss+xml" />
	<link>http://jasonrowe.com</link>
	<description>enjoying the web</description>
	<lastBuildDate>Sun, 13 May 2012 14:05:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>NetMsmqBinding Brain Dump</title>
		<link>http://jasonrowe.com/2012/05/13/netmsmqbinding-brain-dump/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=netmsmqbinding-brain-dump</link>
		<comments>http://jasonrowe.com/2012/05/13/netmsmqbinding-brain-dump/#comments</comments>
		<pubDate>Sun, 13 May 2012 06:14:28 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[MSMQ]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://jasonrowe.com/?p=1940</guid>
		<description><![CDATA[I started experimenting with WCF&#8217;s NetMsmqBinding and found the abstraction to be a bit tricky. WCF takes care of all the MSMQ details and all you need to do is define the contract and do configuration. The following are some &#8230; <a href="http://jasonrowe.com/2012/05/13/netmsmqbinding-brain-dump/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p> I started experimenting with WCF&#8217;s NetMsmqBinding and found the abstraction to be a bit tricky. WCF takes care of all the MSMQ details and all you need to do is define the contract and do configuration. The following are some notes about that process.</p>

<h3>Links</h3>
<p><a href="http://blogs.msdn.com/b/tomholl/archive/2008/07/12/msmq-wcf-and-iis-getting-them-to-play-nice-part-1.aspx">msmq wcf and iis getting them to play nice</a></p>
<p><a href="http://code.google.com/p/autofac/wiki/WcfIntegration#WAS_Hosting_and_Non-HTTP_Activation">AutoFac WAS Hosting and Non-HTTP Activation</a></p>

<h3>Windows Components Installed</h3>
<p>Microsoft Message Queue (MSMQ) Server > MSMQ Server Core</p>
<p>Microsoft .NET Framework > Windows Communication Foundation Non-HTTP Activation</p>

<h3>IIS 7 Configuration</h3>
<ol>
<li>Add net.msmq to the list of enabled protocols. In IIS, Web App -> Advanced Settings -> Enabled Protocols. It is a comma separated list (http,net.msmq).</li>
<li>Make sure Client and Service have correct permissions to access the private queue</li>
</ol>

<h3>MSMQ Config</h3>
<p>Add NETWORK SERVICE to the new MSMQ (windows 7 that is in Computer Managment -> Services and Applications -> Message Queuing</p>

<h3>C# code to create initialize private queue</h3>
<p>The queue name must match the URI of your service&#8217;s .svc file according to <a href="http://blogs.msdn.com/b/tomholl/archive/2008/07/12/msmq-wcf-and-iis-getting-them-to-play-nice-part-1.aspx">this</a></p>

<pre class="brush: csharp; title: ; notranslate">
  // Create and connect to a private Message Queuing queue.
if (!MessageQueue.Exists(@&quot;.\Private$\JangoFettClient/CloneService.svc&quot;))
{
    // Create the queue if it does not exist.
    MessageQueue.Create(@&quot;.\Private$\JangoFettClient/CloneService.svc&quot;);
}
</pre>

<h3>Example Service Config</h3>

<pre class="brush: xml; title: ; notranslate">
&lt;bindings&gt;
    &lt;netMsmqBinding&gt;
        &lt;binding name=&quot;MsmqBindingNonTransactionalNoSecurity&quot;
                        exactlyOnce=&quot;false&quot;&gt;
            &lt;security mode=&quot;None&quot;/&gt;
        &lt;/binding&gt;
    &lt;/netMsmqBinding&gt;
&lt;/bindings&gt;
&lt;services&gt;
&lt;service name=&quot;JangoFettClient.CloneService&quot;&gt;
    &lt;endpoint name=&quot;msmq&quot; 
              address=&quot;net.msmq://localhost/private/JangoFettClient/CloneService.svc&quot;
              binding=&quot;netMsmqBinding&quot; 
              bindingConfiguration=&quot;MsmqBindingNonTransactionalNoSecurity&quot;
              contract=&quot;JangoFettClient.ICloneOrderProcessor&quot; /&gt;
&lt;/service&gt;
&lt;/services&gt;
</pre>

<h3>Example Service</h3>
<p>Example of data contract that would automatically become the listener and pull the items from MSMQ via WCF</p>
<pre class="brush: csharp; title: ; notranslate">
namespace JangoFettClient
{
    public class CloneService : ICloneOrderProcessor
    {
        private readonly ILog _logger;

        public CloneService(ILog logger)
        {
            _logger = logger;
        }

        public void SendMessage(CloneOrder request)
        {
            _logger.Info(&quot;Message received from MSMQ&quot;);
        }
    }
}
</pre>

<h3>Errors with easy fixes</h3>
<p>The protocol &#8216;net.msmq&#8217; is not supported. Add net.msmq to the list of enabled protocols. See IIS 7 Configuration above for more information.</p>]]></content:encoded>
			<wfw:commentRss>http://jasonrowe.com/2012/05/13/netmsmqbinding-brain-dump/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SVG Movable Node Graph</title>
		<link>http://jasonrowe.com/2012/05/10/svg-movable-node-graph/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=svg-movable-node-graph</link>
		<comments>http://jasonrowe.com/2012/05/10/svg-movable-node-graph/#comments</comments>
		<pubDate>Fri, 11 May 2012 04:53:34 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Raphael]]></category>
		<category><![CDATA[SVG]]></category>

		<guid isPermaLink="false">http://jasonrowe.com/?p=1926</guid>
		<description><![CDATA[I&#8217;ve been having fun lately with JavaScript, SVG, and simple node graphs. I just added movable/draggable nodes to my VisualizeInteractions project. It&#8217;s helping me get my head around closures. I&#8217;m not at the point of mastering JavaScript. I never think &#8230; <a href="http://jasonrowe.com/2012/05/10/svg-movable-node-graph/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been having fun lately with JavaScript, SVG, and simple node graphs. I just added movable/draggable nodes to my <a href="https://github.com/JasonRowe/VisualizeInteractions">VisualizeInteractions </a>project. It&#8217;s helping me get my head around <a href="https://developer.mozilla.org/en/JavaScript/Guide/Closures">closures</a>.</p>

<script type="text/javascript" src="http://jasonrowe.com/misc/raphael-min.js"></script>
<script type="text/javascript" src="http://jasonrowe.com/misc/interactions.js"></script>

    <div id="VisualWindow">
    </div>

<script type="text/javascript">

        var FreeTime = { "l": "", "t": "", "c": "#54A0DE", "x": 180, "y": 180, "r": 5, "m": true, "connections":
                                [{ "t": "Coding", "c": "#4BDE7F", "x": 319, "y": 253, "r": 30, "m": true },
                                 { "t": "Twitter", "c": "#F28124", "x": 120, "y": 160, "r": 5, "m": true },
                                 { "t": "Google+", "c": "#FFFF0A", "x": 30, "y": 160, "r": 10, "m": true },
                                 { "t": "Google Reader", "c": "#694E00", "x": 272, "y": 87, "r": 3, "m": true },
                                 { "t": "Biking", "c": "#694E00", "x": 30, "y": 40, "r": 1, "m": true },
                                 { "t": "Family", "c": "#694E00", "x": 101, "y": 275, "r": 30, "m": true }
                                ]
        };

        interactions.initalize("VisualWindow", 600, 350);
        interactions.draw(FreeTime);

    </script>

<p>I&#8217;m not at the point of mastering JavaScript. I never think of closures in advanced when building a project. I sort of just throw them in when an event doesn&#8217;t work or my context is suddenly wrong. At least I&#8217;m no longer using global variables to get things working. </p>

<p>Much of the code for this was borrowed from the Raphaël <a href="http://raphaeljs.com/graffle.html">sample </a>which does use global variables for the event methods and array of edges in the graph. Most of the heavy lifting is done by the Raphaël JavaScript library which I really like since it is compatible with most browsers. The only issue I have seen is old version of android which didn&#8217;t support SVG.</p>]]></content:encoded>
			<wfw:commentRss>http://jasonrowe.com/2012/05/10/svg-movable-node-graph/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>See You Later MarketWatch</title>
		<link>http://jasonrowe.com/2012/04/26/see-you-later-marketwatch/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=see-you-later-marketwatch</link>
		<comments>http://jasonrowe.com/2012/04/26/see-you-later-marketwatch/#comments</comments>
		<pubDate>Fri, 27 Apr 2012 01:11:55 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Personal]]></category>

		<guid isPermaLink="false">http://jasonrowe.com/?p=1793</guid>
		<description><![CDATA[It&#8217;s never easy to say goodbye. Some people do it with a song. Others have suggested interpretive dance. I&#8217;ll leave you with this less entertaining visualization of all the places I&#8217;ve sat in the office and internal teams I&#8217;ve worked &#8230; <a href="http://jasonrowe.com/2012/04/26/see-you-later-marketwatch/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s never easy to say goodbye. Some people do it with a <a href="http://karenx.com/blog/im-leaving-microsoft/">song</a>. Others have suggested <a href="http://www.youtube.com/watch?v=hrZGDAdF1us">interpretive dance</a>. I&#8217;ll leave you with this less entertaining visualization of all the places I&#8217;ve sat in the office and internal teams I&#8217;ve worked with. This is 100% accurate. You just can&#8217;t make this stuff up.</p>

<script type="text/javascript" src="http://jasonrowe.com/misc/raphael-min.js"></script>
<script type="text/javascript" src="http://jasonrowe.com/misc/interactions.js"></script>

    <div id="VisualWindow">
    </div>

   <script type="text/javascript">

        var year2001 = { "l": "2001", "t": "me", "c": "#54A0DE", "x": 180, "y": 180, "r": 5, "connections":
                                [{ "t": "Client Services", "c": "#4BDE7F", "x": 185, "y": 210, "r": 8 },
                                 { "t": "Web Dev", "c": "#F28124", "x": 120, "y": 160, "r": 20 },
                                 { "t": "Data Integrity", "c": "#FFFF0A", "x": 30, "y": 160, "r": 8 },
                                 { "t": "Management", "c": "#694E00", "x": 30, "y": 40, "r": 10 },
                                ]
        };

        var year2002 = { "l": "2002", "t": "me", "c": "#54A0DE", "x": 180, "y": 180, "r": 5, "connections":
                                [{ "t": "Client Services", "c": "#4BDE7F", "x": 185, "y": 210, "r": 8 },
                                 { "t": "Web Dev", "c": "#F28124", "x": 120, "y": 160, "r": 20 },
                                 { "t": "Data Integrity", "c": "#FFFF0A", "x": 30, "y": 260, "r": 8 },
                                 { "t": "Management", "c": "#694E00", "x": 30, "y": 60, "r": 20 },
                                 { "t": "Systems", "c": "#FF0000", "x": 150, "y": 40, "r": 30 },
                                 { "t": "MarketWatch Dev", "c": "#009138", "x": 240, "y": 150, "r": 30 },
                                ]
        };

        var year2003 = { "l": "2003", "t": "me", "c": "#54A0DE", "x": 30, "y": 90, "r": 5, "connections":
                                [{ "t": "Client Services", "c": "#4BDE7F", "x": 185, "y": 210, "r": 8 },
                                 { "t": "Web Dev", "c": "#F28124", "x": 120, "y": 160, "r": 20 },
                                 { "t": "Data Integrity", "c": "#FFFF0A", "x": 30, "y": 260, "r": 8 },
                                 { "t": "Management", "c": "#694E00", "x": 30, "y": 60, "r": 20 },
                                 { "t": "Systems", "c": "#FF0000", "x": 150, "y": 40, "r": 30 },
                                 { "t": "MarketWatch Dev", "c": "#009138", "x": 240, "y": 150, "r": 30 },
                                 { "t": "DB Group", "c": "#870029", "x": 280, "y": 210, "r": 20 },
                                 { "t": "CTO", "c": "#9DF8FC", "x": 280, "y": 260, "r": 5 },
                                 { "t": "PM", "c": "#9DF8FC", "x": 35, "y": 150, "r": 30 },
                                ]
        };

        var year2004 = { "l": "2004", "t": "me", "c": "#54A0DE", "x": 30, "y": 200, "r": 5, "connections":
                                [{ "t": "Web Dev", "c": "#F28124", "x": 120, "y": 160, "r": 40 },
                                 { "t": "Data Integrity", "c": "#FFFF0A", "x": 30, "y": 260, "r": 10 },
                                 { "t": "Management", "c": "#694E00", "x": 30, "y": 60, "r": 20 },
                                 { "t": "Systems", "c": "#FF0000", "x": 150, "y": 40, "r": 30 },
                                 { "t": "MarketWatch Dev", "c": "#009138", "x": 240, "y": 150, "r": 35 },
                                 { "t": "DB Group", "c": "#870029", "x": 280, "y": 210, "r": 20 },
                                 { "t": "CTO", "c": "#9DF8FC", "x": 280, "y": 260, "r": 5 },
                                 { "t": "PM", "c": "#9DF8FC", "x": 35, "y": 130, "r": 30 },
                                ]
        };

        var year2005 = { "l": "2005", "t": "me", "c": "#54A0DE", "x": 300, "y": 75, "r": 5, "connections":
                                [{ "t": "Data Integrity", "c": "#FFFF0A", "x": 30, "y": 260, "r": 10 },
                                 { "t": "Management", "c": "#694E00", "x": 30, "y": 60, "r": 20 },
                                 { "t": "Systems", "c": "#FF0000", "x": 150, "y": 40, "r": 30 },
                                 { "t": "MarketWatch Dev", "c": "#009138", "x": 240, "y": 150, "r": 40 },
                                 { "t": "DB Group", "c": "#870029", "x": 70, "y": 50, "r": 5 },
                                 { "t": "CTO", "c": "#9DF8FC", "x": 280, "y": 260, "r": 5 },
                                 { "t": "QA", "c": "#B100F7", "x": 175, "y": 260, "r": 10 },
                                 { "t": "Market Data", "c": "#000000", "x": 300, "y": 40, "r": 5 },
                                ]
        };

        var year2006 = { "l": "2006", "t": "me", "c": "#54A0DE", "x": 300, "y": 75, "r": 5, "connections":
                                [{ "t": "Data Integrity", "c": "#FFFF0A", "x": 30, "y": 260, "r": 10 },
                                 { "t": "Management", "c": "#694E00", "x": 30, "y": 60, "r": 20 },
                                 { "t": "Systems", "c": "#FF0000", "x": 150, "y": 40, "r": 30 },
                                 { "t": "MarketWatch Dev", "c": "#009138", "x": 240, "y": 150, "r": 45 },
                                 { "t": "DB Group", "c": "#870029", "x": 70, "y": 50, "r": 5 },
                                 { "t": "CTO", "c": "#9DF8FC", "x": 280, "y": 260, "r": 5 },
                                 { "t": "QA", "c": "#B100F7", "x": 175, "y": 260, "r": 10 },
                                 { "t": "News Team", "c": "#C9C5C9", "x": 130, "y": 260, "r": 20 },
                                 { "t": "Market Data", "c": "#000000", "x": 260, "y": 100, "r": 10 },
                                 { "t": "Market Data", "c": "#000000", "x": 300, "y": 40, "r": 5 },
                                ]
        };

        var year2007 = { "l": "2007", "t": "me", "c": "#54A0DE", "x": 200, "y": 100, "r": 5, "connections":
                                [{ "t": "Data Integrity", "c": "#FFFF0A", "x": 30, "y": 260, "r": 10 },
                                 { "t": "Management", "c": "#694E00", "x": 30, "y": 60, "r": 20 },
                                 { "t": "Systems", "c": "#FF0000", "x": 150, "y": 40, "r": 30 },
                                 { "t": "MarketWatch Dev", "c": "#009138", "x": 240, "y": 150, "r": 50 },
                                 { "t": "DB Group", "c": "#870029", "x": 70, "y": 50, "r": 5 },
                                 { "t": "CTO", "c": "#9DF8FC", "x": 280, "y": 260, "r": 5 },
                                 { "t": "QA", "c": "#B100F7", "x": 175, "y": 260, "r": 10 },
                                 { "t": "News Team", "c": "#C9C5C9", "x": 130, "y": 260, "r": 20 },
                                 { "t": "Market Data", "c": "#000000", "x": 260, "y": 100, "r": 10 },
                                ]
        };

        var year2008 = { "l": "2008", "t": "me", "c": "#54A0DE", "x": 200, "y": 100, "r": 5, "connections":
                                [{ "t": "Data Integrity", "c": "#FFFF0A", "x": 30, "y": 260, "r": 10 },
                                 { "t": "Management", "c": "#694E00", "x": 30, "y": 60, "r": 20 },
                                 { "t": "Systems", "c": "#FF0000", "x": 150, "y": 40, "r": 30 },
                                 { "t": "MarketWatch Dev", "c": "#009138", "x": 240, "y": 150, "r": 55 },
                                 { "t": "DB Group", "c": "#870029", "x": 70, "y": 50, "r": 5 },
                                 { "t": "CTO", "c": "#9DF8FC", "x": 280, "y": 260, "r": 5 },
                                 { "t": "QA", "c": "#B100F7", "x": 175, "y": 260, "r": 10 },
                                 { "t": "News Team", "c": "#C9C5C9", "x": 130, "y": 260, "r": 20 },
                                 { "t": "Market Data", "c": "#000000", "x": 260, "y": 100, "r": 15 },
                                ]
        };

        var year2009 = { "l": "2009", "t": "me", "c": "#54A0DE", "x": 200, "y": 100, "r": 5, "connections":
                                [{ "t": "Data Integrity", "c": "#FFFF0A", "x": 30, "y": 260, "r": 10 },
                                 { "t": "Management", "c": "#694E00", "x": 280, "y": 260, "r": 10 },
                                 { "t": "Systems", "c": "#FF0000", "x": 150, "y": 40, "r": 30 },
                                 { "t": "MarketWatch Dev", "c": "#009138", "x": 240, "y": 180, "r": 60 },
                                 { "t": "DB Group", "c": "#870029", "x": 70, "y": 50, "r": 5 },
                                 { "t": "QA", "c": "#B100F7", "x": 175, "y": 260, "r": 5 },
                                 { "t": "News Team", "c": "#C9C5C9", "x": 130, "y": 260, "r": 20 },
                                 { "t": "Market Data", "c": "#000000", "x": 280, "y": 230, "r": 15 },
                                ]
        };

        var year2010 = { "l": "2010", "t": "me", "c": "#54A0DE", "x": 200, "y": 100, "r": 5, "connections":
                                [{ "t": "Data Integrity", "c": "#FFFF0A", "x": 30, "y": 260, "r": 10 },
                                 { "t": "Management", "c": "#694E00", "x": 280, "y": 260, "r": 10 },
                                 { "t": "Systems", "c": "#FF0000", "x": 150, "y": 40, "r": 10 },
                                 { "t": "MarketWatch Dev", "c": "#009138", "x": 240, "y": 150, "r": 55 },
                                 { "t": "DB Group", "c": "#870029", "x": 70, "y": 50, "r": 5 },
                                 { "t": "Market Data", "c": "#000000", "x": 280, "y": 230, "r": 20 },
                                ]
        };

        var year2011 = { "l": "2011", "t": "me", "c": "#54A0DE", "x": 155, "y": 260, "r": 5, "connections":
                                [{ "t": "Data Integrity", "c": "#FFFF0A", "x": 30, "y": 260, "r": 5 },
                                 { "t": "Systems", "c": "#FF0000", "x": 150, "y": 40, "r": 5 },
                                 { "t": "MarketWatch Dev", "c": "#009138", "x": 240, "y": 150, "r": 30 },
                                 { "t": "DB Group", "c": "#870029", "x": 70, "y": 50, "r": 5 },
                                 { "t": "News Team", "c": "#C9C5C9", "x": 35, "y": 150, "r": 5 },
                                 { "t": "Market Data", "c": "#000000", "x": 125, "y": 260, "r": 20 },
                                 { "t": "Managment", "c": "#694E00", "x": 280, "y": 260, "r": 10 },
                                ]
        };

        var year2012 = { "l": "2012", "t": "me", "c": "#54A0DE", "x": 155, "y": 260, "r": 5, "connections":
                                [{ "t": "Systems", "c": "#FF0000", "x": 150, "y": 40, "r": 5 },
                                 { "t": "MarketWatch Dev", "c": "#009138", "x": 55, "y": 150, "r": 30 },
                                 { "t": "Market Data", "c": "#000000", "x": 110, "y": 240, "r": 30 },
                                 { "t": "News Team", "c": "#C9C5C9", "x": 35, "y": 222, "r": 5 },
                                 { "t": "Management", "c": "#694E00", "x": 280, "y": 260, "r": 10 },
                                 { "t": "Video", "c": "#694E00", "x": 30, "y": 40, "r": 10 },
                                 { "t": "R.O.U.S.", "c": "#FF00C3", "x": 220, "y": 150, "r": 10},
                                ]
        };
        var intervalID, i = 1, yearList = [];

        yearList.push(year2001);
        yearList.push(year2002);
        yearList.push(year2003);
        yearList.push(year2004);
        yearList.push(year2005);
        yearList.push(year2006);
        yearList.push(year2007);
        yearList.push(year2008);
        yearList.push(year2009);
        yearList.push(year2010);
        yearList.push(year2011);
        yearList.push(year2012);
        //wow you looked at the code and made it this far. sorry.
        function visualizeConnections() {

            if (i < yearList.length) {

                interactions.clear();
                interactions.draw(yearList[i]);
                i++;
            }
            else {
                i = 0;
            }
        }

        interactions.initalize("VisualWindow", 320, 300);
        interactions.draw(yearList[0]);

        intervalID = setInterval(visualizeConnections, 3000);
    </script>

<p>I often think back to my first day in Oct. 2001 (<a href="http://web.archive.org/web/20011009101048/http://www.marketwatch.com/news/default.asp?siteid=mktw">take a look at the site web.archive.org</a> it takes awhile to load but it is worth it). The times seemed grim and the economy was in turmoil. Through the ups and downs the Minneapolis team adapted, <a href="http://www.codinghorror.com/blog/2009/02/paying-down-your-technical-debt.html">payed down technical debt</a>, and used modern development practices to be successful. Now becoming a key component of the world's second-largest <a href="http://en.wikipedia.org/wiki/News_Corporation">media conglomerate</a>.</p>

<h2>What’s Next?</h2>

<p>I have a new job in downtown Minneapolis with <a href="http://en.wikipedia.org/wiki/Wolters_Kluwer">Wolters Kluwer</a>. I'll still be doing software development but working more directly with financial institutions again. I have plenty of new things to learn and challenging projects to work on.</p>

<p>I'll miss you Morris, Kaavio, Dylan, Ziggman, Ronco, and Varasto!</p>

]]></content:encoded>
			<wfw:commentRss>http://jasonrowe.com/2012/04/26/see-you-later-marketwatch/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Right Click Add To Path</title>
		<link>http://jasonrowe.com/2012/04/25/right-click-add-to-path/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=right-click-add-to-path</link>
		<comments>http://jasonrowe.com/2012/04/25/right-click-add-to-path/#comments</comments>
		<pubDate>Thu, 26 Apr 2012 03:03:41 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[General Programming]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://jasonrowe.com/?p=1839</guid>
		<description><![CDATA[I do lots of installs on my windows machine and got tired of having to change the path environment variables manually. I created a AddPath.exe that will do this for me and added a short cut to the right click &#8230; <a href="http://jasonrowe.com/2012/04/25/right-click-add-to-path/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<a href="http://jasonrowe.com/wp-content/uploads/2012/04/addpath.png"><img src="http://jasonrowe.com/wp-content/uploads/2012/04/addpath.png" alt="" title="addpath" width="236" height="93" class="alignleft size-full wp-image-1840" /></a>

<p>I do lots of installs on my windows machine and got tired of having to change the path environment variables manually. I created a AddPath.exe that will do this for me and added a short cut to the right click context menu. </p>

<p>In one right click I can get this result:</p>
<a href="http://jasonrowe.com/wp-content/uploads/2012/04/addpathresult.png"><img src="http://jasonrowe.com/wp-content/uploads/2012/04/addpathresult.png" alt="" title="addpathresult" width="355" height="151" class="alignnone size-full wp-image-1878" /></a>



<p>Here is how it works if you are interested:</p>
<ol>
<li>Compile Code Via &#8211; git@github.com:JasonRowe/AddPath.git or <a href="http://jasonrowe.com/misc/AddPath.zip">Download the zip file</a>.</li>
<li>Put the executable (AddPath.exe) and the dependency file (System.dll) into C:\tools\</li>
<li>This executable needs to run as Admin. Right click on AddPath.exe, click compatibility tab and select &#8220;run this program as an administrator&#8221;</li>
</ol>

<p>To add the right click context menu you need to add a new key to the registry</p>

<img src="http://jasonrowe.com/wp-content/uploads/2012/04/AddPathReg1.png" alt="" title="AddPathReg" width="664" height="229" class="alignleft size-full wp-image-1863" />

<ol>
<li>open the registry editor (Start -> Run -> regedit.exe)</li>
<li>Find the key HKEY_CLASSES_ROOT\Folder. Create a new key named shell if its not already there (HKEY_CLASSES_ROOT\Folder\shell)</li>
<li>In the shell key (possibly just created) create a new key and change its name AddPath or whatever you want to show in the context menu</li>
<li>Under the new key create a new key named command (HKEY_CLASSES_ROOT\Folder\shell\AddPath\command) and change its default value C:\tools\AddPath.exe &#8220;%1&#8243;</li>
</ol>

That %1 in quotes becomes the folder path and is passed to AddPath.exe as a parameter. Here is what the code is doing with the path that is passed in:

<pre class="brush: csharp; title: ; notranslate">
 public static void AddPathSegments(Options options)
        {
            try
            {
                string allPaths = Environment.GetEnvironmentVariable(&quot;PATH&quot;, options.Target);
                if (allPaths != null)
                    allPaths = options.PathSegment + &quot;; &quot; + allPaths;
                else
                    allPaths = options.PathSegment;
                Environment.SetEnvironmentVariable(&quot;PATH&quot;, allPaths, options.Target);

                Console.WriteLine(&quot;Added path segment: {0}&quot;, options.PathSegment);
            }
            catch (Exception ex)
            {
                Console.WriteLine(&quot;could not add path segment: {0} -  error {1}&quot;, 
                                   options.PathSegment, ex);
            }
        }
</pre>]]></content:encoded>
			<wfw:commentRss>http://jasonrowe.com/2012/04/25/right-click-add-to-path/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Understand Your Networks Using ThinkUp</title>
		<link>http://jasonrowe.com/2012/04/16/understand-your-networks-using-thinkup/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=understand-your-networks-using-thinkup</link>
		<comments>http://jasonrowe.com/2012/04/16/understand-your-networks-using-thinkup/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 03:18:40 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[Commentary]]></category>
		<category><![CDATA[General Programming]]></category>

		<guid isPermaLink="false">http://jasonrowe.com/?p=1751</guid>
		<description><![CDATA[I use ThinkUp as a way to archive some of my social network data and get insight on what&#8217;s going on. It comes with plugins to pull data from Google+, Facebook, and Twitter accounts into a MySql database. Once it &#8230; <a href="http://jasonrowe.com/2012/04/16/understand-your-networks-using-thinkup/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I use <a href="http://thinkupapp.com/">ThinkUp </a>as a way to archive some of my social network data and get insight on what&#8217;s going on. It comes with plugins to pull data from Google+, Facebook, and Twitter accounts into a MySql database. Once it is in the database the app slices and dices the data for you or you can analyze it however you want.</p>

<p>My own personal networks aren&#8217;t comprehensive <a href="http://thinkup.jasonrowe.com/" title="thinkup.jasonrowe.com">thinkup.jasonrowe.com</a> but ThinkUp still comes in handy when I can&#8217;t find an old post from Twitter. It also gives you Klout like information on follower counts and interactions. A fun area to look at is the follower categories which are: Most Popular, Dead Beats, and Chatter Box.</p>

<a href="http://jasonrowe.com/wp-content/uploads/2012/04/mpf.png"><img src="http://jasonrowe.com/wp-content/uploads/2012/04/mpf.png" alt="" title="mpf" width="719" height="148" class="alignleft size-full wp-image-1752" /></a>
<br />

<p>Another feature is you can pull in data from Facebook pages you have liked. You don&#8217;t need to have access to the account to pull in the data since it is already public. For example, I started tracking the MarketWatch Facebook page. Now from the ThinkUp interface I can see what stories have the most social engagement.</p>

<a href="http://jasonrowe.com/wp-content/uploads/2012/04/hot_stories.png"><img src="http://jasonrowe.com/wp-content/uploads/2012/04/hot_stories.png" alt="" title="hot_stories" width="728" height="196" class="alignleft size-full wp-image-1768" /></a>
<br />
<p>Huh? Maybe Apple stock is going to get a little cheaper in the next couple of days. :)</p>
<a href="http://jasonrowe.com/wp-content/uploads/2012/04/apple.png"><img src="http://jasonrowe.com/wp-content/uploads/2012/04/apple.png" alt="" title="apple" width="728" height="228" class="alignleft size-full wp-image-1771" /></a>

<br />
<p>Here is an example of one of the nice stats you can get from the ThinkUp web app.</p>

<p><strong>MarketWatch Facebook Likes</strong></p>
<a href="http://jasonrowe.com/wp-content/uploads/2012/04/mwlikes.png"><img src="http://jasonrowe.com/wp-content/uploads/2012/04/mwlikes.png" alt="" title="mwlikes" width="714" height="315" class="alignleft size-full wp-image-1757" /></a>
<br />
<p>With little effort you get a quick way to connect and pull in social network data. Adding more Facebook pages is as easy as liking the page and then clicking the ThinkUp button shown below.</p>

<a href="http://jasonrowe.com/wp-content/uploads/2012/04/page.png"><img src="http://jasonrowe.com/wp-content/uploads/2012/04/page.png" alt="" title="page" width="661" height="133" class="alignleft size-full wp-image-1761" /></a>
]]></content:encoded>
			<wfw:commentRss>http://jasonrowe.com/2012/04/16/understand-your-networks-using-thinkup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ejabberd offline messages</title>
		<link>http://jasonrowe.com/2011/12/30/ejabberd-offline-messages/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=ejabberd-offline-messages</link>
		<comments>http://jasonrowe.com/2011/12/30/ejabberd-offline-messages/#comments</comments>
		<pubDate>Fri, 30 Dec 2011 22:58:26 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[XMPP]]></category>
		<category><![CDATA[ejabberd]]></category>
		<category><![CDATA[erlang]]></category>
		<category><![CDATA[offline messages]]></category>

		<guid isPermaLink="false">http://jasonrowe.com/?p=1600</guid>
		<description><![CDATA[The following is how I created a custom ejabberd module to POST offline messages to a web application. I should mention this is not production ready I&#8217;ve only just started working with Erlang and the XMPP server ejabberd. The main &#8230; <a href="http://jasonrowe.com/2011/12/30/ejabberd-offline-messages/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The following is how I created a custom ejabberd module to POST offline messages to a web application. I should mention this is not production ready I&#8217;ve only just started working with Erlang and the XMPP server ejabberd. The main reason I&#8217;m experimenting with XMPP is to provide apple push notifications once a user closes an iPhone application. My day job is programming in C# so this is going to be from a Windows .Net developer perspective.</p>

<p>Why use ejabberd which is written in a wacky language called Erlang? Well&#8230; you will have to decide for yourself. Erlang is a functional programming language which is known for concurrency and high reliability. Also, it&#8217;s the <a href="https://github.com/languages/Erlang">24th most popular language on GitHub</a> as of writting this so it can&#8217;t be that bad. :)</p>

<p>If you don&#8217;t have ejabberd setup yet see my <a href="http://jasonrowe.com/2011/11/18/strophejs-ejabberd-iis-setup/">previous post</a> on getting strophejs, ejabberd, and IIS all working together.</p>

<p>Step one, take a deep breath and get up to speed on XMPP, ejabberd, and Erlang. Easy right?
Don&#8217;t worry, it will all come together by the end of this post. Well, at least you will write some Erlang by the end of the post. Here are some resource to have handy.</p>

<p><strong>Books:</strong></p>
<ol>
	<li><a href="http://learnyousomeerlang.com/introduction">Learn You Some Erlang</a></li>
	<li><a href="http://books.google.com/books?id=SG3jayrd41cC&#038;dq=xmpp">XMPP, the definitive guide</a></li>
</ol>

<p>Let&#8217;s start with getting the Erlang environment up and running. You need Erlang to compile the new module. The Erlang version is important because it should match the one used in the installed ejabberd server. What version of Erlang was used with your installed ejabberd? You can find that information here using your ejabberd version number (if you don&#8217;t know the version number skip ahead to the next section before following this link): <a href="http://www.ejabberd.im/erlang">http://www.ejabberd.im/erlang</a>.</p>

<p><strong>If you don&#8217;t know your ejabberd version here is how to get it.</strong></p>

<p>Go to start, run, and type cmd to open a command prompt. CD to your ejabberd\bin folder. 
Mine in &#8220;D:\Program Files (x86)\ejabberd-2.1.9\bin&#8221;. Then run the following command:</p>

<code>ejabberdctl status</code>

<p>You should see something like this &#8220;The node ejabberd@localhost is started with status: started
ejabberd 2.1.9 is running in that node&#8221;</p>


<strong>Note on ejabberd start error and erlang cookie</strong>
<p>If you you get an error like the following <strong>&#8220;Failed RPC connection to the node ejabberd@localhost: nodedown&#8221;</strong> 
Try to run the start command:</p>

<code>ejabberdctl start</code>

<p>If you get the same error when trying to start you might have a &#8220;.erlang.cookie&#8221; mismatch. On my box ejabberd runs using the
erlang cookie from &#8220;C:\Windows\.erlang.cookie&#8221;. This needs to match the one in your user folder. My Erlang cookie is located here:
&#8220;C:\Users\rowej\.erlang.cookie&#8221;. If you are getting the error mentioned, copy your erlang cookie from the windows folder
into your user folder.</p>

<p>Now that you have the ejabberd version go to <a href="http://www.ejabberd.im/erlang">ejabberd official site</a> and see which version of erlang was used. This is important so you are using the same
version when you compile your module.</p>

<p>Now open your favorite text editor. I recommend Sublime Text 2 with Erlang syntax highlighting turned on. Also, there are several choices of plugins for NetBeans or Eclipse. The officially recommended IDE is Erlang mode for Emacs.</p>


<p>The next step is to get a basic module installed and make sure it is working. Lets start with a very simple module that does nothing but logs out information. Finally, time to start coding!</p>

<p>Create a file named mod_http_offline.erl.</p>

<p>Lets start with a very simple module that just does logging. This should give us a good idea of how ejabberd handles modules. Fill in the file you created &#8220;mod_http_offline.erl&#8221; with the following code:</p>


<pre class="brush: erlang; title: ; notranslate">

%% name of module must match file name
-module(mod_http_offline).

-author(&quot;Earl The Squirrel&quot;).

%% Every ejabberd module implements the gen_mod behavior
%% The gen_mod behavior requires two functions: start/2 and stop/1
-behaviour(gen_mod).

%% public methods for this module
-export([start/2, stop/1, create_message/3]).

%% included for writing to ejabberd log file
-include(&quot;ejabberd.hrl&quot;).

%% ejabberd functions for JID manipulation called jlib.
-include(&quot;jlib.hrl&quot;).

start(_Host, _Opt) -&gt; 
		post_offline_message(&quot;testFrom&quot;, &quot;testTo&quot;, &quot;testBody&quot;),
		?INFO_MSG(&quot;mod_http_offline loading&quot;, []),
		ejabberd_hooks:add(offline_message_hook, _Host, ?MODULE, create_message, 50).   



stop (_Host) -&gt; 
		?INFO_MSG(&quot;stopping mod_http_offline&quot;, []),
		ejabberd_hooks:delete(offline_message_hook, _Host, ?MODULE, create_message, 50).



create_message(_From, _To, Packet) -&gt;
		Type = xml:get_tag_attr_s(&quot;type&quot;, Packet),
		FromS = xml:get_tag_attr_s(&quot;from&quot;, Packet),
		ToS = xml:get_tag_attr_s(&quot;to&quot;, Packet),
		Body = xml:get_path_s(Packet, [{elem, &quot;body&quot;}, cdata]),
		if (Type == &quot;chat&quot;) -&gt;
			post_offline_message(FromS, ToS, Body)
		end.



post_offline_message(From, To, Body) -&gt;
		?INFO_MSG(&quot;Posting From ~p To ~p Body ~p~n&quot;,[From, To, Body]),
		?INFO_MSG(&quot;post request sent (not really yet)&quot;, []).
</pre>

<p>Now lets get the necessary include files to compile the code. You will have to go to the <a href="http://www.process-one.net/en/ejabberd/downloads/">ejabberd site and download the src</a>.</p>

<p>select &#8220;source code&#8221; from the drop down list. Then use a tool like <a href="http://tartool.codeplex.com/">TarTool</a> to unzip it. Copy jlib.hrl and ejabberd.hrl into the same folder where where you created the module source mod_http_offline.erl</p>

<p>Now open the erlang shell (programs > Erlang), type in:</p>

<p><strong>Remember you must use a slash (forward slash). If you cut and paste from windows explorer you will get back slashes and you won&#8217;t be able to change directories.</strong></p>

<code>cd("path/to/where.you/saved/the-module").</code>

<p>Then compile by doing the following:</p>
<code>c(mod_http_offline).</code>

<p>You should see this result and a .beam file now created in the directory:</p>
<code>./mod_http_offline.erl:8: Warning: behaviour gen_mod undefined</code>

<p>Shut down ejabberd server and copy the resulting .beam file to the directory where all the other ejabberd .beam files are.
\ejabberd-2.1.9\lib\ejabberd-2.1.9\ebin</p>

<p>Configure ejabberd to enable this module via the ejabberd.cfg. Add it to the list of modules in the Module section.</p>
<code>{mod_http_offline,    []}</code>

<p>Start up eJabberd.</p> 

<p>After it starts lets examine the log files to see if our module loaded.
example\path\ejabberd-2.1.9\logs\ejabberd.log</p> 

<p>You should see the following log entries:</p> 

<code>=INFO REPORT==== 2011-12-30 14:55:27 ===
I(<0.36.0>:mod_http_offline:44) : Posting From "testFrom" To "testTo" Body "testBody"

=INFO REPORT==== 2011-12-30 14:55:27 ===
I(<0.36.0>:mod_http_offline:45) : post request sent (not really yet)

=INFO REPORT==== 2011-12-30 14:55:27 ===
I(<0.36.0>:mod_http_offline:21) : mod_http_offline loading</code>

<p>Now we can have fun and send some offline messages. Get two XMPP clients running logged in with two different users. I used my admin account created during the ejabberd setup and a new test account created via the ejabberd Web Admin. I used the agxXMPP client to send messages back and forth but you can use which ever XMPP client is easier for you. You can find a list of them on the official <a href="http://xmpp.org/xmpp-software/clients/">XMPP website client list</a>. Send a few message to a user who is not connected (offline) and check your ejabberd.log file.(example\path\ejabberd-2.1.9\logs\ejabberd.log). Here is what mine looks like after sending a Hello world message.</p>

<code>
=INFO REPORT==== 2011-12-30 13:31:25 ===
I(<0.493.0>:mod_http_offline:44) : Posting From [] To "test@localhost.demo.com" Body "hello world"</code>

<p>Shut down ejabberd and setup a page to handle HTTP POST&#8217;s via Erlang. use your favorite web framework for the page it really doesn&#8217;t matter. If you are using MVC .Net it might look somethign like this.</p>

<pre class="brush: csharp; title: ; notranslate">
 [HttpPost]
        public ActionResult Process()
        {
            var formValues = Request.Form;

            string from;
            string to;
            string body;

            if (!string.IsNullOrEmpty(formValues[&quot;From&quot;]))
            {
                from = formValues[&quot;From&quot;];
            }

            if (!string.IsNullOrEmpty(formValues[&quot;To&quot;]))
            {
                to = formValues[&quot;To&quot;];
            }

            if (!string.IsNullOrEmpty(formValues[&quot;Body&quot;]))
            {
                body = formValues[&quot;Body&quot;];
            }
</pre>

<p>Then from the Erlang console send a post to make sure everything is working with this command:</p>

http:request(post, {&#8220;http://localhost/OfflineDemoWebhost/Message/Process&#8221;,[], &#8220;application/x-www-form-urlencoded&#8221;,&#8221;From=earl the squirrel&#038;To=you&#038;Body=Hello World&#8221;}, [], [])


<p>If you see a response starting with this you are good to go.</p>
<pre class="brush: bash; title: ; notranslate">{ok,{{&quot;HTTP/1.1&quot;,200,&quot;OK&quot;},</pre>

<p><strong>
Now lets change the module to send the post adding in a few more lines of code.</strong></p>

<pre class="brush: erlang; title: ; notranslate">
%% name of module must match file name
-module(mod_http_offline).

-author(&quot;Earl The Squirrel&quot;).

%% Every ejabberd module implements the gen_mod behavior
%% The gen_mod behavior requires two functions: start/2 and stop/1
-behaviour(gen_mod).

%% public methods for this module
-export([start/2, stop/1, create_message/3]).

%% included for writing to ejabberd log file
-include(&quot;ejabberd.hrl&quot;).

%% ejabberd functions for JID manipulation called jlib.
-include(&quot;jlib.hrl&quot;).

start(_Host, _Opt) -&gt; 
		?INFO_MSG(&quot;mod_http_offline loading&quot;, []),
		inets:start(),
		?INFO_MSG(&quot;HTTP client started&quot;, []),
		post_offline_message(&quot;testFrom&quot;, &quot;testTo&quot;, &quot;testBody&quot;),
		ejabberd_hooks:add(offline_message_hook, _Host, ?MODULE, create_message, 50).   



stop (_Host) -&gt; 
		?INFO_MSG(&quot;stopping mod_http_offline&quot;, []),
		ejabberd_hooks:delete(offline_message_hook, _Host, ?MODULE, create_message, 50).



create_message(_From, _To, Packet) -&gt;
		Type = xml:get_tag_attr_s(&quot;type&quot;, Packet),
		FromS = xml:get_tag_attr_s(&quot;from&quot;, Packet),
		ToS = xml:get_tag_attr_s(&quot;to&quot;, Packet),
		Body = xml:get_path_s(Packet, [{elem, &quot;body&quot;}, cdata]),
		if (Type == &quot;chat&quot;) -&gt;
			post_offline_message(FromS, ToS, Body)
		end.



post_offline_message(From, To, Body) -&gt;
		?INFO_MSG(&quot;Posting From ~p To ~p Body ~p~n&quot;,[From, To, Body]),
		 http:request(post, {&quot;http://localhost/OfflineDemoWebhost/Message/Process&quot;,[], 
		 &quot;application/x-www-form-urlencoded&quot;,
		 lists:concat([&quot;From=&quot;, From,&quot;&amp;To=&quot;, To,&quot;&amp;Body=&quot;, Body])}, [], []),
		?INFO_MSG(&quot;post request sent&quot;, []).
</pre>

<p>Shut down ejabberd again and recompile. Copy the beam file overitting the old version. Now start up the server and you should have offline messages posting to your web application.</p>
]]></content:encoded>
			<wfw:commentRss>http://jasonrowe.com/2011/12/30/ejabberd-offline-messages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Strophejs ejabberd IIS Setup</title>
		<link>http://jasonrowe.com/2011/11/18/strophejs-ejabberd-iis-setup/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=strophejs-ejabberd-iis-setup</link>
		<comments>http://jasonrowe.com/2011/11/18/strophejs-ejabberd-iis-setup/#comments</comments>
		<pubDate>Fri, 18 Nov 2011 19:08:17 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[XMPP]]></category>
		<category><![CDATA[ejabberd]]></category>
		<category><![CDATA[strophejs]]></category>

		<guid isPermaLink="false">http://jasonrowe.com/?p=1547</guid>
		<description><![CDATA[This is a simple guide for getting strophe.js, ejabberd, and IIS all working together on a local dev machine. This assumes you have IIS 7.5 installed and are familiar with the basics of IIS Manager Step 1: Download and install &#8230; <a href="http://jasonrowe.com/2011/11/18/strophejs-ejabberd-iis-setup/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This is a simple guide for getting strophe.js, ejabberd, and IIS all working together on a local dev machine. This assumes you have IIS 7.5 installed and are familiar with the basics of IIS Manager</p>

<img src="http://jasonrowe.com/wp-content/uploads/2011/11/ej_iis_stro_blog1.png" alt="strophe ejabberd IIS" title="ej_iis_stro_blog" width="400" height="100" class="alignleft size-full wp-image-1563" />

<p><strong>Step 1</strong>: Download and install <a href="http://www.process-one.net/en/ejabberd/downloads">ejabberd</a>. The install is straight forward and the default configuration has everything you need. During the install it will ask you for a domain. I would recommend setting up a host alias &#8220;localhost.demo.com&#8221; because it looks nicer and easier to use but you could also just use localhost. After install check to make sure the http-bind endpoint is working http://localhost:5280/http-bind/. You should see a simple page that has &#8220;ejabberd mod_http_bind&#8221; at the top</p>

<p><strong>Step 1.5</strong>: Setup a host name if needed. If you used localhost you can skip this step. You can do this in Windows 7 via the host file which should be located &#8220;C:\Windows\System32\drivers\etc\hosts&#8221;. Add a line at the bottom with your IP and new local DNS.</p>

<p><strong>Step 2</strong>: Setup new IIS application and copy in strophe.js examples. Go into IIS manager and create a new application named &#8220;xmppExample&#8221;. Then download the latest <a href="http://strophe.im/strophejs/">strophe.js</a> and copy the contents to your new site. You should be able to access the following now. http://localhost.demo.com/xmppExample/strophejs/examples/basic.html. You will have to change the first line in basic.js to setup your endpoint. It should look like this <strong>BOSH_SERVICE = &#8216;http://localhost.demo.com/http-bind&#8217;</strong></p>

<p><strong>Step 3</strong>: Setup proxy for ejabberd http-bind endpoint. To make things simple we need everything on the same domain. Right now, the bosch http-bind endpoint is this http://localhost:5280/http-bind/ and we need it to be this http://localhost.demo.com/http-bind. Download and install the Application Request Routing for IIS. Once installed follow these steps to enable proxy.
</p>

<ol>
	<li>Open IIS Manager</li>
	<li>Select a server node in the tree view on the left hand side and then click on the &#8220;Application Request Routing&#8230;&#8221; the full name shows up as &#8220;Application Request Routing Cache&#8221;</li>
	<li>Then on the far right side click on &#8220;Server Proxy Settings&#8230;</li>
	<li>check the box next to Enable proxy and apply settings (keep everything else default)</li>
</ol>

<p>
Finally, add a rewrite rule to the web.config file in your inetpub root dir. For example, mine is located &#8220;C:\inetpub\wwwroot\web.config&#8221;. Here is my full XML configuration file:
</p>

<pre class="brush: xml; title: ; notranslate">

&lt;rewrite&gt;
    &lt;rules&gt;
          &lt;rule name=&quot;ejabberd.BOSH&quot; stopProcessing=&quot;true&quot;&gt;
               	&lt;match url=&quot;^http-bind&quot; /&gt;
               	&lt;action type=&quot;Rewrite&quot; url=&quot;http://localhost.demo.com:5280/http-bind/&quot; /&gt;
          &lt;/rule&gt;
    &lt;/rules&gt;
&lt;/rewrite&gt;
</pre>

<p>Now you should be able to run the demo at http://localhost.demo.com/xmppExample/strophejs/examples/basic.html. You will need to login with admin@localhost.demo.com (if admin is the username you selected during install) and the password you selected during install.</p>

<blockquote>I can also be found on Google+

<a title="Jason Rowe is on Google+" rel="author" href="http://profiles.google.com/jasonrowe?rel=author" alt="Google+" title="Google+">Jason Rowe</a> and twitter <a title="Jason Rowe is on twitter" rel="author" href="http://twitter.com/jsonrow?rel=author" alt="twitter" title="twitter">@jsonrow</a>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://jasonrowe.com/2011/11/18/strophejs-ejabberd-iis-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting back into JavaScript</title>
		<link>http://jasonrowe.com/2011/11/02/getting-back-into-javascript/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=getting-back-into-javascript</link>
		<comments>http://jasonrowe.com/2011/11/02/getting-back-into-javascript/#comments</comments>
		<pubDate>Thu, 03 Nov 2011 04:17:32 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[General Programming]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[charting]]></category>

		<guid isPermaLink="false">http://jasonrowe.com/?p=1498</guid>
		<description><![CDATA[The last time I did any serious JavaScript was around the time Sizzle was added to JQuery, Google Chrome was brand new, and MarketWatch.com started using canvas charts. Note: Here is a quick overview of JavaScript that is as short &#8230; <a href="http://jasonrowe.com/2011/11/02/getting-back-into-javascript/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The last time I did any serious JavaScript was around the time Sizzle was added to JQuery, Google Chrome was brand new, and MarketWatch.com started using canvas charts.</p> 

<p><strong>Note:</strong> Here is a quick <a href="http://www.2ality.com/2011/10/javascript-overview.html">overview of JavaScript</a> that is as short as possible, but explains every major feature. I would also recommend following the <a href="http://www.2ality.com/">2ality</a> website</p>

<p>Today JavaScript projects have the complexity, size, and structure of projects written in languages like C# and Java. Thankfully, the developer tools for debugging and logging are solid across browsers. *<i>Opera is still a little funky about logging using &#8220;opera.postError.apply(opera, arguments);&#8221;</i>. Looking particularly good, <a href="http://code.google.com/chrome/devtools/">Google&#8217;s version of the webkit dev tools</a> and some API&#8217;s they have in <a href="http://code.google.com/chrome/extensions/dev/experimental.devtools.html">beta</a>. I’ve started to use <a href="http://docs.jquery.com/QUnit">quint</a> for unit testing. I’ve also been looking leveraging these frameworks: <a href="http://documentcloud.github.com/underscore/">underscore.js</a>, <a href="http://jashkenas.github.com/coffee-script/">coffee script</a>, <a href="http://raphaeljs.com/">raphaeljs</a>, and <a href="http://code.google.com/closure/compiler/">closure compiler</a>.</p> <p>It’s amazing how much has changed. Now <a href="https://developer.mozilla.org/en/JavaScript/Reference">examples of good JavaScript</a> are much easier to find. Hell, here is a step by step walkthrough of how to <a href="http://dailyjs.com/tags.html#lmaf">build your very own JavaScript framework</a>.</p> 

<p>So to get some practice I went and found some JS that needed cleanup. I wanted to focus on structure and namespaces and this <a href="http://www.elated.com/res/File/articles/development/javascript/snazzy-animated-pie-chart-html5-jquery/">script</a> needed some love. View source on that page and you will notice global variables and one big pile of code.</p> <p>The first thing I did was break up the logic into separate functional script files that will later be compiled and minified into one. You can see the python script I use to minify <a href="https://raw.github.com/JasonRowe/SimpleHTML5.Charts/master/build.py">here</a>.</p> 

<ol> 
<li><a href="https://github.com/JasonRowe/SimpleHTML5.Charts/blob/master/src/animation.js">animation.js</a></li> 
<li><a href="https://github.com/JasonRowe/SimpleHTML5.Charts/blob/master/src/builder.js">builder.js</a></li> 
<li><a href="https://github.com/JasonRowe/SimpleHTML5.Charts/blob/master/src/core.js">core.js</a></li> 
<li><a href="https://github.com/JasonRowe/SimpleHTML5.Charts/blob/master/src/pie.js">pie.js</a></li> 
<li><a href="https://github.com/JasonRowe/SimpleHTML5.Charts/blob/master/src/rendering.js">rendering.js</a></li> 
<li><a href="https://github.com/JasonRowe/SimpleHTML5.Charts/blob/master/src/styles.js">styles.js</a></li>
</ol> 

<p>I then added a <a href="https://github.com/JasonRowe/SimpleHTML5.Charts/tree/master/test">test folder</a> and setup the same file names but which had test cases for each script. Then an index.html file to display the test groups or “modules” as they are called in QUnit. Here is an example of a test that always passes</p> 

<pre class="brush: jscript; title: ; notranslate">
module(&quot;sample test&quot;);

test(&quot;a sample qunit test&quot;, function () {
    ok(true, &quot;always fine&quot;);
});

</pre>  

<p>The next thing I worked on was getting a namespace around the code. I went with the following which seems to work for my needs.</p> 

<pre class="brush: jscript; title: ; notranslate">
var SimpleHtml5 = SimpleHtml5 || {};

SimpleHtml5.namespace = function (ns_string) {
    'use strict';
    var parts = ns_string.split('.'), parent = SimpleHtml5, i;
    if (parts[0] === &quot;SimpleHtml5&quot;) {
        parts = parts.slice(1);
    }
    for (i = 0; i &lt; parts.length; i += 1) {
        if (typeof parent[parts[i]] === &quot;undefined&quot;) {
            parent[parts[i]] = {};
        }
        parent = parent[parts[i]];
    }
    return parent;
};

</pre>  

<p>Stefanov, Stoyan (2010). JavaScript Patterns (pp. 89-90). OReilly Media &#8211; A. Kindle Edition. </p>

<p>So after refactoring, I’ve got the pie chart setup code to the following.</p>

<pre class="brush: jscript; title: ; notranslate">
var pieElm = document.getElementById('pieChart');
var pieData = $('#chartData td');

var pieChart = new SimpleHtml5.Core.Pie(pieElm, pieData);

$('#pieChart').click (pieChart, SimpleHtml5.Pie.Animation.HandleChartClick);
</pre>

<p>To customize the style I allow passing in a custom style object to override the defaults.</p>

<pre class="brush: jscript; title: ; notranslate">

var customStyles = {
    chartSizePercent: 49,
    maxPullOutDistance: 10,
    pullOutFrameStep: 4,
    pullOutFrameInterval: 40,
    pullOutLabelPadding: 42
};

var pieElm = document.getElementById('pieChart');
var pieData = $('#chartData td');
var pieChart = new SimpleHtml5.Core.Pie(pieElm, pieData, customStyles);
$('#pieChart').click (pieChart, SimpleHtml5.Pie.Animation.HandleChartClick);
</pre>

<p>
If you are curious about how the other parts of the chart were organized you can see the source code on <a href="https://github.com/JasonRowe/SimpleHTML5.Charts">github</a>.
</p>

<p>

<blockquote>I can also be found on Google+

<a title="Jason Rowe is on Google+" rel="author" href="http://profiles.google.com/jasonrowe?rel=author" alt="Google+" title="Google+">Jason Rowe</a> and twitter <a title="Jason Rowe is on twitter" rel="author" href="http://twitter.com/jsonrow?rel=author" alt="twitter" title="twitter">@jsonrow</a>
</blockquote>


</p>

]]></content:encoded>
			<wfw:commentRss>http://jasonrowe.com/2011/11/02/getting-back-into-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Factory Pattern using Windsor and MVC</title>
		<link>http://jasonrowe.com/2011/07/15/factory-pattern-using-windsor-and-mvc/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=factory-pattern-using-windsor-and-mvc</link>
		<comments>http://jasonrowe.com/2011/07/15/factory-pattern-using-windsor-and-mvc/#comments</comments>
		<pubDate>Fri, 15 Jul 2011 21:56:56 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[Named]]></category>
		<category><![CDATA[Typed Factory]]></category>
		<category><![CDATA[Windsor]]></category>

		<guid isPermaLink="false">http://jasonrowe.com/?p=1477</guid>
		<description><![CDATA[I ran into a situation where I wanted to return a dynamically drawn image based on the file name . For example, if someone requested somedomain.com/image/legacypage42.foo the &#8220;legacypage42.foo&#8221; would be the name of the Windsor component used to draw the &#8230; <a href="http://jasonrowe.com/2011/07/15/factory-pattern-using-windsor-and-mvc/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[I ran into a situation where I wanted to return a dynamically drawn image based on the file name . For example, if someone requested somedomain.com/image/legacypage42.foo the &#8220;legacypage42.foo&#8221; would be the name of the Windsor component used to draw the image. The first thing I needed to do was change that page into a parameter which is very simple with MVC .net routing:

<pre class="brush: csharp; title: ; notranslate">  
routes.MapRoute(&quot;MyImageRoute&quot;,
                &quot;image/{filename}&quot;,
                new { controller = &quot;Images&quot;, action = &quot;Index&quot; });
</pre>

So now filename becomes the parameter in the controller. Now comes the tricky part. How to resolve a component in Windsor by name. Windsor does allow you to set the name using this syntax:

<pre class="brush: csharp; title: ; notranslate">  
kernel.Register(
    Component.For&lt;IMyImageComponent&gt;()
        .ImplementedBy&lt;MyImageComponent&gt;()
        .Named(&quot;SomeImage&quot;));
</pre>

Although, using that syntax is going to make for a nightmare if I have many different image components so I&#8217;ll use the built in <a href="http://docs.castleproject.org/Windsor.Typed-Factory-Facility-interface-based-factories.ashx">Windsor Type Factory</a>. The first step is to cleanly register all my image components setting the name. To do that I created an interface all my images will use so I can easily set the named value.

<pre class="brush: csharp; title: ; notranslate">  
Interface example:

    public interface IMyImageComponent
    {
        Bitmap BuildImage();

        string GetFileName();
    }
</pre>

Here is how I use the interface to setup my Windsor components and named values.

<pre class="brush: csharp; title: ; notranslate">  
var type = typeof(IMyImageComponent);
var styles = AppDomain.CurrentDomain.GetAssemblies().ToList()
        .SelectMany(s =&gt; s.GetTypes())
        .Where(type.IsAssignableFrom);

    foreach (var style in styles)
    {
        if (!style.IsClass || style.IsNotPublic || style.IsAbstract) 
            continue;

        object o = Activator.CreateInstance(style);
        var propertyInfo = style.GetMethod(&quot;GetFileName&quot;);
        var name = (string)propertyInfo.Invoke(o, null);
        container.Register(Component.For&lt;IMyImageComponent&gt;()
                    .ImplementedBy(o.GetType()).Named(name));
</pre>

If you want to use the power of Windsor inside your classes that implement IMyImageComponent. You could use the following instead. The only downside is you have to register the components twice in Windsor but only on the initial start up.

<pre class="brush: csharp; title: ; notranslate">  

container.Register(AllTypes.FromAssembly(typeof(YourClassNameHere).Assembly)
               .BasedOn&lt;IMyImageComponent&gt;());

var myImageStyles = container.ResolveAll&lt;IMyImageComponent&gt;();

var myImageTypes = myImageStyles .Select(style =&gt; style.GetType()).ToList();

foreach (var type in myImageTypes )
{
    object o = container.Resolve(type);
    var propertyInfo = type.GetMethod(&quot;GetFileName&quot;);
    var name = (string)propertyInfo.Invoke(o, null);
    container.Register(Component.For&lt;IMyImageComponent&gt;()
        .ImplementedBy(o.GetType()).Named(name));
}
</pre>

Here is how the factory was initialized:

<pre class="brush: csharp; title: ; notranslate">  
container.Register(Component.For&lt;ITypedFactoryComponentSelector&gt;()
         .ImplementedBy&lt;ImageStyleFactorySelector&gt;().Named(&quot;ImageStyleFactorySelector&quot;));

container.Register(Component.For&lt;IMyImageTemplateFactory&gt;()
         .AsFactory(c =&gt; c.SelectedWith(&quot;ImageStyleFactorySelector&quot;)));
</pre>

Notice I used a custom selector in the factory. This is used when the factory is looking up the components. Here is what the FactorySelector looks like.

<pre class="brush: csharp; title: ; notranslate">  
public class ImageStyleFactorySelector : DefaultTypedFactoryComponentSelector
{
   protected override string GetComponentName(MethodInfo method, object[] arguments)
   {
       if (method.Name == &quot;GetByFileName&quot; &amp;&amp; arguments.Length == 1 &amp;&amp; arguments[0] is string)
       {
           return arguments[0].ToString();
       }
       return base.GetComponentName(method, arguments);
   }
}
</pre>

Now inside the controller I use the factory with the function &#8220;GetByFileName&#8221; which uses the custom selector to find the component.

<pre class="brush: csharp; title: ; notranslate">   
var imageComponent = _ImageTemplateFactory.GetByFileName(fileName);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://jasonrowe.com/2011/07/15/factory-pattern-using-windsor-and-mvc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing Chart Color by Previous Close</title>
		<link>http://jasonrowe.com/2011/01/16/changing-chart-color-by-previous-close/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=changing-chart-color-by-previous-close</link>
		<comments>http://jasonrowe.com/2011/01/16/changing-chart-color-by-previous-close/#comments</comments>
		<pubDate>Mon, 17 Jan 2011 01:40:14 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[charting]]></category>
		<category><![CDATA[gRaphaël]]></category>

		<guid isPermaLink="false">http://jasonrowe.com/?p=1438</guid>
		<description><![CDATA[&#160; I frequently get asked how to create a chart in JavaScript that shows a different line color above and below the previous close price. Here is a example of what I mean. View this test page if you want &#8230; <a href="http://jasonrowe.com/2011/01/16/changing-chart-color-by-previous-close/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p> 

<p>I frequently get asked how to create a chart in JavaScript that shows a different line color above and below the previous close price. Here is a example of what I mean.</p> 

<p><a href="http://jasonrowe.com/wp-content/uploads/2011/01/final_example.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="final_example" border="0" alt="final_example" src="http://jasonrowe.com/wp-content/uploads/2011/01/final_example_thumb.png" width="244" height="177"></a></p> 

<p>View this <a href="http://jasonrowe.com/misc/chart/prevcloseline.html">test page</a> if you want skip the details and see a working example in JavaScript/SVG</p>

<p>At first glance, I’ve always thought this would be very easy and instructed them to create a new path depending on if the line is above or below the previous close line (the blue line in the image above). Simple enough right?</p> 

<p>It turns out I was missing a crucial step that might go unnoticed if you are using many data points. The problem turns up when using sparse data like the example shown above.</p> <p>Here is what it looks like if you do what I said literally.</p> <p><a href="http://jasonrowe.com/wp-content/uploads/2011/01/simple_start_broken.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="simple_start_broken" border="0" alt="simple_start_broken" src="http://jasonrowe.com/wp-content/uploads/2011/01/simple_start_broken_thumb.png" width="244" height="178"></a>&nbsp; </p> <p>&nbsp;</p> <p>That missing step I mentioned is connecting the new lines. Seems obvious now that I look at an example. So how will this be done? Here is an image showing the paths with labels for easy reference.</p> 

<p><a href="http://jasonrowe.com/wp-content/uploads/2011/01/simple_paths_connections.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="simple_paths_connections" border="0" alt="simple_paths_connections" src="http://jasonrowe.com/wp-content/uploads/2011/01/simple_paths_connections_thumb.png" width="244" height="179"></a></p> 

<p>What I have found works best is to find the intersection point between the paths and the previous close line. So you would create one line using the last point from path 1 and the first points from path2. The second line would just be the previous close line points. Unfortunately, just having the points is not enough to calculate the intersection.</p> 

<p>Below is the needed format and calculation. I created a function to do this in JS which is provided below but I wanted to include the <a href="http://www.topcoder.com/tc?module=Static&#038;d1=tutorials&#038;d2=geometry2">full explanation. </a></p> 
<blockquote>

Say we are given two different points, (x1, y1) and (x2, y2), and want to find A, B and C for the equation above. We can do so by setting

A = y2-y1
B = x1-x2
C = A*x1+B*y1

Regardless of how the lines are specified, you should be able to generate two different points along the line, and then generate A, B and C. Now, lets say that you have lines, given by the equations:

A1x + B1y = C1
A2x + B2y = C2

To find the point at which the two lines intersect, we simply need to solve the two equations for the two unknowns, x and y. 

 double det = A1*B2 &#8211; A2*B1
    if(det == 0){
        //Lines are parallel
    }else{
        double x = (B2*C1 &#8211; B1*C2)/det
        double y = (A1*C2 &#8211; A2*C1)/det
    }
</blockquote>


<p>Here is the full function in JS to create this format and find the intersection.</p> 



<pre class="brush: jscript; title: ; notranslate">
  //Line-Line Intersection
        var getXCrossing = function(p1x, p1y, p2x, p2y, marker, markerMaxX) {
               
                var retValX = 0;
                var retValY = 0;
               
                //graph lines
                var a1 = p2y - p1y;
                var b1 = p1x - p2x;
                var c1 = a1 * p1x + b1 * p1y;
                
                //marker line is always horizontal
                var a2 = marker - marker;
                var b2 = 0 - markerMaxX;
                var c2 = a2 * 0 + b2 * marker;
                
                var det = a1 * b2 - a2 * b1;
                
                if(det === 0)
                {
                    //Lines are parallel
                }
                else
                {
                    retValX = (b2 * c1 - b1 * c2) / det;
                    retValY = (a1 * c2 - a2 * c1) / det;
                }   
                
                return {
                        x: retValX,
                        y: retValY
                    };
                };
</pre>

<p>Here is a <a href="http://jasonrowe.com/misc/chart/prevcloseline.html">test page</a> which shows a working example in SVG using <a href="http://g.raphaeljs.com/">gRaphaël</a> JavaScript library.</p>
]]></content:encoded>
			<wfw:commentRss>http://jasonrowe.com/2011/01/16/changing-chart-color-by-previous-close/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

