<?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>amptools</title>
	<atom:link href="http://www.amptools.net/feed" rel="self" type="application/rss+xml" />
	<link>http://www.amptools.net</link>
	<description>Simplify your life.</description>
	<lastBuildDate>Tue, 16 Mar 2010 18:22:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The trouble with porting migrations and railties into other languages.</title>
		<link>http://www.amptools.net/blog/the-trouble-with-porting-migrations-and-railties-into-other-languages</link>
		<comments>http://www.amptools.net/blog/the-trouble-with-porting-migrations-and-railties-into-other-languages#comments</comments>
		<pubDate>Tue, 16 Mar 2010 09:46:32 +0000</pubDate>
		<dc:creator>Michael Herndon</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[ado.net]]></category>
		<category><![CDATA[C Sharp]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[csharp]]></category>
		<category><![CDATA[migrations]]></category>
		<category><![CDATA[porting]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.amptools.net/?p=288</guid>
		<description><![CDATA[I&#8217;ve been toying with API design for solid and simple with Ado.Net to build migrations on top of and possibly layer for building ORMs on. Ironically, Rob Conery, of Subsonic fame, just posted a page (or blog) about migrations in .net and subsonic in general.
The Problem(s).
Database agnostic scripting in C# and PHP and executing sql [...]]]></description>
			<content:encoded><![CDATA[<img class='gravatar' style='float: left; margin-right: 10px; border: none;' src='http://www.gravatar.com/avatar.php?gravatar_id=899a978b0f02774a965aec11eeb0b8f4&amp;default=http://amppotls.net' alt='No Gravatar' width=48 height=48/><p>I&#8217;ve been toying with API design for solid and simple with Ado.Net to build migrations on top of and possibly layer for building ORMs on. Ironically, Rob Conery, of Subsonic fame, just posted <a href="http://blog.wekeroad.com/2010/03/15/subsonic-migrations-without-subsonic">a page (or blog) about migrations in .net and subsonic</a> in general.</p>
<h2>The Problem(s).</h2>
<p>Database agnostic scripting in C# and PHP and executing sql statements without having to use a heavy ORM in C#.</p>
<p>Obviously, Rails makes a good run at these problems with active record&#8217;s built in migrations that everyone and their mother (or at least their co-workers) tries to mimic.   However C#, PHP, and other C style languages lack that Ruby Meta Programming magic.</p>
<p>So why not just include active record into a project that isn&#8217;t rails?  This might be doable with Iron Ruby&#8217;s release on the horizon. Unfortunately the cost of adding another language to a project is not always justifiable (as some rubyist zealots tend to forget <img src='http://www.amptools.net/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  .</p>
<h2>So why not just port the awesome library?</h2>
<p>After much time over the last year or so, I&#8217;ve come to the conclusion that porting libraries from other languages often comes with delusions of grandeur.  Especially when the languages differ on key features.</p>
<p>Ruby and in some ways Javascript, have a much better mechanism for the portability and mixing in methods. Ruby itself has the ability to create powerful readable Domain Specific Languages that other modern languages will not be able to copy.</p>
<p>You tend to see possible extra noise or reduced flexibility when you compare something like Migrator.Net</p>
<pre class="brush: csharp;">[Migration(20080805151231)]
public class AddCustomerTable : Migration
{
    public override void Up()
    {
         Database.AddTable(&quot;Customer&quot;,
             new Column(&quot;name&quot;, DbType.String, 50),
             new Column(&quot;address&quot;, DbType.String, 100),
             new Column(&quot;age&quot;, DbType.Int32)
        );
    }

    public override void Down()
    {
        Database.RemoveTable(&quot;Customer&quot;);
    }
}</pre>
<p>to Rails Migrations.</p>
<pre class="brush: ruby;">
class 20080805151231_AddCustomerTable &gt; ActiveRecord::Migration
  def self.up
    create_table :customer do |t|
        t.string   :name,     :limit =&gt; 50
        t.string   :address,  :limit =&gt; 100
        t.integer  :age
   end
 end 

  def self.down
    drop_table :customer
  end
end</pre>
<p>The biggest issue I see though is sometimes throwing out the baby with the bathwater by not using some of the same naming conventions because the languages do differ.</p>
<h2>Possible Solutions Or Ideas</h2>
<p>At least when it comes to C# 4.0 it shouldn&#8217;t be too hard to create a .Net library and then create a thin DSL layer in Ruby through Iron Ruby to make calls to the .Net lib.  That coupled with some form of code generation could give you a decent programing work flow.</p>
<p>Another option is to port key features from Rails, adapt to the language that your working in, but at least keep some kind of consistency in naming.</p>
<p>Or  you could do a hybrid. That way you have the ability to create a readable DSL in projects that can allow for this or let you fall back to your native language if it doesn&#8217;t.</p>
<p>It is still ugly and verbose, but at least it follows in some proximity to its ported counter part.</p>
<pre class="brush: csharp;">
[Version(20080805151231)]
public class AddCustomerTable : Migration
{
  public override void Up()
  {
    CreateTable(&quot;Customer&quot;, (t) =&gt; {
      t.String   (&quot;name&quot;,     (c) =&gt; { c.Limit = 50; });
      t.String   (&quot;address&quot;,  (c) =&gt; { c.Limit = 100; });
      t.Integer  (&quot;age&quot;);
    });
 }

 public override void Down()
 {
    DropTable(&quot;Customer&quot;);
 }
}
</pre>
<p>And it shouldn&#8217;t be hard to build on an underlying API. If done right, you could use the DLR for Ruby or even Python for scripting access or creating that thin readable DSL layer.</p>
<p>It would have probably been cleaner to use optional parameters, but &#8216;default&#8217; and &#8216;null&#8217; are keywords in C# and adding @ to keywords for variables can distract from readability.</p>
<p>Another path is to create something new that adapts to your language but does the same thing in principle similar to what Rob partly did for Subsonic 3.0&#8217;s migrations.  Porting could be trying to put a square peg in a round hole. So its time to create that peg that fits.</p>
<p>I&#8217;ll have some follow up posts that cover ideas on the other areas of being able to script sql in C# with Ado.Net as well as experimental APIs and concepts.  If you got any comments, leave em.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.amptools.net/blog/the-trouble-with-porting-migrations-and-railties-into-other-languages/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microformats in HTML 5</title>
		<link>http://www.amptools.net/blog/microformats-in-html-5</link>
		<comments>http://www.amptools.net/blog/microformats-in-html-5#comments</comments>
		<pubDate>Thu, 25 Feb 2010 23:38:10 +0000</pubDate>
		<dc:creator>Michael Herndon</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.amptools.net/?p=285</guid>
		<description><![CDATA[Declaring microformat uri profiles in HTML 5 is different than it was for HTML 4. The profile attribute for the head element was dropped in HTML 5. Gone. Banished, despite the use of other W3 standards that might make use of it like GRDDL (Gleaning Resource Descriptions from Dialects of Languages). And I though Microsoft [...]]]></description>
			<content:encoded><![CDATA[<img class='gravatar' style='float: left; margin-right: 10px; border: none;' src='http://www.gravatar.com/avatar.php?gravatar_id=899a978b0f02774a965aec11eeb0b8f4&amp;default=http://amppotls.net' alt='No Gravatar' width=48 height=48/><p>Declaring microformat uri profiles in HTML 5 is different than it was for HTML 4. The profile attribute for the head element was dropped in HTML 5. Gone. Banished, despite the use of other W3 standards that might make use of it like <a href="http://www.w3.org/2001/sw/grddl-wg/">GRDDL</a> (Gleaning Resource Descriptions from Dialects of Languages). And I though Microsoft was bad at naming things..</p>
<p>This is the typical way that you would define a uri profile in HTML 4</p>
<pre class="brush:html">&lt;html profile="http://purl.org/uF/2008/03/"&gt;
</pre>
<p>In HTML 5, the <a href="http://microformats.org/wiki/profile-uris">microformat&#8217;s wiki</a> suggests using a visible link, anchor a element, or a hidden link inside the head element.  I suggest we use the hidden link inside the head element, despite the lack of example usage of this on the wiki.</p>
<pre class="brush:html">&lt;link rel="profile" href="http://purl.org/uF/2008/03/" /&gt;
</pre>
<p>Now you can go out in the world still use microformats for HTML 5 without generating invalid markup.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.amptools.net/blog/microformats-in-html-5/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>In Vegas, Tonight Only: Asp.Net Mvc vs *</title>
		<link>http://www.amptools.net/blog/in-vegas-tonight-only-asp-net-mvc-vs</link>
		<comments>http://www.amptools.net/blog/in-vegas-tonight-only-asp-net-mvc-vs#comments</comments>
		<pubDate>Sat, 30 Jan 2010 13:59:21 +0000</pubDate>
		<dc:creator>Michael Herndon</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://www.amptools.net/?p=279</guid>
		<description><![CDATA[Notice: I&#8217;m always right. kidding. no seriously dawg, I am.
This post is not about how one Mvc framework is better than the rest, rather about my views of the current status of heated debates in the software community dealing with MVC.
Its feels like the Mac vs PC debate. The practical versus the trendy clique.
The Line [...]]]></description>
			<content:encoded><![CDATA[<img class='gravatar' style='float: left; margin-right: 10px; border: none;' src='http://www.gravatar.com/avatar.php?gravatar_id=899a978b0f02774a965aec11eeb0b8f4&amp;default=http://amppotls.net' alt='No Gravatar' width=48 height=48/><h2>Notice: I&#8217;m always right. kidding. no seriously dawg, I am.</h2>
<p>This post is not about how one Mvc framework is better than the rest, rather about my views of the current status of heated debates in the software community dealing with MVC.</p>
<p>Its feels like the Mac vs PC debate. The practical versus the trendy clique.</p>
<h2>The Line Up: developer cat fights</h2>
<p>There has been a ton of debate about Asp.Net Mvc on twitter, forums, blog posts and various other mediums. Asp.Net Mvc vs the world of Mvc:  WebForms, Rails, and various Java Mvc frameworks (i.e. struts, spring, groovy, grails, etc).</p>
<p>I would add PHP Mvc frameworks to the list, but it seems the frameworks in PHP are always too busy duking it out with other PHP frameworks to have time for frameworks in other other laguages.</p>
<p>To get a glimpse of this, all you would need to do is a search in twitter for &#8220;mvc or php or framework&#8221;. You could also just scout Rob Connery&#8217;s blog, specifically the post on <a href="http://blog.wekeroad.com/2010/01/04/thoughts-on-aspnet-mvp--a-framework-that-wants-to-be-mvc">WebForms and the Mvp framework that wants to be Mvc</a>.</p>
<h2>Intervention Hotline: 1-800-dev-kill</h2>
<p>Scott Gu wrote a blog post on the debacle that is <a href="http://www.amptools.net/blog/in-vegas-tonight-only-asp-net-mvc-vs">Asp.Net Mvc vs WebForms and debating in general</a>. Scott Gutherie, the guy behind Asp.Net and now much more, originally created WebForms and had much to do with the new Mvc framework in .Net.</p>
<p>This is the first time that <em>I&#8217;ve seen</em> one of the higher ups at Microsoft openly engage the whole community this openly in a blog. I do think the guys in Redmond know debate/discourse is important to a healthy community, yet realize a house totally divided can not stand.</p>
<p>I surmise that they also realize the community has nothing to gain by trying to bash other languages, platforms, or other solid slightly competing Microsoft technologies.</p>
<h2>View From The Ring Seats: wiping off the blood spatter</h2>
<p>If people were to visualize this debate it would look something along the lines of the stereotypical somewhat chunky guys with uber thick glasses, living in their mom&#8217;s basement, smacking and pulling each others hair out over a bunch of 1s and 0s.</p>
<p>Scary image, is it not?</p>
<p>This is barely a step up from the angry french guy wearing a sleeveless turtle neck selling a wicked cool book-scanner.</p>
<h2>Developers, Developers, Developers: type this in youtube.</h2>
<p>There are a vast array of developers: they can be green, new, old, seasoned, amazing, awful, inquisitive, humble, or arrogant. Sometimes it better to take a second to understand where they are coming from. New developers sometimes get overexcited easily.</p>
<p>I&#8217;m supportive that developers are passionate about code and their craft.  It is a great motivator and one of the biggest reasons we are gifted with great under appreciated opensource projects that we do have.</p>
<p>However, I have to wonder how much of this debate is due to other reasons: The pressure in the job market? The heightened political debates reaching over into other arenas this past year (2009)? Is it jealously of attention or just being bombarded by the new kid on the block, Asp.Net Mvc?</p>
<p>Emotion does seem to block all blood moving to the rationale and logical parts of the brain. Maybe its just a lack of&#8230;. anyways.</p>
<p>I find it hypocritical when a Ruby developer gets upset because a .Net programmer is excited about the new Mvc option or vice versa. Or better yet, why are we debating why Asp.Net Mvc is better than WebForms? The Asp.Net framework is built on top of WebForms.</p>
<p>The whole Asp.Net Mvc vs Asp.Net WebForms debate is like this. A 3 year old jumps up and down ands says &#8220;Mom, I hate you&#8221; and the mom vehemently replies with immaturity, &#8220;I hate you too&#8221;. Except these are grown men and women, saying this about software. Does that put perspective on it?</p>
<p>Its laughable, arrogant, and ignorant that anyone can honestly say a certain platform, language, or framework is totally superior than all others.</p>
<p>If you want to be the Adolf Hilter of programming languages, frameworks, or applications, be my guest. Just don&#8217;t expect that to wow your clients or make you a ton of money.</p>
<p>The simple reason why that an argumentative attitude will not work is that it creates division and problems, it does not solve them. Clients don&#8217;t respect that. If you need to see this for yourself, look at Microsofts reversal efforts of its previous anti-opensource views and policies.</p>
<h2>Don&#8217;t Be A Tool: be a craftsman.</h2>
<p>Whether your choice of tooling comes from your preference or it might be the solution your client needs: there are various ways to solve problems. Some are more efficient than others.  Over time those solutions change for better or worse.</p>
<p>A great developer can generally find interesting and new ways of solving a problem, even in a very constrained space with the framework, tool, or language is not up to par.</p>
<p>Clients and users generally don&#8217;t care what you use as long as you get the work done. Some clients do care and have constraints for a platform, language, framework that you must fill.</p>
<p>Do what is best for them with as much unbiased decisions that you can, not what is best for you. Network with developers in various spaces, trade work that fits your skill sets or preferences better.</p>
<h2>Down for the count: rather breath and count backwards</h2>
<p>In the meantime, if your passion leads you astray into heavy arguments that descends into insulting the person directly or indirectly. Then its probably time to hit alt+f4 before you make the comment.</p>
<p>If anything you could probably use a walk to shave of those extra developer pounds of fat. Maybe turn on the XBox or Wii, blow some things up.  Unplug, read a book.</p>
<p>Those tweets and blog posts will still be there when you get back.</p>
<p>Do something other than waste bandwidth and space on a harddisk with irate and irrational debate like you were some kind of singles&#8217; dating service advertisement.</p>
<p>At the very least, put that energy and passion into creating an opensource project or something usable for the community.</p>
<p>Feel free to comment, vent, or add some humor.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.amptools.net/blog/in-vegas-tonight-only-asp-net-mvc-vs/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Saying goodbye to shared hosting, embracing the cloud.</title>
		<link>http://www.amptools.net/blog/saying-goodbye-to-shared-hosting-embracing-the-cloud</link>
		<comments>http://www.amptools.net/blog/saying-goodbye-to-shared-hosting-embracing-the-cloud#comments</comments>
		<pubDate>Thu, 14 Jan 2010 07:07:20 +0000</pubDate>
		<dc:creator>Michael Herndon</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[cloud hosting]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[rackspace]]></category>
		<category><![CDATA[shared hosting]]></category>

		<guid isPermaLink="false">http://www.amptools.net/?p=261</guid>
		<description><![CDATA[I really liked using reliablesite.net  as a host provider. Alas, their lack of ability to reign in MySql was killing my ability to do anything with a wordpress blog.
First it started with the site timing out. Then I couldn&#8217;t even log into the backend to make a post. Even with caching, I was increasing [...]]]></description>
			<content:encoded><![CDATA[<img class='gravatar' style='float: left; margin-right: 10px; border: none;' src='http://www.gravatar.com/avatar.php?gravatar_id=899a978b0f02774a965aec11eeb0b8f4&amp;default=http://amppotls.net' alt='No Gravatar' width=48 height=48/><p>I really liked using <a title="reliablesite" href="http://reliablesite.net">reliablesite.net </a> as a host provider. Alas, their lack of ability to reign in MySql was killing my ability to do anything with a wordpress blog.</p>
<p>First it started with the site timing out. Then I couldn&#8217;t even log into the backend to make a post. Even with caching, I was increasing my collection of grey hair prematurely.</p>
<h2>Amptools.Net now resides in the cloud.</h2>
<p>At first, I must say that I was a little skeptical of the notion of moving to the cloud. Though, months of issues, lost productivity, and really no lead way in resolving the issues; does have a way of influencing your decision making process.</p>
<p>Being the Granted Master Developer that I am (don&#8217;t feed the ego folks, it bites), I wanted options. I wanted access to a server with the ability to run .Net, Mono, Ruby, or PHP as needed.</p>
<p>I need to be able to install software that has been shown to work well without difficulty. Of course like any consumer, I need to do this on a fair budget.</p>
<p>My hosting options were to find another shared host, get a dedicated server, or jump into the cloud.  After searching, the cost of shared hosting with limited options excluded themselves.</p>
<p>It came down to finding a decent by inexpensive dedicated server or start digging into researching the options for hosting a site in the cloud.</p>
<p>What surprised me the most was the lack of explanation about the differences in the major cloud companies and what they actually offer.  I consider <a href="http://aws.amazon.com/">Amazon</a>, <a href="http://code.google.com/appengine/">Microsoft</a>, <a href="http://code.google.com/appengine/">Google</a>, and <a href="http://www.rackspace.com/index.php">Rackspace</a> (formerly Mosso) as the biggest providers in the market.</p>
<h2>Google&#8217;s App Engine</h2>
<p>Probably the most self explanatory plan is Google&#8217;s App Engine. You are hosting single apps and charged per application.  You are limited to 10 applications. You are also limited to using either Java or Python at the moment.</p>
<p>Hmm, I like python. But right now I spend more time in other languages. Java. Well, it has no fight left in it. Its like it has given up in becoming a better language, so thats a fat no.  Plus I really want to be able to install a variety of opensource applications as needed that tend to be in other languages.</p>
<h2>Microsoft&#8217;s Azure Platform</h2>
<p>Microsoft&#8217;s Azure platform was the most tempting at first. Microsoft offers .Net, Java, PHP and Ruby on their platform. They generally have great developer tools and they even have an <a href="http://www.interoperabilitybridges.com/projects/windows-azure-tools-for-eclipse.aspx">Azure plugin for eclipse</a>.</p>
<p>Microsoft&#8217;s model is also one application per instance. Paying $60 or more a month per sandboxed application just wasn&#8217;t appealing to me. I need to be able to install more than one application per site.</p>
<h2>Rackspace Cloud</h2>
<p>Next I evaluated Rackspace. They seemed very promising. They offer an <a href="http://www.rackspacecloud.com/cloud_hosting_products/sites">application instance model</a> like Google and Microsoft, but they also offer <a href="http://www.rackspacecloud.com/cloud_hosting_products/servers">cloud servers</a> at a very compelling rate.</p>
<p>Yes! Wait!!! Their cloud servers only offered linux operating systems at the time.  Well I can use Mono, PHP, and Ruby, but I really want to be able to install .Net 4 when it comes out and I didn&#8217;t want move hosts a 3rd time.</p>
<p><strong>Time to check out Amazon.</strong></p>
<h2><strong>Amazon Web Services EC2</strong></h2>
<p>Amazon&#8217;s model does not offer an application instance model, but it does offer <a href="http://aws.amazon.com/ec2/">cloud servers (EC2)</a>. They&#8217;ve have been running windows for a while, but they even have Server 2008 and Server 2008 R2 with a preloaded stack of .net 3.5 and Sql Express.  I would need to install PHP and Ruby myself, but thats no big deal.</p>
<p>Even though the price seems steep compared to shared hosting, its cheaper than dedicated hosting and lets you run more than one application on the server per instance and to install what you need within reason.</p>
<p><strong>Amazon EC2 was the one for me.</strong></p>
<p>The cost is a bit more per month. Its totally worth the ability to blog once again and the freedom to set up the server to meet my needs. The cloud also comes with scalability and maintainability perks to build on. Now I just need to figure out how to make this site cover hosting costs, hiring a professional editor, and owning a cat. Then I&#8217;m golden.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.amptools.net/blog/saying-goodbye-to-shared-hosting-embracing-the-cloud/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Asp.Net Mvc 2 Areas Tip: Drop in a web.config</title>
		<link>http://www.amptools.net/blog/asp-net-mvc-2-areas-tip-drop-in-a-web-config</link>
		<comments>http://www.amptools.net/blog/asp-net-mvc-2-areas-tip-drop-in-a-web-config#comments</comments>
		<pubDate>Mon, 26 Oct 2009 20:28:31 +0000</pubDate>
		<dc:creator>Michael Herndon</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[areas]]></category>
		<category><![CDATA[asp.net mvc]]></category>
		<category><![CDATA[asp.net mvc 2.0]]></category>
		<category><![CDATA[exception]]></category>

		<guid isPermaLink="false">http://www.amptools.net/?p=250</guid>
		<description><![CDATA[I ran into an exception &#8220;Could not load type &#8216;System.Web.Mvc.ViewPage&#8221; or something along those lines while trying to implement &#8220;Areas&#8221; for Asp.Net MVC 2.  
So if you are coming up against this issue, you might be having that same issue. 
The solution, drop in a copy of the web.config from the views folder into [...]]]></description>
			<content:encoded><![CDATA[<img class='gravatar' style='float: left; margin-right: 10px; border: none;' src='http://www.gravatar.com/avatar.php?gravatar_id=899a978b0f02774a965aec11eeb0b8f4&amp;default=http://amppotls.net' alt='No Gravatar' width=48 height=48/><p>I ran into an exception &#8220;Could not load type &#8216;System.Web.Mvc.ViewPage<T>&#8221; or something along those lines while trying to implement &#8220;Areas&#8221; for Asp.Net MVC 2.  </p>
<p>So if you are coming up against this issue, you might be having that same issue. </p>
<p>The solution, drop in a copy of the web.config from the views folder into the folder for your areas folder (i.e. Areas/AreaName or Areas/AreaName/Views). Refresh. That should solve that exception.  Hopefully. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.amptools.net/blog/asp-net-mvc-2-areas-tip-drop-in-a-web-config/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>quote</title>
		<link>http://www.amptools.net/blog/247</link>
		<comments>http://www.amptools.net/blog/247#comments</comments>
		<pubDate>Fri, 23 Oct 2009 16:18:52 +0000</pubDate>
		<dc:creator>Michael Herndon</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[programmer]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[quotes]]></category>

		<guid isPermaLink="false">http://www.amptools.net/blog/quote</guid>
		<description><![CDATA[If you interrupt a programmer who&#8217;s deep in the zone because you need help with your e-mail, you deserve his wrath. &#8211; Inc Magazine
]]></description>
			<content:encoded><![CDATA[<img class='gravatar' style='float: left; margin-right: 10px; border: none;' src='http://www.gravatar.com/avatar.php?gravatar_id=899a978b0f02774a965aec11eeb0b8f4&amp;default=http://amppotls.net' alt='No Gravatar' width=48 height=48/><blockquote><p><q>If you interrupt a programmer who&#8217;s deep in the zone because you need help with your e-mail, you deserve his wrath.</q><span class="byline"> &#8211; <span class="author">Inc Magazine</span></span></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.amptools.net/blog/247/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Switching between Ioc libraries in Net.</title>
		<link>http://www.amptools.net/blog/switching-between-ioc-libraries-in-net</link>
		<comments>http://www.amptools.net/blog/switching-between-ioc-libraries-in-net#comments</comments>
		<pubDate>Fri, 23 Oct 2009 01:04:55 +0000</pubDate>
		<dc:creator>Michael Herndon</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[common-service-locator]]></category>
		<category><![CDATA[dependency-injection]]></category>
		<category><![CDATA[di]]></category>
		<category><![CDATA[inversion-of-control]]></category>
		<category><![CDATA[ioc]]></category>

		<guid isPermaLink="false">http://www.amptools.net/?p=239</guid>
		<description><![CDATA[Lets face it. Some developers are religiously attached to their beloved languages, frameworks, and libraries.
This becomes a problem when building software with hopes of gaining a developer base.  If it is not built on Unity, Castle Windsor, Structure Map or [insert beloved Ioc library here], they refuse to work/use the software.
Evidently others have had [...]]]></description>
			<content:encoded><![CDATA[<img class='gravatar' style='float: left; margin-right: 10px; border: none;' src='http://www.gravatar.com/avatar.php?gravatar_id=899a978b0f02774a965aec11eeb0b8f4&amp;default=http://amppotls.net' alt='No Gravatar' width=48 height=48/><p>Lets face it. Some developers are religiously attached to their beloved languages, frameworks, and libraries.</p>
<p>This becomes a problem when building software with hopes of gaining a developer base.  If it is not built on Unity, Castle Windsor, Structure Map or [insert beloved Ioc library here], they refuse to work/use the software.</p>
<p>Evidently others have had this issue and have created a solution, the <a href="http://www.codeplex.com/CommonServiceLocator">common service locator</a>. Â I ran across while searching for asp.net Â mvc and DI (dependency injection) for models. More on DI with models inside controllers in a future post.</p>
<h2>How to use</h2>
<p>Download the library from <a href="http://www.codeplex.com/commonservicelocator">codeplex.com/CommonServiceLocator</a></p>
<p>Its pretty straight forward. Â Download the service locator adapter for the Ioc library of your code on the <a href="http://www.codeplex.com/commonservicelocator">codeplex.com/CommonServiceLocator</a></p>
<div class="wp-caption alignnone" style="width: 439px"><img title="common service locator adapters" src="http://farm3.static.flickr.com/2447/4035421289_eb10bffd3b_o.png" alt="choose the adapter for your Ioc library. " width="429" height="265" /><p class="wp-caption-text">choose the adapter for your Ioc library. </p></div>
<p>Configure your Ioc library in the usual manner. Then pass the container into the adapter.</p>
<pre class="brush: csharp;">
        private IServiceLocator CreateLocator()
        {
            var container = new UnityContainer();
            container.RegisterType&lt;IUser, User&gt;();
            container.RegisterType&lt;IMembership, Membership&gt;();
            container.RegisterType&lt;IUser, Loser&gt;(&quot;loser&quot;);

            return new UnityServiceLocatorAdapter(container);
        }
</pre>
<p>Then tell the service locator which adapter you are using.</p>
<pre class="brush: csharp;">
        private void SetupService()
        {
            // CreateLocator returns IServiceLocator in the above method.
            ServiceLocator.SetLocatorProvider(() =&gt; CreateLocator());
        }
</pre>
<p>Then use the locator to return the adapter, which will allow you to use a common interface to resolve your dependencies.</p>
<pre class="brush: csharp;">
        [It, Should(&quot;resolve the type to the default&quot;)]
        public void ResolveType()
        {
            this.SetupService();
           Â              // gets the current adapter for the Ioc Library.
            var resolver = ServiceLocator.Current;             

            // resolves the type.
            var result = resolver.GetInstance(typeof(IUser));

            // verify the result is the right type for the contract.
            result.IsInstanceOf(typeof(User));

            // this user should not have a membership.
            var user = (User)result;
            user.Membership.ShouldBeNull();
        }
</pre>
<h2>Some Caveats.</h2>
<p>Someone named the base service locator class in a java like manner using Impl.</p>
<p>The assemblies for the Unity Ioc are not strong named assemblies.  I had to create a key, sign the assign the assemblies for Unity.<a href="http://github.com/amptools-net/midori-project/zipball/master"> You can download the midori-project</a> which has the signed assemblies for Unity under the vendor folder.</p>
<h2>Further Usage and Reading</h2>
<p>If you would like to check out the spec and see how it might be used, <a href="http://github.com/amptools-net/midori-project/blob/master/specs/midori.core.specs/Services/ServiceLocatorApi_UnityServiceLocatorAdapter.cs">check out the spec in the midori core</a>. This will give you some context.</p>
<p>You can also read more about it on <a href="http://codebetter.com/blogs/glenn.block/archive/2008/10/02/iservicelocator-a-step-toward-ioc-container-service-locator-detente.aspx">codebetter.com</a> as well as the<a href="http://codebetter.com/blogs/jeremy.miller/archive/2008/08/16/it-s-time-for-ioc-container-detente.aspx"> initial post from Jeremy Miller</a> that spawned someone to write this.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.amptools.net/blog/switching-between-ioc-libraries-in-net/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Asp.Net Mvc Add Css Classes To The Body Element</title>
		<link>http://www.amptools.net/blog/asp-net-mvc-add-css-classes-to-the-body-element</link>
		<comments>http://www.amptools.net/blog/asp-net-mvc-add-css-classes-to-the-body-element#comments</comments>
		<pubDate>Thu, 15 Oct 2009 07:00:42 +0000</pubDate>
		<dc:creator>Michael Herndon</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[#AspNetMvc]]></category>
		<category><![CDATA[action]]></category>
		<category><![CDATA[asp.net mvc]]></category>
		<category><![CDATA[body]]></category>
		<category><![CDATA[controller]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[element]]></category>
		<category><![CDATA[name]]></category>
		<category><![CDATA[tag]]></category>

		<guid isPermaLink="false">http://www.amptools.net/?p=234</guid>
		<description><![CDATA[Using the css classes on the body tag/element, you can open a door to having finer control over the layout of your site. Its one of the few decent tricks that bigger Content/Course Management Software like drupal or moodle provides. 
In Asp.Net Mvc this can be done in the master page, outside of the head [...]]]></description>
			<content:encoded><![CDATA[<img class='gravatar' style='float: left; margin-right: 10px; border: none;' src='http://www.gravatar.com/avatar.php?gravatar_id=899a978b0f02774a965aec11eeb0b8f4&amp;default=http://amppotls.net' alt='No Gravatar' width=48 height=48/><p>Using the css classes on the body tag/element, you can open a door to having finer control over the layout of your site. Its one of the few decent tricks that bigger Content/Course Management Software like drupal or moodle provides. </p>
<p>In Asp.Net Mvc this can be done in the master page, outside of the head tags.  What makes this nice is using the controller and action name to isolate the page and section of the site you are int.     </p>
<pre class="brush: csharp;">
&lt;/head&gt;
&lt;%
        var values = Html.ViewContext.RouteData.Values;
        var bodyClasses = values[&quot;controller&quot;] + &quot; &quot; +
                        values[&quot;action&quot;];
%&gt;
</pre>
<pre class="brush: xml;">
// in the master page
&lt;body class=&quot;&lt;%= bodyClasses %&gt;&quot;&gt; 

// what should be rendered for the url: /blog/edit/5
&lt;body class=&quot;blog edit&quot;&gt;
</pre>
<p>As you can see above, it would pay off to stick to using the controller and action keywords in your routing.  You could adjust the above for adding the modules/areas name. </p>
<pre class="brush: css;">
.blog aside.column {
        display: none;
}

.blog.edit  footer {
        margin-top: 20px;
        background: transparent(images/egg.png) no-repeat;
}
</pre>
<p>You can now target certain aspects of the layout and change it depending what section of the site you are in.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.amptools.net/blog/asp-net-mvc-add-css-classes-to-the-body-element/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>quote</title>
		<link>http://www.amptools.net/blog/226</link>
		<comments>http://www.amptools.net/blog/226#comments</comments>
		<pubDate>Wed, 07 Oct 2009 22:01:14 +0000</pubDate>
		<dc:creator>Michael Herndon</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[branding]]></category>
		<category><![CDATA[marketing]]></category>
		<category><![CDATA[quotes]]></category>

		<guid isPermaLink="false">http://www.amptools.net/?p=226</guid>
		<description><![CDATA[content is king, but marketing is queen (and the queen rules the household)- Gary Vaynerchuck
]]></description>
			<content:encoded><![CDATA[<img class='gravatar' style='float: left; margin-right: 10px; border: none;' src='http://www.gravatar.com/avatar.php?gravatar_id=899a978b0f02774a965aec11eeb0b8f4&amp;default=http://amppotls.net' alt='No Gravatar' width=48 height=48/><blockquote><p><q>content is king, but marketing is queen (and the queen rules the household)</q><span class="byline">-<span class="author"> Gary Vaynerchuck</span></span></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.amptools.net/blog/226/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Missing ValidationMessageFor ?</title>
		<link>http://www.amptools.net/blog/missing-validation-message-for</link>
		<comments>http://www.amptools.net/blog/missing-validation-message-for#comments</comments>
		<pubDate>Wed, 07 Oct 2009 04:18:18 +0000</pubDate>
		<dc:creator>Michael Herndon</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[asp.net mvc 2.0]]></category>
		<category><![CDATA[preview 1]]></category>
		<category><![CDATA[preview 2]]></category>
		<category><![CDATA[validation]]></category>
		<category><![CDATA[validation message]]></category>

		<guid isPermaLink="false">http://www.amptools.net/?p=220</guid>
		<description><![CDATA[Looking for the method ValidationMessageFor() ? Or at least wondering what happened to it?  Same here. 
I see the example of it&#8217;s use on Scott Gu&#8217;s Blog for Asp.Net Mvc 2.0 preview 1.   Yet I have not been able to google/bing a blog, tweet, or official mention of why this was dropped. [...]]]></description>
			<content:encoded><![CDATA[<img class='gravatar' style='float: left; margin-right: 10px; border: none;' src='http://www.gravatar.com/avatar.php?gravatar_id=899a978b0f02774a965aec11eeb0b8f4&amp;default=http://amppotls.net' alt='No Gravatar' width=48 height=48/><p>Looking for the method <code>ValidationMessageFor()</code> ? Or at least wondering what happened to it?  Same here. </p>
<p>I see the example of it&#8217;s use on <a href="http://weblogs.asp.net/scottgu/archive/2009/07/31/asp-net-mvc-v2-preview-1-released.aspx">Scott Gu&#8217;s Blog</a> for Asp.Net Mvc 2.0 preview 1.   Yet I have not been able to google/bing a blog, tweet, or official mention of why this was dropped. </p>
<p>I checked the bits using <a href="http://www.red-gate.com/products/reflector/" rel="tag">reflector</a>, source code, and release notes for <a href="http://haacked.com/archive/2009/10/01/asp.net-mvc-preview-2-released.aspx" rel="tag">Asp.Net Mvc 2.0 Preview 2</a>. The bits and source code do confirm one thing. The extension methods for <code>ValidationMessageFor()</code> are not available in Preview 2.  </p>
<p>Unfortunately I do not have a bat phone (or a direct message on twitter) to anyone that works on Asp.Net Mvc. But I&#8217;m sure someone will pick up on this.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.amptools.net/blog/missing-validation-message-for/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->