<?xml version="1.0" encoding="utf-8"?>
<feed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom">
  <title>Confessions of a .NET Code Monkey</title>
  <link rel="alternate" type="text/html" href="http://puurunen.ca/" />
  <link rel="self" href="http://puurunen.ca/SyndicationService.asmx/GetAtom" />
  <icon>favicon.ico</icon>
  <updated>2010-09-01T13:24:54.5977614-07:00</updated>
  <author>
    <name>2009 Elias Puurunen</name>
  </author>
  <subtitle>Elias Puurunen's adventures in the new .NET world.</subtitle>
  <id>http://puurunen.ca/</id>
  <generator uri="http://dasblog.info/" version="2.3.9074.18820">DasBlog</generator>
  <entry>
    <title>PodTower 1.0 Released!</title>
    <link rel="alternate" type="text/html" href="http://puurunen.ca/2010/09/01/PodTower10Released.aspx" />
    <id>http://puurunen.ca/PermaLink,guid,25a00255-7774-46ce-b07c-275be6fcf99e.aspx</id>
    <published>2010-09-01T13:24:54.5977614-07:00</published>
    <updated>2010-09-01T13:24:54.5977614-07:00</updated>
    <category term="Coding" label="Coding" scheme="http://puurunen.ca/CategoryView,category,Coding.aspx" />
    <category term="My Life" label="My Life" scheme="http://puurunen.ca/CategoryView,category,MyLife.aspx" />
    <category term="PodTower" label="PodTower" scheme="http://puurunen.ca/CategoryView,category,PodTower.aspx" />
    <category term="Silverlight" label="Silverlight" scheme="http://puurunen.ca/CategoryView,category,Silverlight.aspx" />
    <author>
      <name>Elias</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://puurunen.ca/content/binary/WindowsLiveWriter/PodTower1.0Released_E6BF/PodTower_2.png">
            <img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="PodTower" border="0" alt="PodTower" src="http://puurunen.ca/content/binary/WindowsLiveWriter/PodTower1.0Released_E6BF/PodTower_thumb.png" width="240" height="59" />
          </a>
        </p>
        <p>
It is my pleasure to unveil to the world version 1.0 of the almighty PodTower podcatcher!
Over the past while I’ve been reworking the internals of PodTower to add new features,
make it more maintainable, and just overall a better application. Today is the realization
of all that work.
</p>
        <p>
Some of the new features/fixes in PodTower 1.0 include…
</p>
        <ul>
          <li>
Remove podcast now a menu item 
</li>
          <li>
Added a new add-podcast window 
</li>
          <li>
Added general download progress indicator 
</li>
          <li>
Storing of configuration outside of isolated storage 
</li>
          <li>
Podcasts now stored in User/My Music/PodTower Podcasts, along with config 
</li>
          <li>
Ability to update individual or all podcasts at once 
</li>
          <li>
Removed "toast" notifications for now 
</li>
          <li>
General stability issues 
</li>
        </ul>
        <p>
And of course, the action shots…
</p>
        <p>
          <img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="PodTower-v1.0-1" border="0" alt="PodTower-v1.0-1" src="http://puurunen.ca/content/binary/WindowsLiveWriter/PodTower1.0Released_E6BF/PodTower-v1.0-1_3.png" width="652" height="470" />
        </p>
        <p align="center">
          <em>PodTower’s new overall download indication – akin to what FireFox does</em>
        </p>
        <p align="center">
          <img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="PodTower-v1.0-2" border="0" alt="PodTower-v1.0-2" src="http://puurunen.ca/content/binary/WindowsLiveWriter/PodTower1.0Released_E6BF/PodTower-v1.0-2_3.png" width="652" height="470" />
        </p>
        <p align="center">
          <em>The new add podcast window.</em>
        </p>
        <p align="center">
          <img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="PodTower-v1.0-4" border="0" alt="PodTower-v1.0-4" src="http://puurunen.ca/content/binary/WindowsLiveWriter/PodTower1.0Released_E6BF/PodTower-v1.0-4_3.png" width="620" height="392" />
        </p>
        <p align="center">
          <em>The new update command for individual podcasts.</em> 
</p>
        <p>
        </p>
        <p>
So head over to <a href="http://silverfinn.net/podtower">the new PodTower site</a> and
go download PodTower! If you like it, tell a friend! Spread the word!
</p>
        <img width="0" height="0" src="http://puurunen.ca/aggbug.ashx?id=25a00255-7774-46ce-b07c-275be6fcf99e" />
      </div>
    </content>
  </entry>
  <entry>
    <title>PodTower Site Refresh</title>
    <link rel="alternate" type="text/html" href="http://puurunen.ca/2010/09/01/PodTowerSiteRefresh.aspx" />
    <id>http://puurunen.ca/PermaLink,guid,4485f63a-dd3e-418e-80ea-365c57abe8b9.aspx</id>
    <published>2010-08-31T22:13:54.2541149-07:00</published>
    <updated>2010-08-31T22:13:54.2541149-07:00</updated>
    <category term="Coding" label="Coding" scheme="http://puurunen.ca/CategoryView,category,Coding.aspx" />
    <category term="PodTower" label="PodTower" scheme="http://puurunen.ca/CategoryView,category,PodTower.aspx" />
    <author>
      <name>Elias</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="PodTowerHeader" border="0" alt="PodTowerHeader" src="http://puurunen.ca/content/binary/WindowsLiveWriter/PodTowerSiteRefresh_1132/PodTowerHeader_3.png" width="576" height="128" />
        </p>
        <p>
I’ve refreshed the site for PodTower – head over to the <a href="http://silverfinn.net/podtower">PodTower
Site</a> to check it out. Note that it’s now under the guise of SilverFinn – my new,
professional blog. There’s a new version of PodTower on the vanguard, so look out
for it.
</p>
        <p align="center">
          <a href="http://silverfinn.net/podtower">
            <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="PodTower Site" border="0" alt="PodTower Site" src="http://puurunen.ca/content/binary/WindowsLiveWriter/PodTowerSiteRefresh_1132/PodTower-64_5.png" width="64" height="64" />
          </a>
        </p>
        <img width="0" height="0" src="http://puurunen.ca/aggbug.ashx?id=4485f63a-dd3e-418e-80ea-365c57abe8b9" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Introducing: Elias’ WPF Libraries!</title>
    <link rel="alternate" type="text/html" href="http://puurunen.ca/2010/06/21/IntroducingEliasWPFLibraries.aspx" />
    <id>http://puurunen.ca/PermaLink,guid,85c27472-1750-4eba-8dd4-909e76bb9d3f.aspx</id>
    <published>2010-06-20T19:19:02.155153-07:00</published>
    <updated>2010-06-20T19:19:02.155153-07:00</updated>
    <category term="Coding" label="Coding" scheme="http://puurunen.ca/CategoryView,category,Coding.aspx" />
    <category term="WPF" label="WPF" scheme="http://puurunen.ca/CategoryView,category,WPF.aspx" />
    <author>
      <name>Elias</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Over the past while I’ve found that I’ve been writing code for myself over and over
again to do a bunch of generic tasks in WPF (drag and drop, etc). So, I’ve decided
to combine all this generic code into a project called Elias’ WPF Libraries!
</p>
        <p>
Head over to <a title="http://eliaswpflibs.codeplex.com/" href="http://eliaswpflibs.codeplex.com/">http://eliaswpflibs.codeplex.com/</a> to
check it out.
</p>
        <img width="0" height="0" src="http://puurunen.ca/aggbug.ashx?id=85c27472-1750-4eba-8dd4-909e76bb9d3f" />
      </div>
    </content>
  </entry>
  <entry>
    <title>PodTower Updated (Yet Again)</title>
    <link rel="alternate" type="text/html" href="http://puurunen.ca/2010/06/03/PodTowerUpdatedYetAgain.aspx" />
    <id>http://puurunen.ca/PermaLink,guid,114a97ff-e541-4bb4-9200-78fbf266d63c.aspx</id>
    <published>2010-06-02T18:01:41.2754174-07:00</published>
    <updated>2010-06-02T18:01:41.2754174-07:00</updated>
    <category term="Coding" label="Coding" scheme="http://puurunen.ca/CategoryView,category,Coding.aspx" />
    <category term="My Life" label="My Life" scheme="http://puurunen.ca/CategoryView,category,MyLife.aspx" />
    <category term="PodTower" label="PodTower" scheme="http://puurunen.ca/CategoryView,category,PodTower.aspx" />
    <category term="Silverlight" label="Silverlight" scheme="http://puurunen.ca/CategoryView,category,Silverlight.aspx" />
    <author>
      <name>Elias</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p align="center">
 <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="PodTower" border="0" alt="PodTower" src="http://puurunen.ca/content/binary/WindowsLiveWriter/PodTowerUpdatedYetAgain_12777/PodTower_3.png" width="322" height="79" /><br />
a podfetcher, sucking less, one day at a time.
</p>
        <p>
Today, I’ve done a little more work on PodTower. It’s addictive, I tell you.
</p>
        <p>
          <img style="display: block; float: none; margin-left: auto; margin-right: auto" src="http://puurunen.ca/content/binary/WindowsLiveWriter/PodTower_11861/image_3.png" />
        </p>
        <p>
          <strong>New Features</strong>
        </p>
        <ul>
          <li>
            <strong>Pause, Stop, Next Track, Previous Track</strong>
            <ul>
              <li>
Mandatory features of any playback client 
</li>
            </ul>
          </li>
          <li>
            <strong>Volume Control</strong>
            <ul>
              <li>
Another obvious omission 
</li>
            </ul>
          </li>
        </ul>
        <p>
          <strong>Coming Next</strong>
        </p>
        <p>
I’ve ordered a code certificate for myself, so in the next few days PodTower will
be signed, which will enable automatic updates, along with giving you a warm fuzzy
feeling when you run PodTower, knowing it’s a trusted, signed app. Hopefully that’ll
also prove that I actually care about PodTower (and you, the user).
</p>
        <p>
Additional features from this point? Setting the download directory. After that, who
knows. Leave a comment and let me know what <em>you’d</em> like to see in PodTower!
</p>
        <img width="0" height="0" src="http://puurunen.ca/aggbug.ashx?id=114a97ff-e541-4bb4-9200-78fbf266d63c" />
      </div>
    </content>
  </entry>
  <entry>
    <title>PodTower</title>
    <link rel="alternate" type="text/html" href="http://puurunen.ca/2010/06/02/PodTower.aspx" />
    <id>http://puurunen.ca/PermaLink,guid,4bee440d-c492-4060-a491-74cc280b7f04.aspx</id>
    <published>2010-06-01T18:07:02.817-07:00</published>
    <updated>2010-06-02T18:07:34.1164493-07:00</updated>
    <category term="Coding" label="Coding" scheme="http://puurunen.ca/CategoryView,category,Coding.aspx" />
    <category term="My Life" label="My Life" scheme="http://puurunen.ca/CategoryView,category,MyLife.aspx" />
    <category term="PodTower" label="PodTower" scheme="http://puurunen.ca/CategoryView,category,PodTower.aspx" />
    <category term="Silverlight" label="Silverlight" scheme="http://puurunen.ca/CategoryView,category,Silverlight.aspx" />
    <author>
      <name>Elias</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p align="center">
          <img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="PodTower" alt="PodTower" src="http://puurunen.ca/content/binary/WindowsLiveWriter/PodTower_11861/PodTower_3.png" border="0" height="79" width="322" /> the
podcast client that sucks less each day.
</p>
        <p>
Today, I’ve done a little more work on PodTower, and I feel that it’s got enough features
that it warrants a beta release of sorts. I’ve been posting updates on a daily basis
for the past few days, but I think from this point the stream of major updates will
be a little slower.
</p>
        <p>
          <strong>What is PodTower?</strong>
        </p>
        <p>
PodTower is a cross-platform podcast client for Microsoft Windows and Macintosh OS
X. It’s meant to be a simple client – it updates the various feeds once per hour (or
when you click the refresh button), and can play back the downloaded podcasts, if
they’re in WMA or MP3 format.
</p>
        <p>
          <strong>How was it made?</strong>
        </p>
        <p>
PodTower is built using Microsoft Silverlight 4 and Visual Web Developer Express 2010.
In order to install PodTower, you’ll have to install the Silverlight 4 plugin, <a href="http://www.silverlight.net/">which
is available here</a>. It runs as a standalone application on your desktop. I’ve spent
about three days so far on it, and used the Silverlight Toolkit for theming (as I’m
not a visual designer).
</p>
        <p>
          <strong>Features</strong>
        </p>
        <ul>
          <li>
Subscribe to podcast/RSS feeds 
<ul><li>
As long as your feeds have an enclosure tag, it’ll work 
</li></ul></li>
          <li>
Play downloaded podcasts 
<ul><li>
Plays MP3 and WMA podcasts from your local machine 
</li></ul></li>
          <li>
Low memory footprint 
<ul><li>
It’s Silverlight – it’s small 
</li></ul></li>
          <li>
Fast, one-click install 
<ul><li>
Head over to <a href="http://puurunen.ca/podtower">http://puurunen.ca/podtower</a> and
click install Podtower. 
</li></ul></li>
        </ul>
        <p>
PodTower downloads your podcasts to your “My Music” directory in your home directory.
When downloads are complete, PodTower notifies you both by the status bar text, and
by toast notifications by the bottom of your screen.
</p>
        <p>
          <img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="http://puurunen.ca/podtower-next.png" border="0" height="396" width="696" />
        </p>
        <p>
The three buttons along the top-right represent the three major features of PodTower
– adding RSS feeds, refreshing current feeds, and playing the selected podcast.
</p>
        <p>
          <a href="http://puurunen.ca/content/binary/WindowsLiveWriter/PodTower_11861/image_5.png">
            <img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="http://puurunen.ca/content/binary/WindowsLiveWriter/PodTower_11861/image_thumb_1.png" border="0" height="136" width="398" />
          </a>
        </p>
        <p>
Clicking the add button will give you a dialog to add your podcast feed.
</p>
        <p>
        </p>
        <p>
          <a href="http://puurunen.ca/content/binary/WindowsLiveWriter/PodTower_11861/image_7.png">
            <img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="http://puurunen.ca/content/binary/WindowsLiveWriter/PodTower_11861/image_thumb_2.png" border="0" height="102" width="239" />
          </a> 
</p>
        <p>
Expanding any of the feeds will give you a list of podcasts available for download.
Clicking the button next to the name will begin the download. A progress bar beneath
the item will show how much of the podcast has downloaded.
</p>
        <p>
          <a href="http://puurunen.ca/content/binary/WindowsLiveWriter/PodTower_11861/image_9.png">
            <img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="http://puurunen.ca/content/binary/WindowsLiveWriter/PodTower_11861/image_thumb_3.png" border="0" height="148" width="354" />
          </a>
        </p>
        <p>
When the podcast finishes downloading, PodTower will alert you with a toast notification.
It automatically closes after about four seconds of inactivity.
</p>
        <p>
          <a href="http://puurunen.ca/content/binary/WindowsLiveWriter/PodTower_11861/image_11.png">
            <img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="http://puurunen.ca/content/binary/WindowsLiveWriter/PodTower_11861/image_thumb_4.png" border="0" height="127" width="359" />
          </a>
        </p>
        <p>
Clicking a podcast item, then clicking the play button up at the right will begin
the playback of the podcast. Clicking inside the gauge below the title will adjust
the position within the podcast.
</p>
        <p>
          <strong>So what are you waiting for?</strong>
        </p>
        <p>
Go download a copy of PodTower! You might just like it. It’s licensed under the New
BSD License, so it’s totally free. Tell a friend about it too.
</p>
        <p>
          <strong>Want to help contribute?</strong>
        </p>
        <p>
I’m mainly doing this as a fun little project. However, it’d be awesome if PodTower
caught on and actually became supported by you. <a href="http://puurunen.ca/podtower">If
you think this program is nifty or useful, I’d appreciate a donation. </a>PodTower
is totally free and licensed under the New BSD (3-clause) license. 
</p>
        <img width="0" height="0" src="http://puurunen.ca/aggbug.ashx?id=4bee440d-c492-4060-a491-74cc280b7f04" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Powershell (Lame) Source Control</title>
    <link rel="alternate" type="text/html" href="http://puurunen.ca/2010/06/01/PowershellLameSourceControl.aspx" />
    <id>http://puurunen.ca/PermaLink,guid,d7c4dd9c-0bf6-43a1-abc5-3dde31bda1ed.aspx</id>
    <published>2010-05-31T19:51:26.544-07:00</published>
    <updated>2010-06-01T10:01:34.2202442-07:00</updated>
    <category term="Coding" label="Coding" scheme="http://puurunen.ca/CategoryView,category,Coding.aspx" />
    <category term="PodTower" label="PodTower" scheme="http://puurunen.ca/CategoryView,category,PodTower.aspx" />
    <author>
      <name>Elias</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Tonight, I was too lazy to set up CVS or Git, so I somehow deduced that writing my
own Powershell script to do basic source control made more sense. Just in case anyone
else is looking for something similar, here it is.
</p>
        <p>
The script works as follows: You pass in a list of folders you wish to "check-in",
and it copies them, excluding bin and obj directories, to .\.es\yyyyMMddHHmmss\(Names).
Optionally, if you want to mark something as "stable", you can include the "-stable"
flag. If you want to give the folder a more descriptive name, you can include the
"-tag" flag, and the script will ask for a name.<br /><br /></p>
        <blockquote>
          <p>
            <font size="2" face="Courier New">$checkinfolder = get-date -format "yyyyMMddHHmmss" 
<br />
$currentloc = get-location 
<br />
$promoteAsStable = $FALSE </font>
          </p>
          <p>
            <font size="2" face="Courier New">foreach($arg in $args) 
<br />
{ 
<br />
    if($arg.ToLower().Equals("-tag")) 
<br />
    { 
<br />
        $checkinfolder = read-host "Check-in as
tagged revision path" 
<br />
    } 
<br />
} </font>
          </p>
          <p>
            <font size="2" face="Courier New">new-item $currentloc\.es\$checkinfolder -type Directory
| out-null </font>
          </p>
          <p>
            <font size="2" face="Courier New">foreach($arg in $args) 
<br />
{ 
<br />
    if($arg.ToLower().Equals("-stable")) 
<br />
    { 
<br />
        $promoteAsStable = $TRUE 
<br />
    } 
<br />
    else 
<br />
    { 
<br />
        echo "Checking in $arg..." 
<br />
        get-childitem .\$arg -Exclude "Bin","Obj"
| copy-item -Destination .es\$checkinfolder\$arg 
<br />
    } 
<br />
} </font>
          </p>
          <p>
            <font size="2" face="Courier New">$comment = read-host "Check-in Comment for $checkinfolder" </font>
          </p>
          <p>
            <font size="2" face="Courier New">if($promoteAsStable -eq $TRUE) 
<br />
{ 
<br />
    $checkinfolder | out-file -filepath ".\.es\STABLE" -append 
<br />
} 
<br />
$comment | out-file -filepath ".\.es\$checkinfolder.txt" </font>
          </p>
          <p>
            <font size="2" face="Courier New">$checkinfolder | out-file -filepath ".\.es\CHECKINS"
–append</font>
          </p>
        </blockquote>
        <p>
          <font size="2" face="Courier New">
          </font>
        </p>
        <p>
Hopefully you’ll find it useful. 
</p>
        <img width="0" height="0" src="http://puurunen.ca/aggbug.ashx?id=d7c4dd9c-0bf6-43a1-abc5-3dde31bda1ed" />
      </div>
    </content>
  </entry>
  <entry>
    <title>PodTower – Updated</title>
    <link rel="alternate" type="text/html" href="http://puurunen.ca/2010/06/01/PodTowerUpdated.aspx" />
    <id>http://puurunen.ca/PermaLink,guid,7e0e7fb5-8f98-4739-8c97-509f12e7c142.aspx</id>
    <published>2010-05-31T18:06:35.2349918-07:00</published>
    <updated>2010-05-31T18:06:35.2349918-07:00</updated>
    <category term="Coding" label="Coding" scheme="http://puurunen.ca/CategoryView,category,Coding.aspx" />
    <category term="PodTower" label="PodTower" scheme="http://puurunen.ca/CategoryView,category,PodTower.aspx" />
    <category term="Silverlight" label="Silverlight" scheme="http://puurunen.ca/CategoryView,category,Silverlight.aspx" />
    <author>
      <name>Elias</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p align="center">
          <a href="http://puurunen.ca/podtower">
            <img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="PodTower" border="0" alt="PodTower" src="http://puurunen.ca/content/binary/WindowsLiveWriter/PodTowerUpdated_128BA/PodTower_3.png" width="322" height="79" />
          </a>the
podcast client that eventually won’t suck.
</p>
        <p>
          <img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="PodTower-Next" border="0" alt="PodTower-Next" src="http://puurunen.ca/content/binary/WindowsLiveWriter/PodTowerUpdated_128BA/PodTower-Next_3.png" width="691" height="392" />
        </p>
        <p>
        </p>
        <p>
Added: ability to actually remove podcasts. Playback is nicer, and downloading should
work now. The progress bar under the Now Playing box now displays the progress.
</p>
        <p>
Coming next: Volume control, toast notifications when minimized. Hey, maybe I should
get this onto the WinPhone 7!
</p>
        <p>
Get it at <a href="http://puurunen.ca/podtower">http://puurunen.ca/podtower</a></p>
        <img width="0" height="0" src="http://puurunen.ca/aggbug.ashx?id=7e0e7fb5-8f98-4739-8c97-509f12e7c142" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Introducing: PodTower!</title>
    <link rel="alternate" type="text/html" href="http://puurunen.ca/2010/05/31/IntroducingPodTower.aspx" />
    <id>http://puurunen.ca/PermaLink,guid,4182c502-186a-4ea4-950c-e338f67a24cf.aspx</id>
    <published>2010-05-30T20:36:25.048-07:00</published>
    <updated>2010-05-30T20:37:55.5639093-07:00</updated>
    <category term="Coding" label="Coding" scheme="http://puurunen.ca/CategoryView,category,Coding.aspx" />
    <category term="My Life" label="My Life" scheme="http://puurunen.ca/CategoryView,category,MyLife.aspx" />
    <category term="Silverlight" label="Silverlight" scheme="http://puurunen.ca/CategoryView,category,Silverlight.aspx" />
    <author>
      <name>Elias</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Over the past couple of days, I’ve been lamenting over the fact that iTunes isn’t
my ideal podcast client. To further compound problems, no podcast fetcher I’ve found
has supported exactly the features I’ve wanted. 
</p>
        <p>
          <img style="border: 0px none ; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="http://puurunen.ca/content/binary/WindowsLiveWriter/IntroducingPodTower_14BD9/image_3.png" border="0" width="713" height="403" />
        </p>
        <p>
Enter PodTower – my answer to the sucko podcast fetchers currently in existence. Does
it suck? Sure. It’s totally untested with about 99% of the podcasts out there right
now, and doesn’t have the “remove-this-podcast-from-my-list” feature. Right now, it’s
simply a nice way to download and play podcasts. I plan on improving it over the next
while though.
</p>
        <p>
          <img style="border: 0px none ; display: block; float: none; margin-left: auto; margin-right: auto;" title="image" alt="image" src="http://puurunen.ca/content/binary/WindowsLiveWriter/IntroducingPodTower_14BD9/image_6.png" border="0" width="713" height="403" />
        </p>
        <p>
          <a href="http://puurunen.ca/podtower">Head over here to install</a> PodTower. It requires
Silverlight 4 in order to work. I’m using the Silverlight 4 Toolkit Expression Dark
theme to make it look semi-good. I know it looks like a dogs breakfast right now,
but it’ll get better. Just give it time. 
</p>
        <img width="0" height="0" src="http://puurunen.ca/aggbug.ashx?id=4182c502-186a-4ea4-950c-e338f67a24cf" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Demo Effect – The Basic Scroller</title>
    <link rel="alternate" type="text/html" href="http://puurunen.ca/2010/04/16/DemoEffectTheBasicScroller.aspx" />
    <id>http://puurunen.ca/PermaLink,guid,8e22aa0a-b66c-4e34-8228-ad47416e5212.aspx</id>
    <published>2010-04-15T22:36:20.0286697-07:00</published>
    <updated>2010-04-15T22:36:20.0286697-07:00</updated>
    <category term="Coding" label="Coding" scheme="http://puurunen.ca/CategoryView,category,Coding.aspx" />
    <category term="Demoscene" label="Demoscene" scheme="http://puurunen.ca/CategoryView,category,Demoscene.aspx" />
    <author>
      <name>Elias</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Tonight, I worked some more on Ubox. Since having been introduced to demos, there
has been one effect I’ve always wanted to try coding – the LED-sign style scroller.
In theory, it’s easy enough – plot pixels. However, I tried to take it a step further.
</p>
        <p>
My first attempt involved testing copying one array of integers to another, column
by column, to simulate the effect of scrolling. While this worked, I quickly realized
how inefficient it is. To store the 26 letters of the alphabet as arrays of integers,
size 8x8 would require on a 32-bit machine, 4 x 64 x 26 = 6656 bytes, or around 6KB.
Doesn’t sound like a lot of memory? It might not be these days, but it’s inefficient
as hell. After doing some thinking, I realized that for the scroller, I only wanted
two colors – a light red and a dark red. With this in mind, I realized I could do
some primitive compression. If we have 8x8 scroller character data, we need to store
64 bits, or 8 bytes of information per character. That works out to two 32-bit integers
on a Win32 machine. With this in mind, I cut the space requirement from 6656 bytes
to 208 bytes. 
</p>
        <p>
To implement this, I built a separate helper program in C#. Enter the worlds worst
monochrome graphics editor.
</p>
        <p>
          <a href="http://puurunen.ca/content/binary/WindowsLiveWriter/DemoEffectTheBasicScroller_1109/image_2.png">
            <img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://puurunen.ca/content/binary/WindowsLiveWriter/DemoEffectTheBasicScroller_1109/image_thumb.png" width="240" height="177" />
          </a>
        </p>
        <p>
Yes, it’s done in WinForms. Yes, I know how to use WPF. Yes, the program is a total
hack. But it works. Basically, the checkboxes represent what one would expect to be
an “on” state. Output gives me the integer array representing the character data.
For instance, 
</p>
        <p>
int stuff[53] = 
<br />
{ 
<br />
0x66663C3C, 0x66667E66, 0x7E82827E, 0x7E82827E, 0x6063C78, 0x783C0606, 0x42427E3E,
0x3E7E4242, 0x3E023E7E, 0x7E3E021E, 0x3E023E7E, 0x202021E, 0x6067E3C, 0x7C7E4676,
0x7E666666, 0x6666667E, 
<br />
0x18187E7E, 0x7E7E1818, 0x3730FCFC, 0x1E3E3237, 0x1E366606, 0x66361E0E, 0x6060606,
0x3C7E0606, 0xD6FEEEC6, 0xC6C6C6C6, 0xCFC7C3C3, 0xC3E3F3DB, 0x66667E1C, 0x3C7E6666,
0x6666663E, 0x606063E, 
<br />
0x66667618, 0xD8FE7676, 0x46467E3E, 0x66361E3E, 0x606063C, 0x3C60603C, 0x18183C7E,
0x18181818, 0x66666666, 0x387E6666, 0xC3C3C300, 0x183C66C3, 0xC3C3C3C3, 0x66FEDBDB,
0x183CE7C3, 0xC3C3663C, 
<br />
0x3C666666, 0x18181818, 0x30607C7E, 0x7E3E0C18, 0x0, 0x0 
<br />
};
</p>
        <p>
…represents my horribly-drawn 26-character-plus-space alphabet. 
</p>
        <p>
Next came the implementation. I keep track of the current “column” being displayed
in the scroller, along with the ASCII string being displayed. The ASCII string is
used to plot each character.
</p>
        <pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px">
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px">  1: <span style="color: #0000ff">for</span>(<span style="color: #0000ff">int</span> i
= 0; i &lt; 96; i++) </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px">  2: {
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px">  3:   <span style="color: #008000">//
Drawing routine for pixel scroller.</span></pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px">  4: 
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px">  5:   <span style="color: #008000">//
PSet(xLet + (x &lt;&lt; scale), 50 + (y &lt;&lt; scale), pixDt[2], pixDt[1], pixDt[0],
screen);</span></pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px">  6: 
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px">  7:   <span style="color: #0000ff">int</span> currCol
= (col + i) % len; </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px">  8:   <span style="color: #0000ff">char</span> letter
= scroller[currCol / 8]; </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px">  9:   <span style="color: #0000ff">if</span>(letter
== 32) </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 10:   {
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 11:     <span style="color: #0000ff">for</span>(<span style="color: #0000ff">int</span> y
= 0; y &lt; 8; y++) </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 12:     {
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 13:       <span style="color: #008000">//
col</span></pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 14:       PSet(xLet + (i &lt;&lt; scale), 125 + (y &lt;&lt; scale), 140, 0, 0, screen);
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 15:     }
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 16:   }
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 17:   <span style="color: #0000ff">else</span></pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 18:   {
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 19:     <span style="color: #0000ff">for</span>(<span style="color: #0000ff">int</span> y
= 0; y &lt; 4; y++) </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 20:     {
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 21:       <span style="color: #0000ff">int</span> realLetter
= letter - 0x41; </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 22: 
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 23:       <span style="color: #008000">//
Idea: top half is in MSB of stuff[realLetter]</span></pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 24:       <span style="color: #008000">//
bottom in LSB of stuff[realLetter + 1]</span></pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 25: 
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 26:       <span style="color: #0000ff">int</span> t1
= ((8 * y) + (currCol % 8)); </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 27:       <span style="color: #0000ff">int</span> t2
= stuff[realLetter * 2] &gt;&gt; t1; </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 28:       Uint8 g1 = (t2 &amp; 0x1) == 0x1 ? 255 : 140;
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 29:       Uint8 g2 = ((stuff[(realLetter * 2) + 1] &gt;&gt; ((8 * (y + 4)) 
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 30:         + (currCol % 8))) &amp; 0x1) == 0x1 ? 255 : 140;
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 31:       <span style="color: #008000">//
col</span></pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 32:       <span style="color: #0000ff">int</span> x1
= xLet + (i &lt;&lt; scale); </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 33:       <span style="color: #0000ff">int</span> y1
= (y &lt;&lt; scale); </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 34:       <span style="color: #0000ff">int</span> x2
= xLet + (i &lt;&lt; scale); </pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 35:       <span style="color: #0000ff">int</span> y2
= ((y + 4) &lt;&lt; scale); </pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 36: 
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 37:       y1 = 125 + y1;<span style="color: #008000">//
* cos((double)sAngle*3.14/180.0);</span></pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 38:       y2 = 125 + y2;<span style="color: #008000">//
* cos((double)sAngle*3.14/180.0);</span></pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 39:       PSet(x1, y1, g1, 0, 0, screen);
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 40:       PSet(x2, y2, g2, 0, 0, screen);
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 41:     }
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 42:   
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 43:   }
</pre>
          <pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 44: }
</pre>
          <pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 10px"> 45: </pre>
        </pre>
        <p>
That’s the entire source listing for the scroller. The horrible mess of bit-shifts
and modulo translates the stored integer into a simple 0x1 or 0x0 for display. 
</p>
        <p>
The result looks like this:
</p>
        <p>
          <a href="http://puurunen.ca/content/binary/WindowsLiveWriter/DemoEffectTheBasicScroller_1109/Ubox3_2.png">
            <img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="Ubox3" border="0" alt="Ubox3" src="http://puurunen.ca/content/binary/WindowsLiveWriter/DemoEffectTheBasicScroller_1109/Ubox3_thumb.png" width="637" height="478" />
          </a>
        </p>
        <img width="0" height="0" src="http://puurunen.ca/aggbug.ashx?id=8e22aa0a-b66c-4e34-8228-ad47416e5212" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Demo: Ubox (Preview)</title>
    <link rel="alternate" type="text/html" href="http://puurunen.ca/2010/04/14/DemoUboxPreview.aspx" />
    <id>http://puurunen.ca/PermaLink,guid,65dae83c-5196-4ffa-9aad-0aafe8b0db42.aspx</id>
    <published>2010-04-14T01:23:19.434914-07:00</published>
    <updated>2010-04-15T18:44:20.9749248-07:00</updated>
    <category term="Coding" label="Coding" scheme="http://puurunen.ca/CategoryView,category,Coding.aspx" />
    <category term="Demoscene" label="Demoscene" scheme="http://puurunen.ca/CategoryView,category,Demoscene.aspx" />
    <author>
      <name>Elias</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <em>Ubox – Enter the Hello World</em>
        </p>
        <p>
          <a href="http://puurunen.ca/content/binary/WindowsLiveWriter/DemoUboxPreview_3DC7/Ubox1_2.png">
            <img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Ubox1" border="0" alt="Ubox1" src="http://puurunen.ca/content/binary/WindowsLiveWriter/DemoUboxPreview_3DC7/Ubox1_thumb.png" width="640" height="480" />
          </a>
        </p>
        <p>
          <em>
          </em>
          <img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Ubox-Preview" border="0" alt="Ubox-Preview" src="http://puurunen.ca/content/binary/WindowsLiveWriter/DemoUboxPreview_3DC7/Ubox-Preview_3.png" width="637" height="480" />
        </p>
        <p>
        </p>
        <p>
Music was totally ripped from the Razor 1911 Chipdisk #3. I plan on changing that.
The bouncing head is Bob Barker from Robot Chicken. Totally not posting until I find
a way to not have to deal with DLL hell. The source is 463 lines long, including whitespace,
written in C++ (so it’s no speed demon). I think for a hello-world sort of demo it’s
not bad at all. Just need to watch more demos and get inspiration for this. 
</p>
        <p>
Did I mention this is only my second completely unmanaged C++ application that isn’t
trivial? (The first was my Physics project for grade 12 – a GameBoy Advance ROM. That
was some serious fun to work on.)
</p>
        <img width="0" height="0" src="http://puurunen.ca/aggbug.ashx?id=65dae83c-5196-4ffa-9aad-0aafe8b0db42" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Debug vs. Release, Unmanaged DLL Hell</title>
    <link rel="alternate" type="text/html" href="http://puurunen.ca/2010/04/14/DebugVsReleaseUnmanagedDLLHell.aspx" />
    <id>http://puurunen.ca/PermaLink,guid,671185ec-2e36-4013-aeef-c4a0fd548350.aspx</id>
    <published>2010-04-14T01:12:11.0853253-07:00</published>
    <updated>2010-04-14T01:13:17.7627171-07:00</updated>
    <category term="Coding" label="Coding" scheme="http://puurunen.ca/CategoryView,category,Coding.aspx" />
    <category term="Demoscene" label="Demoscene" scheme="http://puurunen.ca/CategoryView,category,Demoscene.aspx" />
    <category term="Gotchas" label="Gotchas" scheme="http://puurunen.ca/CategoryView,category,Gotchas.aspx" />
    <category term="My Life" label="My Life" scheme="http://puurunen.ca/CategoryView,category,MyLife.aspx" />
    <author>
      <name>Elias</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Today, after studying for a CS exam for four hours straight, I decided that it would
be a good judgment call to write some code. After all, there’s only so much theory
one can absorb until code calls. So, I decided to write my first (official) demo.
I’m still working on it, and want to compose my own music to it (and make it suck
a little less), so it’ll be released later. 
</p>
        <p>
I ran into a fun snag along the way, though. I used the SDL libraries to power the
graphics of the demo. One library, SDL_Gfx, is not distributed precompiled – you have
to compile it yourself. Fortunately, the author includes a Visual C++ Project file
that builds just fine. Now, I’ve done some SDL work in the past and had built SDL_Gfx
a while ago. 
</p>
        <p>
At this point, some readers might see where this is going. As I put some of the hacking
finishing touches on the demo, I sent it out to a couple of friends. Of course, it
didn’t run on either machine. One was Windows 7, one was Windows XP, and both failed
with the same error: The application was unable to start correctly (0x0150002). 
</p>
        <p>
A little digging, and the problem pointed to a few solutions – reinstall Windows (yuck),
install Visual C++ Express 2008 (double-yuck), or redistribute the debug DLL for Visual
C++ 2008 (triple-yuck). This seemed odd to me; I had compiled the demo as a release,
non-debug Windows EXE. Why on earth would it need the debug runtime?
</p>
        <p>
Further digging in the event log brought us this error: "Activation context generation
failed for "c:\…\release\SDLGFX.DLL". Dependent Assembly Microsoft.VC90.DebugCRT,
processorArchitecture="x86", publicKeyToken="1fc8b3b9a1e18e3b",
type="win32", version="9.0.21022.8" could not be found. Please
use sxstrace.exe for detailed diagnosis."
</p>
        <p>
After a couple of hours of fiddling with manifest files, swearing at SxS, and no luck
with the various builds, I stared at the path above. SDLGFX.dll. Then it hit me.
</p>
        <p>
          <em>I had built SDL_Gfx as a Debug library in Visual C++ 2008. Crap.</em>
        </p>
        <p>
Some swearing and frantic coding later, it works, and runs on other machines. The
moral of the story? Always check to make sure your library build type matches your
solution type. 
</p>
        <p>
I just wish I could have that two hours of my life back.
</p>
        <img width="0" height="0" src="http://puurunen.ca/aggbug.ashx?id=671185ec-2e36-4013-aeef-c4a0fd548350" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Recipe: Spicy Chicken Spaghetti</title>
    <link rel="alternate" type="text/html" href="http://puurunen.ca/2010/03/03/RecipeSpicyChickenSpaghetti.aspx" />
    <id>http://puurunen.ca/PermaLink,guid,2b20c1b8-c1ca-4de7-b231-6f02d757e532.aspx</id>
    <published>2010-03-02T17:10:34.9015777-07:00</published>
    <updated>2010-03-02T17:10:34.9015777-07:00</updated>
    <category term="Cooking" label="Cooking" scheme="http://puurunen.ca/CategoryView,category,Cooking.aspx" />
    <category term="Recipes" label="Recipes" scheme="http://puurunen.ca/CategoryView,category,Recipes.aspx" />
    <author>
      <name>Elias</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I’ve been on a cooking kick recently and have come up with a series of recipes that
are tasty, cheap, and nutritious. Here’s one such dish.
</p>
        <ul>
          <li>
Skinless, boneless chicken breast</li>
          <li>
Whole-wheat spaghetti noodles</li>
          <li>
Red chili pepper flakes</li>
          <li>
Garlic (either powder or fresh)</li>
          <li>
Salt</li>
        </ul>
        <p>
Here’s how to prep:
</p>
        <ol>
          <li>
Cook up the chicken breasts. Since I’ve got a Costco membership, I like to buy the
bags of Kirkland frozen chicken breasts, as they yield 2kg worth. I’d recommend buying
at least 400g worth of chicken breasts and cooking them all up at the same time. From
frozen, bake in the oven for approx. 30 minutes at 400F. 
</li>
          <li>
At the same time, cook up the spaghetti noodles. As with the chicken, I like to cook
a lot of it up at the same time so it’s ready to go when I need to throw a meal together
quickly. Whole wheat noodles boiled should take 8-10 minutes.</li>
          <li>
After cooking the noodles, strain them. Once the excess water is removed, set aside
and (optionally) let cool.</li>
          <li>
After cooking the chicken breasts, take one or two and cut into thin pieces, width-wise. 
</li>
          <li>
Get out the frying pan, put in some olive oil, and crank the heat to approximately
medium (electric). When the oil is up to temperature, throw in some noodles, and the
sliced up chicken.</li>
          <li>
Sprinkle on some red chili pepper flakes, garlic, and salt. Cook 3-5 minutes.</li>
          <li>
Plate, and serve.</li>
        </ol>
        <p>
I’ll post some pictures of this dish the next time I make it. Enjoy!
</p>
        <p>
(Note: the directions to making this dish are a little vague, I know. It’s moreso
a dish I threw together when I ran out of spaghetti sauce. It’s delicious though.)
</p>
        <img width="0" height="0" src="http://puurunen.ca/aggbug.ashx?id=2b20c1b8-c1ca-4de7-b231-6f02d757e532" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Retemplating the WPF Toolkit – DataGrid Gotcha</title>
    <link rel="alternate" type="text/html" href="http://puurunen.ca/2009/11/26/RetemplatingTheWPFToolkitDataGridGotcha.aspx" />
    <id>http://puurunen.ca/PermaLink,guid,43f17d81-d4df-4f82-9da2-8c221b3ec238.aspx</id>
    <published>2009-11-26T09:32:16.7746883-07:00</published>
    <updated>2009-11-26T09:32:16.7746883-07:00</updated>
    <category term="Coding" label="Coding" scheme="http://puurunen.ca/CategoryView,category,Coding.aspx" />
    <category term="Gotchas" label="Gotchas" scheme="http://puurunen.ca/CategoryView,category,Gotchas.aspx" />
    <category term="WPF" label="WPF" scheme="http://puurunen.ca/CategoryView,category,WPF.aspx" />
    <category term="WPF Toolkit" label="WPF Toolkit" scheme="http://puurunen.ca/CategoryView,category,WPFToolkit.aspx" />
    <category term="WPF Tricks" label="WPF Tricks" scheme="http://puurunen.ca/CategoryView,category,WPFTricks.aspx" />
    <author>
      <name>Elias</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
For anyone who’s done any WPF control retemplating, it can sometimes be a daunting
task. Some controls seem to retemplate with ease, while others can have a myriad of
nested styles, with certain parts seeming to appear where you don’t expect them. Today,
I ran into an interesting situation with the WPF Toolkit’s DataGrid – retemplating
the column header sorting arrows.
</p>
        <p>
As it turns out, the arrows for column sorting live in the control DataGridHeaderBorder.
If we inspect the DataGrid.DataGridColumnHeader style in Blend…
</p>
        <p>
          <img style="border-bottom: 0px; border-left: 0px; margin: 0px auto 5px; display: block; float: none; border-top: 0px; border-right: 0px" title="Blend1" border="0" alt="Blend1" src="http://puurunen.ca/content/binary/WindowsLiveWriter/RetemplatingtheWPFToolkitDataGridGotcha_9DFB/Blend1_3.jpg" width="447" height="178" />
        </p>
        <p>
…notice there’s no placeholder for the arrows. Attempting to edit the default style
for the Border won’t work either – there is no style to be found. There is no ControlTemplate
to edit either, since DataGridHeaderBorder inherits from Border, which in turn inherits
from FrameworkElement, and not Control. (Remember, Control defines the ControlTemplate
property)
</p>
        <p>
So where are the arrows defined then? Well, inspecting the source for the DataGridHeaderBorder…
</p>
        <p>
        </p>
        <div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:6b34a3cc-7003-4735-bc9f-d6eba1076c5e" class="wlWriterEditableSmartContent">
          <pre style="background-color:#FFFFFF;overflow: auto;">
            <span style="color: #808080;">///</span>
            <span style="color: #008000;">
            </span>
            <span style="color: #808080;">&lt;summary&gt;</span>
            <span style="color: #008000;">
            </span>
            <span style="color: #808080;">///</span>
            <span style="color: #008000;"> Called
when this element should re-render. </span>
            <span style="color: #808080;">///</span>
            <span style="color: #008000;">
            </span>
            <span style="color: #808080;">&lt;/summary&gt;</span>
            <span style="color: #808080;">
            </span>
            <span style="color: #0000FF;">protected</span>
            <span style="color: #000000;">
            </span>
            <span style="color: #0000FF;">override</span>
            <span style="color: #000000;">
            </span>
            <span style="color: #0000FF;">void</span>
            <span style="color: #000000;"> OnRender(DrawingContext
dc) { </span>
            <span style="color: #0000FF;">if</span>
            <span style="color: #000000;"> (UsingBorderImplementation)
{ </span>
            <span style="color: #008000;">//</span>
            <span style="color: #008000;"> Revert
to the Border implementation</span>
            <span style="color: #008000;">
            </span>
            <span style="color: #000000;">
            </span>
            <span style="color: #0000FF;">base</span>
            <span style="color: #000000;">.OnRender(dc);
} </span>
            <span style="color: #0000FF;">else</span>
            <span style="color: #000000;"> { </span>
            <span style="color: #008000;">//</span>
            <span style="color: #008000;"> Choose
the appropriate rendering based on the current theme</span>
            <span style="color: #008000;">
            </span>
            <span style="color: #000000;">
            </span>
            <span style="color: #0000FF;">switch</span>
            <span style="color: #000000;"> (Theme)
{ </span>
            <span style="color: #008000;">//</span>
            <span style="color: #008000;"> Omitted
for brevity's sake... </span>
            <span style="color: #008000;">//</span>
            <span style="color: #008000;"> A
switch here calls RenderAeroNormalColor.</span>
            <span style="color: #008000;">
            </span>
            <span style="color: #000000;"> }
} </span>
            <span style="color: #0000FF;">private</span>
            <span style="color: #000000;">
            </span>
            <span style="color: #0000FF;">void</span>
            <span style="color: #000000;"> RenderAeroNormalColor(DrawingContext
dc) { </span>
            <span style="color: #0000FF;">if</span>
            <span style="color: #000000;"> (isSorted </span>
            <span style="color: #000000;">&amp;&amp;</span>
            <span style="color: #000000;"> (size.Width </span>
            <span style="color: #000000;">&gt;</span>
            <span style="color: #000000;">
            </span>
            <span style="color: #800080;">14.0</span>
            <span style="color: #000000;">) </span>
            <span style="color: #000000;">&amp;&amp;</span>
            <span style="color: #000000;"> (size.Height </span>
            <span style="color: #000000;">&gt;</span>
            <span style="color: #000000;">
            </span>
            <span style="color: #800080;">10.0</span>
            <span style="color: #000000;">))
{ </span>
            <span style="color: #008000;">//</span>
            <span style="color: #008000;"> Draw
the sort arrow</span>
            <span style="color: #008000;">
            </span>
            <span style="color: #000000;"> TranslateTransform
positionTransform </span>
            <span style="color: #000000;">=</span>
            <span style="color: #000000;">
            </span>
            <span style="color: #0000FF;">new</span>
            <span style="color: #000000;"> TranslateTransform((size.Width </span>
            <span style="color: #000000;">-</span>
            <span style="color: #000000;">
            </span>
            <span style="color: #800080;">8.0</span>
            <span style="color: #000000;">) </span>
            <span style="color: #000000;">*</span>
            <span style="color: #000000;">
            </span>
            <span style="color: #800080;">0.5</span>
            <span style="color: #000000;">, </span>
            <span style="color: #800080;">1.0</span>
            <span style="color: #000000;">);
positionTransform.Freeze(); dc.PushTransform(positionTransform); </span>
            <span style="color: #0000FF;">bool</span>
            <span style="color: #000000;"> ascending </span>
            <span style="color: #000000;">=</span>
            <span style="color: #000000;"> (sortDirection </span>
            <span style="color: #000000;">==</span>
            <span style="color: #000000;"> ListSortDirection.Ascending);
PathGeometry arrowGeometry </span>
            <span style="color: #000000;">=</span>
            <span style="color: #000000;"> (PathGeometry)GetCachedFreezable(ascending </span>
            <span style="color: #000000;">?</span>
            <span style="color: #000000;"> (</span>
            <span style="color: #0000FF;">int</span>
            <span style="color: #000000;">)AeroFreezables.ArrowUpGeometry
: (</span>
            <span style="color: #0000FF;">int</span>
            <span style="color: #000000;">)AeroFreezables.ArrowDownGeometry); </span>
            <span style="color: #008000;">//</span>
            <span style="color: #008000;"> Actual
drawing here, omitted for brevity's sake...</span>
            <span style="color: #008000;">
            </span>
            <span style="color: #000000;"> }
}</span>
          </pre>
          <!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com -->
        </div>
        <p>
        </p>
        <p>
If you snoop through this source (in the toolkit), you’ll notice the arrows are drawn
in the OnRender() method of the DataGridHeaderBorder. In my humble opinion, I don’t
think this is the most intuitive way to pull this effect off, but I’m sure there was
a sound reason for it. In any case, if you’ve got your own sorting arrows that you
wish to use, the easiest (and only way, I believe) to do this is to adjust their visibility
by using the Triggers of the DataGridColumnHeader, namely the SortDirection property.
</p>
        <p>
Special note: SortDirection <em>is </em>a nullable property – it is set to null when
there is no sorting applied to the column. Keep this in mind when templating the control.
</p>
        <p>
          <a href="http://puurunen.ca/content/binary/WindowsLiveWriter/RetemplatingtheWPFToolkitDataGridGotcha_9DFB/image_9.png">
            <img style="border-right-width: 0px; margin: 0px 5px 5px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" align="left" src="http://puurunen.ca/content/binary/WindowsLiveWriter/RetemplatingtheWPFToolkitDataGridGotcha_9DFB/image_thumb_3.png" width="460" height="345" />
          </a> For
this demonstration, I’ve blown away the default DataGridHeaderBorder. I’ll use a regular
Border, with a ContentPresenter within it (for the column header contents – don’t
forget this), and two TextBlocks to indicate the sort direction. Remember, you aren’t
limited to TextBlocks – you can use whatever you want to indicate sort direction.
You can even use Storyboards that fire on the EnterAction property of the trigger
to provide animations.
</p>
        <p>
First, I created a style on the DataGridColumnHeader of a fresh DataGrid, and defined
it in Window1.xaml. I blew away the default style and put in a Border containing a
StackPanel, which contains the ContentPresenter and our two TextBlocks. 
</p>
        <p>
The TextBlocks are to be Collapsed by default, since the default state of a column
is no sorting. 
</p>
        <p>
The reason I picked a StackPanel to contain the ContentPresenter and the sorting arrows
is that I wanted to whip up a demo fairly quickly, and this is the fastest way to
get the control to automatically resize itself to prevent waste of dead-space from
the arrows. You can pull off the hiding of the space used by the arrows by using appropriate
autosizing of grid columns, etc., a topic of which I’ll cover in a future article.
</p>
        <p>
Next, we can apply our triggers to show the user what direction they are sorting.
In the above screengrab, I’ve already added three Property triggers for  SortDirection:
Ascending, Descending, and null. Null is used for when there is no sorting applied,
and the other two are self-explanatory. So, depending on which value is currently
set will define which arrows are visible. 
</p>
        <p>
With SortDirection = Ascending selected, I’ve set the Visibility property of the Up
TextBlock to be visible, and for the SortDirection = Descending, the Dn TextBlock
is visible. When null, no changes occur from the default style, which is to say both
TextBlocks are Collapsed. The end result looks like this…
</p>
        <p>
 
</p>
        <p>
        </p>
        <p>
 <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="image" border="0" alt="image" src="http://puurunen.ca/content/binary/WindowsLiveWriter/RetemplatingtheWPFToolkitDataGridGotcha_9DFB/image_25.png" width="240" height="240" /> which
goes to…  <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="image" border="0" alt="image" src="http://puurunen.ca/content/binary/WindowsLiveWriter/RetemplatingtheWPFToolkitDataGridGotcha_9DFB/image_23.png" width="240" height="240" /></p>
        <p>
        </p>
        <p>
… and finally goes to…
</p>
        <p>
          <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="image" border="0" alt="image" src="http://puurunen.ca/content/binary/WindowsLiveWriter/RetemplatingtheWPFToolkitDataGridGotcha_9DFB/image_24.png" width="240" height="240" />
        </p>
        <img width="0" height="0" src="http://puurunen.ca/aggbug.ashx?id=43f17d81-d4df-4f82-9da2-8c221b3ec238" />
      </div>
    </content>
  </entry>
</feed>