<?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"
	>

<channel>
	<title>JLCoady.net</title>
	<atom:link href="http://jlcoady.net/index.php/feed" rel="self" type="application/rss+xml" />
	<link>http://jlcoady.net</link>
	<description></description>
	<pubDate>Fri, 18 Jul 2008 12:00:44 +0000</pubDate>
	
	<language>en</language>
			<item>
		<title>Customizing a Symfony layout with property settings via slots</title>
		<link>http://jlcoady.net/symfony/customizing-symfony-layout-property-settings-slots</link>
		<comments>http://jlcoady.net/symfony/customizing-symfony-layout-property-settings-slots#comments</comments>
		<pubDate>Fri, 18 Jul 2008 11:03:27 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
		
		<category><![CDATA[Symfony]]></category>

		<category><![CDATA[css]]></category>

		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://jlcoady.net/?p=31</guid>
		<description><![CDATA[Ever wanted to have a layout in Symfony that allowed a template to pass it information about what to display in a more structured manner than slots allow? Well, here&#8217;s how to do it. You still need to use slots to avoid the caching issues described in http://trac.symfony-project.org/wiki/Symfony11LayoutUpgrade, but it is pretty easy to do [...]]]></description>
			<content:encoded><![CDATA[<p>Ever wanted to have a layout in Symfony that allowed a template to pass it information about what to display in a more structured manner than slots allow? Well, here&#8217;s how to do it. You still need to use slots to avoid the caching issues described in <a rel="nofollow" href="http://trac.symfony-project.org/wiki/Symfony11LayoutUpgrade">http://trac.symfony-project.org/wiki/Symfony11LayoutUpgrade</a>, but it is pretty easy to do once you know how.</p>
<p>For example, you have to basic page designs using the same layout, you just need to set a css class on the body element so your stylesheet knows which design to display. The default design is with no css class set and the alternate design is in effect when the css class is set to &#8220;alternate&#8221;.</p>
<p>You would normally do this with a simple slot in your layout:</p>
<pre lang="php"><body class="<?php if(has_slot('bodyClass')) { include_slot('bodyClass'); } ?>"></pre>
<p>Then, for any view that needs the alternate design, put this in its template:</p>
<pre lang="php"><?php slot('bodyClass') ?>alternate<?php end_slot() ?></pre>
<p>Now, this will work well for a while—until you want to change the class name from alternate to something else and you realize that you now have 50 pages to go edit. Is there a way to avoid this maintenance horror?</p>
<p><span id="more-31"></span></p>
<p>Try the following change and see what you think. First, go back to the template and change it to:</p>
<pre lang="php"><?php slot('useAlternateDesign') ?>true<?php end_slot() ?></pre>
<p>Then, in the layout:</p>
<pre lang="php"><body<?php if(has_slot('useAlternateDesign') &#038;&#038; get_slot('useAlternateDesign') == 'true'): ?> class="alternate"<?php endif; ?>></pre>
<p>Note that we were also able to cleanup the output in the default case. It will no longer output <code>&lt;body class=""&gt;</code>, it will output simply <code>&lt;body&gt;</code> as it should.</p>
<p>Sometimes you may want to use the layout property more than once in the layout, but checking</p>
<pre lang="php">has_slot('useAlternateDesign') &#038;&#038; get_slot('useAlternateDesign') == 'true'</pre>
<p>each time is redundant and a code smell. Instead, assign it to a local variable at the top of the layout:</p>
<pre lang="php"><?php $useAlternateDesign = (has_slot('useAlternateDesign') &#038;&#038; get_slot('useAlternateDesign') == 'true'); ?></pre>
<p>Then, whenever you need to reference the property, it is as simple as</p>
<pre lang="php"><body<?php if($useAlternateDesign): ?> class="alternate"<?php endif; ?>></pre>
<p>or</p>
<pre lang="php"><?php if($useAlternateDesign): ?>
<div id="crumbs">
        <a href="/">Home</a> &raquo;
        <?php if (has_slot('crumbs')): ?>
            <?php include_slot('crumbs') ?>
        <?php endif; ?>
    </div>

<?php endif; ?></pre>
<p>Finally, there may be a circumstance where you want to set the layout property dynamically in the action. This is also possible:</p>
<pre lang="php">$this->getResponse()->setSlot('useAlternateDesign', $myObject->isAltType);</pre>
<p><strong>Note:</strong> I believe the <code>setSlot</code> method is new with Symfony 1.1, but I have not confirmed it.</p>
]]></content:encoded>
			<wfw:commentRss>http://jlcoady.net/symfony/customizing-symfony-layout-property-settings-slots/feed</wfw:commentRss>
		</item>
		<item>
		<title>Tip: How to remove a user from Google AdSense</title>
		<link>http://jlcoady.net/tips/remove-user-google-adsense</link>
		<comments>http://jlcoady.net/tips/remove-user-google-adsense#comments</comments>
		<pubDate>Fri, 18 Jul 2008 08:50:52 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
		
		<category><![CDATA[Tips]]></category>

		<category><![CDATA[AdSense]]></category>

		<category><![CDATA[AdWords]]></category>

		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://jlcoady.net/?p=33</guid>
		<description><![CDATA[If you want to remove a user from the My Account -&#62; Account Access screen of AdSense and there are no Actions available, you likely have a linked AdWords account and will need to do it there. Go to the My Account -&#62; Access screen of AdWords and click on the Terminate access link next [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to remove a user from the My Account -&gt; Account Access screen of AdSense and there are no Actions available, you likely have a linked AdWords account and will need to do it there. Go to the My Account -&gt; Access screen of AdWords and click on the Terminate access link next to the user you want to remove. This will remove them from both AdWords and AdSense.</p>
]]></content:encoded>
			<wfw:commentRss>http://jlcoady.net/tips/remove-user-google-adsense/feed</wfw:commentRss>
		</item>
		<item>
		<title>Ruby on Rails development with Eclipse and RadRails</title>
		<link>http://jlcoady.net/ruby-on-rails/ruby-rails-development-eclipse-radrails</link>
		<comments>http://jlcoady.net/ruby-on-rails/ruby-rails-development-eclipse-radrails#comments</comments>
		<pubDate>Wed, 04 Jun 2008 07:00:27 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
		
		<category><![CDATA[Ruby on Rails]]></category>

		<category><![CDATA[Eclipse]]></category>

		<category><![CDATA[RadRails]]></category>

		<guid isPermaLink="false">http://blog.jlcoady.net/?p=22</guid>
		<description><![CDATA[To successfully install Aptana RadRails into Eclipse without installing the full Aptana Studio:


Install Eclipse if you haven&#8217;t already
In Eclipse go to &#8220;Help-&#62;Software Updates-&#62;Find and Install&#8230;&#8221;
Select &#8220;Search for new features to install&#8221;
Click the &#8220;Next &#62;&#8221; button
Click the &#8220;New Remote Site&#8230;&#8221; button
Enter &#8220;Aptana Studio&#8221; for the Name and &#8220;http://update.aptana.com/update/studio/3.2/&#8221; for the URL
Click the &#8220;OK&#8221; button
Click the &#8220;New [...]]]></description>
			<content:encoded><![CDATA[<p>To successfully install Aptana RadRails into Eclipse without installing the full Aptana Studio:</p>
<p><span id="more-22"></span></p>
<ol>
<li>Install <a rel="nofollow" href="http://download.eclipse.org/eclipse/downloads/">Eclipse</a> if you haven&#8217;t already</li>
<li>In Eclipse go to &#8220;Help-&gt;Software Updates-&gt;Find and Install&#8230;&#8221;</li>
<li>Select &#8220;Search for new features to install&#8221;</li>
<li>Click the &#8220;Next &gt;&#8221; button</li>
<li>Click the &#8220;New Remote Site&#8230;&#8221; button</li>
<li>Enter &#8220;Aptana Studio&#8221; for the Name and &#8220;http://update.aptana.com/update/studio/3.2/&#8221; for the URL</li>
<li>Click the &#8220;OK&#8221; button</li>
<li>Click the &#8220;New Remote Site&#8230;&#8221; button again</li>
<li>Enter &#8220;Aptana RadRails&#8221; for the Name and &#8220;http://update.aptana.com/install/rails/3.2/&#8221; for the URL</li>
<li>Click the &#8220;OK&#8221; button</li>
<li>Click the &#8220;Finish&#8221; button</li>
</ol>
<p>Complete the installation by following the instructions and that&#8217;s it, you now have a Ruby on Rails IDE.</p>
]]></content:encoded>
			<wfw:commentRss>http://jlcoady.net/ruby-on-rails/ruby-rails-development-eclipse-radrails/feed</wfw:commentRss>
		</item>
		<item>
		<title>The Browser Wars and UI Testing</title>
		<link>http://jlcoady.net/testing/browser-wars-ui-testing</link>
		<comments>http://jlcoady.net/testing/browser-wars-ui-testing#comments</comments>
		<pubDate>Sun, 02 Sep 2007 07:00:43 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
		
		<category><![CDATA[Testing]]></category>

		<category><![CDATA[FireFox]]></category>

		<guid isPermaLink="false">http://blog.jlcoady.net/?p=18</guid>
		<description><![CDATA[I just did something that I&#8217;ve been putting off for a long time: I switched to FireFox. I&#8217;d been a longtime Opera fan and I kept hoping that the sites I use would start to support it better, but that didn’t happen and Internet Explorer 7 came out with tabbed browsing, so I couldn’t justify [...]]]></description>
			<content:encoded><![CDATA[<p>I just did something that I&#8217;ve been putting off for a long time: I switched to FireFox. I&#8217;d been a longtime Opera fan and I kept hoping that the sites I use would start to support it better, but that didn’t happen and Internet Explorer 7 came out with tabbed browsing, so I couldn’t justify sticking with it. I knew there was also FireFox, but I didn’t want to put the time into learning a new interface.</p>
<p><span id="more-18"></span></p>
<p>Well, Internet Explorer&#8217;s lacking bookmark support finally pushed me over the edge—come to think of it, it seems like most of Internet Explorer&#8217;s features other then the actual page rendering and tabs are second-class features and are not a first-class part of the browser. This is where embedding Internet Explorer in Windows definitely hurt the product&#8211;it&#8217;s like they wanted to keep all these points of integration with the operating system, but it limits the functionality/capability of those features because they cant exactly be browser specific.</p>
<p>FireFox also has a couple nice <a rel="nofollow" href="http://jlcoady.net/archive/2007/09/02/%E2%80%9Dhttps://addons.mozilla.org/en-US/firefox/browse/type:1/cat:4/sort:popular?show=50%E2%80%9D">features/extensions</a> that make testing websites easier. Not the least of which is an <a rel="nofollow" href="http://jlcoady.net/archive/2007/09/02/%E2%80%9Dhttp://ietab.mozdev.org/%E2%80%9D">extension</a> that allows you to open a tab in FireFox that is actually an Internet Explorer browser window. That isn’t to say that I still don’t have to go through some hoops to test are target browsers—Windows Vista/Internet Explorer 7, Windows Vista/FireFox 2, Windows Vista/Safari, Windows XP/Internet Explorer 6—but since <a rel="nofollow" href="http://jlcoady.net/archive/2007/09/02/%E2%80%9Dhttp://www.pbs.org/cringely/pulpit/2007/pulpit_20070614_002230.html%E2%80%9D">Apple released</a> <a rel="nofollow" href="http://jlcoady.net/archive/2007/09/02/%E2%80%9Dhttp://www.apple.com/safari/download/%E2%80%9D">Safari 3 Beta for Windows</a> I no longer have to run <a rel="nofollow" href="http://jlcoady.net/archive/2007/09/02/%E2%80%9Dhttp://pearpc.sourceforge.net/%E2%80%9D">PearPC</a>/OS X (at 1/40th the host machine&#8217;s speed) to test Safari and my last hoop is running Windows XP from within Microsoft Virtual PC 2007 (<a rel="nofollow" href="http://jlcoady.net/archive/2007/09/02/%E2%80%9Dhttp://www.microsoft.com/windows/products/winfamily/virtualpc/overview.mspx%E2%80%9D">free download</a>) to be able to test IE6.</p>
]]></content:encoded>
			<wfw:commentRss>http://jlcoady.net/testing/browser-wars-ui-testing/feed</wfw:commentRss>
		</item>
		<item>
		<title>How to get URL rewriting to work with ASP.Net 2.0 Themes and form post-backs</title>
		<link>http://jlcoady.net/aspnet/how-to-url-rewrite-asp-net-2-theme-form-postback</link>
		<comments>http://jlcoady.net/aspnet/how-to-url-rewrite-asp-net-2-theme-form-postback#comments</comments>
		<pubDate>Thu, 17 May 2007 07:00:00 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
		
		<category><![CDATA[ASP.net]]></category>

		<guid isPermaLink="false">http://blog.jlcoady.net/?p=10</guid>
		<description><![CDATA[Back in February, Scott Guthrie posted an article on URL rewriting with ASP.Net. Towards the end of the article there is a section on how to handle form post backs by sub classing HtmlForm (for ASP.Net 1.0 and 1.1) or by using a Control Adapter (for ASP.Net 2.0).
That seemed like a lot of work to [...]]]></description>
			<content:encoded><![CDATA[<p>Back in February, Scott Guthrie <a rel="nofollow" href="http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx">posted an article</a> on URL rewriting with ASP.Net. Towards the end of the article there is a section on how to handle form post backs by sub classing HtmlForm (for ASP.Net 1.0 and 1.1) or by using a Control Adapter (for ASP.Net 2.0).</p>
<p>That seemed like a lot of work to get a viable solution so I decided to try and find a simpler solution before I &#8220;bit the bullet&#8221;. Additionally, ASP.Net 2.0 Themes do not always work with URL Rewriting and the article did not provide a solution.</p>
<p>The solution is to use the Application PostMapRequestHandler event to rewrite back to the original URL after the request has been mapped to its handler.</p>
<p><span id="more-10"></span></p>
<p>Following is an example that assume you are using ISAPI_Rewrite. ISAPI_Rewrite puts the originally requested URL in a requested header named HTTP_X_REWRITE_URL.</p>
<pre lang="csharp">void Application_PostMapRequestHandler(object sender, EventArgs e)
{
    string originalUrl = Request.ServerVariables["HTTP_X_REWRITE_URL"];

    if (!string.IsNullOrEmpty(originalUrl))
    {
        Context.RewritePath(originalUrl);
    }
}</pre>
<p>I have tested this method and have it working with extension-less URLs for both form post backs and ASP.Net 2.0 Themes.</p>
]]></content:encoded>
			<wfw:commentRss>http://jlcoady.net/aspnet/how-to-url-rewrite-asp-net-2-theme-form-postback/feed</wfw:commentRss>
		</item>
		<item>
		<title>Easy way to get FCKEditor to work inside an ASP.Net AJAX UpdatePanel</title>
		<link>http://jlcoady.net/aspnet/fckeditor-work-inside-updatepanel</link>
		<comments>http://jlcoady.net/aspnet/fckeditor-work-inside-updatepanel#comments</comments>
		<pubDate>Fri, 30 Mar 2007 07:00:46 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
		
		<category><![CDATA[ASP.net]]></category>

		<category><![CDATA[AJAX]]></category>

		<category><![CDATA[FCKEditor]]></category>

		<guid isPermaLink="false">http://blog.jlcoady.net/?p=3</guid>
		<description><![CDATA[The Problem
I had a MultiLine TextBox inside an UpdatePanel and I wanted that TextBox to have rich editing capabilities so I chose FCKEditor. But, now when I do a partial PostBack, the TextBox doesnt retain it value.
An Initial Solution
So, I searched for a solution to this problem and found this post, but it seemed like [...]]]></description>
			<content:encoded><![CDATA[<h2>The Problem</h2>
<p>I had a MultiLine TextBox inside an UpdatePanel and I wanted that TextBox to have rich editing capabilities so I chose <a rel="nofollow" href="http://www.fckeditor.net/">FCKEditor</a>. But, now when I do a partial PostBack, the TextBox doesnt retain it value.</p>
<h2>An Initial Solution</h2>
<p>So, I searched for a solution to this problem and found <a rel="nofollow" href="http://forums.asp.net/1513800/ShowThread.aspx">this post</a>, but it seemed like more of a hack than I prefer.</p>
<p><span id="more-3"></span></p>
<h2>A More Elegant Solution</h2>
<p>As it turns out, there is a much simpler way hinted at in the <a rel="nofollow" href="http://wiki.fckeditor.net/Troubleshooting#head-c83215c3393542ddc261fb2b7a64b60a41253d76">FCKEditor wiki</a>:</p>
<pre lang="csharp">private void Page_Load(object sender, EventArgs args)
{
    Page.ClientScript.RegisterOnSubmitStatement(
        editor.GetType(),
        "editor",
        "FCKeditorAPI.GetInstance('" + editor.ClientID + "').UpdateLinkedField();");
}</pre>
<p>If you have multiple FCKEditors, you need to apply this solution to each one:</p>
<pre lang="csharp">private void Page_Load(object sender, EventArgs args)
{
    Page.ClientScript.RegisterOnSubmitStatement(
        editor1.GetType(),
        "editor1",
        "FCKeditorAPI.GetInstance('" + editor1.ClientID + "').UpdateLinkedField();");

    Page.ClientScript.RegisterOnSubmitStatement(
        editor2.GetType(),
        "editor2",
        "FCKeditorAPI.GetInstance('" + editor2.ClientID + "').UpdateLinkedField();");
}</pre>
<h2>One Small Problem</h2>
<p>There is one small issue with this solution, however—there will be JavaScript errors if you hide the TextBox during a partial PostBack.</p>
<p>For example, if you have a three step form: edit, review, and then publish. On the edit step the TextBox is shown and you enter and style your rich text, then you click the review button and this causes a partial PostBack which removed the TextBox and shows a preview of the text you enterred. When you click the publish button there will be a JavaScript error because the Textbox is no longer visible.</p>
<h2>The Final Solution</h2>
<p>To solve this problem and come to an elegant, working solution I just needed to add in some basic error checking. Since the JavaScript was getting a little more complex, I decided to move the main work into a .js file:</p>
<pre lang="javascript">function FCKUpdateLinkedField(id)
{
    try
    {
        if(typeof(FCKeditorAPI) == "object")
        {
            FCKeditorAPI.GetInstance(id).UpdateLinkedField();
        }
    }
    catch(err)
    {
    }
}</pre>
<p>And the page code now looks like:</p>
<pre lang="csharp">private void Page_Load(object sender, EventArgs args)
{
    Page.ClientScript.RegisterOnSubmitStatement(
        editor.GetType(),
        "editor",
        "FCKUpdateLinkedField('" + editor.ClientID + "');");
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://jlcoady.net/aspnet/fckeditor-work-inside-updatepanel/feed</wfw:commentRss>
		</item>
		<item>
		<title>How to enable Umbraco directory URLs without needing a wildcard mapping in IIS</title>
		<link>http://jlcoady.net/umbraco/umbraco-directory-urls-without-iis-wildcard-mapping</link>
		<comments>http://jlcoady.net/umbraco/umbraco-directory-urls-without-iis-wildcard-mapping#comments</comments>
		<pubDate>Fri, 24 Nov 2006 07:00:54 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
		
		<category><![CDATA[Umbraco]]></category>

		<category><![CDATA[ISAPI_Rewrite]]></category>

		<guid isPermaLink="false">http://blog.jlcoady.net/?p=12</guid>
		<description><![CDATA[If for some reason you cannot create an wildcard mapping to ASP.net in IIS, but would still like to have directory URLs in Umbraco there is another way. You can use ISAPI_rewrite (or a similiar tool) to rewrite requests to an extension that is handled by ASP.net. Here are the ISAPI_rewrite rules I use to [...]]]></description>
			<content:encoded><![CDATA[<p>If for some reason you cannot create an wildcard mapping to ASP.net in IIS, but would still like to have directory URLs in Umbraco there is another way. You can use ISAPI_rewrite (or a similiar tool) to rewrite requests to an extension that is handled by ASP.net. Here are the ISAPI_rewrite rules I use to accomplish this for JLCoady.net:</p>
<p><span id="more-12"></span></p>
<pre lang="apache">RewriteRule /data/.* / [F,I,O]
RewriteRule /(umbraco|reports).* $&amp; [L]
RewriteRule / $&amp; [L]
RewriteRule ([^.?]*)(\?.+)? $1.aspx$2</pre>
<p>The first rule blocks access to the contents of the data directory.</p>
<p>The second rule bypasses umbraco handling for certain paths; this should be the same as umbracoReservedUrls and umbracoReservedPaths in your web.config.</p>
<p>The third rule makes root access work, otherwise requests made to &#8216;/&#8217; would be rewritten to &#8216;/.aspx&#8217;.</p>
<p>Now that all of the non-standard cases have been handled, the fourth rule takes all requests to directories (no file extension) and rewrites them with an aspx file extension so they will be handled by ASP.net.</p>
]]></content:encoded>
			<wfw:commentRss>http://jlcoady.net/umbraco/umbraco-directory-urls-without-iis-wildcard-mapping/feed</wfw:commentRss>
		</item>
		<item>
		<title>Loose expectations with NMock2</title>
		<link>http://jlcoady.net/testing/loose-expectations-nmock2</link>
		<comments>http://jlcoady.net/testing/loose-expectations-nmock2#comments</comments>
		<pubDate>Thu, 23 Nov 2006 07:00:42 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
		
		<category><![CDATA[Testing]]></category>

		<category><![CDATA[NMock]]></category>

		<guid isPermaLink="false">http://blog.jlcoady.net/?p=20</guid>
		<description><![CDATA[NMock2 will have a verification failure if all expected calls are not made and if any unexpected calls are made. That last bit can make writing test code rather tedious.
I have a presenter and I&#8217;m testing its normal path using a bunch of calls like the following:
...
Expect.Once.On(view).GetProperty("Name").Will(Return.Value("Widget"));
Expect.Once.On(view).GetProperty("Quantity").Will(Return.Value(3));
Expect.Once.On(view).GetProperty("Price").Will(Return.Value(9.95m));
Expect.Once.On(view).Method("ShowTotal").With(29.85m);
...
That&#8217;s all good, but now I want to test [...]]]></description>
			<content:encoded><![CDATA[<p>NMock2 will have a verification failure if all expected calls are not made <em>and</em> if any unexpected calls are made. That last bit can make writing test code rather tedious.</p>
<p>I have a presenter and I&#8217;m testing its normal path using a bunch of calls like the following:</p>
<pre lang="csharp">...
Expect.Once.On(view).GetProperty("Name").Will(Return.Value("Widget"));
Expect.Once.On(view).GetProperty("Quantity").Will(Return.Value(3));
Expect.Once.On(view).GetProperty("Price").Will(Return.Value(9.95m));
Expect.Once.On(view).Method("ShowTotal").With(29.85m);
...</pre>
<p>That&#8217;s all good, but now I want to test some error conditions, exceptions, bad input, etc., but I dont want to repeat all the property test, especially considering the maintenance issues—if I add a new call to another property in my presenter, all my tests will fail because there was an unexpected call. It would be much nicer to only have to change one test instead of many. Not to mention that testing the same thing ten times is rather stinky.</p>
<p><span id="more-20"></span></p>
<p>As far as I could tell, NMock2 doesnt allow for this type of loosely coupled mock, so I found a way to coerce NMock2 into doing it.</p>
<p>NMock2 supports a Stub method that sets an anything expectation (i.e., zero or more), but if you do something like <code>Stub.On(view);</code> any specific expectations you set afterward are meaningless and will never fail.</p>
<p>What you need to do is create an negative method matcher for the stub so it sets an anything expectation for all methods but the one you wish to set a specific expectation on:</p>
<pre lang="csharp">...
private Matcher Not(string methodName)
{
    return new NotMatcher(new MethodNameMatcher(methodName));
}
...
Stub.On(view).Method(Not("ShowError"));
Expect.Once.On(view).Method("ShowError").With(Strings.Invalid_Quantity);
...</pre>
<p>I&#8217;ll leave the implementation for doing the same thing, but for multiple methods to the reader. Clue: you&#8217;ll need to us an or matcher.</p>
]]></content:encoded>
			<wfw:commentRss>http://jlcoady.net/testing/loose-expectations-nmock2/feed</wfw:commentRss>
		</item>
		<item>
		<title>Using asp.net syntax in an umbraco document template and in XSLT templates</title>
		<link>http://jlcoady.net/aspnet/asp-net-syntax-in-umbraco-template-and-xslt</link>
		<comments>http://jlcoady.net/aspnet/asp-net-syntax-in-umbraco-template-and-xslt#comments</comments>
		<pubDate>Sat, 18 Nov 2006 07:00:20 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
		
		<category><![CDATA[ASP.net]]></category>

		<category><![CDATA[Umbraco]]></category>

		<category><![CDATA[AJAX]]></category>

		<category><![CDATA[XSL]]></category>

		<guid isPermaLink="false">http://jlcoady.net/?p=27</guid>
		<description><![CDATA[I am about to embark on a project that will be using ASP.NET AJAX extensively, along with the ASP.NET AJAX Control Toolkit. I would love to be able to do the whole thing inside of Umbraco, but, as far as I know, the only way to use these controls is from within a macro.
For example [...]]]></description>
			<content:encoded><![CDATA[<p>I am about to embark on a project that will be using <a href="http://ajax.asp.net/">ASP.NET AJAX</a> extensively, along with the <a href="http://ajax.asp.net/ajaxtoolkit/">ASP.NET AJAX Control Toolkit</a>. I would love to be able to do the whole thing inside of Umbraco, but, as far as I know, the only way to use these controls is from within a macro.</p>
<p>For example (very simplified), I have a list of items that I want to display. Each item gets a delete button. I would like to put each item into an updatepanel and so when the delete button is clicked, the item simply disappears. There is no need to reload the entire page when we are just changing one small portion of it.</p>
<p>Right now, my options would be to put the entire list inside a macro or write all the ajax myself (which seems like a step backward).</p>
<p><span id="more-27"></span></p>
<p>I forgot to mention that the list is based on nodes and so here is my preferred way of doing things: Generate the list using xslt, like I would if I didn&#8217;t need the asp.net controls, and have the xslt output the asp.net controls as you would expect to see them in an aspx page. They are, after all, well-formed xml, and so I see no reason why this wouldn&#8217;t work if the umbraco parser could then translate these controls into objects, like it does for &lt;?aspnet_form&gt;. Except that it doesn&#8217;t have to (why reinvent the wheel?), but more about that later.</p>
<p>I&#8217;ve been perusing the umbraco source code, and this is how I understand parsing works (high-level view and leaving out a lot of details like caching). It gets the page template and replaces all the values from the specific page node. Then it renders the macros. Then it finds a few specific items like the aspnet form. All the while it is keeping all the data inside a Page by just adding sub controls to that Page&#8217;s control collection, the majority of which are LiteralControls.</p>
<p>What if instead of doing that all the parser did was build a string. It would still replace all the getitems with the values from the specific node. It would still replace all the XSLT macros with their transformed renderings. In short, it would still need to process anything that started with &lt;umbraco, but instead of building a page control hierarchy out of that it would simply build a string. But it wouldn&#8217;t be an ordinary string, the string would contain exactly what you would expect to find in an aspx page. Then the umbraco parser would just pass this string on to the asp.net parser to render the output.</p>
<p>Did the flexibility and usefulness of Umbraco just expand infinitely? Maybe not, but I&#8217;d say at least exponentially. Obviously there would be kinks to work out, but wouldn&#8217;t it be worth it? Imagine the possibilities of your page templates being aspx pages and your xslt transformations including asp.net controls.</p>
<p>Doesn&#8217;t this sound feasible and well worth the effort? Prove me wrong; tell me I&#8217;m crazy and I&#8217;ll shut up <img src='http://jlcoady.net/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /></p>
]]></content:encoded>
			<wfw:commentRss>http://jlcoady.net/aspnet/asp-net-syntax-in-umbraco-template-and-xslt/feed</wfw:commentRss>
		</item>
		<item>
		<title>Umbraco&#8217;s rich text editor is using my site&#8217;s styles</title>
		<link>http://jlcoady.net/umbraco/umbraco-rich-editor-using-my-site-styles</link>
		<comments>http://jlcoady.net/umbraco/umbraco-rich-editor-using-my-site-styles#comments</comments>
		<pubDate>Thu, 27 Apr 2006 07:00:31 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
		
		<category><![CDATA[Umbraco]]></category>

		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://jlcoady.net/?p=29</guid>
		<description><![CDATA[I am creating an Umbraco site with a document type that has rich text (my innovation here is astounding!) and everything was working great on my local. Then I upload it to the production server and the rich text editor now has a navy blue background with black text and is centered—editing is now very [...]]]></description>
			<content:encoded><![CDATA[<p>I am creating an Umbraco site with a document type that has rich text (my innovation here is astounding!) and everything was working great on my local. Then I upload it to the production server and the rich text editor now has a navy blue background with black text and is centered—editing is now very difficult. Since the site I am creating has a navy blue background I had an obvious culprit and a quick test by deleting the site&#8217;s style sheet confirmed my suspicions.</p>
<p>After tinkering for a while and do some searching, I have found out why this was happening only on the production site and how to fix it.</p>
<p><span id="more-29"></span></p>
<p>It turns out that Umbraco uses the styles defined in the &#8216;Stylesheets&#8217; section of &#8216;Settings&#8217; to style the rich text editor. These styles can, however, be overridden by defining styles for #holderBody and #holder. I figured this out because on my local Umbraco site I had imported the website wizard sample package which, among other things, includes a couple style sheets. In one of these style sheets there are definitions for those two elements (see the tutorial below for their contents). My production site was a clean install and did not have the sample templates, and so it didn&#8217;t have the rich text styles overridden to normal.</p>
<p>Here is how to fix this problem if you don&#8217;t want to install the sample package:</p>
<ol>
<li>Login to the Umbraco admin</li>
<li>Go to the &#8216;Settings&#8217; section</li>
<li>Right-click on &#8216;Stylesheets&#8217; and select &#8216;Create&#8217;</li>
<li>Enter &#8216;RichTextEditor&#8217; as the name</li>
<li>Click on &#8216;RichTextEditor&#8217; in the list of stylesheets</li>
<li>Copy and paste the styles listed below into the editor</li>
<li>Click the save button</li>
</ol>
<pre lang="css">    #holderBody
    {
        background: #fff;
    }

    #holder
    {
        border: 1px solid #ccc;
        padding: 10px;
        margin: 5px;
        text-align: left;
    }</pre>
<p>That&#8217;s it, you should now have a useable rich text editor.</p>
]]></content:encoded>
			<wfw:commentRss>http://jlcoady.net/umbraco/umbraco-rich-editor-using-my-site-styles/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
