<?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>Digital Moose Tracks</title>
	<atom:link href="http://digitalmoosetracks.com/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://digitalmoosetracks.com/blog</link>
	<description>.Net, MythTV and Me</description>
	<lastBuildDate>Mon, 08 Mar 2010 06:24:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Masterlock SpeedDial Padlock Review</title>
		<link>http://digitalmoosetracks.com/blog/masterlock-speeddial-padlock-review</link>
		<comments>http://digitalmoosetracks.com/blog/masterlock-speeddial-padlock-review#comments</comments>
		<pubDate>Mon, 08 Mar 2010 06:24:50 +0000</pubDate>
		<dc:creator>joshua</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://digitalmoosetracks.com/blog/masterlock-speeddial-padlock-review</guid>
		<description><![CDATA[I saw this lock at Walmart for $8 and couldn’t resist, since its so different than regular combination locks.&#160; Operation Operating the lock is amazingly simple and elegant.&#160; Rather than rotating the dial like a traditional lock you push it in the cardinal directions.&#160; This has two big benefits.&#160; Firstly it requires much less dexterity [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://digitalmoosetracks.com/blog/wp-content/uploads/2010/03/image.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://digitalmoosetracks.com/blog/wp-content/uploads/2010/03/image_thumb.png" width="404" height="404" /></a> </p>
<p>I saw this lock at Walmart for $8 and couldn’t resist, since its so different than regular combination locks.&#160; </p>
<h3>Operation</h3>
<p>Operating the lock is amazingly simple and elegant.&#160; Rather than rotating the dial like a traditional lock you push it in the cardinal directions.&#160; This has two big benefits.&#160; Firstly it requires much less dexterity to use then a traditional combination since you only have the be able to push the lock in 4 directions rather than be able to rotate the lock to 39 different angles.&#160; Secondly it allows you to enter even fairly long combinations in under 10 seconds.&#160; The lock is also user settable to any combination you want, in less than 30 seconds.&#160; (Assuming you don’t choose a 37 move combo or something)</p>
<h3>How it works</h3>
<p>The internals of the lock are truly clever.&#160; I won’t bother going over them since there is this nice <a href="http://toool.nl/Image:The_New_Master_Lock_Combination_Padlock_V2.0.pdf">pdf</a> that already does that.&#160; And there is this great <a href="http://toool.nl/images/e/e1/MhVisualizer_V2.0_p.swf">flash visualizer</a> that shows you how the internals of the lock work in operation.</p>
<h3>Security</h3>
<p>Because of the way the lock works there are only 7,501 states the internal mechanism can be in.&#160;&#160; So although there are lots, 4^8, combinations of length 8 all of them map to one of the 7,501 states.&#160; More troubling however is that a combination of length 8 may produced a state that is the same as a combination of length 4.&#160; The table below summarizes the probable ‘badness’ of combos of different lengths.&#160; It shows that combos of length 7 seem to be the sweet spot.</p>
<table border="0" rules="none" cellspacing="0" frame="void" cols="cols">
<colgroup>
<col width="84" />
<col width="79" />
<col width="143" />
<col width="132" />
<col width="111" /></colgroup>
<tbody>
<tr>
<td height="59" width="84" align="left">Number Of moves</td>
<td width="79" align="left">Combos</td>
<td width="143" align="left">Unique lock states not produced by smaller combos</td>
<td bgcolor="#ffff99" width="132" align="left" sdnum="1033;0;0.00%">% Bad Combos*</td>
<td width="111" align="left">Bad Combos*</td>
</tr>
<tr>
<td height="20" align="right" sdnum="1033;" sdval="11">11</td>
<td align="right" sdnum="1033;" sdval="4194304">4194304</td>
<td align="right" sdnum="1033;" sdval="104">104</td>
<td bgcolor="#ffff99" align="right" sdnum="1033;0;0.00%" sdval="0.0235204696655273">2.35%</td>
<td align="right" sdnum="1033;" sdval="98652">98652</td>
</tr>
<tr>
<td height="20" align="right" sdnum="1033;" sdval="10">10</td>
<td align="right" sdnum="1033;" sdval="1048576">1048576</td>
<td align="right" sdnum="1033;" sdval="708">708</td>
<td bgcolor="#ffff99" align="right" sdnum="1033;0;0.00%" sdval="0.0197334289550781">1.97%</td>
<td align="right" sdnum="1033;" sdval="20692">20692</td>
</tr>
<tr>
<td height="20" align="right" sdnum="1033;" sdval="9">9</td>
<td align="right" sdnum="1033;" sdval="262144">262144</td>
<td align="right" sdnum="1033;" sdval="1796">1796</td>
<td bgcolor="#ffff99" align="right" sdnum="1033;0;0.00%" sdval="0.013763427734375">1.38%</td>
<td align="right" sdnum="1033;" sdval="3608">3608</td>
</tr>
<tr>
<td height="20" align="right" sdnum="1033;" sdval="8">8</td>
<td align="right" sdnum="1033;" sdval="65536">65536</td>
<td align="right" sdnum="1033;" sdval="1984">1984</td>
<td bgcolor="#ffff99" align="right" sdnum="1033;0;0.00%" sdval="0.0068359375">0.68%</td>
<td align="right" sdnum="1033;" sdval="448">448</td>
</tr>
<tr>
<td height="20" align="right" sdnum="1033;" sdval="7">7</td>
<td align="right" sdnum="1033;" sdval="16384">16384</td>
<td align="right" sdnum="1033;" sdval="1448">1448</td>
<td bgcolor="#ffff99" align="right" sdnum="1033;0;0.00%" sdval="0.00341796875">0.34%</td>
<td align="right" sdnum="1033;" sdval="56">56</td>
</tr>
<tr>
<td height="20" align="right" sdnum="1033;" sdval="6">6</td>
<td align="right" sdnum="1033;" sdval="4096">4096</td>
<td align="right" sdnum="1033;" sdval="816">816</td>
<td bgcolor="#ffff99" align="right" sdnum="1033;0;0.00%" sdval="0.0263671875">2.64%</td>
<td align="right" sdnum="1033;" sdval="108">108</td>
</tr>
<tr>
<td height="20" align="right" sdnum="1033;" sdval="5">5</td>
<td align="right" sdnum="1033;" sdval="1024">1024</td>
<td align="right" sdnum="1033;" sdval="396">396</td>
<td bgcolor="#ffff99" align="right" sdnum="1033;0;0.00%" sdval="0.296875">29.69%</td>
<td align="right" sdnum="1033;" sdval="304">304</td>
</tr>
</tbody>
</table>
<p>*Bad combos mean a combination that can be open by another combination shorter than 5 moves.</p>
<p>Since all the combinations of length 4 or less can be tried in about 20 minutes, 249*5sec, having a combination that can be open with a combination of 4 or less opens you up to a brute force attack.&#160; Unfortunately these bad combos are not simple to recognize as such.&#160; For instance the combo up,up,right,up,down,down,left,right is the same as right,right,right,right.&#160; </p>
<h3>Conclusion</h3>
<p>Although there is a small chance, that you can accidently pick a bad combination for the advertised purpose of protecting a high school locker it should be more than adequate security and the easy of use is much better than a traditional lock.</p>
]]></content:encoded>
			<wfw:commentRss>http://digitalmoosetracks.com/blog/masterlock-speeddial-padlock-review/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Yay! PNGOUT – How to install on Dreamhost</title>
		<link>http://digitalmoosetracks.com/blog/yay-pngout-how-to-install-on-dreamhost</link>
		<comments>http://digitalmoosetracks.com/blog/yay-pngout-how-to-install-on-dreamhost#comments</comments>
		<pubDate>Sun, 13 Dec 2009 21:10:21 +0000</pubDate>
		<dc:creator>joshua</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://digitalmoosetracks.com/blog/yay-pngout-how-to-install-on-dreamhost</guid>
		<description><![CDATA[PNGOUT is a wonderful little utility written by …. (of Duke Nukem fame) that compresses PNG files by about 15%-20% on average.  Which if you have many PNG images in you website can make a small but noticeable difference in load times.  Although there are other similar utilities PNGOUT seems to be regarded as the [...]]]></description>
			<content:encoded><![CDATA[<p>PNGOUT is a wonderful little utility written by …. (of Duke Nukem fame) that compresses PNG files by about 15%-20% on average.  Which if you have many PNG images in you website can make a small but noticeable difference in load times.  Although there are other similar utilities PNGOUT seems to be regarded as the best so I decided to use it.  Since I already had a lot of images I wanted to compress on this blog I had to figure out a couple of things to easily compress them.</p>
<ol>
<li>I wanted to run PNGOUT on my webhost server since then I wouldn’t have to transfer the files back and forth to compress them.  Since Dreamhost has linux servers so that required finding a linux port of PNGOUT.  As and added benefit this should make it reasonably simple to make a cron job to compress all PNG images later.</li>
<li>I wanted to basically make it a one line command to compress all my PNG files so I had to figure out how to find all PNG images under a directory and run PNGOUT on them</li>
</ol>
<p>Nothing particularly complex so lets dive in.  Step one was easy as there is already a well know port of PNGOUT available although it took a bit of searching to find the <a href="http://www.jonof.id.au/pngout">download site</a>.  Now I just download the Linux  Dynamic zip, unzip it and load up the i386 executable to my home directory on my webhost. (Make sure to make it executable)</p>
<p>After testing to make sure pngout worked on a single file I set about finding how to do it on all PNG files under a directory.  Give that I am not a linux expert it was pretty easy as the find command let me do everything I wanted.</p>
<pre class="brush: bash;">find blog_directory -name *.png -exec ./pngout {} \;</pre>
<p>That will find anything under blog_directory that matches the naming pattern *.png and run pngout on it.  That was easy enough I may actual setup a cron job sometime.</p>
]]></content:encoded>
			<wfw:commentRss>http://digitalmoosetracks.com/blog/yay-pngout-how-to-install-on-dreamhost/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Where Ultra@VNC store its ‘host’ list</title>
		<link>http://digitalmoosetracks.com/blog/where-ultravnc-store-its-host-list</link>
		<comments>http://digitalmoosetracks.com/blog/where-ultravnc-store-its-host-list#comments</comments>
		<pubDate>Wed, 19 Aug 2009 19:40:40 +0000</pubDate>
		<dc:creator>joshua</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[ultravnc]]></category>

		<guid isPermaLink="false">http://digitalmoosetracks.com/blog/where-ultravnc-store-its-host-list</guid>
		<description><![CDATA[Short answer HKCU\Software\ORL\VNCviewer\MRU Long answer In UltraVNC it keeps a list of the host you connected to before in its little drop down. Over time it tends get cluttered with one time use entries making it more difficult to pick the right one.&#160; After it became enough of a burden I opened up Process Monitor [...]]]></description>
			<content:encoded><![CDATA[<p>Short answer </p>
<p>HKCU\Software\ORL\VNCviewer\MRU</p>
<p>Long answer </p>
<p>In <a href="http://www.uvnc.com/">UltraVNC</a> it keeps a list of the host you connected to before in its little drop down.</p>
<p><a href="http://digitalmoosetracks.com/blog/wp-content/uploads/2009/08/image1.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://digitalmoosetracks.com/blog/wp-content/uploads/2009/08/image_thumb1.png" width="644" height="220" /></a> </p>
<p>Over time it tends get cluttered with one time use entries making it more difficult to pick the right one.&#160; After it became enough of a burden I opened up <a href="http://technet.microsoft.com/en-gb/sysinternals/bb896645.aspx">Process Monitor</a> to see what I could see.</p>
<p><a href="http://digitalmoosetracks.com/blog/wp-content/uploads/2009/08/image2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://digitalmoosetracks.com/blog/wp-content/uploads/2009/08/image_thumb2.png" width="644" height="89" /></a> </p>
</p>
<p>After dialing in the filtering so I was only looking at vncviewer.exe I can see its writing to the registry in a directory called setting – that sounds promising.&#160; Opening that up and routing around a bit reveals this.</p>
<p><a href="http://digitalmoosetracks.com/blog/wp-content/uploads/2009/08/image3.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://digitalmoosetracks.com/blog/wp-content/uploads/2009/08/image_thumb3.png" width="644" height="241" /></a> </p>
<p>Which looks suspiciously like the dropdown.&#160; Basically you have some name/value pairs for the host names.&#160;&#160; And index specifces their order.&#160; And you can just delete any entries you want provided you also remove it from index.</p>
<p>And now I can sit back and enjoy my clutter free pull down.</p>
]]></content:encoded>
			<wfw:commentRss>http://digitalmoosetracks.com/blog/where-ultravnc-store-its-host-list/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I love DataTemplates</title>
		<link>http://digitalmoosetracks.com/blog/i-love-datatemplates</link>
		<comments>http://digitalmoosetracks.com/blog/i-love-datatemplates#comments</comments>
		<pubDate>Tue, 18 Aug 2009 21:43:23 +0000</pubDate>
		<dc:creator>joshua</dc:creator>
				<category><![CDATA[Programing]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://digitalmoosetracks.com/blog/i-love-datatemplates</guid>
		<description><![CDATA[I have been playing around with WPF and  started writing a little game to experiment with.   So far I think my favorite thing about WPF has been data templates.  I defined a data template for a Gem Card, one of the game pieces. &#60;DataTemplate DataType="{x:Type game:GemCard}"&#62; &#60;Border Style="{DynamicResource CardBorder}" Background="Green"&#62; &#60;Border Style="{DynamicResource CardHighlight}"&#62; &#60;Grid&#62; &#60;Label [...]]]></description>
			<content:encoded><![CDATA[<p>I have been playing around with WPF and  started writing a little game to experiment with.   So far I think my favorite thing about WPF has been data templates.  I defined a data template for a Gem Card, one of the game pieces.</p>
<pre class="brush: xml;">&lt;DataTemplate DataType="{x:Type game:GemCard}"&gt;
    &lt;Border Style="{DynamicResource CardBorder}" Background="Green"&gt;
    &lt;Border Style="{DynamicResource CardHighlight}"&gt;
        &lt;Grid&gt;
            &lt;Label Content="{Binding Value}" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5" FontSize="18.667"/&gt;
            &lt;Label Content="{Binding Value}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="5" FontSize="18.667"/&gt;
            &lt;Path Stretch="Fill" Stroke="Black" Data="m0,0 l1,1 -1,1 -1,-1z" Fill="Red" HorizontalAlignment="Center" VerticalAlignment="Center" Width="40" Height="60"/&gt;
            &lt;Label Content="{Binding Gems}" FontSize="18.667" HorizontalAlignment="Center" VerticalAlignment="Center"/&gt;
        &lt;/Grid&gt;
    &lt;/Border&gt;
    &lt;/Border&gt;
&lt;/DataTemplate&gt;</pre>
<p>And when I put a GemCard in a content control in my game it looks something like this</p>
<p><a href="http://digitalmoosetracks.com/blog/wp-content/uploads/2009/08/image.png"><img style="border: 0pt none; display: inline;" title="image" src="http://digitalmoosetracks.com/blog/wp-content/uploads/2009/08/image_thumb.png" border="0" alt="image" /></a></p>
<p>I like this approach a lot because I can just tell WPF how I want my classes to be presented and then I can just start putting them in listboxes with out having to worry about how the will look.</p>
]]></content:encoded>
			<wfw:commentRss>http://digitalmoosetracks.com/blog/i-love-datatemplates/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>List.Pop</title>
		<link>http://digitalmoosetracks.com/blog/list-pop</link>
		<comments>http://digitalmoosetracks.com/blog/list-pop#comments</comments>
		<pubDate>Thu, 06 Aug 2009 05:06:45 +0000</pubDate>
		<dc:creator>joshua</dc:creator>
				<category><![CDATA[Programing]]></category>

		<guid isPermaLink="false">http://digitalmoosetracks.com/blog/list-pop</guid>
		<description><![CDATA[I started writing a little WPF card game and kept coming up against having to remove and store an item from the list – essentially a pop operation.&#160; So I wrote the following extension method. public static class ListPopper { public static T Pop&#60;T&#62;(this IList&#60;T&#62; list) { T value = list.FirstOrDefault(); list.Remove(value); return value; } [...]]]></description>
			<content:encoded><![CDATA[<p>I started writing a little WPF card game and kept coming up against having to remove and store an item from the list – essentially a pop operation.&#160; So I wrote the following extension method.</p>
<pre class="brush: csharp;">public static class ListPopper
{
    public static T Pop&lt;T&gt;(this IList&lt;T&gt; list)
    {
        T value = list.FirstOrDefault();

        list.Remove(value);

        return value;
    }
}</pre>
<p>I eventually decided to switch to a Stack for the card game – but I think the extension method may come in handy for other projects.</p>
]]></content:encoded>
			<wfw:commentRss>http://digitalmoosetracks.com/blog/list-pop/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>F# Active Patterns as function parameters</title>
		<link>http://digitalmoosetracks.com/blog/f-active-patterns-as-function-parameters</link>
		<comments>http://digitalmoosetracks.com/blog/f-active-patterns-as-function-parameters#comments</comments>
		<pubDate>Thu, 23 Jul 2009 23:33:09 +0000</pubDate>
		<dc:creator>joshua</dc:creator>
				<category><![CDATA[Programing]]></category>
		<category><![CDATA[F#]]></category>

		<guid isPermaLink="false">http://digitalmoosetracks.com/blog/f-active-patterns-as-function-parameters</guid>
		<description><![CDATA[When I first learned about active patterns in F# I thought they were pretty great.  Then I saw you this F# video and learned you can patterns as function parameters.  This lets you do stuff like the following. (note I stole the example from this F# video) open System.Drawing let (&#124;RGB&#124;) (color : Color) = [...]]]></description>
			<content:encoded><![CDATA[<p>When I first learned about active patterns in F# I thought they were pretty great.  Then I saw you <a href="http://channel9.msdn.com/posts/kmcgrath/Patterns-and-Match-Expressions-in-F/">this F# video</a> and learned you can patterns as function parameters.  This lets you do stuff like the following. (note I stole the example from <a href="http://channel9.msdn.com/posts/kmcgrath/Active-Patterns-F/">this F# video</a>)</p>
<pre class="brush: scala;">open System.Drawing

let (|RGB|) (color : Color) = (color.R, color.G, color.B)

let printRGB (RGB(r, g, b)) =
    printfn "%d, %d, %d" r g b

printRGB Color.Red</pre>
<p>I find this especially cool because I often have a wrapper function to do this sort of data transformation and this is far more elegant.</p>
]]></content:encoded>
			<wfw:commentRss>http://digitalmoosetracks.com/blog/f-active-patterns-as-function-parameters/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WPF Transparent Window With Resizing</title>
		<link>http://digitalmoosetracks.com/blog/wpf-transparent-window-with-resizing</link>
		<comments>http://digitalmoosetracks.com/blog/wpf-transparent-window-with-resizing#comments</comments>
		<pubDate>Fri, 17 Jul 2009 19:51:41 +0000</pubDate>
		<dc:creator>joshua</dc:creator>
				<category><![CDATA[Programing]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://digitalmoosetracks.com/blog/?p=76</guid>
		<description><![CDATA[When I was playing with the FlicScannerWedge Clone I wrote I decided I wanted to make the window look like a barcode cause that would be cool looking.  Plus hey its WPF so it should be able to do something like this. So I found this cool looking image to use as the window background. [...]]]></description>
			<content:encoded><![CDATA[<p>When I was playing with the FlicScannerWedge Clone I wrote I decided I wanted to make the window look like a barcode cause that would be cool looking.  Plus hey its WPF so it should be able to do something like this. So I found this cool looking image to use as the window background.</p>
<p><a href="http://digitalmoosetracks.com/blog/wp-content/uploads/2009/07/Barcode.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Barcode" src="http://digitalmoosetracks.com/blog/wp-content/uploads/2009/07/Barcode_thumb.png" border="0" alt="Barcode" width="260" height="189" /></a></p>
<p>So I set it as the background and make the window style none and allow transparency and I get the following</p>
<p><a href="http://digitalmoosetracks.com/blog/wp-content/uploads/2009/07/image3.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" src="http://digitalmoosetracks.com/blog/wp-content/uploads/2009/07/image_thumb3.png" border="0" alt="image" width="244" height="165" /></a></p>
<p>Bamm!! I was pretty excite that it was so easy but then I went to resize the window and no joy <img src='http://digitalmoosetracks.com/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> .  So I ask Google how to handle this and find Kirupa Chinnathambi’s <a href="http://blog.kirupa.com/">blog</a> where he shows you how to do this.  The way his example works is by creating a bunch of transparent ‘handles’ around they boarder of your window and then handling some mouse events to do the resizing.  Here’s how my window looks with the handles colored in.</p>
<p><a href="http://digitalmoosetracks.com/blog/wp-content/uploads/2009/07/image4.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" src="http://digitalmoosetracks.com/blog/wp-content/uploads/2009/07/image_thumb4.png" border="0" alt="image" width="244" height="165" /></a></p>
<p>So I go through the steps and it resizing and am happy.  Since Kipupa’s was presented more as a proof of concept I pulled out the resizing logic into a base class and did a little refactoring.  The refactoring I liked the most was using Enum,Parse and a dictionary  to replace a switch statement. Turning this</p>
<pre class="brush: csharp;">private void Resize(object sender, MouseEventArgs e)
{
    Rectangle clickedRectangle = sender as Rectangle;
    ResizeDirection direction = ResizeDirection.Top;

    switch (clickedRectangle.Name)
    {
        case "top":
            this.Cursor = Cursors.SizeNS;
            direction = ResizeDirection.Top;
            break;
        case "bottom":
            this.Cursor = Cursors.SizeNS;
            direction = ResizeDirection.Bottom;
            break;
        case "left":
            this.Cursor = Cursors.SizeWE;
            direction = ResizeDirection.Left;
            break;
        case "right":
            this.Cursor = Cursors.SizeWE;
            direction = ResizeDirection.Right;
            break;
        case "topLeft":
            this.Cursor = Cursors.SizeNWSE;
            direction = ResizeDirection.TopLeft;
            break;
        case "topRight":
            this.Cursor = Cursors.SizeNESW;
            direction = ResizeDirection.TopRight;
            break;
        case "bottomLeft":
            this.Cursor = Cursors.SizeNESW;
            direction = ResizeDirection.BottomLeft;
            break;
        case "bottomRight":
            this.Cursor = Cursors.SizeNWSE;
            direction = ResizeDirection.BottomRight;
            break;
        default:
            break;
    }

    if (e.LeftButton == MouseButtonState.Pressed)
        ResizeWindow(direction);
}</pre>
<p>in to this</p>
<pre class="brush: csharp;">private Dictionary&lt;ResizeDirection, Cursor&gt; cursors = new Dictionary&lt;ResizeDirection, Cursor&gt;
{
    {ResizeDirection.Top, Cursors.SizeNS},
    {ResizeDirection.Bottom, Cursors.SizeNS},
    {ResizeDirection.Left, Cursors.SizeWE},
    {ResizeDirection.Right, Cursors.SizeWE},
    {ResizeDirection.TopLeft, Cursors.SizeNWSE},
    {ResizeDirection.BottomRight, Cursors.SizeNWSE},
    {ResizeDirection.TopRight, Cursors.SizeNESW},
    {ResizeDirection.BottomLeft, Cursors.SizeNESW}
};

private static ResizeDirection GetDirectionFromName(string name)
{
    //Hack - Assumes the drag handels are all named *DragHandle
    string enumName = name.Replace("DragHandle", "");
    return (ResizeDirection)Enum.Parse(typeof(ResizeDirection), enumName);
}

protected void ResizeIfPressed(object sender, MouseEventArgs e)
{
    FrameworkElement element = sender as FrameworkElement;
    ResizeDirection direction = GetDirectionFromName(element.Name);

    this.Cursor = cursors[direction];

    if (e.LeftButton == MouseButtonState.Pressed)
        ResizeWindow(direction);
}</pre>
<p>Which is a little smaller and more readable IMHO – although probably slower. Here is the source.</p>
<p><a href="http://digitalmoosetracks.com/blog/wp-content/uploads/2009/07/FlicScannerWedge.zip">Flic Scanner Wedge Source Code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://digitalmoosetracks.com/blog/wpf-transparent-window-with-resizing/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Umm &#8230; Lazy</title>
		<link>http://digitalmoosetracks.com/blog/umm-lazy</link>
		<comments>http://digitalmoosetracks.com/blog/umm-lazy#comments</comments>
		<pubDate>Thu, 28 May 2009 23:23:13 +0000</pubDate>
		<dc:creator>joshua</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://digitalmoosetracks.com/blog/umm-lazy</guid>
		<description><![CDATA[I currently remote desktoping into a computer approximately 2 feet in front of me so I don&#8217;t have to lean to the left to grab the keyboard.&#160;&#160; Its little moments like this when you remember why you love technology]]></description>
			<content:encoded><![CDATA[<p>I currently remote desktoping into a computer approximately 2 feet in front of me so I don&#8217;t have to lean to the left to grab the keyboard.&nbsp;&nbsp; Its little moments like this when you remember why you love technology <img src='http://digitalmoosetracks.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://digitalmoosetracks.com/blog/umm-lazy/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom LIRC remote config doesn&#8217;t work in Mythbuntu 9.04</title>
		<link>http://digitalmoosetracks.com/blog/custom-lirc-remote-config-doesnt-work-in-mythbuntu-904</link>
		<comments>http://digitalmoosetracks.com/blog/custom-lirc-remote-config-doesnt-work-in-mythbuntu-904#comments</comments>
		<pubDate>Fri, 08 May 2009 18:18:01 +0000</pubDate>
		<dc:creator>joshua</dc:creator>
				<category><![CDATA[MythTV]]></category>

		<guid isPermaLink="false">http://digitalmoosetracks.com/blog/custom-lirc-remote-config-doesnt-work-in-mythbuntu-904</guid>
		<description><![CDATA[I just reinstalled my mythbox and had some trouble with getting LRIC to work.&#160; It turns out that in the new Mythbuntu in the lircd.conf file you need to have quotes around the path to the remote file you want to include. i.e. you want to have include &#8220;/usr/share/lirc/remotes/one-for-all/lircd.conf.6131n&#8221; NOT! include /usr/share/lirc/remotes/one-for-all/lircd.conf.6131n Hopefully this spares [...]]]></description>
			<content:encoded><![CDATA[<p>I just reinstalled my mythbox and had some trouble with getting LRIC to work.&nbsp; It turns out that in the new Mythbuntu in the lircd.conf file you need to have quotes around the path to the remote file you want to include.</p>
<p>i.e. you want to have</p>
<p>include &#8220;/usr/share/lirc/remotes/one-for-all/lircd.conf.6131n&#8221;
<p><strong>NOT!</strong></p>
<p>include /usr/share/lirc/remotes/one-for-all/lircd.conf.6131n
<p>Hopefully this spares some one some grief.</p>
]]></content:encoded>
			<wfw:commentRss>http://digitalmoosetracks.com/blog/custom-lirc-remote-config-doesnt-work-in-mythbuntu-904/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Verizon Mandatory Data</title>
		<link>http://digitalmoosetracks.com/blog/verizon-mandatory-data</link>
		<comments>http://digitalmoosetracks.com/blog/verizon-mandatory-data#comments</comments>
		<pubDate>Fri, 10 Apr 2009 21:40:01 +0000</pubDate>
		<dc:creator>joshua</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[cell phone]]></category>
		<category><![CDATA[verizon]]></category>

		<guid isPermaLink="false">http://digitalmoosetracks.com/blog/verizon-mandatory-data</guid>
		<description><![CDATA[First let me give you a little back story.  My mother has a Motorola Q from Verizon she got about two years ago. She doesn&#8217;t surf the web or anything so she got the pay as you go data plan.   She just uses it for a phone and to run a small booklist app I [...]]]></description>
			<content:encoded><![CDATA[<p>First let me give you a little back story.  My mother has a Motorola Q from Verizon she got about two years ago. <a href="http://digitalmoosetracks.com/blog/wp-content/uploads/2009/04/image.png"><img style="margin: 5px 10px 0px 0px; border: 0px;" src="http://digitalmoosetracks.com/blog/wp-content/uploads/2009/04/image-thumb.png" border="0" alt="image" width="225" height="244" align="left" /></a> She doesn&#8217;t surf the web or anything so she got the pay as you go data plan.   She just uses it for a phone and to run a small booklist app I wrote for her.  This worked out pretty well for her as now she only has the one device to carry around, where as she used to forget to bring the PDA on book shopping trips.  So everything is good and my mom is real happy with the experience, so far so good.</p>
<p>Fastforward two years to the present time and its now time to get a new phone.  As the family geek I start looking into what would be the best new smartphone to get. So I start looking into the latest and greatest from Verizon and find that they have instituted a <a href="http://www.boygeniusreport.com/2008/11/13/additional-details-about-verizons-mandatory-data-plans-emerge/">new policy</a> requiring all smart phones introduced after November first 2009 to have either a $29.99 or $45.99 per month data plan!  This would almost double my mother&#8217;s phone bill with no visible benefit to her.  Although I respect the fact the Verizon has the right to do what every it wants with it pricing policy this really sucks for my mother and effectively means she&#8217;ll never be able to upgrade to a new smartphone again as long as she stays on Verizon.</p>
<p>So I call up Verizon customer support to try to get full details on the new policy.(Props to Verizon here the support guy was really good and understood the issue straight away and answered all my questions)  He confirmed that there are only three newer phones that can still uses the pay as you go plan, two new versions of the Q and a Samsung model.  And that my mother could buy one of those and add it no problems so she&#8217;ll be able to upgrade one last time this year.  Although Verizon doesn&#8217;t sell them any more as far as I could tell making here $100 NE2 bonus worthless to her.</p>
<p>Asking why Verizon was implementing this new policy he gave me the company line that the new phones were designed so they will download information for the internet for weather and such automatically and so the new policy was designed to protect the customer from overage charges.  Now I don&#8217;t really believe this is true but assuming it is why couldn&#8217;t they have just include an option to block all data access instead of requiring a data plan?  This is an option they have for all there phones so its not a technical limitation.</p>
<p>Here are the reasons I think Verizon is implementing this policy and alternative solutions I think they could implement that I think better respect the customers ability to choose.</p>
<ol>
<li>Verizon doesn&#8217;t want to give people cheap smartphones if it isn&#8217;t going to make up the money with the data plan
<ol>
<li>Only give the smartphone discount if you buy a data plan and stay on for a given length of time.  My mother would be willing to spend the $400-$500 for a smartphone if she had to.  Better that than spend $360 a year for a service she doesn&#8217;t need.</li>
</ol>
</li>
<li>Verizon apparently had a lot of issues with people choosing the pay as you go plan and then being surprised with the huge charges they got.
<ol>
<li>Verizon could give customers one month of a free data plan if they sign up with the pay as you go option  and in the bill show them what it would have cost with pay as you go.  If the customer doesn&#8217;t switch they are responsible for whatever charges happen no if and or butts.  Obviously this would cost some money on Verizon&#8217;s part for the &#8216;free&#8217; month but they seem to run these sorts of ploys to try to rope you into other services such as their TV service so I don&#8217;t think it would be a huge issue for them.</li>
<li>Verizon could require that you either have a data plan or you get data blocked.  Ergo no surprises with pay as you go charges.</li>
</ol>
</li>
<li>Verizon apparently had a lot of issues with people returning smartphones after they bought them without data plans as they didn&#8217;t realize all the neat features required data access or what not.
<ol>
<li>Verizon could charge a additional restocking fee for a smartphone if you either cancel the contract or &#8216;downgrade&#8217; to a regular phone.  That should ameliorate any costs associated with returned smartphones.</li>
</ol>
</li>
</ol>
<p>Although my mom has always been happy with Verizon&#8217;s service and coverage this new policy has her strongly considering moving to another carrier.  And this is despite all in network benefits she gets since the rest of the family is also with Verizon.  I hope Verizon will retract this policy and replace it with something more customer friendly.</p>
]]></content:encoded>
			<wfw:commentRss>http://digitalmoosetracks.com/blog/verizon-mandatory-data/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
