﻿<?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>Programming By A Tool</title>
	<atom:link href="http://byatool.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://byatool.com</link>
	<description>Like Ma Bell, I've got the Ill Communication.</description>
	<lastBuildDate>Fri, 27 Aug 2010 14:05:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Quick Example of Inheritance in Templates with Mako: Using Next</title>
		<link>http://byatool.com/python/quick-example-of-inheritance-in-templates-with-mako-using-next/</link>
		<comments>http://byatool.com/python/quick-example-of-inheritance-in-templates-with-mako-using-next/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 14:05:33 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Mako]]></category>
		<category><![CDATA[Pylons]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1563</guid>
		<description><![CDATA[So as I further my side journey into Python, or Pylons to be more exact, one of the decent things I&#8217;ve run into is that Mako templating system. What is that? It&#8217;s what runs along side of Pylons (Or at least one of many) for displaying the View side of the whole MVC thing. Now [...]]]></description>
			<content:encoded><![CDATA[<p>So as I further my side journey into Python, or Pylons to be more exact, one of the decent things I&#8217;ve run into is that Mako templating system.  What is that?  It&#8217;s what runs along side of Pylons (Or at least one of many) for displaying the View side of the whole MVC thing.  Now if you&#8217;re here, chances are you just searched on this so I wouldn&#8217;t go into a huge thing about Pylons or Mako.  I&#8217;ll just get to the damn point.</p>
<p>This is just an example of a three layer template I use to help with pumping out pages with out repeating a lot of code.  The nice thing about Mako is how simple it is to have multiple layers of templates to make up a single page.  This is basically done with using the next keyword.</p>
<p><strong>What is next? </strong><br />
Mako has a system that works something like an abstract class.  A page template can define a certain area in a method like way and like an abstract method, there is no method body.  Any page template that &#8220;inherits&#8221; the base has to fill in the body or create an abstract method itself to call the original method.</p>
<p>Now with that being said, there are two key words for doing this and the default keyword is self.  Problem with self is that it looks at the top most template only.  So if you have say 3 layers:</p>
<p>BasePage -&gt; SecondLayer -&gt; ThirdLayer</p>
<p>self will always look to the third layer:</p>
<p>BasePage -&gt; ThirdLayer</p>
<p>While second layer is all like, &#8220;Yeah whateve&#8221;.  Overall, this isn&#8217;t very helpful if you want a sort of chain like effect.  Its basically like a base class not giving a flying&#8230; not caring about what any child classes do except the top most child class.  What if you have a div that holds content on the base, and the second layer has its own content area to hold the third layer.  This would be useless if you used self since that second layer would just be ignored.  Sad day.  This is where next comes in.  Next, like an abstract method, basically just sets a place holder for the next template to &#8220;inherit&#8221; the said template.  Now the danger of next is that just like an abstract method, the system will be all &#8220;Waaaaaah, you didn&#8217;t override the method.  Waaaaaah.&#8221; if you forget to define the method in the next layer.  The huge advantage is you can create a nice consistent design in which you can just bang out child templates since you know exactly what the baser (Yeah I wrote baser.) page will have.</p>
<p>On to the example.  And this is an example of what a template structure could look like.</p>
<p>The base page:</p>
<pre>  &lt;<span style="color: #800000;">html</span>&gt;
    &lt;<span style="color: #800000;">head</span>&gt;
       <span style="color: #008000;">//next.title will allow all children to add on to the title</span>
       &lt;<span style="color: #800000;">title</span>&gt;First Level - ${next.title()} &lt;/<span style="color: #800000;">title</span>&gt;

        <span style="color: #008000;">//next.styleSheetIncludes will allow all children to add any included css files if needed.</span>
        &lt;<span style="color: #800000;">link</span> <span style="color: #0000ff;">rel=</span><span style="color: #ff0000;">"Stylesheet"</span> <span style="color: #0000ff;">href=</span><span style="color: #ff0000;">"${h.url('/css/base.css')}"</span> /&gt;
        ${next.styleSheetIncludes()} 

        <span style="color: #008000;">//next.javascriptIncludes will allow all children to add any included javascript files if needed.</span>
        &lt;<span style="color: #800000;">script</span> <span style="color: #0000ff;">type=</span><span style="color: #ff0000;">"text/javascript"</span> <span style="color: #0000ff;">src=</span><span style="color: #ff0000;">"${h.url('/scripts/base.js')}"</span>&gt;&lt;/<span style="color: #800000;">script</span>&gt;
        ${next.javascriptIncludes()} 

        <span style="color: #008000;">//next.styleSheet allow all children to add any page specific css that wasn't included in files.  Why</span>
        <span style="color: #008000;">//  have the style tags instead of just having the  ${next.styleSheet()}.  Well you could but then you would</span>
        <span style="color: #008000;">//  end up with more than one style tag when the page is built.</span>
        &lt;<span style="color: #800000;">style</span> <span style="color: #0000ff;">type=</span><span style="color: #ff0000;">"text/css"</span>&gt;
          ${next.styleSheet()}
        &lt;/<span style="color: #800000;">style</span>&gt;

        <span style="color: #008000;">//next.javascript allows all children to add any page specific javascript that wasn't included in files. This</span>
        <span style="color: #008000;">//  follow the same idea as the next.styleSheet above.  Why have a possible 3...4...5... script tag when</span>
        <span style="color: #008000;">//  the child templates can just add to this one?</span>
        &lt;<span style="color: #800000;">script</span> <span style="color: #0000ff;">type=</span><span style="color: #ff0000;">"text/javascript"</span>&gt;

          <span style="color: #0000ff;">function</span> firstLevel(){
          }

          ${next.javascript()} 

          <span style="color: #008000;">//next.javascript allows all children to add any page jquery document.ready javascript that is specific to the</span>
          <span style="color: #008000;">//  given child.  Once again this is an example of add to instead of repeating a section</span>
          jQuery(document).ready(
            <span style="color: #0000ff;">function</span> () {
              jQuery(<span style="color: #ff0000;">'button'</span>).button();

              ${next.documentReady()} 

            }
          );
        &lt;/<span style="color: #800000;">script</span>&gt;
    &lt;/<span style="color: #800000;">head</span>&gt;
    &lt;<span style="color: #800000;">body</span>&gt;
      &lt;<span style="color: #800000;">div</span> <span style="color: #0000ff;">class=</span>"header"&gt;
      &lt;/<span style="color: #800000;">div</span>&gt;
        &lt;<span style="color: #800000;">div</span> <span style="color: #0000ff;">class=</span>"bodyContainer"&gt;
          <span style="color: #008000;">//This will be where the child html will fall.</span>
          ${next.body()}
        &lt;/<span style="color: #800000;">div</span>&gt;
      &lt;/<span style="color: #800000;">div</span>&gt;
   &lt;/<span style="color: #800000;">body</span>&gt;
  &lt;/<span style="color: #800000;">html</span>&gt;</pre>
<p>The second layer:</p>
<pre>  &lt;%inherit file="base.html" /&gt;

  &lt;%def name="title()"&gt;
    - Second Level
  &lt;/%def&gt;

  &lt;%def name="styleSheetIncludes()"&gt;
    &lt;<span style="color: #800000;">link</span> <span style="color: #0000ff;">rel=</span><span style="color: #ff0000;">"Stylesheet"</span> <span style="color: #0000ff;">href=</span><span style="color: #ff0000;">"${h.url('/css/secondLevel.css')}"</span> /&gt;
    ${next.styleSheetIncludes}
  &lt;/%def&gt;

  &lt;%def name="styleSheet()"&gt;
    ${next.styleSheet()}
  &lt;/%def&gt;

  &lt;%def name="javascriptIncludes()"&gt;
    &lt;<span style="color: #800000;">script</span> <span style="color: #0000ff;">type=</span><span style="color: #ff0000;">"text/javascript"</span> <span style="color: #0000ff;">src=</span><span style="color: #ff0000;">"${h.url('/scripts/secondLevel.js')}"</span>&gt;&lt;/<span style="color: #800000;">script</span>&gt;

    ${next.javascriptIncludes()}
  &lt;/%def&gt;

  &lt;%def name="javascript()"&gt;
    <span style="color: #0000ff;">function</span> secondLevel(){
      //Method in second level
    }
    ${next.javascript()}
  &lt;/%def&gt;

  &lt;%def name="documentReady()"&gt;
    <span style="color: #008000;">//nothing here on second level</span>
    ${next.documentReady()}
  &lt;/%def&gt;

  &lt;%def name="body()"&gt;
    &lt;<span style="color: #800000;">div</span> <span style="color: #0000ff;">class=</span><span style="color: #ff0000;">"leftMenu"</span>&gt;
      &lt;<span style="color: #800000;">a</span> <span style="color: #0000ff;">href=</span><span style="color: #ff0000;">"something.html"</span>&gt;something&lt;/<span style="color: #800000;">a</span>&gt;
      &lt;<span style="color: #800000;">a</span> <span style="color: #0000ff;">href=</span><span style="color: #ff0000;">"somethingElse.html"</span>&gt;something else&lt;/<span style="color: #800000;">a</span>&gt;
    &lt;/<span style="color: #800000;">div</span>&gt;
    &lt;<span style="color: #800000;">div</span> <span style="color: #0000ff;">class=</span><span style="color: #ff0000;">"rightArea"</span>&gt;
      ${next.body()}
    &lt;/<span style="color: #800000;">div</span>&gt;
  &lt;/%def&gt;</pre>
<p>As you can see, all the abstract areas defined in the base are being used by this layer and then this layer is in turn adding its own abstract methods that share the same name as the base template&#8217;s method.  The nice this is you can do this using the next keyword as the current template will only respond to the template immediately inheriting it.  You don&#8217;t get any kind of method name clash.</p>
<p>And the final layer:</p>
<pre>  &lt;%inherit file="secondLevel.html" /&gt;

  &lt;%def name="title()"&gt;
     - Third Level
  &lt;/%def&gt;

  &lt;%def name="styleSheetIncludes()"&gt;
    &lt;<span style="color: #800000;">link </span>rel=<span style="color: #ff0000;">"Stylesheet"</span> href=<span style="color: #ff0000;">"${h.url('/css/thirdLevel.css')}"</span> /&gt;
  &lt;/%def&gt;

  &lt;%def name="styleSheet()"&gt;
    .thirdLevel
    {
    }
  &lt;/%def&gt;

  &lt;%def name="javascriptIncludes()"&gt;
    &lt;<span style="color: #800000;">script</span> type=<span style="color: #ff0000;">"text/javascript"</span> src=<span style="color: #ff0000;">"${h.url('/scripts/thirdLevel.js')}"</span>&gt;&lt;/<span style="color: #800000;">script</span>&gt;
  &lt;/%def&gt;

  &lt;%def name="javascript()"&gt;
    <span style="color: #0000ff;">function</span> thirdLevel(){
      <span style="color: #008000;">//Method in second level</span>
    }
  &lt;/%def&gt;

  &lt;%def name="documentReady()"&gt;
    <span style="color: #008000;">//nothing here on third level</span>
  &lt;/%def&gt;

  &lt;%def name="body()"&gt;
    &lt;<span style="color: #800000;">div</span>&gt; Hi from third level&lt;/<span style="color: #800000;">div</span>&gt;
  &lt;/%def&gt;</pre>
<p>The third layer now closes off the chain by no longer adding any abstract methods of its own.  Now if I knew there could be yet another layer, all I would have to do is use the same naming convention and add the needed next.methods.</p>
<p>And this is what the source should look like:</p>
<pre>  &lt;<span style="color: #800000;">html</span>&gt;
    &lt;<span style="color: #800000;">head</span>&gt;
      &lt;<span style="color: #800000;">title</span>&gt;First Level - - Second Level - Third Level &lt;/<span style="color: #800000;">title</span>&gt;

      &lt;<span style="color: #800000;">link</span> <span style="color: #0000ff;">rel=</span><span style="color: #ff0000;">"Stylesheet"</span> <span style="color: #0000ff;">href=</span><span style="color: #ff0000;">"${h.url('/css/base.css')}"</span> /&gt;
      &lt;<span style="color: #800000;">link</span> <span style="color: #0000ff;">rel=</span><span style="color: #ff0000;">"Stylesheet"</span> <span style="color: #0000ff;">href=</span><span style="color: #ff0000;">"${h.url('/css/secondLevel.css')}"</span> /&gt;
      &lt;<span style="color: #800000;">link</span> <span style="color: #0000ff;">rel=</span><span style="color: #ff0000;">"Stylesheet"</span> <span style="color: #0000ff;">href=</span><span style="color: #ff0000;">"${h.url('/css/thirdLevel.css')}"</span> /&gt;

      &lt;<span style="color: #800000;">style</span> <span style="color: #0000ff;">type=</span><span style="color: #ff0000;">"text/css"</span>&gt;

      .thirdLevel
      {
      }

      &lt;/<span style="color: #800000;">style</span>&gt;

      &lt;<span style="color: #800000;">script</span> <span style="color: #0000ff;">type=</span><span style="color: #ff0000;">"text/javascript"</span> <span style="color: #0000ff;">src=</span><span style="color: #ff0000;">"${h.url('/scripts/base.js')}"</span>&gt;&lt;/<span style="color: #800000;">script</span>&gt;
      &lt;<span style="color: #800000;">script</span> <span style="color: #0000ff;">type=</span><span style="color: #ff0000;">"text/javascript"</span> <span style="color: #0000ff;">src=</span><span style="color: #ff0000;">"${h.url('/scripts/secondLevel.js')}"</span>&gt;&lt;/<span style="color: #800000;">script</span>&gt;
      &lt;<span style="color: #800000;">script</span> <span style="color: #0000ff;">type=</span><span style="color: #ff0000;">"text/javascript"</span> <span style="color: #0000ff;">src=</span><span style="color: #ff0000;">"${h.url('/scripts/thirdLevel.js')}"</span>&gt;&lt;/<span style="color: #800000;">script</span>&gt;

      &lt;<span style="color: #800000;">script</span> <span style="color: #0000ff;">type=</span><span style="color: #ff0000;">"text/javascript"</span>&gt;

        <span style="color: #0000ff;">function</span> firstLevel(){
        }

        <span style="color: #0000ff;">function</span> secondLevel(){
          <span style="color: #008000;">//Method in second level</span>
        }

        <span style="color: #0000ff;">function</span> thirdLevel(){
          <span style="color: #008000;">//Method in second level</span>
        }

        jQuery(document).ready(
          <span style="color: #0000ff;">function</span> () {
            jQuery(<span style="color: #ff0000;">'button'</span>).button();
	      <span style="color: #008000;">//nothing here on second level</span>
              <span style="color: #008000;">//nothing here on third level</span>
          });
        &lt;/<span style="color: #800000;">script</span>&gt;
    &lt;/<span style="color: #800000;">head</span>&gt;
    &lt;<span style="color: #800000;">body</span>&gt;
      &lt;<span style="color: #800000;">div</span> <span style="color: #0000ff;">class=</span><span style="color: #ff0000;">"header"</span>&gt;
      &lt;/<span style="color: #800000;">div</span>&gt;
      &lt;<span style="color: #800000;">div</span> <span style="color: #0000ff;">class=</span><span style="color: #ff0000;">"bodyContainer"</span>&gt;
        &lt;<span style="color: #800000;">div</span> <span style="color: #0000ff;">class=</span><span style="color: #ff0000;">"leftMenu"</span>&gt;
          &lt;<span style="color: #800000;">a</span> <span style="color: #0000ff;">href=</span><span style="color: #ff0000;">"something.html"</span>&gt;something&lt;/<span style="color: #800000;">a</span>&gt;
          &lt;<span style="color: #800000;">a</span> <span style="color: #0000ff;">href=</span><span style="color: #ff0000;">"somethingElse.html</span>"&gt;something else&lt;/<span style="color: #800000;">a</span>&gt;
        &lt;/<span style="color: #800000;">div</span>&gt;
        &lt;<span style="color: #800000;">div</span> c<span style="color: #0000ff;">lass=</span><span style="color: #ff0000;">"rightArea"</span>&gt;
          &lt;<span style="color: #800000;">div</span>&gt; Hi from third level&lt;/<span style="color: #800000;">div</span>&gt;
        &lt;/<span style="color: #800000;">div</span>&gt;
      &lt;/<span style="color: #800000;">div</span>&gt;
    &lt;/<span style="color: #800000;">div</span>&gt;
   &lt;/<span style="color: #800000;">body</span>&gt;
  &lt;/<span style="color: #800000;">html</span>&gt;
</pre>
<p>As you can see, things like the ${next.documentReady()} really helped to keep the source code clean and avoid repeated code on the source side.  Now go forth, all 2 of you&#8230; including me&#8230;, and use this knowledge to do something.</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/python/pylons-module-object-has-no-attribute-redirect_to/" title="Pylons: &#8216;module&#8217; object has no attribute &#8216;redirect_to&#8217; ">Pylons: &#8216;module&#8217; object has no attribute &#8216;redirect_to&#8217; </a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/python/quick-example-of-inheritance-in-templates-with-mako-using-next/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pylons: &#8216;module&#8217; object has no attribute &#8216;redirect_to&#8217;</title>
		<link>http://byatool.com/python/pylons-module-object-has-no-attribute-redirect_to/</link>
		<comments>http://byatool.com/python/pylons-module-object-has-no-attribute-redirect_to/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 15:39:46 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Error]]></category>
		<category><![CDATA[Pylons]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1556</guid>
		<description><![CDATA[Yeah I&#8217;m using python/pylons, don&#8217;t you worry about it. So ran into this while looking over a pylons tutorial.  Turns out, that method was removed in Pylons 1.0 but the tutorial was a little bit old. So instead of: redirect_to(controller='hello', action='other_action', _code=303) just use: from pylons import url from pylons.controllers.util import abort, redirect ... redirect(url(controller='hello', [...]]]></description>
			<content:encoded><![CDATA[<p>Yeah I&#8217;m using python/pylons, don&#8217;t you worry about it.</p>
<p>So ran into this while looking over<a href="http://pylonsbook.com/en/1.1/exploring-pylons.html"> a pylons tutorial</a>.  Turns out, that method was removed in Pylons 1.0 but the tutorial was a little bit old. So instead of:</p>
<pre>
  redirect_to(controller='hello', action='other_action', _code=303)</pre>
<p>just use:</p>
<pre>
  from pylons import url
  from pylons.controllers.util import abort, redirect

  ...

  redirect(url(controller='hello', action='index', _code='303'))</pre>
<p>Bad news is I didn&#8217;t get a chance to actually see the full behavior of the old redirect to, so I&#8217;m not sure the result:</p>
<pre>

http://127.0.0.1:5000/?_code=303</pre>
<p>Is the same. Still new to this thing called pylons. Just got annoyed trying to find an answer to this one so hopefully my title will speed up the search for future people.</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/python/quick-example-of-inheritance-in-templates-with-mako-using-next/" title="Quick Example of Inheritance in Templates with Mako: Using Next">Quick Example of Inheritance in Templates with Mako: Using Next</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/python/pylons-module-object-has-no-attribute-redirect_to/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Connect Your Web App To Twitter Using Hammock &amp; C-Sharp</title>
		<link>http://byatool.com/c/connect-your-web-app-to-twitter-using-hammock-csharp/</link>
		<comments>http://byatool.com/c/connect-your-web-app-to-twitter-using-hammock-csharp/#comments</comments>
		<pubDate>Thu, 05 Aug 2010 19:45:53 +0000</pubDate>
		<dc:creator>Andre</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Social Media]]></category>
		<category><![CDATA[Hammock]]></category>
		<category><![CDATA[OAuth]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1454</guid>
		<description><![CDATA[The Challenge Recently I was challenged with the task of connecting a web application to Twitter and sending out a tweet. This article will focus on the connection to Twitter, saving the talk about sending out a tweet for another article.  Having used TweetSharp last year, I thought I would check for an updated version [...]]]></description>
			<content:encoded><![CDATA[<h3>The Challenge</h3>
<p><a href="http://byatool.com/wp-content/uploads/2010/08/hammock-logo.png"><img class="size-full wp-image-1481 alignleft" title="Hammock Logo" src="http://byatool.com/wp-content/uploads/2010/08/hammock-logo.png" alt="Hammock Logo" width="94" height="100" /></a>Recently I was challenged with the task of connecting a web application to Twitter and sending out a tweet. This article will focus on the connection to Twitter, saving the talk about sending out a tweet for another article.  Having used <a title="TweetSharp on CodePlex" href="http://tweetsharp.codeplex.com/" target="_blank">TweetSharp</a> last year, I thought I would check for an updated version of it and be on my way.  When I got to CodePlex, I learned that support for TweetSharp had pretty much stopped in May and the developers had moved onto <a title="Hammock on CodePlex" href="http://hammock.codeplex.com/" target="_blank">Hammock</a>.</p>
<p>After reading their explanation, and suggestions for future development, I decided to use Hammock to connect my web application to Twitter.  What is Hammock you ask, in their own words, it is a REST library for .NET that greatly simplifies consuming and wrapping  RESTful services.  In plain English, it makes integrating REST APIs a snap.  If you want an explanation of what REST is, please check out <a title="Representational State Transfer" href="http://en.wikipedia.org/wiki/Representational_State_Transfer" target="_blank">Wikipedia</a>.</p>
<p>I have to give credit to ColinM, author of <a title="A Forum Post" href="http://hammock.codeplex.com/Thread/View.aspx?ThreadId=219691" target="_self">this forum post</a> on CodePlex, for giving me the basis of this code.</p>
<h3><strong>Before The Code</strong></h3>
<p>Before you can connect your web application (or desktop application) to Twitter, you need to register with Twitter.  This is not the same as creating a new Twitter account, which you will need, instead this is telling Twitter that your application is going to want to interact with it.  To do this, go to <a title="Register Applications With Twitter" href="http://twitter.com/apps/new" target="_blank">http://twitter.com/apps/new</a>.</p>
<p style="text-align: center;"><img class="size-full wp-image-1457 aligncenter" title="Adding A New Twitter App" src="http://byatool.com/wp-content/uploads/2010/08/TwitterAppsNew.png" alt="Adding A New Twitter App" width="489" height="363" /></p>
<p>Let&#8217;s talk about some of the settings you will need to configure when you register your application.</p>
<ul>
<li><strong>Application Type</strong> &#8211; For this example, choose Browser (Web).  If you choose Client (Desktop), you will see the Callback URL option go away.</li>
<li><strong>Callback URL</strong> &#8211; This is the URL Twitter will send your users to after they Allow or Deny your request to connect your application to Twitter.  I would recommend entering this as your production URL.  In this article I will show you how to override this setting in your code.</li>
<li><strong>Default Access type</strong> &#8211; If your application is only going to consume data from Twitter, you can leave it at Read-only, but if you intend on posting tweets you will need to select Read &amp; Write</li>
<li><strong>Use Twitter for login</strong> &#8211; If you want to allow users to authenticate via Twitter, check this box.</li>
</ul>
<p>After you register your application, Twitter will give you the information you need to connect.  You will need to take note of your Consumer key and Consumer secret.  This key/secret combination is unique to your application.  The Request token URL, Access token URL and Authorize URL are the same for pretty much everyone.  Now that we&#8217;ve established your secret identity with Twitter, we can get started.</p>
<h3><strong>A Four Step Process</strong></h3>
<p>To make my example as simple as can be, I broke it down into four steps.  Also, I set up this example using two web forms.  Steps One and Two are called from GetTwitterRequest.aspx and Steps Three and Four are called from ProcessTwitterResponse.aspx.  You can do this from the same form if you wish.  If you&#8217;re not into web forms, you can call it from an ASP.NET MVC View as well.</p>
<p>For simplicity, I have setup a couple of private strings called  CONSUMER_KEY &amp; CONSUMER_SECRET.  Yeah, you guessed it, those are the  values we needed from Twitter.  You can store these in a database, in  your web.config, or hard code them right in your C# code, that&#8217;s all up  to you.</p>
<p>For the purpose of making a fast, lightweight example, I used Session to store certain information.  You will probably want to store the  accessKey and accessSecret in a database.  You will want to associate these values with your user in your system.  We will talk about each key later on.</p>
<p>Here are the related &#8220;usings&#8221;:</p>
<pre lang="csharp">using System.Net;

using Hammock;
using Hammock.Authentication.OAuth;
using Hammock.Web;</pre>
<p>Also, many developers have found the need to include the following line of code when talking to Twitter.  I can&#8217;t explain why.</p>
<pre lang="csharp">ServicePointManager.Expect100Continue = false;
</pre>
<h4>Step One: Identify Your Application</h4>
<pre lang="csharp">var credentials = new OAuthCredentials
{
	Type = OAuthType.RequestToken,
	SignatureMethod = OAuthSignatureMethod.HmacSha1,
	ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader,
	ConsumerKey = CONSUMER_KEY,
	ConsumerSecret = CONSUMER_SECRET,
	CallbackUrl = "YOUR_CALLBACK_URL_GOES_HERE/ProcessTwitterResponse.aspx",
};

var client = new RestClient
{
	Authority = "http://twitter.com/oauth",
	Credentials = credentials
};

var request = new RestRequest
{
	Path = "/request_token"
};

RestResponse response = client.Request(request);</pre>
<p>Before you can connect your application with Twitter, you need your application to identify itself.  Above you will find a pretty standard piece of code that you can use to do that.  You won&#8217;t have to change much of this code to get it working with your application.</p>
<p>First, you need to instantiate your credentials.  To do this, you&#8217;ll need to provide your CONSUMER_KEY, CONSUMER_SECRET, and Callback URL.  Use your key/secret combination provided by Twitter.  Your Callback URL is the URL of the page you want to process the response from Twitter.  As a note, Twitter only supports hmac-sha1 signatures.   After you&#8217;ve created your credentials, you&#8217;ll need to instantiate a RestClient and RestRequest.</p>
<p>In short, the RestClient uses your Credentials to execute your RestRequest.  When you execute your RestRequest you will need to capture the RestResponse for use in Step Two.</p>
<h4>Step Two: Ask For Permission To Connect</h4>
<pre lang="csharp">var collection = HttpUtility.ParseQueryString(response.Content);
Session["requestSecret"] = collection[1];
Response.Redirect("http://twitter.com/oauth/authorize?oauth_token=" + collection[0]);
</pre>
<p>In step two, we are going to parse the RestResponse from our RestRequest in Step One.  If Twitter recognizes your application, you will receive a temporary key/secret combination that we&#8217;ll call requestKey and requestSecret.  This key/secret combination will be used to request authorization to connect your application to your user&#8217;s Twitter account.  It is important to note that this combination is good for one request.  Once you use them, you&#8217;ll have to get a new requestKey and requestSecret to make new authorization requests.</p>
<p>I used HttpUtility.ParseQueryString to break apart the querystring in the RestResponse.  The first part is going to be your requestKey, and the second part is your requestSecret.  To actually make the request, you are going to send your requestKey back to Twitter.  You will want to store your requestSecret for use in Step Three.  For this example I stored the requestSecret in Session.  You can store this in a database if you want, but due to it&#8217;s temporary nature, storing it in Session or a Cookie should work just as well.</p>
<p>When you redirect your user to Twitter for authorization to connect your app to their Twitter account, they should see a screen similar to the one below.</p>
<p><img class="aligncenter size-full wp-image-1473" title="Create A Twitter Connection - Deny or Allow" src="http://byatool.com/wp-content/uploads/2010/08/DenyAllow.png" alt="Create A Twitter Connection - Deny or Allow" width="620" height="306" /></p>
<h4>Step Three: Wait For Twitter&#8217;s Response</h4>
<pre lang="csharp">var requestToken = (String)Request.QueryString["oauth_token"];
var requestSecret = (String)Session["requestSecret"];
var requestVerifier = (String)Request.QueryString["oauth_verifier"];

var credentials2 = new OAuthCredentials
{
	Type = OAuthType.AccessToken,
	SignatureMethod = OAuthSignatureMethod.HmacSha1,
	ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader,
	ConsumerKey = CONSUMER_KEY,
	ConsumerSecret = CONSUMER_SECRET,
	Token = requestToken,
	TokenSecret = requestSecret,
	Verifier = requestVerifier
};

var client2 = new RestClient()
{
	Authority = "http://twitter.com/oauth",
	Credentials = credentials2
};

var request2 = new RestRequest
{
	Path = "/access_token"
};

RestResponse response2 = client2.Request(request2);</pre>
<p>At this point, your application will be waiting for Twiiter to send back a response.  It will do so by redirecting the user to the URL you sent Twitter in Step Two.  This step is very similar to Step One, with the exception that we will be sending more data.  Besides your CONSUMER_KEY and CONSUMER_SECRET, you will need to provide your requestToken and requestVerifier, which you get from Twitter&#8217;s call to your Callback URL.  You will also need your requestSecret which you stored in Step Two.</p>
<p>Again you will use a RestClient to execute your  RestRequest.  When you execute your RestRequest you will need to capture  the RestResponse for use in Step Four.</p>
<h4>Step Four: Remember Your Secret Handshake</h4>
<p>Now all we need to do is parse the response from Twitter and save the token and secret they return.</p>
<pre lang="csharp">var accessResponseCollection = HttpUtility.ParseQueryString(response2.Content);

Session["accessToken"] = accessResponseCollection["oauth_token"];
Session["accessSecret"] = accessResponseCollection["oauth_token_secret"];
</pre>
<p>Twitter will respond, if the user allowed the connection, with a permanent accessToken and accessSecret.  This IS your secret handshake with Twitter.  You will want to store the accessToken and accessSecret in your database.  I know I stored it in Session, but that&#8217;s because I was too lazy to wire this example to a database.  Using you accessToken and accessSecret in future Twitter API calls is how you connect to your user&#8217;s Twitter account to your application.  This token and token secret do not expire unless the user removes the connection to your application via the Twitter web site.</p>
<p>In closing, all this article really does is help you connect with Twitter, you will have to find something to do with this connection.  It should also give you a light understanding of REST API calls as well as some insight on the OAuth authentication process.  There will be future articles to help you tweet from your application or get data from Twitter to display.</p>
<hr />To find out more about the technologies in this article, check out the following links.</p>
<p>Hammock &#8211; <a title="Hammock on CodePlex" href="http://hammock.codeplex.com/" target="_blank">http://hammock.codeplex.com/</a></p>
<p>OAuth &#8211; <a title="OAuth" href="http://oauth.net/" target="_blank">http://oauth.net/</a></p>
<p>Twitter API &#8211; <a title="Twitter API" href="http://apiwiki.twitter.com/" target="_blank">http://apiwiki.twitter.com/</a></p>
<div  class="related_post_title">Most Commented Posts</div><ul class="related_post"><li><a href="http://byatool.com/ui/my-jquery-primer/" title="My jQuery Primer">My jQuery Primer</a></li><li><a href="http://byatool.com/mvc/custom-data-annotations-with-mvc-how-to-check-multiple-properties-at-one-time/" title="Custom Data Annotations With MVC: How to Check Multiple Properties at One Time">Custom Data Annotations With MVC: How to Check Multiple Properties at One Time</a></li><li><a href="http://byatool.com/mvc/asp-net-mvc-upload-image-to-database-and-show-image-dynamically-using-a-view/" title="ASP.Net MVC: Upload Image to Database and Show Image &#8220;Dynamically&#8221; Using a View">ASP.Net MVC: Upload Image to Database and Show Image &#8220;Dynamically&#8221; Using a View</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/c/connect-your-web-app-to-twitter-using-hammock-csharp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WPF: Inherit Style From Style.   BasedOn Is Your Friend</title>
		<link>http://byatool.com/wpf/wpf-inherit-style-from-style-basedon-is-your-friend/</link>
		<comments>http://byatool.com/wpf/wpf-inherit-style-from-style-basedon-is-your-friend/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 18:01:05 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[Style]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1451</guid>
		<description><![CDATA[So another quick one.  Say you have a style for creating round buttons, but you don&#8217;t want to include a size, how a size be applied without touching the original style?  Well you could just adjust the properties right on the button, but what if you want something a little more reusable?  It&#8217;s actually pretty [...]]]></description>
			<content:encoded><![CDATA[<p>So another quick one.  Say you have a style for creating round buttons, but you don&#8217;t want to include a size, how a size be applied without touching the original style?  Well you could just adjust the properties right on the button, but what if you want something a little more reusable?  It&#8217;s actually pretty simple, just have one style &#8220;inherit&#8221; the other.  Well that&#8217;s where BasedOn comes in.</p>
<p>Say you have a style named RoundButton.</p>
<pre>    &lt;<span style="color: #800000;">Style</span> <span style="color: #ff0000;">x:Key</span><span style="color: #0000ff;">="GlassButton"</span> <span style="color: #ff0000;">TargetType</span><span style="color: #0000ff;">="{x:Type Button}"</span>&gt;
      ...
    &lt;/<span style="color: #800000;">Style</span>&gt;
</pre>
<p>All you have to do is create a new style:</p>
<pre>    &lt;<span style="color: #800000;">Style</span> <span style="color: #ff0000;">x:Key</span><span style="color: #0000ff;">="HeaderButton"</span> <span style="color: #ff0000;">BasedOn</span><span style="color: #0000ff;">="{StaticResource GlassButton}"</span> <span style="color: #ff0000;">TargetType</span><span style="color: #0000ff;">="{x:Type Button}"</span>&gt;
        &lt;<span style="color: #800000;">Setter</span><span style="color: #ff0000;"> Property</span><span style="color: #0000ff;">="Height"</span> <span style="color: #ff0000;">Value</span><span style="color: #0000ff;">="20"</span> /&gt;
        &lt;<span style="color: #800000;">Setter</span> <span style="color: #ff0000;">Property</span><span style="color: #0000ff;">="Width"</span> <span style="color: #ff0000;">Value</span><span style="color: #0000ff;">="20"</span> /&gt;
    &lt;/<span style="color: #800000;">Style</span>&gt;
</pre>
<p>As you can see, it&#8217;s pretty simple using the BasedOn keyword.  Now when the HeaderButton style is applied to the button, it will take on the properties of the RoundButton style and the HeaderButton one.  Nice huh?</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/wpf/wpf-hide-built-in-header-bar-for-an-open-window/" title="WPF: Hide Built in Header Bar For an Open Window">WPF: Hide Built in Header Bar For an Open Window</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/wpf/wpf-inherit-style-from-style-basedon-is-your-friend/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WPF: Hide Built in Header Bar For an Open Window</title>
		<link>http://byatool.com/wpf/wpf-hide-built-in-header-bar-for-an-open-window/</link>
		<comments>http://byatool.com/wpf/wpf-hide-built-in-header-bar-for-an-open-window/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 17:19:21 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[Style]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1447</guid>
		<description><![CDATA[Ok so this one is a simple one.  Well at least once you see it in action.  Say you want to get rid of the built in windows header bar: You know, that thing. Well it&#8217;s crazy simple. And I mean crazy as in mind boggling, not crazy like dress up your cat in clothes [...]]]></description>
			<content:encoded><![CDATA[<p>Ok so this one is a simple one.  Well at least once you see it in action.  Say you want to get rid of the built in windows header bar:</p>
<pre><a href="http://byatool.com/wp-content/uploads/2010/07/WindowWithHeaderBar.png"><img class="alignnone size-full wp-image-1448" title="WindowWithHeaderBar" src="http://byatool.com/wp-content/uploads/2010/07/WindowWithHeaderBar.png" alt="" width="581" height="366" /></a>
</pre>
<p>You know, that thing.  Well it&#8217;s crazy simple. And I mean crazy as in mind boggling, not crazy like dress up your cat in clothes crazy.</p>
<p>All you have to do is set these two properties:</p>
<pre>AllowsTransparency="True" WindowStyle="None"
</pre>
<p>In the window tag at the top of the page.  For example:</p>
<pre>&lt;<span style="color: #800000;">Window</span> <span style="color: #ff0000;">x:Class</span><span style="color: #0000ff;">="DesCombine.WPF.FileUpload"</span>
  <span style="color: #ff0000;">xmlns</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml/presentation"</span>
  <span style="color: #ff0000;">xmlns:x</span><span style="color: #0000ff;">="http://schemas.microsoft.com/winfx/2006/xaml"</span>
  <span style="color: #ff0000;">Title</span><span style="color: #0000ff;">="File Upload"</span> <span style="color: #ff0000;">Height</span><span style="color: #0000ff;">="350"</span> <span style="color: #ff0000;">Width</span><span style="color: #0000ff;">="525"</span> <span style="color: #ff0000;">BorderThickness</span><span style="color: #0000ff;">="0"</span> <span style="color: #ff0000;">ResizeMode</span><span style="color: #0000ff;">="NoResize"</span>
  <span style="color: #ff0000;">WindowStartupLocation</span><span style="color: #0000ff;">="CenterScreen"</span> <strong><span style="color: #ff0000;">AllowsTransparency</span><span style="color: #0000ff;">="True"</span> <span style="color: #ff0000;">WindowStyle</span><span style="color: #0000ff;">="None"</span></strong>&gt;
</pre>
<p>Only catch is that you have to now supply any useful buttons like Minimize or Close by yourself.  But I never said that you wouldn&#8217;t.  You thought that.  You.</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/wpf/wpf-inherit-style-from-style-basedon-is-your-friend/" title="WPF: Inherit Style From Style.   BasedOn Is Your Friend">WPF: Inherit Style From Style.   BasedOn Is Your Friend</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/wpf/wpf-hide-built-in-header-bar-for-an-open-window/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spark View Engine, ASP.Net MVC, and You</title>
		<link>http://byatool.com/lessons/spark-view-engine-asp-net-mvc-and-you/</link>
		<comments>http://byatool.com/lessons/spark-view-engine-asp-net-mvc-and-you/#comments</comments>
		<pubDate>Thu, 27 May 2010 15:10:28 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Lessons]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[Spark]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1395</guid>
		<description><![CDATA[So one of the things I was forced to use, semi kicking and screaming, at one point in my illustrious career was the Spark View Engine for ASP.Net MVC. Actually that&#8217;s not totally true. I only kicked for a bit then skipped the screaming once I noticed what it did: It took all the ugly [...]]]></description>
			<content:encoded><![CDATA[<p>So one of the things I was forced to use, semi kicking and screaming, at one point in my illustrious career was the <a href="http://dev.dejardin.org/">Spark View Engine for ASP.Net MVC</a>.  Actually that&#8217;s not totally true.  I only kicked for a bit then skipped the screaming once I noticed what it did:  It took all the ugly &lt;% %&gt; junk out of the html&#8230; <a href="http://byatool.com/pontification/just-use-html-why-mvc-can-be-a-good-thing/">my beautiful html</a>&#8230; and made things like for loops much nicer.  Mind you, this is mererly the tip of the ice pick&#8230; eh berg I meant berg&#8230; there&#8217;s a lot more to it.  It handles things like Master Pages and Partial Controls pretty darn well as well as caching javascript files on the go.  Sounds good?  Well it should and if it doesn&#8217;t, I don&#8217;t think we can be friends.</p>
<p>First off, I just wanted to quickly write something up on how to get it all going and because I&#8217;m such a nice guy <a href="http://byatool.com/Hosted/PhotoShare.UI.zip">I even have a project that is ready to go</a> for common use.  The catch is that I made it in 2010 so if you don&#8217;t have that yet, you could be screwed.  Then again I could type out a lot of the steps too.  You just don&#8217;t know.</p>
<p>First off you can either get the assemblies from my hosted project, <a href="http://sparkviewengine.codeplex.com/releases/view/27601">or you can go here</a> and get it.  Either way, I don&#8217;t care.  No really, I don&#8217;t.  Not just sayin&#8217;.  The care cup had run dry.</p>
<p>The two assemblies you need to reference in your project are:</p>
<pre>  spark.dll
  spark.mvc
</pre>
<p>Next add this line to the Application_Start method in the Global.asax.cs file:</p>
<pre>  <span style="color: #008080;">ViewEngines</span>.Engines.Add(<span style="color: #0000ff;">new</span> <span style="color: #008080;">SparkViewFactory</span>());
</pre>
<p>After that, you&#8217;ll have to add a little somethin&#8217; somethin&#8217; to your web.config.  I know, I know.  This is all so very hard.  Live strong like Lance.</p>
<pre>  &lt;<span style="color: #ff0000;">configuration</span>&gt;
    ...
    &lt;<span style="color: #ff0000;">configSections</span>&gt;
      &lt;<span style="color: #ff0000;">section</span> <span style="color: #0000ff;">name=</span><span style="color: #800000;">"spark"</span> <span style="color: #ff0000;">type=</span><span style="color: #800000;">"Spark.Configuration.SparkSectionHandler, Spark"</span>/&gt;
    &lt;/<span style="color: #ff0000;">configSections</span>&gt;
    ...
    &lt;<span style="color: #ff0000;">spark</span>&gt;
      &lt;<span style="color: #ff0000;">compilation</span> <span style="color: #0000ff;">debug=</span><span style="color: #800000;">"true"</span> <span style="color: #0000ff;">defaultLanguage=</span><span style="color: #800000;">"CSharp"</span>&gt;
        &lt;<span style="color: #ff0000;">assemblies</span>&gt;
          &lt;<span style="color: #ff0000;">add</span> <span style="color: #0000ff;">assembly=</span><span style="color: #800000;">"PhotoShare.UI"</span> /&gt; /<span style="color: #008000;">/Whatever the actual UI project is</span>
        &lt;/<span style="color: #ff0000;">assemblies</span>&gt;
      &lt;/<span style="color: #ff0000;">compilation</span>&gt;
      &lt;<span style="color: #ff0000;">pages</span> <span style="color: #0000ff;">automaticEncoding=</span><span style="color: #800000;">"false"</span>&gt; <span style="color: #008000;">//If you want it to auto HTML encode post/get stuff</span>
        &lt;<span style="color: #ff0000;">namespaces</span>&gt;
          &lt;<span style="color: #ff0000;">add</span> <span style="color: #0000ff;">namespace=</span><span style="color: #800000;">"System"</span>/&gt;
          &lt;<span style="color: #ff0000;">add</span> <span style="color: #0000ff;">namespace=</span><span style="color: #800000;">"System.Collections.Generic"</span>/&gt;
          &lt;<span style="color: #ff0000;">add</span> <span style="color: #0000ff;">namespace=</span><span style="color: #800000;">"System.Linq"</span>/&gt;
          &lt;<span style="color: #ff0000;">add</span> <span style="color: #0000ff;">namespace=</span><span style="color: #800000;">"System.Web.Mvc"</span>/&gt;
        &lt;/<span style="color: #ff0000;">namespaces</span>&gt;
      &lt;/<span style="color: #ff0000;">pages</span>&gt;
    &lt;/<span style="color: #ff0000;">spark</span>&gt;
</pre>
<p>Ok so the web config is ready.  Now what?</p>
<p>Well now you are going to create a master page.  That&#8217;s right you are.  Don&#8217;t fight me on this.  I&#8217;m way cooler than you.</p>
<p>There is a little directory structure hard coding going on since by default you have to have things in certain places for Spark.  Oh well.  All Master Pages go in a directory named &#8220;Layouts&#8221; in the &#8220;Views&#8221; directory.  So something like:</p>
<pre>  Views/Layouts/Application.spark
</pre>
<p>D&#8212; it.  Forgot about that little tid bit too.  Spark files have to be named .spark.  Well actually I think there&#8217;s a way to call them whatever you want, but lets just go with defaults for now smarty pants.</p>
<p>And for the hard part, the html for the master page.</p>
<pre>  &lt;<span style="color: #ff0000;">html</span>&gt;
    &lt;<span style="color: #ff0000;">head</span>&gt;
    &lt;/<span style="color: #ff0000;">head</span>&gt;
    &lt;<span style="color: #ff0000;">body</span>&gt;
      &lt;<span style="color: #ff0000;">div</span>&gt;
        &lt;<span style="color: #ff0000;">use</span> <span style="color: #0000ff;">content=</span><span style="color: #800000;">"Middle"</span> /&gt;
          aasdfasdfa
      &lt;/<span style="color: #ff0000;">div</span>&gt;
    &lt;/<span style="color: #ff0000;">body</span>&gt;
  &lt;/<span style="color: #ff0000;">html</span>&gt;
</pre>
<p>HOLY HECK THAT&#8217;S HARD!  Now there needs to be a controller.  So just create one in the controllers folder.  In my project it&#8217;s called this:</p>
<pre>  Controllers/SparkTestController.cs
</pre>
<p>And then go ahead and create a view for index.  Once you&#8217;ve done that, rename the extension from aspx to spark.  Now for the html:</p>
<pre>  &lt;<span style="color: #ff0000;">use</span> <span style="color: #0000ff;">master=</span><span style="color: #800000;">"Application"</span>/&gt;

  &lt;<span style="color: #ff0000;">div</span>&gt;
    &lt;<span style="color: #ff0000;">content</span> <span style="color: #0000ff;">name=</span><span style="color: #993300;">"Middle"</span>&gt;
        hi there
    &lt;/<span style="color: #ff0000;">content</span>&gt;
  &lt;/<span style="color: #ff0000;">div</span>&gt;
</pre>
<p>And that&#8217;s it really.  As you can see, the placeholder on the master page (use content=&#8221;Middle&#8221;) is referred to on the child page.</p>
<p>To make testing this page easy, I would suggest changing the routing in the Global.asax.cs file to:</p>
<pre>  routes.MapRoute(
          <span style="color: #800000;">"Default"</span>,
          <span style="color: #800000;">"{controller}/{action}"</span>,
          <span style="color: #0000ff;">new</span> { controller = <span style="color: #800000;">"SparkTest"</span>, action = <span style="color: #800000;">"Index"</span>}
</pre>
<p>And you should see something like:</p>
<pre>  hi there aasdfasdfa
</pre>
<p>Proving that both the master page and the child page are printing stuff out.</p>
<p>You might be wondering why you should do all of this?  If you aren&#8217;t, you are one hell of a lemming.  And not the cool kind like those little guys that blow themselves up for the betterment of the lemming collective.  You&#8217;re that stupid one the just sits there with its hand out shaking its head.</p>
<p>A quick example:</p>
<pre>  <span style="color: #dcea0a;">&lt;%</span>
    <span style="color: #0000ff;">if</span>(something.IsTrue)
    {
  <span style="color: #dcea0a;">%&gt;</span>
       &lt;<span style="color: #ff0000;">div</span>&gt; hihihihih &lt;/<span style="color: #ff0000;">div</span>&gt;
  <span style="color: #dcea0a;">&lt;%</span>
    }
  <span style="color: #dcea0a;">%&gt;</span>
</pre>
<p>Compared to:</p>
<pre>  &lt;<span style="color: #ff0000;">div</span> <span style="color: #0000ff;">if=</span><span style="color: #800000;">"something.IsTrue"</span>&gt; hihihihih &lt;/<span style="color: #ff0000;">div</span>&gt;
</pre>
<p>Small example, but I think its pretty obvious why the second is so much better.  And this is just scratching the surface on what spark does really.   I&#8217;d suggest <a href="http://sparkviewengine.com/documentation">looking here</a> for more.  I&#8217;d also suggest a new hair cut because&#8230; just wow.</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/writing/byatool-com-gets-a-shiny-new-tool/" title="ByATool.com gets a shiny new tool!">ByATool.com gets a shiny new tool!</a></li><li><a href="http://byatool.com/lessons/data-annotations-mvc-and-why-you-might-like-them/" title="Data Annotations, MVC, and Why You Might Like Them">Data Annotations, MVC, and Why You Might Like Them</a></li><li><a href="http://byatool.com/pontification/asp-net-mvc-quick-overview-of-controller-structure/" title="ASP.Net MVC:  Quick Overview of Controller Structure">ASP.Net MVC:  Quick Overview of Controller Structure</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/lessons/spark-view-engine-asp-net-mvc-and-you/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>ByATool.com Is Looking For Writers</title>
		<link>http://byatool.com/wordpress/byatool-is-looking-for-writers/</link>
		<comments>http://byatool.com/wordpress/byatool-is-looking-for-writers/#comments</comments>
		<pubDate>Wed, 12 May 2010 11:05:40 +0000</pubDate>
		<dc:creator>Andre</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Writing]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1222</guid>
		<description><![CDATA[Yeah, you read that right.  ByATool.com is looking to add one or two writers with various IT backgrounds.  This is not a job, it is simply an avenue for you to get your work read.  We want to know what YOU want to write about.  It&#8217;s no fun to be given a topic to write [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><img class="alignleft size-full wp-image-1223" title="Writer" src="http://byatool.com/wp-content/uploads/2010/01/writer.jpg" alt="" width="140" height="200" style="padding: 4px;" />Yeah, you read that right.  ByATool.com is looking to add one or two writers with various IT backgrounds.  This is not a job, it is simply an avenue for you to get your work read.  We want to know what YOU want to write about.  It&#8217;s no fun to be given a topic to write about when your passion lies elsewhere.  Please contact us at the address listed below so we can discuss this one-on-one!</p>
<p style="text-align: justify;"><strong>What we need from you:</strong><br />
Name:<br />
E-Mail:<br />
What would you like to write about:<br />
How often would you like to write:</p>
<p style="text-align: justify;">Please submit this simple information, <span style="text-decoration: underline;">along with an example blog post</span> to iwanttowrite [at] byatool [dot] com</p>
<div  class="related_post_title">Most Commented Posts</div><ul class="related_post"><li><a href="http://byatool.com/ui/my-jquery-primer/" title="My jQuery Primer">My jQuery Primer</a></li><li><a href="http://byatool.com/mvc/custom-data-annotations-with-mvc-how-to-check-multiple-properties-at-one-time/" title="Custom Data Annotations With MVC: How to Check Multiple Properties at One Time">Custom Data Annotations With MVC: How to Check Multiple Properties at One Time</a></li><li><a href="http://byatool.com/mvc/asp-net-mvc-upload-image-to-database-and-show-image-dynamically-using-a-view/" title="ASP.Net MVC: Upload Image to Database and Show Image &#8220;Dynamically&#8221; Using a View">ASP.Net MVC: Upload Image to Database and Show Image &#8220;Dynamically&#8221; Using a View</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/wordpress/byatool-is-looking-for-writers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New SharePoint Server Explorer in Visual Studio 2010</title>
		<link>http://byatool.com/sharepoint/new-sharepoint-server-explorer-in-visual-studio-2010/</link>
		<comments>http://byatool.com/sharepoint/new-sharepoint-server-explorer-in-visual-studio-2010/#comments</comments>
		<pubDate>Tue, 27 Apr 2010 10:41:24 +0000</pubDate>
		<dc:creator>Amy</dc:creator>
				<category><![CDATA[Sharepoint]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1376</guid>
		<description><![CDATA[Just kinda geeking out about this, but when looking over some of the new features for Visual Studio 2010  I caught this little gem in the white paper…. You see that?&#8230;. IT’s A SHAREPOINT SITE IN THE SERVER EXPLORER!!  &#60;Rubs hands together gleefully&#62; Now… to figure out how to fit playing with this in after [...]]]></description>
			<content:encoded><![CDATA[<p>Just kinda geeking out about this, but when looking over some of the new features for Visual Studio 2010  I caught this little gem in the white paper….</p>
<p><a href="http://byatool.com/wp-content/uploads/2010/04/SharePointExplorer.jpg"><img class="alignnone size-full wp-image-1377" src="http://byatool.com/wp-content/uploads/2010/04/SharePointExplorer.jpg" alt="" width="581" height="543" /></a></p>
<p>You see that?&#8230;. IT’s A SHAREPOINT SITE IN THE SERVER EXPLORER!! </p>
<p>&lt;Rubs hands together gleefully&gt; Now… to figure out how to fit playing with this in after all my other urgent priorities….</p>
<div  class="related_post_title">Most Commented Posts</div><ul class="related_post"><li><a href="http://byatool.com/ui/my-jquery-primer/" title="My jQuery Primer">My jQuery Primer</a></li><li><a href="http://byatool.com/mvc/custom-data-annotations-with-mvc-how-to-check-multiple-properties-at-one-time/" title="Custom Data Annotations With MVC: How to Check Multiple Properties at One Time">Custom Data Annotations With MVC: How to Check Multiple Properties at One Time</a></li><li><a href="http://byatool.com/mvc/asp-net-mvc-upload-image-to-database-and-show-image-dynamically-using-a-view/" title="ASP.Net MVC: Upload Image to Database and Show Image &#8220;Dynamically&#8221; Using a View">ASP.Net MVC: Upload Image to Database and Show Image &#8220;Dynamically&#8221; Using a View</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/sharepoint/new-sharepoint-server-explorer-in-visual-studio-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MVC and Table Inheritance: Part 1</title>
		<link>http://byatool.com/c/mvc-and-table-inheritance-part-1/</link>
		<comments>http://byatool.com/c/mvc-and-table-inheritance-part-1/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 10:30:55 +0000</pubDate>
		<dc:creator>Amy</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1278</guid>
		<description><![CDATA[PART 1:  Setting up the database and Entity Framework Model Okay, so say you need to create an internal IIS hosted web application that acts as a portal for managing internal training courses.  You could do a simple ASP.NET web forms app&#8230;. but what&#8217;s the fun in that?!?  Besides, you know that you&#8217;re going to [...]]]></description>
			<content:encoded><![CDATA[<h2>PART 1:  Setting up the database and Entity Framework Model</h2>
<p>Okay, so say you need to create an internal IIS hosted web application that acts as a portal for managing internal training courses.  You could do a simple ASP.NET web forms app&#8230;. but what&#8217;s the fun in that?!?  Besides, you know that you&#8217;re going to need to expand this thing regularly to handle different course types and provide different layers of permission depending on the user.  Well, as it happens, ASP.NET MVC is a really nice way to address such a situation (especially if you&#8217;re already familiar with using Java and Struts).</p>
<p>Before we get started you&#8217;ll need to get the usual downloads from Microsoft found here:  <a href="http://www.asp.net/mvc/">http://www.asp.net/mvc/</a></p>
<h2>Create ASP.NET MVC Project</h2>
<p>Then you&#8217;ll need to open either Visual Studio 2008 or the free Visual Web Developer 2008 Express and select the <strong>File-&gt;New Project</strong> menu item.  This will bring up the &#8220;New Project&#8221; dialog.  To create a new ASP.NET MVC application, we&#8217;ll select the &#8220;Web&#8221; node on the left-hand side of the dialog and then choose the <strong>ASP.NET MVC Web Application</strong> template and enter the following:<strong></strong></p>
<ul>
<li>Name: TrainingPortalMVC<strong></strong></li>
<li>Location: C:\Development<strong></strong></li>
<li>Solution: Create new Solution<strong></strong></li>
<li>Solution Name: TrainingPortalMVC<strong></strong></li>
<li>Create directory for solution:  checked</li>
</ul>
<p><a href="http://byatool.com/wp-content/uploads/2010/04/NewProjectSC.jpg"><img class="alignnone size-full wp-image-1369" src="http://byatool.com/wp-content/uploads/2010/04/NewProjectSC.jpg" alt="" width="602" height="439" /></a></p>
<h2>SQL 2005 Database Tables</h2>
<p>To setup your MVC project so it can use the Microsoft Entity Framework:</p>
<ol>
<li>Right-click the App_Data folder in the Solution Explorer window and select the menu option <strong>Add, New Item.</strong></li>
<li>From the <strong>Add New Item</strong> dialog box, select <strong>SQL Server Database</strong>, give the database the name TrainingPortalDB.mdf, and click the <strong>Add</strong> button.</li>
<li>Double-click the TrainingPortalDB.mdf file to open the Server Explorer/Database Explorer window.</li>
<li>Click on the <strong>Database Diagrams</strong> folder and say yes to create a new diagram</li>
<li>Setup your tables to look like this:</li>
</ol>
<p><a href="http://byatool.com/wp-content/uploads/2010/04/DataDiagramSC.jpg"><img class="alignnone size-full wp-image-1371" src="http://byatool.com/wp-content/uploads/2010/04/DataDiagramSC.jpg" alt="" width="612" height="496" /></a></p>
<h2>Create the Entity Framework Model</h2>
<p><strong>Steps</strong></p>
<ol>
<li>Right-click the <strong>TrainingPortalMVC</strong> project. <strong></strong></li>
<li>Select in the menu <strong>Add New Item</strong></li>
<li>Select from the Templates: <strong>ADO.NET Entity Data Model</strong></li>
<li>Enter the name <strong>TrainingPortalEDM.edmx</strong> then click <strong>Add</strong></li>
<li>Choose the <strong>Generate from database</strong> then click <strong>Next&gt;</strong></li>
<li>For the data connection, select <strong>TrainingMvc.mdf</strong> make sure the checkbox is checked and the connection settings is <strong>TrainingMvcEntities</strong> then click <strong>Next&gt;</strong></li>
<li>Check all tables in the database except for the <strong>sysdiagrams (dbo)</strong> one and make sure the Model Namespace is <strong>TrainingMvcModel</strong>.  Click <strong>Finish</strong></li>
</ol>
<p><strong>Suggested Modifications</strong></p>
<ul>
<li>Open the ModelBrowser panel in Visual Studio 2008, and expand the EntityContainer-&gt;EntitySets and add “Set” to the end of your Entity Sets….. Trust me, it will make things much less confusing later…</li>
</ul>
<p>When you&#8217;re done you should have something like this:</p>
<p><a href="http://byatool.com/wp-content/uploads/2010/04/EDMSC.jpg"><img class="alignnone size-full wp-image-1370" src="http://byatool.com/wp-content/uploads/2010/04/EDMSC.jpg" alt="" width="669" height="524" /></a></p>
<p>This is the end of Part 1&#8230;&#8230; Calm down, I know you can&#8217;t possibly wait for more answers, but a girl&#8217;s gotta have a little mystery to keep things interesting.  Good luck and hopefully this will help you shed another angle of light to get a better idea of how you want to approach this type of application until I can finish procrastinating&#8230;. I mean preparing Part 2&#8230;..</p>
<div  class="related_post_title">Most Commented Posts</div><ul class="related_post"><li><a href="http://byatool.com/ui/my-jquery-primer/" title="My jQuery Primer">My jQuery Primer</a></li><li><a href="http://byatool.com/mvc/custom-data-annotations-with-mvc-how-to-check-multiple-properties-at-one-time/" title="Custom Data Annotations With MVC: How to Check Multiple Properties at One Time">Custom Data Annotations With MVC: How to Check Multiple Properties at One Time</a></li><li><a href="http://byatool.com/mvc/asp-net-mvc-upload-image-to-database-and-show-image-dynamically-using-a-view/" title="ASP.Net MVC: Upload Image to Database and Show Image &#8220;Dynamically&#8221; Using a View">ASP.Net MVC: Upload Image to Database and Show Image &#8220;Dynamically&#8221; Using a View</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/c/mvc-and-table-inheritance-part-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Failure scanning CollectionGen.dll for extensions.</title>
		<link>http://byatool.com/lessons/failure-scanning-collectiongen-dll-for-extensions/</link>
		<comments>http://byatool.com/lessons/failure-scanning-collectiongen-dll-for-extensions/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 14:32:48 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Lessons]]></category>
		<category><![CDATA[Nant]]></category>
		<category><![CDATA[NantContrib]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1366</guid>
		<description><![CDATA[Quick hit, you might get this if you try loading the bin directory of the nantcontrib project AND YOU DIDN&#8217;T FOLLOW THIS POST. Solution, FOLLOW THIS POST or you can simply remove the CollectionGen.dll from the bin directory. However if you do that, you aren&#8217;t helping my bounce rate and that makes you a Communist&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>Quick hit, you might get this if you try loading the bin directory of the nantcontrib project <a href="http://byatool.com/lessons/how-to-installusing-nantcontrib-because-the-documentation-sucks/">AND YOU DIDN&#8217;T FOLLOW THIS POST.</a></p>
<p>Solution, <a href="http://byatool.com/lessons/how-to-installusing-nantcontrib-because-the-documentation-sucks/">FOLLOW THIS POST</a> or you can simply remove the CollectionGen.dll from the bin directory.  However if you do that, you aren&#8217;t helping my bounce rate and that makes you a Communist&#8230; unless you are a Communist then it makes you a Capitalist.</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/lessons/how-to-installusing-nantcontrib-because-the-documentation-sucks/" title="How to Install/Using NantContrib BECAUSE THE DOCUMENTATION SUCKS">How to Install/Using NantContrib BECAUSE THE DOCUMENTATION SUCKS</a></li><li><a href="http://byatool.com/lessons/using-subversion-with-nant-automated-checkouts-from-config-file/" title="Using Subversion With Nant: Automated Checkouts From Config File">Using Subversion With Nant: Automated Checkouts From Config File</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/lessons/failure-scanning-collectiongen-dll-for-extensions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Install/Using NantContrib BECAUSE THE DOCUMENTATION SUCKS</title>
		<link>http://byatool.com/lessons/how-to-installusing-nantcontrib-because-the-documentation-sucks/</link>
		<comments>http://byatool.com/lessons/how-to-installusing-nantcontrib-because-the-documentation-sucks/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 14:29:30 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Lessons]]></category>
		<category><![CDATA[Nant]]></category>
		<category><![CDATA[NantContrib]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1363</guid>
		<description><![CDATA[I understand I&#8217;m not what you call the sharpest bulb in the bunch, but readmes shouldn&#8217;t be painful. They should be helpful. They should be kind and gentle, and remind you that the world is great and wonderful. Not put you on the verge of a three figure body count. In a way, this is [...]]]></description>
			<content:encoded><![CDATA[<p>I understand I&#8217;m not what you call the sharpest bulb in the bunch, but readmes shouldn&#8217;t be painful.  They should be helpful.  They should be kind and gentle, and remind you that the world is great and wonderful.  Not put you on the verge of a three figure body count.  In a way, this is why I&#8217;ve shied away from a lot of open source stuff since the readme files read like instructions for putting together something from IKEA.  And not the horrible broken English ones, more like the ones with all those funny squiggly lines.  (I think it&#8217;s call &#8220;Chinese&#8221;)  Why is it always so painful to figure something out WHEN YOU HAVE INSTRUCTIONS?  Best hint on writing instructions, always assume the person you&#8217;re writing to is an idiot.  You can infer from that whatever you want.</p>
<p>Anyhow, NantContrib, the library of things that adds on to Nant (With brilliant ideas like being able to add an else to an if WOW), is a victim of nothumanenoughtowriteadecentreadmefileinawaythatnormalhumansunderstanditis (Otherwise known as Thoreau Syndrome) so I thought I would save you some together time between your head and your monitor.</p>
<p>Now you could go download it from wherever it is, or you can just grab <a href="http://www.byatool.com/hosted/nantcontrib.zip">this</a> which is nantcontrib post &#8220;fixing&#8221; it.  Basically if you get my version, all you have to do is drop it somewhere, anywhere, and extract.  I put it in the same directory that Nant is, so they sort of sit side by side but separate.  A happy little couple, at least for the first few years until Nant has a mid life crisis and decides it&#8217;s time to get a Corvette and start rolling for college girls at which point nantcontrib starts eying the Fedex guy.  Right now, its idealistic bliss.</p>
<p>Once you&#8217;ve done that, all you have to do is drop this bit into your nant script, probably above your properties, but it possibly can go other places.  I haven&#8217;t really looked into that.</p>
<pre>
&lt;loadtasks&gt;
  &lt;fileset&gt;
    &lt;include name="c:\nantcontrib\bin\lib\" /&gt;
  &lt;/fileset&gt;
&lt;/loadtasks&gt;
</pre>
<p>And now you are ready to go.</p>
<p>Now you might be curious about what I did to the directory structure of the nantcontrib stuff.  It&#8217;s actually pretty simple. I just took the bin folder and split it up. (Something I kind of pieced together from random pages)  I took what I understand to be the important stuff (All the dlls except CollectionGen.dll and SlingShot.core.dll.. wait I&#8217;m sorry SLiNgshoT.core.dll cause f&#8212;ed up casing means its that much better. ITS HARDCORE MAN!  TO THE XXXXXXXTREEEEMEEEE!) and put it into a new folder &#8220;lib&#8221; that still resides in the bin folder.  The rest of the stuff went into a new folder &#8220;tasks&#8221;.  Then I had the loadtask command include everything in bin\lib.  Boom, everything works as it should.</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/lessons/failure-scanning-collectiongen-dll-for-extensions/" title="Failure scanning CollectionGen.dll for extensions.">Failure scanning CollectionGen.dll for extensions.</a></li><li><a href="http://byatool.com/lessons/using-subversion-with-nant-automated-checkouts-from-config-file/" title="Using Subversion With Nant: Automated Checkouts From Config File">Using Subversion With Nant: Automated Checkouts From Config File</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/lessons/how-to-installusing-nantcontrib-because-the-documentation-sucks/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Force Embeded Video Behind A JQuery Modal Dialog</title>
		<link>http://byatool.com/lessons/force-embeded-video-behind-a-jquery-modal-dialog/</link>
		<comments>http://byatool.com/lessons/force-embeded-video-behind-a-jquery-modal-dialog/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 17:22:22 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Lessons]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1361</guid>
		<description><![CDATA[Another quick one, and I&#8217;ll probably file this under &#8220;I don&#8217;t care you if need this but I&#8217;m posting it because I have a bad memory&#8221;. When you use the jQuery Modal Dialog with an embedded video, like say something from youtube, and you have a modal dialog on the same page, you might notice [...]]]></description>
			<content:encoded><![CDATA[<p>Another quick one,  and I&#8217;ll probably file this under &#8220;I don&#8217;t care you if need this but I&#8217;m posting it because I have a bad memory&#8221;.  When you use the jQuery Modal Dialog with an embedded video, like say something  from youtube, and you have a modal dialog on the same page, you might notice that the video stays in front of the dialog.  This would be considered contrary to design.  Nice thing is, it&#8217;s an easy fix:</p>
<pre>&lt;<span style="color: #800000;">object</span> <span style="color: #0000ff;">class<span style="color: #ff0000;">=</span></span><span style="color: #ff0000;">"nospace"</span> <span style="color: #0000ff;">data=</span><span style="color: #ff0000;">"http://www.youtube.com/v/jU_lNNwCLp0&amp;hl=en_US&amp;fs=1&amp;" height="320" type="application/x-shockwave-flash"</span> <span style="color: #0000ff;">width=</span><span style="color: #ff0000;">"400"</span> &gt;
  &lt;<span style="color: #800000;">param</span> <span style="color: #0000ff;">name<span style="color: #ff0000;">=</span></span><span style="color: #ff0000;">"movie"</span> <span style="color: #0000ff;">value=</span><span style="color: #ff0000;">"http://www.youtube.com/v/jU_lNNwCLp0&amp;hl=en_US&amp;fs=1&amp;"</span> /&gt;
  &lt;<span style="color: #800000;">param</span> <span style="color: #0000ff;">name=</span><span style="color: #ff0000;">"allowFullScreen"</span> <span style="color: #0000ff;">value<span style="color: #ff0000;">=</span></span><span style="color: #ff0000;">"true"</span> /&gt;
  &lt;<span style="color: #800000;">param</span> <span style="color: #0000ff;">name<span style="color: #ff0000;">=</span></span><span style="color: #ff0000;">"allowscriptaccess"</span> <span style="color: #0000ff;">value<span style="color: #ff0000;">=</span></span><span style="color: #ff0000;">"always"</span>/&gt;
  &lt;<span style="color: #800000;">param</span> <span style="color: #0000ff;">name<span style="color: #ff0000;">=</span></span><span style="color: #ff0000;">"wmode"</span> <span style="color: #0000ff;">value<span style="color: #ff0000;">=</span></span><span style="color: #ff0000;">"opaque"</span>/&gt; <span style="color: #008000;">&lt;----- RIGHT THERE LOOK SEE IT?????</span>
&lt;/<span style="color: #800000;">object</span>&gt;
</pre>
<p>It&#8217;s the last parameter in that block.  I posted the whole thing because it just seemed easier.</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/lessons/element-embed-is-not-supported-embedding-youtube-video-without-the-embed-tag/" title="Element &#8216;Embed&#8217; Is Not Supported: Embedding YouTube Video Without The Embed Tag">Element &#8216;Embed&#8217; Is Not Supported: Embedding YouTube Video Without The Embed Tag</a></li><li><a href="http://byatool.com/ui/quick-hit-hiding-horizontal-or-verticle-scroll-using-css/" title="Quick Hit: Hiding Horizontal or Verticle scroll using CSS">Quick Hit: Hiding Horizontal or Verticle scroll using CSS</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/lessons/force-embeded-video-behind-a-jquery-modal-dialog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Element &#8216;Embed&#8217; Is Not Supported: Embedding YouTube Video Without The Embed Tag</title>
		<link>http://byatool.com/lessons/element-embed-is-not-supported-embedding-youtube-video-without-the-embed-tag/</link>
		<comments>http://byatool.com/lessons/element-embed-is-not-supported-embedding-youtube-video-without-the-embed-tag/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 16:52:44 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Lessons]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1356</guid>
		<description><![CDATA[This should be quick, so don&#8217;t expect my usual charming self. If you&#8217;ve run into this problem, and chances are you have, you&#8217;re probably as frustrated as a thumbless hitchhiker. Good thing is, I have the solution and you can watch it here on video: HAHAH THAT WAS FUNNY! Yeah I&#8217;m not that big of [...]]]></description>
			<content:encoded><![CDATA[<p>This should be quick, so don&#8217;t expect my usual charming self.  If you&#8217;ve run into this problem, and chances are you have, you&#8217;re probably as frustrated as a thumbless hitchhiker.  Good thing is, I have the solution and you can <a href="http://byatool.com/wp-content/uploads/2010/04/nodog.jpg">watch it here on video:</a></p>
<p>HAHAH THAT WAS FUNNY!  Yeah I&#8217;m not that big of a bag.  I actually will give you the code.  Go figure.</p>
<pre>&lt;<span style="color: #800000;">object</span> <span style="color: #0000ff;">class<span style="color: #ff0000;">=</span></span><span style="color: #ff0000;">"nospace"</span> <span style="color: #0000ff;">data=</span><span style="color: #ff0000;">"http://www.youtube.com/v/jU_lNNwCLp0&amp;hl=en_US&amp;fs=1&amp;" height="320" type="application/x-shockwave-flash"</span> <span style="color: #0000ff;">width=</span><span style="color: #ff0000;">"400"</span> &gt;
  &lt;<span style="color: #800000;">param</span> <span style="color: #0000ff;">name<span style="color: #ff0000;">=</span></span><span style="color: #ff0000;">"movie"</span> <span style="color: #0000ff;">value=</span><span style="color: #ff0000;">"http://www.youtube.com/v/jU_lNNwCLp0&amp;hl=en_US&amp;fs=1&amp;"</span> /&gt;
  &lt;<span style="color: #800000;">param</span> <span style="color: #0000ff;">name=</span><span style="color: #ff0000;">"allowFullScreen"</span> <span style="color: #0000ff;">value<span style="color: #ff0000;">=</span></span><span style="color: #ff0000;">"true"</span> /&gt;
  &lt;<span style="color: #800000;">param</span> <span style="color: #0000ff;">name<span style="color: #ff0000;">=</span></span><span style="color: #ff0000;">"allowscriptaccess"</span> <span style="color: #0000ff;">value<span style="color: #ff0000;">=</span></span><span style="color: #ff0000;">"always"</span>/&gt;
&lt;/<span style="color: #800000;">object</span>&gt;
</pre>
<p>And there it is.  Easy as something other than pie because pie isn&#8217;t f&#8212;ing easy to make.</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/lessons/force-embeded-video-behind-a-jquery-modal-dialog/" title="Force Embeded Video Behind A JQuery Modal Dialog">Force Embeded Video Behind A JQuery Modal Dialog</a></li><li><a href="http://byatool.com/ui/quick-hit-hiding-horizontal-or-verticle-scroll-using-css/" title="Quick Hit: Hiding Horizontal or Verticle scroll using CSS">Quick Hit: Hiding Horizontal or Verticle scroll using CSS</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/lessons/element-embed-is-not-supported-embedding-youtube-video-without-the-embed-tag/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Subversion With Nant: Automated Checkouts From Config File</title>
		<link>http://byatool.com/lessons/using-subversion-with-nant-automated-checkouts-from-config-file/</link>
		<comments>http://byatool.com/lessons/using-subversion-with-nant-automated-checkouts-from-config-file/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 13:55:20 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Lessons]]></category>
		<category><![CDATA[Nant]]></category>
		<category><![CDATA[Subversion]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1347</guid>
		<description><![CDATA[This is the first part of a I HAVE NO CLUE HOW MANY part thing involving Nant and how to use it to make your life easier. Of course you might wonder why I&#8217;m using Nant over say MSBuild, (Though I&#8217;m sure you were actually wondering if you really can get ripped in two weeks) [...]]]></description>
			<content:encoded><![CDATA[<p>This is the first part of a I HAVE NO CLUE HOW MANY part thing involving Nant and how to use it to make your life easier. Of course you might wonder why I&#8217;m using Nant over say MSBuild, (Though I&#8217;m sure you were actually wondering if you really can get ripped in two weeks) and I have no real reason other than at some point this will tie into Cruise Control for easy deployments. Fact is, the debate between nant and msbuild is an ongoing war between the hopeless broken records known as Microsoft haters and the mindless Microbots. Personal, I don&#8217;t really care since they are both fine. I may some day switch to MSBuild but for the scope of this article that MIGHT BE A BIT STUPID AND HYPOCRITICAL.</p>
<p>Also you might wonder about why I&#8217;m using subversion instead of say Team Foundation Server. (And no you can&#8217;t get ripped in two weeks) Probably has to do with the 10k I don&#8217;t have to shell out for something that is about two generations behind subversion&#8230; and that&#8217;s saying something since subversion is about two generations behind source control in general. But my subversion hosting is 3.95 a month. So it really comes down to what is the only thing that matters when developing: Money.</p>
<p>Say you have someone new coming in and you want to be able to have said person be able to get a project from a subversion repository without really thinking. (You can&#8217;t assume new people think.) This is mostly helpful because chances are you&#8217;re place of employment is a revolving door just like every other place. So the thought of automation comes to mind. What if I told you getting things from a subversion repository is as easy as a config file? &#8220;Balderdash!&#8221;, you say. &#8220;The f&#8212; is balderdash?&#8221;, I reply. And at somepoint we talking an common language and I show you this:</p>
<pre>&lt;<span style="color: #800000;">project</span> <span style="color: #ff0000;">name=</span><span style="color: #0000ff;">"ToolInstall"</span> <span style="color: #ff0000;">default=</span><span style="color: #0000ff;">"download"</span>&gt;
  &lt;<span style="color: #800000;">property</span> <span style="color: #ff0000;">name=</span><span style="color: #0000ff;">"toolProject"</span> <span style="color: #ff0000;">value=</span><span style="color: #0000ff;">"ToolsProject"</span> /&gt;
  &lt;<span style="color: #800000;">property</span> <span style="color: #ff0000;">name=</span><span style="color: #0000ff;">"svnLocation"</span> <span style="color: #ff0000;">value=</span><span style="color: #0000ff;">"c:\program files\subversion\bin\svn.exe"</span> /&gt;

  &lt;<span style="color: #800000;">target</span> <span style="color: #ff0000;">name=</span><span style="color: #0000ff;">"clean"</span> <span style="color: #ff0000;">description=</span><span style="color: #0000ff;">"cleans build directory"</span>&gt;
    &lt;<span style="color: #800000;">delete</span> <span style="color: #ff0000;">dir=</span><span style="color: #0000ff;">"${toolProject}"</span> <span style="color: #ff0000;">verbose=</span><span style="color: #0000ff;">"false"</span> <span style="color: #ff0000;">failonerror</span>=<span style="color: #0000ff;">"false"</span>/&gt;
  &lt;/<span style="color: #800000;">target</span>&gt;

  &lt;<span style="color: #800000;">target</span> <span style="color: #ff0000;">name=</span><span style="color: #0000ff;">"download"</span> <span style="color: #ff0000;">description=</span><span style="color: #0000ff;">"gets projects from repository"</span> <span style="color: #ff0000;">depends=</span><span style="color: #0000ff;">"clean"</span>&gt;
   &lt;<span style="color: #800000;">exec</span> <span style="color: #ff0000;">program=</span><span style="color: #0000ff;">"${svnLocation}"</span> <span style="color: #ff0000;">commandline=</span><span style="color: #0000ff;">"checkout http://some.repository.com/trunk/src/ToolProject ToolProject --username tool --password somepassword"</span>/&gt;
  &lt;/<span style="color: #800000;">target</span>&gt;
&lt;/<span style="color: #800000;">project</span>&gt;</pre>
<p>What&#8217;s all of this? Well I am here to break it down. Oh Oh Whoooaaa.</p>
<pre>&lt;<span style="color: #800000;">project</span> <span style="color: #ff0000;">name=</span><span style="color: #0000ff;">"ToolInstall"</span> <span style="color: #ff0000;">default=</span><span style="color: #0000ff;">"download"</span>&gt;</pre>
<p>First element of the file has to be project. The name isn&#8217;t all that important to this example, however Default means whith taget it will run first if you don&#8217;t tell it.</p>
<pre>  &lt;<span style="color: #800000;">property</span> <span style="color: #ff0000;">name=</span><span style="color: #0000ff;">"toolProject"</span> <span style="color: #ff0000;">value=</span><span style="color: #0000ff;">"ToolsProject"</span> /&gt;
  &lt;<span style="color: #800000;">property</span> <span style="color: #ff0000;">name=</span><span style="color: #0000ff;">"svnLocation"</span> <span style="color: #ff0000;">value=</span><span style="color: #0000ff;">"c:\program files\subversion\bin\svn.exe"</span> /&gt;</pre>
<p>Think of a Property as a variable. They just allow you to take out as many repeated strings as possible. You&#8217;ll see that the svnLocation Property points to where subversion was installed. This will vary per computer if you didn&#8217;t specify the name of the install directory.</p>
<pre>  &lt;<span style="color: #800000;">target</span> <span style="color: #ff0000;">name=</span><span style="color: #0000ff;">"clean"</span> <span style="color: #ff0000;">description=</span><span style="color: #0000ff;">"cleans build directory"</span>&gt;
    &lt;<span style="color: #800000;">delete</span> <span style="color: #ff0000;">dir=</span><span style="color: #0000ff;">"${toolProject}"</span> <span style="color: #ff0000;">verbose=</span><span style="color: #0000ff;">"false"</span> <span style="color: #ff0000;">failonerror</span>=<span style="color: #0000ff;">"false"</span>/&gt;
  &lt;/<span style="color: #800000;">target</span>&gt;</pre>
<p>A target is basically a task you need to have done. It could be anything from deleting junk, running tests, or getting you a date. (HAHA ITS FUNAY CAUSE THATS IMPOSSIBLE) For this one, it is simply removing a folder that may exist. You can use this same idea to remove bin and obj folders if you use nant to build your project or simply clean it&#8230; But I&#8217;ll get to building in another post.</p>
<pre>  &lt;<span style="color: #800000;">target</span> <span style="color: #ff0000;">name=</span><span style="color: #0000ff;">"download"</span> <span style="color: #ff0000;">description=</span><span style="color: #0000ff;">"gets projects from repository"</span> <span style="color: #ff0000;">depends=</span><span style="color: #0000ff;">"clean"</span>&gt;
   &lt;<span style="color: #800000;">exec</span> <span style="color: #ff0000;">program=</span><span style="color: #0000ff;">"${svnLocation}"</span> <span style="color: #ff0000;">commandline=</span><span style="color: #0000ff;">"checkout http://some.repository.com/trunk/src/ToolProject ToolProject --username tool --password somepassword"</span>/&gt;
  &lt;/<span style="color: #800000;">target</span>&gt;</pre>
<p>And there&#8217;s the best part of the post, using nant to grab something from a subversion repository. As you can see, I&#8217;ve used the svnLocation property to make it easier to set what Program to use. I think this target is pretty much self explanitory for anyone with an IQ higher that that of a potato.</p>
<p>Next step is just to create a batch file to call nant and run this config file. Let&#8217;s assume you called it Nant.install. I know, it&#8217;s so descriptive, it&#8217;s genius. Shut up, I get the sarcasm.</p>
<p>Here&#8217;s the batch file:</p>
<pre>@..\nant\nant.exe -buildfile:Nant.install</pre>
<p>Mind you @..\nant\nant.exe will change depending where your copy of nant.exe is, but I figured I leave that in the way it is just to show that it doesn&#8217;t have to reside in the same place.</p>
<p>And there you have it, subversion and nant together like two children frolicking in the forests of Bavaria. (Assuming they have forests there and me mentioning kids isn&#8217;t creepy) In my next post I&#8217;ll probably go more into nant itself, this was just kind of on a whim. And I don&#8217;t know why I am appologizing for this. Stop f&#8212;ing judging me.</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/lessons/failure-scanning-collectiongen-dll-for-extensions/" title="Failure scanning CollectionGen.dll for extensions.">Failure scanning CollectionGen.dll for extensions.</a></li><li><a href="http://byatool.com/lessons/how-to-installusing-nantcontrib-because-the-documentation-sucks/" title="How to Install/Using NantContrib BECAUSE THE DOCUMENTATION SUCKS">How to Install/Using NantContrib BECAUSE THE DOCUMENTATION SUCKS</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/lessons/using-subversion-with-nant-automated-checkouts-from-config-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Use a Factory Method With Castle / WindsorContainer</title>
		<link>http://byatool.com/lessons/how-to-use-a-factory-method-with-castle-windsorcontainer/</link>
		<comments>http://byatool.com/lessons/how-to-use-a-factory-method-with-castle-windsorcontainer/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 13:29:13 +0000</pubDate>
		<dc:creator>Sean</dc:creator>
				<category><![CDATA[Lessons]]></category>
		<category><![CDATA[Castle]]></category>
		<category><![CDATA[Mocking]]></category>
		<category><![CDATA[Test]]></category>

		<guid isPermaLink="false">http://byatool.com/?p=1316</guid>
		<description><![CDATA[In my last post, I showed you the wonder of the WindsorContainer and creating concrete objects from a config file&#8230; but I wasn&#8217;t done yet. In fact, if you looked at my example and used your keen sense of observation (I&#8217;m suspending my disbelief) you might have noticed a little somethin&#8217; somethin&#8217; in the config [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://byatool.com/lessons/castle-rhino-mocking-and-possibly-you/">In my last post</a>, I showed you the wonder of the WindsorContainer and creating concrete objects from a config file&#8230; but I wasn&#8217;t done yet. In fact, if you looked at <a href="http://byatool.com/Hosted/LiveDemos/CastleConfigTest.zip">my example</a> and used your keen sense of observation (I&#8217;m suspending my disbelief) you might have noticed a little somethin&#8217; somethin&#8217; in the config file that I didn&#8217;t explain:</p>
<pre>  &lt;<span style="color: #800000;">component</span> <span style="color: #0000ff;">id=</span><span style="color: #ff0000;">"factoryB"
</span>    <span style="color: #0000ff;">type=</span><span style="color: #ff0000;">"CastleConfigTest.Factory.FactoryB, CastleConfigTest"</span>&gt;
  &lt;/<span style="color: #800000;">component</span>&gt;

  &lt;<span style="color: #800000;">component</span> <span style="color: #0000ff;">id=</span><span style="color: #ff0000;">"childClassB"
</span>   <span style="color: #0000ff;">type=</span><span style="color: #ff0000;">"CastleConfigTest.Interface.IBaseClassB, CastleConfigTest"</span>
   <span style="color: #0000ff;">factoryId=</span><span style="color: #ff0000;">"factoryB"</span>
   <span style="color: #0000ff;">factoryCreate=</span><span style="color: #ff0000;">"Create"</span>&gt;
  &lt;/<span style="color: #800000;">component</span>&gt;</pre>
<p>And:</p>
<pre>  &lt;<span style="color: #800000;">facilities</span>&gt;
    &lt;<span style="color: #800000;">facility</span> <span style="color: #0000ff;">id=</span><span style="color: #ff0000;">"factorysupport"</span> <span style="color: #0000ff;">type=</span><span style="color: #ff0000;">"Castle.Facilities.FactorySupport.FactorySupportFacility, Castle.Microkernel"</span> /&gt;
  &lt;/<span style="color: #800000;">facilities</span>&gt;</pre>
<p>What are these??? Could they be the proof of intelligent life we&#8217;ve been looking for? Sadly no, since they actually are part of something that sounds a lot more complicated then it is. Say you have this interface:</p>
<pre>  <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">interface</span> <span style="color: #008080;">IBaseClassB</span>
  {
    <span style="color: #008080;">String</span> ClassName();
  }</pre>
<p>And this class:</p>
<pre>  <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #008080;">ChildClassB </span>: <span style="color: #008080;">IBaseClassB</span>
  {
    <span style="color: #0000ff;">public</span> <span style="color: #008080;">String</span> ClassName()
    {
      <span style="color: #0000ff;">return</span> <span style="color: #800000;">"ChildClassB"</span>;
    }
  }</pre>
<p>Which is all pretty straight forward much like that woman&#8217;s answer to you asking her out, &#8220;God no.&#8221;</p>
<p>If you had <a href="http://byatool.com/lessons/castle-rhino-mocking-and-possibly-you/">read this post</a>, you might guess where this is going. Or you might guess that I&#8217;m going to re-explain it because you are too lazy to go and read it. One of those is correct.</p>
<p>Once again like my last post I do something simple like this:</p>
<pre>  <span style="color: #0000ff;">var</span> test = <span style="color: #0000ff;">new</span> <span style="color: #008080;">ObjectFactory</span>().Create&lt;<span style="color: #008080;">IBaseClassB</span>&gt;();</pre>
<p>And what I get is a brand new shiny ChildClassB. I can hear the yawns from here SO I&#8217;ll change it up a bit. What if I need ChildClassB to come from a Factory? How the hell would I pull that off?</p>
<pre>  <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> <span style="color: #008080;">FactoryB
</span>  {
    <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">static</span> <span style="color: #008080;">IBaseClassB</span> Create()
    {
      <span style="color: #0000ff;">var</span> test = <span style="color: #0000ff;">new</span> <span style="color: #008080;">ChildClassB</span>();
      <span style="color: #008000;">//Do some stuff to test</span>
      <span style="color: #0000ff;">return</span> test;
    }
  }</pre>
<p>I no longer can just replace IBaseClassB with ChildClassB directly because I need FactoryB to do something for me first. (I cheated by just adding a comment where code might go.  Point is, something happens to ChildClassB before the factory returns it.) OH NO! WHAT AM I TO DO? HOW CAN I SOLVE THIS? DOES THE CAPSLOCK ADD SUSPENSE?</p>
<p>Guess what? That&#8217;s right, that&#8217;s where that config stuff at the top comes in. Here&#8217;s the config file in full:</p>
<pre>&lt;<span style="color: #800000;">configuration</span>&gt;
  &lt;<span style="color: #800000;">components</span>&gt;
    &lt;<span style="color: #800000;">component</span> <span style="color: #0000ff;">id=</span><span style="color: #ff0000;">"factoryB"</span>
      <span style="color: #0000ff;">type=</span><span style="color: #ff0000;">"CastleConfigTest.Factory.FactoryB, CastleConfigTest"</span>&gt;
    &lt;/<span style="color: #800000;">component</span>&gt;
    &lt;<span style="color: #800000;">component</span> <span style="color: #0000ff;">id=</span><span style="color: #ff0000;">"childClassB"</span>
     <span style="color: #0000ff;">type=</span><span style="color: #ff0000;">"CastleConfigTest.Interface.IBaseClassB, CastleConfigTest"</span>
     <span style="color: #0000ff;">factoryId=</span><span style="color: #ff0000;">"factoryB"</span>
     <span style="color: #0000ff;">factoryCreate=</span><span style="color: #ff0000;">"Create"</span>&gt;
    &lt;/<span style="color: #800000;">component</span>&gt;
  &lt;/<span style="color: #800000;">components</span>&gt;
  &lt;<span style="color: #800000;">facilities</span>&gt;
    &lt;<span style="color: #800000;">facility</span> <span style="color: #0000ff;">id=</span><span style="color: #ff0000;">"factorysupport"</span> <span style="color: #0000ff;">type=</span><span style="color: #ff0000;">"Castle.Facilities.FactorySupport.FactorySupportFacility, Castle.Microkernel"</span> /&gt;
  &lt;/<span style="color: #800000;">facilities</span>&gt;
&lt;/<span style="color: #800000;">configuration</span>&gt;
</pre>
<p>Ok so I lied, that&#8217;s not the full thing I have in <a href="http://byatool.com/Hosted/LiveDemos/CastleConfigTest.zip"> my example that you can download</a>, but it is what you need for this part.  It&#8217;s actually pretty simple too.  You just need to declare three things:</p>
<p>The factory class &#8220;FactoryB&#8221;</p>
<pre>    &lt;<span style="color: #800000;">component</span> <span style="color: #0000ff;">id=</span><span style="color: #ff0000;">"factoryB"</span>
      <span style="color: #0000ff;">type=</span><span style="color: #ff0000;">"CastleConfigTest.Factory.FactoryB, CastleConfigTest"</span>&gt;
    &lt;/<span style="color: #800000;">component</span>&gt;</pre>
<p>The interface you want to mask with the factory return (IBaseClassB)</p>
<pre>    &lt;<span style="color: #800000;">component</span> <span style="color: #0000ff;">id=</span><span style="color: #ff0000;">"childClassB"</span>
     <span style="color: #0000ff;">type=</span><span style="color: #ff0000;">"CastleConfigTest.Interface.IBaseClassB, CastleConfigTest"</span>  <span style="color: #008000;">//This is the interface to look for</span>
     <span style="color: #0000ff;">factoryId=</span><span style="color: #ff0000;">"factoryB"</span>  <span style="color: #008000;">//This is the id from above where you declared the factoryB section</span>
     <span style="color: #0000ff;">factoryCreate=</span><span style="color: #ff0000;">"Create"</span>&gt;  <span style="color: #008000;">//This is the method to use</span>
    &lt;/<span style="color: #800000;">component</span>&gt;</pre>
<p>and the Castle part for using factories</p>
<pre>  &lt;<span style="color: #800000;">facilities</span>&gt;
    &lt;<span style="color: #800000;">facility</span> <span style="color: #0000ff;">id=</span><span style="color: #ff0000;">"factorysupport"</span> <span style="color: #0000ff;">type=</span><span style="color: #ff0000;">"Castle.Facilities.FactorySupport.FactorySupportFacility, Castle.Microkernel"</span> /&gt;
  &lt;/<span style="color: #800000;">facilities</span>&gt;</pre>
<p>And that&#8217;s really it.  From that, this should work:</p>
<pre>    [<span style="color: #008080;">TestMethod</span>]
    p<span style="color: #0000ff;">ublic</span> <span style="color: #0000ff;">void</span> Create_ClassB()
    {
      <span style="color: #008000;">//This will call FactoryB.Create to create the ChildClassB for me</span>
      <span style="color: #0000ff;">var</span> test = <span style="color: #0000ff;">new</span> <span style="color: #008080;">ObjectFactory</span>().Create();
      <span style="color: #008080;">Assert</span>.IsTrue(test.ClassName().Equals(<span style="color: #ff0000;">"ChildClassB"</span>));
    }</pre>
<p>Woo hoo!  Now you can run home and impress your Wife/Husband/fiance/partner/thing that lives in your apartment and always seems to pay the rent late but doesn&#8217;t have any issue with eating everything in your fridge!  Enjoy!</p>
<div  class="related_post_title">Related Posts</div><ul class="related_post"><li><a href="http://byatool.com/lessons/castle-rhino-mocking-and-possibly-you/" title="Castle, Rhino, Mocking, and Possibly You">Castle, Rhino, Mocking, and Possibly You</a></li><li><a href="http://byatool.com/lessons/dictionary-index-lookup-vs-contains-key-vs-list-contains-vs-linq-speed-testtexas-tornado-match/" title="Dictionary Index Lookup Vs Contains Key Vs List Contains Vs Linq&#8230; Speed Test/Texas Tornado Match">Dictionary Index Lookup Vs Contains Key Vs List Contains Vs Linq&#8230; Speed Test/Texas Tornado Match</a></li><li><a href="http://byatool.com/general-coding/filling-a-private-field-on-a-base-class/" title="Filling a Private Field on a Base Class Using Reflection">Filling a Private Field on a Base Class Using Reflection</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://byatool.com/lessons/how-to-use-a-factory-method-with-castle-windsorcontainer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
