<?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>Dan Appleyard &#187; Programming</title>
	<atom:link href="http://www.danappleyard.com/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.danappleyard.com</link>
	<description>Developer&#039;s Thoughts on Tech, Life, &#38; Stuff</description>
	<lastBuildDate>Thu, 21 Jul 2011 21:43:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Enabling or disabling a validator control in javascript</title>
		<link>http://www.danappleyard.com/2011/07/21/enabling-or-disabling-a-validator-control-in-javascript/</link>
		<comments>http://www.danappleyard.com/2011/07/21/enabling-or-disabling-a-validator-control-in-javascript/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 21:39:36 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[web forms]]></category>

		<guid isPermaLink="false">http://www.danappleyard.com/?p=709</guid>
		<description><![CDATA[Recently I had to have a form that had a requiredfieldvalidator that was supposed to validate only on certain conditions. I did not want the validator to validate its control (textbox B) unless textbox A had a value in it. I decided the best way to do this was to capture the keyup event of [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had to have a form that had a requiredfieldvalidator that was supposed to validate only on certain conditions.  I did not want the validator to validate its control (textbox B) unless textbox A had a value in it.  I decided the best way to do this was to capture the keyup event of textbox A and if there was a value in the textbox, to turn the validator for textbox B on.  To do that via javascript, you have to utilize the asp.net built in javascript function ValidatorEnable.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #003366; font-weight: bold;">var</span> makeEnabled <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
    <span style="color: #003366; font-weight: bold;">var</span> validatorControl <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;%= RequiredFieldValidator1.ClientID %&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    ValidatorEnable<span style="color: #009900;">&#40;</span>validatorControl<span style="color: #339933;">,</span> makeEnabled<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.danappleyard.com/2011/07/21/enabling-or-disabling-a-validator-control-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Budapest Table Sorting Plugin</title>
		<link>http://www.danappleyard.com/2011/06/18/budapest-table-sorting-plugin/</link>
		<comments>http://www.danappleyard.com/2011/06/18/budapest-table-sorting-plugin/#comments</comments>
		<pubDate>Sat, 18 Jun 2011 13:35:36 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[utility]]></category>

		<guid isPermaLink="false">http://www.danappleyard.com/?p=645</guid>
		<description><![CDATA[Budapest is a jQuery plugin that allows for simple table sorting. It allows the developer to have full control over the sorting. Basic usage: $&#40;&#34;table&#34;&#41;.budapest&#40;&#41;; Advanced usage: $&#40;&#34;table&#34;&#41;.budapest&#40;&#123; headers: &#123; 0: &#123; sortable: true&#125;, 1: &#123; sortable: true&#125;, 2: &#123; sortable: true&#125; &#125;, sortIndex: 2, sortDirection: &#34;asc&#34;, onSort: function&#40;index, val1, val2, direction&#41;&#123; //provide your own [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.danappleyard.com/budapest/">Budapest</a> is a jQuery plugin that allows for simple table sorting. It allows the developer to have full control over the sorting.</p>
<h3>Basic usage:</h3>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;table&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">budapest</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>Advanced usage:</h3>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;table&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">budapest</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
  headers<span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #CC0000;">0</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> sortable<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    <span style="color: #CC0000;">1</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> sortable<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    <span style="color: #CC0000;">2</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span> sortable<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
  sortIndex<span style="color: #339933;">:</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">,</span>
  sortDirection<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;asc&quot;</span><span style="color: #339933;">,</span>
  onSort<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>index<span style="color: #339933;">,</span> val1<span style="color: #339933;">,</span> val2<span style="color: #339933;">,</span> direction<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">//provide your own sorting algorithm for each column!</span>
    <span style="color: #006600; font-style: italic;">//must return either -1, 0, or 1</span>
  <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
  onSorted<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>index<span style="color: #339933;">,</span> direction<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #006600; font-style: italic;">//this event is fired after each sort!</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><a href="http://www.danappleyard.com/budapest/">Check out the full documentation.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.danappleyard.com/2011/06/18/budapest-table-sorting-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create an ical file in ASP.NET MVC</title>
		<link>http://www.danappleyard.com/2011/03/15/create-an-ical-file-in-asp-net-mvc/</link>
		<comments>http://www.danappleyard.com/2011/03/15/create-an-ical-file-in-asp-net-mvc/#comments</comments>
		<pubDate>Tue, 15 Mar 2011 12:55:48 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.danappleyard.com/?p=629</guid>
		<description><![CDATA[I recently had to write some code that generates an ical file and sends it to the browser. I decided to utilize the awesomeness that is asp.net mvc and try it like that. Following the information I got from reading Stephen Walther&#8217;s blog entry on using MVC to generate files to download, I started by [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had to write some code that generates an ical file and sends it to the browser.  I decided to utilize the awesomeness that is asp.net mvc and try it like that. Following the information I got from reading <a href="http://stephenwalther.com/blog/archive/2008/06/16/asp-net-mvc-tip-2-create-a-custom-action-result-that-returns-microsoft-excel-documents.aspx">Stephen Walther&#8217;s blog entry on using MVC to generate files to download</a>, I started by creating a MVC controller that processes the request.</p>

<div class="wp_syntax"><div class="code"><pre class="vbnet" style="font-family:monospace;"><span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Class</span> ICalController
        <span style="color: #0600FF;">Inherits</span> Controller
&nbsp;
        <span style="color: #FF8000;">Private</span> _sessionRepo <span style="color: #FF8000;">As</span> ISessionRepository
        <span style="color: #FF8000;">Private</span> _locationRepo <span style="color: #FF8000;">As</span> ILocationRepository
&nbsp;
        <span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Sub</span> <span style="color: #FF8000;">New</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> sessionRepo <span style="color: #FF8000;">As</span> ISessionRepository, _
                             <span style="color: #FF8000;">ByVal</span> locationRepo <span style="color: #FF8000;">As</span> ILocationRepository<span style="color: #000000;">&#41;</span>
            _sessionRepo <span style="color: #008000;">=</span> sessionRepo
            _locationRepo <span style="color: #008000;">=</span> locationRepo
        <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span>
&nbsp;
        <span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Function</span> SessionEvent<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> sessionID <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Long</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">As</span> ActionResult
            <span style="color: #0600FF;">Dim</span> s <span style="color: #FF8000;">As</span> SessionsEntity <span style="color: #008000;">=</span> _sessionRepo.<span style="color: #0000FF;">GetSession</span><span style="color: #000000;">&#40;</span>sessionID<span style="color: #000000;">&#41;</span>
            <span style="color: #0600FF;">Dim</span> <span style="color: #0600FF;">loc</span> <span style="color: #FF8000;">As</span> LocationsEntity <span style="color: #008000;">=</span> _locationRepo.<span style="color: #FF8000;">Get</span><span style="color: #000000;">&#40;</span>s.<span style="color: #0000FF;">LocationID</span><span style="color: #000000;">&#41;</span>
            <span style="color: #FF8000;">Return</span> ICalEvent<span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;session.ics&quot;</span>, <span style="color: #0600FF;">loc</span>.<span style="color: #0000FF;">CodeAndName</span>, _
                                   s.<span style="color: #0000FF;">SessionName</span>, s.<span style="color: #0000FF;">SessionName</span>, _
                                   s.<span style="color: #0000FF;">StartDateUTC</span>, s.<span style="color: #0000FF;">EndDateUTC</span><span style="color: #000000;">&#41;</span>
        <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span>
    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span></pre></div></div>

<p>I then created a custom ActionResult that creates the actual ical file.  Not surprisingly I called it ICalEventResult.  I created an DateTime extension method to format the utc dates into the correct format for the ical file (I won&#8217;t include it here).</p>

<div class="wp_syntax"><div class="code"><pre class="vbnet" style="font-family:monospace;"><span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Class</span> ICalEventResult
        <span style="color: #0600FF;">Inherits</span> ActionResult
&nbsp;
        <span style="color: #FF8000;">Private</span> _startUtc <span style="color: #FF8000;">As</span> DateTime
        <span style="color: #FF8000;">Private</span> _endUtc <span style="color: #FF8000;">As</span> DateTime
        <span style="color: #FF8000;">Private</span> _summary <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span>
        <span style="color: #FF8000;">Private</span> _description <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span>
        <span style="color: #FF8000;">Private</span> _location <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span>
        <span style="color: #FF8000;">Private</span> _fileName <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span>
&nbsp;
        <span style="color: #FF8000;">Public</span> <span style="color: #0600FF;">Sub</span> <span style="color: #FF8000;">New</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> startUtc <span style="color: #FF8000;">As</span> DateTime, <span style="color: #FF8000;">ByVal</span> endUtc <span style="color: #FF8000;">As</span> DateTime, _
                       <span style="color: #FF8000;">ByVal</span> summary <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span>, <span style="color: #FF8000;">ByVal</span> description <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span>, _
                       <span style="color: #FF8000;">ByVal</span> location <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span>, <span style="color: #FF8000;">ByVal</span> fileName <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">String</span><span style="color: #000000;">&#41;</span>
&nbsp;
            _startUtc <span style="color: #008000;">=</span> startUtc
            _endUtc <span style="color: #008000;">=</span> endUtc
            _summary <span style="color: #008000;">=</span> summary
            _description <span style="color: #008000;">=</span> description
            _location <span style="color: #008000;">=</span> location
            _fileName <span style="color: #008000;">=</span> fileName
&nbsp;
        <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span>
&nbsp;
        <span style="color: #FF8000;">Public</span> <span style="color: #FF8000;">Overrides</span> <span style="color: #0600FF;">Sub</span> ExecuteResult<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> context <span style="color: #FF8000;">As</span> System.<span style="color: #0000FF;">Web</span>.<span style="color: #0000FF;">Mvc</span>.<span style="color: #0000FF;">ControllerContext</span><span style="color: #000000;">&#41;</span>
            <span style="color: #0600FF;">Dim</span> <span style="color: #0600FF;">str</span> <span style="color: #FF8000;">As</span> <span style="color: #FF8000;">New</span> StringBuilder<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
            <span style="color: #0600FF;">With</span> <span style="color: #0600FF;">str</span>
                .<span style="color: #0000FF;">AppendLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;BEGIN:VCALENDAR&quot;</span><span style="color: #000000;">&#41;</span>
                .<span style="color: #0000FF;">AppendLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;VERSION:2.0&quot;</span><span style="color: #000000;">&#41;</span>
                .<span style="color: #0000FF;">AppendLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;BEGIN:VEVENT&quot;</span><span style="color: #000000;">&#41;</span>
                .<span style="color: #0000FF;">AppendLine</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">String</span>.<span style="color: #0600FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;DTSTART:{0}&quot;</span>, _startUtc.<span style="color: #0000FF;">ToUniversalTimeString</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
                .<span style="color: #0000FF;">AppendLine</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">String</span>.<span style="color: #0600FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;DTEND:{0}&quot;</span>, _endUtc.<span style="color: #0000FF;">ToUniversalTimeString</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
                .<span style="color: #0000FF;">AppendLine</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">String</span>.<span style="color: #0600FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;SUMMARY:{0}&quot;</span>, _summary<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
                .<span style="color: #0000FF;">AppendLine</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">String</span>.<span style="color: #0600FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;DESCRIPTION:{0}&quot;</span>, _description<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
                .<span style="color: #0000FF;">AppendLine</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">String</span>.<span style="color: #0600FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;LOCATION:{0}&quot;</span>, _location<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
                .<span style="color: #0000FF;">AppendLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;END:VEVENT&quot;</span><span style="color: #000000;">&#41;</span>
                .<span style="color: #0000FF;">AppendLine</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;END:VCALENDAR&quot;</span><span style="color: #000000;">&#41;</span>
            <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">With</span>
            context.<span style="color: #0000FF;">HttpContext</span>.<span style="color: #0000FF;">Response</span>.<span style="color: #0000FF;">ContentType</span> <span style="color: #008000;">=</span> <span style="color: #808080;">&quot;text/calendar&quot;</span>
            context.<span style="color: #0000FF;">HttpContext</span>.<span style="color: #0000FF;">Response</span>.<span style="color: #0000FF;">AddHeader</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;Content-disposition&quot;</span>, <span style="color: #FF8000;">String</span>.<span style="color: #0600FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;attachment; filename={0}&quot;</span>, _fileName<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
            context.<span style="color: #0000FF;">HttpContext</span>.<span style="color: #0000FF;">Response</span>.<span style="color: #0600FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">str</span>.<span style="color: #0000FF;">ToString</span><span style="color: #000000;">&#41;</span>
            context.<span style="color: #0000FF;">HttpContext</span>.<span style="color: #0000FF;">Response</span>.<span style="color: #0600FF;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span>
    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span></pre></div></div>

<p>Finally I created a controller extension method called ICalEvent that simply returns an instance of the ICalEventResult.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danappleyard.com/2011/03/15/create-an-ical-file-in-asp-net-mvc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft&#8217;s NuPack &#8211; .Net&#8217;s Gem Manager?</title>
		<link>http://www.danappleyard.com/2010/10/06/microsofts-nupack-nets-gem-manager/</link>
		<comments>http://www.danappleyard.com/2010/10/06/microsofts-nupack-nets-gem-manager/#comments</comments>
		<pubDate>Wed, 06 Oct 2010 15:45:25 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.danappleyard.com/?p=460</guid>
		<description><![CDATA[Today Microsoft announced the betas of several new projects &#8211; ASP.NET MVC 3 Beta 1, WebMatrix Beta 2, and NuPack. NuPack is a free open source package manager that makes it easy for you to find, install, and use .NET libraries in your projects. Once installed, you can open a new &#8220;&#8221; within Visual Studio [...]]]></description>
			<content:encoded><![CDATA[<p>Today <a href="http://weblogs.asp.net/scottgu/archive/2010/10/06/announcing-nupack-asp-net-mvc-3-beta-and-webmatrix-beta-2.aspx">Microsoft announced the betas of several new projects</a> &#8211; ASP.NET MVC 3 Beta 1, WebMatrix Beta 2, and NuPack.  NuPack is a free open source package manager that makes it easy for you to find, install, and use .NET libraries in your projects. Once installed, you can open a new &#8220;&#8221; within Visual Studio and enter the line &#8220;Add-Package [name of library]&#8220;.  NuPack will search online, download, add a reference to the library to your project, and setup the project&#8217;s configuration file.</p>
<blockquote><p>Isn&#8217;t that doing the same thing as Ruby&#8217;s Gem Manager?</p></blockquote>
<p>Basically it is.  But so what?  Some people say that Microsoft has been trying to play catch-up with Ruby / Rails for the last year or so.  Once again, I say &#8220;So What?&#8221;.  Don&#8217;t we as developers want improvements in our languages/platforms?  These are just my initial thoughts about this interesting new project.  Once I have played around with NuPack, I am sure I will much more to say.  Until then, here are some links for your reading pleasure.</p>
<ul>
<li><a href="http://haacked.com/archive/2010/10/06/introducing-nupack-package-manager.aspx">Phil Haack introducing NuPack</a></li>
<li> <a href="http://weblogs.asp.net/scottgu/archive/2010/10/06/announcing-nupack-asp-net-mvc-3-beta-and-webmatrix-beta-2.aspx">Scott Guthrie announcing the new projects</a></li>
<li><a href="http://haacked.com/archive/2010/10/06/asp-net-mvc-3-beta-released.aspx">Phil Haack talking about Mvc 3 Beta</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.danappleyard.com/2010/10/06/microsofts-nupack-nets-gem-manager/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>No AJAX request in IE7</title>
		<link>http://www.danappleyard.com/2010/09/13/no-ajax-request-in-ie7/</link>
		<comments>http://www.danappleyard.com/2010/09/13/no-ajax-request-in-ie7/#comments</comments>
		<pubDate>Mon, 13 Sep 2010 17:14:59 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.danappleyard.com/?p=423</guid>
		<description><![CDATA[I was recently trying to solve an issue regarding jquery and a ASP.NET Webforms application.  I would sometimes get an AJAX call to execute and other times it would not fire.  I was beating my brain into a bloody mush, when I discovered that it was skipping the AJAX request only in IE7 browsers.  IIIIIEEEEEEEEEEEEEEEEEEEEEE! [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://danappleyard.files.wordpress.com/2010/09/kahn1.png"><img class="aligncenter size-full wp-image-426" title="KAAAAAAAHHHHHNNNNN!" src="http://danappleyard.files.wordpress.com/2010/09/kahn1.png" alt="" width="536" height="303" /></a>I was recently trying to solve an issue regarding jquery and a ASP.NET Webforms application.  I would sometimes get an AJAX call to execute and other times it would not fire.  I was beating my brain into a bloody mush, when I discovered that it was skipping the AJAX request only in IE7 browsers.  <a href="http://www.youtube.com/watch?v=wRnSnfiUI54" target="_blank">IIIIIEEEEEEEEEEEEEEEEEEEEEE!</a></p>
<p>Thankfully, after regaining my composure, I was able to find a the solution right <a href="http://www.thushanfernando.com/index.php/2009/10/27/quickfix-jquery-getjson-fails-in-ie6-ie7/" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danappleyard.com/2010/09/13/no-ajax-request-in-ie7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The chosen language is Ruby</title>
		<link>http://www.danappleyard.com/2010/06/04/the-chosen-language-is-ruby/</link>
		<comments>http://www.danappleyard.com/2010/06/04/the-chosen-language-is-ruby/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 15:19:00 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.danappleyard.com/?p=198</guid>
		<description><![CDATA[It has been awhile since I wrote about my examination of what language to learn first after using .Net for years. I narrowed it to PHP, Perl, Python, Ruby, and Java. So far, I had gone over all but Java. The reason I did not do Java is because I felt that the examination code [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ruby-lang.org/en/"><img class="alignnone" title="The Ruby Programming Language" src="http://www.ruby-lang.org/images/logo.gif" alt="The Ruby Programming Language" width="331" height="119" /></a><br />
It has been awhile since I wrote about my examination of what language to learn first after using .Net for years.  I narrowed it to <a href="http://www.danappleyard.com/2010/05/19/a-look-at-php/">PHP</a>, <a href="http://www.danappleyard.com/2010/05/17/a-look-at-perl/">Perl</a>, <a href="http://www.danappleyard.com/2010/05/18/a-look-at-python/">Python</a>, <a href="http://www.danappleyard.com/2010/05/22/a-belated-look-at-ruby/">Ruby</a>, and Java.  So far, I had gone over all but Java.  The reason I did not do Java is because I felt that the examination code I would have written in Java was basically C#.  That would not have really brought anything new to light for me.  That is not really attractive to me for a new language.  I was now left with PHP, Perl, Python, and Ruby.  I found that Perl was very cryptic in its syntax, PHP was just for web, and that Python and Ruby are very similar.  I had Python and Ruby in the top two.  Researching what people thought about the two languages, I found that Ruby had the advantage.  Since I take what the development community thinks seriously, I have chosen to learn Ruby.  I will probably try to learn Rails as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danappleyard.com/2010/06/04/the-chosen-language-is-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A belated look at Ruby</title>
		<link>http://www.danappleyard.com/2010/05/22/a-belated-look-at-ruby/</link>
		<comments>http://www.danappleyard.com/2010/05/22/a-belated-look-at-ruby/#comments</comments>
		<pubDate>Sun, 23 May 2010 04:32:45 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.danappleyard.com/?p=159</guid>
		<description><![CDATA[Last Sunday I went over a list of possible programming languages to learn. It ended with me decided to learn all of them, but unsure as to what to learn first. I decided to go over each of them and figure out what I thought about them. How would I do this? What I have [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.danappleyard.com/2010/05/16/learn-a-new-programming-language/">Last Sunday I went over a list of possible programming languages to learn</a>.  It ended with me decided to learn all of them, but unsure as to what to learn first.  I decided to go over each of them and figure out what I thought about them.  How would I do this?  What I have decided to do is see how complex it is to do the same thing in each language.  What better to test out a language than to create a class?  <a href="http://www.danappleyard.com/2010/05/17/a-look-at-php/">Wednesday, I went over the PHP implementation</a>.  Today is Ruby&#8217;s turn.</p>
<h2>Ruby Class</h2>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Person
&nbsp;
	<span style="color:#9966CC; font-weight:bold;">def</span> initialze<span style="color:#006600; font-weight:bold;">&#40;</span>firstName, lastName, age<span style="color:#006600; font-weight:bold;">&#41;</span>
		<span style="color:#0066ff; font-weight:bold;">@firstName</span> = firstName
		<span style="color:#0066ff; font-weight:bold;">@lastName</span> = lastName
		<span style="color:#0066ff; font-weight:bold;">@age</span> = age
	<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
	<span style="color:#9966CC; font-weight:bold;">def</span> IntroduceYourself
	    response = <span style="color:#996600;">&quot;Hello, my name is &quot;</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#0066ff; font-weight:bold;">@firstName</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">&quot; &quot;</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#0066ff; font-weight:bold;">@lastName</span>
            response = response <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">&quot;, and I am &quot;</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#0066ff; font-weight:bold;">@age</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">&quot; year(s) old.&quot;</span>
            <span style="color:#0000FF; font-weight:bold;">return</span> response
	<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<h2>Ruby Implementation</h2>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">dan = Person.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;Dan&quot;</span>, <span style="color:#996600;">&quot;Appleyard&quot;</span>, <span style="color:#006666;">27</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#CC0066; font-weight:bold;">puts</span> dan.<span style="color:#9900CC;">IntroduceYourself</span></pre></div></div>

<h2>My Thoughts</h2>
<p>Rubys seems similar to Python.  Since I liked Python, I like Ruby.  At this point in my limited knowledge of these languages, I don&#8217;t really see the differences between Ruby and Python.  My final examination will be that of Java.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danappleyard.com/2010/05/22/a-belated-look-at-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>No look at Ruby today</title>
		<link>http://www.danappleyard.com/2010/05/20/no-look-at-ruby-today/</link>
		<comments>http://www.danappleyard.com/2010/05/20/no-look-at-ruby-today/#comments</comments>
		<pubDate>Fri, 21 May 2010 03:27:26 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.danappleyard.com/?p=154</guid>
		<description><![CDATA[I have been too busy today to mess around with Ruby. Will try tomorrow.]]></description>
			<content:encoded><![CDATA[<p>I have been too busy today to mess around with Ruby.  Will try tomorrow.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danappleyard.com/2010/05/20/no-look-at-ruby-today/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The numbers don&#8217;t lie</title>
		<link>http://www.danappleyard.com/2010/05/20/the-numbers-dont-lie/</link>
		<comments>http://www.danappleyard.com/2010/05/20/the-numbers-dont-lie/#comments</comments>
		<pubDate>Thu, 20 May 2010 17:15:50 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[web forms]]></category>

		<guid isPermaLink="false">http://www.danappleyard.com/?p=125</guid>
		<description><![CDATA[Yesterday I talked about my hatred of postbacks and third party controls. Looking back on it, I didn&#8217;t include any numbers to back me up. Well, here are some numbers. In this scenario, I have a page that contains two dropdown controls. One is populated with the numbers one through 10. The second one is [...]]]></description>
			<content:encoded><![CDATA[<p><img alt="" src="http://www.americanprogress.org/cartoons/2009/04/img/040109.jpg" title="Numbers don&#039;t lie" class="aligncenter" width="288" height="320" /><br />
Yesterday I talked about my hatred of postbacks and third party controls.  Looking back on it, I didn&#8217;t include any numbers to back me up.  Well, here are some numbers.  In this scenario, I have a page that contains two dropdown controls.  One is populated with the numbers one through 10.  The second one is empty.  The goals is to populate the second dropdown when a selection is made on the first dropdown.  The first way we are going to implement this is through the typical postback method.</p>
<h2>Full Page Postback</h2>
<p>When an end user selects an item in the first dropdown, the browser will postback the entire page and code on the server will populate the second dropdown with data and send the updated html markup back to the browser to render again.  When there is just a small portion of the page that needs to be updated (as is the case in our example), that can be quite expensive!  In this example, I have various javascript, css, and image files that have to be downloaded from the server to the client on every load of the back.</p>
<h3>Server-side VB.Net Code</h3>
<pre class="brush:vb">
'this method is executed when the page posts back after a selection is made in the first dropdown
Private Sub drp1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles drp1.SelectedIndexChanged
        Dim letters As New List(Of String)
        letters.Add("A")
        letters.Add("B")
        letters.Add("C")
        letters.Add("D")
        letters.Add("E")
        letters.Add("F")
        letters.Add("G")
        letters.Add("H")
        letters.Add("I")
        letters.Add("J")
        letters.Add("K")
        letters.Add("L")
        letters.Add("M")
        letters.Add("N")
        letters.Add("O")
        letters.Add("P")
        letters.Add("Q")
        letters.Add("R")
        letters.Add("S")
        letters.Add("T")
        letters.Add("U")
        letters.Add("V")
        letters.Add("W")
        letters.Add("X")
        letters.Add("Y")
        letters.Add("Z")

        drp2.DataSource = letters
        drp2.DataBind()
    End Sub
</pre>
<h3>The Server-side Numbers</h3>
<p>When running this, we get a total of 218,049 bytes being sent from the server back to the browser.  This number includes the actual html of the entire page, and any necessary javascript, css, or image files that are needed on the page.  That is a lot of data!</p>
<h2>Ajax Post</h2>
<p>When an end user selects an item in the first dropdown, a javascript handler will call the server with a request for data to populate the second dropdown.  The server gets the request and sends back just the data requested.  The browser gets that data and puts it in the second dropdown.  There is no page refreshing.  There is no html, javascript, css, or image files being sent back to the client, because they are already there.  It is very light!</p>
<h3>jQuery Code</h3>
<pre class="brush:javascript">

        $(document).ready(function() {
            $("#").change(function() {
               //when a selection is made in the dropdown
              //do an ajax post back to the page and get a list of strings
                $.ajax({
                    type: "POST",
                    url: "WebForm1.aspx/GetNextCombobox",
                    data: "{}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function(msg) {
                       //we convert it into an array
                        var arr = jQuery.makeArray(msg.d);
                        //we find the dropdown we want to populate with data
                        var dd = $("#");
                        //let us empty it first of any existing data
                        dd.empty();
                        $.each(arr, function(i, v) {
                            //for each item in the array we got from the server, place it into the dropdown
                            dd.append($("").val(v).text(v));
                        });
                    }
                });
            });
        });
</pre>
<h3>Server-side VB.Net Code</h3>
<p>I am still trying out different syntax highlighters for my blog.  This one is sometimes adding extra tags when not needed.  Please excuse my malformed webmethod tag(s).</p>
<pre class="brush:vb">
'this method is executed when the javascript ajax call requests the data for the second dropdown
 _
Public Shared Function GetNextCombobox() as List(Of String)
        Dim letters As New List(Of String)
        letters.Add("A")
        letters.Add("B")
        letters.Add("C")
        letters.Add("D")
        letters.Add("E")
        letters.Add("F")
        letters.Add("G")
        letters.Add("H")
        letters.Add("I")
        letters.Add("J")
        letters.Add("K")
        letters.Add("L")
        letters.Add("M")
        letters.Add("N")
        letters.Add("O")
        letters.Add("P")
        letters.Add("Q")
        letters.Add("R")
        letters.Add("S")
        letters.Add("T")
        letters.Add("U")
        letters.Add("V")
        letters.Add("W")
        letters.Add("X")
        letters.Add("Y")
        letters.Add("Z")

        Return letters
    End Function
</pre>
<h3>The Ajax Numbers</h3>
<p>With this implementation, the server is only passing 111 bytes of data back.</p>
<h2>Recap</h2>
<p>The postback implementation cost us 218,049 bytes of data being sent from the server to the browser, while the jQuery implementation cost us only 111 bytes!  That is 1,964 times less data.  Why anyone would be fine with dealing with 1964 times of overhead is beyond me, but the numbers don&#8217;t lie.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danappleyard.com/2010/05/20/the-numbers-dont-lie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A look at PHP</title>
		<link>http://www.danappleyard.com/2010/05/19/a-look-at-php/</link>
		<comments>http://www.danappleyard.com/2010/05/19/a-look-at-php/#comments</comments>
		<pubDate>Wed, 19 May 2010 22:03:46 +0000</pubDate>
		<dc:creator>Dan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Learning]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.danappleyard.com/?p=83</guid>
		<description><![CDATA[Okay, on Sunday I went over a list of possible programming languages to learn. It ended with me decided to learn all of them, but unsure as to what to learn first. I decided to go over each of them and figure out what I thought about them. How would I do this? What I [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, <a href="http://www.danappleyard.com/2010/05/16/learn-a-new-programming-language/">on Sunday I went over a list of possible programming languages to learn</a>.  It ended with me decided to learn all of them, but unsure as to what to learn first.  I decided to go over each of them and figure out what I thought about them.  How would I do this?  What I have decided to do is see how complex it is to do the same thing in each language.  What better to test out a language than to create a class?<br />
<a href="http://www.danappleyard.com/2010/05/17/a-look-at-python/">Yesterday, I went over the Python implementation</a>.  Today is PHP&#8217;s turn.</p>
<h2>PHP Class</h2>
<pre class="brush:php">
firstName = $firstName;
		$this-&gt;lastName = $lastName;
		$this-&gt;age = $age;
	}
	public function IntroduceYourself(){
		return "Hello, my name is $this-&gt;firstName $this-&gt;lastName, and I am $this-&gt;age year(s) old.";
	}
}

?&gt;
</pre>
<h2>PHP Implementation</h2>
<pre class="brush:php">
IntroduceYourself();
?&gt;
</pre>
<h2>My Thoughts</h2>
<p>I&#8217;ve had some minor experience with PHP before in the past.  Nothing really to write home about.  PHP is fine I guess, reminds me too much of C and C++ for some reason.  I&#8217;m really looking for a language that I can do both in and out a web environment.  PHP is just web.  As of now, PHP is slighly over Perl and under Python.  Tomorrow I will go over Ruby.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danappleyard.com/2010/05/19/a-look-at-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

