<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2enclosuresfull.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Joel Holder's Code Spool</title>
	
	<link>http://uberpwn.wordpress.com</link>
	<description>A Public Journey of Discovery</description>
	<lastBuildDate>Thu, 16 Feb 2012 08:39:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain="uberpwn.wordpress.com" port="80" path="/?rsscloud=notify" registerProcedure="" protocol="http-post" />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Joel Holder's Code Spool</title>
		<link>http://uberpwn.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://uberpwn.wordpress.com/osd.xml" title="Joel Holder's Code Spool" />
	
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/salientsignal" /><feedburner:info uri="salientsignal" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://uberpwn.wordpress.com/?pushpress=hub" /><itunes:explicit>no</itunes:explicit><itunes:subtitle>A Public Journey of Discovery</itunes:subtitle><feedburner:browserFriendly></feedburner:browserFriendly><item>
		<title>Sleek CLI wrappers around Ruby libs</title>
		<link>http://uberpwn.wordpress.com/2012/02/09/sleek-cli-wrappers-around-ruby-libs/</link>
		<comments>http://uberpwn.wordpress.com/2012/02/09/sleek-cli-wrappers-around-ruby-libs/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 08:02:26 +0000</pubDate>
		<dc:creator>joelholder</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[splat]]></category>
		<category><![CDATA[wrapper script]]></category>

		<guid isPermaLink="false">http://uberpwn.wordpress.com/?p=187</guid>
		<description><![CDATA[When using Ruby&#8217;s splat operator for method invocation, eg. my_method(*my_array), it takes the array and blows it out into the parameters required to fill the method&#8217;s signature. This makes it super easy to call methods from classes via the command line, by simply passing the arguments (ARGV) passed to a Ruby command line app directly [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpwn.wordpress.com&amp;blog=17277133&amp;post=187&amp;subd=uberpwn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When using Ruby&#8217;s splat operator for method invocation, eg. my_method(*my_array), it takes the array and blows it out into the parameters required to fill the method&#8217;s signature.  This makes it super easy to call methods from classes via the command line, by simply passing the arguments (ARGV) passed to a Ruby command line app directly down into a Ruby class API.  The key to my approach is to do this in a very DRY way with as little code as possible.  Here&#8217;s how I do it.</p>
<p>First we&#8217;ll create a file called seeker.rb with a class a API that looks like this:</p>
<p><pre class="brush: ruby;">
class Seeker
  def work_file(infile, outfile, suffix, delimeter)
    p &quot;parameter 1: infile = #{infile}&quot;
    p &quot;parameter 2: outfile = #{outfile}&quot;
    p &quot;parameter 3: suffix = #{suffix}&quot;
    p &quot;parameter 4: delimeter = #{delimeter}&quot;
    #do important stuff, etc..
  end
end
</pre></p>
<p>Now, we can create a generic wrapper script to drive it like this by doing the following. Create a file called just seeker.  Make sure to chmod +x seeker.  Add the following text:</p>
<p><pre class="brush: ruby;">
#!/usr/bin/env ruby

require File.expand_path('seeker.rb', __FILE__)
Seeker.new.send(ARGV.shift.to_sym, *ARGV)
</pre></p>
<p>With this generic message passing script in place, we can call the API like this:</p>
<p><code>$./seeker work_file foo.txt bar.txt .com ,</code></p>
<p>Running this command, we get the following output:</p>
<p><code>parameter 1: infile = foo.txt<br />
parameter 2: outfile = bar.txt<br />
parameter 3: suffix = .com<br />
parameter 4: delimeter = ,</code></p>
<p>The ease with which we&#8217;re able to pass input from the cli straight into our class API comes from the splat operator&#8217;s ability to turn an ordered set of cli args into Ruby method params.  Notice that we chewed off ARGV[0] as the name of the method we wanted to run.  Using the builtin &#8220;send&#8221; method, which sends a generic message to an instance of a Ruby class, we can invoke any method by simply specifying it as the first cli arg followed by the parameters to be passed into the method, which are just the subsequent cli args.</p>
<p>With a general purpose wrapper like this we can invoke any method on any target class with no additional code.  This is a testament to the sheer goodness of Ruby.  </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/uberpwn.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/uberpwn.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/uberpwn.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/uberpwn.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/uberpwn.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/uberpwn.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/uberpwn.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/uberpwn.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/uberpwn.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/uberpwn.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/uberpwn.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/uberpwn.wordpress.com/187/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/uberpwn.wordpress.com/187/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/uberpwn.wordpress.com/187/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpwn.wordpress.com&amp;blog=17277133&amp;post=187&amp;subd=uberpwn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://uberpwn.wordpress.com/2012/02/09/sleek-cli-wrappers-around-ruby-libs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aab5bcf3573f923f01af6ecfae077a5c?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">joelholder</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating a “Supernatural” Self-Adapting REST Proxy in C#</title>
		<link>http://uberpwn.wordpress.com/2011/04/20/creating-a-ghostly-self-adapting-rest-proxy-in-c/</link>
		<comments>http://uberpwn.wordpress.com/2011/04/20/creating-a-ghostly-self-adapting-rest-proxy-in-c/#comments</comments>
		<pubDate>Thu, 21 Apr 2011 04:43:38 +0000</pubDate>
		<dc:creator>joelholder</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://uberpwn.wordpress.com/?p=154</guid>
		<description><![CDATA[.NET 4.0’s DynamicObject provides a quick and easy way to hook into and control how a call for a method is dispatched at runtime.  This so called “late dispatch” capability is exactly what we need to easily create dynamic facades over out-of-process APIs, such as those of remote REST services. In this post, I’ll show [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpwn.wordpress.com&amp;blog=17277133&amp;post=154&amp;subd=uberpwn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>.NET 4.0’s DynamicObject provides a quick and easy way to hook into and control how a call for a method is dispatched at runtime.  This so called “late dispatch” capability is exactly what we need to easily create dynamic facades over out-of-process APIs, such as those of remote REST services.</p>
<p>In this post, I’ll show you how to take advantage of dynamic dispatch, in order to create an adaptive web agent that gets driven through a normal C# class API.  What I mean by normal, is that familiar dot syntax for calling methods from our objects.  However, in this case the methods we will be calling are not actually there; they are “<a href="http://www.timonv.nl/2011/01/18/unusual-ruby-metaprogramming-101-2-method" target="_blank">ghost methods</a>”.   They do not exist on the object whose receiving the call.  This might sound a bit strange to the uninitiated, but fear not, you’re about to get your secret decoder rings.  C#’s DynamicObject gives us the opportunity to delegate to remote service APIs transparently, without the knowledge or concern of the caller. </p>
<p>To demonstrate this in action, I created a small class called Flickr.  It inherits from DynamicObject and serves as our call dispatcher to Flickr’s REST API, which is available here: <span style="color:#a31515;"><a href="http://api.flickr.com/services/rest/">http://api.flickr.com/services/rest/</a></span>.  Here is the API documentation: <a title="http://www.flickr.com/services/api/" href="http://www.flickr.com/services/api/">http://www.flickr.com/services/api/</a>.  You can get API keys here: <a title="http://www.flickr.com/services/apps/create/apply" href="http://www.flickr.com/services/apps/create/apply">http://www.flickr.com/services/apps/create/apply</a>.</p>
<p>Each call you see in this TestMethod is actually to a method that does not exist in the definition of the Flickr class.</p>
<pre style="font-family:consolas;">[<span style="color:#2b91af;">TestMethod</span>]
<span style="color:blue;">public</span> <span style="color:blue;">void</span> Testing_Flickr()
{
    <span style="color:blue;">dynamic</span> flickr = <span style="color:blue;">new</span> <span style="color:#2b91af;">Flickr</span>();

    <span style="color:blue;">var</span> xml1 = flickr.people_findByUsername(username: <span style="color:#a31515;">"duncandavidson"</span>);

    <span style="color:blue;">var</span> xml2 = flickr.collections_getTree(user_id: <span style="color:#a31515;">"59532755@N00"</span>);

    <span style="color:blue;">var</span> xml3 = flickr.urls_getUserPhotos(user_id: <span style="color:#a31515;"><a href="mailto:59532755@N00">59532755@N00</a></span>);
}</pre>
<p>Each of these calls succeeds, and returns a response from Flickr’s service.  Note a few things about this code.  Flickr’s API has methods that look like this flickr.people.findByUsername and flickr.urls.getUserPhotos.  Notice the similarity above.  What I’ve done is replaced the dots with underscores, in order to make the functions legal C# method names.  As you’ll see below, we reformat the method name before attempting to call it on the remote Flickr service.  Additionally, note that we are using named parameters above in order to pass in both parameter name and parameter value to our ghost methods.  This allows us to pass any number of key-value paired parameters to any method name we want.  Here is the implementation of the Flickr class.</p>
<pre><span style="font-family:consolas;color:blue;">using</span><span style="font-family:consolas;"> System;
<span style="color:blue;">using</span> System.Collections.Generic;
<span style="color:blue;">using</span> System.Linq;
<span style="color:blue;">using</span> System.Text;
<span style="color:blue;">using</span> System.Dynamic;
<span style="color:blue;">using</span> System.Net;
 
<span style="color:blue;">public</span> <span style="color:blue;">class</span> <span style="color:#2b91af;">Flickr</span> : <span style="color:#2b91af;">DynamicObject</span>
{
    <span style="color:blue;">public</span> <span style="color:blue;">override</span> <span style="color:blue;">bool</span> TryInvokeMember(<span style="color:#2b91af;">InvokeMemberBinder</span> binder, <span style="color:blue;">object</span>[] args, <span style="color:blue;">out</span> <span style="color:blue;">object</span> result)
    {
        <span style="color:blue;">dynamic</span> request;
 
        request = <span style="color:blue;">new</span> <span style="color:#2b91af;">Func</span>&lt;<span style="color:blue;">object</span>&gt;(() =&gt;
        {
            <span style="color:green;">//format methodname</span>
            <span style="color:blue;">var</span> remoteMethodName = binder.Name.Replace(<span style="color:#a31515;">'_'</span>, <span style="color:#a31515;">'.'</span>);
 
            <span style="color:green;">//format parameters</span>
            <span style="color:blue;">var</span> queryStringBuilder = <span style="color:blue;">new</span> <span style="color:#2b91af;">StringBuilder</span>();
            <span style="color:blue;">for</span> (<span style="color:blue;">var</span> i = 0; i &lt; binder.CallInfo.ArgumentNames.Count; i++)
            {
                queryStringBuilder.Append(binder.CallInfo.ArgumentNames[i] + <span style="color:#a31515;">"="</span> + args[i] + <span style="color:#a31515;">"&amp;"</span>);
            }
 
            <span style="color:green;">//build rest message</span>
            <span style="color:blue;">var</span> baseUrl = <span style="color:#a31515;"><a href="http://api.flickr.com/services/rest/">http://api.flickr.com/services/rest/</a></span>;
            <span style="color:blue;">var</span> message = <span style="color:blue;">string</span>.Format(baseUrl + <span style="color:#a31515;">"?method=flickr.{0}&amp;{1}api_key=YOUR_KEY_HERE"</span>,
                                        remoteMethodName,
                                        queryStringBuilder.ToString());
 

            <span style="color:green;">//send</span>
            <span style="color:blue;">var</span> strResponse = <span style="color:blue;">new</span> <span style="color:#2b91af;">WebClient</span>().DownloadString(message);
 
            <span style="color:green;">//respond</span>
            <span style="color:blue;">return</span> strResponse;
        });
 
        result = (request <span style="color:blue;">as</span> <span style="color:#2b91af;">Delegate</span>).DynamicInvoke(); <span style="color:green;">//no need to pass args. they were set via closures above</span>
        <span style="color:blue;">return</span> <span style="color:blue;">true</span>;
    }
}
 </span></pre>
<p>As you can see, its DynamicObject’s TryInvokeMember method that is our seam for redelegating the call out to the web.   You may be asking yourself, why in the world would I want to do this.  The biggest advantage is that your local proxy API will always stay in sync with the Flickr service.  Even if they, extend the remote API I can call those methods without having to write a single line of additional plumbing code.  The reason is the responder to the call is not the actual Flickr class, but rather Flickr itself out on the web.  This seems simple and natural.  As it turns out, this type of runtime metaprogramming is becoming the preferred approach to interacting with cloud services via dynamic languages such as Python, Ruby, and JavaScript.  It enables applications to adapt to changes in one another&#8217;s interfaces automatically.   Now that C# has been endowed with dynamic, we can capitalize on the feature to build client-server apps that are less brittle and require little to no maintenance around the edges.  Perhaps best of all, the client api automatically already supports new behaviors immediately when they show up on the server.  Thats instant gratification for the extraordinarily low price of free.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/uberpwn.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/uberpwn.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/uberpwn.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/uberpwn.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/uberpwn.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/uberpwn.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/uberpwn.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/uberpwn.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/uberpwn.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/uberpwn.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/uberpwn.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/uberpwn.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/uberpwn.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/uberpwn.wordpress.com/154/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpwn.wordpress.com&amp;blog=17277133&amp;post=154&amp;subd=uberpwn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://uberpwn.wordpress.com/2011/04/20/creating-a-ghostly-self-adapting-rest-proxy-in-c/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aab5bcf3573f923f01af6ecfae077a5c?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">joelholder</media:title>
		</media:content>
	</item>
		<item>
		<title>Giving Your Data Some Functional Muscle With C#</title>
		<link>http://uberpwn.wordpress.com/2011/04/05/giving-your-data-some-functional-smarts-with-c/</link>
		<comments>http://uberpwn.wordpress.com/2011/04/05/giving-your-data-some-functional-smarts-with-c/#comments</comments>
		<pubDate>Wed, 06 Apr 2011 03:12:00 +0000</pubDate>
		<dc:creator>joelholder</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://uberpwn.wordpress.com/2011/04/05/giving-your-data-some-functional-smarts-with-c/</guid>
		<description><![CDATA[Today a colleague and I were going through some code.  I have recently been trying to impart to him the power and beauty in the functional programing paradigm in C#.  Today, the opportunity to demonstrate it presented itself as I was showing him how to use extension methods to extend Entities and ValueObjects with a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpwn.wordpress.com&amp;blog=17277133&amp;post=110&amp;subd=uberpwn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today a colleague and I were going through some code.  I have recently been trying to impart to him the power and beauty in the functional programing paradigm in C#.  Today, the opportunity to demonstrate it presented itself as I was showing him how to use extension methods to extend Entities and ValueObjects with a suite-to-purpose functional API.  As we began the code, I realized that what I really wanted to show him was the concept with no additional fluff.  First, the extension method part.</p>
<p>Here’s what I came up with:</p>
<pre><span style="font-family:Consolas;"><span style="color:#0000ff;">public</span><span style="color:#000000;"> </span><span style="color:#0000ff;">static</span><span style="color:#000000;"> </span><span style="color:#0000ff;">class</span><span style="color:#000000;"> </span><span style="color:#2b91af;">IntExtensions</span></span>
<span style="font-family:Consolas;"><span style="color:#000000;">{</span></span>
<span style="font-family:Consolas;"><span style="color:#000000;">    </span><span style="color:#0000ff;">public</span><span style="color:#000000;"> </span><span style="color:#0000ff;">static</span><span style="color:#000000;"> </span><span style="color:#0000ff;">void</span><span style="color:#000000;"> Times(</span><span style="color:#0000ff;">this</span><span style="color:#000000;"> </span><span style="color:#0000ff;">int</span><span style="color:#000000;"> count, </span><span style="color:#2b91af;">Action</span><span style="color:#000000;">&lt;</span><span style="color:#0000ff;">int</span><span style="color:#000000;">&gt; action)</span></span>
<span style="font-family:Consolas;"><span style="color:#000000;">    {</span></span>
<span style="font-family:Consolas;"><span style="color:#000000;">        </span><span style="color:#0000ff;">for</span><span style="color:#000000;"> (</span><span style="color:#0000ff;">var</span><span style="color:#000000;"> i = 0; i &lt; count; i++)</span></span>
<span style="font-family:Consolas;"><span style="color:#000000;">        {</span></span>
<span style="font-family:Consolas;"><span style="color:#000000;">            action(i);</span></span>
<span style="font-family:Consolas;"><span style="color:#000000;">        }</span></span>
<span style="font-family:Consolas;"><span style="color:#000000;">    }</span></span>
<span style="font-family:Consolas;"><span style="color:#000000;">}</span></span></pre>
<div style="height:60px;padding-top:35px;">
<p class="MsoNormal" style="line-height:normal;margin:0;">This small extension to the builtin int type, gives us a convenient and expressive functional API, driven directly from Int32 typed variables themselves.  Now, we can use it as follows.</p>
</div>
<pre><span style="font-family:Consolas;"><span style="color:#000000;">[</span><span style="color:#2b91af;">TestMethod</span><span style="color:#000000;">]</span></span>
<span style="font-family:Consolas;"><span style="color:#0000ff;">public</span><span style="color:#000000;"> </span><span style="color:#0000ff;">void</span><span style="color:#000000;"> SampleRepository_Can_Create_New()</span></span>
<span style="font-family:Consolas;"><span style="color:#000000;">{</span></span>
<span style="font-family:Consolas;"><span style="color:#000000;">     10.Times(i =&gt;</span></span>
<span style="font-family:Consolas;"><span style="color:#000000;">     {</span></span>
<span style="font-family:Consolas;"><span style="color:#0000ff;">          var</span><span style="color:#000000;"> sample = </span><span style="color:#2b91af;">TestObjects</span><span style="color:#000000;">.BuildSample();</span></span>
<span style="font-family:Consolas;"><span style="color:#000000;">          SampleRepository.Save(sample);</span></span>
<span style="font-family:Consolas;"><span style="color:#000000;">     });</span></span>

<span style="font-family:Consolas;"><span style="color:#0000ff;">     var</span><span style="color:#000000;"> samples = SampleRepository.GetAll();</span></span>
<span style="font-family:Consolas;"><span style="color:#000000;"><span style="line-height:11pt;text-indent:0;">     </span></span></span>
<span style="font-family:Consolas;"><span style="color:#000000;"><span style="line-height:11pt;text-indent:0;">     samples.Count().Times(i =&gt; <span style="color:#2b91af;">Debug</span>.WriteLine(<span style="color:#a31515;">"your index is "</span> + i));</span></span></span>

<span style="font-family:Consolas;"><span style="color:#2b91af;">     Assert</span><span style="color:#000000;">.IsTrue(samples.Count() == 10, </span><span style="color:#a31515;">"Should have 10 samples"</span><span style="color:#000000;">);</span></span>
<span style="line-height:11pt;"><span style="font-family:Consolas;"><span style="color:#000000;">}</span></span></span></pre>
<p>Rubyists recognize this API as its built into the language.  Its simple stepwise iteration driven directly off numeric types.  In C# we can use extension methods to shim this behavior into our scalers.  APIs that read like <strong>5.Times(doSomething); </strong>read like English.  This makes our code  more comprehensible by everyone, and that ladies and gentlemen is worth its weight in <a href="http://en.wikipedia.org/wiki/Fictional_currency">Gold Pressed Latinum</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/uberpwn.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/uberpwn.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/uberpwn.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/uberpwn.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/uberpwn.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/uberpwn.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/uberpwn.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/uberpwn.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/uberpwn.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/uberpwn.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/uberpwn.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/uberpwn.wordpress.com/110/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/uberpwn.wordpress.com/110/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/uberpwn.wordpress.com/110/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpwn.wordpress.com&amp;blog=17277133&amp;post=110&amp;subd=uberpwn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://uberpwn.wordpress.com/2011/04/05/giving-your-data-some-functional-smarts-with-c/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aab5bcf3573f923f01af6ecfae077a5c?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">joelholder</media:title>
		</media:content>
	</item>
		<item>
		<title>Ruby AOP in 12 lines of Code</title>
		<link>http://uberpwn.wordpress.com/2011/03/14/ruby-aop-in-12-lines-of-code/</link>
		<comments>http://uberpwn.wordpress.com/2011/03/14/ruby-aop-in-12-lines-of-code/#comments</comments>
		<pubDate>Tue, 15 Mar 2011 03:13:59 +0000</pubDate>
		<dc:creator>joelholder</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://uberpwn.wordpress.com/2011/03/14/ruby-aop-in-12-lines-of-code/</guid>
		<description><![CDATA[First, we shim the Ruby Object class with a profiling aspect, in this case an additional method called profile that will wrap any existing method with timing code that we tell it to. Lets put this in a file called: aop_extension.rb. class Object   def Object.profile symbol     _symbol = ("rprof_" + symbol.to_s).to_sym     alias_method [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpwn.wordpress.com&amp;blog=17277133&amp;post=99&amp;subd=uberpwn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>First, we shim the Ruby Object class with a profiling aspect, in this case an additional method called profile that will wrap any existing method with timing code that we tell it to.</p>
<p>Lets put this in a file called: <strong>aop_extension.rb</strong>.</p>
<pre><strong><span style="text-decoration:underline;"><span style="font-family:'Courier New';color:#a4357a;font-size:10pt;">c</span></span></strong><strong><span style="font-family:'Courier New';color:#a4357a;font-size:10pt;">lass</span></strong><span style="font-family:'Courier New';color:black;font-size:10pt;"> <span style="background:silver;">Object</span></span>

<strong><span style="font-family:'Courier New';color:#a4357a;font-size:10pt;">  def</span></strong><span style="font-family:'Courier New';color:black;font-size:10pt;"> <span style="background:silver;">Object</span>.profile symbol</span>

<span style="font-family:'Courier New';color:black;font-size:10pt;">    _symbol = (</span><span style="font-family:'Courier New';color:#2a00ff;font-size:10pt;">"rprof_"</span><span style="font-family:'Courier New';color:black;font-size:10pt;"> + symbol.to_s).to_sym</span>

<span style="font-family:'Courier New';color:black;font-size:10pt;">    alias_method _symbol, symbol</span>

<span style="font-family:'Courier New';font-size:10pt;">    <span style="color:#3f7f5f;"># Define the new wrapper method </span></span>

<strong><span style="font-family:'Courier New';color:#a4357a;font-size:10pt;">    self</span></strong><span style="font-family:'Courier New';color:black;font-size:10pt;">.send(</span><strong><span style="font-family:'Courier New';color:#ff4040;font-size:10pt;">:define_method</span></strong><span style="font-family:'Courier New';color:black;font-size:10pt;">, symbol.to_s) { |*args|</span>

<span style="font-family:'Courier New';color:black;font-size:10pt;">      start_time = Time.now</span>

<strong><span style="font-family:'Courier New';color:#a4357a;font-size:10pt;">      self</span></strong><span style="font-family:'Courier New';color:black;font-size:10pt;">.send(_symbol, *args)</span>

<span style="font-family:'Courier New';color:black;font-size:10pt;">      puts (Time.now - start_time).to_s +</span><span style="font-family:'Courier New';color:#2a00ff;font-size:10pt;"> " have elapsed"</span>

<span style="font-family:'Courier New';color:black;font-size:10pt;">    }</span>

<span style="font-family:'Courier New';color:black;font-size:10pt;">    puts</span><span style="font-family:'Courier New';color:#2a00ff;font-size:10pt;"> "The new method "</span><span style="font-family:'Courier New';color:black;font-size:10pt;"> + _symbol.to_s +</span><span style="font-family:'Courier New';color:#2a00ff;font-size:10pt;"> " has been created for method "</span><span style="font-family:'Courier New';color:black;font-size:10pt;"> + symbol.to_s</span>

<strong><span style="font-family:'Courier New';color:#a4357a;font-size:10pt;">  end</span></strong>

<strong><span style="font-family:'Courier New';color:#a4357a;font-size:10pt;">en</span></strong><span style="font-family:'Courier New';color:black;font-size:10pt;">d</span></pre>
<p>Now lets define a class that we can use as a test subject.  Create a file called <strong>greeter.rb</strong>.  Add the following:</p>
<pre> 

<span style="font-family:'Courier New';background:silver;color:black;font-size:10pt;">require</span><span style="font-family:'Courier New';color:#2a00ff;font-size:10pt;"> "./aop_extension.rb"</span>

<span style="font-family:'Courier New';font-size:10pt;"> </span>

<strong><span style="font-family:'Courier New';color:#a4357a;font-size:10pt;">class</span></strong><span style="font-family:'Courier New';color:black;font-size:10pt;"> Greeter</span>

<strong><span style="font-family:'Courier New';color:#a4357a;font-size:10pt;">   def</span></strong><span style="font-family:'Courier New';color:black;font-size:10pt;"> hello</span>

<span style="font-family:'Courier New';color:black;font-size:10pt;">    puts</span><span style="font-family:'Courier New';color:#2a00ff;font-size:10pt;"> "hello"</span>

<strong><span style="font-family:'Courier New';color:#a4357a;font-size:10pt;">  end</span></strong>

<span style="font-family:'Courier New';color:black;font-size:10pt;">  profile</span><strong><span style="font-family:'Courier New';color:#ff4040;font-size:10pt;"> :hello</span></strong>

<strong><span style="line-height:115%;font-family:'Courier New';color:#a4357a;font-size:10pt;">en</span></strong><span style="line-height:115%;font-family:'Courier New';color:black;font-size:10pt;">d</span></pre>
<p>Notice that in the constructor code we tell the inherited profile method to go after the “hello” method.  This creates a proxy method that will run the targeted method on behalf of callers.</p>
<p>Now lets see this thing in action.  For this we’ll create a file called <strong>main.rb</strong>.  Add the following:</p>
<pre><span style="font-family:'Courier New';background:silver;color:black;font-size:10pt;">require</span><span style="font-family:'Courier New';color:#2a00ff;font-size:10pt;"> "./greeter.rb"</span>

<span style="font-family:'Courier New';font-size:10pt;"> </span>

<span style="font-family:'Courier New';color:black;font-size:10pt;">t = Greeter.new</span>

<span style="line-height:115%;font-family:'Courier New';color:black;font-size:10pt;">t.hello</span></pre>
<p>Finally, after all this extra heavy lifting we can see the goodness shining through in the output:</p>
<p><strong><span style="color:#0000ff;">$ ruby main.rb</span><br />
The new method rprof_hello has been created for method hello<br />
hello<br />
0.001 have elapsed</strong></p>
<p>Wow, we didn’t even break a sweat on that one.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/uberpwn.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/uberpwn.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/uberpwn.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/uberpwn.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/uberpwn.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/uberpwn.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/uberpwn.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/uberpwn.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/uberpwn.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/uberpwn.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/uberpwn.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/uberpwn.wordpress.com/99/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/uberpwn.wordpress.com/99/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/uberpwn.wordpress.com/99/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpwn.wordpress.com&amp;blog=17277133&amp;post=99&amp;subd=uberpwn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://uberpwn.wordpress.com/2011/03/14/ruby-aop-in-12-lines-of-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aab5bcf3573f923f01af6ecfae077a5c?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">joelholder</media:title>
		</media:content>
	</item>
		<item>
		<title>Property getter/setter extraction from C# Types</title>
		<link>http://uberpwn.wordpress.com/2011/03/12/property-gettersetter-extraction-from-c-types/</link>
		<comments>http://uberpwn.wordpress.com/2011/03/12/property-gettersetter-extraction-from-c-types/#comments</comments>
		<pubDate>Sun, 13 Mar 2011 05:41:42 +0000</pubDate>
		<dc:creator>joelholder</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://uberpwn.wordpress.com/2011/03/12/property-gettersetter-extraction-from-c-types/</guid>
		<description><![CDATA[The C# Expression API allows you to scrape property and method definitions from Types and work with them as external references.  See here: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Linq.Expressions; using System.Dynamic; using System.Runtime.CompilerServices; public static class Extensions  {        public static Func&#60;X, T&#62; GetPropertyFunction&#60;X, T&#62;(this Type source, string name) { ParameterExpression param = Expression.Parameter(typeof(X), "arg");              MemberExpression [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpwn.wordpress.com&amp;blog=17277133&amp;post=77&amp;subd=uberpwn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal">The C# Expression API allows you to scrape property and method definitions from Types and work with them as external references.  See here:</p>
<pre>

<span style="font-family:consolas;color:blue;">using</span><span style="font-family:consolas;"> System;
<span style="color:blue;">using</span> System.Collections.Generic;
<span style="color:blue;">using</span> System.Linq;
<span style="color:blue;">using</span> System.Text;
<span style="color:blue;">using</span> System.Linq.Expressions;
<span style="color:blue;">using</span> System.Dynamic;
<span style="color:blue;">using</span> System.Runtime.CompilerServices;

<span style="color:blue;">public</span> <span style="color:blue;">static</span> <span style="color:blue;">class</span> <span style="color:#2b91af;">Extensions</span></span></pre>
<pre style="min-height:200px;">

<span style="font-family:consolas;"><span style="color:#2b91af;"> </span></span><span style="font-family:consolas;">{
       <span style="color:blue;">public</span> <span style="color:blue;">static</span> <span style="color:#2b91af;">Func</span>&lt;X, T&gt; GetPropertyFunction&lt;X, T&gt;(<span style="color:blue;">this</span> <span style="color:#2b91af;">Type</span> source, <span style="color:blue;">string</span> name)
          {
             <span style="color:#2b91af;">ParameterExpression</span> param = <span style="color:#2b91af;">Expression</span>.Parameter(<span style="color:blue;">typeof</span>(X), <span style="color:#a31515;">"arg"</span>);
             <span style="color:#2b91af;">MemberExpression</span> member = <span style="color:#2b91af;">Expression</span>.Property(param, name);
             <span style="color:#2b91af;">LambdaExpression</span> lambda = <span style="color:#2b91af;">Expression</span>.Lambda(<span style="color:blue;">typeof</span>(<span style="color:#2b91af;">Func</span>&lt;X, T&gt;), member, param);
             <span style="color:#2b91af;">Func</span>&lt;X, T&gt; compiled = (<span style="color:#2b91af;">Func</span>&lt;X, T&gt;)lambda.Compile();
             <span style="color:blue;">return</span> compiled;
         }
}
</span>
</pre>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal">And you can use it like this:</p>
<pre style="min-height:300px;">

<span style="font-family:consolas;">[<span style="color:#2b91af;">TestMethod</span>]
<span style="color:blue;">public</span> <span style="color:blue;">void</span> TestMethod1()
         {
             <span style="color:blue;">var</span> testObj = <span style="color:blue;">new</span> <span style="color:#2b91af;">TestObject</span>
             {
                 ID = 1,
                 Description = <span style="color:#a31515;">"ASDFASDF"</span>,
                 Name = <span style="color:#a31515;">"GGGG"</span>,
                 UnitPrice = 6
             };

             <span style="color:#2b91af;">Type</span> type = <span style="color:blue;">typeof</span>(<span style="color:#2b91af;">TestObject</span>);
             <span style="color:blue;">var</span> getName = type.GetPropertyFunction&lt;<span style="color:#2b91af;">TestObject</span>, <span style="color:#2b91af;">String</span>&gt;(<span style="color:#a31515;">"Name"</span>);
             <span style="color:#2b91af;">String</span> value = getName(testObj);

             <span style="color:#2b91af;">Assert</span>.IsTrue(value == testObj.Name);
       }</span></pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/uberpwn.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/uberpwn.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/uberpwn.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/uberpwn.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/uberpwn.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/uberpwn.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/uberpwn.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/uberpwn.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/uberpwn.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/uberpwn.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/uberpwn.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/uberpwn.wordpress.com/77/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/uberpwn.wordpress.com/77/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/uberpwn.wordpress.com/77/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpwn.wordpress.com&amp;blog=17277133&amp;post=77&amp;subd=uberpwn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://uberpwn.wordpress.com/2011/03/12/property-gettersetter-extraction-from-c-types/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aab5bcf3573f923f01af6ecfae077a5c?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">joelholder</media:title>
		</media:content>
	</item>
		<item>
		<title>My C# ObservableDictionary</title>
		<link>http://uberpwn.wordpress.com/2011/03/12/my-c-observabledictionary/</link>
		<comments>http://uberpwn.wordpress.com/2011/03/12/my-c-observabledictionary/#comments</comments>
		<pubDate>Sun, 13 Mar 2011 04:39:18 +0000</pubDate>
		<dc:creator>joelholder</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://uberpwn.wordpress.com/2011/03/12/my-c-observabledictionary/</guid>
		<description><![CDATA[using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.ComponentModel;using System.Collections.Specialized; namespace DynamicSpikes{&#160;&#160;&#160; public&#160;class&#160;ObservableDictionary&#60;String, Object&#62; : Dictionary&#60;string, object&#62;, INotifyPropertyChanged, INotifyCollectionChanged&#160;&#160;&#160; { &#160;&#160;&#160;&#160;&#160;&#160;&#160; public&#160;event&#160;PropertyChangedEventHandler PropertyChanged = delegate { };&#160;&#160;&#160;&#160;&#160;&#160;&#160; public&#160;event&#160;NotifyCollectionChangedEventHandler CollectionChanged = delegate { }; &#160;&#160;&#160;&#160;&#160;&#160;&#160; private&#160;void OnCollectionChanged(object sender, NotifyCollectionChangedAction action, object value)&#160;&#160;&#160;&#160;&#160;&#160;&#160; {&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (CollectionChanged != null)&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; CollectionChanged(sender, new&#160;NotifyCollectionChangedEventArgs(action, value));&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }&#160;&#160;&#160;&#160;&#160;&#160;&#160; } &#160;&#160;&#160;&#160;&#160;&#160;&#160; private&#160;void OnPropertyChanged(object sender, string propertyName)&#160;&#160;&#160;&#160;&#160;&#160;&#160; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpwn.wordpress.com&amp;blog=17277133&amp;post=70&amp;subd=uberpwn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><code style="font-family:consolas;"><span style="color:blue;">using</span> System;<br /><span style="color:blue;">using</span> System.Collections.Generic;<br /><span style="color:blue;">using</span> System.Linq;<br /><span style="color:blue;">using</span> System.Text;<br /><span style="color:blue;">using</span> System.ComponentModel;<br /><span style="color:blue;">using</span> System.Collections.Specialized;</p>
<p><span style="color:blue;">namespace</span> DynamicSpikes<br />{<br />&nbsp;&nbsp;&nbsp; <span style="color:blue;">public</span>&nbsp;<span style="color:blue;">class</span>&nbsp;<span style="color:#2b91af;">ObservableDictionary</span>&lt;String, Object&gt; : <span style="color:#2b91af;">Dictionary</span>&lt;<span style="color:blue;">string</span>, <span style="color:blue;">object</span>&gt;, <span style="color:#2b91af;">INotifyPropertyChanged</span>, <span style="color:#2b91af;">INotifyCollectionChanged</span><br />&nbsp;&nbsp;&nbsp; {</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">public</span>&nbsp;<span style="color:blue;">event</span>&nbsp;<span style="color:#2b91af;">PropertyChangedEventHandler</span> PropertyChanged = <span style="color:blue;">delegate</span> { };<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">public</span>&nbsp;<span style="color:blue;">event</span>&nbsp;<span style="color:#2b91af;">NotifyCollectionChangedEventHandler</span> CollectionChanged = <span style="color:blue;">delegate</span> { };</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">private</span>&nbsp;<span style="color:blue;">void</span> OnCollectionChanged(<span style="color:blue;">object</span> sender, <span style="color:#2b91af;">NotifyCollectionChangedAction</span> action, <span style="color:blue;">object</span> value)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">if</span> (CollectionChanged != <span style="color:blue;">null</span>)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CollectionChanged(sender, <span style="color:blue;">new</span>&nbsp;<span style="color:#2b91af;">NotifyCollectionChangedEventArgs</span>(action, value));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">private</span>&nbsp;<span style="color:blue;">void</span> OnPropertyChanged(<span style="color:blue;">object</span> sender, <span style="color:blue;">string</span> propertyName)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">if</span> (PropertyChanged != <span style="color:blue;">null</span>)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PropertyChanged(<span style="color:blue;">this</span>, <span style="color:blue;">new</span>&nbsp;<span style="color:#2b91af;">PropertyChangedEventArgs</span>(propertyName));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">public</span>&nbsp;<span style="color:blue;">new</span>&nbsp;<span style="color:blue;">void</span> Add(<span style="color:blue;">string</span> key, <span style="color:blue;">object</span> value)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">base</span>.Add(key, value);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OnCollectionChanged(<span style="color:blue;">this</span>, <span style="color:#2b91af;">NotifyCollectionChangedAction</span>.Add, <span style="color:blue;">new</span>&nbsp;<span style="color:#2b91af;">KeyValuePair</span>&lt;<span style="color:blue;">string</span>, <span style="color:blue;">object</span>&gt;(key, value));</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:green;">//OnPropertyChanged(this, "Values");</span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:green;">//OnPropertyChanged(this, "Keys");</span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:green;">//OnPropertyChanged(this, "Count");</span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">public</span>&nbsp;<span style="color:blue;">new</span>&nbsp;<span style="color:blue;">bool</span> Remove(<span style="color:blue;">string</span> key)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">var</span> kvp = <span style="color:blue;">base</span>[key];<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">var</span> result = <span style="color:blue;">base</span>.Remove(key);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">if</span> (result)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OnCollectionChanged(<span style="color:blue;">this</span>, <span style="color:#2b91af;">NotifyCollectionChangedAction</span>.Remove, kvp);</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:green;">//OnPropertyChanged(this, "Values");</span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:green;">//OnPropertyChanged(this, "Keys");</span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:green;">//OnPropertyChanged(this, "Count");</span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">return</span> result;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">public</span>&nbsp;<span style="color:blue;">new</span>&nbsp;<span style="color:blue;">object</span>&nbsp;<span style="color:blue;">this</span>[<span style="color:blue;">string</span> key]<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">get</span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">return</span>&nbsp;<span style="color:blue;">base</span>[key];<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">set</span><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">base</span>[key] = <span style="color:blue;">value</span>;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PropertyChanged(<span style="color:blue;">this</span>, <span style="color:blue;">new</span>&nbsp;<span style="color:#2b91af;">PropertyChangedEventArgs</span>(key)); <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp; }</p>
<p>}<br /></code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/uberpwn.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/uberpwn.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/uberpwn.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/uberpwn.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/uberpwn.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/uberpwn.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/uberpwn.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/uberpwn.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/uberpwn.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/uberpwn.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/uberpwn.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/uberpwn.wordpress.com/70/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/uberpwn.wordpress.com/70/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/uberpwn.wordpress.com/70/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpwn.wordpress.com&amp;blog=17277133&amp;post=70&amp;subd=uberpwn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://uberpwn.wordpress.com/2011/03/12/my-c-observabledictionary/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aab5bcf3573f923f01af6ecfae077a5c?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">joelholder</media:title>
		</media:content>
	</item>
		<item>
		<title>C# Introspection With StackTrace</title>
		<link>http://uberpwn.wordpress.com/2011/03/12/tracing-method-for-instrumenting-c-call-chains/</link>
		<comments>http://uberpwn.wordpress.com/2011/03/12/tracing-method-for-instrumenting-c-call-chains/#comments</comments>
		<pubDate>Sun, 13 Mar 2011 04:26:10 +0000</pubDate>
		<dc:creator>joelholder</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://uberpwn.wordpress.com/2011/03/12/tracing-method-for-instrumenting-c-call-chains/</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160;&#160; public static&#160;string WhoCalledMe()&#160;&#160;&#160;&#160;&#160;&#160;&#160; {&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var st = new&#160;StackTrace();&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var sf = st.GetFrame(1);&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var mb = sf.GetMethod();&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; return mb.Name;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpwn.wordpress.com&amp;blog=17277133&amp;post=68&amp;subd=uberpwn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><code style="font-family:consolas;"><span style="font-family:consolas;color:blue;font-size:10pt;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public static</span><span style="font-family:consolas;font-size:10pt;">&nbsp;<span style="color:blue;">string</span> WhoCalledMe()<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">var</span> st = <span style="color:blue;">new</span>&nbsp;<span style="color:#2b91af;">StackTrace</span>();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">var</span> sf = st.GetFrame(1);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">var</span> mb = sf.GetMethod();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">return</span> mb.Name;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></code></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/uberpwn.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/uberpwn.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/uberpwn.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/uberpwn.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/uberpwn.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/uberpwn.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/uberpwn.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/uberpwn.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/uberpwn.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/uberpwn.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/uberpwn.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/uberpwn.wordpress.com/68/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/uberpwn.wordpress.com/68/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/uberpwn.wordpress.com/68/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpwn.wordpress.com&amp;blog=17277133&amp;post=68&amp;subd=uberpwn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://uberpwn.wordpress.com/2011/03/12/tracing-method-for-instrumenting-c-call-chains/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aab5bcf3573f923f01af6ecfae077a5c?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">joelholder</media:title>
		</media:content>
	</item>
		<item>
		<title>Webshims – HTML5 For The Masses</title>
		<link>http://uberpwn.wordpress.com/2011/02/25/webshims-html5-now-html5-everywhere/</link>
		<comments>http://uberpwn.wordpress.com/2011/02/25/webshims-html5-now-html5-everywhere/#comments</comments>
		<pubDate>Fri, 25 Feb 2011 06:39:30 +0000</pubDate>
		<dc:creator>joelholder</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://uberpwn.wordpress.com/?p=60</guid>
		<description><![CDATA[I’ve been researching the available shimming libaries out there that provide old browsers with modern features.  The Webshims library does this in an efficient and unobtrusive way, always defering to the browser&#8217;s built in feature if it exists natively.  With 2 lines of code you tell it where to find its shim scripts and then to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpwn.wordpress.com&amp;blog=17277133&amp;post=60&amp;subd=uberpwn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I’ve been researching the available shimming libaries out there that provide old browsers with modern features.  The <a href="http://afarkas.github.com/webshim/demos/" target="_blank">Webshims</a> library does this in an efficient and unobtrusive way, always defering to the browser&#8217;s built in feature if it exists natively.  With 2 lines of code you tell it where to find its shim scripts and then to discover and patch any missing HTML5 features in your browser.  I’ve provided a complete working sample of how to ensure the HTML5 localStorage API in all browsers.</p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#0000ff;">&lt;!</span><span style="color:#800000;">DOCTYPE</span><span style="color:#000000;"> </span><span style="color:#ff0000;">html</span><span style="color:#0000ff;">&gt;</span><span style="color:#000000;"> </span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">html</span><span style="color:#000000;"> </span><span style="color:#ff0000;">lang</span><span style="color:#0000ff;">=&#8221;en&#8221;&gt;</span><span style="color:#000000;"> </span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">head</span><span style="color:#0000ff;">&gt;</span><span style="color:#000000;"> </span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> </span><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">meta</span><span style="color:#000000;"> </span><span style="color:#ff0000;">http-equiv</span><span style="color:#0000ff;">=&#8221;Content-Type&#8221;</span><span style="color:#000000;"> </span><span style="color:#ff0000;">content</span><span style="color:#0000ff;">=&#8221;text/html; charset=utf-8&#8243;&gt;</span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> </span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> </span><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">script</span><span style="color:#000000;"> </span><span style="color:#ff0000;">src</span><span style="color:#0000ff;">=&#8221;http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js&#8221;&gt;&lt;/</span><span style="color:#800000;">script</span><span style="color:#0000ff;">&gt;</span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> </span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> </span><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">script</span><span style="color:#000000;"> </span><span style="color:#ff0000;">src</span><span style="color:#0000ff;">=&#8221;/scripts/js-webshim/dev/polyfiller.js&#8221;&gt;&lt;/</span><span style="color:#800000;">script</span><span style="color:#0000ff;">&gt;</span><span style="color:#000000;"> </span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> </span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> </span><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">script</span><span style="color:#0000ff;">&gt;</span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> </span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> </span><span style="color:#006400;">//path is path of polyfiller.js-code + shims/ </span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> $.webshims.loader.basePath += </span><span style="color:#800000;">&#8216;shims/&#8217;</span><span style="color:#000000;">;</span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> </span><span style="color:#006400;">//load and implement all unsupported features </span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> $.webshims.polyfill();</span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> </span><span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">script</span><span style="color:#0000ff;">&gt;</span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> </span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> </span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> </span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> </span><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">script</span><span style="color:#0000ff;">&gt;</span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> $.webshims.ready(</span><span style="color:#800000;">&#8216;json-storage&#8217;</span><span style="color:#000000;">, </span><span style="color:#0000ff;">function</span><span style="color:#000000;"> () {</span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> </span><span style="color:#006400;">//work with JSON and localStorage</span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> localStorage.setItem(</span><span style="color:#800000;">&#8220;name&#8221;</span><span style="color:#000000;">, </span><span style="color:#800000;">&#8220;Hello World!&#8221;</span><span style="color:#000000;">); </span><span style="color:#006400;">//saves to the database, &#8220;key&#8221;, &#8220;value&#8221;</span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> document.write(window.localStorage.getItem(</span><span style="color:#800000;">&#8220;name&#8221;</span><span style="color:#000000;">)); </span><span style="color:#006400;">//Hello World!</span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> localStorage.removeItem(</span><span style="color:#800000;">&#8220;name&#8221;</span><span style="color:#000000;">); </span><span style="color:#006400;">//deletes the matching item from the database</span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> });</span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> </span><span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">script</span><span style="color:#0000ff;">&gt;</span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> </span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> </span><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">title</span><span style="color:#0000ff;">&gt;</span><span style="color:#000000;">localStorage() &#8211; Sample</span><span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">title</span><span style="color:#0000ff;">&gt;</span><span style="color:#000000;"> </span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">head</span><span style="color:#0000ff;">&gt;</span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#0000ff;">&lt;</span><span style="color:#800000;">body</span><span style="color:#0000ff;">&gt;</span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#000000;"> </span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">body</span><span style="color:#0000ff;">&gt;</span></span></p>
<p class="MsoNormal" style="line-height:normal;margin:0;"><span style="font-family:Consolas;"><span style="color:#0000ff;">&lt;/</span><span style="color:#800000;">html</span><span style="color:#0000ff;">&gt;</span></span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/uberpwn.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/uberpwn.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/uberpwn.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/uberpwn.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/uberpwn.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/uberpwn.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/uberpwn.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/uberpwn.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/uberpwn.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/uberpwn.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/uberpwn.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/uberpwn.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/uberpwn.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/uberpwn.wordpress.com/60/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpwn.wordpress.com&amp;blog=17277133&amp;post=60&amp;subd=uberpwn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://uberpwn.wordpress.com/2011/02/25/webshims-html5-now-html5-everywhere/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aab5bcf3573f923f01af6ecfae077a5c?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">joelholder</media:title>
		</media:content>
	</item>
		<item>
		<title>Metaprogramming in Ruby and C#</title>
		<link>http://uberpwn.wordpress.com/2011/02/16/metaprogramming-in-ruby-and-c/</link>
		<comments>http://uberpwn.wordpress.com/2011/02/16/metaprogramming-in-ruby-and-c/#comments</comments>
		<pubDate>Wed, 16 Feb 2011 08:47:59 +0000</pubDate>
		<dc:creator>joelholder</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://uberpwn.wordpress.com/?p=46</guid>
		<description><![CDATA[First read this and understand metaprogramming in Ruby: http://www.devsource.com/c/a/Languages/An-Exercise-in-Metaprogramming-with-Ruby/ It seems that C# dynamic supports a similar scenario, but in a different way. C# dynamic objects are in fact not new Types created at runtime, but rather individual compiler-safe bags of key/value pairs that self expose the keys as properties. Thus C# dynamic objects are [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpwn.wordpress.com&amp;blog=17277133&amp;post=46&amp;subd=uberpwn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>First read this and understand metaprogramming in Ruby: <a title="An Exercise in Metaprogramming with Ruby" href="http://www.devsource.com/c/a/Languages/An-Exercise-in-Metaprogramming-with-Ruby/">http://www.devsource.com/c/a/Languages/An-Exercise-in-Metaprogramming-with-Ruby/</a></p>
<p>It seems that C# dynamic supports a similar scenario, but in a different way. C# dynamic objects are in fact not new Types created at runtime, but rather individual compiler-safe bags of key/value pairs that self expose the keys as properties. Thus C# dynamic objects are only available as defined at the instance level and those instances are of type DynamicObject.</p>
<p>The technique I demonstrate in this post: <a href="http://uberpwn.wordpress.com/2009/12/21/property-copying-with-dynamic-objects-in-net-4-0/">http://uberpwn.wordpress.com/2009/12/21/property-copying-with-dynamic-objects-in-net-4-0/</a> could be modified to take its key/value pair input from a csv to achieve the same result.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/uberpwn.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/uberpwn.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/uberpwn.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/uberpwn.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/uberpwn.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/uberpwn.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/uberpwn.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/uberpwn.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/uberpwn.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/uberpwn.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/uberpwn.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/uberpwn.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/uberpwn.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/uberpwn.wordpress.com/46/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpwn.wordpress.com&amp;blog=17277133&amp;post=46&amp;subd=uberpwn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://uberpwn.wordpress.com/2011/02/16/metaprogramming-in-ruby-and-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aab5bcf3573f923f01af6ecfae077a5c?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">joelholder</media:title>
		</media:content>
	</item>
		<item>
		<title>Loading Scripts As Strings into the DOM with JQuery</title>
		<link>http://uberpwn.wordpress.com/2010/11/01/loading-scripts-as-strings-into-the-dom-with-jquery/</link>
		<comments>http://uberpwn.wordpress.com/2010/11/01/loading-scripts-as-strings-into-the-dom-with-jquery/#comments</comments>
		<pubDate>Tue, 02 Nov 2010 01:49:24 +0000</pubDate>
		<dc:creator>joelholder</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://uberpwn.wordpress.com/2010/11/01/loading-scripts-as-strings-into-the-dom-with-jquery/</guid>
		<description><![CDATA[Here’s why JavaScript is teh awsome: var ns = {}; $(document).ready(function () { $(&#8216;&#60;scrip&#8217;+'t&#62;ns.blah=function(){alert(&#8220;hi&#8221;);};&#60;/scr&#8217;+'ipt&#62;&#8217;) .appendTo(&#8216;body&#8217;); ns.blah(); }); With this I get: Here play with it yourself. http://www.jsfiddle.net/nVuNZ/ Consider the deployment and update scenarios enabled using this technique with a modular application pattern.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpwn.wordpress.com&amp;blog=17277133&amp;post=43&amp;subd=uberpwn&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here’s why JavaScript is teh awsome:</p>
<p>var ns = {};<br />
$(document).ready(function () {<br />
$(&#8216;&lt;scrip&#8217;+'t&gt;ns.blah=function(){alert(&#8220;hi&#8221;);};&lt;/scr&#8217;+'ipt&gt;&#8217;)<br />
.appendTo(&#8216;body&#8217;);<br />
ns.blah();<br />
});</p>
<p>With this I get:</p>
<p><a href="http://uberpwn.files.wordpress.com/2010/11/image.png"><img style="display:inline;border:0;" title="image" src="http://uberpwn.files.wordpress.com/2010/11/image_thumb.png?w=338&#038;h=118" border="0" alt="image" width="338" height="118" /></a></p>
<p>Here play with it yourself.</p>
<p><a href="http://www.jsfiddle.net/nVuNZ/">http://www.jsfiddle.net/nVuNZ/</a></p>
<p>Consider the deployment and update scenarios enabled using this technique with a modular application pattern.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/uberpwn.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/uberpwn.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/uberpwn.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/uberpwn.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/uberpwn.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/uberpwn.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/uberpwn.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/uberpwn.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/uberpwn.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/uberpwn.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/uberpwn.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/uberpwn.wordpress.com/43/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/uberpwn.wordpress.com/43/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/uberpwn.wordpress.com/43/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=uberpwn.wordpress.com&amp;blog=17277133&amp;post=43&amp;subd=uberpwn&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://uberpwn.wordpress.com/2010/11/01/loading-scripts-as-strings-into-the-dom-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/aab5bcf3573f923f01af6ecfae077a5c?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">joelholder</media:title>
		</media:content>

		<media:content url="http://uberpwn.files.wordpress.com/2010/11/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
	<media:rating>nonadult</media:rating></channel>
</rss>

