<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>Shane Bauer - ShaneBauer.com - Home</title>
  <id>tag:weblog.shanebauer.com,2010:mephisto/</id>
  <generator uri="http://mephistoblog.com" version="0.8.0">Mephisto Drax</generator>
  <link href="http://weblog.shanebauer.com/feed/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://weblog.shanebauer.com/" rel="alternate" type="text/html"/>
  <updated>2009-03-14T02:48:37Z</updated>
  <entry xml:base="http://weblog.shanebauer.com/">
    <author>
      <name>sbauer</name>
    </author>
    <id>tag:weblog.shanebauer.com,2009-02-09:3</id>
    <published>2009-02-09T18:04:00Z</published>
    <updated>2009-03-14T02:48:37Z</updated>
    <link href="http://weblog.shanebauer.com/2009/2/9/upgrading-to-ruby-1-9-1-for-windows" rel="alternate" type="text/html"/>
    <title>Upgrading to Ruby 1.9.1 for Windows</title>
<content type="html">
            &lt;p&gt;
I spent some time upgrading to Ruby 1.9.1 not too long ago. For Ruby/Rails devs using Windows (I know there a few of you closet developers out there), if you&#39;re using the 1.9.1 preview binary, you need to add the &lt;span class=&quot;caps&quot;&gt;DLL&lt;/span&gt; dependencies yourself. For some unknown reason, they did not package the required DLLs with the package. If you have 1.8.7 installed, you can copy the DLLs from that install&#39;s bin directory and place them into your Ruby 1.9.1 bin directory. Here&#39;s the list below. Note the change in file names for the zlib directory.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
 -&amp;gt; [Ruby 1.9.1]\bin\libeay32.dll&lt;br /&gt;
 -&amp;gt; [Ruby 1.9.1]\bin\readline.dll&lt;br /&gt;
 -&amp;gt; [Ruby 1.9.1]\bin\ssleay32.dll&lt;br /&gt;
 -&amp;gt; [Ruby 1.9.1]\bin\&lt;strong&gt;zlib&lt;/strong&gt;.dll
&lt;/p&gt;
&lt;p&gt;
I know Ruby/Rails wasn&#39;t designed with Windows in-mind, but if you&#39;re going to make it available, at least package the dependencies for it. 
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://weblog.shanebauer.com/">
    <author>
      <name>sbauer</name>
    </author>
    <id>tag:weblog.shanebauer.com,2008-10-29:4</id>
    <published>2008-10-29T02:51:00Z</published>
    <updated>2009-03-14T02:52:15Z</updated>
    <link href="http://weblog.shanebauer.com/2008/10/29/subversion-teamcity-and-rake-wow" rel="alternate" type="text/html"/>
    <title>Subversion, TeamCity, and Rake = Wow</title>
<content type="html">
            &lt;p&gt;
Whenever I start a new project there are certain things that I always need to do. I need to setup the source code repository, create a basic project structure, create a build script to build the project, and setup the project on a build server. 
&lt;/p&gt;
&lt;p&gt;
A few months ago I realized just how much I hated doing all of this. Setting up the repository was the easiest part. I&#39;ve been using Subversion for years. Instead of hosting my own subversion server, I use a &lt;a href=&quot;http://www.svnrepository.com/&quot;&gt;third party&lt;/a&gt;. I&#39;ll let them manage the server, subversion upgrades and the backups. Because of this, setting up the repository was basically logging into a control panel, filling out a form, and that&#39;s basically it. However, after this was completed, the tasks became much more redundent.&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
For the longest time I used NAnt for my build engine. It is a good tool, no doubt. The problem is I hate XML. I hate it. It&#39;s not the language itself really. It&#39;s how people use XML. NAnt uses XML as the way to write the build script. I hated creating the scripts and I hated modifying them.
&lt;/p&gt;
&lt;p&gt;
Of course, my XML troubles didn&#39;t end there. I used CruiseControl.net as my CI (build) server. The application itself is OK. It&#39;s not great and has aged quite a bit. By far my biggest problem with CC.NET is the process of adding a new project. In order to add a new project to CC.NET, you must modify an XML file. If you have many projects configured, that file may be quite large. 
&lt;/p&gt;
&lt;p&gt;
I don&#39;t know about you, but after setting up my build script and setting up the project in CC.NET, I&#39;m pretty tired of looking at XML. 
&lt;/p&gt;
&lt;h3&gt;Taking a look at TeamCity &lt;/h3&gt;
&lt;p&gt;
After reading a ton of blogs and twitter messages from people talking about &lt;a href=&quot;http://www.jetbrains.com/teamcity/index.html&quot;&gt;TeamCity&lt;/a&gt;, I decided to give it a shot. I wasn&#39;t really sure what to expect. I thought it would be good as I&#39;m a huge ReSharper fan (the same company that makes ReSharper also makes TeamCity), but didn&#39;t really know if it would fit my needs.
&lt;/p&gt;
&lt;p&gt;
Fortunately, &lt;a href=&quot;http://www.jetbrains.com&quot;&gt;JetBrains&lt;/a&gt; (makers of TeamCity) markets a version of TeamCity targeted for smaller teams that doesn&#39;t cost a thing. I grabbed it, installed it on a VM, and played around. To make a long story short, I&#39;m still using it. TeamCity is a really nice CI server. It&#39;s very extensible and configuration is a breeze. You can add projects and build configurations straight from the browse. No need to modify XML files. TeamCity supports a number of different version control systems and build environments out-of-the-box. NAnt, MSBuild, Ant, and command-line are just a few. Because of this I was able to migrate my project from CC.NET to TeamCity in no time.&amp;nbsp;
&lt;/p&gt;
&lt;h3&gt;Replacing NAnt with Rake &lt;/h3&gt;
&lt;p&gt;
After deciding to go with TeamCity, I felt pretty good. I had solved one problem. I cannot tell you how much time I&#39;ve saved because of it. After a while, though, I started to look for replacement options for NAnt. Like I said before, I like NAnt, but I wanted something better than XML. After doing some research, I decided to look into Rake, a build tool programmed in Ruby. I noticed a few .NET developers using Rake successfully. One evening I loaded my NAnt build script and replicated the entire script using Rake. I&#39;ve done some work in Ruby so it didn&#39;t take that long to convert everything over. Obviously, you don&#39;t have the pre-made nant tasks, but creating a reusable framework that calls the executables for various tools (msbuild, nant) wasn&#39;t too bad. After I got it working locally, I modified my existing build configuration in TeamCity to call the new rake script. Initially, I used the rake runner in TeamCity. After a while, I wasn&#39;t getting the results that I wanted so I switched to the simple command-line runner. After tweaking a few minor things, I was done.&amp;nbsp;
&lt;/p&gt;
&lt;h3&gt;Looking Back &lt;/h3&gt;
&lt;p&gt;
I&#39;m really satisifed how things turned out. TeamCity is a joy to work with. Managing Rake build scripts instead of XML files just feels right. If you&#39;re looking for a replacement or you&#39;re just getting into this territory, you should really take a look at TeamCity and Rake. 
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://weblog.shanebauer.com/">
    <author>
      <name>sbauer</name>
    </author>
    <id>tag:weblog.shanebauer.com,2008-04-22:2</id>
    <published>2008-04-22T14:49:00Z</published>
    <updated>2009-03-14T02:46:01Z</updated>
    <link href="http://weblog.shanebauer.com/2008/4/22/asp-net-mvc-testing-controllers-using-the-pre-preview-3-drop" rel="alternate" type="text/html"/>
    <title>ASP.NET MVC: Testing Controllers Using the Pre-Preview 3 Drop</title>
<content type="html">
            A week or so ago, I wrote &lt;a href=&quot;/blog/post/2008/04/Using-MvcContribs-TestControllerBuilder-to-Test-Your-ASPNET-MVC-Controllers.aspx&quot;&gt;an entry about controller testing with the ControllerBuilder&lt;/a&gt;. In it I mentioned the &amp;quot;solution&amp;quot; obviously wasn&#39;t the best, and hoped that the work-around we were using wouldn&#39;t be needed for much longer. Well, last Wednesday the &lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2008/04/16/asp-net-mvc-source-refresh-preview.aspx&quot;&gt;MVC team published a preview of preview 3&lt;/a&gt;. There were a number of changes included in this build, but I&#39;m going to talk about controller testing improvements. 
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;What We Did Way Back Last Week&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Last week, we used a test helper from the MvcContrib project. Basically, the controller builder constructed an instance of our controller using Dynamic Proxy and then implemented an interceptor so it could grab data that we could use in our tests. It is quite a bit of work for something so straightforward. All we wanted to do was execute our action and see if it rendered the correct view.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;What&#39;s My ActionResult?&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
If you remember, our controller actions are nothing more than public methods on a controller class. When you call the action from your browser, the ASP.NET MVC simply wires up a request that eventually executes the specified method. Nothing too crazy. The methods didn&#39;t even return anything; they were simply declared void.
&lt;/p&gt;
&lt;p&gt;
Since we&#39;re working with preview releases here, you can&#39;t really expect things not to change. With the latest build, controller methods/actions now return an instance of ActionResult. What is ActionResult? ActionResult is an abstract class that is used to return the result of the action. A result can be a rendered view, a redirect to an action, or even a regular HTTP redirect to another location entirely.&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Getting the Result&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Now, here&#39;s where you may notice the difference. In our previous controller code, if we wanted to redirect to an action, we could just call RedirectToAction in the middle of the action code and be done with it. RedirectToAction, and the other helper methods, all return instances of some form of ActionResult. RedirectToAction now returns ActionRedirectResult. RenderView returns RenderViewResult. What does this mean? When you call the helper methods, you need return their result now. Here&#39;s an example:
&lt;/p&gt;
&lt;pre name=&quot;code&quot; class=&quot;csharp&quot;&gt;
public ActionResult Index()
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return RenderView(&amp;quot;index&amp;quot;);
}
&lt;/pre&gt;
&lt;p&gt;
As you can see, you just need to ensure you return the result. This result is then used by the framework and you can also use it for testing. The code below illustrates a very simple test using the new build.
&lt;/p&gt;
&lt;pre name=&quot;code&quot; class=&quot;csharp&quot;&gt;
[Test]
public void BookController_Ensure_Index_Action_Renders_Index_View()
{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;BookController controller = new BookController();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;var result = controller.Index() as RenderViewResult;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Assert.IsNotNull(result);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Assert.AreEqual(&amp;quot;index&amp;quot;, result.ViewName);
}
&lt;/pre&gt;
&lt;p&gt;
I&#39;ll have more on this subject, and a real world example that puts them all together in a little while. 
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://weblog.shanebauer.com/">
    <author>
      <name>sbauer</name>
    </author>
    <id>tag:weblog.shanebauer.com,2008-01-07:5</id>
    <published>2008-01-07T03:56:00Z</published>
    <updated>2009-03-14T02:57:40Z</updated>
    <link href="http://weblog.shanebauer.com/2008/1/7/asp-net-web-controls-have-an-id-a-clientid-and-a-uniqueid-what-s-the-deal" rel="alternate" type="text/html"/>
    <title>ASP.NET: Web Controls have an ID, a ClientID and a UniqueID. What's the deal?</title>
<content type="html">
            &lt;p&gt;
While working on your ASP.NET page,
you may have&amp;nbsp;noticed that all of your web controls contain three
different ID properties. That&#39;s great. But why? Uniqueness.
&lt;/p&gt;
&lt;p&gt;
Lets say, for example, you have a Repeater control. In this Repeater
control, you have an itemtemplate that contains a textbox and a label.
Your label is called &amp;quot;ProductName&amp;quot; and your textbox is called
&amp;quot;ProductQuantity&amp;quot;. If your repeater contained more than one item, you
would run into issues with html elements being named the same. That&#39;s a
huge problem. 
&lt;/p&gt;
&lt;p&gt;
UniqueID fixes this issue. When the control gets created, a uniqueId
is generated based on the control&#39;s heirarchy. For example, a textbox
within a CreateUserWizard would have a UniqueID similar to
&amp;quot;CreateUserWizard1$CreateUserStepContainer$Email&amp;quot;. The UniqueID, as you
can see, is a large string seperating the control&#39;s parents by a dollar
sign. Pretty simple.
&lt;/p&gt;
&lt;p&gt;
However, that&#39;s not technically valid in the HTML world. ClientID
fixes this problem. ClientID replaces the invalid separator with a
valid separator, like an underscore. Therefore, the textbox within the
CreateUserWizard would have a ClientID similar to
&amp;quot;CreateUserWizard1_CreateUserStepContainer_Email&amp;quot;. As a result, when
your textbox is rendered as a standard input element, the ID field
would contain the value in the ClientID property.
&lt;/p&gt;
&lt;p&gt;
If you want to access your control via javascript, don&#39;t use the ID
property, and don&#39;t use the UniqueID property. Use the ClientID
Property. 
&lt;/p&gt;
          </content>  </entry>
</feed>
