<?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>ErrorOK &#187; Uncategorized</title>
	<atom:link href="http://blog.errorok.com/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.errorok.com</link>
	<description>A library of useless knowledge</description>
	<lastBuildDate>Wed, 28 Dec 2011 19:31:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Anonymous Type Return Value in C# 4.0</title>
		<link>http://blog.errorok.com/2010/12/13/208/</link>
		<comments>http://blog.errorok.com/2010/12/13/208/#comments</comments>
		<pubDate>Mon, 13 Dec 2010 16:59:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Software Developement]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://blog.errorok.com/?p=208</guid>
		<description><![CDATA[Ever wanted to return an anonymous type from a method or property, but then find out you can&#8217;t use it because there is no valid return type?  Well I have, and I will explain how to get around this issue.
The solution as you may have guessed is to use dynamic types, which allow you to [...]]]></description>
			<content:encoded><![CDATA[<p>Ever wanted to return an anonymous type from a method or property, but then find out you can&#8217;t use it because there is no valid return type?  Well I have, and I will explain how to get around this issue.</p>
<p>The solution as you may have guessed is to use dynamic types, which allow you to build the type definition at run time and return it.  Since there is no static compilation type checking, it doesn&#8217;t care that you can&#8217;t define the return type of your method or property.  This isn&#8217;t something very common, or even recommended in most situations, but it can come in handy in a pinch.  Here is some totally useless, but good sample code explanation.</p>
<pre>private bool flagValue = false;
private bool isFlagValueSet = false;

private dynamic Flag
{
    get
    {
        return new { Value = flagValue, IsValueSet = isFlagValueSet };
    }
}

public bool Test()
{
    return Flag.IsValueSet ? Flag.Value : false;
}</pre>
<p>All you gotta do is ensure that you reference the Microsoft.CSharp.dll to get access to dynamic types.  You won&#8217;t get any intellisense on the flag variable, but that&#8217;s because the type information is computed at runtime only.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.errorok.com/2010/12/13/208/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hooking up a datacontext to WPF DataGrid colums</title>
		<link>http://blog.errorok.com/2010/09/09/212/</link>
		<comments>http://blog.errorok.com/2010/09/09/212/#comments</comments>
		<pubDate>Thu, 09 Sep 2010 17:55:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.errorok.com/?p=212</guid>
		<description><![CDATA[If you have ever wanted to do any data binding on the columns defined within a wpf data grid, you have probably quickly realized that it is not possible.  The reason why your data bindings don&#8217;t work is because the DataGrid.Columns property is attached, and therefore not part of the visual tree.  What that means [...]]]></description>
			<content:encoded><![CDATA[<p>If you have ever wanted to do any data binding on the columns defined within a wpf data grid, you have probably quickly realized that it is not possible.  The reason why your data bindings don&#8217;t work is because the DataGrid.Columns property is attached, and therefore not part of the visual tree.  What that means is that the data context is not automatically passed down from the data grid to the grid columns.  We can, however, emulate the columns being a part of the visual tree by passing the data context down manually.   My initial source of information on how to do this lies <a href="http://stackoverflow.com/questions/1560871/wpf-datagrid-binding-datagridcolumn-visibility-to-contextmenu-menuitems-ischeked" target="_blank">here</a>, however, this solution forces you to re-use your data grid&#8217;s data context which may not be desirable in all situations.  So instead i employed a slightly more flexible solution so that i could apply any data context i wanted.</p>
<p>I started off by creating a static extension class for the data grid modifications i need to make.  Then i add an attached property to hold the column data context.  Then i created a static constructor so that i could attach the FrameworkElement.DataContextProperty to the grid column class.  Finally, create a property changed handler for the attached property, loop through the grid columns and set the FrameworkElement.DataContextProperty to the new data context on each column.</p>
<p>Now in your xaml, you just need to add a binding to your attached property <strong>BELOW </strong>your column definitions.  It is imperative that you add this binding below your column definitions, or else your grid won&#8217;t contain any columns to update.  The binding syntax on your grid columns is a little more complicated than usual, just take a look at the sample code below to get an idea how to use it.  The only real difference is that you must source yourself as well as path the FrameworkElement.DataContextProperty.</p>
<p>After you assign the column data context property to a binding, your data grid columns will now be able to function just like any other bindable element in the visual tree.   If you just want to push the data grid data context to the columns, simple use an empty binding element instead of specifying the element name, source, or path.</p>
<p>Code</p>
<pre>
<pre style="font-family: consolas;"><span style="color: blue;">namespace</span> DataGrid.Extensions
{
    <span style="color: blue;">using</span> System.Windows;
    <span style="color: blue;">using</span> Microsoft.Windows.Controls;

    <span style="color: blue;">static</span> <span style="color: blue;">class</span> <span style="color: #2b91af;">DataGridExtensions</span>
    {
        <span style="color: blue;">public</span> <span style="color: blue;">static</span> <span style="color: blue;">object</span> GetColumnDataContext(<span style="color: #2b91af;">DependencyObject</span> obj)
        {
            <span style="color: blue;">return</span> (<span style="color: blue;">object</span>)obj.GetValue(ColumnDataContextProperty);
        }

        <span style="color: blue;">public</span> <span style="color: blue;">static</span> <span style="color: blue;">void</span> SetColumnDataContext(<span style="color: #2b91af;">DependencyObject</span> obj, <span style="color: blue;">object</span> value)
        {
            obj.SetValue(ColumnDataContextProperty, value);
        }

        <span style="color: green;">// Using a DependencyProperty as the backing store for ColumnDataContext.  This enables animation, styling, binding, etc...</span>
        <span style="color: blue;">public</span> <span style="color: blue;">static</span> <span style="color: blue;">readonly</span> <span style="color: #2b91af;">DependencyProperty</span> ColumnDataContextProperty =
            <span style="color: #2b91af;">DependencyProperty</span>.RegisterAttached(<span style="color: #a31515;">"ColumnDataContext"</span>, 
            <span style="color: blue;">typeof</span>(<span style="color: blue;">object</span>),
            <span style="color: blue;">typeof</span>(<span style="color: #2b91af;">DataGridExtensions</span>), 
            <span style="color: blue;">new</span> <span style="color: #2b91af;">UIPropertyMetadata</span>(<span style="color: blue;">null</span>, ColumnDataContextChanged));

        <span style="color: blue;">static</span> DataGridExtensions()
        {
            <span style="color: #2b91af;">FrameworkElement</span>.DataContextProperty.AddOwner(<span style="color: blue;">typeof</span>(<span style="color: #2b91af;">DataGridColumn</span>));
        }

        <span style="color: blue;">private</span> <span style="color: blue;">static</span> <span style="color: blue;">void</span> ColumnDataContextChanged(<span style="color: #2b91af;">DependencyObject</span> d, <span style="color: #2b91af;">DependencyPropertyChangedEventArgs</span> e)
        {
            UpdateColumnsDataContext(d <span style="color: blue;">as</span> <span style="color: #2b91af;">DataGrid</span>, e.NewValue);
        }

        <span style="color: blue;">private</span> <span style="color: blue;">static</span> <span style="color: blue;">void</span> UpdateColumnsDataContext(<span style="color: #2b91af;">DataGrid</span> grid, <span style="color: blue;">object</span> dataContext)
        {
            <span style="color: blue;">if</span> (grid != <span style="color: blue;">null</span>)
            {
                <span style="color: blue;">foreach</span> (<span style="color: blue;">var</span> col <span style="color: blue;">in</span> grid.Columns)
                {
                    col.SetValue(<span style="color: #2b91af;">FrameworkElement</span>.DataContextProperty, dataContext);
                }
            }
        }
    }
}</pre>
</pre>
<p>XAML</p>
<pre style="font-family: consolas;"><span style="color: blue;">&lt;</span><span style="color: #a31515;">wpf</span><span style="color: blue;">:</span><span style="color: #a31515;">DataGrid</span><span style="color: red;"> ItemsSource</span><span style="color: blue;">="{</span><span style="color: #a31515;">Binding</span><span style="color: red;"> Path</span><span style="color: blue;">=</span><span style="color: blue;">Channels</span><span style="color: blue;">,</span><span style="color: red;"> Mode</span><span style="color: blue;">=</span><span style="color: blue;">OneWay</span><span style="color: blue;">}</span><span style="color: blue;">"</span><span style="color: red;"> AutoGenerateColumns</span><span style="color: blue;">=</span><span style="color: blue;">"False"</span><span style="color: blue;">&gt;</span>
<span style="color: #a31515;">    </span><span style="color: blue;">&lt;</span><span style="color: #a31515;">wpf</span><span style="color: blue;">:</span><span style="color: #a31515;">DataGrid.Columns</span><span style="color: blue;">&gt;</span>
<span style="color: #a31515;">        </span><span style="color: blue;">&lt;</span><span style="color: #a31515;">wpf</span><span style="color: blue;">:</span><span style="color: #a31515;">DataGridTextColumn</span><span style="color: red;"> Header</span><span style="color: blue;">="{</span><span style="color: #a31515;">Binding</span><span style="color: red;"> RelativeSource</span><span style="color: blue;">={</span><span style="color: #a31515;">RelativeSource</span><span style="color: red;"> Self</span><span style="color: blue;">},</span><span style="color: red;"> Path</span><span style="color: blue;">=(</span><span style="color: blue;">FrameworkElement</span><span style="color: blue;">.</span><span style="color: blue;">DataContext</span><span style="color: blue;">).</span><span style="color: blue;">DataHeader</span><span style="color: blue;">"</span><span style="color: red;"> Binding</span><span style="color: blue;">="{</span><span style="color: #a31515;">Binding</span><span style="color: red;"> Path</span><span style="color: blue;">=</span><span style="color: blue;">Data</span><span style="color: blue;">,</span><span style="color: red;"> Mode</span><span style="color: blue;">=</span><span style="color: blue;">OneWay</span><span style="color: blue;">}</span><span style="color: blue;">"</span><span style="color: blue;">/&gt;</span>
<span style="color: #a31515;">    </span><span style="color: blue;">&lt;/</span><span style="color: #a31515;">wpf</span><span style="color: blue;">:</span><span style="color: #a31515;">DataGrid.Columns</span><span style="color: blue;">&gt;</span>
<span style="color: #a31515;">    </span><span style="color: blue;">&lt;</span><span style="color: #a31515;">l</span><span style="color: blue;">:</span><span style="color: #a31515;">DataGridExtensions.ColumnDataContext</span><span style="color: blue;">&gt;</span>
<span style="color: #a31515;">        </span><span style="color: blue;">&lt;</span><span style="color: #a31515;">Binding</span><span style="color: red;"> ElementName</span><span style="color: blue;">=</span><span style="color: blue;">"control"</span><span style="color: red;"> Mode</span><span style="color: blue;">=</span><span style="color: blue;">"OneWay"</span><span style="color: red;"> Path</span><span style="color: blue;">=</span><span style="color: blue;">"HeaderNames"</span><span style="color: blue;">/&gt;</span>
<span style="color: #a31515;">    </span><span style="color: blue;">&lt;/</span><span style="color: #a31515;">l</span><span style="color: blue;">:</span><span style="color: #a31515;">DataGridExtensions.ColumnDataContext</span><span style="color: blue;">&gt;</span>
<span style="color: blue;">&lt;/</span><span style="color: #a31515;">wpf</span><span style="color: blue;">:</span><span style="color: #a31515;">DataGrid</span><span style="color: blue;">&gt;</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.errorok.com/2010/09/09/212/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Edmonton Tennis Courts</title>
		<link>http://blog.errorok.com/2010/03/08/160/</link>
		<comments>http://blog.errorok.com/2010/03/08/160/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 22:36:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[tennis]]></category>

		<guid isPermaLink="false">http://blog.errorok.com/?p=160</guid>
		<description><![CDATA[Just a quick posting that i had planned to do over a year ago.  Way back when i first got myself into tennis mode, I started scanning Edmonton for tennis courts.  I did the scanning on google maps, and my result was a pretty filled set of tennis courts in and around Edmonton. [...]]]></description>
			<content:encoded><![CDATA[<p>Just a quick posting that i had planned to do over a year ago.  Way back when i first got myself into tennis mode, I started scanning Edmonton for tennis courts.  I did the scanning on google maps, and my result was a pretty filled set of tennis courts in and around Edmonton.  And i mean PRETTY DAMN FILLED, as in, even private backyard courts are marked (sorry if this is your back yard court, i am just being complete).  While the private courts are probably not of any use, the public and semi-private ones might be.  So here is the map.  It is open for collaboration, so please do not vandalize it, and please contribute if you have anything new.</p>
<p><strong>EDIT</strong>: Sorry, i accidentally added a space in the link, it is now fixed.</p>
<p><a href="http://maps.google.com/maps/ms?ie=UTF&#038;msa=0&#038;msid=111280860624041810439.000435ccccd375c63c7c2">Edmonton and Area Tennis Courts</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.errorok.com/2010/03/08/160/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tracking IKS channels for FTA satellite</title>
		<link>http://blog.errorok.com/2010/02/25/189/</link>
		<comments>http://blog.errorok.com/2010/02/25/189/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 23:21:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[fta]]></category>
		<category><![CDATA[iks]]></category>
		<category><![CDATA[satellite]]></category>

		<guid isPermaLink="false">http://blog.errorok.com/2010/02/25/189/</guid>
		<description><![CDATA[I wanted to play around with some of my new work the last few days, so i decided to mash up one of my beta projects with a chance to learn the google visualization api.
My beta project was a research project on ruby, Hpricot, and XPath.  you can see the minimalist webpage for this [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to play around with some of my new work the last few days, so i decided to mash up one of my beta projects with a chance to learn the google visualization api.</p>
<p>My beta project was a research project on ruby, Hpricot, and XPath.  you can see the minimalist webpage for this project at <a href="http://llamabot.com/" target="_blank">http://llamabot.com/</a> and play around with it.  It is just a quick and easy way to scrape pages without having to know much of anything about the page structure.</p>
<p>This new mash-up combines the XPath for scraping various IKS channel counts with google&#8217;s dynamic data visualization widgets.  With the addition of a cron job, the web page is now fully automated.  While it currently has very little data, soon the data set will grow and this will become a useful method of determining which systems are better suited for different people.</p>
<p>Check out the results at <a href="http://fta.errorok.com/" target="_blank">http://fta.errorok.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.errorok.com/2010/02/25/189/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding a Home in Edmonton</title>
		<link>http://blog.errorok.com/2009/02/13/119/</link>
		<comments>http://blog.errorok.com/2009/02/13/119/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 23:50:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.errorok.com/?p=119</guid>
		<description><![CDATA[With the internet at your disposal, it seems like finding a new home should be relatively simple.  The truth is that this is true, but it always helps to be pointed in the right direction.  So given that, here are some pointers that helped me out when i was in search mode.
Where to look:

http://www.findmyedmontonhome.com/
http://www.mls.ca/splash.aspx
http://www.comfree.com/home

I found [...]]]></description>
			<content:encoded><![CDATA[<p>With the internet at your disposal, it seems like finding a new home should be relatively simple.  The truth is that this is true, but it always helps to be pointed in the right direction.  So given that, here are some pointers that helped me out when i was in search mode.</p>
<p>Where to look:</p>
<ul>
<li><a href="http://www.findmyedmontonhome.com/">http://www.findmyedmontonhome.com/</a></li>
<li><a href="http://www.mls.ca/splash.aspx">http://www.mls.ca/splash.aspx</a></li>
<li><a href="http://www.comfree.com/home">http://www.comfree.com/home</a></li>
</ul>
<p>I found that findmyedmontonhome worked best for me, it has the same database of homes that mls does, but the fine tuning of the search and the ease of navigation was much better.  I spent very little time looking at comfree mostly because when real estate is heading towards a buyer&#8217;s market, comfree listings tend to be over priced.  There is some rhyme and reason behind this; home owners are reluctant to drop their prices as they still expect that their home has not decreased in value.  The truth is that unless you are able to keep up with the changing market (which is totally possible), you <strong>NEED</strong> a realtor to market your house for you, they will handle all the small details of keeping your house appealing in the price department.  To sum things up, comfree listings were always priced a few months behind and I often found myself saying &#8220;gee, how the hell do they expect to sell <em>THAT</em> place at <em>THAT</em> price?&#8221;</p>
<p><strong>FIND A REALTOR</strong></p>
<p>This is so important!  Realtors have access to all kinds of extra information that is not available to the public (I&#8217;ve checked into it, only realtors have access to it).  The most important being that of the prices that homes have sold for in the surrounding areas where you are looking.  This can give you a lot of leverage when buying a home.  Realtors will also help show you around some of the homes you find interesting and likely point out things that you may have otherwise missed.  The bottom line is that when buying a home, the realtor works for you but gets paid by the seller, this type of business relationship is very beneficial to a home buyer.  One last mention, make sure you shop around for a realtor (ask friends, family, someone is bound to know a good one).  When it comes to starting the home buying process (the paperwork), a good realtor can mean a world of difference, between actually getting the home you want and letting it slip through your fingers.</p>
<p><strong>Negotiating</strong></p>
<p>Once you find the home you like (or homes if you have a hard time deciding between several), you put down your initial offer in a contract.  The contract will have two major sections that concern you, the condition date and the financing date.  It is easy to put offers on multiple homes because you get to remove the conditions at your leasure.  This means that if you put an offer in on 5 houses, and 4 sellers bite your offer (with a potential counter offer), you get to choose the one you like best and just let the other contracts expire.  Your conditions will likely include that the house is given a clean inspection (or at least relatively clean).  And financing revolves around your ability to get financing from the bank of your choice.  So even though you <em>could</em> get financing for each contract, you have to manually lift the conditions on each contract, and if the dates expire you are no longer bound to the contract.  Now, you likely do not want to pay for multiple inspections, that can get pricey, but the option is there which is nice. </p>
<p>The negotiation process is a bit like haggling for a t-shirt in Mexico, only instead of $1 and $2 it is instead $5,000 and $10,000 (depending on the price of the home i suppose).  But the concept is still very similar, start low but not too low or the seller might get offended and refuse to do your business.  The seller will almost always counter with a higher offer, upon which you should (in a buyer&#8217;s market especially) re-counter split down the middle.  Repeat this process (more or less) until you both agree on a price.  Like I said before, in a buyer&#8217;s market (like today), the buyer has the advantage of not losing the seller too easily with counter offers.  In a seller&#8217;s market the buyer must fight with other buyers for the seller&#8217;s home, which means they have to over bid the price.</p>
<p><strong>Research</strong></p>
<p>Do some research, as much as possible.  Here are some links to get you started:</p>
<ul>
<li><a href="http://www.ereb.com/REALTORSAssociationOfEdmonton.html" target="_blank">http://www.ereb.com/REALTORSAssociationOfEdmonton.html</a> - click on Latest Market Activity on the left and read up (especially the Monthly and Quarterly reports).</li>
<li><a href="http://spreadsheets.google.com/ccc?key=pjgVyIX-40-W8yD9s9BLjGQ" target="_blank">http://spreadsheets.google.com/ccc?key=pjgVyIX-40-W8yD9s9BLjGQ</a> &#8211; I have compiled (and will continue to compile) a lot of Edmonton real estate data.  Basically, I take the EREB reports and condense them down to nice graph-able data rows.</li>
</ul>
<p>Some RSS feeds to watch: </p>
<ul>
<li><a href="http://albertarealestatewatch.blogspot.com/feeds/posts/default?alt=rss" target="_blank">Alberta Real Estate Watch</a></li>
<li><a href="http://albertabubble.blogspot.com/feeds/posts/default" target="_blank">Alberta Bubble</a></li>
<li><a href="http://www.canadianmortgagetrends.com/canadian_mortgage_trends/index.rdf" target="_blank">Canadian Mortgage News &amp; Canada&#8217;s Mortgage Trends</a></li>
<li><a href="http://feeds.feedburner.com/chrisdavies/SZeK" target="_blank">Chris Davies</a></li>
<li><a href="http://www.edmontoncondoblog.com/?feed=rss" target="_blank">Edmonton Condo Blog</a></li>
<li><a href="http://edmontonhousingbust.blogspot.com/feeds/posts/default" target="_blank">Edmonton Housing Bust</a></li>
<li><a href="http://feeds.feedburner.com/EdmontonRealEstateBlog">Edmonton Real Estate Blog</a></li>
</ul>
<p>Remember to take everything you read with a grain of salt, while the author may be a professional, they often just voice their opinions.  Personally, I like to gather data, and dump it into a spreadsheet, then try and filter things down or graph numbers to see if I can get a bigger picture.  Here is one graph i have created that shows the extent of the Edmonton housing bubble:</p>
<p><a rel="attachment wp-att-120" href="http://blog.errorok.com/2009/02/13/119/2007_housing_bubble/"><img class="alignnone size-full wp-image-120" title="Edmonton Housing Prices" src="http://blog.errorok.com/wp-content/uploads/2009/02/2007_housing_bubble.png" alt="MoM and YoY price changes" width="725" height="192" /></a></p>
<p>and a closeup of the 2007 bubble:</p>
<p><a rel="attachment wp-att-121" href="http://blog.errorok.com/2009/02/13/119/2007_housing_bubble_closeup/"><img class="alignnone size-full wp-image-121" title="2007 Edmonton Housing Bubble" src="http://blog.errorok.com/wp-content/uploads/2009/02/2007_housing_bubble_closeup.png" alt="here you can see the full extent of the housing bubble" width="723" height="192" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.errorok.com/2009/02/13/119/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.467 seconds -->

