<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-453286148678307547</id><updated>2012-02-12T12:53:45.350-08:00</updated><category term='Jobs'/><category term='Tools'/><category term='Code Snippets'/><category term='asp.net charts c# javascript'/><category term='Fluent API'/><category term='Code Review'/><category term='Javascript'/><category term='Discussions'/><title type='text'>Develocity</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Robert Taylor</name><uri>http://www.blogger.com/profile/17656686243105089817</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>23</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-453286148678307547.post-647234863501605193</id><published>2010-07-17T06:57:00.001-07:00</published><updated>2010-07-17T07:02:09.075-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Jobs'/><title type='text'>How to Find and Land a .NET Development Job</title><content type='html'>My developer job resource kit is now available. It's called "Shove It, FizzBuzz: How to find and land a .NET development job."&lt;div&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://shoveitfizzbuzz.com/"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 238px; height: 320px;" src="http://1.bp.blogspot.com/_JJCxaUuf-5Q/TEG3IHqV91I/AAAAAAAAY1o/d4z3fz1zpC8/s320/shoveitfizzbuzz_bookcover_s.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5494874370492200786" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;What's included in this kit?&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style=" color: rgb(56, 45, 44);  line-height: 19px; font-family:Helvetica, Arial, 'Liberation Sans', FreeSans, sans-serif;font-size:13px;"&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 13px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 20px; border-style: initial; border-color: initial; font-weight: normal; font-style: normal; font-family: inherit; text-align: left; color: rgb(68, 68, 68) !important; background-position: initial initial; background-repeat: initial initial; "&gt;The kit includes a 200+ page eBook (PDF) that teaches you how to get the job you want (and will make you a better developer in the process). It contains tips on improving your overall developer marketability, 110+ technical questions (with answers), plus general interview questions, puzzle questions, and more.&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 13px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 20px; border-style: initial; border-color: initial; font-weight: normal; font-style: normal; font-family: inherit; text-align: left; color: rgb(68, 68, 68) !important; background-position: initial initial; background-repeat: initial initial; "&gt;The kit also includes software that simulates an actual interview and can help boost your confidence during the real thing. You could also just use the software to keep yourself on top of the latest technologies.&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 13px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 20px; border-style: initial; border-color: initial; font-weight: normal; font-style: normal; font-family: inherit; text-align: left; color: rgb(68, 68, 68) !important; background-position: initial initial; background-repeat: initial initial; "&gt;Last, but not least, the kit includes a customizable resume (in Word format) that has proven to be effective at getting people jobs.&lt;/p&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 8px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; outline-width: 0px; outline-style: initial; outline-color: initial; font-size: 13px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; line-height: 20px; border-style: initial; border-color: initial; font-weight: normal; font-style: normal; font-family: inherit; text-align: left; color: rgb(68, 68, 68) !important; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;a href="http://shoveitfizzbuzz.com/"&gt;http://shoveitfizzbuzz.com&lt;/a&gt;&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/453286148678307547-647234863501605193?l=develocity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/647234863501605193/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=453286148678307547&amp;postID=647234863501605193' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/647234863501605193'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/647234863501605193'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/2010/07/how-to-find-and-land-net-development.html' title='How to Find and Land a .NET Development Job'/><author><name>Dave Haynes</name><uri>http://www.blogger.com/profile/14398394041644839400</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-nHfqFMn9q3w/TYtlFxYOW-I/AAAAAAAAbho/wl51gBkfZrk/s220/DaveHaynes.png'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_JJCxaUuf-5Q/TEG3IHqV91I/AAAAAAAAY1o/d4z3fz1zpC8/s72-c/shoveitfizzbuzz_bookcover_s.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-453286148678307547.post-4773011121420999711</id><published>2010-05-14T14:37:00.001-07:00</published><updated>2010-05-14T14:39:23.494-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Code Snippets'/><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><title type='text'>Repeating and aligning elements using jQuery and CSS</title><content type='html'>&lt;p&gt;Today I had a need to create a dynamic list of checkboxes, and I wanted them all aligned properly, so the results would look something like this:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.downcastsystems.com/blog/CreatingaRepeaterusingjQueryandCSS_F481/image.png" width="508" height="105" /&gt;&lt;/p&gt;  &lt;p&gt;The layout was simple with CSS, then I added some jQuery to simulate getting the checkbox items dynamically.&lt;/p&gt;  &lt;p&gt;Example:&lt;/p&gt;  &lt;div style="margin: 0px; display: block" id="iframeDivab341eb1-df20-4c61-9c90-52899adeaa32"&gt;&lt;iframe style="border-bottom: #e0e0e0 1px solid; border-left: #e0e0e0 1px solid; margin: 0px; width: 600px; height: 480px; border-top: #e0e0e0 1px solid; border-right: #e0e0e0 1px solid" id="iframeab341eb1-df20-4c61-9c90-52899adeaa32" src="http://www.blogtrog.com/code.aspx?id=ab341eb1-df20-4c61-9c90-52899adeaa32" frameborder="0"&gt;&lt;/iframe&gt;&lt;/div&gt;  &lt;div style="margin: 0px; display: none" id="noIframeDivab341eb1-df20-4c61-9c90-52899adeaa32"&gt;   &lt;pre&gt;&lt;div&gt;&lt;!--&lt;br /&gt;&lt;br /&gt;Code highlighting produced by Actipro CodeHighlighter (freeware)&lt;br /&gt;http://www.CodeHighlighter.com/&lt;br /&gt;&lt;br /&gt;--&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;html&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;head&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;Simple repeater&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;title&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;style &lt;/span&gt;&lt;span style="color: #ff0000"&gt;type&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;text/css&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #800000"&gt;&lt;br /&gt;    .repeater &lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;{&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #ff0000"&gt; list-style-type&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;:&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #0000ff"&gt; none&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #ff0000"&gt; &lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;}&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #800000"&gt;&lt;br /&gt;    .repeater li &lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;{&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #ff0000"&gt; float&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;:&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #0000ff"&gt; left&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #ff0000"&gt; width&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;:&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #0000ff"&gt; 150px&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #ff0000"&gt; &lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;}&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #800000"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;style&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;script &lt;/span&gt;&lt;span style="color: #ff0000"&gt;src&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&amp;quot;&lt;/span&gt;&lt;span style="color: #ff0000"&gt; type&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;script&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;script &lt;/span&gt;&lt;span style="color: #ff0000"&gt;type&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&lt;br /&gt;    $(document).ready(&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #0000ff"&gt;function&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;()&lt;br /&gt;    {&lt;br /&gt;        &lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #0000ff"&gt;var&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt; names &lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;=&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt; [&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;Tanya&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;, &lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;Julia&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;, &lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;Avery&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;, &lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;Dave&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;, &lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;Robert&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;, &lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;Howard&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;, &lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;Greg&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;, &lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;Scott&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;];&lt;br /&gt;                     &lt;br /&gt;        &lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #0000ff"&gt;for&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt; (i &lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;=&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt; &lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;0&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;; i &lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt; names.length; i&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;++&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;)&lt;br /&gt;        {&lt;br /&gt;            $(&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;#peopleCheckboxGroup&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;)&lt;br /&gt;                .append(&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;lt;li&amp;gt;&amp;lt;input type='checkbox' /&amp;gt;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt; &lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;+&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt; names[i] &lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;+&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt; &lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;&amp;quot;&lt;/span&gt;&lt;span style="background-color: #f5f5f5; color: #000000"&gt;)&lt;br /&gt;        }&lt;br /&gt;    });&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;script&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;head&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;body&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ul &lt;/span&gt;&lt;span style="color: #ff0000"&gt;id&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;peopleCheckboxGroup&amp;quot;&lt;/span&gt;&lt;span style="color: #ff0000"&gt; class&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;repeater&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ul&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;body&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;html&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"&gt;&lt;/script&gt;&lt;script language='javascript' type='text/javascript'&gt;bt_code_init('ab341eb1-df20-4c61-9c90-52899adeaa32');&lt;/script&gt;That example produces a list that adjusts appropriately when resized:&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://www.downcastsystems.com/blog/CreatingaRepeaterusingjQueryandCSS_F481/image_3.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.downcastsystems.com/blog/CreatingaRepeaterusingjQueryandCSS_F481/image_thumb.png" width="192" height="207" /&gt;&lt;/a&gt; &lt;a href="http://www.downcastsystems.com/blog/CreatingaRepeaterusingjQueryandCSS_F481/image_4.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.downcastsystems.com/blog/CreatingaRepeaterusingjQueryandCSS_F481/image_thumb_3.png" width="302" height="200" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/453286148678307547-4773011121420999711?l=develocity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/4773011121420999711/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=453286148678307547&amp;postID=4773011121420999711' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/4773011121420999711'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/4773011121420999711'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/2010/05/repeating-and-aligning-elements-using.html' title='Repeating and aligning elements using jQuery and CSS'/><author><name>Dave Haynes</name><uri>http://www.blogger.com/profile/14398394041644839400</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-nHfqFMn9q3w/TYtlFxYOW-I/AAAAAAAAbho/wl51gBkfZrk/s220/DaveHaynes.png'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-453286148678307547.post-6933133989104002513</id><published>2010-04-26T10:50:00.001-07:00</published><updated>2010-04-26T11:08:44.312-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='asp.net charts c# javascript'/><title type='text'>ASP.NET Chart Controls Without Web Forms</title><content type='html'>&lt;div&gt;&lt;br /&gt;&lt;/div&gt;I started tinkering with the &lt;a href="http://weblogs.asp.net/scottgu/archive/2008/11/24/new-asp-net-charting-control-lt-asp-chart-runat-quot-server-quot-gt.aspx"&gt;ASP.NET chart controls&lt;/a&gt; last week for a project at work, and the samples available from Microsoft are excellent, except they're mostly all using web forms. So I took it upon myself to do a few things:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Upgraded the existing samples from .NET 3.5 to .NET 4.0.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Added a sample project 'ChartsWithoutWebForms' to show one way to utilize the ASP.NET charts without using web forms at all.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Added a sample project 'ChartsWithMVC' to show one way to utilize the ASP.NET charts with the ASP.NET MVC framework.&lt;/li&gt;&lt;/ul&gt;The basic idea behind the two additional projects is that the chart is rendered as an image, which means you lose some interactive functionality, but my examples show that you can still fake some interactivity.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I also have an example that shows how you might create a dynamic charting system, which is actually what I'm working on now, but the work is venturing into an area where it will be specific to my employer, so I want to release the samples before that happens.&lt;br /&gt;&lt;br /&gt;Feel free to take these updated samples and use them as you see fit. Hopefully they will help you out.&lt;br /&gt;&lt;br /&gt;You can download the samples here:&lt;br /&gt;&lt;a href="http://www.downcastsystems.com/files/ChartSamples.zip"&gt;http://www.downcastsystems.com/files/ChartSamples.zip&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/453286148678307547-6933133989104002513?l=develocity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/6933133989104002513/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=453286148678307547&amp;postID=6933133989104002513' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/6933133989104002513'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/6933133989104002513'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/2010/04/aspnet-chart-controls-without-web-forms.html' title='ASP.NET Chart Controls Without Web Forms'/><author><name>Dave Haynes</name><uri>http://www.blogger.com/profile/14398394041644839400</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-nHfqFMn9q3w/TYtlFxYOW-I/AAAAAAAAbho/wl51gBkfZrk/s220/DaveHaynes.png'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-453286148678307547.post-866764602270316157</id><published>2008-11-04T20:59:00.001-08:00</published><updated>2008-11-04T21:03:31.076-08:00</updated><title type='text'>C# 4.0 dynamic Intellisense : a letter to the C# designers</title><content type='html'>&lt;p&gt;I just emailed this to &lt;a href="http://blogs.msdn.com/ericlippert/default.aspx"&gt;Eric Lippert&lt;/a&gt;:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;I want to express my concern with the new dynamic language features in C# 4.0. &lt;/p&gt;    &lt;p&gt;I think it is important to enable duck-typing along with this feature; possibly by enabling a &amp;quot;fake&amp;quot; cast to an interface. My proposal is below. &lt;/p&gt;    &lt;div&gt;&amp;#160;&lt;/div&gt;    &lt;div&gt;     &lt;pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Person&lt;br /&gt;{&lt;br /&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Name { get; set; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Fruit&lt;br /&gt;{&lt;br /&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Name { get; set; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;interface&lt;/span&gt; INamed&lt;br /&gt;{&lt;br /&gt;  &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Name { get; set; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Program&lt;br /&gt;{&lt;br /&gt;  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Main()&lt;br /&gt;  {&lt;br /&gt;    &lt;span style="color: #008000"&gt;// these types may be defined in any language; possibly from Ruby, etc.&lt;/span&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;// the cast to INamed is &amp;quot;fake&amp;quot;; used only to enable intellisense since actual member resolution is dynamic&lt;/span&gt;&lt;br /&gt;    dynamic p = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Person() { Name = &lt;span style="color: #006080"&gt;&amp;quot;John&amp;quot;&lt;/span&gt; } &lt;span style="color: #0000ff"&gt;as&lt;/span&gt; INamed;&lt;br /&gt;    dynamic f = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Fruit() { Name = &lt;span style="color: #006080"&gt;&amp;quot;Apple&amp;quot;&lt;/span&gt; } &lt;span style="color: #0000ff"&gt;as&lt;/span&gt; INamed;&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #008000"&gt;// would get intellisense after &amp;quot;.&amp;quot; provided by the INamed interface&lt;/span&gt;&lt;br /&gt;    Console.WriteLine(p.Name);&lt;br /&gt;    Console.WriteLine(f.Name);&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;  &lt;/div&gt;&lt;/blockquote&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/453286148678307547-866764602270316157?l=develocity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/866764602270316157/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=453286148678307547&amp;postID=866764602270316157' title='301 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/866764602270316157'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/866764602270316157'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/2008/11/c-40-dynamic-intellisense-letter-to-c.html' title='C# 4.0 dynamic Intellisense : a letter to the C# designers'/><author><name>Robert Taylor</name><uri>http://www.blogger.com/profile/17656686243105089817</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>301</thr:total></entry><entry><id>tag:blogger.com,1999:blog-453286148678307547.post-7119114310059074264</id><published>2008-09-29T15:02:00.000-07:00</published><updated>2008-10-01T14:08:13.308-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tools'/><title type='text'>Balsamiq makes mocking up fun!</title><content type='html'>&lt;p&gt;Robert sent me a link last week to a new mockup tool called &lt;a href="http://www.balsamiq.com" target="_blank"&gt;Balsamiq&lt;/a&gt;.&amp;#160; At first, I didn't really see the point, but after using it for only a few minutes, I was totally sold.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;What is it?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Have you ever tried to use Visio to mockup UI?&amp;#160; It's a cumbersome process, and no matter what I do, the end result just always looks like a bunch of circles and squares and nothing like what I actually envisioned.&lt;/p&gt;  &lt;p&gt;Balsamiq has some ready-made controls that you can easily drop onto your canvas.&amp;#160; They look hand drawn, which is absolutely wonderful because then when I show people my mockups, there will be no doubt that they're simply looking at a mockup and not the final version.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.downcastsystems.com/blog/Balsamiqmakesmockingupfun_D97A/image.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="343" alt="image" src="http://www.downcastsystems.com/blog/Balsamiqmakesmockingupfun_D97A/image_thumb.png" width="644" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Why is it useful?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;I was just playing around with Balsamiq for a few minutes and made a quick screen showing a new feature we want to implement.&amp;#160; I showed it to Robert, and we found out instantly that I was going about it the wrong way.&amp;#160; Imagine if I'd mocked that up in HTML, or in Photoshop?&amp;#160; It would have taken me a lot longer, and it would have been harder to modify after my initial mistake.&amp;#160; Since I used Balsamiq, i was able to just move the controls around.&amp;#160; So it saved me a lot of time and aggravation.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Another Example&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;We have to implement a way for color blind users to use our web application, so we've been asked to add &amp;quot;Color Schemes&amp;quot; to the User Settings.&amp;#160; The user can have an underline or a box around particular fields on the form.&amp;#160; The box background color or underline color is affected by changing color schemes. &lt;/p&gt;  &lt;p&gt;At first, I thought, the simplest thing to do would be to simply provide a drop-down list of named color schemes with a preview below, so I mocked it up, and it looked like shit.&amp;#160; Then I remembered the way &lt;a href="http://www.digsby.com" target="_blank"&gt;Digsby&lt;/a&gt; and now the new &lt;a href="http://download.live.com/messenger" target="_blank"&gt;Windows Live Messenger 9 Beta&lt;/a&gt; showed some of the custom UI settings, so I tried to emulate it a bit.&amp;#160; (The horizontal rule control in Balsamiq isn't colorable yet, but the author says he's added to his upcoming feature list.)&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.downcastsystems.com/blog/Balsamiqmakesmockingupfun_D97A/image_3.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="434" alt="image" src="http://www.downcastsystems.com/blog/Balsamiqmakesmockingupfun_D97A/image_thumb_3.png" width="644" border="0" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Also, I just want to note that I've emailed the author twice, and he responded back within a few minutes each time.&amp;#160; That's impressive.&lt;/p&gt;  &lt;p&gt;Check it out:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.balsamiq.com"&gt;http://www.balsamiq.com&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/453286148678307547-7119114310059074264?l=develocity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/7119114310059074264/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=453286148678307547&amp;postID=7119114310059074264' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/7119114310059074264'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/7119114310059074264'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/2008/09/balsamiq-makes-mocking-up-fun.html' title='Balsamiq makes mocking up fun!'/><author><name>Dave Haynes</name><uri>http://www.blogger.com/profile/14398394041644839400</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-nHfqFMn9q3w/TYtlFxYOW-I/AAAAAAAAbho/wl51gBkfZrk/s220/DaveHaynes.png'/></author><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-453286148678307547.post-5747489997009450054</id><published>2008-05-02T08:27:00.001-07:00</published><updated>2008-05-02T10:07:35.410-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Code Review'/><title type='text'>Unnecessary Iffage</title><content type='html'>&lt;p&gt;A friend of mine showed me an example of the kind of &lt;strong&gt;bad code&lt;/strong&gt; he finds every day where he works:&lt;/p&gt;  &lt;div&gt;&lt;a href="http://www.downcastsystems.com/blog/UnnecessaryIffage_A138/image.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="260" alt="image" src="http://www.downcastsystems.com/blog/UnnecessaryIffage_A138/image_thumb.png" width="444" border="0" /&gt;&lt;/a&gt; &lt;/div&gt;  &lt;p&gt;There are a lot of things wrong with the example above.&amp;#160; Le'ts pick it apart and simplify. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;1. This line is unnecessary:      &lt;br /&gt;&lt;a href="http://www.downcastsystems.com/blog/UnnecessaryIffage_A138/image_3.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="40" alt="image" src="http://www.downcastsystems.com/blog/UnnecessaryIffage_A138/image_thumb_3.png" width="410" border="0" /&gt;&lt;/a&gt;&amp;#160;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;You could just use &lt;font face="Courier New"&gt;SomeBooleanFunction&lt;/font&gt; in place of &lt;font face="Courier New"&gt;someBooleanValue&lt;/font&gt; in the example above, like so: &lt;/p&gt;  &lt;div&gt;&lt;a href="http://www.downcastsystems.com/blog/UnnecessaryIffage_A138/image_4.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="37" alt="image" src="http://www.downcastsystems.com/blog/UnnecessaryIffage_A138/image_thumb_4.png" width="279" border="0" /&gt;&lt;/a&gt; &lt;/div&gt;  &lt;div&gt;&lt;strong&gt;     &lt;br /&gt;2. &amp;quot; &lt;font face="Courier New"&gt;= True&lt;/font&gt;&amp;quot; is unnecessary. &lt;/strong&gt;The function already returns a boolean value.&amp;#160; Get rid of it: &lt;/div&gt;  &lt;p&gt;&lt;a href="http://www.downcastsystems.com/blog/UnnecessaryIffage_A138/image_5.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="39" alt="image" src="http://www.downcastsystems.com/blog/UnnecessaryIffage_A138/image_thumb_5.png" width="228" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;div&gt;&lt;strong&gt;3. &lt;font face="Courier New"&gt;anotherBooleanValue&lt;/font&gt; is also unnecessary.&lt;/strong&gt; We could do away with it and return the value immediately from the If statement, like so: &lt;/div&gt;  &lt;div&gt;&lt;a href="http://www.downcastsystems.com/blog/UnnecessaryIffage_A138/image_6.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="107" alt="image" src="http://www.downcastsystems.com/blog/UnnecessaryIffage_A138/image_thumb_6.png" width="235" border="0" /&gt;&lt;/a&gt; &lt;/div&gt;  &lt;div&gt;&amp;#160;&lt;/div&gt;  &lt;div&gt;&lt;strong&gt;4. In fact, almost all of it is unnecessary:&lt;/strong&gt; &lt;/div&gt;  &lt;div&gt;&lt;a href="http://www.downcastsystems.com/blog/UnnecessaryIffage_A138/image_7.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="71" alt="image" src="http://www.downcastsystems.com/blog/UnnecessaryIffage_A138/image_thumb_7.png" width="301" border="0" /&gt;&lt;/a&gt; &lt;/div&gt;  &lt;div&gt;&amp;#160;&lt;/div&gt;  &lt;p&gt;&lt;strong&gt;How does this happen?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Why didn't the programmer just use the existing &lt;font face="Courier New"&gt;SomeBooleanFunction()&lt;/font&gt; instead of creating a new method that does the exact same thing?&amp;#160; I bet I know.&lt;/p&gt;  &lt;p&gt;I suspect the original programmer didn't know that &lt;font face="Courier New"&gt;SomeBooleanFunction()&lt;/font&gt; existed until after he'd already duplicated the same logic in &lt;font face="Courier New"&gt;MyBooleanFunction()&lt;/font&gt;.&amp;#160; Once he found out that &lt;font face="Courier New"&gt;SomeBooleanFunction()&lt;/font&gt; was there, he wanted to use it, but didn't want to change all the code that was already using his new &lt;font face="Courier New"&gt;MyBooleanFunction().&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;A simple find/replace could have solved his problem, but he may have been afraid to change too much. That's not a good excuse, I know. I'm just sayin'.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/453286148678307547-5747489997009450054?l=develocity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/5747489997009450054/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=453286148678307547&amp;postID=5747489997009450054' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/5747489997009450054'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/5747489997009450054'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/2008/05/unnecessary-iffage.html' title='Unnecessary Iffage'/><author><name>Dave Haynes</name><uri>http://www.blogger.com/profile/14398394041644839400</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-nHfqFMn9q3w/TYtlFxYOW-I/AAAAAAAAbho/wl51gBkfZrk/s220/DaveHaynes.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-453286148678307547.post-6336183360847242328</id><published>2008-04-29T08:33:00.001-07:00</published><updated>2008-04-29T08:33:56.571-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Code Review'/><title type='text'>Programming Books Usually Suck</title><content type='html'>&lt;p&gt;Jeff Atwood over at &lt;a href="http://www.codinghorror.com/blog/archives/001108.html" target="_blank"&gt;Coding Horror&lt;/a&gt; is always going on about how &lt;a href="http://www.codinghorror.com/blog/archives/001108.html" target="_blank"&gt;programmers don't read programming books&lt;/a&gt; because most of them suck, and I agree with that.&amp;#160; I personally have only read about three really good ones.&lt;/p&gt;  &lt;p&gt;In Jeff's post, he mentioned (as an example of poor writing) a book called &lt;em&gt;&lt;a href="http://www.amazon.com/Perl-Dummies-Fourth-Paul-Hoffman/dp/0764537504" target="_blank"&gt;Perl for Dummies&lt;/a&gt;&lt;/em&gt;. I followed through to the linked &lt;a href="http://perl.plover.com/reviews/p54d.html" target="_blank"&gt;review&lt;/a&gt;, and it was great. So I wanted to point out a few of the best (of the worst) examples, as I think programmers who are writing should take notice of these kinds of things.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;When there are simple and difficult explanations, you can usually count on Hoffman to find the difficult explanation, and then to tell you how difficult is. For example: (page 93) &lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#004080"&gt;&lt;code&gt;int&lt;/code&gt; can be a bit tricky because it rounds down for positive numbers and rounds up for negative numbers.&lt;/font&gt; &lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;He's right; that &lt;i&gt;is&lt;/i&gt; tricky. Wait, which was does it round again? Up, down, positive, negative, I can't remember. But if he had said &lt;/p&gt;    &lt;p&gt;&lt;font color="#004080"&gt;&lt;code&gt;int&lt;/code&gt; is very simple: It throws away the fractional part of a number, leaving the integer part. &lt;/font&gt;&lt;/p&gt;    &lt;p&gt;then it is a lot easier &lt;i&gt;and&lt;/i&gt; you understand the name so that next week you might remember what it does.&amp;#160; Another example of this: In the ill-advised explanation of &lt;code&gt;xor&lt;/code&gt;, he says &lt;/p&gt;    &lt;blockquote&gt;&lt;font color="#004080"&gt;The operator returns true if the two things have different truth values but returns false if they have the same truth value. (See table 8-2.) &lt;/font&gt;&lt;/blockquote&gt;    &lt;p&gt;Here's the simple version: &lt;/p&gt;    &lt;blockquote&gt;&lt;font color="#004080"&gt;&lt;code&gt;$soup xor $salad&lt;/code&gt; is true if either &lt;code&gt;$soup&lt;/code&gt; or &lt;code&gt;$salad&lt;/code&gt; is true, but not both. &lt;/font&gt;&lt;/blockquote&gt;    &lt;p&gt;Then you dispense with the table.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Part of the reason Robert and I do Develocity is because we are always finding terrible sample code out in the wilds of the Internet, and it's teaching programmers the wrong ways to do things. It's scary to think people are filling books with the same sort of nonsense.&lt;/p&gt;  &lt;p&gt;I'm not a programming expert, and I make my share of mistakes too, but before I post sample code that other people are going to look at and possibly use, I will go through it a few times, seeing if it can be made simpler and easier to understand.&lt;/p&gt;  &lt;p&gt;Most examples have too much noise.&amp;#160; A &amp;quot;&lt;a href="http://www.roesler-ac.de/wolfram/hello.htm" target="_blank"&gt;Hello, World&lt;/a&gt;&amp;quot; example should do nothing but print &amp;quot;Hello, World&amp;quot; to the screen. Don't add any for loops or random number generators to it.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/453286148678307547-6336183360847242328?l=develocity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/6336183360847242328/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=453286148678307547&amp;postID=6336183360847242328' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/6336183360847242328'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/6336183360847242328'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/2008/04/programming-books-usually-suck.html' title='Programming Books Usually Suck'/><author><name>Dave Haynes</name><uri>http://www.blogger.com/profile/14398394041644839400</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-nHfqFMn9q3w/TYtlFxYOW-I/AAAAAAAAbho/wl51gBkfZrk/s220/DaveHaynes.png'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-453286148678307547.post-7857256745920502365</id><published>2008-04-13T18:50:00.001-07:00</published><updated>2008-04-13T18:50:46.335-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tools'/><title type='text'>Learn and Practice LINQ With LINQPad</title><content type='html'>&lt;p&gt;&lt;a href="http://www.linqpad.net" target="_blank"&gt;LINQPad&lt;/a&gt; is a free tool that lets you query your databases using LINQ syntax in an IDE similar to a poor man's SQL Management Studio. It comes packed with 200+ examples. &lt;/p&gt;  &lt;p&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="484" alt="image" src="http://www.downcastsystems.com/blog/LearnandPracticeLINQWithLINQPad_132CF/image_thumb.png" width="513" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;You can also use it as a code snippet compiler, but I think &lt;a href="http://www.sliver.com/dotnet/SnippetCompiler/" target="_blank"&gt;Snippet Compiler&lt;/a&gt; is better suited for that, as LINQPad doesn't have Intellisense at the moment.&lt;/p&gt;  &lt;p&gt;&lt;a title="http://www.linqpad.net/" href="http://www.linqpad.net/"&gt;http://www.linqpad.net/&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/453286148678307547-7857256745920502365?l=develocity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/7857256745920502365/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=453286148678307547&amp;postID=7857256745920502365' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/7857256745920502365'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/7857256745920502365'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/2008/04/learn-and-practice-linq-with-linqpad.html' title='Learn and Practice LINQ With LINQPad'/><author><name>Dave Haynes</name><uri>http://www.blogger.com/profile/14398394041644839400</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-nHfqFMn9q3w/TYtlFxYOW-I/AAAAAAAAbho/wl51gBkfZrk/s220/DaveHaynes.png'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-453286148678307547.post-1904249026154531521</id><published>2008-04-11T13:11:00.001-07:00</published><updated>2008-04-11T13:11:44.595-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tools'/><title type='text'>Development-Related Uses For Screencasts</title><content type='html'>&lt;p&gt;I&amp;#8217;ve started using a program called &lt;b&gt;&lt;a href="http://www.jingproject.com/" target="_blank"&gt;Jing&lt;/a&gt;&lt;/b&gt; recently. It can record a video of what's currently on your screen.&lt;/p&gt;  &lt;p&gt;Possible uses:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Show managers or project sponsors the current state of your in-progress application without giving them access to the version on your machine (that you might accidentally break since you're still working on it). &lt;/li&gt;    &lt;li&gt;When a new feature is created, developers could create a video that shows the QA team what the new feature is &lt;em&gt;supposed&lt;/em&gt; to do. &lt;/li&gt;    &lt;li&gt;When the new feature doesn't work, the QA team can show the developers the steps necessary to reproduce the problem. (Most of the time, a simple text description isn't enough.) &lt;/li&gt;    &lt;li&gt;I have a friend who wants to show his users in Asia how to use certain features of his application. &lt;/li&gt;    &lt;li&gt;I have another friend who wants to record the repetitive (yet somewhat complicated) tasks he&amp;#8217;s currently doing, so he can show someone else how to do those tasks. &lt;/li&gt;    &lt;li&gt;Project sponsors could keep customers (internal and external) abreast of new changes to an application via a blog and show off those changes with an embedded screencast. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;If you want to get really fancy, you could even create tutorial videos like the kind you see on &lt;a href="http://www.asp.net" target="_blank"&gt;www.asp.net&lt;/a&gt;, but I think a program like &lt;a href="http://www.techsmith.com/camtasia.asp" target="_blank"&gt;Camtasia Studio&lt;/a&gt; would probably be better suited to that, as Jing has a 5 minute limit on any videos created, and there is no way to edit the videos it creates.&lt;/p&gt;  &lt;p&gt;Also, because I don't want to divulge any company secrets, I'm not sharing my videos to Screencast.com, Jing's default video destination. I set it up to save a file on my hard drive, so that I can attach it to an email or TFS work item.&lt;/p&gt;  &lt;p&gt;Jing is &lt;b&gt;free&lt;/b&gt; and extremely easy to use.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.jingproject.com/" target="_blank"&gt;http://www.jingproject.com/&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/453286148678307547-1904249026154531521?l=develocity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/1904249026154531521/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=453286148678307547&amp;postID=1904249026154531521' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/1904249026154531521'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/1904249026154531521'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/2008/04/development-related-uses-for.html' title='Development-Related Uses For Screencasts'/><author><name>Dave Haynes</name><uri>http://www.blogger.com/profile/14398394041644839400</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-nHfqFMn9q3w/TYtlFxYOW-I/AAAAAAAAbho/wl51gBkfZrk/s220/DaveHaynes.png'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-453286148678307547.post-6618459562075682651</id><published>2008-04-11T08:17:00.001-07:00</published><updated>2009-01-17T09:59:48.631-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Code Snippets'/><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><title type='text'>How To: Hide a Button When Clicked on an ASP.NET Page Containing Validation Controls</title><content type='html'>&lt;p&gt;Suppose you have a form with some ASP.NET validation controls on it, and you want to prevent users from clicking the form's submit button more than once.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="106" alt="image" src="http://www.downcastsystems.com/blog/HowToHidea.NETPageWithValidationControls_9C1B/image.png" width="260" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;It might sound easy at first. Just add some javascript to the asp:Button's OnClientClick to hide the button and show your custom message:&lt;/p&gt;&lt;div id='noIframeDiv7ee4154d-9cc3-4845-a68c-41c703f0c094' style='display:block;margin:0px;'&gt;&lt;pre&gt;&lt;div&gt;&lt;!--&lt;br /&gt;&lt;br /&gt;Code highlighting produced by Actipro CodeHighlighter (freeware)&lt;br /&gt;http://www.CodeHighlighter.com/&lt;br /&gt;&lt;br /&gt;--&gt;&lt;span style="color: #0000FF;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;script &lt;/span&gt;&lt;span style="color: #FF0000;"&gt;language&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;=&amp;quot;javascript&amp;quot;&lt;/span&gt;&lt;span style="color: #FF0000;"&gt; type&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #0000FF;"&gt;function&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt; DisableButton(button)&lt;br /&gt;{&lt;br /&gt;    button.style.display &lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;=&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt; &lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;'&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;none&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;'&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;;&lt;br /&gt;    document.getElementById(&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;'&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;loading&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;'&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;).style.display &lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;=&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt; &lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;'&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;inline&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;'&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000;"&gt;script&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div id='iframeDiv7ee4154d-9cc3-4845-a68c-41c703f0c094' style='display:none;margin:0px;'&gt;&lt;iframe id='iframe7ee4154d-9cc3-4845-a68c-41c703f0c094' src='http://www.blogtrog.com/Code.aspx?id=7ee4154d-9cc3-4845-a68c-41c703f0c094' style='width: 98%; height: 160px; border: 1px solid #e0e0e0;margin:0px;' frameborder='0'&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;script language='javascript' src='http://www.blogtrog.com/scripts/bt_code.js' type='text/javascript'&gt;&lt;/script&gt;&lt;script language='javascript' type='text/javascript'&gt;bt_code_init('7ee4154d-9cc3-4845-a68c-41c703f0c094');&lt;/script&gt;&lt;div id='noIframeDivb7f5d3c8-deef-4b95-8e69-f55066532c52' style='display:block;margin:0px;'&gt;&lt;pre&gt;&lt;div&gt;&lt;!--&lt;br /&gt;&lt;br /&gt;Code highlighting produced by Actipro CodeHighlighter (freeware)&lt;br /&gt;http://www.CodeHighlighter.com/&lt;br /&gt;&lt;br /&gt;--&gt;&lt;span style="color: #0000FF;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;asp:Button &lt;/span&gt;&lt;span style="color: #FF0000;"&gt;ID&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;=&amp;quot;LoginButton&amp;quot;&lt;/span&gt;&lt;span style="color: #FF0000;"&gt; runat&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span style="color: #FF0000;"&gt; Text&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;=&amp;quot;Login&amp;quot;&lt;/span&gt;&lt;span style="color: #FF0000;"&gt; OnClientClick&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;=&amp;quot;DisableButton(this)&amp;quot;&lt;/span&gt;&lt;span style="color: #FF0000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;span &lt;/span&gt;&lt;span style="color: #FF0000;"&gt;id&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;=&amp;quot;loading&amp;quot;&lt;/span&gt;&lt;span style="color: #FF0000;"&gt; style&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;=&amp;quot;display: none;&amp;quot;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;Logging in...&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000;"&gt;span&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div id='iframeDivb7f5d3c8-deef-4b95-8e69-f55066532c52' style='display:none;margin:0px;'&gt;&lt;iframe id='iframeb7f5d3c8-deef-4b95-8e69-f55066532c52' src='http://www.blogtrog.com/Code.aspx?id=b7f5d3c8-deef-4b95-8e69-f55066532c52' style='width: 98%; height: 90px; border: 1px solid #e0e0e0;margin:0px;' frameborder='0'&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;script language='javascript' src='http://www.blogtrog.com/scripts/bt_code.js' type='text/javascript'&gt;&lt;/script&gt;&lt;script language='javascript' type='text/javascript'&gt;bt_code_init('b7f5d3c8-deef-4b95-8e69-f55066532c52');&lt;/script&gt;&lt;p&gt;&lt;strong&gt;Except&lt;/strong&gt; if you do that, and you're using ASP.NET validation controls on the page, your user could end up in a situation like this:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="105" alt="image" src="http://www.downcastsystems.com/blog/HowToHidea.NETPageWithValidationControls_9C1B/image_5.png" width="383" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;Now your user is stuck because the Login button is gone!&lt;/p&gt;  &lt;p&gt;So, this is &lt;strong&gt;how to get around that&lt;/strong&gt;:&lt;/p&gt;  &lt;div id='noIframeDivcb5d6097-5b90-41e7-a0c7-1bda425a6c0a' style='display:block;margin:0px;'&gt;&lt;pre&gt;&lt;div&gt;&lt;!--&lt;br /&gt;&lt;br /&gt;Code highlighting produced by Actipro CodeHighlighter (freeware)&lt;br /&gt;http://www.CodeHighlighter.com/&lt;br /&gt;&lt;br /&gt;--&gt;&lt;span style="color: #0000FF;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000;"&gt;script &lt;/span&gt;&lt;span style="color: #FF0000;"&gt;language&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;=&amp;quot;javascript&amp;quot;&lt;/span&gt;&lt;span style="color: #FF0000;"&gt; type&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #0000FF;"&gt;function&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt; DisableButton(button)&lt;br /&gt;{&lt;br /&gt;    Page_ClientValidate();&lt;br /&gt;    &lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #0000FF;"&gt;if&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt; (Page_IsValid)&lt;br /&gt;    {&lt;br /&gt;        button.style.display &lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;=&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt; &lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;'&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;none&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;'&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;;&lt;br /&gt;        document.getElementById(&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;'&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;loading&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;'&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;).style.display &lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;=&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt; &lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;'&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;inline&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;'&lt;/span&gt;&lt;span style="background-color: #F5F5F5; color: #000000;"&gt;;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000;"&gt;script&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div id='iframeDivcb5d6097-5b90-41e7-a0c7-1bda425a6c0a' style='display:none;margin:0px;'&gt;&lt;iframe id='iframecb5d6097-5b90-41e7-a0c7-1bda425a6c0a' src='http://www.blogtrog.com/Code.aspx?id=cb5d6097-5b90-41e7-a0c7-1bda425a6c0a' style='width: 98%; height: 210px; border: 1px solid #e0e0e0;margin:0px;' frameborder='0'&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;script language='javascript' src='http://www.blogtrog.com/scripts/bt_code.js' type='text/javascript'&gt;&lt;/script&gt;&lt;script language='javascript' type='text/javascript'&gt;bt_code_init('cb5d6097-5b90-41e7-a0c7-1bda425a6c0a');&lt;/script&gt;&lt;p&gt;In the script above, you'll notice I'm using a &lt;strong&gt;Page_ClientValidate() &lt;/strong&gt;method and a &lt;strong&gt;Page_IsValid&lt;/strong&gt; boolean variable. Those are exposed as part of ASP.NET's Client-Side Validation API.&lt;/p&gt;  &lt;p&gt;What's happening:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;strong&gt;Page_ClientValidate()&lt;/strong&gt; forces the validation to happen immediately.     &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;If the validation tests pass (&lt;strong&gt;Page_IsValid&lt;/strong&gt;), hide the button, show the message, and submit the page.     &lt;br /&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="103" alt="image" src="http://www.downcastsystems.com/blog/HowToHidea.NETPageWithValidationControls_9C1B/image_7.png" width="274" border="0" /&gt; &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;If the validation tests fail, ASP.NET will handle showing the validation errors for you, and the page will not be submitted.    &lt;br /&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="103" alt="image" src="http://www.downcastsystems.com/blog/HowToHidea.NETPageWithValidationControls_9C1B/image_8.png" width="379" border="0" /&gt; &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;For more information on ASP.NET Validation, see this article on MSDN:  &lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa479045.aspx" target="_blank"&gt;http://msdn2.microsoft.com/en-us/library/aa479045.aspx&lt;/a&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/453286148678307547-6618459562075682651?l=develocity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/6618459562075682651/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=453286148678307547&amp;postID=6618459562075682651' title='25 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/6618459562075682651'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/6618459562075682651'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/2008/04/how-to-hide-button-when-clicked-on.html' title='How To: Hide a Button When Clicked on an ASP.NET Page Containing Validation Controls'/><author><name>Dave Haynes</name><uri>http://www.blogger.com/profile/14398394041644839400</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-nHfqFMn9q3w/TYtlFxYOW-I/AAAAAAAAbho/wl51gBkfZrk/s220/DaveHaynes.png'/></author><thr:total>25</thr:total></entry><entry><id>tag:blogger.com,1999:blog-453286148678307547.post-8986234677932101321</id><published>2008-04-04T20:02:00.001-07:00</published><updated>2008-04-04T20:23:29.049-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Code Review'/><category scheme='http://www.blogger.com/atom/ns#' term='Fluent API'/><title type='text'>Enhancing C#'s switch statement with a fluent API</title><content type='html'>&lt;p&gt;A colleague pointed me to &lt;a title="this article " href="http://community.bartdesmet.net/blogs/bart/archive/2008/03/30/a-functional-c-type-switch.aspx"&gt;this article &lt;/a&gt;today.&amp;#160; It shows a very clever set of utility classes that can dramatically improve the usefulness of the &amp;quot;switch..case&amp;quot; concept.&amp;#160; Since the C# language can't be extended, it is implemented as a fluent API that tries to mimic the built-in switch statement.&lt;/p&gt;  &lt;p&gt;The most interesting use to me is the generics-based &lt;a href="http://blogs.msdn.com/devdev/archive/2005/08/29/457798.aspx"&gt;double dispatch&lt;/a&gt; using delegates that enables a sort of visitor pattern:&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4"&gt;   &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Do(&lt;font color="#008080"&gt;Control&lt;/font&gt; c) &lt;br /&gt;{ &lt;br /&gt;     &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Switch(c) &lt;br /&gt;          .Case&amp;lt;&lt;font color="#008080"&gt;Label&lt;/font&gt;&amp;gt;(l =&amp;gt; &lt;br /&gt;          { &lt;br /&gt;               &lt;span style="color: #008000"&gt;// ... &lt;/span&gt;&lt;br /&gt;          }) &lt;br /&gt;          .Case&amp;lt;&lt;font color="#008080"&gt;Button&lt;/font&gt;&amp;gt;(b =&amp;gt; &lt;br /&gt;          { &lt;br /&gt;               &lt;span style="color: #008000"&gt;// ... &lt;/span&gt;&lt;br /&gt;          }) &lt;br /&gt;          .Default(cc =&amp;gt; &lt;br /&gt;          { &lt;br /&gt;               &lt;span style="color: #008000"&gt;// ... &lt;/span&gt;&lt;br /&gt;          }); &lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;An interesting oddity of the implementation is that the various Case() overloads are implemented as Extension methods on the Switch types. That is the only thing I don't like in the linked article. It exploits a &amp;quot;feature&amp;quot; of Extension methods that &lt;em&gt;sorta &lt;/em&gt;allows you to call methods on null references. The case &amp;quot;statements&amp;quot; (method calls) are short-circuited by returning null and additional calls to Case() check for the null &amp;quot;this&amp;quot; pointer (the fake &amp;quot;this&amp;quot; which is the first parameter to extension methods) and exits quickly. To me, this seems like abuse of extension methods since the same thing can easily be accomplished with a traditional class. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Here is a modified version of the Switch&amp;lt;T&amp;gt; class implemented as a simple class without the extension methods:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4"&gt;&lt;br /&gt;  &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; &lt;font color="#008080"&gt;Switch&lt;/font&gt;&amp;lt;T&amp;gt;&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; T Object { get; &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; set; }&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; hasBroken = &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Switch(T obj)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Object = obj;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;font color="#008080"&gt;Switch&lt;/font&gt;&amp;lt;T&amp;gt; Case(T other, &lt;font color="#008080"&gt;Action&lt;/font&gt;&amp;lt;T&amp;gt; action)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Case(other, action, &lt;font color="#008080"&gt;SwitchBehavior&lt;/font&gt;.Break);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;font color="#008080"&gt;Switch&lt;/font&gt;&amp;lt;T&amp;gt; Case(T other, &lt;font color="#008080"&gt;Action&lt;/font&gt;&amp;lt;T&amp;gt; action, &lt;font color="#008080"&gt;SwitchBehavior&lt;/font&gt; behavior)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Case(x =&amp;gt; &lt;span style="color: #0000ff"&gt;object&lt;/span&gt;.Equals(x, other), action, behavior);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;font color="#008080"&gt;Switch&lt;/font&gt;&amp;lt;T&amp;gt; Case(&lt;font color="#008080"&gt;Func&lt;/font&gt;&amp;lt;T, &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt;&amp;gt; condition, &lt;font color="#008080"&gt;Action&lt;/font&gt;&amp;lt;T&amp;gt; action)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Case(condition, action, &lt;font color="#008080"&gt;SwitchBehavior&lt;/font&gt;.Break);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;font color="#008080"&gt;Switch&lt;/font&gt;&amp;lt;T&amp;gt; Case(&lt;font color="#008080"&gt;Func&lt;/font&gt;&amp;lt;T, &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt;&amp;gt; condition, &lt;font color="#008080"&gt;Action&lt;/font&gt;&amp;lt;T&amp;gt; action, &lt;font color="#008080"&gt;SwitchBehavior&lt;/font&gt; behavior)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (!&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.hasBroken &amp;amp;&amp;amp; condition(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Object))&lt;br /&gt;        {&lt;br /&gt;            action(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Object);&lt;br /&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (behavior == &lt;font color="#008080"&gt;SwitchBehavior&lt;/font&gt;.Break)&lt;br /&gt;                &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.hasBroken = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Default(&lt;font color="#008080"&gt;Action&lt;/font&gt;&amp;lt;T&amp;gt; action)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Case(t =&amp;gt; &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;, action, &lt;font color="#008080"&gt;SwitchBehavior&lt;/font&gt;.Break);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;enum&lt;/span&gt; &lt;font color="#008080"&gt;SwitchBehavior&lt;/font&gt; { FallThrough, Break }&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://community.bartdesmet.net/blogs/bart/archive/2008/03/30/a-functional-c-type-switch.aspx"&gt;A functional C# (type)switch - B# .NET Blog&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/453286148678307547-8986234677932101321?l=develocity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/8986234677932101321/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=453286148678307547&amp;postID=8986234677932101321' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/8986234677932101321'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/8986234677932101321'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/2008/04/enhancing-c-switch-statement-with.html' title='Enhancing C#&amp;#39;s switch statement with a fluent API'/><author><name>Robert Taylor</name><uri>http://www.blogger.com/profile/17656686243105089817</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-453286148678307547.post-858051842638677760</id><published>2008-04-04T17:06:00.001-07:00</published><updated>2008-04-04T17:06:59.516-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><title type='text'>Javascript: More than meets the eye...</title><content type='html'>&lt;p&gt;I recently ran across a presentation on &lt;a href="http://www.infoq.com/"&gt;InfoQ&lt;/a&gt; by Glenn Vanderburg called &amp;quot;&lt;a href="http://www.infoq.com/presentations/vanderburg-power-of-javascript"&gt;The Power of Javascript&lt;/a&gt;&amp;quot; that was recorded at &lt;a href="http://jaoo.dk/"&gt;JAOO&lt;/a&gt;. &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;b&gt;Summary&lt;/b&gt;      &lt;br /&gt;Glenn Vanderburg makes the case for Javascript, a language long overlooked. This presentation from JAOO 2007 shows how its OOP model and other language features make it a very powerful tool and how to use these features to get the most out of the language.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The presentation describes how Javascript got its name - starting out as LiveScript developed by Netscape and later rebranded as Javascript to exploit the popularity of the new kid on the block - Java, developed by Sun. He explains why it is commonly considered to be a &amp;quot;&lt;a href="http://lolcode.com/examples/hai-world"&gt;toy language&lt;/a&gt;&amp;quot; and why it isn't.&lt;/p&gt;  &lt;p&gt;A while ago I posted &lt;a href="http://develocity.blogspot.com/2007/04/recently-i-realized-that-most.html"&gt;the first&lt;/a&gt; in a series of &lt;a href="http://develocity.blogspot.com/2007/04/its-hard-to-know-where-to-start-but.html"&gt;articles&lt;/a&gt; &lt;a href="http://develocity.blogspot.com/2007/04/garbage-collection-probably-sounds-like.html"&gt;about&lt;/a&gt; &lt;a href="http://develocity.blogspot.com/2007/07/for-some-reason-unlike-other-modern.html"&gt;javascript&lt;/a&gt;. Since then I've been somewhat stingy in releasing the other proposed articles.&amp;#160; I'll try to get back into the swing of things promptly.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/453286148678307547-858051842638677760?l=develocity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/858051842638677760/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=453286148678307547&amp;postID=858051842638677760' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/858051842638677760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/858051842638677760'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/2008/04/javascript-more-than-meets-eye.html' title='Javascript: More than meets the eye...'/><author><name>Robert Taylor</name><uri>http://www.blogger.com/profile/17656686243105089817</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-453286148678307547.post-4984662396394260288</id><published>2007-11-15T08:50:00.001-08:00</published><updated>2009-01-17T18:06:20.385-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Code Snippets'/><title type='text'>Sorting a Generic List of Custom Objects Simply</title><content type='html'>&lt;p&gt;For a defect I was working on today, I just wanted to sort a list of users by username in a very simple fashion.&lt;br /&gt;&lt;br /&gt;Google failed me. I wasn't able to find a good example of how to do this &lt;em&gt;easily&lt;/em&gt; in VB.NET. As usual, most examples are full of noise, like &lt;a href="http://www.vbforums.com/showthread.php?t=310363" target="_blank"&gt;this&lt;/a&gt;, &lt;a href="http://codebetter.com/blogs/david.hayden/archive/2005/03/06/56584.aspx" target="_blank"&gt;this&lt;/a&gt;, &lt;a href="http://addressof.com/blog/archive/2003/05/05/174.aspx" target="_blank"&gt;this&lt;/a&gt;, or &lt;a href="http://www.mredkj.com/vbnet/CollectionSort.html" target="_blank"&gt;that&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;So, once I figured out how to do it, I thought I should share it.&lt;br /&gt;&lt;br /&gt;First, we create a function to handle our comparison.&lt;/p&gt;&lt;div id='iframeDivc2dfed0a-53a6-46d2-856a-df7295112e73' style='display:none;margin:0px;'&gt;&lt;iframe id='iframec2dfed0a-53a6-46d2-856a-df7295112e73' src='http://www.blogtrog.com/Code.aspx?id=c2dfed0a-53a6-46d2-856a-df7295112e73' style='width: 600px; height: 100px; border: 1px solid #e0e0e0;margin:0px;' frameborder='0'&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div id='noIframeDivc2dfed0a-53a6-46d2-856a-df7295112e73' style='display:block;margin:0px;'&gt;&lt;pre&gt;&lt;div&gt;&lt;!--&lt;br /&gt;&lt;br /&gt;Code highlighting produced by Actipro CodeHighlighter (freeware)&lt;br /&gt;http://www.CodeHighlighter.com/&lt;br /&gt;&lt;br /&gt;--&gt;&lt;span style="color: #0000FF;"&gt;Private&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Function&lt;/span&gt;&lt;span style="color: #000000;"&gt; UsernameComparer(&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;ByVal&lt;/span&gt;&lt;span style="color: #000000;"&gt; x &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;As&lt;/span&gt;&lt;span style="color: #000000;"&gt; User, &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;ByVal&lt;/span&gt;&lt;span style="color: #000000;"&gt; y &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;As&lt;/span&gt;&lt;span style="color: #000000;"&gt; User) &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;As&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Integer&lt;/span&gt;&lt;span style="color: #000000;"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Return&lt;/span&gt;&lt;span style="color: #000000;"&gt; x.UserName.CompareTo(y.UserName)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;End Function&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;script language='javascript' src='http://www.blogtrog.com/scripts/bt_code.js' type='text/javascript'&gt;&lt;/script&gt;&lt;script language='javascript' type='text/javascript'&gt;bt_code_init('c2dfed0a-53a6-46d2-856a-df7295112e73');&lt;/script&gt;&lt;p&gt;Next, we use it.&lt;/p&gt;&lt;div id='iframeDiv2e99a5a0-d0a7-4b06-aba7-e42e5c21907a' style='display:none;margin:0px;'&gt;&lt;iframe id='iframe2e99a5a0-d0a7-4b06-aba7-e42e5c21907a' src='http://www.blogtrog.com/Code.aspx?id=2e99a5a0-d0a7-4b06-aba7-e42e5c21907a' style='width: 600px; height: 50px; border: 1px solid #e0e0e0;margin:0px;' frameborder='0'&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div id='noIframeDiv2e99a5a0-d0a7-4b06-aba7-e42e5c21907a' style='display:block;margin:0px;'&gt;&lt;pre&gt;&lt;div&gt;&lt;!--&lt;br /&gt;&lt;br /&gt;Code highlighting produced by Actipro CodeHighlighter (freeware)&lt;br /&gt;http://www.CodeHighlighter.com/&lt;br /&gt;&lt;br /&gt;--&gt;&lt;span style="color: #000000;"&gt;myUserList.Sort(&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;AddressOf&lt;/span&gt;&lt;span style="color: #000000;"&gt; UsernameComparer)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;script language='javascript' src='http://www.blogtrog.com/scripts/bt_code.js' type='text/javascript'&gt;&lt;/script&gt;&lt;script language='javascript' type='text/javascript'&gt;bt_code_init('2e99a5a0-d0a7-4b06-aba7-e42e5c21907a');&lt;/script&gt;&lt;p&gt;Now our user list is sorted by username.&lt;br /&gt;&lt;br /&gt;In C# 2.0, using anonymous methods, it can even be done all at once:&lt;/p&gt;&lt;div id='iframeDiv85c25d50-13f6-45d6-979e-604264a2e2fd' style='display:none;margin:0px;'&gt;&lt;iframe id='iframe85c25d50-13f6-45d6-979e-604264a2e2fd' src='http://www.blogtrog.com/Code.aspx?id=85c25d50-13f6-45d6-979e-604264a2e2fd' style='width: 600px; height: 90px; border: 1px solid #e0e0e0;margin:0px;' frameborder='0'&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;div id='noIframeDiv85c25d50-13f6-45d6-979e-604264a2e2fd' style='display:block;margin:0px;'&gt;&lt;pre&gt;&lt;div&gt;&lt;!--&lt;br /&gt;&lt;br /&gt;Code highlighting produced by Actipro CodeHighlighter (freeware)&lt;br /&gt;http://www.CodeHighlighter.com/&lt;br /&gt;&lt;br /&gt;--&gt;&lt;span style="color: #000000;"&gt;myUserList.Sort(&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;delegate&lt;/span&gt;&lt;span style="color: #000000;"&gt;(User x, User y) { &lt;br /&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;return&lt;/span&gt;&lt;span style="color: #000000;"&gt; x.UserName.CompareTo(y.UserName); &lt;br /&gt;});&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;script language='javascript' src='http://www.blogtrog.com/scripts/bt_code.js' type='text/javascript'&gt;&lt;/script&gt;&lt;script language='javascript' type='text/javascript'&gt;bt_code_init('85c25d50-13f6-45d6-979e-604264a2e2fd');&lt;/script&gt;&lt;p&gt;If you know of an even simpler way to do this, leave some comments and let us know!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/453286148678307547-4984662396394260288?l=develocity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/4984662396394260288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=453286148678307547&amp;postID=4984662396394260288' title='67 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/4984662396394260288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/4984662396394260288'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/2007/11/sorting-generic-list-of-custom-objects.html' title='Sorting a Generic List of Custom Objects Simply'/><author><name>Dave Haynes</name><uri>http://www.blogger.com/profile/14398394041644839400</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-nHfqFMn9q3w/TYtlFxYOW-I/AAAAAAAAbho/wl51gBkfZrk/s220/DaveHaynes.png'/></author><thr:total>67</thr:total></entry><entry><id>tag:blogger.com,1999:blog-453286148678307547.post-8745823136979413316</id><published>2007-10-17T13:47:00.001-07:00</published><updated>2008-03-26T13:16:42.873-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Code Snippets'/><title type='text'>MSDN code examples are terrible</title><content type='html'>&lt;p&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.page.registeronsubmitstatement(VS.71).aspx"&gt;This is the page&lt;/a&gt; that really got my goat. I'll list the relevant parts here for ease of reading.&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;strong&gt;Page.RegisterOnSubmitStatement Method&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Allows a page to access the client &lt;b&gt;OnSubmit&lt;/b&gt; event. The script should be a function call to client code registered elsewhere.&lt;/p&gt; &lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4"&gt; &lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #008000"&gt;'[Visual Basic] &lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Dim&lt;/span&gt; scriptString &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;String&lt;/span&gt; = &lt;span style="color: #006080"&gt;"&amp;lt;script language=JavaScript&amp;gt; function doClick() {"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt; scriptString += &lt;span style="color: #006080"&gt;"document.write('&amp;lt;h4&amp;gt;' + myForm.myHiddenField.value+ '&amp;lt;/h4&amp;gt;');}&amp;lt;"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt; scriptString += &lt;span style="color: #006080"&gt;"/"&lt;/span&gt; + &lt;span style="color: #006080"&gt;"script&amp;gt;"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt; RegisterHiddenField(&lt;span style="color: #006080"&gt;"myHiddenField"&lt;/span&gt;, &lt;span style="color: #006080"&gt;"Welcome to Microsoft .NET!"&lt;/span&gt;) &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt; &amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt; RegisterOnSubmitStatement(&lt;span style="color: #006080"&gt;"submit"&lt;/span&gt;, &lt;span style="color: #006080"&gt;"document.write('&amp;lt;h4&amp;gt;Submit button clicked.&amp;lt;/h4&amp;gt;')"&lt;/span&gt;) &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt; &amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt; RegisterStartupScript(&lt;span style="color: #006080"&gt;"startup"&lt;/span&gt;, scriptString) &lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4"&gt;&lt;br /&gt;&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #008000"&gt;//[C#] &lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Page_Load(Object sender, EventArgs e) &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt; { &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;    String scriptString = &lt;span style="color: #006080"&gt;"&amp;lt;script language=JavaScript&amp;gt; function doClick() {"&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;    scriptString += &lt;span style="color: #006080"&gt;"document.write('&amp;lt;h4&amp;gt;' + myForm.myHiddenField.value+ '&amp;lt;/h4&amp;gt;');}&amp;lt;"&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;    scriptString += &lt;span style="color: #006080"&gt;"/"&lt;/span&gt; + &lt;span style="color: #006080"&gt;"script&amp;gt;"&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;    RegisterHiddenField(&lt;span style="color: #006080"&gt;"myHiddenField"&lt;/span&gt;, &lt;span style="color: #006080"&gt;"Welcome to Microsoft .NET!"&lt;/span&gt;); &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;    RegisterOnSubmitStatement(&lt;span style="color: #006080"&gt;"submit"&lt;/span&gt;, &lt;span style="color: #006080"&gt;"document.write('&amp;lt;h4&amp;gt;Submit button clicked.&amp;lt;/h4&amp;gt;')"&lt;/span&gt;); &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;    RegisterStartupScript(&lt;span style="color: #006080"&gt;"startup"&lt;/span&gt;, scriptString);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt; } &lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;p&gt;Ok, how many things can you find wrong with this simple example?&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;&lt;li&gt;string concatenating to make a script block&lt;/li&gt;&lt;br /&gt;&lt;li&gt;a bunch of totally unrelated code that muddies the point&lt;/li&gt;&lt;br /&gt;&lt;li&gt;document.write() - who does that?&lt;/li&gt;&lt;br /&gt;&lt;li&gt;VB and C# code don't even match; C# includes the method declaration; VB only includes the method body&lt;/li&gt;&lt;br /&gt;&lt;li&gt;scriptString += "/" + "script&amp;gt;"&lt;/li&gt;&lt;br /&gt;&lt;li&gt;definition says "The script should be a function call to client code registered elsewhere." but that is not what the example code does&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;p&gt;Here's my stab:&lt;/p&gt;&lt;br /&gt;&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4"&gt;&lt;br /&gt;&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #008000"&gt;//[C#] &lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Page_Load(Object sender, EventArgs e) &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt; { &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;   &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (!IsClientScriptBlockRegistered(&lt;span style="color: #006080"&gt;"doClickScriptKey"&lt;/span&gt;))&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;   {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;     String scriptString = &lt;span style="color: #006080"&gt;@"&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;     &amp;lt;script type='text/javascript'&amp;gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;         function doClick() { alert('the form is about to submit!'); }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;     &amp;lt;/script&amp;gt;"&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;     RegisterClientScriptBlock(&lt;span style="color: #006080"&gt;"doClickScriptKey"&lt;/span&gt;, scriptString);  &lt;span style="color: #008000"&gt;//"registered elsewhere"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;   }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;   RegisterOnSubmitStatement(&lt;span style="color: #006080"&gt;"submitScriptKey"&lt;/span&gt;, &lt;span style="color: #006080"&gt;"doClick();"&lt;/span&gt;); &lt;span style="color: #008000"&gt;//"function call to client code registered elsewhere"&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt; } &lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/453286148678307547-8745823136979413316?l=develocity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/8745823136979413316/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=453286148678307547&amp;postID=8745823136979413316' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/8745823136979413316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/8745823136979413316'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/2007/10/msdn-code-examples-are-terrible.html' title='MSDN code examples are terrible'/><author><name>Robert Taylor</name><uri>http://www.blogger.com/profile/17656686243105089817</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-453286148678307547.post-6630556365899826516</id><published>2007-09-14T20:13:00.001-07:00</published><updated>2008-03-26T13:18:23.586-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Discussions'/><title type='text'>Conversation about Patterns, Developers, and whatnot</title><content type='html'>&lt;p&gt;&lt;/p&gt;  &lt;p&gt;(9:10 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;how's the job going this week?&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:11 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;better actually, we're digging into this arcade game    &lt;br /&gt;and I'm starting to understand things more &lt;/p&gt;  &lt;p&gt;(9:11 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;but its all-consuming in my head, i can't seem to think about anything else    &lt;br /&gt;i.e. dave's game &lt;/p&gt;  &lt;p&gt;(9:12 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;that's understandable&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:12 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;I really want to help dave though, cause I want him to finish it &lt;/p&gt;  &lt;p&gt;(9:13 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;maybe on the weekends I'll have time &lt;/p&gt;  &lt;p&gt;(9:24 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;i hate words that have extraneous letters      &lt;br /&gt;such as Lincoln&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:24 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;what's that second L doing in there?&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:24 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;just hangin out man &lt;/p&gt;  &lt;p&gt;(9:24 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;nobody says &amp;quot;Leen-koln&amp;quot;&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:25 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;back to programming a bit...&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:25 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;I feel your pain &lt;/p&gt;  &lt;p&gt;(9:25 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;have you read about &amp;quot;design patterns&amp;quot;?&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:26 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;(along with &amp;quot;anti-patterns&amp;quot;)&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:26 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;I'm staring at a book called Design Patterns at this very moment &lt;/p&gt;  &lt;p&gt;(9:26 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;not reading it, its on the table &lt;/p&gt;  &lt;p&gt;(9:26 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;&amp;quot;Elements of Reusable Object-Oriented Software&amp;quot;?&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:26 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;you're meaning things like the factory method, singletons...etc &lt;/p&gt;  &lt;p&gt;(9:27 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;yeah&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:27 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;yeah, that's the one &lt;/p&gt;  &lt;p&gt;(9:27 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;cool&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:27 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;dedrick had it in the office and I'm borrowing it &lt;/p&gt;  &lt;p&gt;(9:27 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;you're already light-years ahead of most developers&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:27 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;of your own accord or upon his suggestion?&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:28 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;no, I've been wanting to learn about them &lt;/p&gt;  &lt;p&gt;(9:28 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;and it turns out he had just the book I was going to buy &lt;/p&gt;  &lt;p&gt;(9:28 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;i was teaching Greg at work about the Strategy pattern today&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:29 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;I guess I don't know greg &lt;/p&gt;  &lt;p&gt;(9:29 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;you don't&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:29 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;but yeah, I've been wanting to read up on the patterns for awhile now    &lt;br /&gt;after learning they existed &lt;/p&gt;  &lt;p&gt;(9:29 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;do you know if that book also talks about &amp;quot;anti-patterns&amp;quot;?&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:29 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;not sure &lt;/p&gt;  &lt;p&gt;(9:30 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;not in the index    &lt;br /&gt;anyway &lt;/p&gt;  &lt;p&gt;(9:32 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;I don't understand something &lt;/p&gt;  &lt;p&gt;(9:33 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;you mention a lot that most developers don't do this, or know about that    &lt;br /&gt;but jeez, what do they know? &lt;/p&gt;  &lt;p&gt;(9:33 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;they know how to write &amp;quot;spaghetti code&amp;quot; until it just barely works&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:34 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;&amp;quot;spaghetti code&amp;quot; is probably what your early expirements looked like&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:34 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;that sucks, they don't even want to make it good? &lt;/p&gt;  &lt;p&gt;(9:34 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;nope      &lt;br /&gt;they are victims of &amp;quot;good enough&amp;quot;&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:37 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;a href="http://www.amazon.com/AntiPatterns-Refactoring-Software-Architectures-Projects/dp/0471197130/ref=pd_bbs_1/104-0707808-5144724?ie=UTF8&amp;amp;s=books&amp;amp;qid=1189647010&amp;amp;sr=1-1"&gt;http://www.amazon.com/AntiPatterns-Refactoring-Software-Architectures-Projects/dp/0471197130/ref=pd_bbs_1/104-0707808-5144724?ie=UTF8&amp;amp;s=books&amp;amp;qid=1189647010&amp;amp;sr=1-1&lt;/a&gt;&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:37 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;I guess I don't have enough time working with dedrick and the other guy to see what they're attitude is, they seem to be okay &lt;/p&gt;  &lt;p&gt;(9:38 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;sounds like a funny book    &lt;br /&gt;interesting &lt;/p&gt;  &lt;p&gt;(9:39 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;this is the exact reason why i think i told you before - i'd rather hire a mediocre-but-passionate dev than a well-trained-but-unmotivated dev&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:39 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;I can see that &lt;/p&gt;  &lt;p&gt;(9:40 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;do you ever get input on who your company hires?    &lt;br /&gt;give input &lt;/p&gt;  &lt;p&gt;(9:41 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;passion begets constant improvement and excellent developers that can encourage other devs&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:42 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;lack-luster begets wasted time/effort and code that is difficult to maintain      &lt;br /&gt;no&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:43 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;though i was asked to write a small code-snippet that would be presented to interveiwees to see what they understand about it      &lt;br /&gt;i'll show you - you won't get it - it's probably too difficult&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:43 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;ok &lt;/p&gt;  &lt;p&gt;(9:46 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0; static class Foo&amp;lt;T&amp;gt; where T : new()      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0; {       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; private static T bar = new T();       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; public static T Bar       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; {       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; get { return bar; }       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; }       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0; }       &lt;br /&gt;that's the whole class, and it's quite useful&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:47 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;ok, let me look &lt;/p&gt;  &lt;p&gt;(9:47 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;i had to replace real names with Foo and Bar or else you'd know right away&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:48 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;don't tell me &lt;/p&gt;  &lt;p&gt;(9:49 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;the point of the code in the interview isn't to see if you get it right, it's to see how much of it you can explain&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:50 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;it looks like a generic class that just makes things    &lt;br /&gt;to me &lt;/p&gt;  &lt;p&gt;(9:50 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;some parts of the code confuse me however &lt;/p&gt;  &lt;p&gt;(9:51 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;explain...&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:51 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;explain what I don't understand? &lt;/p&gt;  &lt;p&gt;(9:51 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;yeah&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:52 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;in the class heading, you have &amp;quot;where T : new()    &lt;br /&gt;I don't get that &lt;/p&gt;  &lt;p&gt;(9:53 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;maybe I'm just reading it wrong &lt;/p&gt;  &lt;p&gt;(9:54 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;that is a &amp;quot;generic type parameter constraint&amp;quot;&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:55 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;it say's &amp;quot;you can use any T as long as it has a default public constructor&amp;quot;&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:55 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;I see &lt;/p&gt;  &lt;p&gt;(9:55 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;is this an object factory? &lt;/p&gt;  &lt;p&gt;(9:56 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;if a type only had a private constructor or the only public constructor (abbrv. &amp;quot;ctor&amp;quot;) requires any parameters&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:56 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;that's close - it's a very special type of &amp;quot;factory&amp;quot;&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:57 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;want me to explain?&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:57 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;yeah, don't think I can get any closer &lt;/p&gt;  &lt;p&gt;(9:58 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;hint: it's not building very many objects - &amp;quot;new T()&amp;quot; is only called once&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:59 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;a singleton? &lt;/p&gt;  &lt;p&gt;(9:59 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;yep      &lt;br /&gt;it externalizes the concept of &amp;quot;singleton&amp;quot; to a separate generic class&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(9:59 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;you would use it like this:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:00 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;WizardGame game = Singleton&amp;lt;WizardGame&amp;gt;.Instance();&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:00 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;the Singleton class (Foo) ensures that there is only one&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:01 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;how does it do that?    &lt;br /&gt;what prevents you &lt;/p&gt;  &lt;p&gt;(10:08 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;brb; putting dishes away&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:09 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;ok &lt;/p&gt;  &lt;p&gt;(10:36 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;hey      &lt;br /&gt;i'm back&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:37 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;ok &lt;/p&gt;  &lt;p&gt;(10:37 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;every question you ask me tells me more about what you know and don't know about C#/.Net&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:37 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.google.com/UrbanFly/RutN1_MjTjI/AAAAAAAAAM0/dUP_IwmeHsQ/clip_image002154%5B1%5D%5B2%5D.gif"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="16" alt=":)" src="http://lh3.google.com/UrbanFly/RutN2PMjTkI/AAAAAAAAAM4/fqsjFEpCQRc/clip_image002154%5B1%5D_thumb%5B1%5D.gif" width="16" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;(10:37 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;...as an interviewer&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:38 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;at first, i knew that you at least understood the C# language at a basic level      &lt;br /&gt;and you understood the basic concepts of Generics&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:38 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;but not some of the finer points (constraints)&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:39 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;after my hint, i knew that you were familiar with the concept of &amp;quot;design patterns&amp;quot;&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:39 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;a lot of information from just a little bit of code &lt;/p&gt;  &lt;p&gt;(10:40 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;and now i know that you aren't familiar with the intricacies of C#&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:40 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;here's the non-obfuscated code:      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0; static class Singleton&amp;lt;T&amp;gt; where T : new()       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0; {       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; private static T instance = new T();       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; public static T Instance       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; {       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; get { return instance; }       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; }       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0; }&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:41 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;and now to answer your question...&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:41 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;first, you have to understand that Singleton&amp;lt;Foo&amp;gt; is a different class than Singleton&amp;lt;Bar&amp;gt;&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:42 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;ok &lt;/p&gt;  &lt;p&gt;(10:42 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;seems logical enough &lt;/p&gt;  &lt;p&gt;(10:45 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;was looking up some terms i forgot for a second&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:45 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Singleton&amp;lt;T&amp;gt; is called an &amp;quot;open&amp;quot; generic type as long as T is undefined&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:46 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Singleton&amp;lt;Foo&amp;gt; is a &amp;quot;closed&amp;quot; generic type b/c T has been defined as Foo&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:46 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;ok &lt;/p&gt;  &lt;p&gt;(10:46 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Singleton&amp;lt;T&amp;gt; == S&amp;lt;T&amp;gt; from now on&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:46 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;ok &lt;/p&gt;  &lt;p&gt;(10:47 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;so now that you know S&amp;lt;Foo&amp;gt; is a totally different class than S&amp;lt;Bar&amp;gt;...&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:47 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;notice that the class is static - both member (field and property) are both static&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:47 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;I see &lt;/p&gt;  &lt;p&gt;(10:48 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;so you don't need an instance of the class, but it returns an instance    &lt;br /&gt;of T &lt;/p&gt;  &lt;p&gt;(10:50 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0; class Foo      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0; {       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; public object bar = new object();       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0; }       &lt;br /&gt;is basically the same as...       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0; class Foo       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0; {       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; public object bar;       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; public Foo()       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; {       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; bar = new object();       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; }       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0; }&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:50 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;first initializes bar inline; second initializes bar inside the constructor&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:51 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;I'm with you &lt;/p&gt;  &lt;p&gt;(10:51 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;first is essentially converted to second when compiled&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:51 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;C# guarantees that all fields will be initialized before any user-defined ctor code is executed&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:52 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;ok &lt;/p&gt;  &lt;p&gt;(10:52 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0; class Foo      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0; {       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; public int bar = 3;       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; public Foo()       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; {       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; bar = 2;       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; }       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0; }&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:52 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;in this case, bar is initialized to 3, then immediatly overwritten with 2&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:53 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;I see &lt;/p&gt;  &lt;p&gt;(10:53 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;C# also guarantees that a static constructor will be executed exactly one time per class (per AppDomain)&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:54 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;and that it will be executed immediatly before the first access of any static members of the class&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:54 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;does the constructor need an access modifier? &lt;/p&gt;  &lt;p&gt;(10:54 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;static constructors can't have access modifiers&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:55 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;instance constructors follow the same rules as other members - everything without an access modifier is private by default&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:55 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;ok    &lt;br /&gt;let me soak in what you wrote &lt;/p&gt;  &lt;p&gt;(10:57 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;so its the static keyword in the constructor that makes it the singleton &lt;/p&gt;  &lt;p&gt;(10:57 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;the class i sent you doesn't even have an explicit constructor&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(10:58 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;oh, you're right &lt;/p&gt;  &lt;p&gt;(10:58 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;hmm &lt;/p&gt;  &lt;p&gt;(10:59 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;so the fact that its a static class then &lt;/p&gt;  &lt;p&gt;(10:59 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;sorta - in C# a static class is just a way to ensure that all members are static      &lt;br /&gt;it doesn't mean much&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(11:01 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;(in .Net 1.x they shipped with a class that was expected to be &amp;quot;static&amp;quot;, but it had a public instance method and the only instance ctor was Private - that meant that there was no way for anyone to instantiate the class and use the public method - in .Net 2.0 they added the concept of a &amp;quot;static class&amp;quot; to prevent things like that in the future)&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(11:02 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;I see &lt;/p&gt;  &lt;p&gt;(11:03 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;i have given you all the info you need to answer your orig. question&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(11:04 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;(inline initialization == ctor initialization; static ctor is called exactly once and just before first access of any static member)&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(11:06 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;I get it &lt;/p&gt;  &lt;p&gt;(11:06 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;you grok it?&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(11:06 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;no, I don't want&amp;#xA0; to say I grok it until I've used it &lt;/p&gt;  &lt;p&gt;(11:07 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;so pretty much that's how you do a singleton in .net? &lt;/p&gt;  &lt;p&gt;(11:08 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;or is that across other languages as well? &lt;/p&gt;  &lt;p&gt;(11:08 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;other languages/platforms have different intricacies      &lt;br /&gt;and that's not the normal way to do a singleton       &lt;br /&gt;it's my own invention &lt;/b&gt;&lt;b&gt;&lt;a href="http://lh5.google.com/UrbanFly/RutN2vMjTlI/AAAAAAAAAM8/YU0iwksKeDc/clip_image002164%5B1%5D%5B2%5D.gif"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="16" alt=":)" src="http://lh6.google.com/UrbanFly/RutN2_MjTmI/AAAAAAAAANA/Ye0uPWDH95g/clip_image002164%5B1%5D_thumb%5B1%5D.gif" width="16" border="0" /&gt;&lt;/a&gt;&lt;/b&gt;&lt;b&gt;&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(11:08 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;seems elegant &lt;/p&gt;  &lt;p&gt;(11:09 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;although I don't know the other way &lt;/p&gt;  &lt;p&gt;(11:09 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;I have a question for you &lt;/p&gt;  &lt;p&gt;(11:10 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;its C++ but more OOP specific &lt;/p&gt;  &lt;p&gt;(11:11 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;in the main class I'm doing at work, it has a bunch of functions that work with the member&amp;#xA0; data &lt;/p&gt;  &lt;p&gt;(11:12 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;it basically has one method, and inside that method I've broken tasks down into their own methods &lt;/p&gt;  &lt;p&gt;(11:12 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;but since its all within the class I don't have to pass anything into these methods since I already have access to them &lt;/p&gt;  &lt;p&gt;(11:13 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;but it feels weird or something &lt;/p&gt;  &lt;p&gt;(11:13 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;it's a bad habit&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(11:13 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;I thought so, but I wasn't sure &lt;/p&gt;  &lt;p&gt;(11:14 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;unless the data (state) needs to be persisted even after the call to the &amp;quot;basically one method&amp;quot; then it should be passed to each method as needed&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(11:15 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;ok, I felt that was the right way    &lt;br /&gt;tomorrow I'll fix it &lt;/p&gt;  &lt;p&gt;(11:16 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;I mean I felt that passing parameters was the right way &lt;/p&gt;  &lt;p&gt;(11:19 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;this is the conventional singleton pattern      &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0; public class Foo       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0; {       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; // prevents public instantiation       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; private Foo() { }       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; private static Foo instance;       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; public static Foo Instance       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; {       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; get       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; {       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; // this is called the &amp;quot;double-checked locking&amp;quot; singleton pattern       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; // it attempts to solve a &amp;quot;race condition&amp;quot; that may occur in multi-threaded systems       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; if (instance == null)       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; {       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; lock (this)       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; {       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; if (instance == null) // another thread could have assigned it since the previous check       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; {       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; instance = new Foo();       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; }       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; }       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; }       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; return instance;       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; }       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; }       &lt;br /&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0; }&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(11:20 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;&lt;a href="http://www.ibm.com/developerworks/java/library/j-dcl.html"&gt;http://www.ibm.com/developerworks/java/library/j-dcl.html&lt;/a&gt;&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(11:21 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;&amp;quot;The bottom line is that double-checked locking, in whatever form, should not be used because you cannot guarantee that it will work on any JVM implementation.&amp;quot;      &lt;br /&gt;same thing on the .Net platform&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(11:23 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;&amp;quot;Listing 10&amp;quot; in that article is &amp;quot;good&amp;quot; but not great in .Net b/c it isn't lazy enough&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(11:24 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;access to *any* static member will instantiate the &amp;quot;instance&amp;quot; field even though i may not be using it      &lt;br /&gt;anyway, it's bedtime       &lt;br /&gt;i think you've got enought for tonight &lt;/b&gt;&lt;b&gt;&lt;img height="16" alt=":)" src="http://lh4.google.com/UrbanFly/RutN3fMjTnI/AAAAAAAAAMc/SLS6dtC_drc/clip_image0021713.gif" width="16" border="0" /&gt;&lt;/b&gt;&lt;b&gt;&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(11:24 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;i had fun teaching you&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(11:24 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;for sure, thanks &lt;/p&gt;  &lt;p&gt;(11:25 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;interesting how you merged our two topics    &lt;br /&gt;did you notice that? &lt;/p&gt;  &lt;p&gt;(11:25 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;no?&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(11:25 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;we were talking about design patterns then about programmers you don't like, which lead to my question about how much input you have in the hiring &lt;/p&gt;  &lt;p&gt;(11:26 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;which lead to you giving me the example snippet you wrote for interviewees &lt;/p&gt;  &lt;p&gt;(11:26 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;which went back around to patterns&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(11:26 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;which was about a singleton    &lt;br /&gt;:0-)     &lt;br /&gt;uh, &lt;img height="16" alt=":)" src="http://lh5.google.com/UrbanFly/RutN3vMjToI/AAAAAAAAAMk/Z2lv-PiqFpM/clip_image002186.gif" width="16" border="0" /&gt; &lt;/p&gt;  &lt;p&gt;(11:26 PM)&lt;b&gt; Robert:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;&lt;b&gt;i'm just good like that &lt;/b&gt;&lt;b&gt;&lt;img height="16" alt=":)" src="http://lh5.google.com/UrbanFly/RutN3vMjTpI/AAAAAAAAAMs/CDESb4rcdNs/clip_image002196.gif" width="16" border="0" /&gt;&lt;/b&gt;&lt;b&gt;      &lt;br /&gt;goodnight&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;(11:26 PM)&lt;b&gt; Daniel:&lt;/b&gt; &lt;/p&gt;  &lt;p&gt;guess so, night&lt;/p&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/453286148678307547-6630556365899826516?l=develocity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/6630556365899826516/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=453286148678307547&amp;postID=6630556365899826516' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/6630556365899826516'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/6630556365899826516'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/2007/09/conversation-about-patterns-developers.html' title='Conversation about Patterns, Developers, and whatnot'/><author><name>Robert Taylor</name><uri>http://www.blogger.com/profile/17656686243105089817</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-453286148678307547.post-7758514753834662050</id><published>2007-07-25T19:27:00.000-07:00</published><updated>2007-07-26T06:58:11.086-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><title type='text'>Object Oriented? You can't even define classes, can you?</title><content type='html'>&lt;p&gt;For some reason, unlike other modern languages, &lt;strong&gt;the ability to define custom types&lt;/strong&gt; seems to be a Javascript language feature that is often passed over. Only advanced Javascripters seem to ever get around to learning about this underused feature. Defining a new type in Javascript is easy; you just have to get used to the syntax and understand that in Javascript, &lt;strong&gt;everything is an object; Functions are Objects, too&lt;/strong&gt;. &lt;/p&gt; &lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4"&gt; &lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; Person(fname, lname)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._fname = fname;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._lname = lname;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt; }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; dave = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Person(&lt;span style="color: #006080"&gt;"Dave"&lt;/span&gt;, &lt;span style="color: #006080"&gt;"Haynes"&lt;/span&gt;);&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;The code above defines a function called &lt;span style="font-family: courier new"&gt;&lt;strong&gt;Person&lt;/strong&gt; &lt;/span&gt;which takes two parameters; notice how it assigns the value of the parameters to a pair of expando properties on &lt;span style="color: #3333ff; font-family: courier new"&gt;&lt;strong&gt;this&lt;/strong&gt;&lt;/span&gt;. What is &lt;span style="color: #3333ff; font-family: courier new"&gt;&lt;strong&gt;this&lt;/strong&gt;&lt;/span&gt;?&lt;br&gt;&lt;br&gt;First, notice the &lt;strong&gt;&lt;span style="color: #3333ff; font-family: courier new"&gt;new&lt;/span&gt; &lt;/strong&gt;keyword used in the assignment to &lt;span style="font-family: courier new"&gt;&lt;strong&gt;dave&lt;/strong&gt;&lt;/span&gt;. The &lt;span style="color: #3333ff; font-family: courier new"&gt;&lt;strong&gt;new&lt;/strong&gt;&lt;/span&gt; keyword basically calls the function in the context of a new object of type &lt;span style="font-family: courier new"&gt;&lt;strong&gt;Person&lt;/strong&gt;&lt;/span&gt; - &lt;span style="color: #3333ff; font-family: courier new"&gt;&lt;strong&gt;this&lt;/strong&gt;&lt;/span&gt; refers to that new object within the scope of the function. The function then adds new &lt;em&gt;expando&lt;/em&gt; properties to this object, then the object is assigned to &lt;span style="font-family: courier new"&gt;&lt;strong&gt;dave&lt;/strong&gt;&lt;/span&gt;. You can consider the &lt;span style="font-family: courier new"&gt;&lt;strong&gt;Person&lt;/strong&gt;&lt;/span&gt; function to be both the constructor for and the definition of the &lt;strong&gt;&lt;span style="font-family: courier new"&gt;Person&lt;/span&gt; &lt;/strong&gt;type. Without the &lt;span style="color: #3333ff; font-family: courier new"&gt;&lt;strong&gt;new&lt;/strong&gt;&lt;/span&gt; keyword, the &lt;em&gt;expando&lt;/em&gt; properties would be added to the &lt;em&gt;global&lt;/em&gt; scope and &lt;span style="font-family: courier new"&gt;&lt;strong&gt;dave&lt;/strong&gt;&lt;/span&gt; would be assigned the return value of the traditional function call. Since the function doesn't have a &lt;strong&gt;&lt;span style="color: #3333ff; font-family: courier new"&gt;return&lt;/span&gt;&lt;/strong&gt; statement, it implicitly returns &lt;strong&gt;&lt;span style="font-family: courier new"&gt;null&lt;/span&gt;&lt;/strong&gt;.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Remember earlier when I said "Functions are Objects, too"? Let's expand the sample a bit... &lt;/p&gt;&lt;br /&gt;&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4"&gt;&lt;br /&gt;&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;function&lt;/span&gt; Person(fname, lname)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._fname = fname;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._lname = lname;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;     &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.GetFullName = &lt;span style="color: #0000ff"&gt;function&lt;/span&gt;(){&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._fname + &lt;span style="color: #006080"&gt;" "&lt;/span&gt; + &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._lname;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt; }&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;var&lt;/span&gt; dave = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Person(&lt;span style="color: #006080"&gt;"Dave"&lt;/span&gt;, &lt;span style="color: #006080"&gt;"Haynes"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt; alert(dave.GetFullName());&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;Now we have added a new &lt;em&gt;expando&lt;/em&gt; property called &lt;span style="font-family: courier new"&gt;&lt;strong&gt;GetFullName&lt;/strong&gt;&lt;/span&gt;, but this time it is assigned a function that takes no formal parameters. This demonstrates that a function is an object just like everything else in Javascript. It can be passed around to other functions, stored in variables, garbage collected, etc.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/453286148678307547-7758514753834662050?l=develocity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/7758514753834662050/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=453286148678307547&amp;postID=7758514753834662050' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/7758514753834662050'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/7758514753834662050'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/2007/07/for-some-reason-unlike-other-modern.html' title='Object Oriented? You can&amp;#39;t even define classes, can you?'/><author><name>Robert Taylor</name><uri>http://www.blogger.com/profile/17656686243105089817</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-453286148678307547.post-8417723964536544951</id><published>2007-04-25T07:22:00.000-07:00</published><updated>2007-04-25T10:40:52.266-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><title type='text'>Garbage Collection? That's gross!</title><content type='html'>&lt;P&gt;&lt;span style="padding:5px; float:right;"&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://develocity.blogspot.com/2007/04/garbage-collection-probably-sounds-like.html';&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/span&gt;&lt;STRONG&gt;"Garbage Collection"&lt;/STRONG&gt; probably sounds like a strange term if you've never heard of it before.  So what is it? Well, you've all probably heard of a "memory leak" before.  Garbage Collection, or GC, is essentially &lt;STRONG&gt;an attempt to prevent memory leaks&lt;/STRONG&gt;.  Back in the old days, developers had to be very diligent about cleaning up after themselves.  If an object was allocated repeatedly but never "destroyed" or cleaned up the system would gradually use more and more memory until there was no more available memory and the application would crash.&lt;/P&gt; &lt;P&gt; &lt;/P&gt; &lt;P&gt;Today, platforms like Java, .Net, Javascript, Perl, Ruby, and PHP have GC built-in.  In platforms with GC, objects that are no longer referenced (because the reference has gone out of scope or because the variable was set to null) become &lt;EM&gt;eligible&lt;/EM&gt; to be automatically destroyed and the memory used made available for new allocations.  Notice that i said they become &lt;EM&gt;eligible&lt;/EM&gt;; the objects are not immediately cleaned up when they go out of scope.  The garbage collector only performs the collection when it is necessary, such as when the system is running low on memory.&lt;/P&gt; &lt;P&gt; &lt;/P&gt; &lt;P&gt;Javascript has the ability to be garbage collected or to use explicit memory management when necessary or desired with the &lt;FONT face="Courier New" color=#3333ff&gt;delete&lt;/FONT&gt; keyword.  The two graphs below show the difference.&lt;/P&gt; &lt;P&gt; &lt;/P&gt; &lt;P&gt;The first graph shows memory consumption over time while the &lt;STRONG&gt;garbage collector is allowed to manage the memory&lt;/STRONG&gt;.&lt;/P&gt; &lt;P&gt; &lt;/P&gt; &lt;P&gt;&lt;IMG title="Javascript GC Sawtooth Pattern" style="WIDTH: 605px; HEIGHT: 457px" src="http://docs.google.com/File?id=dff66jpz_10fpzqrq"&gt; &lt;/P&gt; &lt;P&gt;  &lt;/P&gt; &lt;P&gt;The second graph shows the same thing while the program manages it's own memory by &lt;STRONG&gt;explicitly deleting the objects&lt;/STRONG&gt; when it is done with them.&lt;/P&gt; &lt;P&gt; &lt;/P&gt; &lt;P&gt;&lt;IMG title="Javascript GC Flatline Pattern" style="WIDTH: 605px; HEIGHT: 457px" src="http://docs.google.com/File?id=dff66jpz_11fwc8cq"&gt;  &lt;/P&gt; &lt;P&gt; &lt;/P&gt; &lt;DIV style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: gray 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 8pt; PADDING-BOTTOM: 4px; MARGIN: 20px 0px 10px; OVERFLOW: auto; BORDER-LEFT: gray 1px solid; WIDTH: 97.5%; MAX-HEIGHT: 200px; LINE-HEIGHT: 12pt; PADDING-TOP: 4px; BORDER-BOTTOM: gray 1px solid; BACKGROUND-COLOR: #f4f4f4"&gt; &lt;DIV style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   1:&lt;/SPAN&gt; &lt;SPAN style="BACKGROUND-COLOR: #ffff00"&gt;&amp;lt;%@ Page Language="C#" AutoEventWireup="true" Codebehind="Default.aspx.cs" Inherits="ItsJustJavascript._Default" %&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   2:&lt;/SPAN&gt;  &lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   3:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;!&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;DOCTYPE&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;html&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;PUBLIC&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;"-//W3C//DTD XHTML 1.0 Transitional//EN"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   4:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;html&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;xmlns&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="http://www.w3.org/1999/xhtml"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   5:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;head&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;id&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="Head1"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="server"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   6:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;title&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;Untitled Page&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;title&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   7:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;head&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   8:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;body&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   9:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;form&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;id&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="form1"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;runat&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="server"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  10:&lt;/SPAN&gt;         &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;div&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  11:&lt;/SPAN&gt;             &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;button&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;onclick&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="cancel = false; useMemory(false);"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  12:&lt;/SPAN&gt;                 start (normal)&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;button&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  13:&lt;/SPAN&gt;             &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;button&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;onclick&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="cancel = false; useMemory(true);"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  14:&lt;/SPAN&gt;                 start (self cleanup)&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;button&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  15:&lt;/SPAN&gt;             &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;button&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;onclick&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="cancel = true;"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  16:&lt;/SPAN&gt;                 stop&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;button&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  17:&lt;/SPAN&gt;             &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;br&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  18:&lt;/SPAN&gt;             &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;input&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;type&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="text"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;id&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="output"&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  19:&lt;/SPAN&gt;         &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;div&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  20:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;form&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  21:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;script&lt;/SPAN&gt; &lt;SPAN style="COLOR: #ff0000"&gt;type&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;="text/javascript"&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   1:&lt;/SPAN&gt;  &lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   2:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;var&lt;/SPAN&gt; cancel = &lt;SPAN style="COLOR: #0000ff"&gt;false&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   3:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;var&lt;/SPAN&gt; output = document.getElementById(&lt;SPAN style="COLOR: #006080"&gt;"output"&lt;/SPAN&gt;);    &lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   4:&lt;/SPAN&gt;     &lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   5:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;function&lt;/SPAN&gt; useMemory(selfCleanUp)&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   6:&lt;/SPAN&gt;     {&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   7:&lt;/SPAN&gt;         &lt;SPAN style="COLOR: #0000ff"&gt;if&lt;/SPAN&gt; (cancel) &lt;SPAN style="COLOR: #0000ff"&gt;return&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   8:&lt;/SPAN&gt;         &lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   9:&lt;/SPAN&gt;         output.value = (&lt;SPAN style="COLOR: #0000ff"&gt;new&lt;/SPAN&gt; Date()).toString();&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  10:&lt;/SPAN&gt;         &lt;SPAN style="COLOR: #0000ff"&gt;for&lt;/SPAN&gt; (&lt;SPAN style="COLOR: #0000ff"&gt;var&lt;/SPAN&gt; i = 0; i&amp;lt;100000; i++)&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  11:&lt;/SPAN&gt;         {&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  12:&lt;/SPAN&gt;             &lt;SPAN style="COLOR: #0000ff"&gt;var&lt;/SPAN&gt; foo = &lt;SPAN style="COLOR: #0000ff"&gt;new&lt;/SPAN&gt; Object(); &lt;SPAN style="COLOR: #008000"&gt;//just consume a small amount of memory&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  13:&lt;/SPAN&gt;             foo.bar = &lt;SPAN style="COLOR: #0000ff"&gt;new&lt;/SPAN&gt; Object(); &lt;SPAN style="COLOR: #008000"&gt;// and a bit more memory, plus an expando!&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  14:&lt;/SPAN&gt;             &lt;SPAN style="COLOR: #0000ff"&gt;if&lt;/SPAN&gt; (selfCleanUp)&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  15:&lt;/SPAN&gt;             {&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  16:&lt;/SPAN&gt;                 foo.bar = &lt;SPAN style="COLOR: #0000ff"&gt;null&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  17:&lt;/SPAN&gt;                 delete foo.bar;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  18:&lt;/SPAN&gt;                 foo = &lt;SPAN style="COLOR: #0000ff"&gt;null&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  19:&lt;/SPAN&gt;                 delete foo;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  20:&lt;/SPAN&gt;             }&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  21:&lt;/SPAN&gt;         }&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  22:&lt;/SPAN&gt;         &lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  23:&lt;/SPAN&gt;         window.setTimeout(&lt;SPAN style="COLOR: #006080"&gt;"useMemory("&lt;/SPAN&gt; + selfCleanUp + &lt;SPAN style="COLOR: #006080"&gt;")"&lt;/SPAN&gt;, 1);&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  24:&lt;/SPAN&gt;     }&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  25:&lt;/SPAN&gt;     &lt;/PRE&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;script&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  22:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;body&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  23:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #800000"&gt;html&lt;/SPAN&gt;&lt;SPAN style="COLOR: #0000ff"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt; &lt;P&gt;Additional Info:&lt;/P&gt; &lt;UL&gt; &lt;LI&gt;&lt;A title="Garbage collection @ Wikipedia" href="http://en.wikipedia.org/wiki/Garbage_collection_(computer_science)"&gt;Garbage collection @ Wikipedia&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/453286148678307547-8417723964536544951?l=develocity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/8417723964536544951/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=453286148678307547&amp;postID=8417723964536544951' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/8417723964536544951'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/8417723964536544951'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/2007/04/garbage-collection-probably-sounds-like.html' title='Garbage Collection? That&apos;s gross!'/><author><name>Robert Taylor</name><uri>http://www.blogger.com/profile/17656686243105089817</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-453286148678307547.post-4931418785149803155</id><published>2007-04-23T06:31:00.000-07:00</published><updated>2007-04-25T10:42:01.836-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><title type='text'>Presto Expando</title><content type='html'>&lt;P&gt;&lt;span style="padding:5px; float:right;"&gt;&lt;script type="text/javascript"&gt;digg_url = 'http://develocity.blogspot.com/2007/04/its-hard-to-know-where-to-start-but.html';&lt;/script&gt;&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;&lt;/span&gt;It's hard to know where to start, but you've got to start somewhere, right? &lt;/P&gt; &lt;P&gt; &lt;/P&gt; &lt;P&gt;JavaScript is a very dynamic language.  That basically means that &lt;STRONG&gt;objects can be created and modified at runtime&lt;/STRONG&gt;.  It is also very loosely-typed which means that you can treat a string variable as an integer or an integer as a date, or a date as a string, or... well, you get the point. &lt;/P&gt; &lt;P&gt; &lt;/P&gt; &lt;P&gt;So what do I mean by "objects can be created and modified at runtime"?  In static languages, the members (attributes, properties, methods, etc.) and behaviors of a type are explicitly defined at design-time and then compiled.  After compilation you cannot add or remove any of the members.  I suppose you've already guessed what i'm going to say next. In dynamic languages (depending on the degree of dynamicism), any member can be added, removed, or replaced at runtime. In Javascript, &lt;STRONG&gt;members you add at runtime are commonly called "expando properties".&lt;/STRONG&gt; &lt;/P&gt; &lt;DIV style="BORDER-RIGHT: gray 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: gray 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 8pt; PADDING-BOTTOM: 4px; MARGIN: 20px 0px 10px; OVERFLOW: auto; BORDER-LEFT: gray 1px solid; WIDTH: 97.5%; MAX-HEIGHT: 200px; LINE-HEIGHT: 12pt; PADDING-TOP: 4px; BORDER-BOTTOM: gray 1px solid; BACKGROUND-COLOR: #f4f4f4"&gt; &lt;DIV style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   1:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;var&lt;/SPAN&gt; someObject = &lt;SPAN style="COLOR: #0000ff"&gt;new&lt;/SPAN&gt; Object();&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   2:&lt;/SPAN&gt;  &lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   3:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #008000"&gt;//calls builtin toString method&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   4:&lt;/SPAN&gt; alert(someObject.toString());&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   5:&lt;/SPAN&gt;  &lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   6:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #008000"&gt;// adding an attribute&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   7:&lt;/SPAN&gt; someObject.myExpando = &lt;SPAN style="COLOR: #006080"&gt;"hello expando"&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   8:&lt;/SPAN&gt;  &lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;   9:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #008000"&gt;// replaces builtin toString method&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  10:&lt;/SPAN&gt; someObject.toString = &lt;SPAN style="COLOR: #0000ff"&gt;function&lt;/SPAN&gt;()&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  11:&lt;/SPAN&gt; {&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  12:&lt;/SPAN&gt;     &lt;SPAN style="COLOR: #0000ff"&gt;return&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;this&lt;/SPAN&gt;.myExpando;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  13:&lt;/SPAN&gt; }&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  14:&lt;/SPAN&gt;  &lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  15:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #008000"&gt;// notice how the toString method has been replaced&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  16:&lt;/SPAN&gt; alert(someObject.toString());&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  17:&lt;/SPAN&gt;  &lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  18:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #008000"&gt;// adding a new method to the new object&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  19:&lt;/SPAN&gt; someObject.tellTime = &lt;SPAN style="COLOR: #0000ff"&gt;function&lt;/SPAN&gt;()&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  20:&lt;/SPAN&gt; {&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  21:&lt;/SPAN&gt;     alert(&lt;SPAN style="COLOR: #0000ff"&gt;new&lt;/SPAN&gt; Date());&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  22:&lt;/SPAN&gt; }&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  23:&lt;/SPAN&gt;  &lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  24:&lt;/SPAN&gt; someObject.tellTime();&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  25:&lt;/SPAN&gt;  &lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  26:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #008000"&gt;//removing the method we just added&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  27:&lt;/SPAN&gt; delete someObject.tellTime;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  28:&lt;/SPAN&gt;  &lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  29:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #008000"&gt;//calling the method now will be an error&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  30:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;try&lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  31:&lt;/SPAN&gt; {&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  32:&lt;/SPAN&gt;     someObject.tellTime();&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  33:&lt;/SPAN&gt; }&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  34:&lt;/SPAN&gt; &lt;SPAN style="COLOR: #0000ff"&gt;catch&lt;/SPAN&gt;(e)&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  35:&lt;/SPAN&gt; {&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: #f4f4f4; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  36:&lt;/SPAN&gt;     alert(e.message);&lt;/PRE&gt;&lt;PRE style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; FONT-SIZE: 8pt; PADDING-BOTTOM: 0px; MARGIN: 0em; OVERFLOW: visible; WIDTH: 100%; COLOR: black; BORDER-TOP-STYLE: none; LINE-HEIGHT: 12pt; PADDING-TOP: 0px; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: white; BORDER-BOTTOM-STYLE: none"&gt;&lt;SPAN style="COLOR: #606060"&gt;  37:&lt;/SPAN&gt; }&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt; &lt;P&gt;Additional Info: &lt;/P&gt; &lt;UL&gt; &lt;LI&gt;&lt;A title="Dynamic language @ Wikipedia" href="http://en.wikipedia.org/wiki/Dynamic_language"&gt;Dynamic language @ Wikipedia&lt;/A&gt;  &lt;LI&gt;&lt;A title="Javascript Objects @ MSDN" href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/f5106284-1240-4f47-8c3b-5a45e227e5e1.asp"&gt;Javascript Objects @ MSDN&lt;/A&gt; &lt;/LI&gt;&lt;/UL&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/453286148678307547-4931418785149803155?l=develocity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/4931418785149803155/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=453286148678307547&amp;postID=4931418785149803155' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/4931418785149803155'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/4931418785149803155'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/2007/04/its-hard-to-know-where-to-start-but.html' title='Presto Expando'/><author><name>Robert Taylor</name><uri>http://www.blogger.com/profile/17656686243105089817</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-453286148678307547.post-3163115003753678526</id><published>2007-04-20T18:29:00.000-07:00</published><updated>2007-07-25T19:33:51.178-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><title type='text'>It's just Javascript, right?</title><content type='html'>&lt;p&gt;&lt;span style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; FLOAT: right; PADDING-BOTTOM: 5px; PADDING-TOP: 5px"&gt;&lt;/span&gt;Recently I realized that most developers I've known (and therefore, probably most developers in the world) think of Javascript as just:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;a bunch of variables, &lt;li&gt;inline code in an onClick attribute, and &lt;li&gt;global methods on a webpage.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;How many of you are saying "yeah, what else is there?"; raise your hands...&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;I'll discuss the language in more detail in a series that will start out simple and then build upon itself. Hopefully each episode will leave you dying to find out what happens next - like an episode of Lost or 24. Some of the episodes will be called:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;a title="Presto Expando" href="http://develocity.blogspot.com/2007/04/its-hard-to-know-where-to-start-but.html"&gt;Presto Expando&lt;/a&gt; &lt;li&gt;&lt;a title="Garbage Collection? That's gross!" href="http://develocity.blogspot.com/2007/04/garbage-collection-probably-sounds-like.html"&gt;Garbage Collection? That's gross!&lt;/a&gt; &lt;li&gt;Boolean. Not the meat cubes; and not the gold bricks. &lt;li&gt;&lt;a href="http://develocity.blogspot.com/2007/07/for-some-reason-unlike-other-modern.html"&gt;Object Oriented? You can't even define classes, can you?&lt;/a&gt; &lt;li&gt;Prototype? But hasn't Javascript been around for a while now? &lt;li&gt;Functional? Of course it is, I mean, I've seen it work. &lt;li&gt;What's in the Dictionary? &lt;li&gt;Who is this J[a]SON i've been hearing about? &lt;li&gt;The library formerly known as "Atlas"&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/453286148678307547-3163115003753678526?l=develocity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/3163115003753678526/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=453286148678307547&amp;postID=3163115003753678526' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/3163115003753678526'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/3163115003753678526'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/2007/04/recently-i-realized-that-most.html' title='It&apos;s just Javascript, right?'/><author><name>Robert Taylor</name><uri>http://www.blogger.com/profile/17656686243105089817</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-453286148678307547.post-8540631124918995640</id><published>2007-03-23T13:45:00.000-07:00</published><updated>2008-03-26T13:18:17.189-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Discussions'/><title type='text'>Declarative vs. Imperative</title><content type='html'>&lt;p&gt;Recently i was talking to &lt;a href="http://michaelsilver.us/"&gt;Michael Silver&lt;/a&gt; about declarative vs. imperative programming; he found &lt;a href="http://michaellatta.spaces.live.com/Blog/cns!C1946631E30779E4!805.entry"&gt;an article on the topic saying that declarative programming is overrated&lt;/a&gt; and that "languages like Ruby" allow writing imperative code that "looks" and "feels" declarative. The article didn't give any examples, but Michael sent me an example using ActiveRecord to define a database schema.&lt;/p&gt; &lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4"&gt; &lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; ActiveRecord::Schema.define(:version =&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; 2) do&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt;  &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;   create_table "comments", :force =&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; true do |t|&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;     t.column "body", :text&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;     t.column "post_id", :integer&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;   end&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;  &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;   create_table "posts", :force =&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; true do |t|&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;     t.column "title", :string&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;     t.column "body", :text&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;     t.column "created_at", :datetime&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;     t.column "author_name", :string&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt;     t.column "comments_count", :integer, :default =&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; 0&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  14:&lt;/span&gt;   end&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  15:&lt;/span&gt;  &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  16:&lt;/span&gt; end&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;After a while of &lt;a href="http://en.wikibooks.org/wiki/Ruby_Programming/Ruby_basics"&gt;figuring out the semantics of the Ruby syntax&lt;/a&gt;, i realized that it isn't even a *language* feature that the article was touting - it's simply a "&lt;a href="http://codebetter.com/blogs/jeremy.miller/archive/2007/02/20/Preview-of-StructureMap_2700_s-new-Configuration-DSL.aspx"&gt;fluent API&lt;/a&gt;" which is apparently fairly common in Ruby libraries.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;So I thought I would try to create a library in .Net that would "feel" very similar to the Ruby style.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;So, here's the same code in VB.Net...&lt;br&gt;&lt;/p&gt;&lt;br /&gt;&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4"&gt;&lt;br&gt;&lt;br /&gt;&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;With&lt;/span&gt; ActiveRecord.DefineSchema().AsVersion(2)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; &amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;With&lt;/span&gt; .WithTable(&lt;span style="color: #006080"&gt;"comments"&lt;/span&gt;).UseForce()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;         .WithColumn(&lt;span style="color: #006080"&gt;"body"&lt;/span&gt;).AsType(Of &lt;span style="color: #0000ff"&gt;String&lt;/span&gt;)()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;         .WithColumn(&lt;span style="color: #006080"&gt;"post_id"&lt;/span&gt;).AsType(Of &lt;span style="color: #0000ff"&gt;Integer&lt;/span&gt;)()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;With&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt; &amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;With&lt;/span&gt; .WithTable(&lt;span style="color: #006080"&gt;"posts"&lt;/span&gt;).UseForce()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt;         .WithColumn(&lt;span style="color: #006080"&gt;"title"&lt;/span&gt;).AsType(Of &lt;span style="color: #0000ff"&gt;String&lt;/span&gt;)()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;         .WithColumn(&lt;span style="color: #006080"&gt;"body"&lt;/span&gt;).AsType(Of &lt;span style="color: #0000ff"&gt;String&lt;/span&gt;)()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;         .WithColumn(&lt;span style="color: #006080"&gt;"Created_at"&lt;/span&gt;).AsType(Of &lt;span style="color: #0000ff"&gt;Date&lt;/span&gt;)()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;         .WithColumn(&lt;span style="color: #006080"&gt;"author_name"&lt;/span&gt;).AsType(Of &lt;span style="color: #0000ff"&gt;String&lt;/span&gt;)()&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt;         .WithColumn(&lt;span style="color: #006080"&gt;"comments_count"&lt;/span&gt;).AsType(Of &lt;span style="color: #0000ff"&gt;Integer&lt;/span&gt;).UseDefault(0)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  14:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;With&lt;/span&gt;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  15:&lt;/span&gt; &amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  16:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;With&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;...and here's the same code in C#...&lt;/p&gt;&lt;br /&gt;&lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, 'Courier New', courier, monospace; background-color: #f4f4f4"&gt;&lt;br&gt;&lt;br /&gt;&lt;div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   1:&lt;/span&gt; ActiveRecord.DefineSchema(&lt;span style="color: #0000ff"&gt;delegate&lt;/span&gt;(ARSchema s)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   3:&lt;/span&gt; &amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   4:&lt;/span&gt;     s.WithTable(&lt;span style="color: #006080"&gt;"comments"&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;delegate&lt;/span&gt;(ARTable t)&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   5:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   6:&lt;/span&gt;         t.WithColumn(&lt;span style="color: #006080"&gt;"body"&lt;/span&gt;).AsType&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   7:&lt;/span&gt;         t.WithColumn(&lt;span style="color: #006080"&gt;"post_id"&lt;/span&gt;).AsType&amp;lt;&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;&amp;gt;();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   8:&lt;/span&gt;     }).UseForce();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;   9:&lt;/span&gt; &amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  10:&lt;/span&gt;     s.WithTable(&lt;span style="color: #006080"&gt;"posts"&lt;/span&gt;).UseForce(&lt;span style="color: #0000ff"&gt;delegate&lt;/span&gt;(ARTable t) &lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  11:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  12:&lt;/span&gt;         t.WithColumn(&lt;span style="color: #006080"&gt;"title"&lt;/span&gt;).AsType&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  13:&lt;/span&gt;         t.WithColumn(&lt;span style="color: #006080"&gt;"body"&lt;/span&gt;).AsType&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  14:&lt;/span&gt;         t.WithColumn(&lt;span style="color: #006080"&gt;"Created_at"&lt;/span&gt;).AsType&amp;lt;DateTime&amp;gt;();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  15:&lt;/span&gt;         t.WithColumn(&lt;span style="color: #006080"&gt;"author_name"&lt;/span&gt;).AsType&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;();&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  16:&lt;/span&gt;         t.WithColumn(&lt;span style="color: #006080"&gt;"comments_count"&lt;/span&gt;).AsType&amp;lt;&lt;span style="color: #0000ff"&gt;int&lt;/span&gt;&amp;gt;().UseDefault(0);&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  17:&lt;/span&gt;     });&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  18:&lt;/span&gt; &amp;nbsp;&lt;/pre&gt;&lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, 'Courier New', courier, monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"&gt;&lt;span style="color: #606060"&gt;  19:&lt;/span&gt; }).AsVersion(2);&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;The VB and the C# versions both take advantage of the language features.&amp;nbsp; VB supports the With statement, while C# supports anonymous delegates.&amp;nbsp; Both of these scenarios were enabled with overloaded methods within the same library.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/453286148678307547-8540631124918995640?l=develocity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/8540631124918995640/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=453286148678307547&amp;postID=8540631124918995640' title='28 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/8540631124918995640'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/8540631124918995640'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/2007/03/declarative-vs-imperative.html' title='Declarative vs. Imperative'/><author><name>Robert Taylor</name><uri>http://www.blogger.com/profile/17656686243105089817</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>28</thr:total></entry><entry><id>tag:blogger.com,1999:blog-453286148678307547.post-4620663497437863524</id><published>2007-03-15T06:59:00.001-07:00</published><updated>2008-03-26T13:15:09.457-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Code Snippets'/><title type='text'>How To Post Code From Visual Studio 2005 To Your Blog</title><content type='html'>&lt;p&gt;You would not believe how much time we've spent trying to find an easy way to post code samples to this blog. Research (via Google) has proven that we're not the only ones who have spent countless hours trying to do what should be very simple.    &lt;br /&gt;    &lt;br /&gt;Now that we've figured out an excellent way to do it, we thought we'd share it with everyone else.     &lt;br /&gt;    &lt;br /&gt;&lt;strong&gt;Step-By-Step Instructions:      &lt;br /&gt;&lt;/strong&gt;    &lt;br /&gt;1. Download, install, and run &lt;a href="http://windowslivewriter.spaces.live.com/" target="_blank"&gt;Windows Live Writer&lt;/a&gt;. Setup your blog following the wizard.     &lt;br /&gt;    &lt;br /&gt;2. Download and install the &lt;a href="http://gallery.live.com/liveItemDetail.aspx?li=d4409446-af7f-42ec-aa20-78aa5bac4748&amp;amp;l=8" target="_blank"&gt;Code Snippet Plugin&lt;/a&gt; for Windows Live Writer.     &lt;br /&gt;    &lt;br /&gt;3. Open &lt;strong&gt;Visual Studio 2005&lt;/strong&gt;.     &lt;br /&gt;    &lt;br /&gt;4. &lt;strong&gt;Copy the code&lt;/strong&gt; from Visual Studio 2005 that you want to post to your blog.     &lt;br /&gt;    &lt;br /&gt;5. Switch to Windows Live Writer. Make sure you're in Web Layout mode. Click the link on the sidebar that says &lt;strong&gt;Insert Code Snippet&lt;/strong&gt;.     &lt;br /&gt;    &lt;br /&gt;&lt;a href="http://www.downcastsystems.com/blog/HowToPostCodeSamplesFromVisualStudio2005_FD79/image01.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="240" src="http://www.downcastsystems.com/blog/HowToPostCodeSamplesFromVisualStudio2005_FD79/image0.png" width="217" border="0" /&gt;&lt;/a&gt;     &lt;br /&gt;    &lt;br /&gt;6. When the &lt;strong&gt;Code Snippet&lt;/strong&gt; window pops up, paste your code into the top window.&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;&lt;a href="http://www.downcastsystems.com/blog/HowToPostCodeSamplesFromVisualStudio2005_FD79/image05.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="396" src="http://www.downcastsystems.com/blog/HowToPostCodeSamplesFromVisualStudio2005_FD79/image0_thumb1.png" width="385" border="0" /&gt;&lt;/a&gt;     &lt;br /&gt;    &lt;br /&gt;7. Be sure &lt;strong&gt;Embed Styles&lt;/strong&gt; is highlighted (it's between the top and bottom windows). This will make it so that the code will retain its formatting on your blog.&lt;/p&gt;  &lt;p style="width: 437px; height: 22.98%"&gt;&lt;/p&gt;  &lt;p&gt;The end result will look something like this:&lt;/p&gt;  &lt;div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; height: 89px; background-color: #f4f4f4"&gt;   &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas, &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; SayHello(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Name)&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #006080"&gt;&amp;quot;Hello: &amp;quot;&lt;/span&gt; + Name + &lt;span style="color: #006080"&gt;&amp;quot;\n\nWe are glad you have decided to read posts on the Develocity blog. We are trying to bring you quality, helpful stuff on here.&amp;quot;&lt;/span&gt;;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;You can adjust the width and height of the code box from within Windows Live Writer. &lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;That's it! It wasn't too painful, I hope.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/453286148678307547-4620663497437863524?l=develocity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/4620663497437863524/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=453286148678307547&amp;postID=4620663497437863524' title='106 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/4620663497437863524'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/4620663497437863524'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/2007/03/how-to-post-code-samples-from-visual.html' title='How To Post Code From Visual Studio 2005 To Your Blog'/><author><name>Dave Haynes</name><uri>http://www.blogger.com/profile/14398394041644839400</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/-nHfqFMn9q3w/TYtlFxYOW-I/AAAAAAAAbho/wl51gBkfZrk/s220/DaveHaynes.png'/></author><thr:total>106</thr:total></entry><entry><id>tag:blogger.com,1999:blog-453286148678307547.post-9040342721614576420</id><published>2007-03-13T18:06:00.001-07:00</published><updated>2007-04-25T11:47:55.183-07:00</updated><title type='text'>The Ten Commandments</title><content type='html'>&lt;span xmlns=""&gt;&lt;p&gt;&lt;span style="font-size:78%;"&gt;(from &lt;/span&gt;&lt;a href="http://builder.com.com/5100-6404-1045782.html"&gt;&lt;span style="font-size:78%;"&gt;http://builder.com.com/5100-6404-1045782.html&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size:78%;"&gt;)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;What we need is a set of rules or guidelines to help developers keep themselves (their egos, actually) separate from their code. Hence our Ten Commandments for Egoless Programming, which you can also &lt;a href="ftp://ftp.download.com/pub/builder/u00420020606adm01.zip"&gt;download in handy "stone tablet" format&lt;/a&gt;:&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;&lt;strong&gt;Understand and accept that you will make mistakes.&lt;/strong&gt; The point is to find them early, before they make it into production. Fortunately, except for the few of us developing rocket guidance software at JPL, mistakes are rarely fatal in our industry, so we can, and should, learn, laugh, and move on.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;You are not your code.&lt;/strong&gt; Remember that the entire point of a review is to find problems, and problems will be found. Don't take it personally when one is uncovered.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;No matter how much "karate" you know, someone else will always know more.&lt;/strong&gt; Such an individual can teach you some new moves if you ask. Seek and accept input from others, &lt;em&gt;especially&lt;/em&gt; when you think it's not needed.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Don't rewrite code without consultation.&lt;/strong&gt; There's a fine line between "fixing code" and "rewriting code." Know the difference, and pursue stylistic changes within the framework of a code review, not as a lone enforcer.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Treat people who know less than you with respect, deference, and patience.&lt;/strong&gt; Nontechnical people who deal with developers on a regular basis almost universally hold the opinion that we are prima donnas at best and crybabies at worst. Don't reinforce this stereotype with anger and impatience.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;The only constant in the world is change.&lt;/strong&gt; Be open to it and accept it with a smile. Look at each change to your requirements, platform, or tool as a new challenge, not as some serious inconvenience to be fought.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;The only true authority stems from knowledge, not from position.&lt;/strong&gt; Knowledge engenders authority, and authority engenders respect—so if you want respect in an egoless environment, cultivate knowledge.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Fight for what you believe, but gracefully accept defeat.&lt;/strong&gt; Understand that sometimes your ideas will be overruled. Even if you do turn out to be right, don't take revenge or say, "I told you so" more than a few times at most, and don't make your dearly departed idea a martyr or rallying cry.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Don't be "the guy in the room."&lt;/strong&gt; Don't be the guy coding in the dark office emerging only to buy cola. The guy in the room is out of touch, out of sight, and out of control and has no place in an open, collaborative environment.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Critique code instead of people—be kind to the coder, not to the code. &lt;/strong&gt;As much as possible, make all of your comments positive and oriented to improving the code. Relate comments to local standards, program specs, increased performance, etc.&lt;/li&gt;&lt;/ol&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/453286148678307547-9040342721614576420?l=develocity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/9040342721614576420/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=453286148678307547&amp;postID=9040342721614576420' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/9040342721614576420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/9040342721614576420'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/2007/03/ten-commandments.html' title='The Ten Commandments'/><author><name>Robert Taylor</name><uri>http://www.blogger.com/profile/17656686243105089817</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-453286148678307547.post-8230787014074294303</id><published>2007-03-13T17:44:00.001-07:00</published><updated>2008-03-26T13:18:38.174-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Code Snippets'/><title type='text'>PasteBin - easy way to share source code</title><content type='html'>&lt;span xmlns=''&gt;&lt;p&gt;If you've ever wanted to share source code with someone, here's a better way than IM or email. It allows longer snippets than IM normally does and includes syntax highlighting.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;a href='http://pastebin.com/'&gt;http://pastebin.com/&lt;/a&gt;&lt;br /&gt;			&lt;/p&gt;&lt;p&gt;I'm going to try using it to post source code on this blog using a "private" PasteBin at &lt;a href='http://develocity.pastebin.com'&gt;http://develocity.pastebin.com&lt;/a&gt;.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;em&gt;(btw, this was posted with Word 2007)&lt;/em&gt;&lt;/p&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/453286148678307547-8230787014074294303?l=develocity.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://develocity.blogspot.com/feeds/8230787014074294303/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=453286148678307547&amp;postID=8230787014074294303' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/8230787014074294303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/453286148678307547/posts/default/8230787014074294303'/><link rel='alternate' type='text/html' href='http://develocity.blogspot.com/2007/03/pastebin-easy-way-to-share-source-code.html' title='PasteBin - easy way to share source code'/><author><name>Robert Taylor</name><uri>http://www.blogger.com/profile/17656686243105089817</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry></feed>
