<?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: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/" version="2.0">

<channel>
	<title>Phil Derksen</title>
	
	<link>http://philderksen.com</link>
	<description>ASP.NET MVC &amp; jQuery development</description>
	<lastBuildDate>Mon, 23 Aug 2010 04:24:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/philderksen" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="philderksen" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">philderksen</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>April Fresno-area .NET user group wrap up</title>
		<link>http://philderksen.com/2010/04/april-fresno-area-net-user-group-wrap-up/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=april-fresno-area-net-user-group-wrap-up</link>
		<comments>http://philderksen.com/2010/04/april-fresno-area-net-user-group-wrap-up/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 22:26:13 +0000</pubDate>
		<dc:creator>Phil Derksen</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Fresno Tech]]></category>

		<guid isPermaLink="false">http://philderksen.com/?p=248</guid>
		<description><![CDATA[I haven&#8217;t been able to make it out to the Fresno-area .NET user group in a while, but I&#8217;m glad I did for the one this last Wednesday (held at Fresno State). The topic of the night was NHibernate (and several related technologies) given by Jeff Doolittle. Jeff&#8217;s the CTO of Lotpath (built on ASP.NET [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fphilderksen.com%2F2010%2F04%2Fapril-fresno-area-net-user-group-wrap-up%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fphilderksen.com%2F2010%2F04%2Fapril-fresno-area-net-user-group-wrap-up%2F&amp;source=philderksen&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>I haven&#8217;t been able to make it out to the <a href="http://www.centralcaldotnet.com/">Fresno-area .NET user group</a> in a while, but I&#8217;m glad I did for the one this last Wednesday (held at Fresno State).</p>
<p>The topic of the night was <a href="http://nhforge.org">NHibernate</a> (and several related technologies) given by Jeff Doolittle. Jeff&#8217;s the CTO of <a href="http://www.lotpath.com/">Lotpath</a> (built on ASP.NET MVC), so he and his company are definitely eating their own dogfood with what he presented. The <a href="http://www.agilification.com/post/NHibernate-Demo-Slides-and-Code.aspx">slides and code are available</a> which will be great for review for anyone diving into it.</p>
<p>After the presentation and questions, quite a bit of networking went on. I talked to several developers I hadn&#8217;t before, including a recent FSU grad who&#8217;s been developing iPhone and Android apps for <a href="http://www.watchdoit.com/">Watch Do It</a>. Swag, books and full-on software licenses were raffled out at the end as well (I won a copy of <a href="http://www.jetbrains.com/resharper/">ReSharper</a>!). Even after we were kicked out, several of us hit Doghouse Grill for another hour or so.</p>
<p>Needless to say, if you&#8217;re a developer in Fresno, this is definitely a good group to attend and meet other local geeks at. The subject matter spans quite a bit, half the time not even .NET specific. Thanks to <a href="http://www.tinyfit.com/">Gustavo Cavalcanti</a>, who&#8217;s been organizing this user group for some time now. <a href="mailto:gustavo@centralcaldotnet.com">Send him an email</a> if you want to get on the list. The next one is on May 13.</p>
<p>That being said, there&#8217;s also groups for <a href="http://groups.drupal.org/fresno">Drupal</a>, <a href="http://fresnodesignalliance.org">designers</a>, and <a href="http://www.facebook.com/smcfresno">social media</a>. I&#8217;m sure there&#8217;s more, so let us know.</p>
<p>In addition, check out the <a href="http://fresnotech.pbworks.com">Fresno-area techies wiki</a>. Request access, add yourself to the directory, and post any local events such as this one.</p>
<p>Next up: the <a href="http://www.59daysofcode.com/">59 Days of Code</a> kicks off on Friday, April 23 at 10pm. Hope to see some of you there!</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fphilderksen.com%2F2010%2F04%2Fapril-fresno-area-net-user-group-wrap-up%2F&amp;layout=standard&amp;&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px;height:30px;margin-top:5px;"></iframe>]]></content:encoded>
			<wfw:commentRss>http://philderksen.com/2010/04/april-fresno-area-net-user-group-wrap-up/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Zen, a web app built with ASP.NET MVC 2 and jQuery</title>
		<link>http://philderksen.com/2010/03/zen-a-web-app-built-with-asp-net-mvc-2-and-jquery/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=zen-a-web-app-built-with-asp-net-mvc-2-and-jquery</link>
		<comments>http://philderksen.com/2010/03/zen-a-web-app-built-with-asp-net-mvc-2-and-jquery/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 21:16:48 +0000</pubDate>
		<dc:creator>Phil Derksen</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://philderksen.com/?p=221</guid>
		<description><![CDATA[I was fortunate enough to attend Microsoft&#8217;s MIX conference for the first time this year. I learned a ton, jotted down hundreds of ideas for my projects, and had some valuable discussions with a lot of smart people. Obviously you have to attend in person to network, but fortunately all the videos and slides are [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fphilderksen.com%2F2010%2F03%2Fzen-a-web-app-built-with-asp-net-mvc-2-and-jquery%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fphilderksen.com%2F2010%2F03%2Fzen-a-web-app-built-with-asp-net-mvc-2-and-jquery%2F&amp;source=philderksen&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>I was fortunate enough to attend Microsoft&#8217;s <a href="http://live.visitmix.com/">MIX conference</a> for the first time this year. I learned a ton, jotted down hundreds of ideas for my projects, and had some valuable discussions with a lot of smart people.</p>
<p>Obviously you have to attend in person to network, but fortunately all the videos and slides are being made available online. Even for attendees this is great for review, but also because you inevitably miss a ton of sessions because of the schedule.</p>
<p>At the very end, I attended a great session by the co-founder and developer of <a href="http://www.agilezen.com/">Zen</a>, <a href="http://twitter.com/nkohari">Nate Kohari</a>. It&#8217;s a unique project management web app written in ASP.NET MVC 2 and jQuery. Nate&#8217;s the sole developer and this is his major product. It&#8217;s a business that charges for certain levels of usage, not a free-to-use or open source app created for fun. It was refreshing to go through something more in line with my own goals. <a href="http://live.visitmix.com/MIX10/Sessions/EX10">See the video and slides for yourself</a>.</p>
<p>Some of the technology Zen is using:</p>
<ul>
<li>ASP.NET MVC 2</li>
<li>jQuery &amp; <a href="http://jqueryui.com/">jQuery UI</a></li>
<li><a href="http://jsclass.jcoglan.com/">JS.Class</a> (OO JavaScript)</li>
<li><a href="http://nhforge.org">NHibernate</a> ORM</li>
<li><a href="http://sparkviewengine.codeplex.com/">Spark View Engine</a></li>
</ul>
<p>My plan is to convert <a href="http://outofeggs.com/">Out  of  Eggs</a> to ASP.NET MVC 2, then explore some of these other technologies for use within it and other projects I&#8217;m currently working on.</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fphilderksen.com%2F2010%2F03%2Fzen-a-web-app-built-with-asp-net-mvc-2-and-jquery%2F&amp;layout=standard&amp;&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px;height:30px;margin-top:5px;"></iframe>]]></content:encoded>
			<wfw:commentRss>http://philderksen.com/2010/03/zen-a-web-app-built-with-asp-net-mvc-2-and-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Announcing 59 Days of Code (a Fresno-area web &amp; mobile app competition)</title>
		<link>http://philderksen.com/2010/02/announcing-59-days-of-code/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=announcing-59-days-of-code</link>
		<comments>http://philderksen.com/2010/02/announcing-59-days-of-code/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 00:06:01 +0000</pubDate>
		<dc:creator>Phil Derksen</dc:creator>
				<category><![CDATA[Fresno Tech]]></category>

		<guid isPermaLink="false">http://philderksen.com/?p=209</guid>
		<description><![CDATA[I&#8217;m excited to announce the CVBI is officially kicking off a web &#38; mobile app showcase/competition for the Fresno area. 59daysofcode.com Fresnans know all too well that we&#8217;re not commonly referred to as a hub for tech startups and talent, so this is definitely a boon for the local community. Sure, I&#8217;m stoked to enter [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fphilderksen.com%2F2010%2F02%2Fannouncing-59-days-of-code%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fphilderksen.com%2F2010%2F02%2Fannouncing-59-days-of-code%2F&amp;source=philderksen&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>I&#8217;m excited to announce the <a href="http://cvbi.org/">CVBI</a> is officially kicking off a web &amp; mobile app showcase/competition for the Fresno area.</p>
<p><a href="http://59daysofcode.com">59daysofcode.com</a></p>
<p>Fresnans know all too well that we&#8217;re not commonly referred to as a hub for tech startups and talent, so this is  definitely a boon for the local community. Sure, I&#8217;m stoked to enter <a href="http://outofeggs.com">Out of Eggs</a> into the &#8220;In Progress&#8221; category of the contest. And it would definitely be nice to win a prize. But more importantly, I&#8217;m eager to see all the other apps that join in along with their enthusiasm and creativity. And will this competition significantly boost recognition of local talent by the community and investors? I sure hope so.</p>
<p>Also see:</p>
<p><a href="http://twitter.com/59daysOfCode">http://twitter.com/59daysOfCode</a><br />
<a href="http://blog.irmsgeekwork.com/2010/the-59daysofcode-web-mobile-apps-competition">http://blog.irmsgeekwork.com/2010/the-59daysofcode-web-mobile-apps-competition</a></p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fphilderksen.com%2F2010%2F02%2Fannouncing-59-days-of-code%2F&amp;layout=standard&amp;&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px;height:30px;margin-top:5px;"></iframe>]]></content:encoded>
			<wfw:commentRss>http://philderksen.com/2010/02/announcing-59-days-of-code/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Out of Eggs, a web app built in ASP.NET MVC, jQuery &amp; jQuery UI</title>
		<link>http://philderksen.com/2009/11/out-of-eggs-a-web-app-built-in-asp-net-mvc-jquery-jquery-ui/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=out-of-eggs-a-web-app-built-in-asp-net-mvc-jquery-jquery-ui</link>
		<comments>http://philderksen.com/2009/11/out-of-eggs-a-web-app-built-in-asp-net-mvc-jquery-jquery-ui/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 21:26:55 +0000</pubDate>
		<dc:creator>Phil Derksen</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://philderksen.com/?p=188</guid>
		<description><![CDATA[I&#8217;m excited to announce outofeggs.com, a web app I&#8217;ve been working on for a while. It&#8217;s built on the techniques I&#8217;ve gone through in my Categorized Item List series (using ASP.NET MVC, jQuery &#38; jQuery UI). Just create a list and see for yourself. The back end is SQL Server 2008. It probably goes without [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fphilderksen.com%2F2009%2F11%2Fout-of-eggs-a-web-app-built-in-asp-net-mvc-jquery-jquery-ui%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fphilderksen.com%2F2009%2F11%2Fout-of-eggs-a-web-app-built-in-asp-net-mvc-jquery-jquery-ui%2F&amp;source=philderksen&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>I&#8217;m excited to announce <a href="http://outofeggs.com">outofeggs.com</a>, a web app I&#8217;ve been working on for a while. It&#8217;s built on the techniques I&#8217;ve gone through in my <a href="http://philderksen.com/2009/06/series-for-drag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc/">Categorized Item List</a> series (using ASP.NET MVC, jQuery &amp; jQuery UI). Just create a list and see for yourself. The back end is SQL Server 2008.</p>
<p>It probably goes without saying that I could use any and all feedback: bugs that pop up, features you&#8217;d like to see, usability issues, etc. Also let me know if there&#8217;s any development-related aspects of the app you&#8217;d like me to share in a post that I haven&#8217;t covered yet.</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fphilderksen.com%2F2009%2F11%2Fout-of-eggs-a-web-app-built-in-asp-net-mvc-jquery-jquery-ui%2F&amp;layout=standard&amp;&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px;height:30px;margin-top:5px;"></iframe>]]></content:encoded>
			<wfw:commentRss>http://philderksen.com/2009/11/out-of-eggs-a-web-app-built-in-asp-net-mvc-jquery-jquery-ui/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Drag and Drop Categorized Item List with jQuery and ASP.NET MVC – Part 4</title>
		<link>http://philderksen.com/2009/10/drag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc-part-4/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=drag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc-part-4</link>
		<comments>http://philderksen.com/2009/10/drag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc-part-4/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 16:15:20 +0000</pubDate>
		<dc:creator>Phil Derksen</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://philderksen.com/?p=175</guid>
		<description><![CDATA[Controllers and AJAX This is part 4 of a series. In this post I’ll go through the controller classes and how to use jQuery and AJAX to update the database with the position (or state) of where each section and item is moved to. Every section can be dragged and dropped into any of the [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fphilderksen.com%2F2009%2F10%2Fdrag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc-part-4%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fphilderksen.com%2F2009%2F10%2Fdrag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc-part-4%2F&amp;source=philderksen&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p><strong>Controllers and AJAX</strong></p>
<p>This is part 4 of a <a href="http://philderksen.com/2009/06/01/series-for-drag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc/">series</a>. In this post I’ll go through the controller classes and how to use jQuery and AJAX to update the database with the position (or state) of where each section and item is moved to.</p>
<p>Every section can be dragged and dropped into any of the 4 columns and in any position within that column. This is the reason for both the ColumnNum and SortOrder fields of the Sections table described in <a href="http://philderksen.com/2009/07/17/drag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc-part-2/">part 2</a>.</p>
<p>First we’ll dive into jQuery. Going back to our sortable() call for the sections, we need to add code that fires after an update event. The important thing to note here is that the update event will fire for both the column moving from and to. If moving within the same column, it’ll fire only once.</p>
<p>As set up in <a href="http://philderksen.com/2009/09/02/drag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc-part-3/">part 3</a>, the column num is stored in the id attribute of the “listColumn” div, so with a little parsing we can retrieve the column who’s state just changed.</p>
<p>Next we’ll need the new order of the sections within each changed column. The sortable(“serialize”) call forms the section IDs into a “form/ajax submittable string” like this:</p>
<p>section[]=3&amp;section[]=1&amp;section[]=4</p>
<p>For more detail see the <a href="http://jqueryui.com/demos/sortable">jQuery UI sortable</a> page. Look under Methods &gt; serialize.</p>
<p>Now we’ll do an AJAX post to a method within the section controller we’ll create below. Here’s the resulting jQuery:</p>
<pre class="brush: js;">function InitSectionSorting()
{
    $(".listColumn").sortable(
    {
        …,
        //update event fires both for column leaving and receiving
        update: function(event, ui)
        {
            //Extract column num from current div id
            var colNum = $(this).attr("id").replace(/col_/, "");

            $.post("/Section/UpdateSortOrder",
            { columnNum: colNum, sectionIdQueryString: $(this).sortable("serialize") });
        }
    });
}</pre>
<p>In SectionController.cs, we’ll now code the UpdateSortOrder method to receive the serialized string from jQuery and pass it as a string array to it’s model class.</p>
<pre class="brush: csharp;">[AcceptVerbs(HttpVerbs.Post)]
public ActionResult UpdateSortOrder(int columnNum, string sectionIdQueryString)
{
    string[] separator = new string[2] { "section[]=", "&amp;" };
    string[] sectionIdArray = sectionIdQueryString.Split(separator, StringSplitOptions.RemoveEmptyEntries);

    secRepo.UpdateSortOrder(columnNum, sectionIdArray);
    secRepo.Save();

    return Content("Success");
}</pre>
<p>The return Content(“Success”) is simply to see that the update was successful using <a href="http://getfirebug.com/">Firebug</a>. You should see the text “Success” within Firebug’s Console tab after you drag and drop a section. It’s optional so you can remove it.</p>
<p>Now on to Items. They can be moved to any section and in any position, so the jQuery and controller code is almost the same Sections.</p>
<p>jQuery:</p>
<pre class="brush: js;">function InitItemSorting()
{
    $(".itemList").sortable(
    {
        ...,
        //update event fires both for item list leaving and receiving
        update: function(event, ui)
        {
            //Extract section id from parent section box
            var sectionId = $(this).closest(".secBox").attr("id").replace(/section_/, "");

            $.post("/Item/UpdateSortOrder",
                { sectionId: sectionId, itemIdQueryString: $(this).sortable("serialize") });
        }
    });
}</pre>
<p>ItemController.cs:</p>
<pre class="brush: csharp;">[AcceptVerbs(HttpVerbs.Post)]
public ActionResult UpdateSortOrder(long sectionId, string itemIdQueryString)
{
    string[] separator = new string[2] { "item[]=", "&amp;" };
    string[] itemIdArray = itemIdQueryString.Split(separator, StringSplitOptions.RemoveEmptyEntries);

    itemRepo.UpdateSortOrder(sectionId, itemIdArray);
    itemRepo.Save();

    return Content("Success");
}</pre>
<p>In a later series we’ll cover editing the text of (and deleting) sections and items.</p>
<h3><a href="http://philderksen.com/wp-content/uploads/2009/10/2009-10-08_CategorizedItemsListDemo.zip">Download the source code</a> (requires Visual Studio 2008 and ASP.NET MVC 1.0)</h3>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fphilderksen.com%2F2009%2F10%2Fdrag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc-part-4%2F&amp;layout=standard&amp;&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px;height:30px;margin-top:5px;"></iframe>]]></content:encoded>
			<wfw:commentRss>http://philderksen.com/2009/10/drag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc-part-4/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>12 Mbps+ Broadband Internet Options in Fresno, CA (Fall 2009)</title>
		<link>http://philderksen.com/2009/09/broadband-internet-options-in-fresno-ca-fall-2009/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=broadband-internet-options-in-fresno-ca-fall-2009</link>
		<comments>http://philderksen.com/2009/09/broadband-internet-options-in-fresno-ca-fall-2009/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 23:20:53 +0000</pubDate>
		<dc:creator>Phil Derksen</dc:creator>
				<category><![CDATA[Fresno Tech]]></category>

		<guid isPermaLink="false">http://philderksen.com/2009/09/16/high-speed-broadband-internet-options-in-fresno-ca-fall-2009/</guid>
		<description><![CDATA[It’s Fall 2009 and time to upgrade my home internet service. For all those in Fresno, Clovis and the central valley area with similar needs to mine, hopefully this helps. In Fresno the only real options I know of are AT&#38;T (DSL or “U-verse”) and Comcast (cable). For the last few years we’ve had AT&#38;T’s [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fphilderksen.com%2F2009%2F09%2Fbroadband-internet-options-in-fresno-ca-fall-2009%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fphilderksen.com%2F2009%2F09%2Fbroadband-internet-options-in-fresno-ca-fall-2009%2F&amp;source=philderksen&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>It’s Fall 2009 and time to upgrade my home internet service. For all those in Fresno, Clovis and the central valley area with similar needs to mine, hopefully this helps.</p>
<p>In Fresno the only real options I know of are AT&amp;T (DSL or “U-verse”) and Comcast (cable). For the last few years we’ve had AT&amp;T’s DSL Elite (6 Mbps @ $35/month), and that’s been fine, but a few things have changed…</p>
<p><strong>We need more speed&#8230;12 Mbps+ speed!<br />
</strong>Yes, 6 Mbps downstream is a lot already, but these days we’re watching HD-quality video from <a href="http://www.netflix.com">Netflix</a>, <a href="http://www.hulu.com">Hulu</a> and other sources (usually streamed or live). The kicker is my wife is now uploading 10+ gigs of pics after a <a href="http://www.derksenphotographyblog.com/2009/09/16/cabo-san-lucas-mexico/">weekend photo shoot</a> and our 768 Kbps upstream just isn’t cutting it. Here are my &#8220;before&#8221; speed tests:</p>
<p><img class="alignnone" title="AT&amp;T DSL 6 Mbps 1" src="http://www.speedtest.net/result/572385241.png" alt="" width="300" height="135" /> <img class="alignnone" title="AT&amp;T DSL 6 Mbps 2" src="http://www.speedtest.net/result/572385859.png" alt="" width="300" height="135" /></p>
<p><strong>We don’t need a home phone line.<br />
</strong>Actually we haven’t needed one for a while with two cell phones. But now there’s <a href="http://www.google.com/voice">Google Voice</a> for an extra phone number or <a href="http://www.skype.com">Skype</a> and other <a href="http://en.wikipedia.org/wiki/VOIP">VOIP</a> services. Cell service has gotten better at our house recently as well.</p>
<p><strong>We don’t need cable or satellite TV.<br />
</strong>Our current setup consists of a <a href="http://www.tivo.com/dvr-products/tivo-hd-dvr/index.html">Tivo HD DVR</a> with integrated Netflix streaming and <a href="http://www.amazon.com/videoondemand">Amazon VoD</a>. I get excellent HD reception for over-the-air broadcast channels with an outdoor antenna. Plus there are plenty of <a href="http://www.redbox.com">Redbox</a> kiosks and <a href="http://www.blockbuster.com">Blockbusters</a> around the corner while the physical medium for movies still exists. This probably won’t work for hard core sports or movie enthusiasts, but it does for me, my wife and my kids.</p>
<p><strong>Bottom line:</strong> We need faster internet and nothing else for our home. So what’s the best deal…</p>
<p>As usual, both AT&amp;T and Comcast try to bundle packages together. They want you to buy it all: internet, phone and TV. For years it’s always been a hassle to subscribe to their services a la carte. For this reason I had to start on online chat with both companies to work out a deal. At least this removes the hassle of doing it over the phone. Usually someone responds via chat within minutes if not immediately.</p>
<p>Obviously internet coverage will vary by specific location, but here are the options I had at my address in 93720.</p>
<h3><a href="http://www.att.com/u-verse/explore/internet-landing.jsp">AT&amp;T U-Verse</a></h3>
<p>DSL only goes up to 6 Mbps downstream currently, but U-Verse has 12 Mbps and 18 Mpbs downstream options ($55 and $65/month respectively). I assume 1-2 Mbps upstream but I forgot to ask and it doesn’t say.</p>
<p>At first they said I needed to subscribe to at least their TV service in addition to internet to get the $55/month internet price. I said I wasn’t interested and they changed it to no TV service required but a $150 installation charge. Not great, but at least there’s no contract.<a href="http://www.comcast.com/shop/buyflow2/products.cspx?SourcePage=Internet"><strong> </strong></a></p>
<h3><a href="http://www.comcast.com/shop/buyflow2/products.cspx?SourcePage=Internet">Comcast Cable</a></h3>
<p>They have the same 12 Mbps and 18 Mbps downstream options for cheaper than DSL ($43 and $53 respectively). Like AT&amp;T, there’s no contract, but they try and steer you away from a la carte. But in chat I got the “stand-alone” internet offer out of them and whittled it down from a $100 to a $50 installation charge. Tack on $3/month for the modem and I’m at $45/month. They also state a 2 Mbps upstream which if even close is awesome.</p>
<h3>Winner: Comcast</h3>
<p>Bottom line: <span style="text-decoration: line-through;">$10/month cheaper and a $100 cheaper install than AT&amp;T.</span> $17/month cheaper and a $125 cheaper install than AT&amp;T. Pretty easy decision.</p>
<p><strong>Update 9/21/09</strong></p>
<p>Comcast&#8217;s website and online chat say one thing (see below), but when I called 1-800-COMCAST, I found out the above applies to the bay area and not Fresno. What they offer here past their 6 Mbps package is a 16 Mbps package (not 12 or 18) with a 2 Mbps upstream.</p>
<p>The cost is cheaper $35/month + $3/month modem rental + $25 install, but it&#8217;s only good for a year. It&#8217;s not a contract though, so you can cancel anytime. I scheduled my install and plan on doing just that as after a year it doubles to $70/month. At that point I&#8217;ll shop around again for the best deal or attempt to negotiate the existing one.</p>
<p><strong>Update 9/24/09</strong></p>
<p>The Comcast guy just left my house. Initial speed tests rock!</p>
<p><img class="alignnone" title="Comcast Cable 16 Mbps 1" src="http://www.speedtest.net/result/573785558.png" alt="" width="300" height="135" /> <img class="alignnone" title="Comcast Cable 16 Mbps 2" src="http://www.speedtest.net/result/573786615.png" alt="" width="300" height="135" /></p>
<p>The Comcast guy said I should see speeds &#8220;burst&#8221; when downloading larger files or streaming. And BTW, he also claimed that by the end of this year Comcast is rolling out <strong>50 Mbps downstream / 12 Mbps upstream</strong> to all cable modem subscribers in Fresno with this same package. Their lower-cost 6 Mbps downstream package should also double in speed.</p>
<p><strong>Update 10/28/09</strong></p>
<p><a href="http://www.thebusinessjournal.com/tech/2778-comcast-launches-wideband-in-central-valley">The Business Journal reports</a> Comcast&#8217;s &#8220;wideband&#8221; 50 mb/sec is also coming soon. I&#8217;ll post here with new speed tests when I&#8217;m upgraded.</p>
<p><strong>Update 12/4/09</strong></p>
<p>The cost of the modem rental went from $3/month to $5/month (making my cost now $40/month). Tweeted <a href="http://twitter.com/comcastcares">@comcastcares</a> and they said the <a href="http://amzn.com/B001UI2FPE">Motorola SB6120</a> (currently $93) is a good one. Considering buying it.</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fphilderksen.com%2F2009%2F09%2Fbroadband-internet-options-in-fresno-ca-fall-2009%2F&amp;layout=standard&amp;&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px;height:30px;margin-top:5px;"></iframe>]]></content:encoded>
			<wfw:commentRss>http://philderksen.com/2009/09/broadband-internet-options-in-fresno-ca-fall-2009/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Drag and Drop Categorized Item List with jQuery and ASP.NET MVC – Part 3</title>
		<link>http://philderksen.com/2009/09/drag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc-part-3/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=drag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc-part-3</link>
		<comments>http://philderksen.com/2009/09/drag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc-part-3/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 17:50:49 +0000</pubDate>
		<dc:creator>Phil Derksen</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://philderksen.com/?p=145</guid>
		<description><![CDATA[Views and Partial Views This is part 3 of a series. In this post I&#8217;ll go through each of the Views (and the List controller). In this post In part 4 I’ll go through the controller classes and how to use jQuery and AJAX to update the database. We already have the three repository classes [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fphilderksen.com%2F2009%2F09%2Fdrag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc-part-3%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fphilderksen.com%2F2009%2F09%2Fdrag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc-part-3%2F&amp;source=philderksen&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<h3><strong>Views and Partial Views</strong></h3>
<p>This is part 3 of a <a href="http://philderksen.com/2009/06/01/series-for-drag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc/">series</a>. In this post I&#8217;ll go through each of the Views (and the List controller). <span style="text-decoration: line-through;">In this post</span> In part 4 I’ll go through the controller classes and how to use jQuery and AJAX to update the database.</p>
<p>We already have the three repository classes in the Models folder. Now we need to add three controller classes to the Controllers folder: ListController.cs, SectionController.cs (for categories) and ItemController.cs.</p>
<p>Next we’ll create a proper View for individual list records. For now we’ll continue to use the single hardcoded list record, so we’ll redirect from the Home controller/Index action to the List controller/Details action with the ID of 1. The List controller code is simply:</p>
<pre class="brush: csharp;">using CategorizedItemsListDemo.Models;

namespace CategorizedItemsListDemo.Controllers
{
    public class ListController : Controller
    {
        private ListRepository listRepo = new ListRepository();

        public ActionResult Details(long id)
        {
            List singleList = listRepo.GetById(id);
            return View(singleList);
        }
    }
}</pre>
<p>For now we don’t need to code up anything in the Section and Item controller classes, so we’ll move on to the views. The parent view we’ll use is the List/Details view. Since we’ll be looping through to add child Section records to the List record, and child Item records to each Section record, we’ll create two “partial views” (one for individual sections, one for individual items). This way user interface markup can be encapsulated without being repetitive (remember DRY – don’t repeat yourself).</p>
<p>Coming from an ASP.NET WebForms background, I equate partial views to the MVC way of doing user controls. They in fact use the same .ascx extension. I also added them to the /Views/Shared folder so the MVC engine can easily locate them. To sum it up, here are the three views added and the containing code:</p>
<p><strong>/Views/List/Details.aspx</strong></p>
<pre class="brush: csharp;">&lt;% for (int i = 1; i &lt;= 4; i++) { %&gt;
    &lt;div class="grid_3 listColumn" id="col_&lt;% =i %&gt;"&gt;
        &lt;% foreach (Section sec in Model.Sections.Where(s =&gt; s.ColumnNum == i).OrderBy(s =&gt; s.SortOrder)) { %&gt;
            &lt;% Html.RenderPartial("SingleSection", sec); %&gt;
        &lt;% } %&gt;
    &lt;/div&gt;
&lt;% } %&gt;</pre>
<p>Here the outside loop is simply going through each of the four columns setting the id attribute to the record id for use in jQuery. The inner loop is going through each Section in the List record (referenced by “Model” since the view is bound to the List model class). It simply uses a Lambda expression to render the Sections in the correct columns in the correct order. Then it passes off each individual Section to the SingleSection partial view.</p>
<p><strong>/Views/Shared/SingleSection.ascx</strong></p>
<pre class="brush: csharp;">&lt;div class="secBox" id="section_&lt;%= Model.SectionId %&gt;"&gt;
    &lt;div class="secHeader"&gt;
        &lt;h2 class="secName"&gt;&lt;%= Html.Encode(Model.SectionName) %&gt;&lt;/h2&gt;
    &lt;/div&gt;

    &lt;div class="itemBox"&gt;
        &lt;ul class="itemList"&gt;
            &lt;% foreach (Item item in Model.Items.OrderBy(i =&gt; i.SortOrder)) { %&gt;
                &lt;% Html.RenderPartial("SingleItem", item); %&gt;
            &lt;% } %&gt;
        &lt;/ul&gt;
    &lt;/div&gt;
&lt;/div&gt;</pre>
<p>Here we’re basically applying the same format from the List view to the Section partial view. Each Section is surrounded by a div with the id attribute set to the record id. “Model” is now bound to the Section model class, which we then use to display the Section name and loop through child Item records. We display Items in the correct sort order using a Lambda expression, then pass off each Item record to another partial view.</p>
<p><strong>/Views/Shared/SingleItem.ascx</strong></p>
<pre class="brush: csharp;">&lt;li class="itemRow" id="item_&lt;%= Model.ItemId %&gt;"&gt;
    &lt;span class="itemName"&gt;&lt;%= Html.Encode(Model.ItemName) %&gt;&lt;/span&gt;
&lt;/li&gt;</pre>
<p><span style="font-family: verdana"> </span></p>
<p><span style="font-family: verdana">This partial view is the simplest (for now). Again the id attribute is set to the record id. After that we simply render the item name.</span></p>
<p>That’s it. Now the app is rendering real data using MVC views. Nothing is hardcoded. To get things looking like they did in the initial layout, I populated the SQL database with sample data.</p>
<h3><a href="http://philderksen.com/wp-content/uploads/2009/09/2009-09-02_CategorizedItemsListDemo.zip">Download the source code</a> (requires Visual Studio 2008 and ASP.NET MVC 1.0)</h3>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fphilderksen.com%2F2009%2F09%2Fdrag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc-part-3%2F&amp;layout=standard&amp;&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px;height:30px;margin-top:5px;"></iframe>]]></content:encoded>
			<wfw:commentRss>http://philderksen.com/2009/09/drag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc-part-3/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Tech Company Mentality in Fresno</title>
		<link>http://philderksen.com/2009/07/tech-company-mentality-in-fresno/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=tech-company-mentality-in-fresno</link>
		<comments>http://philderksen.com/2009/07/tech-company-mentality-in-fresno/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 17:10:36 +0000</pubDate>
		<dc:creator>Phil Derksen</dc:creator>
				<category><![CDATA[Fresno Tech]]></category>

		<guid isPermaLink="false">http://philderksen.com/?p=125</guid>
		<description><![CDATA[My friend Robert Schultz recently gave his opinion on software programmer mentality in Fresno. I personally think it speaks to a larger issue going on with tech companies themselves in the Fresno/Clovis area. I was born and raised in Fresno, and for at least 90% of the last 12 years I&#8217;ve been a full-time software [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fphilderksen.com%2F2009%2F07%2Ftech-company-mentality-in-fresno%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fphilderksen.com%2F2009%2F07%2Ftech-company-mentality-in-fresno%2F&amp;source=philderksen&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<p>My friend Robert Schultz recently gave his opinion on <a href="http://www.robertschultz.org/2009/07/22/software-programmer-mentality-in-fresno/">software programmer mentality in Fresno</a>. I personally think it speaks to a larger issue going on with tech companies themselves in the Fresno/Clovis area.</p>
<p>I was born and raised in Fresno, and for at least 90% of the last 12 years I&#8217;ve been a full-time software developer for 6 different companies in the area. I hate to say it, but with most of them it was only about a year or two before I had to put in my resignation. They all had great people and great potential. But there was always some big setback that eventually caused me to leave.</p>
<p>Most recently my issues with these companies have been with both business direction and how they valued their developers. As engineers, we want to create and have our ideas listened to and our accomplishments valued. Lack of this is the main fault of most of the places I&#8217;ve worked for in Fresno (some more than others of course). Developers should never be treated as just &#8220;task monkeys&#8221; and handed a to-do list of specific items to check off. Many fall into that trap simply because that&#8217;s how it&#8217;s been for them for so long. At the point that it becomes &#8220;just a job&#8221; and they can&#8217;t wait until the clock hits 5 or 6 every day, and that&#8217;s only if they&#8217;re lucky and not forced into overtime.</p>
<p>Some of us have entrepreneurial aspirations and some do not, and that&#8217;s fine. But I think all developers want to contribute ideas and be in on the decision-making process wherever we work. We want to innovate all the time, and from my experience companies around here give little effort if at all to encouraging this process. At companies like Google it’s part of your job description. It’s no secret that sometimes half  their new services came out of their “innovation time” policy. Plenty of startups elsewhere do something similar. Managers and company owners need to be open with their business goals and ask their people to openly discuss ideas and company direction. I know I would enjoy my job more if that was part of my responsibilities.</p>
<p>And I don&#8217;t think companies realize this, but with poor developer treatment  they are taking a huge hit in efficiency. Projects start going in the wrong direction because they&#8217;re not listening to their people. In turn employees start working at a 25% motivation level because they don&#8217;t feel valued. The company starts falling way behind in current technology. Then developers stuck in this old technology realize they&#8217;re not going anywhere with their skills. It&#8217;s a vicious cycle. Developers that get fed up start looking elsewhere for something better, and when they have a tough time finding a better job around Fresno, they leave. That&#8217;s part of the &#8220;brain drain&#8221; we hear about.</p>
<p>Back to company mentality, we&#8217;re still behind in technology for the most part in Fresno from what I&#8217;ve experienced. Where are the companies really using social media or blogging regularly? Why do I still hear more about building Windows apps than mobile apps? Why do all these local companies spend so much time and money hosting their own servers (for internal use or external clients) instead of co-locating? It isn&#8217;t new news anymore that using cloud services (Google, Amazon or otherwise) are much more reliable, speedier and secure. Why are people still maintaining Exchange servers and installing Office on every workstation? Even Microsoft, who benefits from all the companies sticking with “classic” Exchange and Office setups realizes this is inevitable. They can host Exchange for you and are coming out with a <a href="http://www.techcrunch.com/2009/07/13/the-complete-guide-to-microsofts-office-2010/">browser-based version of Office 2010</a>. Even <a href="http://arstechnica.com/software/news/2008/10/washington-dc-latest-to-drop-microsoft-for-web-apps.ars">Washington DC moved to Google Apps</a>. At least consider <a href="http://www.buzzmachine.com/what-would-google-do/">What Would Google Do?</a> This is 2009 people!</p>
<p>Myself and a handful of good developers I know in Fresno are very rooted here and thus determined to find the best place to work that they can. (That or start their own company). For me it&#8217;s because family and friends around here come before my career. Take that away from me and I&#8217;m out to bigger &#8220;tech hubs.&#8221; I know personally some good developers here that aren’t as rooted are just waiting for the right opportunity to leave. The business case for local startups <a href="http://www.robertschultz.org/2009/06/30/outsourcing-plasticjungle-to-the-silicon-jungle/">Plastic Jungle</a> (only local company I’ve seen on <a href="http://www.techcrunch.com/2009/05/21/plastic-jungle-scores-48-million-for-gift-card-marketplace/">TechCrunch</a>) and <a href="http://thebusinessjournal.com/index.php/view-all-blogs/viewpost/1109.html">Vine Global</a> (winner of last year’s <a href="http://fresnobeehive.com/news/2008/10/vine_global_wins_start_it_up_c.html">Start-It-Up contest</a>) to stay put were not enough, so recently they both left.</p>
<p>On behalf of all software developers in Fresno and Clovis (let alone the startup scene and effect on the economy locally), I sure hope this trend turns around soon.</p>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fphilderksen.com%2F2009%2F07%2Ftech-company-mentality-in-fresno%2F&amp;layout=standard&amp;&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px;height:30px;margin-top:5px;"></iframe>]]></content:encoded>
			<wfw:commentRss>http://philderksen.com/2009/07/tech-company-mentality-in-fresno/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Drag and Drop Categorized Item List with jQuery and ASP.NET MVC – Part 2</title>
		<link>http://philderksen.com/2009/07/drag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc-part-2/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=drag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc-part-2</link>
		<comments>http://philderksen.com/2009/07/drag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc-part-2/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 18:45:33 +0000</pubDate>
		<dc:creator>Phil Derksen</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://philderksen.com/?p=108</guid>
		<description><![CDATA[Database and Model Classes This is part two of a series. In this part I’ll describe the database structure and create the model classes needed for basic database interaction. To keep things simple, I went with a SQL Server 2005 Express database as it’s free and easy to create within Visual Studio 2008. To create [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fphilderksen.com%2F2009%2F07%2Fdrag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc-part-2%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fphilderksen.com%2F2009%2F07%2Fdrag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc-part-2%2F&amp;source=philderksen&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<h3><strong>Database and Model Classes</strong></h3>
<p>This is part two of a <a href="http://philderksen.com/2009/06/01/series-for-drag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc/">series</a>. In this part I’ll describe the database structure and create the model classes needed for basic database interaction.</p>
<p>To keep things simple, I went with a SQL Server 2005 Express database as it’s free and easy to create within Visual Studio 2008. To create one, simply right-click on the App_Data folder and select SQL Server database. I named mine ListDemo.mdf.</p>
<p>After the database has been created, double-click on the new .mdf file to open it up. I created three tables: Lists, Sections and Items. Here’s the final database structure:</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="2009-07-15_db_diagram" src="http://philderksen.com/wp-content/uploads/2009/07/20090715_db_diagram1.png" border="0" alt="2009-07-15_db_diagram" width="352" height="616" /></p>
<p>Make sure to set the keys and relationships appropriately. The first ID field of each table should be the primary key and set to auto-increment. I also recommend turning on cascade delete to make deleting whole sections or lists easier. I’ll get into tying the lists table to a users table later.</p>
<p>In the Sections table, the ColumnNum field is to indicate which of the four DIV columns each section resides in. Values must be between 1 and 4. Once narrowed down to a column, sections are sorted by their SortOrder value. Likewise, in the Items table items are sorted within sections by their SortOrder value.</p>
<p>For now I manually created one record in the List table and named it “Demo List 1”.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="2009-07-15_list_table" src="http://philderksen.com/wp-content/uploads/2009/07/20090715_list_table.png" border="0" alt="2009-07-15_list_table" width="249" height="91" /></p>
<p>On to the “M” (models) in MVC. Again to keep it simple and quick, I chose to use <a href="http://msdn.microsoft.com/en-us/library/bb386976%28loband%29.aspx">LINQ to SQL</a> even though you could argue I should use <a href="http://msdn.microsoft.com/en-us/library/bb386964%28loband%29.aspx">LINQ to Entities</a>. I added a “LINQ to SQL Classes” item to the Models folder and named it ListDemo.dbml to match the database file. At this point the LINQ to SQL designer should pop open. Just drag the Sections, Lists and Items tables from the database view in the Server Explorer to the designer. When you click Save the LINQ to SQL code is generated for you behind behind the scenes. To view it look at the code-behind file for ListDemo.dbml.</p>
<p>Following a simple MVC convention, I created a model class for each table with the name ending in “Repository.” Specifically, ListRepository.cs, SectionRepository.cs and ItemRepository.cs (saved to the Models folder). Declared at the top of each class is a variable that references the data context. In each of the three classes I needed a method to retrieve a single record by ID. I called this GetById and used the <a href="http://msdn.microsoft.com/en-us/library/bb397947%28loband%29.aspx">Lambda/Method syntax</a> of LINQ. It’s virtually the same in all three classes, but here’s the code for SectionRepository.cs:</p>
<pre class="brush: csharp;">public class SectionRepository
{
    private ListDemoDataContext db = new ListDemoDataContext();

    public Section GetById(long id)
    {
        return db.Sections.Single(s =&gt; s.SectionId == id);
    }
}</pre>
<p>For now I’m going to ignore the ListRepository class since I’m just dealing with the single List record for now. In the Section and Item classes, next I coded up the Insert, Delete and Save methods. In all 3 methods I’m referencing the DataContext object, which has the already generated InsertOnSubmit(), DeleteOnSubmit() and SubmitChanges() methods (among others) in the LINQ to SQL auto-generated code. Here’s the code in SectionRepository.cs, but again it’s very similar in ItemRepository.cs:</p>
<pre class="brush: csharp;">public void Insert(Section sec)
{
    sec.SortOrder = GetNextSectionSortOrderValueByListIdColumnNum(sec.ListId, sec.ColumnNum);
    db.Sections.InsertOnSubmit(sec);
}

public void Delete(Section sec)
{
    //Items deleted via SQL cascade delete
    db.Sections.DeleteOnSubmit(sec);
}

public void Save()
{
    db.SubmitChanges();
}</pre>
<p>When a Section or Item record is inserted, it needs to have a SortOrder value that is one higher than the max SortOrder value that already exists within it’s group (all items within a section, or all sections within a column). Using LINQ I created a private method in each of these two classes to retrieve this value before saving the record. In SectionRepository.cs:</p>
<pre class="brush: csharp;">private int GetNextSectionSortOrderValueByListIdColumnNum(long listId, int colNum)
{
    //Max value is null if no items yet
    int? highestSortValue = (from s in db.Sections
                             where (s.ListId == listId) &amp;&amp; (s.ColumnNum == colNum)
                             select (int?)s.SortOrder).Max();

    return (highestSortValue ?? 0) + 1;
}</pre>
<p>When we drag sections or items around, we are basically re-ordering the SortOrder value (and possibly changing the ColumnNum value for sections). jQuery can pass a string of separated ID values when posting to the server via AJAX, so I created the method UpdateSortOrder with a ColumnNum (for Sections) or SectionId (for Items) parameter along with a string array parameter in the two repositories. In SectionRepository.cs:</p>
<pre class="brush: csharp;">public void UpdateSortOrder(int columnNum, string[] sectionIds)
{
    for (int i = 0; i &lt; sectionIds.Length; i++)
    {
        Section section = GetById(long.Parse(sectionIds[i]));
        section.ColumnNum = columnNum;
        section.SortOrder = i + 1;
    }
}</pre>
<p>To see the final code for all three repository classes, download the sample project at the end of this post.</p>
<p>I know there’s no UI updates in this part of the series, but it’s important to get the database and model classes established before moving on.</p>
<h3><a href="http://philderksen.com/wp-content/uploads/2009/07/2009-07-17_CategorizedItemsListDemo.zip">Download the source code</a> (requires Visual Studio 2008 and ASP.NET MVC 1.0)</h3>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fphilderksen.com%2F2009%2F07%2Fdrag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc-part-2%2F&amp;layout=standard&amp;&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px;height:30px;margin-top:5px;"></iframe>]]></content:encoded>
			<wfw:commentRss>http://philderksen.com/2009/07/drag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc-part-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Drag and Drop Categorized Item List with jQuery and ASP.NET MVC – Part 1</title>
		<link>http://philderksen.com/2009/06/drag-and-drop-categorized-item-list-with-jquery-and-aspnet-mvc-part-1/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=drag-and-drop-categorized-item-list-with-jquery-and-aspnet-mvc-part-1</link>
		<comments>http://philderksen.com/2009/06/drag-and-drop-categorized-item-list-with-jquery-and-aspnet-mvc-part-1/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 22:35:51 +0000</pubDate>
		<dc:creator>Phil Derksen</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.philderksen.com/?p=76</guid>
		<description><![CDATA[Initial Layout and jQuery Setup There are plenty of to-do lists out there where you can drag and drop to sort individual items, but I wanted to take it a step further and introduce categories. I wanted the categories containing the items to be sortable themselves, and not just within one column but several so [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fphilderksen.com%2F2009%2F06%2Fdrag-and-drop-categorized-item-list-with-jquery-and-aspnet-mvc-part-1%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fphilderksen.com%2F2009%2F06%2Fdrag-and-drop-categorized-item-list-with-jquery-and-aspnet-mvc-part-1%2F&amp;source=philderksen&amp;style=normal&amp;service=bit.ly" height="61" width="50" /><br />
			</a>
		</div>
<h3><strong>Initial Layout and jQuery Setup</strong></h3>
<p>There are plenty of to-do lists out there where you can drag and drop to sort individual items, but I wanted to take it a step further and introduce categories. I wanted the categories containing the items to be sortable themselves, and not just within one column but several so it would maximize use of the web page layout’s width. The main use case I had in mind was for a grocery list, where type of food would be the categories. But it could be used for other things like a movie collection (genres as categories) or a sports league player roster (team names as categories).</p>
<p>This is part one in a <a href="http://philderksen.com/2009/06/01/series-for-drag-and-drop-categorized-item-list-with-jquery-and-asp-net-mvc/">series</a>. In this post I’ll go through the initial layout and jQuery setup. In future posts I’ll go through the ASP.NET MVC setup in detail along with the database interaction.</p>
<p>For starters I kicked off an ASP.NET MVC project in Visual Studio 2008. I wanted a simple 4-column layout, so I added the CSS files from the excellent <a href="http://960.gs/">960 Grid System</a> and cleared out the existing Site.css file.</p>
<p>I’m using both jQuery and <a href="http://jqueryui.com/demos/sortable/">jQuery UI’s Sortable</a> functionality, both of which can be referenced on <a href="http://code.google.com/apis/ajaxlibs/">Google’s CDN</a> to reduce the page load time. I also added a new javascript file in the Scripts folder for custom functions.</p>
<p>With all these references the &lt;head&gt; section of the master page (/Views/Shared/Site.Master) now looks like this:</p>
<pre class="brush: csharp;">&lt;head runat="server"&gt;
    &lt;title&gt;&lt;asp:ContentPlaceHolder ID="TitleContent" runat="server" /&gt;&lt;/title&gt;

    &lt;link href="../../Content/reset.css" rel="stylesheet" type="text/css" /&gt;
    &lt;link href="../../Content/text.css" rel="stylesheet" type="text/css" /&gt;
    &lt;link href="../../Content/960.css" rel="stylesheet" type="text/css" /&gt;
    &lt;link href="../../Content/Site.css" rel="stylesheet" type="text/css" /&gt;

    &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt;
    &lt;script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" type="text/javascript"&gt;&lt;/script&gt;
    &lt;script src="../../Scripts/Custom.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;/head&gt;</pre>
<p>Since we’re not going to delve into the ASP.NET MVC project structure for now, I created a new View simply called “Main” in the /Views/Shared folder, which in turn references the master page. This will contain all the content HTML for the time being. Before I started this blog post I called the categories <strong>sections</strong>, so bear with me on the terminology switch from here on out.</p>
<p>Using the 960 Grid System’s structure I laid out the 4 columns. For now I just added placeholders for two sections in the first column, and one section each under the 2nd and 4th columns. Here’s the layout in Main.aspx so far:</p>
<pre class="brush: csharp;">&lt;div class="container_12"&gt;

    &lt;div class="clear"&gt;&lt;/div&gt;

    &lt;div class="grid_12" id="headerText"&gt;
        &lt;h4&gt;Categorized List Demo&lt;/h4&gt;
    &lt;/div&gt;

    &lt;div class="clear"&gt;&lt;/div&gt;

    &lt;div class="grid_3 listColumn" id="col_1"&gt;
        &lt;div class="secBox"&gt;
            &lt;div class="secHeader"&gt;
                &lt;h2 class="secName"&gt;Vegetables&lt;/h2&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="secBox"&gt;
            &lt;div class="secHeader"&gt;
                &lt;h2 class="secName"&gt;Fruit&lt;/h2&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;

    &lt;div class="grid_3 listColumn" id="col_2"&gt;
        &lt;div class="secBox"&gt;
            &lt;div class="secHeader"&gt;
                &lt;h2 class="secName"&gt;Meat&lt;/h2&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;

    &lt;div class="grid_3 listColumn" id="col_3"&gt;
    &lt;/div&gt;

    &lt;div class="grid_3 listColumn" id="col_4"&gt;
        &lt;div class="secBox"&gt;
            &lt;div class="secHeader"&gt;
                &lt;h2 class="secName"&gt;Dairy&lt;/h2&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;

    &lt;div class="clear"&gt;&lt;/div&gt;

&lt;/div&gt;</pre>
<p>Within each section I added 3 items in an unordered list. Each section now follows this pattern:</p>
<pre class="brush: csharp;">&lt;div class="secBox"&gt;
    &lt;div class="secHeader"&gt;
        &lt;h2 class="secName"&gt;Vegetables&lt;/h2&gt;
    &lt;/div&gt;

    &lt;div class="itemBox"&gt;
        &lt;ul class="itemList"&gt;
            &lt;li class="itemRow"&gt;
                &lt;span class="itemName"&gt;Broccoli&lt;/span&gt;
            &lt;/li&gt;
            &lt;li class="itemRow"&gt;
                &lt;span class="itemName"&gt;Spinach&lt;/span&gt;
            &lt;/li&gt;
            &lt;li class="itemRow"&gt;
                &lt;span class="itemName"&gt;Zuchinni&lt;/span&gt;
            &lt;/li&gt;
        &lt;/ul&gt;
    &lt;/div&gt;
&lt;/div&gt;</pre>
<p>CSS markup was added for simple styling. Here’s a screenshot:</p>
<p><a href="http://philderksen.com/wp-content/uploads/2009/06/20090618-initial-layout.png" target="_blank"><img style="display: inline; margin-left: 0px; margin-right: 0px; border-width: 0px;" title="2009-06-18_initial_layout" src="http://philderksen.com/wp-content/uploads/2009/06/20090618-initial-layout-thumb.png" border="0" alt="2009-06-18_initial_layout" width="640" height="160" /></a></p>
<p>To make sure the root of the site brings up the view “Main”, go to /Controllers/HomeController.cs and make sure the Index action returns this view.</p>
<pre class="brush: csharp;">public ActionResult Index()
{
    return View("Main");
}</pre>
<p>Next up is coding the javascript to enable drag and drop on both the sections and items. When making the sortable() call, sections must use the connectWith attribute to link to the 4 different columns, and items must use the same attribute to link to different sections.</p>
<p>For sections, I also set a handle so the user is forced to use the header to drag the sections around. If this isn’t included, there would be a conflict when dragging items since they already exist within the sections. Dragging a section by it’s header is also common among popular personalized home page sites such as <a href="http://www.google.com/ig">iGoogle</a> and <a href="http://www.pageflakes.com/">PageFlakes</a>. Other than that there are just some visual attributes set (cursor, opacity, placeholder) along with containment so the user can’t scroll off the page dragging things around. Here’s the javascript so far:</p>
<pre class="brush: js;">$(document).ready(function()
{
    InitSectionSorting();
    InitItemSorting();
});

function InitSectionSorting()
{
    $(".listColumn").sortable(
    {
        connectWith: ".listColumn",
        containment: "document",
        cursor: "move",
        handle: ".secHeader",
        opacity: 0.8,
        placeholder: "secBoxPlaceholder"
    });
}

function InitItemSorting()
{
    $(".itemList").sortable(
    {
        connectWith: ".itemList",
        containment: "document",
        cursor: "move",
        opacity: 0.8,
        placeholder: "itemRowPlaceholder"
    });
}</pre>
<p>Here’s what it looks like dragging a section:</p>
<p><img style="display: inline; border-width: 0px;" title="2009-06-18_section_drag" src="http://philderksen.com/wp-content/uploads/2009/06/20090618-section-drag.png" border="0" alt="2009-06-18_section_drag" width="262" height="125" /></p>
<p>…and an item:</p>
<p><img style="display: inline; border-width: 0px;" title="2009-06-18_item_drag" src="http://philderksen.com/wp-content/uploads/2009/06/20090618-item-drag.png" border="0" alt="2009-06-18_item_drag" width="235" height="95" /></p>
<p>That’s about it for the layout and sorting functionality. In future posts I’ll tackle adding, editing and deleting using jQuery’s AJAX calling ASP.NET MVC methods, which in turn access a SQL Server database.</p>
<p>Final note: The styling seems to get messed up in IE. Should look OK in FF, Chrome and Safari though.</p>
<h3><a href="http://philderksen.com/wp-content/uploads/2009/06/2009-06-18_categorizeditemslistdemo.zip">Download the source code</a> (requires Visual Studio 2008 and ASP.NET MVC 1.0)</h3>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fphilderksen.com%2F2009%2F06%2Fdrag-and-drop-categorized-item-list-with-jquery-and-aspnet-mvc-part-1%2F&amp;layout=standard&amp;&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px;height:30px;margin-top:5px;"></iframe>]]></content:encoded>
			<wfw:commentRss>http://philderksen.com/2009/06/drag-and-drop-categorized-item-list-with-jquery-and-aspnet-mvc-part-1/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss><!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)

Served from: philderksen.com @ 2010-09-02 22:06:00 -->
