<?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:blogChannel="http://backend.userland.com/blogChannelModule" xmlns:dc="http://purl.org/dc/elements/1.1/" 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:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
  <channel>
    <title>Peter works on the web!</title>
    <description />
    <link>http://peter.worksontheweb.net/</link>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <generator>BlogEngine.NET 1.4.0.0</generator>
<language>en-GB</language><blogChannel:blogRoll>http://peter.worksontheweb.net/opml.axd</blogChannel:blogRoll><blogChannel:blink>http://www.dotnetblogengine.net/syndication.axd</blogChannel:blink><dc:creator>Peter Eysermans</dc:creator><dc:title>Peter works on the web!</dc:title><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/PeterWorksOnTheWeb" type="application/rss+xml" /><feedburner:browserFriendly></feedburner:browserFriendly><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item><title>Visual Studio Redesign: lose the designers, add a command prompt?</title><description>&lt;p&gt;There has been a clear shift in the way I use Visual Studio lately. Visual studio has a lot of built-in panels to help you develop the next killer application. There are a lot of panels I hardly ever use. Most of my time I spend, not quite surprising, in the text editor editing code. As for the other panels I may be using about 10% of all available options. Windows like the Server Explorer, Document Outline, Object Browser, I don’t think I ever opened them while developing. And I didn’t even mention the designers yet. I am a full-time web developer but I never open the HTML designer.&lt;/p&gt;  &lt;p&gt;So I would like to propose a Visual Studio redesign, let’s just throw out all the designers and unnecessary windows (like when editing a css file lose the CSS properties, Manage Styles, CSS Outline windows) and go back to basics. Build a really good text editor. Once everything is stripped to the bare minimum add a panel which gives you direct access to the command prompt. I got this idea from a Ruby on Rails editor called &lt;a href="http://www.aptana.com/rails"&gt;RadRails&lt;/a&gt;. You can generate controllers, models, etc… from a panel within the IDE.&lt;/p&gt;  &lt;p&gt;Why a command prompt? I have noticed that developing isn’t centralized in Visual Studio any longer. Next to Visual Studio I always have a command prompt open. By using tools like &lt;a href="http://www.javascriptmvc.com"&gt;JavaScriptMVC&lt;/a&gt; and &lt;a href="http://www.lesscss.org"&gt;LESS&lt;/a&gt;, I now use the command prompt very frequently. By running small commands from the command prompt snippets of code are generated for you. And although code generation is considered evil by some, there is a big difference between Microsoft code generation and those tools. They generate code for you but give you the opportunity to change it without any effort. The Microsoft way of code generation, the part I can remember because I try to use it as less as possible, is saying: do not touch our generated piece of art, you are not worthy. And if you dare to change it, it will smack you in the face for doing so. With code generated by Microsoft I constantly have the feeling that I’m not &lt;strong&gt;in control&lt;/strong&gt;. &lt;/p&gt;  &lt;p&gt;So my proposal is, stop building a huge beast with gazillion panels which tackles it all. Create a light weight text editor, let’s call it &lt;a href="http://macromates.com/"&gt;Textmate&lt;/a&gt; for Windows, and give users the possibility to add the tools they want to use in addition to that text editor by accessing them through the command prompt directly in the IDE. &lt;/p&gt;  &lt;p&gt;I’ve googled around for a solution but the only posts that came near were posts which let you launch a command prompt from within Visual Studio. Not really what I was looking for. Let’s hope the Visual Studio Team has implemented this option in Visual Studio 2010…&lt;/p&gt;</description><link>http://peter.worksontheweb.net/post/Visual-Studio-Redesign-lose-the-designers-add-a-command-prompt.aspx</link><author>peter.nospam@nospam.twototango.be (Peter)</author><comments>http://peter.worksontheweb.net/post/Visual-Studio-Redesign-lose-the-designers-add-a-command-prompt.aspx#comment</comments><guid>http://peter.worksontheweb.net/post.aspx?id=b17f25ec-e37b-4c0d-852f-f05aaf0efa3c</guid><pubDate>Sun, 26 Jul 2009 08:37:54 -0500</pubDate><category>Visual Studio</category><category>Development</category><dc:publisher>Peter</dc:publisher><pingback:server>http://peter.worksontheweb.net/pingback.axd</pingback:server><pingback:target>http://peter.worksontheweb.net/post.aspx?id=b17f25ec-e37b-4c0d-852f-f05aaf0efa3c</pingback:target><slash:comments>12</slash:comments><trackback:ping>http://peter.worksontheweb.net/trackback.axd?id=b17f25ec-e37b-4c0d-852f-f05aaf0efa3c</trackback:ping><wfw:comment>http://peter.worksontheweb.net/post/Visual-Studio-Redesign-lose-the-designers-add-a-command-prompt.aspx#comment</wfw:comment><wfw:commentRss>http://peter.worksontheweb.net/syndication.axd?post=b17f25ec-e37b-4c0d-852f-f05aaf0efa3c</wfw:commentRss></item><item><title>Compressing and combining files with JavaScriptMVC</title><description>&lt;p&gt;This is the third article on JavaScriptMVC, so if you’re interested in more these are my previous posts on the subject: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://peter.worksontheweb.net/post/Finally-found-what-I-have-been-looking-for-JavaScriptMVC.aspx"&gt;Finally found what I have been looking for: JavaScriptMVC&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href="http://peter.worksontheweb.net/post/The-MVC-in-JavaScriptMVC.aspx"&gt;The MVC of JavaScriptMVC&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;In these previous posts I’ve shown you the MVC capabilities of the framework, now I would like to look into its combining and compressing features. By now you should be familiar with the js.bat command file which comes with JavaScriptMVC. If this doesn’t ring a bell, please read my previous posts or go to the &lt;a href="http://javascriptmvc.com/"&gt;JavaScriptMVC website&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://twitter.com/justinbmeyer"&gt;Justin&lt;/a&gt;, one of the co-authors of JavaScriptMVC, mentioned in the comments of my previous posts that reducing HTTP requests is the number one performance enhancement recommendation by the Yahoo performance team. They even have a &lt;a href="http://developer.yahoo.com/performance/rules.html"&gt;list of best practices for speeding up your website&lt;/a&gt;. JavaScriptMVC can help you combining your javascript files, external files as well as files generated by the framework. It’s actually very easy to do. To reference your JavaScriptMVC project in your HTML page you use the following code:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:43867d82-c72f-4955-8234-ea281a0d1848" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:White;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;script language&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;javascript&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; type&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;text/javascript&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; src&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;../../jmvc/include.js?tab_manager,development&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;script&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;At this moment JavaScriptMVC is running in development mode, which means no combined files, no compressing. It loads up the files in your browser just as you created them. This can be easily checked with Firebug. Load up your page which references the javascript in Firefox and enable the &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/1843"&gt;Firebug&lt;/a&gt; Script tag. If you open up the list of script files you’ll get something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/CompressingfileswithJavaScriptMVC_B7/Picture%201_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Picture 1" border="0" alt="Picture 1" src="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/CompressingfileswithJavaScriptMVC_B7/Picture%201_thumb.png" width="754" height="594" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;All files should be in this list: controllers, external resources, … This comes in very handy when developing and debugging. But lots of different files are loaded so performance wise this is not the way to go. Fortunately we have JavaScriptMVC to help us. You can load the production version of your code by using the following HTML code:&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:d7aa231e-8ba2-4cf6-b81f-3349b0b52bfe" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:White;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;script language&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;javascript&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; type&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;text/javascript&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; src&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;../../jmvc/include.js?tab_manager,production&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;script&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;Notice that the ‘development’ parameter has been changed to ‘production’. That’s pretty easy huh? Now let’s reload the webpage in Firefox and see what the result is.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/CompressingfileswithJavaScriptMVC_B7/Picture%204_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Picture 4" border="0" alt="Picture 4" src="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/CompressingfileswithJavaScriptMVC_B7/Picture%204_thumb.png" width="756" height="452" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Quite a surprise! We went from twenty or more javascript file to only two files being loaded: index.js and production.js, both are provided by JavaScriptMVC. But how and when is the production.js file created? It is done manually using the js.bat command file once again. You can compress and combine all your files using this command:&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:7d30956b-c4cc-4dba-a578-b24075e1579d" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:White;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #000000;"&gt;js apps&lt;/span&gt;&lt;span style="color: #000000;"&gt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;{application_name}&lt;/span&gt;&lt;span style="color: #000000;"&gt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;compress.js&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;So if we take the example of the previous post, to generate the production file for our Tab Manager:&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:84bd7ef4-b488-4351-916f-b24df0d80a41" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:White;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #000000;"&gt;js apps&lt;/span&gt;&lt;span style="color: #000000;"&gt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;tab_manager&lt;/span&gt;&lt;span style="color: #000000;"&gt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;compress.js&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;This will combine and compress all your files referenced by JavaScriptMVC into the production.js file. Whether it’s a controller, a model or an external resource it doesn’t matter. Even jquery itself is combined into this file when referenced as a resource in your JavaScriptMVC application. It doesn’t matter if the original file already has been minified, this all just works.&lt;/p&gt;

&lt;p&gt;As you can see the framework offers you a great way to enhance the performance of your web application without much effort.&lt;/p&gt;</description><link>http://peter.worksontheweb.net/post/Compressing-and-combining-files-with-JavaScriptMVC.aspx</link><author>peter.nospam@nospam.twototango.be (Peter)</author><comments>http://peter.worksontheweb.net/post/Compressing-and-combining-files-with-JavaScriptMVC.aspx#comment</comments><guid>http://peter.worksontheweb.net/post.aspx?id=6211ca47-ca03-4582-846c-fabcf229aca2</guid><pubDate>Sat, 18 Jul 2009 08:36:27 -0500</pubDate><category>JavaScript</category><category>JavaScriptMVC</category><category>Performance</category><dc:publisher>Peter</dc:publisher><pingback:server>http://peter.worksontheweb.net/pingback.axd</pingback:server><pingback:target>http://peter.worksontheweb.net/post.aspx?id=6211ca47-ca03-4582-846c-fabcf229aca2</pingback:target><slash:comments>0</slash:comments><trackback:ping>http://peter.worksontheweb.net/trackback.axd?id=6211ca47-ca03-4582-846c-fabcf229aca2</trackback:ping><wfw:comment>http://peter.worksontheweb.net/post/Compressing-and-combining-files-with-JavaScriptMVC.aspx#comment</wfw:comment><wfw:commentRss>http://peter.worksontheweb.net/syndication.axd?post=6211ca47-ca03-4582-846c-fabcf229aca2</wfw:commentRss></item><item><title>Getting the element that has the focus via JavaScript</title><description>&lt;p&gt;This is one of those things that you only need on very specific occasions. I needed to get the element that has the focus on a page. Went to Google and found the answer somewhere deep into a forumthread. So for future reference here goes:   &lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms533065%28VS.85%29.aspx"&gt;Internet Explorer supports the document.activeElement property&lt;/a&gt; which gives exactly what I was looking for: the element that has the focus. Because you always have to be careful about javascript properties that are described on a MSDN page, they could be Internet Explorer only, I decided to write a little test to see if it works in the major browsers. I tested this in the following browsers (and corresponding platforms):&lt;/p&gt;  &lt;p&gt;Internet Explorer 6 - Windows    &lt;br /&gt;Internet Explorer 7 - Windows     &lt;br /&gt;Internet Explorer 8 - Windows     &lt;br /&gt;Mozilla Firefox 3.5 – Mac     &lt;br /&gt;Mozilla Firefox 3.5 – Windows     &lt;br /&gt;Google Chrome – Windows &lt;strong&gt;(only works for textbox and select elements)&lt;/strong&gt;&amp;#160; &lt;br /&gt;Safari – Mac &lt;strong&gt;(only works for textbox and select elements)&lt;/strong&gt;    &lt;br /&gt;Safari – Windows &lt;strong&gt;(only works for textbox and select elements)&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;For the Webkit browsers (Safari, Chrome) it appears that the document.activeElement property will only be set if the element that has the focus is a textbox or a select element. Where the other browsers also report if a checkbox or a radiobutton has the focus.&lt;/p&gt;  &lt;p&gt;This was my testing HTML file:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:c0f5cb1c-b885-47e9-997a-dbc8025b4d28" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:White;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #000000;"&gt;&amp;lt;!&lt;/span&gt;&lt;span style="color: #000000;"&gt;DOCTYPE html PUBLIC &lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;-//W3C//DTD XHTML 1.1//EN&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;

&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;html xmlns&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;http://www.w3.org/1999/xhtml&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
    &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;head&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
        &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;title&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;title&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
        &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;link rel&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;stylesheet&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; href&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;c/style.css&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; media&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;screen,projection&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; type&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;text/css&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #000000;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
        &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;script src&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;j/jquery-1.3.2.min.js&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; type&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;text/javascript&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;script&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
        &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;script src&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;j/index.js&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; type&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;text/javascript&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;script&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
    &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;head&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
    &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;body&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
        &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;input type&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;text&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; id&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;text-box&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #000000;"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;br &lt;/span&gt;&lt;span style="color: #000000;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
        &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;input type&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;checkbox&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; id&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;checkbox&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #000000;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
        &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;label &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;for&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;checkbox&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;checkbox&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;label&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;br &lt;/span&gt;&lt;span style="color: #000000;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
        &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;select id&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;select&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
            &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;option value&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;1&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;Testing&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;option&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
        &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;select&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;br &lt;/span&gt;&lt;span style="color: #000000;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
        &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;p&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
            Current active element: &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;span id&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;current-active-element&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;span&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
        &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;p&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
    &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;body&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;html&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;With a little bit of javascript attached to it:&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:f5b3288e-ab26-4b6e-b44f-f526b6a1781f" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:White;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #000000;"&gt;$(function()
{
    setInterval(&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;updateActiveElement();&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;, &lt;/span&gt;&lt;span style="color: #800080;"&gt;500&lt;/span&gt;&lt;span style="color: #000000;"&gt;);
});

function updateActiveElement()
{
    $(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;#current-active-element&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;).text($(document.activeElement).attr(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;id&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;));
}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;This test page will write out the ID of the active element every 500 milliseconds so we can clearly see which element has the focus.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.jamesgoodfellow.com/blog/post/documentactiveElement-in-Firefox---Finding-The-Element-That-Has-Focus.aspx"&gt;James Goodfellow has written a post about the property which is now, according to his post, part of the HTML 5 specification&lt;/a&gt;. For browsers that don’t support the property, James provides a workaround.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://peter.worksontheweb.net/upload/document_activeelement/index.htm"&gt;If you want to test it yourself, I uploaded the test page&lt;/a&gt;.&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:4952aa2d-bc90-477c-beae-8562ad996d24" class="wlWriterEditableSmartContent"&gt;Tags from Technorati: &lt;a href="http://technorati.com/tags/html" rel="tag"&gt;html&lt;/a&gt;,&lt;a href="http://technorati.com/tags/focus" rel="tag"&gt;focus&lt;/a&gt;&lt;/div&gt;</description><link>http://peter.worksontheweb.net/post/Getting-the-element-that-has-the-focus-via-JavaScript.aspx</link><author>peter.nospam@nospam.twototango.be (Peter)</author><comments>http://peter.worksontheweb.net/post/Getting-the-element-that-has-the-focus-via-JavaScript.aspx#comment</comments><guid>http://peter.worksontheweb.net/post.aspx?id=197f3a8a-b022-4fd1-94d9-8c78cde2c1a7</guid><pubDate>Sat, 11 Jul 2009 10:04:34 -0500</pubDate><category>HTML</category><category>focus</category><dc:publisher>Peter</dc:publisher><pingback:server>http://peter.worksontheweb.net/pingback.axd</pingback:server><pingback:target>http://peter.worksontheweb.net/post.aspx?id=197f3a8a-b022-4fd1-94d9-8c78cde2c1a7</pingback:target><slash:comments>4</slash:comments><trackback:ping>http://peter.worksontheweb.net/trackback.axd?id=197f3a8a-b022-4fd1-94d9-8c78cde2c1a7</trackback:ping><wfw:comment>http://peter.worksontheweb.net/post/Getting-the-element-that-has-the-focus-via-JavaScript.aspx#comment</wfw:comment><wfw:commentRss>http://peter.worksontheweb.net/syndication.axd?post=197f3a8a-b022-4fd1-94d9-8c78cde2c1a7</wfw:commentRss></item><item><title>The MVC in JavaScriptMVC</title><description>&lt;p&gt;&lt;strong&gt;DISCLAIMER:&lt;/strong&gt; &lt;strong&gt;I recently started using JavaScriptMVC and got to like it a lot. These blogposts are a way for me to document my learning process of the framework. There is the possibility that I misinterpreted certain principles or abusing the framework at some points. So don’t be afraid to ask questions or set things straight in the comments.&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;In my last post &lt;a href="http://peter.worksontheweb.net/post/Finally-found-what-I-have-been-looking-for-JavaScriptMVC.aspx"&gt;I outed my love for JavaScriptMVC&lt;/a&gt;. I got the remark of &lt;a href="http://jlorenzen.blogspot.com/"&gt;James&lt;/a&gt; that a library that consolidates javascript files doesn’t make it MVC and that is absolutely correct. But JavaScriptMVC is much more then just javascript file consolidation. In this post I would like to show the MVC capabilities of the JavaScript framework and how a typical application built with JavaScriptMVC is structured.&lt;/p&gt;  &lt;p&gt;When you download the framework and unzip it to the folder of your choice you get the following file structure:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/TheMVCinJavaScriptMVC_140A7/Picture%201_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Picture 1" border="0" alt="Picture 1" src="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/TheMVCinJavaScriptMVC_140A7/Picture%201_thumb.png" width="191" height="244" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;We will touch some of the folders and files in this structure. The js.bat is a very important one because we will be generating a lot of the files via this command file. As an exercise I will build a fairly simple tabbed interface using JavaScriptMVC. &lt;a href="http://peter.worksontheweb.net/upload/javascriptmvc/apps/tab_manager/index.html"&gt;I’ve put the result of this tutoria online&lt;/a&gt;. The initial mockup of the application looks like this:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;a href="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/TheMVCinJavaScriptMVC_140A7/Picture%202_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Picture 2" border="0" alt="Picture 2" src="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/TheMVCinJavaScriptMVC_140A7/Picture%202_thumb.png" width="244" height="199" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Before we can start writing code, we have to create an application. You can do this by navigating in a command prompt to the folder where you unzipped the JavaScriptMVC bytes and executing the following command:&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:b0559c15-1305-4e4e-bc08-300523b26e92" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:White;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #000000;"&gt;js jmvc\generate\app tab_manager&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;The batch command has generated a couple of application files. This batch file will also be used to generate models, controllers, views and much more. Before we go any further let’s digg into how JavaSciptMVC uses the MVC pattern. From their website we get the following explanation for models, views and controllers:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="http://javascriptmvc.com/wiki/index.php?title=Model_Overview"&gt;Model&lt;/a&gt; 

    &lt;br /&gt;&lt;/strong&gt;wrap an application’s data layer, this is done in two ways: 

  &lt;br /&gt;- request data from and interacting with services. 

  &lt;br /&gt;- Wrap service data with a domain-specific representation&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="http://javascriptmvc.com/wiki/index.php?title=Controller_Overview"&gt;Controller&lt;/a&gt; 

    &lt;br /&gt;&lt;/strong&gt;event delegation that helps logically organize your event handlers&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="http://javascriptmvc.com/wiki/index.php?title=View_Overview"&gt;View&lt;/a&gt;&lt;/strong&gt;

  &lt;br /&gt;Is used as a templating library, it builds html strings from JSON&lt;/p&gt;

&lt;p&gt;While using the framework I took the liberty to use parts a little different. Controllers I use as defined for event delegation. But models I don’t use solely for requesting data from a service. I try to make my models as fat as possible and also do things like UI manipulation. Because I use JavaScriptMVC in combination with ASP.NET my usage of the View has been limited. I will be mainly speaking about the Models and Controllers given that my *.aspx (or *.ascx) page is my actual view.&lt;/p&gt;

&lt;p&gt;When generating the application, JavaScriptMVC generated an index.html page for us which automatically includes the necessary javascript. We’ll be using that page to create our tab control. I changed the HTML a bit, this is the end result:&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:fdd1ef25-0190-49cf-b723-eb2bd7e631ce" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:White;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;html&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
    &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;head&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;head&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
    &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;script language&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;javascript&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; type&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;text/javascript&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; src&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;../../jmvc/include.js?tab_manager,development&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;script&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;    
    &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;style type&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;text/css&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
        li
        {
            border:solid 1px #&lt;/span&gt;&lt;span style="color: #800080;"&gt;000&lt;/span&gt;&lt;span style="color: #000000;"&gt;;
            &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;float&lt;/span&gt;&lt;span style="color: #000000;"&gt;:left;
            margin&lt;/span&gt;&lt;span style="color: #000000;"&gt;-&lt;/span&gt;&lt;span style="color: #000000;"&gt;right:5px;    
            padding:10px;
        }
        
        li.selected
        {
            background&lt;/span&gt;&lt;span style="color: #000000;"&gt;-&lt;/span&gt;&lt;span style="color: #000000;"&gt;color:#&lt;/span&gt;&lt;span style="color: #800080;"&gt;000&lt;/span&gt;&lt;span style="color: #000000;"&gt;;
        }
        
        li.selected a
        {
            color:#fff;
        }
        
        p, ul
        {
            margin:&lt;/span&gt;&lt;span style="color: #800080;"&gt;0&lt;/span&gt;&lt;span style="color: #000000;"&gt;;
            width:300px;
        }
        
        p
        {
            border:solid 1px #&lt;/span&gt;&lt;span style="color: #800080;"&gt;000&lt;/span&gt;&lt;span style="color: #000000;"&gt;;
            height:200px;
            padding:10px;
        }
        
        ul
        {
            list&lt;/span&gt;&lt;span style="color: #000000;"&gt;-&lt;/span&gt;&lt;span style="color: #000000;"&gt;style&lt;/span&gt;&lt;span style="color: #000000;"&gt;-&lt;/span&gt;&lt;span style="color: #000000;"&gt;type:none;
            height:41px;
            padding:&lt;/span&gt;&lt;span style="color: #800080;"&gt;0&lt;/span&gt;&lt;span style="color: #000000;"&gt;;
            width:300px;
        }
    &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;style&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
    &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;body&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
        &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;ul id&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;tab_manager&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
            &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;li &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;class&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;selected&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;a href&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;#tab-1&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;Tab &lt;/span&gt;&lt;span style="color: #800080;"&gt;1&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;a&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;li&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
            &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;li&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;a href&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;#tab-2&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;Tab &lt;/span&gt;&lt;span style="color: #800080;"&gt;2&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;a&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;li&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
            &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;li&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;a href&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;#tab-3&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;Tab &lt;/span&gt;&lt;span style="color: #800080;"&gt;3&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;a&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;li&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
        &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;ul&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
        &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;p id&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;tab-1&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;Tab &lt;/span&gt;&lt;span style="color: #800080;"&gt;1&lt;/span&gt;&lt;span style="color: #000000;"&gt; selected&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;p&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
        &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;p id&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;tab-2&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; style&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;display:none;&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;Tab &lt;/span&gt;&lt;span style="color: #800080;"&gt;2&lt;/span&gt;&lt;span style="color: #000000;"&gt; selected&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;p&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
        &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;p id&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;tab-3&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; style&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;display:none;&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;Tab &lt;/span&gt;&lt;span style="color: #800080;"&gt;3&lt;/span&gt;&lt;span style="color: #000000;"&gt; selected&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;p&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
    &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;body&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;html&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Some basic CSS rules and HTML to represent the tabbed control. I think this code speaks for itself, let’s create the javascript that is needed to make this control work. In order to respond to events that occur we first need a controller that will do the event delegation. So we use the js.bat command batch to generate a controller, this is the command:&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:b2cd0651-e800-48ff-a70f-f6cb15848453" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:White;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #000000;"&gt;js jmvc&lt;/span&gt;&lt;span style="color: #000000;"&gt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;generate&lt;/span&gt;&lt;span style="color: #000000;"&gt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;controller tab_manager&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;br /&gt;In our controllers folder we now have a tab_manager_controller.js which we will use to hook into the events that occur on our html page. We can hook into different sort of events and &lt;a href="http://javascriptmvc.com/wiki/index.php?title=Controller_Overview"&gt;all the important ones are supported&lt;/a&gt;. So in order to respond to a click on one of the tabs we add the following method to the controller. 

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:6d57f217-c4df-4e30-9cda-d5e4bd0c0a05" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:White;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #000000;"&gt;TabManagerController &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; MVC.Controller.extend(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;tab_manager&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;,
&lt;/span&gt;&lt;span style="color: #008000;"&gt;/*&lt;/span&gt;&lt;span style="color: #008000;"&gt; @Static &lt;/span&gt;&lt;span style="color: #008000;"&gt;*/&lt;/span&gt;&lt;span style="color: #000000;"&gt;
{},
&lt;/span&gt;&lt;span style="color: #008000;"&gt;/*&lt;/span&gt;&lt;span style="color: #008000;"&gt; @Prototype &lt;/span&gt;&lt;span style="color: #008000;"&gt;*/&lt;/span&gt;&lt;span style="color: #000000;"&gt;
{
   &lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;li click&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;: function(&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;params&lt;/span&gt;&lt;span style="color: #000000;"&gt;)
   {
        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;new&lt;/span&gt;&lt;span style="color: #000000;"&gt; Tab().select(&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;params&lt;/span&gt;&lt;span style="color: #000000;"&gt;.element);  
        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;params&lt;/span&gt;&lt;span style="color: #000000;"&gt;.&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;event&lt;/span&gt;&lt;span style="color: #000000;"&gt;.preventDefault();
   } 
}
);&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Let’s reflect over this code. This code defines a TabManagerController class which controls an element that has the id ‘tab_manager’, the id that our ul-tag has. There is one function in the controller that will respond to a click event on a li-tag. Notice how they use CSS selectors to define the event handlers. No real rocket science here for anyone who already is familiar with JavaScript and CSS selectors. Now we could write all necessary code in the controller, but in order to keep my JavaScript code maintainable I would like to use the controllers as a delegation mechanism to my models. This is somewhat different from what the guys of JavaScriptMVC are recommending to use models for. I try to get my models to reflect the different concepts in my application. So we want to generate a Tab model to show and hide the different tabs. Again we use the batch we are already familiar with to generate the model:&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:66b46efb-4d42-4ac1-9fae-1bb6dd1b1159" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:White;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #000000;"&gt;js jmvc&lt;/span&gt;&lt;span style="color: #000000;"&gt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;generate&lt;/span&gt;&lt;span style="color: #000000;"&gt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;model ajax Tab&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;This will generate a Tab.js file under the models directory. Now we can add the necessary methods to this class in order to manipulate a certain tab. The nice thing about this is that it resides in its own class which has a name that reflects the actual UI object it will manipulate. You might have noticed the ‘ajax’ parameter we have provided. This is simply because a model has to be generated with a certain data type (json_p, ajax, xml_rest, …). We will not be using one of the types in our code so this can be ignored for now. This is how the implementation of the Tab model looks like:&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:253161f1-adca-4004-a18b-e9871a1805c6" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:White;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #008000;"&gt;/*&lt;/span&gt;&lt;span style="color: #008000;"&gt;*
 *
 &lt;/span&gt;&lt;span style="color: #008000;"&gt;*/&lt;/span&gt;&lt;span style="color: #000000;"&gt;
Tab &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; MVC.Model.Ajax.extend(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;Tab&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;,
&lt;/span&gt;&lt;span style="color: #008000;"&gt;/*&lt;/span&gt;&lt;span style="color: #008000;"&gt; @Static &lt;/span&gt;&lt;span style="color: #008000;"&gt;*/&lt;/span&gt;&lt;span style="color: #000000;"&gt;
{
},
&lt;/span&gt;&lt;span style="color: #008000;"&gt;/*&lt;/span&gt;&lt;span style="color: #008000;"&gt; @Prototype &lt;/span&gt;&lt;span style="color: #008000;"&gt;*/&lt;/span&gt;&lt;span style="color: #000000;"&gt;
{
    getTabContentSelector: function($tab)
    {
        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;return&lt;/span&gt;&lt;span style="color: #000000;"&gt; $tab.find(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;a&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;).attr(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;href&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;);
    },

    hideTabContent: function(selector)
    {
        $(selector).css(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;display&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;, &lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;none&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;);
    },
    
    showTabContent: function(selector)
    {
        $(selector).css(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;display&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;, &lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;block&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;);
    },

    select: function(tabToShow)
    {
        var $currentSelectedTab &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; $(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;li.selected&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;);
        
        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;this&lt;/span&gt;&lt;span style="color: #000000;"&gt;.hideTabContent(&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;this&lt;/span&gt;&lt;span style="color: #000000;"&gt;.getTabContentSelector($currentSelectedTab));
        $currentSelectedTab.removeClass(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;selected&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;);
        
        var $tabToShow &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; $(tabToShow);
        
        $tabToShow.addClass(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;selected&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;);
        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;this&lt;/span&gt;&lt;span style="color: #000000;"&gt;.showTabContent(&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;this&lt;/span&gt;&lt;span style="color: #000000;"&gt;.getTabContentSelector($tabToShow));
    }
}
);&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;Notice that I use jQuery in the mix. jQuery and JavaScriptMVC are actually very compatible. You do have to include jQuery as a resource in order to be able to use it, more on that later. There are four functions in the Tab model, the most imporant one is the select function which takes a tab (which is actually an li-element) as argument. The content to show is currently hidden in the page, each tab has a corresponding p-tag which holds the data for that tab, but this could be replaced by an Ajax call in order to request some data for a specific tab.&lt;/p&gt;

&lt;p&gt;The last thing I have to mention is the tab_manager.js file in the app folder. That file looks like this:&lt;/p&gt;

&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:6f5e1a04-126f-458f-afc0-208ffe926eb1" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:White;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #000000;"&gt;include.resources(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;jquery-1.3.2.min&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;);
include.engines();
include.plugins(
    &lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;controller&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;,&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;controller/scaffold&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;,
    &lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;view&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;,&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;view/helpers&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;,                         
    &lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;dom/element&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;,
    &lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;io/ajax&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;,
    &lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;model/json_rest&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;,&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;model/xml_rest&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;
    );

include(function(){ &lt;/span&gt;&lt;span style="color: #008000;"&gt;//&lt;/span&gt;&lt;span style="color: #008000;"&gt;runs after prior includes are loaded&lt;/span&gt;&lt;span style="color: #008000;"&gt;
&lt;/span&gt;&lt;span style="color: #000000;"&gt;  include.models(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;Tab&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;);
  include.controllers(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;tab_manager&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;);
  include.views();
});&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;This is actually the main file of our application which determines what resources, plugins, models and controllers are loaded. As you can see the jquery file, the tab_manager controller and the Tab model are present in this file. Don’t forget to add new models and controllers to this file, otherwise they will not be loaded and executed.&lt;/p&gt;

&lt;p&gt;Because this post is already rather lengthy I will leave it here and give you some room to expirement with the code. I know there are a lot of concepts that are left unexplained but I’m planning on writing a few more posts to go into further detail into certain concepts of the framework. As always if you have any remarks the comments are still open and free.&lt;/p&gt;

&lt;p&gt;To finish would like to end with a brief overview&amp;#160; of the important files and folders so you have a nice overview of where to find everything we used in this tutorial.
  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:c1846375-09f9-4d81-b736-774685e0a4e0" class="wlWriterEditableSmartContent"&gt;&lt;pre style="background-color:White;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #000000;"&gt;apps
    tab_manager.js                  general application file to load models, controllers and resources
    index.html                      file which holds the necessary html code, used &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;for&lt;/span&gt;&lt;span style="color: #000000;"&gt; testing purposes
controllers
    tab_manager_controller.js       controller which responds on events coming from the tab manager
models
    Tab.js                          model which represent a tab
resources
    jquery&lt;/span&gt;&lt;span style="color: #000000;"&gt;-&lt;/span&gt;&lt;span style="color: #800080;"&gt;1.3&lt;/span&gt;&lt;span style="color: #000000;"&gt;.&lt;/span&gt;&lt;span style="color: #800080;"&gt;2&lt;/span&gt;&lt;span style="color: #000000;"&gt;.min.js             jquery file&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;&lt;a href="http://peter.worksontheweb.net/upload/javascriptmvc_tab_manager.zip"&gt;Source code of this article&lt;/a&gt;

  &lt;br /&gt;&lt;a href="http://peter.worksontheweb.net/upload/javascriptmvc/apps/tab_manager/index.html"&gt;Result of this tutorial&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:7e2f716c-2ce8-4ffc-822d-00d88a464842" class="wlWriterEditableSmartContent"&gt;Tags from Technorati: &lt;a href="http://technorati.com/tags/JavaScriptMVC" rel="tag"&gt;JavaScriptMVC&lt;/a&gt;,&lt;a href="http://technorati.com/tags/JavaScript" rel="tag"&gt;JavaScript&lt;/a&gt;&lt;/div&gt;&lt;/p&gt;</description><link>http://peter.worksontheweb.net/post/The-MVC-in-JavaScriptMVC.aspx</link><author>peter.nospam@nospam.twototango.be (Peter)</author><comments>http://peter.worksontheweb.net/post/The-MVC-in-JavaScriptMVC.aspx#comment</comments><guid>http://peter.worksontheweb.net/post.aspx?id=b3fdcece-4c52-43e7-89c9-3bee7d5f6209</guid><pubDate>Mon, 06 Jul 2009 15:54:09 -0500</pubDate><category>JavaScript</category><category>JavaScriptMVC</category><dc:publisher>Peter</dc:publisher><pingback:server>http://peter.worksontheweb.net/pingback.axd</pingback:server><pingback:target>http://peter.worksontheweb.net/post.aspx?id=b3fdcece-4c52-43e7-89c9-3bee7d5f6209</pingback:target><slash:comments>9</slash:comments><trackback:ping>http://peter.worksontheweb.net/trackback.axd?id=b3fdcece-4c52-43e7-89c9-3bee7d5f6209</trackback:ping><wfw:comment>http://peter.worksontheweb.net/post/The-MVC-in-JavaScriptMVC.aspx#comment</wfw:comment><wfw:commentRss>http://peter.worksontheweb.net/syndication.axd?post=b3fdcece-4c52-43e7-89c9-3bee7d5f6209</wfw:commentRss></item><item><title>Finally found what I have been looking for: JavaScriptMVC</title><description>&lt;p&gt;I'm very passionate about the code I write, and with the coming of jQuery I really began to love Javascript. But the Javascript I wrote was more of the procedural kind. I tried to split it up per page or user control but it still felt bad. For pages with a lot of interaction the JavaScript files grew very quickly over a couple hundred &lt;abbr title="Lines Of Code"&gt;LOC&lt;/abbr&gt;. There is the possibility to split these up, but the problem that then arises is that the browser launches a request for each javascript file. And most (older) browsers have a suprising low amount of simultaneous request (I thought it was around 2 or 3, it was certainly below 5). So each file I added to make my application more maintainable resulted in a slower application. Not a good situation to be in.&lt;/p&gt; &lt;p&gt;I was constantly on the lookout for something that could easily minify and merge all my JavaScript files and still keep maintainability while developing. I had read solutions of people who had a build task that did this for them. But that seemed like a pretty vulnerable system. The build script has to create a new file on a certain location and has to change your pages so they include the correct javascript file (the newly generated one). So I lived with the pain.&lt;/p&gt; &lt;p&gt;Until I read about &lt;a href="http://ajaxian.com/archives/javascriptmvc-15-released"&gt;JavaScriptMVC on Ajaxian&lt;/a&gt; and decided to check it out. What is &lt;a href="http://www.javascriptmvc.com"&gt;JavaScriptMVC&lt;/a&gt;?&amp;nbsp; I'll quote from their site:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;JavaScriptMVC is a framework that brings methods to the madness of JavaScript development. It guides you to successfully completed projects by promoting best practices, maintainability, and convention over configuration.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;So it uses some conventions and the MVC pattern to give you the ability to manage your JavaScript code. But the biggest thing I like so far is the possibility to run in different modes (development, test and production) and if you run in production all your javascript including your external libraries like jQuery get minified and combined into one javascript file. Yes that's right even if you have a dozen javascript files, after minifying them you'll only have one file called production.js left. The big advantage is that the browser only has to do one request to the server to load all of the javascript. You know what that means, faster loading times!&lt;/p&gt; &lt;p&gt;If you write a lot of JavaScript code, check out &lt;a href="http://www.javascriptmvc.com"&gt;JavascriptMVC&lt;/a&gt; right now. I'll be writing more details about the framework in the coming weeks as I'm still in the process of learning it.&lt;/p&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:7bdac141-970a-4c91-aacc-2932a67ae05c" class="wlWriterSmartContent"&gt;Tags from Technorati: &lt;a href="http://technorati.com/tags/Javascript" rel="tag"&gt;Javascript&lt;/a&gt;,&lt;a href="http://technorati.com/tags/JavascriptMVC" rel="tag"&gt;JavascriptMVC&lt;/a&gt;,&lt;a href="http://technorati.com/tags/maintainability" rel="tag"&gt;maintainability&lt;/a&gt;&lt;/div&gt;</description><link>http://peter.worksontheweb.net/post/Finally-found-what-I-have-been-looking-for-JavaScriptMVC.aspx</link><author>peter.nospam@nospam.twototango.be (Peter)</author><comments>http://peter.worksontheweb.net/post/Finally-found-what-I-have-been-looking-for-JavaScriptMVC.aspx#comment</comments><guid>http://peter.worksontheweb.net/post.aspx?id=d1f17d99-9a2b-4e22-bf47-3c5dd431b622</guid><pubDate>Mon, 22 Jun 2009 03:29:14 -0500</pubDate><dc:publisher>Peter</dc:publisher><pingback:server>http://peter.worksontheweb.net/pingback.axd</pingback:server><pingback:target>http://peter.worksontheweb.net/post.aspx?id=d1f17d99-9a2b-4e22-bf47-3c5dd431b622</pingback:target><slash:comments>5</slash:comments><trackback:ping>http://peter.worksontheweb.net/trackback.axd?id=d1f17d99-9a2b-4e22-bf47-3c5dd431b622</trackback:ping><wfw:comment>http://peter.worksontheweb.net/post/Finally-found-what-I-have-been-looking-for-JavaScriptMVC.aspx#comment</wfw:comment><wfw:commentRss>http://peter.worksontheweb.net/syndication.axd?post=d1f17d99-9a2b-4e22-bf47-3c5dd431b622</wfw:commentRss></item><item><title>Book review: jQuery in Action</title><description>&lt;p&gt;&lt;a href="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/BookreviewjQueryinAction_13A61/jQuery-in-Action_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; margin: 0px 15px 0px 0px; border-top: 0px; border-right: 0px" border="0" alt="jQuery-in-Action" align="left" src="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/BookreviewjQueryinAction_13A61/jQuery-in-Action_thumb.jpg" width="195" height="244"&gt;&lt;/a&gt; I started reading this book about 6 months ago. After reading it half way through I stopped and start reading a newly purchased book. The reason that I stopped reading was because I was excited and impatient to start reading the new book, it's a problem I have every time I purchase a new book. After finishing some books I realized that &lt;a href="http://www.manning.com/bibeault/"&gt;jQuery in Action&lt;/a&gt; was still lying around, and because the new project I'm working on depends heavily on jQuery, I decided to pick up the book where I left off and finish it.&lt;/p&gt; &lt;p&gt;If you use jQuery in your day job or you are interested in JavaScript development in general this book is really for you. I read this book after several months of jQuery development experience and still learned a lot about the framework. &lt;/p&gt; &lt;p&gt;The &lt;a href="http://www.bibeault.org/resume/"&gt;authors of&lt;/a&gt; &lt;a href="http://yehudakatz.com/"&gt;the book&lt;/a&gt; recommend reading the appendices first before getting into the real stuff. They are a very good start for people who are not that familiar with JavaScript and get you up to speed on some essentials of the language like the JavaScript Object and how functions and closures work. These concepts are explained in a very clear way.&lt;/p&gt; &lt;p&gt;After the appendices you dive right into the jQuery goodness with the explanation of the pure basics. Selectors are a very important part which is handled in detail. Via events, animations and effects they show the basic utility functions that are built-in in jQuery. Although the whole book is a very interesting read chapter 7 really pops out and shows how you can write your own plugins, which can result in a lot of code reuse when used properly. The book is finished with how to do Ajax calls with jQuery and some of the best jQuery plugins.&lt;/p&gt; &lt;p&gt;I think it's quite clear by now that this book is a good read for all levels: beginner, intermediate and advanced. I've learned a lot about jQuery that made my job a lot easier. And I think that's the reason why we read technical books, broaden your horizon and learn how to use framework and tools more efficient. The authors certainly succeeded with this book.&lt;/p&gt; &lt;p&gt;To close I would like to list my 5 favorites things I learned or learned more about while reading the book:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://docs.jquery.com/Selectors"&gt;Selectors&lt;/a&gt;, although I already knew a bunch about supported selectors I learned some new ones that I didn't know of&lt;/li&gt; &lt;li&gt;&lt;a href="http://docs.jquery.com/Effects/animate#paramsdurationeasingcallback"&gt;animate()&lt;/a&gt; that enables you to create your own custom animations and gives you endless possibilities&lt;/li&gt; &lt;li&gt;&lt;a href="http://docs.jquery.com/Utilities/jQuery.grep"&gt;$.grep()&lt;/a&gt; can be used to filter arrays&lt;/li&gt; &lt;li&gt;$.post, $.get, $.ajax, ... all the different features in jQuery that support ajax calls to the server and a reference of all the different options.&lt;/li&gt; &lt;li&gt;&lt;a href="http://plugins.jquery.com/project/livequery"&gt;Live Query plugin&lt;/a&gt;, which can monitor if certain events occur on elements which match a certain selector. The good thing about this plugin is when adding new items to the page that match the selector, you don't have to bind the events for this new item. The plugin takes care of that.&lt;/li&gt;&lt;/ul&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:e7ae9452-d9f7-49fa-9213-164beb7a5295" class="wlWriterSmartContent"&gt;Tags from Technorati: &lt;a href="http://technorati.com/tags/jquery" rel="tag"&gt;jquery&lt;/a&gt;,&lt;a href="http://technorati.com/tags/javascript" rel="tag"&gt;javascript&lt;/a&gt;,&lt;a href="http://technorati.com/tags/book" rel="tag"&gt;book&lt;/a&gt;&lt;/div&gt;</description><link>http://peter.worksontheweb.net/post/Book-review-jQuery-in-Action.aspx</link><author>peter.nospam@nospam.twototango.be (Peter)</author><comments>http://peter.worksontheweb.net/post/Book-review-jQuery-in-Action.aspx#comment</comments><guid>http://peter.worksontheweb.net/post.aspx?id=7a4067ea-cb07-4a80-bc70-a218c3c1ee69</guid><pubDate>Sat, 06 Jun 2009 14:51:07 -0500</pubDate><category>JavaScript</category><category>jQuery</category><dc:publisher>Peter</dc:publisher><pingback:server>http://peter.worksontheweb.net/pingback.axd</pingback:server><pingback:target>http://peter.worksontheweb.net/post.aspx?id=7a4067ea-cb07-4a80-bc70-a218c3c1ee69</pingback:target><slash:comments>3</slash:comments><trackback:ping>http://peter.worksontheweb.net/trackback.axd?id=7a4067ea-cb07-4a80-bc70-a218c3c1ee69</trackback:ping><wfw:comment>http://peter.worksontheweb.net/post/Book-review-jQuery-in-Action.aspx#comment</wfw:comment><wfw:commentRss>http://peter.worksontheweb.net/syndication.axd?post=7a4067ea-cb07-4a80-bc70-a218c3c1ee69</wfw:commentRss></item><item><title>Sequentially download multiple files (with jQuery)</title><description>&lt;p&gt;On my previous job, I was working together with a colleague on a file transfer application which lived in the browser. We were up -and downloading multiple files at the same time and needed a rich user experience. To ensure the best experience when uploading we turned to &lt;a href="http://www.swfupload.org/"&gt;swfupload&lt;/a&gt;, it's free and I highly recommend it. But download was another story. The user experience for downloading files is actually something for which we entirely depend on the browser. It's not that there is a lot of choice. You click a link to a file which the browser can't open then you get a save dialog box and the browser shows you a progress bar. All that is out of the hands of the developer you just put the link there or stream the file directly to the client and let the browser do his thing.&lt;/p&gt; &lt;p&gt; But we offered the user multiple files and he could determine which files he wanted to download. This is a simplified mockup of how the screen looked.&lt;/p&gt; &lt;p&gt;&lt;a href="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/SequentiallydownloadmultiplefileswithjQu_13BA0/image_2.png"&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="image" src="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/SequentiallydownloadmultiplefileswithjQu_13BA0/image_thumb.png" width="174" height="102"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;If a user wanted to download the files he could click the links one by one and then save them. But how to make the "Download selected files" button work. After some googling I found that there are numerous solutions for upload but didn't find any decent solution for a 'richer' download experience. And after thinking it through it makes sense, because downloading requires access to the hard disk of the user. This would be a serious risk to allow javascript to write to a certain folder on disk.&lt;/p&gt; &lt;p&gt;So we were stuck, some suggested of zipping all the zips to one file but we didn't want to burden the end user with the extra effort of unzipping.&amp;nbsp; I got a hint on a forum post (can't remember which one sorry for that) that if you pointed the source attribute of an iframe to the file the browser would offer it as a download. So the first attempt to to this was with the following HTML code:&lt;/p&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:8071a25e-10b2-4bfc-b162-ac82b6ca30cf" class="wlWriterSmartContent"&gt;&lt;pre style="background-color:White;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;html xmlns&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;http://www.w3.org/1999/xhtml&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
    &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;head&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
        &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;title&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;title&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
        &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;script src&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;j/jquery.js&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; type&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;text/javascript&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;script&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
        &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;script src&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;j/index.js&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; type&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;text/javascript&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;script&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
    &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;head&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
    &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;body&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
        &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;h1&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;Download files&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;h1&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
        &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;iframe src&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; id&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;download-iframe&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; style&lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #800000;"&gt;display:none;&lt;/span&gt;&lt;span style="color: #800000;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #000000;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
    &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;body&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #000000;"&gt;html&lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
&lt;p&gt;And the following JavaScript was executed when the document was loaded.&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:8352a380-ce40-47dd-8c92-88bc10ff0a60" class="wlWriterSmartContent"&gt;&lt;pre style="background-color:White;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #000000;"&gt;$(function()
{
    $(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;#download-iframe&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;).attr(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;src&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;, &lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;file1.zip&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;);
    $(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;#download-iframe&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;).attr(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;src&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;, &lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;file2.zip&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;);
    $(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;#download-iframe&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;).attr(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;src&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;, &lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;file3.zip&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;);
});&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
&lt;p&gt;You can see I'm using some &lt;a href="http://www.jquery.com"&gt;jQuery&lt;/a&gt; magic. If you haven't used it yet, stop reading and go check it out. Did I already mention &lt;a href="http://peter.worksontheweb.net/post/Brazilian-waxing2c-choosing-a-JavaScript-framework-and-why-I-dont-like-ASPNET-AJAX.aspx"&gt;I'm a fan&lt;/a&gt;? &lt;/p&gt;
&lt;p&gt;But there is a problem with the code. Only the last file is offered as download. I guessed, I'm not 100 % sure and please correct me if I'm wrong, that the problem was that the statements were executed directly after each other. So I used a little timeout to see if that was the solution to our problem, like so:&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:0f5fb310-809a-439e-9aeb-735008ece3bb" class="wlWriterSmartContent"&gt;&lt;pre style="background-color:White;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #000000;"&gt;$(function()
{
    var fileIndex &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #800080;"&gt;0&lt;/span&gt;&lt;span style="color: #000000;"&gt;;
    var fileArray &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; [ &lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;file1.zip&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;, &lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;file2.zip&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;, &lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;file3.zip&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt; ];

    $(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;#download-iframe&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;).attr(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;src&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;, fileArray[fileIndex]);
    fileIndex&lt;/span&gt;&lt;span style="color: #000000;"&gt;++&lt;/span&gt;&lt;span style="color: #000000;"&gt;;
    
    var interval &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; setInterval(function()
    {
        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;if&lt;/span&gt;&lt;span style="color: #000000;"&gt;(fileIndex &lt;/span&gt;&lt;span style="color: #000000;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000;"&gt; fileArray.length)
        {
            $(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;#download-iframe&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;).attr(&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #800000;"&gt;src&lt;/span&gt;&lt;span style="color: #800000;"&gt;'&lt;/span&gt;&lt;span style="color: #000000;"&gt;, fileArray[fileIndex]);
            fileIndex&lt;/span&gt;&lt;span style="color: #000000;"&gt;++&lt;/span&gt;&lt;span style="color: #000000;"&gt;;
        }
        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;else&lt;/span&gt;&lt;span style="color: #000000;"&gt;
        {
            clearInterval(interval);
        }
    }, 
    &lt;/span&gt;&lt;span style="color: #800080;"&gt;100&lt;/span&gt;&lt;span style="color: #000000;"&gt;);
});&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
&lt;p&gt;As you can see the code is not that much longer, I now have an array of the filenames (could be extracted from a list of checkboxes) and offer the first file as download. Then I set an interval that fires every 100 milliseconds which offers the next file as a download. Once all files have been handled, the interval is cleared and we're done. &lt;/p&gt;
&lt;p&gt;Now the user gets prompted with 3 download dialog boxes. I know, it sucks that he still has to click three times to save each download individually. But if the user sets a default download location the files are automatically saved to that location and he doesn't have to click for each file that gets downloaded. It's certainly not perfect and from a user experience standpoint it still kinda sucks ... but it works. If you have another idea of solving this problem, please feel free to elaborate in the comments.&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:5bfe9873-a701-42c4-bb40-d9ba866ec754" class="wlWriterSmartContent"&gt;Tags from Technorati: &lt;a href="http://technorati.com/tags/JavaScript" rel="tag"&gt;JavaScript&lt;/a&gt;,&lt;a href="http://technorati.com/tags/download" rel="tag"&gt;download&lt;/a&gt;,&lt;a href="http://technorati.com/tags/jQuery" rel="tag"&gt;jQuery&lt;/a&gt;&lt;/div&gt;</description><link>http://peter.worksontheweb.net/post/Sequentially-download-multiple-files-(with-jQuery).aspx</link><author>peter.nospam@nospam.twototango.be (Peter)</author><comments>http://peter.worksontheweb.net/post/Sequentially-download-multiple-files-(with-jQuery).aspx#comment</comments><guid>http://peter.worksontheweb.net/post.aspx?id=5f7b26ee-5d28-4fa9-81b5-28a2ea67afc4</guid><pubDate>Thu, 16 Apr 2009 16:02:22 -0500</pubDate><category>JavaScript</category><dc:publisher>Peter</dc:publisher><pingback:server>http://peter.worksontheweb.net/pingback.axd</pingback:server><pingback:target>http://peter.worksontheweb.net/post.aspx?id=5f7b26ee-5d28-4fa9-81b5-28a2ea67afc4</pingback:target><slash:comments>1</slash:comments><trackback:ping>http://peter.worksontheweb.net/trackback.axd?id=5f7b26ee-5d28-4fa9-81b5-28a2ea67afc4</trackback:ping><wfw:comment>http://peter.worksontheweb.net/post/Sequentially-download-multiple-files-(with-jQuery).aspx#comment</wfw:comment><wfw:commentRss>http://peter.worksontheweb.net/syndication.axd?post=5f7b26ee-5d28-4fa9-81b5-28a2ea67afc4</wfw:commentRss></item><item><title>One tool to test them all: Microsoft Expression Web SuperPreview</title><description>&lt;p&gt; A new tool was launched by the Expression Web team at &lt;a href="http://2009.visitmix.com/"&gt;MIX09&lt;/a&gt;. Multibrowser testing these days is still a real pain in the ass. But as a web &lt;img style="border-right: 0px; border-top: 0px; margin: 0px 0px 0px 5px; border-left: 0px; border-bottom: 0px" height="173" alt="the-one-ring2" src="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/MicrosoftExpressionWebSuperPreview_13504/the-one-ring2_thumb.jpg" width="177" align="right" border="0"&gt;standards fanatic I want my websites to work cross browser. Unfortunately this implies installing a handful of browsers on your desktop. To top it off you need &lt;a href="http://www.my-debugbar.com/wiki/IETester/HomePage"&gt;additional tools&lt;/a&gt; to test all versions of Internet Explorer. There is no one tool that you can use to test and debug your website in all browsers.&lt;/p&gt; &lt;p&gt;Enter one tool to test them all: Microsoft Expression Web SuperPreview (a mouthful). It wants to fill the gap in multibrowser testing and looks like a real promising tool. The point of the program is that you have one program which groups all testing. And although the early bèta that is now available only supports Internet Explorer 6 and 7 (or 8 when installed) it is planned to support almost all large browsers in the future.&lt;/p&gt; &lt;p&gt;My installing experience with the product was a bit disappointing. The tool kept crashing on startup. After &lt;a href="http://twitter.com/twototango/status/1359168280"&gt;ranting about it on Twitter&lt;/a&gt; I got almost immediate feedback from &lt;a href="http://twitter.com/JustinHar"&gt;Justin Harrison&lt;/a&gt;, program manager of Expression Web. He pointed me to a &lt;a href="http://social.expression.microsoft.com/Forums/en-US/web/thread/ca391780-2c0a-41d8-8762-e6de03710458"&gt;blog post with a workaround&lt;/a&gt; for the bug I was experiencing. Talk about efficient use of Twitter!&lt;/p&gt; &lt;p&gt;After applying the workaround the tool worked perfectly. You have to be a bit patient because the websites load pretty slow but I'm sure they'll fix this in one of the future releases. After all this is still a beta. One killer feature that immediately catches your attention is the possibility to overlay two websites. Then you can see the real differences between the two browsers&lt;/p&gt; &lt;p&gt;&lt;a href="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/MicrosoftExpressionWebSuperPreview_13504/Picture%204_2.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="566" alt="Picture 4" src="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/MicrosoftExpressionWebSuperPreview_13504/Picture%204_thumb.png" width="696" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;This could grow into a killer tool which would be indispensable for web designers/developers. One thing that would really top it off is if they added real time css editing. It is already possible to select a certain element on the page by clicking on it (Firebug style). In the status bar you then get to see the properties of the clicked element. If you could then start changing the CSS (and even the HTML) and see the changes in real time that would make one hell of a debugging tool. That's also what makes Firebug so powerful.&lt;/p&gt; &lt;p&gt;Conclusion: I like the way Microsoft tries to fill a gap in web development I hope it quickly evolves into stable product. When it does and it supports all common browsers it will become a standard in my tool belt to test my websites cross browser. And is it possible to release a Mac version? That would be great ;-).I know, I know ... wishful thinking.&lt;/p&gt; &lt;p&gt;For more information on Microsoft Expression Web SuperPreview you can check the following links:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/xweb/"&gt;Microsoft Expression Web Team blog&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://www.sitepoint.com/blogs/2009/03/19/microsoft-superpreview-website-tester/"&gt;Article on Microsoft Superpreview on sitepoint&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://twitter.com/JustinHar"&gt;Twitter account of Justin Harrison&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;</description><link>http://peter.worksontheweb.net/post/One-tool-to-test-them-all-Microsoft-Expression-Web-SuperPreview.aspx</link><author>peter.nospam@nospam.twototango.be (Peter)</author><comments>http://peter.worksontheweb.net/post/One-tool-to-test-them-all-Microsoft-Expression-Web-SuperPreview.aspx#comment</comments><guid>http://peter.worksontheweb.net/post.aspx?id=703e907c-71de-483d-a525-1e7fab34cda5</guid><pubDate>Mon, 23 Mar 2009 16:20:40 -0500</pubDate><dc:publisher>Peter</dc:publisher><pingback:server>http://peter.worksontheweb.net/pingback.axd</pingback:server><pingback:target>http://peter.worksontheweb.net/post.aspx?id=703e907c-71de-483d-a525-1e7fab34cda5</pingback:target><slash:comments>2</slash:comments><trackback:ping>http://peter.worksontheweb.net/trackback.axd?id=703e907c-71de-483d-a525-1e7fab34cda5</trackback:ping><wfw:comment>http://peter.worksontheweb.net/post/One-tool-to-test-them-all-Microsoft-Expression-Web-SuperPreview.aspx#comment</wfw:comment><wfw:commentRss>http://peter.worksontheweb.net/syndication.axd?post=703e907c-71de-483d-a525-1e7fab34cda5</wfw:commentRss></item><item><title>Before I sign, can I see your codebase?</title><description>&lt;p&gt;Changing employers is always a hard decision to make. Whatever the reason is you found that new opportunity that caught your attention: money, fame, need for a new challenge. There are plenty of jobs in the sea, certainly as a developer, and it's hard to find that one true job. You don't want to end up in a job which has the same drawbacks as your previous gig. If you take the leap you want it to be worthwhile on all areas: financial, job satisfaction, etc. Although the financial aspect is an important part of the decision making it's not the holy grail. For me even more important is job satisfaction. In every job interview they're telling you they have state of the art ASP.Net Turbo 3000 code running on their Windows 2099 machines. But as we all know there is code and there is code.&lt;/p&gt; &lt;p&gt;To be able to make a good decision, the first thing you do is gathering intel. Asking around with friends, former colleague's, friends from friends and so on about the company you're about to sign for. If all those signs are positive and the pay is good (I've been told it should be minimum 10% more then you're current wage), you could ask to meet the team you're going to become a part of. I don't believe in first contact, certainly not at a job interview because everybody is going to be at his best. You will see your future manager for about 2 to 3 hours and he will be looking for people so he will show his most charming side. Your future team mates don't know you so they'll act like the nicest people you've ever worked with because they don't know you. If you sign the contract you're going to spend more than 8 hours per day with these people, only then you will really get to know them. Worst case scenario if the first encounter with the team was a bad one, I would be reluctant to sign. But this is hardly ever the case.&lt;/p&gt; &lt;p&gt;So on what grounds should your decision be based? I've never done this before but I was discussing this topic with some people and it suddenly struck me. They can offer you double the wage you are earning today but if you have to work your way through the next &lt;a href="http://en.wikipedia.org/wiki/Big_ball_of_mud"&gt;big ball of mud&lt;/a&gt; you're nog going to have a lot of fun at your new job. Unless you're looking for a real challenge. But how do you make a distinction between a challenge and professional suicide? The best way to get to know how a company works and what the quality of the codebase is: ask if you can quickly see some codefiles and if they could shortly draw how their application is architected. You'll get a crash course in how the company works and which of the statements the recruiter or manager made about the software methodology they're currently following are really true. It will be enlightning because you'll not be jumping into an abyss, you'll have a better understanding of the risk you are taking. Of course there is always risk involved but calculated risk is in my opinion a part of an exciting life!&lt;/p&gt; &lt;p&gt;Employers can also learn something from this: If you have a neat codebase or some really cool continuous integration system show it to your future employees. It's certainly an extra plus when trying to convince someone to sign for your company.&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:74f1541c-5d08-4fe3-ba49-3f23e17a5656" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Tags from Technorati: &lt;a href="http://technorati.com/tags/job" rel="tag"&gt;job&lt;/a&gt;,&lt;a href="http://technorati.com/tags/interview" rel="tag"&gt;interview&lt;/a&gt;,&lt;a href="http://technorati.com/tags/recruitment" rel="tag"&gt;recruitment&lt;/a&gt;&lt;/div&gt;</description><link>http://peter.worksontheweb.net/post/Before-I-sign-can-I-see-your-codebase.aspx</link><author>peter.nospam@nospam.twototango.be (Peter)</author><comments>http://peter.worksontheweb.net/post/Before-I-sign-can-I-see-your-codebase.aspx#comment</comments><guid>http://peter.worksontheweb.net/post.aspx?id=95548981-c8df-4c06-ab9e-c3863543e949</guid><pubDate>Mon, 19 Jan 2009 19:05:30 -0500</pubDate><dc:publisher>Peter</dc:publisher><pingback:server>http://peter.worksontheweb.net/pingback.axd</pingback:server><pingback:target>http://peter.worksontheweb.net/post.aspx?id=95548981-c8df-4c06-ab9e-c3863543e949</pingback:target><slash:comments>1</slash:comments><trackback:ping>http://peter.worksontheweb.net/trackback.axd?id=95548981-c8df-4c06-ab9e-c3863543e949</trackback:ping><wfw:comment>http://peter.worksontheweb.net/post/Before-I-sign-can-I-see-your-codebase.aspx#comment</wfw:comment><wfw:commentRss>http://peter.worksontheweb.net/syndication.axd?post=95548981-c8df-4c06-ab9e-c3863543e949</wfw:commentRss></item><item><title>Why learning CSS is important in a (web) development world</title><description>&lt;p&gt;I notice that a lot of development effort is going into creating a nice back end. Creating a GUI is a matter of using the designer - better known as system.draggy-droppy - and setting the right colors via the properties panel. But lately a shift has happened which forces developers to learn about CSS. &lt;/p&gt; &lt;h4&gt;Web development&lt;/h4&gt; &lt;p&gt;If you're into web development and I know more and more developers are into it you &lt;strong&gt;must learn&lt;/strong&gt; CSS. It's part of the web and part of web development. It will make your applications slicker and nicer looking. You can make some &lt;a href="http://woork.blogspot.com/2008/03/css-message-box-collection.html"&gt;very slick feedback messages&lt;/a&gt; with CSS. And everyone knows you can create an application with an almost perfect architecture, if it looks like hell you'll need ten times the effort to convince users to use it. &lt;/p&gt; &lt;h4&gt;JQuery&lt;/h4&gt; &lt;p&gt;With the popularity of jQuery, the adoption by Microsoft certainly helped, a lot of developers are starting to learn the pure basics of web development. People are starting to learn the (fantastic) language that JavaScript is. JQuery introduced us to another phenomenon: CSS selectors. You can use CSS selectors to select a certain element on the page. Where CSS used to be for layout only, it is now being used to code. Most developers don't care about layout. If the code works, they are happy. So most developers didn't care about CSS, until now.&lt;/p&gt; &lt;h4&gt;Fizzler .Net&lt;/h4&gt; &lt;p&gt;I recently read about &lt;a href="http://colinramsay.co.uk/diary/2008/10/19/fizzler-a-css-selector-engine-for-c-sharp/"&gt;Fizzler .Net&lt;/a&gt;, a tool which brings CSS selectors to C#. I think this is an excellent idea, using CSS selectors is very intuitive once you get used to it. I even read about using CSS selectors on plain XML files to select elements. That's even a better idea! We certainly haven't seen the last of CSS selectors in server side languages (like C#).&lt;/p&gt; &lt;h4&gt;The problem(s)&lt;/h4&gt; &lt;p&gt;I see 2 main problems. The first problem is browser compatibility. It takes a lot of effort to get certain CSS code to work in all browsers. Specially Internet Explorer 6 can be a real pain in the ass. A lot of developers lose courage when handling yet another problem of: "It works on Firefox but doesn't on IE6". The only solution to this is ... deal with it. Learn the Internet Explorer 6 bugs, try stuff out and get to know the solutions/workarounds. &lt;a href="http://www.noupe.com/css/using-css-to-fix-anything-20-common-bugs-and-fixes.html"&gt;A lot of bugs have been dealt with before&lt;/a&gt; and after creating a few layouts with XHTML &amp;amp; CSS you are able to solve most of your problems.&lt;/p&gt; &lt;p&gt;The second problem is Visual Studio. It really lacks a tool to do good CSS coding. Sure it has intellisense but that's really it. There is a real market for a tool which support the developer who writes CSS in Visual Studio. A Resharper like tool which gives you hints like #ffffff can be abbreviated to #fff. That would really rock my world. I was hoping that &lt;a href="http://www.aggiorno.com/"&gt;Aggiornio&lt;/a&gt; was going to step up the plate but it hasn't so far. Another thing that should be added is cross browser testing. You should at least be able to test the different versions of Internet Explorer. Now you have to use tools like &lt;a href="http://www.my-debugbar.com/wiki/IETester/HomePage"&gt;IETester&lt;/a&gt; and install Firefox, Chrome and Opera on the side to have a decent coverage. &lt;a href="http://litmusapp.com/labs"&gt;CSS Vista&lt;/a&gt; is worth checking out for this but Visual Studio is an IDE and CSS is part of the development cycle. The functionality that CSS Vista has should be incorporated into Visual Studio.&lt;/p&gt; &lt;h4&gt;Conclusion&lt;/h4&gt; &lt;p&gt;What are you waiting for? Good, practical books to get you started are those of &lt;a href="http://www.amazon.com/Eric-Meyer-CSS-Mastering-Language/dp/073571245X/ref=pd_bbs_sr_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1231966771&amp;amp;sr=8-1"&gt;Eric Meyer&lt;/a&gt; and the &lt;a href="http://www.amazon.com/Zen-CSS-Design-Visual-Enlightenment/dp/0321303474/ref=pd_bbs_sr_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1231966790&amp;amp;sr=8-1"&gt;Zen of CSS design&lt;/a&gt;. You can find a lot of other books on my &lt;a href="http://www.shelfari.com/twototango"&gt;Shelfari profile&lt;/a&gt;, do you have an account yet? If not check it out, you can become virtual friends and it's a great way to learn about new books!&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:eeee5c02-2053-41d3-ac98-86d8e15903bb" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Tags from Technorati: &lt;a href="http://technorati.com/tags/css" rel="tag"&gt;css&lt;/a&gt;,&lt;a href="http://technorati.com/tags/jquery" rel="tag"&gt;jquery&lt;/a&gt;,&lt;a href="http://technorati.com/tags/web%20development" rel="tag"&gt;web development&lt;/a&gt;&lt;/div&gt;</description><link>http://peter.worksontheweb.net/post/Why-learning-CSS-is-important-in-a-(web)-development-world.aspx</link><author>peter.nospam@nospam.twototango.be (Peter)</author><comments>http://peter.worksontheweb.net/post/Why-learning-CSS-is-important-in-a-(web)-development-world.aspx#comment</comments><guid>http://peter.worksontheweb.net/post.aspx?id=15737ea5-ed78-4a83-b3e2-1b74598bf0d1</guid><pubDate>Wed, 14 Jan 2009 16:02:48 -0500</pubDate><dc:publisher>Peter</dc:publisher><pingback:server>http://peter.worksontheweb.net/pingback.axd</pingback:server><pingback:target>http://peter.worksontheweb.net/post.aspx?id=15737ea5-ed78-4a83-b3e2-1b74598bf0d1</pingback:target><slash:comments>3</slash:comments><trackback:ping>http://peter.worksontheweb.net/trackback.axd?id=15737ea5-ed78-4a83-b3e2-1b74598bf0d1</trackback:ping><wfw:comment>http://peter.worksontheweb.net/post/Why-learning-CSS-is-important-in-a-(web)-development-world.aspx#comment</wfw:comment><wfw:commentRss>http://peter.worksontheweb.net/syndication.axd?post=15737ea5-ed78-4a83-b3e2-1b74598bf0d1</wfw:commentRss></item><item><title>Posting code on your blog</title><description>&lt;p&gt;If you have a technical blog it's very important that you can somehow easily post code snippets to your blog. I was using the &lt;a href="http://www.jtleigh.com/people/colin/software/CopySourceAsHtml/"&gt;Visual Studio plugin Copy source as HTML&lt;/a&gt; for a while but I wasn't very enthusiastic about the result. I don't like the fact that I need a plugin in Visual Studio to be able to post code to my blog. Visual Studio is for programming. &lt;a href="http://elegantcode.com"&gt;Jan&lt;/a&gt; told me that there was a &lt;a href="http://stevedunns.googlepages.com/codeformatterforwindowslivewriter"&gt;Windows Live Writer plugin&lt;/a&gt; as well to do this. A few days ago I found the best plugin ever. It allows you to paste code into an intermediate window and then formats it for you! &lt;/p&gt; &lt;p&gt;Because &lt;a href="http://www.agileprogrammer.com/dotnetguy/archive/2006/09/07/19030.aspx"&gt;I recently converted to the dark side&lt;/a&gt;, I didn't want my code snippets all to have a black background. But this problem is solved by the plugin without any configuration (As you can see below).&lt;/p&gt; &lt;p&gt;&lt;a href="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/Postingcodeonyourblog_D05B/Picture%205_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="138" alt="Picture 5" src="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/Postingcodeonyourblog_D05B/Picture%205_thumb.png" width="456" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Screenshot from Visual Studio.&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:9bf53f46-eeb8-433f-8a33-1f0b853ff1f5" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="background-color:White;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #0000FF;"&gt;namespace&lt;/span&gt;&lt;span style="color: #000000;"&gt; TwotoContentTests.FilterAttributes
{
    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;class&lt;/span&gt;&lt;span style="color: #000000;"&gt; Class1
    {
    }
}
&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
&lt;p&gt;Code pasted via the Windows Live Writer plugin.&lt;/p&gt;
&lt;p&gt;What are you waiting for? &lt;a href="http://stevedunns.googlepages.com/codeformatterforwindowslivewriter"&gt;Go download it&lt;/a&gt;!&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:147b24c1-5e5f-4082-90a6-f0a07cc957ff" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Tags from Technorati: &lt;a href="http://technorati.com/tags/technical%20blogging" rel="tag"&gt;technical blogging&lt;/a&gt;,&lt;a href="http://technorati.com/tags/blogging" rel="tag"&gt;blogging&lt;/a&gt;,&lt;a href="http://technorati.com/tags/windows%20live%20writer" rel="tag"&gt;windows live writer&lt;/a&gt;,&lt;a href="http://technorati.com/tags/plugin" rel="tag"&gt;plugin&lt;/a&gt;&lt;/div&gt;</description><link>http://peter.worksontheweb.net/post/Posting-code-on-your-blog.aspx</link><author>peter.nospam@nospam.twototango.be (Peter)</author><comments>http://peter.worksontheweb.net/post/Posting-code-on-your-blog.aspx#comment</comments><guid>http://peter.worksontheweb.net/post.aspx?id=de3182fb-b10c-4f32-93f7-c809ef7c1e9e</guid><pubDate>Wed, 31 Dec 2008 09:54:48 -0500</pubDate><dc:publisher>Peter</dc:publisher><pingback:server>http://peter.worksontheweb.net/pingback.axd</pingback:server><pingback:target>http://peter.worksontheweb.net/post.aspx?id=de3182fb-b10c-4f32-93f7-c809ef7c1e9e</pingback:target><slash:comments>0</slash:comments><trackback:ping>http://peter.worksontheweb.net/trackback.axd?id=de3182fb-b10c-4f32-93f7-c809ef7c1e9e</trackback:ping><wfw:comment>http://peter.worksontheweb.net/post/Posting-code-on-your-blog.aspx#comment</wfw:comment><wfw:commentRss>http://peter.worksontheweb.net/syndication.axd?post=de3182fb-b10c-4f32-93f7-c809ef7c1e9e</wfw:commentRss></item><item><title>Testing the OnActionExecuting event of a Controller</title><description>&lt;p&gt;I was doing a bit of refactoring on an ASP.NET MVC web application and was using the OnActionExecuting event in a controller to do authentication. I had not yet written a test for it, blasphemy I know, so that had to be corrected. The controller was&amp;nbsp; something like this:&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:6cace8e6-2a57-4ce0-a0ab-e9ee5b3a373b" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="overflow: auto; background-color: white"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; System.Web.Mvc;

&lt;/span&gt;&lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt;&lt;span style="color: #000000"&gt; TwotoContent.Controllers
{
    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;class&lt;/span&gt;&lt;span style="color: #000000"&gt; ExampleController : Controller
    {
        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;protected&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;override&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt;&lt;span style="color: #000000"&gt; OnActionExecuting(ActionExecutingContext filterContext)
        {
            &lt;/span&gt;&lt;span style="color: #008000"&gt;//&lt;/span&gt;&lt;span style="color: #008000"&gt; check if user is authenticated before executing an action and redirect if not&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #000000"&gt;        }

        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; ActionResult Action()
        {
            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;return&lt;/span&gt;&lt;span style="color: #000000"&gt; View();
        }

        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; ActionResult AnotherAction()
        {
            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;return&lt;/span&gt;&lt;span style="color: #000000"&gt; View();
        }
    }
}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
&lt;p&gt;At first I did a stupid attempt thinking that if I would call a Controller action from the test, the OnActionExecuting would be automatically executed and tested. I quickly find out that's not the case and after thinking it through it would probably suck if it worked like that because you would have to write the same setup code over and over again for every action for which the OnActionExecuting was called. But there must be the another way to call the OnActionExecuting function directly without having to execute an Action.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/TestingtheOnActionExecutingeventofaContr_10EE6/naamloos.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="286" alt="naamloos" src="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/TestingtheOnActionExecutingeventofaContr_10EE6/naamloos_thumb.jpg" width="517" border="0"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;No luck, as you can see you can't separately call the OnActionExecuting event on a controller because it's protected in the Controller base class. I didn't really know what to do so I googled around a bit and found &lt;a href="http://quickstarts.asp.net/previews/mvc/mvc_CreateActionFilter.htm"&gt;this article about creating your own action filter&lt;/a&gt;. It seems that the OnActionExecuting event is public when you create your own custom ActionFilter. What is an ActionFilter you ask? Let me quote from the article: "An action filter consists of logic that runs directly before or directly after an action method runs. You can use action filters for logging, authentication, output caching, or other uses." Exactly what I needed in other words. So after refactoring a bit I came up with the following code:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:6352c9ea-b68c-4258-bf07-38a606d7d977" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="overflow: auto; background-color: white"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; System.Web.Mvc;

&lt;/span&gt;&lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt;&lt;span style="color: #000000"&gt; TwotoContent.Controllers
{
    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;class&lt;/span&gt;&lt;span style="color: #000000"&gt; ExampleController : Controller
    {
        [ExampleActionFilter]
        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; ActionResult Action()
        {
            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;return&lt;/span&gt;&lt;span style="color: #000000"&gt; View();
        }

        [ExampleActionFilter]
        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; ActionResult AnotherAction()
        {
            &lt;/span&gt;&lt;span style="color: #0000ff"&gt;return&lt;/span&gt;&lt;span style="color: #000000"&gt; View();
        }
    }

    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;class&lt;/span&gt;&lt;span style="color: #000000"&gt; ExampleActionFilterAttribute : ActionFilterAttribute
    {
        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;override&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt;&lt;span style="color: #000000"&gt; OnActionExecuting(ActionExecutingContext filterContext)
        {
            &lt;/span&gt;&lt;span style="color: #008000"&gt;//&lt;/span&gt;&lt;span style="color: #008000"&gt; check if user is authenticated before executing an action&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #000000"&gt;        }
    }
}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Now the OnActionExecuting method in the ActionFilter attribute can now be tested as followed:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:98ef65db-81c0-46a2-89f1-21564f951086" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="overflow: auto; background-color: white"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; System;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; System.Collections.Generic;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; System.Web;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; System.Web.Mvc;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; System.Web.Routing;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; NUnit.Framework;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; Rhino.Mocks;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt;&lt;span style="color: #000000"&gt; TwotoContent.Controllers;

&lt;/span&gt;&lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt;&lt;span style="color: #000000"&gt; TwotoContentTests.FilterAttributes
{
    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;class&lt;/span&gt;&lt;span style="color: #000000"&gt; When_executing_an_event
    {
        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt;&lt;span style="color: #000000"&gt; ActionExecutingContext _context;
        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt;&lt;span style="color: #000000"&gt; ExampleController _controller;

        [SetUp]
        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt;&lt;span style="color: #000000"&gt; SetUp()
        {
            _controller &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; ExampleController();
            _context &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; ActionExecutingContext(&lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; ControllerContext(MockRepository.GenerateMock&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #000000"&gt;HttpContextBase&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;(),
                                                                        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; RouteData(),
                                                                        _controller),
                                                  &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; Dictionary&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="color: #0000ff"&gt;object&lt;/span&gt;&lt;span style="color: #000000"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;());
        }

        [Test]
        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt;&lt;span style="color: #000000"&gt; Then_the_authenticated_indicator_must_be_set()
        {
            var subjectUnderTest &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;new&lt;/span&gt;&lt;span style="color: #000000"&gt; ExampleActionFilterAttribute();

            subjectUnderTest.OnActionExecuting(_context);

            var authenticatedIndicator &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; Convert.ToBoolean(_context.Controller.ViewData[&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;authenticated&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;]);

            Assert.That(authenticatedIndicator &lt;/span&gt;&lt;span style="color: #000000"&gt;==&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;true&lt;/span&gt;&lt;span style="color: #000000"&gt;);
        }
    }
}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I first set up an ActionExecutingContext with a controller so it can be passed to the OnActionExecuting function. In the test I create an instance of the class that is under test, in this case the ExampleActionFilterAttribute class. As you can see the OnActionExecuting function can be called directly (because it's public in the base class). After executing the function I read a variable from the ViewData collection via the context that was set up earlier. Finally I test if the variable in the ViewData is filled out correctly. You actually need quite some setup code to be able to mock an ActionExecutingContext. Because I didn't need the HttpContextBase I have just injected a mock. This minimalizes the amount of Setup code that is needed.&lt;/p&gt;
&lt;p&gt;I can't really think of a reason why the OnActionExecuting event is protected on the base Controller class and is public on the ActionFilter class. A benefit of this approach is that it results in a smaller controller class and an ActionFilter we can reuse over various controller classes. So nothing but advantages! Maybe this isn't the best solution but it worked for me. Ideas/additions/rants are always welcome.&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:2b9b15e0-0b9d-4546-a91b-564b91a60719" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Tags van Technorati: &lt;a href="http://technorati.com/tags/asp.net" rel="tag"&gt;asp.net&lt;/a&gt;,&lt;a href="http://technorati.com/tags/asp.net%20mvc" rel="tag"&gt;asp.net mvc&lt;/a&gt;,&lt;a href="http://technorati.com/tags/web%20development" rel="tag"&gt;web development&lt;/a&gt;,&lt;a href="http://technorati.com/tags/unit%20testing" rel="tag"&gt;unit testing&lt;/a&gt;&lt;/div&gt;</description><link>http://peter.worksontheweb.net/post/Testing-the-OnActionExecuting-event-of-a-Controller.aspx</link><author>peter.nospam@nospam.twototango.be (Peter)</author><comments>http://peter.worksontheweb.net/post/Testing-the-OnActionExecuting-event-of-a-Controller.aspx#comment</comments><guid>http://peter.worksontheweb.net/post.aspx?id=95147e96-79df-406a-a44d-639d3a041721</guid><pubDate>Sun, 28 Dec 2008 13:15:06 -0500</pubDate><dc:publisher>Peter</dc:publisher><pingback:server>http://peter.worksontheweb.net/pingback.axd</pingback:server><pingback:target>http://peter.worksontheweb.net/post.aspx?id=95147e96-79df-406a-a44d-639d3a041721</pingback:target><slash:comments>2</slash:comments><trackback:ping>http://peter.worksontheweb.net/trackback.axd?id=95147e96-79df-406a-a44d-639d3a041721</trackback:ping><wfw:comment>http://peter.worksontheweb.net/post/Testing-the-OnActionExecuting-event-of-a-Controller.aspx#comment</wfw:comment><wfw:commentRss>http://peter.worksontheweb.net/syndication.axd?post=95147e96-79df-406a-a44d-639d3a041721</wfw:commentRss></item><item><title>VMWare Fusion vs Parallels</title><description>&lt;p&gt;
I have been using a Mac as my main development machine for over a year now. I have been very happy with it, you could call me an Apple fanboy. Because I develop in the .Net framework, and I&amp;#39;m not planning on changing that, I had to find a solution to be able to run Windows on my Mac. There are two options to get that done:
&lt;/p&gt;
 
&lt;ul&gt;
	 
	&lt;li&gt;Installing Bootcamp: this implies that you have to reboot your machine to get to Windows  &lt;/li&gt;
	&lt;li&gt;Virtualization: running Windows as a virtual machine on top of Mac OS X&lt;/li&gt;
&lt;/ul&gt;
 
&lt;p&gt;
The first reason I changed to Mac was the slick design but after using it intensively I came to realize that that isn&amp;#39;t the strong point of a Mac. The strong point of the Mac is OS X. It&amp;#39;s a robust operating system that doesn&amp;#39;t get in your way. I was so pleased with OS X that I wanted to use my Mac for all general computer use (surfing, email, ...) and just use Windows as a shell for Visual Studio. So Bootcamp was no option for me.
&lt;/p&gt;
 
&lt;p&gt;
&lt;a href="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/VMWareFusionvsParallels_3FD/parallels-logo_2.png"&gt;&lt;img style="border-width: 0px; margin: 0px 25px 0px 0px" src="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/VMWareFusionvsParallels_3FD/parallels-logo_thumb.png" border="0" alt="parallels-logo" width="155" height="137" align="left" /&gt;&lt;/a&gt; The first choice was made, I wanted to work with Virtual Machines to run Windows on my Mac. There are two virtualization solutions on Mac, &lt;a href="http://www.vmware.com/mac"&gt;VMWare Fusion&lt;/a&gt; and &lt;a href="http://www.parallels.com/"&gt;Parallels&lt;/a&gt;. Because a good friend of mine, who has an &lt;a href="http://www.in-transit.be/"&gt;excellent video production company&lt;/a&gt; by the way, recommended me Parallels I went for that solution and never looked back ... until a few days ago.
&lt;/p&gt;
 
&lt;p&gt;
I was trying to set up a new Parallels Virtual Machine and was installing Windows XP. After 5 tries I had given up. Windows (in Parallels) kept throwing blue screens at me. In the past I had never had this problem. So out of frustration I decided to try VMWare Fusion. I installed it and created my first VMWare Virtual Machine. The first killer feature I noticed is that the desktop and documents is shared between your virtual machine and Mac OS X. It is very easy to copy files between the two.
&lt;/p&gt;
 
&lt;p&gt;
The perfect situation for me is that I have one Virtual Machine, which I can copy if I want to test something like an early b&amp;egrave;ta and then delete it when I&amp;#39;m done. In this way I don&amp;#39;t have to install &lt;a href="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/VMWareFusionvsParallels_3FD/vmware-fusion-logo_2.jpg"&gt;&lt;img style="border-width: 0px; margin: 0px 0px 0px 25px" src="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/VMWareFusionvsParallels_3FD/vmware-fusion-logo_thumb.jpg" border="0" alt="vmware-fusion-logo" width="132" height="132" align="right" /&gt;&lt;/a&gt;application after application that I don&amp;#39;t use in my Virtual Machine and I can keep my Windows clean. A VMWare virtual machine is only one file, you can copy it and when you boot it VMWare Fusion detects that the VM is copied. A Parallels Virtual Machine exists of several files and is less easier to copy. Another point scored by VMWare Fusion.
&lt;/p&gt;
 
&lt;p&gt;
While doing some research on the two products, I noticed that Parallels is popular with designers and VMWare Fusion is more used by programmers. The fact that Parallels is so popular is in my opinion because of the design of the product. Starting a virtual machine is very slick, you&amp;#39;ve got rotating windows and stuff like that which makes it a great experience. Developers who use VMWare Fusion are mostly coming from Windows, on which VMWare is already very popular. On top of that, I have the feeling that VMWare Fusion is a little more robust then Parallels. A .Net developer tends to use his virtual machines a bit more thoroughly then a designer who most of the time just uses them to do some cross platform testing. I think that explains why designer prefers Parallels and developers prefer VMWare Fusion.
&lt;/p&gt;
 
&lt;p&gt;
So I&amp;#39;ve made the switch VMWare Fusion and I&amp;#39;m very happy with it at the moment. Are there any .Net developers on Mac among my readers? Which virtualization platform do you guys use?
&lt;/p&gt;
 
&lt;p&gt;
There is one thing that almost made me throw VMWare Fusion out of the window. The next screenshot explains it all:
&lt;/p&gt;
 
&lt;p&gt;
&lt;a href="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/VMWareFusionvsParallels_3FD/Picture%201_2.png"&gt;&lt;img style="border-width: 0px" src="http://peter.worksontheweb.net/image.axd?picture=WindowsLiveWriter/VMWareFusionvsParallels_3FD/Picture%201_thumb.png" border="0" alt="Picture 1" width="244" height="64" /&gt;&lt;/a&gt;
&lt;/p&gt;
 
&lt;p&gt;
Notice the Install McAfee menu item, I hope VMWare got a lot of money out of it because I really hate it when stuff like this get incorporated into a good product.
&lt;/p&gt;
 
&lt;p&gt;
&lt;strong&gt;Note: I haven&amp;#39;t tested Parallels 4 yet, I wrote this post before it came out.&lt;/strong&gt;
&lt;/p&gt;
</description><link>http://peter.worksontheweb.net/post/VMWare-Fusion-vs-Parallels.aspx</link><author>peter.nospam@nospam.twototango.be (Peter)</author><comments>http://peter.worksontheweb.net/post/VMWare-Fusion-vs-Parallels.aspx#comment</comments><guid>http://peter.worksontheweb.net/post.aspx?id=5286b784-0c03-47ad-8c4b-82caefdeaec3</guid><pubDate>Sun, 30 Nov 2008 05:27:00 -0500</pubDate><dc:publisher>Peter</dc:publisher><pingback:server>http://peter.worksontheweb.net/pingback.axd</pingback:server><pingback:target>http://peter.worksontheweb.net/post.aspx?id=5286b784-0c03-47ad-8c4b-82caefdeaec3</pingback:target><slash:comments>3</slash:comments><trackback:ping>http://peter.worksontheweb.net/trackback.axd?id=5286b784-0c03-47ad-8c4b-82caefdeaec3</trackback:ping><wfw:comment>http://peter.worksontheweb.net/post/VMWare-Fusion-vs-Parallels.aspx#comment</wfw:comment><wfw:commentRss>http://peter.worksontheweb.net/syndication.axd?post=5286b784-0c03-47ad-8c4b-82caefdeaec3</wfw:commentRss></item><item><title>Austin and Kaizenconf Part 2</title><description>&lt;h4&gt;Using and abusing ASP.NET MVC for fun and profit&lt;/h4&gt; &lt;p&gt;Being a huge fan of ASP.NET MVC, I couldn't miss the opportunity to see guys that are much smarter than I am show off how they use the MVC framework. &lt;a href="http://codebetter.com/blogs/jeremy.miller/"&gt;Jeremy&lt;/a&gt; and &lt;a href="http://www.lostechies.com/blogs/chad_myers/"&gt;Chad&lt;/a&gt; showed real code of how they had been using the ASP.NET MVC framework in their projects. &lt;/p&gt; &lt;p&gt;Because this is a brand new framework, I have these moments when I'm using it that it doesn't feel quite right. I feel that the way I'm coding something isn't the best way to do it, but I don't know how to get around it. While sitting in the session I had a lot of aha-moments, I saw how other people tackled problems that I couldn't wrap my head around until now.&lt;/p&gt; &lt;p&gt;These are some key points that from now on I will try to keep in mind while using the ASP.NET MVC framework:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Keep your views light, your controllers medium and your model heavy  &lt;li&gt;HttpContext is your enemy, controllers should not come in direct contact with the HttpContext even now it's mockable  &lt;li&gt;Get rid of magic strings (for example hashtable examples like ViewData) &lt;li&gt;Thunderome principle &lt;li&gt;No if's or foreach's in the view, use extension methods, htmlhelpers and partial views to get rid of logic in your view&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Another thing I couldn't wrap my head around before seeing this session was unit testing javascript with QUnit. I did write some tests with it but again bumped into some road blocks. It was great to see that other people used it with success. I'll probably be writing a blog post about this in the future, as I'm planning on taking the quality of my javascript code to the next level.&lt;/p&gt; &lt;p&gt;Last but not least was a demo that Jeremy gave of StoryTeller, it was a short demo but it looked very promising. I highly recommend viewing the session, you can find the video's at the &lt;a href="http://kaizenconf.pbwiki.com/Media"&gt;KaizenConf wiki&lt;/a&gt;.&lt;/p&gt; &lt;h4&gt;Presentation Patterns&lt;/h4&gt; &lt;p&gt;This time Jeremy paired up with &lt;a href="http://blogs.msdn.com/gblock/"&gt;Glenn Block&lt;/a&gt; to tell us more about presentation patterns. They talked about several presentation patterns including passive view, supervising controller and view-viewmodel-model. The thing I realized is that I'm not using presentation patterns enough in my day to day job and that I should start using them where I can as soon as possible.&lt;/p&gt; &lt;h4&gt;Open space&lt;/h4&gt; &lt;p&gt;After the fantastic sessions it was time to kick off the open space. This was my first open space and I didn't really know what to expect. &lt;a href="http://www.stevenlist.com/"&gt;Doc List&lt;/a&gt; coordinated it all and it was a great learning experience. We started with a fishbowl, after which everyone participating could propose subjects. After that everyone voted and the topics that he or she was interested in. The schedule was formed.&lt;/p&gt; &lt;p&gt;An open space leans on four principles:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Whoever comes is the right people&lt;/li&gt; &lt;li&gt;Whatever happens is the only thing that could have&lt;/li&gt; &lt;li&gt;Whenever it starts is the right time&lt;/li&gt; &lt;li&gt;When it's over it's over&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;I followed a lot of sessions and have a lot of loose notes. I had a really good feeling with the concept of open space. The sessions are more debates and the participants discuss the things they want to talk about, not only what the speaker wants to show. Because almost everyone is participating you learn a lot from each other.&lt;/p&gt; &lt;h4&gt;Conclusion&lt;/h4&gt; &lt;p&gt;This was by far the best conference I've ever been to. I've learned so many things in such a short period of time. I would like to thank everyone who we met in Austin specially &lt;a href="http://thepiratescode.blogspot.com/"&gt;Conrad&lt;/a&gt; and &lt;a href="http://thepiratescode.blogspot.com/"&gt;Michael&lt;/a&gt; for letting us tag along and of course &lt;a href="http://twitter.com/sbellware"&gt;Scott&lt;/a&gt; for organizing the whole thing. If you are interested, there as a LOT of material produced you can find it on the &lt;a href="http://kaizenconf.pbwiki.com"&gt;KaizenConf wiki&lt;/a&gt;.&lt;/p&gt;</description><link>http://peter.worksontheweb.net/post/Austin-and-Kaizenconf-Part-2.aspx</link><author>peter.nospam@nospam.twototango.be (Peter)</author><comments>http://peter.worksontheweb.net/post/Austin-and-Kaizenconf-Part-2.aspx#comment</comments><guid>http://peter.worksontheweb.net/post.aspx?id=c3096de2-c4fe-4e5e-afbb-c14a8c95f25e</guid><pubDate>Sun, 23 Nov 2008 05:19:43 -0500</pubDate><category>ASP.NET MVC</category><category>KaizenConf</category><dc:publisher>Peter</dc:publisher><pingback:server>http://peter.worksontheweb.net/pingback.axd</pingback:server><pingback:target>http://peter.worksontheweb.net/post.aspx?id=c3096de2-c4fe-4e5e-afbb-c14a8c95f25e</pingback:target><slash:comments>0</slash:comments><trackback:ping>http://peter.worksontheweb.net/trackback.axd?id=c3096de2-c4fe-4e5e-afbb-c14a8c95f25e</trackback:ping><wfw:comment>http://peter.worksontheweb.net/post/Austin-and-Kaizenconf-Part-2.aspx#comment</wfw:comment><wfw:commentRss>http://peter.worksontheweb.net/syndication.axd?post=c3096de2-c4fe-4e5e-afbb-c14a8c95f25e</wfw:commentRss></item><item><title>Austin and Kaizenconf Part 1 - workshops</title><description>&lt;p&gt;It's finally there, &lt;a href="http://vanryswyckjan.blogspot.com/"&gt;Jan&lt;/a&gt; and I departed from Belgium to Austin, Texas to attend &lt;a href="http://www.kaizenconf.com/"&gt;Kaizenconf&lt;/a&gt;. I have been looking forward to this for quite a while. It didn't start out good when I spilled my first drink on the plane, but it only got better from then on. After a long flight with a stopover in Atlanta we arrived at the Austin airport. A lot smaller then I expected but that didn't really matter.&lt;/p&gt; &lt;h4&gt;Advanced NHibernate&lt;/h4&gt; &lt;p&gt;On the first 2 days of &lt;a href="http://www.kaizenconf.com/"&gt;Kaizenconf&lt;/a&gt; some promising workshops where scheduled, we decided to go listen to the great &lt;a href="http://ayende.com/Blog/"&gt;ayende&lt;/a&gt; talking about Advanced NHibernate. The talk started off with a blast when ayende gave a demo of the &lt;a href="http://ayende.com/Blog/archive/2008/10/29/nh-prof-teaser.aspx"&gt;NHibernate Profiler&lt;/a&gt; that is being developed. Although beta it looks like this will be a real hit and it will help developers to get to know and control NHibernate better. I don't see myself as an advanced NHibernate user but it was nice to follow a workshop that isn't the usual introduction on how to create a Northwind CRUD application. &lt;/p&gt; &lt;p&gt;Below is a screenshot of the NHibernate Profiler, although it's not the best of quality you can see the query that NHibernate has generated, the different queries that were fired onto the database and much more. Very, very promising!&lt;/p&gt; &lt;p&gt;&lt;img src="http://farm4.static.flickr.com/3294/2987788138_04f4e85a40.jpg?v=0"&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Another topic that was explained is the use of &lt;a href="http://incubator.apache.org/lucene.net/"&gt;Lucene&lt;/a&gt; with NHibernate. By using a couple of attributes on your domain models to indicate which parts should be indexed, you get a very easy way to make your data searchable. Because the original is always better, here is a short video where the advantages of using Lucene with NHibernate are explained:&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:7bb7cba9-61a8-4548-a971-9e2e0ff58fe0" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;div&gt;&lt;object width="400" height="300"&gt;	&lt;param name="allowfullscreen" value="true" /&gt;	&lt;param name="allowscriptaccess" value="always" /&gt;	&lt;param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=2114645&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" /&gt;	&lt;embed src="http://vimeo.com/moogaloop.swf?clip_id=2114645&amp;amp;server=vimeo.com&amp;amp;show_title=1&amp;amp;show_byline=1&amp;amp;show_portrait=0&amp;amp;color=&amp;amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="300"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;a href="http://vimeo.com/2114645?pg=embed&amp;amp;sec=2114645"&gt;Advanced NHibernate: Lucene NHibernate Search&lt;/a&gt; from &lt;a href="http://vimeo.com/twototango?pg=embed&amp;amp;sec=2114645"&gt;Two to Tango&lt;/a&gt; on &lt;a href="http://vimeo.com?pg=embed&amp;amp;sec=2114645"&gt;Vimeo&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt; &lt;p&gt;We went on to NHibernate caching and again I discovered something that will change the way I use NHibernate on a daily basis. Seems like caching is actually very intelligent but, as with everything, you have to watch out not to shoot in your own foot. Oren showed us an example that called the database 4 times without using any caching and called the database 42, yes forty-two, times with badly configured caching.&lt;/p&gt; &lt;p&gt;Here are some random notes I took that I'd like to keep in mind for future use of NHibernate:&lt;/p&gt; &lt;p&gt;- When loading an object via session.Load the query gets fired when the object is being accessed, not when the Load() function is called&lt;/p&gt; &lt;p&gt;- NHibernate solves threading issues with caching by returning different instances of the same object to different users&lt;/p&gt; &lt;p&gt;- Queries can also be cached, call the SetCacheable(true) function on every occurrence of the given query you want to cache&lt;/p&gt; &lt;p&gt;After this excellent session we were looking for something to eat. Luckily some of the attendees (thank you Chris and Tim) were kind enough to give us a ride to Rudy's BBQ where we learned that 'Real people eat meat'. I don't think they have a lot of veggies under their customers.&lt;/p&gt; &lt;p&gt;&lt;img src="http://farm4.static.flickr.com/3232/2986805661_2b5eba1c30.jpg?v=0"&gt; &lt;/p&gt; &lt;h4&gt;&lt;a href="http://codebetter.com/blogs/matthew.podwysocki/archive/2008/10/24/kaizenconf-functional-programming-is-it-a-game-changer.aspx"&gt;Functional programming - Is it a game changer?&lt;/a&gt;&lt;/h4&gt; &lt;p&gt;For the second workshop a difficult choice had to be made. It was choosing between the DDD chalk talk of David Laribee or the workshop about Functional programming of Matt Podwysocki. You probably already guessed the one I chose. This was something completely different then the NHibernate talk and Matt asked several times if our brain hadn't exploded yet, and if I'm honest I had to answer yes every time he asked it. There was a lo-hot of information to take in.&lt;/p&gt; &lt;p&gt;The first part of the presentation was about making C# more functional. By heavily using the new features in C# 3.0, a lot of for-each loops could be eliminated with the help of stuff like LINQ and lambda expressions. Matt told us that F# is very good at math stuff, the software that determines the best player in Halo 3 is written in F#. Because F# has a specific purpose, there will &lt;strong&gt;never&lt;/strong&gt; be a designer to create GUI's or web pages using F#. I think I heard a little cheering in the room after those words. I still have to take a closer look to the abundance of examples Matt provided us to be able to give a deeper insight into F# so I'll leave it at that for now.&lt;/p&gt; &lt;p&gt;Although I'd like to show a piece of code that Matt shared to point out the dangers that come with lazy evaluation of code:&lt;/p&gt; &lt;p style="font-size: 10pt; background: white; margin: 0px; color: black; font-family: courier new"&gt;Func&amp;lt;&lt;span style="color: #2b91af"&gt;String&lt;/span&gt;&amp;gt; GetContent;&lt;/p&gt; &lt;p style="font-size: 10pt; background: white; margin: 0px; color: black; font-family: courier new"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="font-size: 10pt; background: white; margin: 0px; color: black; font-family: courier new"&gt;&lt;span style="color: blue"&gt;using&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;StreamReader&lt;/span&gt; fileStream)&lt;/p&gt; &lt;p style="font-size: 10pt; background: white; margin: 0px; color: black; font-family: courier new"&gt;{&lt;/p&gt; &lt;p style="font-size: 10pt; background: white; margin: 0px; color: black; font-family: courier new"&gt;&amp;nbsp;&amp;nbsp; GetContent = fileStream.ReadToEnd();&lt;/p&gt; &lt;p style="font-size: 10pt; background: white; margin: 0px; color: black; font-family: courier new"&gt;}&lt;/p&gt; &lt;p style="font-size: 10pt; background: white; margin: 0px; color: black; font-family: courier new"&gt;&amp;nbsp;&lt;/p&gt; &lt;p style="font-size: 10pt; background: white; margin: 0px; color: black; font-family: courier new"&gt;&lt;span style="color: #2b91af"&gt;String&lt;/span&gt; content = GetContent();&lt;/p&gt; &lt;p&gt;Because the fileStream is out of scope when calling the GetContent function reference, this will give unexpected behavior which is very hard to debug if you ask me. Another good session for which I'd like to thank Matt.&lt;/p&gt; &lt;p&gt;The conclusion of the first day of kaizenconf is very good. As I already said the sessions were of high quality. I'm already looking forward to day 2 which has an ASP.Net MVC session given by Jeremy Miller and Chad Myers. Very exciting!&lt;/p&gt;</description><link>http://peter.worksontheweb.net/post/Austin-and-Kaizenconf-Part-1-workshops.aspx</link><author>peter.nospam@nospam.twototango.be (Peter)</author><comments>http://peter.worksontheweb.net/post/Austin-and-Kaizenconf-Part-1-workshops.aspx#comment</comments><guid>http://peter.worksontheweb.net/post.aspx?id=ddc49c7c-fdf1-49a8-ac0d-a3e648109c86</guid><pubDate>Sat, 01 Nov 2008 21:16:14 -0500</pubDate><dc:publisher>Peter</dc:publisher><pingback:server>http://peter.worksontheweb.net/pingback.axd</pingback:server><pingback:target>http://peter.worksontheweb.net/post.aspx?id=ddc49c7c-fdf1-49a8-ac0d-a3e648109c86</pingback:target><slash:comments>0</slash:comments><trackback:ping>http://peter.worksontheweb.net/trackback.axd?id=ddc49c7c-fdf1-49a8-ac0d-a3e648109c86</trackback:ping><wfw:comment>http://peter.worksontheweb.net/post/Austin-and-Kaizenconf-Part-1-workshops.aspx#comment</wfw:comment><wfw:commentRss>http://peter.worksontheweb.net/syndication.axd?post=ddc49c7c-fdf1-49a8-ac0d-a3e648109c86</wfw:commentRss></item></channel>
</rss>
