<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>Dan Miser</title>
    <link>http://www.distribucon.com/blog/</link>
    <description>Thoughts from Dan Miser</description>
    <language>en-us</language>
    <copyright>Dan Miser</copyright>
    <lastBuildDate>Sun, 08 Nov 2009 03:00:21 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.0.7226.0</generator>
    <managingEditor>dmiser@distribucon.com</managingEditor>
    <webMaster>dmiser@distribucon.com</webMaster>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/distribucon/danmiser" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=7894225c-ffc2-429b-9829-a49998567094</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,7894225c-ffc2-429b-9829-a49998567094.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,7894225c-ffc2-429b-9829-a49998567094.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=7894225c-ffc2-429b-9829-a49998567094</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Telerik just released an extremely impressive <a href="http://demos.telerik.com/aspnet-mvc/" target="_blank">library
of components</a> (Grid, Menu, TabStrip, and MenuBar), written for MVC. They are truly
first-class, from the architecture, to the development experience, to the finished
screens that your user sees. They released them as open-source, and even better, these
controls are written from the ground up to support ASP.NET MVC. 
<p />
Be sure to check out this awesome write up on how to <a href="http://weblogs.asp.net/rashid/archive/2009/11/05/using-telerik-mvc-grid-in-crud-scenario.aspx" target="_blank">Use
the grid in a CRUD scenario</a>. Very nicely done. 
<p />
I'm not a fan of the whole "Edit/Delete" action column. I'd much rather just have
a link on the column to take me to the detail screen. Here's the way I solved that: <pre><code> &lt;%
Html.Telerik().Grid(Model) .Name("Grid") .PrefixUrlParameters(false) .Columns(columns
=&gt; { columns.Add(o =&gt; o.CollectionDate).Template(c =&gt; { %&gt; &lt;%= Html.ActionLink(c.CollectionDate.ToShortDateString(),
"View", new { Id = c.Id })%&gt; &lt;% }).Width(40); columns.Add(o =&gt; o.Location.Name).Width(40);
}) .Scrollable() .Sortable() .Pageable() .Filterable() .Render(); %&gt; </code></pre><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=7894225c-ffc2-429b-9829-a49998567094" /></body>
      <title>Telerik Extensions for ASP.NET MVC</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,7894225c-ffc2-429b-9829-a49998567094.aspx</guid>
      <link>http://feedproxy.google.com/~r/distribucon/danmiser/~3/iJDxZhouIZs/TelerikExtensionsForASPNETMVC.aspx</link>
      <pubDate>Sun, 08 Nov 2009 03:00:21 GMT</pubDate>
      <description>Telerik just released an extremely impressive &lt;a href="http://demos.telerik.com/aspnet-mvc/" target="_blank"&gt;library
of components&lt;/a&gt; (Grid, Menu, TabStrip, and MenuBar), written for MVC. They are truly
first-class, from the architecture, to the development experience, to the finished
screens that your user sees. They released them as open-source, and even better, these
controls are written from the ground up to support ASP.NET MVC. 
&lt;p /&gt;
Be sure to check out this awesome write up on how to &lt;a href="http://weblogs.asp.net/rashid/archive/2009/11/05/using-telerik-mvc-grid-in-crud-scenario.aspx" target="_blank"&gt;Use
the grid in a CRUD scenario&lt;/a&gt;. Very nicely done. 
&lt;p /&gt;
I'm not a fan of the whole "Edit/Delete" action column. I'd much rather just have
a link on the column to take me to the detail screen. Here's the way I solved that: &lt;pre&gt;&lt;code&gt; &amp;lt;%
Html.Telerik().Grid(Model) .Name("Grid") .PrefixUrlParameters(false) .Columns(columns
=&amp;gt; { columns.Add(o =&amp;gt; o.CollectionDate).Template(c =&amp;gt; { %&gt; &amp;lt;%= Html.ActionLink(c.CollectionDate.ToShortDateString(),
"View", new { Id = c.Id })%&amp;gt; &amp;lt;% }).Width(40); columns.Add(o =&amp;gt; o.Location.Name).Width(40);
}) .Scrollable() .Sortable() .Pageable() .Filterable() .Render(); %&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=7894225c-ffc2-429b-9829-a49998567094" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,7894225c-ffc2-429b-9829-a49998567094.aspx</comments>
      <category>.NET</category>
      <category>ALT.NET</category>
      <category>ASP.NET MVC</category>
    <feedburner:origLink>http://www.distribucon.com/blog/TelerikExtensionsForASPNETMVC.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=5428f2ef-4962-44e0-ba14-1f18cb8bedc3</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,5428f2ef-4962-44e0-ba14-1f18cb8bedc3.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,5428f2ef-4962-44e0-ba14-1f18cb8bedc3.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=5428f2ef-4962-44e0-ba14-1f18cb8bedc3</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I've never been happier that I chose a
technology after today. I have a production web application built using ASP.NET MVC,
and it has been working with almost no issues for over a year now. As a matter of
fact, it is the cornerstone used to run our business. I've had the default blue skin
in use since day 1 (ya, ya, I know, I know. I've been so lazy, I haven't even switched
out to <a href="http://www.asp.net/MVC/Gallery/" target="_blank">pre-built templates</a>),
and we run the app on the iPhone. It works, but there's always pinching, zooming and
scrolling going on. I finally bit the bullet after thinking to myself "Why not create
a view tailored to the iPhone to enhance the experience?" one too many times. About
12 hours later, the entire application was done with an auto-detected, optimized look
and feel for the iPhone. I am now convinced that I've just been paid back with the
technical dividends for investing in ASP.NET MVC. :) 
<p />
To help the next guy out who walks down this path, here are all of the links that
I used during this process: 
<ul><li><a href="http://weblogs.asp.net/aaronlerch/archive/2008/06/08/rock-the-iphone-with-asp-net-mvc.aspx" target="_blank">Aaron
Lerch's seminal article</a> on using iUI</li><li><a href="http://code.google.com/p/iui/" target="_blank">iUI project home page</a> (Be
sure to use 0.31. It is lightning fast!)</li><li><a href="http://www.hanselman.com/blog/TheWeeklySourceCode28IPhoneWithASPNETMVCEdition.aspx" target="_blank">Scott
Hanselman's article</a> that introduced the auto-detect view engine</li><li><a href="http://www.k10design.net/articles/iui/" target="_blank">CW Zachary's article</a> that
gives some extensions to iUI (like tables, load/unload, and script/css execution)</li><li><a href="http://video.yahoo.com/watch/853528/3491272" target="_blank">Joe Hewitt's
introductory video</a>. Nice presentation, and the _replace nugget was worth the 15
minutes to watch it.</li></ul><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=5428f2ef-4962-44e0-ba14-1f18cb8bedc3" /></body>
      <title>ASP.NET MVC on the iPhone</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,5428f2ef-4962-44e0-ba14-1f18cb8bedc3.aspx</guid>
      <link>http://feedproxy.google.com/~r/distribucon/danmiser/~3/O1kLdd0UP9g/ASPNETMVCOnTheIPhone.aspx</link>
      <pubDate>Fri, 06 Nov 2009 23:44:02 GMT</pubDate>
      <description>I've never been happier that I chose a technology after today. I have a production web application built using ASP.NET MVC, and it has been working with almost no issues for over a year now. As a matter of fact, it is the cornerstone used to run our business. I've had the default blue skin in use since day 1 (ya, ya, I know, I know. I've been so lazy, I haven't even switched out to &lt;a href="http://www.asp.net/MVC/Gallery/" target="_blank"&gt;pre-built
templates&lt;/a&gt;), and we run the app on the iPhone. It works, but there's always pinching,
zooming and scrolling going on. I finally bit the bullet after thinking to myself
"Why not create a view tailored to the iPhone to enhance the experience?" one too
many times. About 12 hours later, the entire application was done with an auto-detected,
optimized look and feel for the iPhone. I am now convinced that I've just been paid
back with the technical dividends for investing in ASP.NET MVC. :) 
&lt;p /&gt;
To help the next guy out who walks down this path, here are all of the links that
I used during this process: 
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://weblogs.asp.net/aaronlerch/archive/2008/06/08/rock-the-iphone-with-asp-net-mvc.aspx" target="_blank"&gt;Aaron
Lerch's seminal article&lt;/a&gt; on using iUI&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://code.google.com/p/iui/" target="_blank"&gt;iUI project home page&lt;/a&gt; (Be
sure to use 0.31. It is lightning fast!)&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://www.hanselman.com/blog/TheWeeklySourceCode28IPhoneWithASPNETMVCEdition.aspx" target="_blank"&gt;Scott
Hanselman's article&lt;/a&gt; that introduced the auto-detect view engine&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://www.k10design.net/articles/iui/" target="_blank"&gt;CW Zachary's article&lt;/a&gt; that
gives some extensions to iUI (like tables, load/unload, and script/css execution)&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://video.yahoo.com/watch/853528/3491272" target="_blank"&gt;Joe Hewitt's
introductory video&lt;/a&gt;. Nice presentation, and the _replace nugget was worth the 15
minutes to watch it.&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=5428f2ef-4962-44e0-ba14-1f18cb8bedc3" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,5428f2ef-4962-44e0-ba14-1f18cb8bedc3.aspx</comments>
      <category>ASP.NET</category>
      <category>ASP.NET MVC</category>
    <feedburner:origLink>http://www.distribucon.com/blog/ASPNETMVCOnTheIPhone.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=5b14f213-f984-4a46-9e00-c47f7f0ab52d</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,5b14f213-f984-4a46-9e00-c47f7f0ab52d.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,5b14f213-f984-4a46-9e00-c47f7f0ab52d.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=5b14f213-f984-4a46-9e00-c47f7f0ab52d</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">It looks like the blog shut down on 10/20/09.
The problem turned out to be that I had exceeded the quota for the user account that
hosts dasBlog. I bumped up the quota for that user, and now we should be good to go
again. Until the next post...<img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=5b14f213-f984-4a46-9e00-c47f7f0ab52d" /></body>
      <title>I'm back</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,5b14f213-f984-4a46-9e00-c47f7f0ab52d.aspx</guid>
      <link>http://feedproxy.google.com/~r/distribucon/danmiser/~3/EoSADy36-_U/ImBack.aspx</link>
      <pubDate>Thu, 05 Nov 2009 16:01:22 GMT</pubDate>
      <description>It looks like the blog shut down on 10/20/09. The problem turned out to be that I had exceeded the quota for the user account that hosts dasBlog. I bumped up the quota for that user, and now we should be good to go again. Until the next post...&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=5b14f213-f984-4a46-9e00-c47f7f0ab52d" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,5b14f213-f984-4a46-9e00-c47f7f0ab52d.aspx</comments>
    <feedburner:origLink>http://www.distribucon.com/blog/ImBack.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=30b6e8a6-7d18-49a3-825c-ea4c0c2006fc</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,30b6e8a6-7d18-49a3-825c-ea4c0c2006fc.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,30b6e8a6-7d18-49a3-825c-ea4c0c2006fc.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=30b6e8a6-7d18-49a3-825c-ea4c0c2006fc</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">Given a collection of players that were
constructed like this: <pre><code> private static IList&lt;Player&gt; LoadPlayers()
{ Player favre = new Player { Id = 1, Name = "Favre", Team = new Team { Id = 1, Name
= "Vikings" } }; Player peterson = new Player { Id = 2, Name = "Peterson", Team =
new Team { Id = 1, Name = "Vikings" } }; Player rodgers = new Player { Id = 3, Name
= "Rodgers", Team = new Team { Id = 2, Name = "Packers" } }; Player driver = new Player
{ Id = 4, Name = "Driver", Team = new Team { Id = 2, Name = "Packers" } }; List&lt;Player&gt;
players = new List&lt;Player&gt; {favre, peterson, rodgers, driver}; return players;
} </code></pre><p />
And the following LINQ query: <pre><code> var query = from p in LoadPlayers() group
p by p.Team into g select g; </code></pre><p />
We will see the following output: <pre><code> Vikings Vikings Packers Packers </code></pre><p />
The reason this is happening is that we created new Team objects for each and every
Player, and when LINQ tries to group, it does so based on object equality. The solution
to this is to <a href="http://www.developer.com/net/asp/print.php/989091" target="_blank">override
the Equals() and GetHashCode() methods</a> in the Team class. After doing that, the
LINQ query will be able to group the objects up properly and just display each team
name once. <a href="http://www.jetbrains.com/resharper/" target="_blank">Resharper</a> has
a nice code generation template to create solid implementations of these methods (press
Alt+Ins to bring up the code generation menu). 
<p />
The example here is obviously contrived. We could create each team object once, and
then use the same instance during the property assignment, and if we did that, things
would work just fine. However, I ran into a more generalized version of this problem
when using WCF and a lot of custom code generation. The underlying lesson is still
the same: LINQ and GroupBy need to have object equality defined properly in order
to make things work as you would expect.<img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=30b6e8a6-7d18-49a3-825c-ea4c0c2006fc" /></body>
      <title>LINQ GroupBy requires object equality</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,30b6e8a6-7d18-49a3-825c-ea4c0c2006fc.aspx</guid>
      <link>http://feedproxy.google.com/~r/distribucon/danmiser/~3/3r7v-TgGw4A/LINQGroupByRequiresObjectEquality.aspx</link>
      <pubDate>Fri, 16 Oct 2009 18:14:18 GMT</pubDate>
      <description>Given a collection of players that were constructed like this:
&lt;pre&gt;&lt;code&gt; private
static IList&amp;lt;Player&amp;gt; LoadPlayers() { Player favre = new Player { Id = 1, Name
= "Favre", Team = new Team { Id = 1, Name = "Vikings" } }; Player peterson = new Player
{ Id = 2, Name = "Peterson", Team = new Team { Id = 1, Name = "Vikings" } }; Player
rodgers = new Player { Id = 3, Name = "Rodgers", Team = new Team { Id = 2, Name =
"Packers" } }; Player driver = new Player { Id = 4, Name = "Driver", Team = new Team
{ Id = 2, Name = "Packers" } }; List&amp;lt;Player&amp;gt; players = new List&amp;lt;Player&amp;gt;
{favre, peterson, rodgers, driver}; return players; } &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
And the following LINQ query: &lt;pre&gt;&lt;code&gt; var query = from p in LoadPlayers() group
p by p.Team into g select g; &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
We will see the following output: &lt;pre&gt;&lt;code&gt; Vikings Vikings Packers Packers &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
The reason this is happening is that we created new Team objects for each and every
Player, and when LINQ tries to group, it does so based on object equality. The solution
to this is to &lt;a href="http://www.developer.com/net/asp/print.php/989091" target="_blank"&gt;override
the Equals() and GetHashCode() methods&lt;/a&gt; in the Team class. After doing that, the
LINQ query will be able to group the objects up properly and just display each team
name once. &lt;a href="http://www.jetbrains.com/resharper/" target="_blank"&gt;Resharper&lt;/a&gt; has
a nice code generation template to create solid implementations of these methods (press
Alt+Ins to bring up the code generation menu). 
&lt;p /&gt;
The example here is obviously contrived. We could create each team object once, and
then use the same instance during the property assignment, and if we did that, things
would work just fine. However, I ran into a more generalized version of this problem
when using WCF and a lot of custom code generation. The underlying lesson is still
the same: LINQ and GroupBy need to have object equality defined properly in order
to make things work as you would expect.&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=30b6e8a6-7d18-49a3-825c-ea4c0c2006fc" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,30b6e8a6-7d18-49a3-825c-ea4c0c2006fc.aspx</comments>
      <category>.NET</category>
      <category>LINQ</category>
    <feedburner:origLink>http://www.distribucon.com/blog/LINQGroupByRequiresObjectEquality.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=53f4be36-1d7b-43f7-8691-286b480ec9d2</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,53f4be36-1d7b-43f7-8691-286b480ec9d2.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,53f4be36-1d7b-43f7-8691-286b480ec9d2.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=53f4be36-1d7b-43f7-8691-286b480ec9d2</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Since my <a href="http://www.distribucon.com/blog/PopulatingDateRanges.aspx" target="_blank">last
post</a>, the date has changed from October 9th to October 12th. The reason this is
important is that the functions that needed to calculate the date based on the current
date are now coming through a different code path. Before, everything worked great.
As of October 10th, not so much. The fix is simple - the getDate function was missing
the parentheses to make it a method call. The fix is quite simple and is listed below: <pre><code> var
day = (now.getDate() &lt; 10) ? "0" + now.getDate() : now.getDate(); </code></pre><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=53f4be36-1d7b-43f7-8691-286b480ec9d2" /></body>
      <title>Populating Date Ranges, part 2</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,53f4be36-1d7b-43f7-8691-286b480ec9d2.aspx</guid>
      <link>http://feedproxy.google.com/~r/distribucon/danmiser/~3/GLjGFUVlYCY/PopulatingDateRangesPart2.aspx</link>
      <pubDate>Tue, 13 Oct 2009 04:11:13 GMT</pubDate>
      <description>Since my &lt;a href="http://www.distribucon.com/blog/PopulatingDateRanges.aspx" target="_blank"&gt;last
post&lt;/a&gt;, the date has changed from October 9th to October 12th. The reason this is
important is that the functions that needed to calculate the date based on the current
date are now coming through a different code path. Before, everything worked great.
As of October 10th, not so much. The fix is simple - the getDate function was missing
the parentheses to make it a method call. The fix is quite simple and is listed below: &lt;pre&gt;&lt;code&gt; var
day = (now.getDate() &amp;lt; 10) ? "0" + now.getDate() : now.getDate(); &lt;/code&gt;&lt;/pre&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=53f4be36-1d7b-43f7-8691-286b480ec9d2" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,53f4be36-1d7b-43f7-8691-286b480ec9d2.aspx</comments>
      <category>ASP.NET</category>
      <category>ASP.NET MVC</category>
    <feedburner:origLink>http://www.distribucon.com/blog/PopulatingDateRangesPart2.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=691a0e72-3786-4810-ad90-d064e6090fac</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,691a0e72-3786-4810-ad90-d064e6090fac.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,691a0e72-3786-4810-ad90-d064e6090fac.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=691a0e72-3786-4810-ad90-d064e6090fac</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I have several reports in my ASP.NET MVC
application that are date-oriented. I had start date and end date text boxes, and
things worked fine. What I really wanted was something that would allow those date
boxes to be populated with a variety of canned date ranges (e.g. Year to Date, Last
Month, etc.). I found just what I was looking for in a pure JavaScript implementation <a href="http://www.epalla.com/2009/06/using-javascript-to-calculate-dates/" target="_blank">here</a>. 
<p />
The one problem I found was that "Last Month" was being calculated incorrectly. Below
is the simple fix. Thanks to epalla for the original code. 
<p /><pre><code> // last month case "lastmo": // we need a new month variable for month-1,
also formatted correctly var lastmonth = ((month - 1) &lt; 10) ? "0" + (month - 1)
: (month - 1); startbox.value = lastmonth + "/01/" + year; // now grab the last day
of the month (30, 31? we don't know!) var moend = new Date(year, (month - 1), 0);
endbox.value = lastmonth + "/" + moend.getDate() + "/" + year; break; </code></pre><img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=691a0e72-3786-4810-ad90-d064e6090fac" /></body>
      <title>Populating Date Ranges</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,691a0e72-3786-4810-ad90-d064e6090fac.aspx</guid>
      <link>http://feedproxy.google.com/~r/distribucon/danmiser/~3/PKhhzxhEBXk/PopulatingDateRanges.aspx</link>
      <pubDate>Fri, 09 Oct 2009 01:44:07 GMT</pubDate>
      <description>I have several reports in my ASP.NET MVC application that are date-oriented. I had start date and end date text boxes, and things worked fine. What I really wanted was something that would allow those date boxes to be populated with a variety of canned date ranges (e.g. Year to Date, Last Month, etc.). I found just what I was looking for in a pure JavaScript implementation &lt;a href="http://www.epalla.com/2009/06/using-javascript-to-calculate-dates/" target="_blank"&gt;here&lt;/a&gt;. 
&lt;p /&gt;
The one problem I found was that "Last Month" was being calculated incorrectly. Below
is the simple fix. Thanks to epalla for the original code. 
&lt;p /&gt;
&lt;pre&gt;&lt;code&gt; // last month case "lastmo": // we need a new month variable for month-1,
also formatted correctly var lastmonth = ((month - 1) &amp;lt; 10) ? "0" + (month - 1)
: (month - 1); startbox.value = lastmonth + "/01/" + year; // now grab the last day
of the month (30, 31? we don't know!) var moend = new Date(year, (month - 1), 0);
endbox.value = lastmonth + "/" + moend.getDate() + "/" + year; break; &lt;/code&gt;&lt;/pre&gt;
&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=691a0e72-3786-4810-ad90-d064e6090fac" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,691a0e72-3786-4810-ad90-d064e6090fac.aspx</comments>
      <category>ASP.NET</category>
      <category>ASP.NET MVC</category>
    <feedburner:origLink>http://www.distribucon.com/blog/PopulatingDateRanges.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=c83cdf21-4e42-4454-b2f4-35d2ed774f45</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,c83cdf21-4e42-4454-b2f4-35d2ed774f45.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,c83cdf21-4e42-4454-b2f4-35d2ed774f45.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=c83cdf21-4e42-4454-b2f4-35d2ed774f45</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I posted about <a href="http://www.distribucon.com/blog/iPhone.aspx" target="_blank">my
iPhone experience</a> in April, 2008. I just picked up a 3gs, and I have to say that
I am incredibly pleased. Just about every complaint that I had in that original article
has been addressed. In addition, the speed increase really is significant. It really
is that noticeable. Add in the cool camera upgrades (better pixels, video, and cool
touch to focus), and this is absolutely a winner. 
<p />
The current complaints deal with lack of MMS and tethering, but that's hardly Apple's
fault. (Nice workaround for tethering <a href="http://help.benm.at/help.php" target="_blank">posted
here</a>.) The experience ordering business phones through AT&amp;T sucked as bad
as anything I've ever dealt with, so it's not shocking they don't care about their
users enough to enable simple features such as these. 
<p />
Now I just need to find an iPhone app to follow the Tour de France. Allez!<img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=c83cdf21-4e42-4454-b2f4-35d2ed774f45" /></body>
      <title>iPhone 3gs</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,c83cdf21-4e42-4454-b2f4-35d2ed774f45.aspx</guid>
      <link>http://feedproxy.google.com/~r/distribucon/danmiser/~3/ODk7PchBMWg/iPhone3gs.aspx</link>
      <pubDate>Fri, 10 Jul 2009 02:39:39 GMT</pubDate>
      <description>I posted about &lt;a href="http://www.distribucon.com/blog/iPhone.aspx" target="_blank"&gt;my
iPhone experience&lt;/a&gt; in April, 2008. I just picked up a 3gs, and I have to say that
I am incredibly pleased. Just about every complaint that I had in that original article
has been addressed. In addition, the speed increase really is significant. It really
is that noticeable. Add in the cool camera upgrades (better pixels, video, and cool
touch to focus), and this is absolutely a winner. 
&lt;p /&gt;
The current complaints deal with lack of MMS and tethering, but that's hardly Apple's
fault. (Nice workaround for tethering &lt;a href="http://help.benm.at/help.php" target="_blank"&gt;posted
here&lt;/a&gt;.) The experience ordering business phones through AT&amp;amp;T sucked as bad
as anything I've ever dealt with, so it's not shocking they don't care about their
users enough to enable simple features such as these. 
&lt;p /&gt;
Now I just need to find an iPhone app to follow the Tour de France. Allez!&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=c83cdf21-4e42-4454-b2f4-35d2ed774f45" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,c83cdf21-4e42-4454-b2f4-35d2ed774f45.aspx</comments>
      <category>Macintosh</category>
    <feedburner:origLink>http://www.distribucon.com/blog/iPhone3gs.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=a0a5275a-0c32-409a-b8f2-7b8e02ba71d5</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,a0a5275a-0c32-409a-b8f2-7b8e02ba71d5.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,a0a5275a-0c32-409a-b8f2-7b8e02ba71d5.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=a0a5275a-0c32-409a-b8f2-7b8e02ba71d5</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Given a set up like this (where ExpenseSummaryData
returns some arbitrary HTML fragment) : <pre><code> &lt;%using (Ajax.BeginForm("ExpenseSummaryData",
new AjaxOptions { UpdateTargetId = "result" })) { %&gt; &lt;label for="startDate"&gt;Start
Date:&lt;/label&gt; &lt;%= Html.TextBox("startDate") %&gt; &lt;br /&gt; &lt;label
for="endDate"&gt;End Date:&lt;/label&gt; &lt;%= Html.TextBox("endDate")%&gt; &lt;br
/&gt; &lt;input type="submit"/&gt; &lt;br /&gt; &lt;span id="result"/&gt; &lt;% }
%&gt; </code></pre><p />
If that is all your page does, you will notice that you get taken to a new page when
pressing Submit. The data on the new page is the HTML fragment returned by the AJAX
call, but that's all it contains (e.g. no master page), and it's clearly not replacing
the result span. 
<p />
The reason for this is that I forgot to add the following lines to the &lt;head&gt;
section in the original page: <pre><code> &lt;script src='&lt;%=ResolveUrl("~/Content/js/MicrosoftAjax.debug.js")%&gt;'
type="text/javascript"&gt;&lt;/script&gt; &lt;script src='&lt;%=ResolveUrl("~/Content/js/MicrosoftMvcAjax.debug.js")%&gt;'
type="text/javascript"&gt;&lt;/script&gt; </code></pre><p />
After adding those declarations in, the content in the span tag is properly updated
and it looks like a real AJAX call.<img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=a0a5275a-0c32-409a-b8f2-7b8e02ba71d5" /></body>
      <title>Why AJAX posts go to a new page instead of updating UpdateTargetId</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,a0a5275a-0c32-409a-b8f2-7b8e02ba71d5.aspx</guid>
      <link>http://feedproxy.google.com/~r/distribucon/danmiser/~3/vTF_0J384Zw/WhyAJAXPostsGoToANewPageInsteadOfUpdatingUpdateTargetId.aspx</link>
      <pubDate>Sun, 31 May 2009 16:38:24 GMT</pubDate>
      <description>Given a set up like this (where ExpenseSummaryData returns some arbitrary HTML fragment) :
&lt;pre&gt;&lt;code&gt; &amp;lt;%using
(Ajax.BeginForm("ExpenseSummaryData", new AjaxOptions { UpdateTargetId = "result"
})) { %&amp;gt; &amp;lt;label for="startDate"&amp;gt;Start Date:&amp;lt;/label&amp;gt; &amp;lt;%= Html.TextBox("startDate")
%&amp;gt; &amp;lt;br /&amp;gt; &amp;lt;label for="endDate"&amp;gt;End Date:&amp;lt;/label&amp;gt; &amp;lt;%= Html.TextBox("endDate")%&amp;gt;
&amp;lt;br /&amp;gt; &amp;lt;input type="submit"/&amp;gt; &amp;lt;br /&amp;gt; &amp;lt;span id="result"/&amp;gt; &amp;lt;%
} %&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
If that is all your page does, you will notice that you get taken to a new page when
pressing Submit. The data on the new page is the HTML fragment returned by the AJAX
call, but that's all it contains (e.g. no master page), and it's clearly not replacing
the result span. 
&lt;p /&gt;
The reason for this is that I forgot to add the following lines to the &amp;lt;head&amp;gt;
section in the original page: &lt;pre&gt;&lt;code&gt; &amp;lt;script src='&amp;lt;%=ResolveUrl("~/Content/js/MicrosoftAjax.debug.js")%&amp;gt;'
type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt; &amp;lt;script src='&amp;lt;%=ResolveUrl("~/Content/js/MicrosoftMvcAjax.debug.js")%&amp;gt;'
type="text/javascript"&amp;gt;&amp;lt;/script&amp;gt; &lt;/code&gt;&lt;/pre&gt;
&lt;p /&gt;
After adding those declarations in, the content in the span tag is properly updated
and it looks like a real AJAX call.&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=a0a5275a-0c32-409a-b8f2-7b8e02ba71d5" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,a0a5275a-0c32-409a-b8f2-7b8e02ba71d5.aspx</comments>
      <category>.NET</category>
      <category>ASP.NET MVC</category>
    <feedburner:origLink>http://www.distribucon.com/blog/WhyAJAXPostsGoToANewPageInsteadOfUpdatingUpdateTargetId.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=60411c85-da2d-4907-8d0a-d0949d16ffee</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,60411c85-da2d-4907-8d0a-d0949d16ffee.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,60411c85-da2d-4907-8d0a-d0949d16ffee.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=60411c85-da2d-4907-8d0a-d0949d16ffee</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I've been on Facebook for a while, and
I just added Twitter to the mix. I'm trying to keep communications on those sites
much more informal and fairly non-technical. If you want to follow me, search for
dmiser@wi.rr.com on Facebook or danmiser on Twitter. Hope to see you over there.<img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=60411c85-da2d-4907-8d0a-d0949d16ffee" /></body>
      <title>Social networking</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,60411c85-da2d-4907-8d0a-d0949d16ffee.aspx</guid>
      <link>http://feedproxy.google.com/~r/distribucon/danmiser/~3/lkqvjXjL7m0/SocialNetworking.aspx</link>
      <pubDate>Sat, 25 Apr 2009 17:08:10 GMT</pubDate>
      <description>I've been on Facebook for a while, and I just added Twitter to the mix. I'm trying to keep communications on those sites much more informal and fairly non-technical. If you want to follow me, search for dmiser@wi.rr.com on Facebook or danmiser on Twitter. Hope to see you over there.&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=60411c85-da2d-4907-8d0a-d0949d16ffee" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,60411c85-da2d-4907-8d0a-d0949d16ffee.aspx</comments>
      <category>.NET</category>
    <feedburner:origLink>http://www.distribucon.com/blog/SocialNetworking.aspx</feedburner:origLink></item>
    <item>
      <trackback:ping>http://www.distribucon.com/blog/Trackback.aspx?guid=c8755312-f231-4981-8332-07422a11622a</trackback:ping>
      <pingback:server>http://www.distribucon.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.distribucon.com/blog/PermaLink,guid,c8755312-f231-4981-8332-07422a11622a.aspx</pingback:target>
      <dc:creator>Dan Miser</dc:creator>
      <wfw:comment>http://www.distribucon.com/blog/CommentView,guid,c8755312-f231-4981-8332-07422a11622a.aspx</wfw:comment>
      <wfw:commentRss>http://www.distribucon.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=c8755312-f231-4981-8332-07422a11622a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">Are you looking for a strong developer/architect
with a serious passion for all things technical and a unique blend of experience?
If so, feel free to <a href="mailto:dmiser@distribucon.com">email me</a>. My main
focus over the past couple of years has been on things ALT.NET-ish (e.g. ASP.NET MVC,
NHibernate, Spring.NET, etc.) while I have delved into a variety of other technologies
as well (e.g. Mindscape LightSpeed, LINQ, Dynamic Data, Delphi, etc.). If you know
of an opening - contract or full-time - please keep me in mind. I'd prefer to remain
in the Milwaukee area, but occasional travel wouldn't be the end of the world. 
<p />
Until the next technical post here, take care and thanks in advance.<img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=c8755312-f231-4981-8332-07422a11622a" /></body>
      <title>Looking for work</title>
      <guid isPermaLink="false">http://www.distribucon.com/blog/PermaLink,guid,c8755312-f231-4981-8332-07422a11622a.aspx</guid>
      <link>http://feedproxy.google.com/~r/distribucon/danmiser/~3/tRlBqMMsczE/LookingForWork.aspx</link>
      <pubDate>Wed, 22 Apr 2009 18:29:54 GMT</pubDate>
      <description>Are you looking for a strong developer/architect with a serious passion for all things technical and a unique blend of experience? If so, feel free to &lt;a href="mailto:dmiser@distribucon.com"&gt;email
me&lt;/a&gt;. My main focus over the past couple of years has been on things ALT.NET-ish
(e.g. ASP.NET MVC, NHibernate, Spring.NET, etc.) while I have delved into a variety
of other technologies as well (e.g. Mindscape LightSpeed, LINQ, Dynamic Data, Delphi,
etc.). If you know of an opening - contract or full-time - please keep me in mind.
I'd prefer to remain in the Milwaukee area, but occasional travel wouldn't be the
end of the world. 
&lt;p /&gt;
Until the next technical post here, take care and thanks in advance.&lt;img width="0" height="0" src="http://www.distribucon.com/blog/aggbug.ashx?id=c8755312-f231-4981-8332-07422a11622a" /&gt;</description>
      <comments>http://www.distribucon.com/blog/CommentView,guid,c8755312-f231-4981-8332-07422a11622a.aspx</comments>
      <category>.NET</category>
      <category>ALT.NET</category>
      <category>Delphi</category>
    <feedburner:origLink>http://www.distribucon.com/blog/LookingForWork.aspx</feedburner:origLink></item>
  </channel>
</rss>
