<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" gd:etag="W/&quot;CU8DQ3k6fSp7ImA9WxBbFkg.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298</id><updated>2010-03-15T07:51:12.715-04:00</updated><title>Michael Haren</title><subtitle type="html">My thoughts on technology, money, life and babies.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://blog.wassupy.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>250</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/wassupy-wp" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="wassupy-wp" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;CE4NRnc8eCp7ImA9WxBbE04.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-8653109317224056003</id><published>2010-03-11T13:43:00.001-05:00</published><updated>2010-03-11T13:43:17.970-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-11T13:43:17.970-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Technology" /><category scheme="http://www.blogger.com/atom/ns#" term="Work" /><title>Easter Eggs in Red-Gate’s SQL Compare</title><content type="html">&lt;p&gt;A coworker discovered a neat Easter egg in Red-Gate’s &lt;a href="http://www.red-gate.com/Products/schema_compare_for_oracle/index.htm"&gt;Schema Compare for Oracle&lt;/a&gt;: Oracleoids:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://lh5.ggpht.com/_IKD9WtY5kxU/S5k5sSRmH3I/AAAAAAAAArU/gW5hQeDo6FE/clip_image002%5B3%5D.jpg?imgmax=800" width="693" height="459" /&gt;&lt;/p&gt;  &lt;p&gt;I checked the tools &lt;em&gt;I use &lt;/em&gt;and discovered this Easter egg in &lt;a href="http://www.red-gate.com/Products/SQL_Compare/index.htm"&gt;SQL Compare&lt;/a&gt; and &lt;a href="http://www.red-gate.com/Products/SQL_Data_Compare/index.htm"&gt;Data Compare&lt;/a&gt; (v7.1):&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_IKD9WtY5kxU/S5k5tg6jhEI/AAAAAAAAArY/_iKjbD5Y1WI/image%5B2%5D.png?imgmax=800" width="592" height="422" /&gt; &lt;/p&gt;  &lt;p&gt;Which, after a few seconds, turns into one of those annoying slider puzzles:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_IKD9WtY5kxU/S5k5u808ATI/AAAAAAAAArc/c8ZGMy13yyo/image%5B5%5D.png?imgmax=800" width="592" height="422" /&gt; &lt;/p&gt;  &lt;p&gt;Fun stuff!&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7767624464875146298-8653109317224056003?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/8653109317224056003/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=8653109317224056003" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/8653109317224056003?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/8653109317224056003?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2010/03/easter-eggs-in-red-gates-sql-compare.html" title="Easter Eggs in Red-Gate’s SQL Compare" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></entry><entry gd:etag="W/&quot;CUcGQ3Y7fyp7ImA9WxBbE04.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-661472834055914529</id><published>2010-03-11T11:38:00.001-05:00</published><updated>2010-03-11T13:43:42.807-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-11T13:43:42.807-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Technology" /><category scheme="http://www.blogger.com/atom/ns#" term="Work" /><title>Watch out for that Distribution Database</title><content type="html">&lt;p&gt;I received some pretty &lt;a href="http://twitter.com/mharen/status/10326855258"&gt;serious alerts this morning&lt;/a&gt; about our database server running low on disk space and quickly discovered something amiss:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_IKD9WtY5kxU/S5kch_P0yoI/AAAAAAAAArI/dLksI7uk940/image%5B2%5D.png?imgmax=800" width="210" height="58" /&gt; &lt;/p&gt;  &lt;p&gt;That’s a tad higher than usual…just 100x bigger than it should be (yikes)! Allow me to illustrate how I imagine the last few months going for this gargantuan file:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="db-growth" border="0" alt="db-growth" src="http://lh6.ggpht.com/_IKD9WtY5kxU/S5kciOjEgMI/AAAAAAAAArM/v7SQotcU79Y/db-growth%5B5%5D.png?imgmax=800" width="631" height="455" /&gt; &lt;/p&gt;  &lt;p&gt;The problem turned out to be that several of the replication SQL jobs were disabled (since…months ago). The pertinent job is probably this one, the distribution clean up job:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_IKD9WtY5kxU/S5kciRVAdSI/AAAAAAAAArQ/yqxehPZak48/image%5B5%5D.png?imgmax=800" width="226" height="20" /&gt; &lt;/p&gt;  &lt;p&gt;It’s supposed to run every 10 minutes to tidy things up in the distribution database. I guess not running for &lt;em&gt;three months &lt;/em&gt;could lead to some problems (eek!). There’s really no excuse for this—it’s embarrassing. I’m not the DBA for this system but I should have noticed; a lot of people should have noticed.&lt;/p&gt;  &lt;p&gt;Since this task was disabled (not failing), it didn’t show up in our usual alert stream. I’m not sure how we solve that problem other than create an alert that detects disabled jobs. Or better yet, we could create alerts that fire whenever the job hasn’t run in the last &lt;em&gt;n&lt;/em&gt; minutes—something like that. &lt;/p&gt;  &lt;p&gt;Of course adding more sensitive alerts to the sizes of certain files or the free space of certain drives will help, too.&lt;/p&gt;  &lt;p&gt;So I guess the lesson here is to run regular checkups on your critical infrastructure and leverage monitoring services if you can to make the checkups easier and more effective.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7767624464875146298-661472834055914529?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/661472834055914529/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=661472834055914529" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/661472834055914529?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/661472834055914529?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2010/03/watch-out-for-that-distribution.html" title="Watch out for that Distribution Database" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry gd:etag="W/&quot;CUcFQHo_eip7ImA9WxBbE04.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-6244973506019829889</id><published>2010-03-10T12:42:00.001-05:00</published><updated>2010-03-11T13:43:31.442-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-11T13:43:31.442-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Technology" /><category scheme="http://www.blogger.com/atom/ns#" term="Work" /><title>Autohotkey: Wrapping the selection with a tag</title><content type="html">&lt;p&gt;&lt;a href="http://www.autohotkey.com/"&gt;Autohotkey&lt;/a&gt; is a nice tool to be familiar with—it enables you to create advanced hotkeys. Today, I built a very simple script which saved me a bunch of time. Here’s the skinny:&lt;/p&gt;  &lt;p&gt;I’ve been blogging about software a lot and these posts are often heavy with terms or phrases that I wrap in &lt;code&gt;http://www.autohotkey.com/&lt;/code&gt; tags. Unfortunately, my editor (&lt;a href="http://download.live.com/writer"&gt;Live Writer&lt;/a&gt;), as awesome as it is, doesn’t support something like this. AutoHotKey to the rescue!&lt;/p&gt;  &lt;p&gt;Here’s the script:&lt;/p&gt;  &lt;pre&gt;&lt;code class="csharpcode"&gt;#c::                       &lt;span class="rem"&gt;; fire on WIN+c&lt;/span&gt;
AutoTrim Off               &lt;span class="rem"&gt;; Retain any leading and trailing whitespace on the clipboard.&lt;/span&gt;
ClipSaved := ClipboardAll  &lt;span class="rem"&gt;; Save the entire clipboard so we can restore it when we're done&lt;/span&gt;
SendInput ^x               &lt;span class="rem"&gt;; cut the selection to the clipboard&lt;/span&gt;
ClipWait                   &lt;span class="rem"&gt;; wait for the clipboard to contain something&lt;/span&gt;
SendInput &amp;lt;code&amp;gt;%clipboard%&amp;lt;/code&amp;gt; &lt;span class="rem"&gt;; Output what was selected, surrounded by &amp;lt;code&amp;gt; tags&lt;/span&gt;
Clipboard := ClipSaved     &lt;span class="rem"&gt;; Restore the original clipboard&lt;/span&gt;
ClipSaved =                &lt;span class="rem"&gt;; Free the memory in case the clipboard was very large.&lt;/span&gt;
return&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Load this into your AHK script, hit reload, and fire away. Select some text, hit &lt;code&gt;WIN+C&lt;/code&gt;, and watch in amazement as it is surrounded by &lt;code&gt;&amp;lt;code&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7767624464875146298-6244973506019829889?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/6244973506019829889/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=6244973506019829889" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/6244973506019829889?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/6244973506019829889?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2010/03/autohotkey-wrapping-selection-with-tag.html" title="Autohotkey: Wrapping the selection with a tag" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry gd:etag="W/&quot;CUYHSX06fSp7ImA9WxBbEkk.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-4418479828736584084</id><published>2010-03-10T12:01:00.001-05:00</published><updated>2010-03-10T12:45:38.315-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-10T12:45:38.315-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Technology" /><title>Building URLs for “SRC” Attributes in ASP.NET MVC</title><content type="html">&lt;p&gt;I’ve been told that these programming posts are not interesting or funny. For those that have no interest in programming, I offer the following jokes: &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;“Chuck Norris can divide by zero” &lt;/p&gt;    &lt;p&gt;“Chuck Norris can touch MC Hammer”&lt;/p&gt;    &lt;p&gt;“Chuck Norris CAN believe it's not butter.”&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;–&lt;a href="http://www.chucknorrisfacts.com/chuck-norris-top-50-facts"&gt;Chuck Norris Facts&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Now would be a good time for you to stop reading. &lt;/p&gt;  &lt;p&gt;   &lt;hr /&gt;&lt;/p&gt;  &lt;p&gt;Dive into ASP.NET MVC and it won’t be long before you do this in a master page:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;link&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;text/css&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;rel&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Stylesheet&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;href&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;~/Content/all-src.min.css&amp;quot;&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;src&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;~/Scripts/all-src.min.js&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;This of course includes a couple global files—one for styles and one for scripts. Here’s the rub: it doesn’t work at all. It’ll seem like it works at first, because you’ll have nice styles and some of your scripts might even work, but it will be a short-lived experience.&lt;/p&gt;

&lt;p&gt;Unfortunately something funny is going on here. Those URLs are not valid—they’re more than relative (relative URLs are fine), they’re relative from an application root, denoted by the tilde (&lt;code&gt;~&lt;/code&gt;). That tilde means nothing to the browser. &lt;/p&gt;

&lt;p&gt;Now the funny business is that ASP.NET will rewrite the link tag &lt;em&gt;automatically&lt;/em&gt; to include the correct relative URL by replacing the “&lt;code&gt;~&lt;/code&gt;” with the appropriate path. It &lt;em&gt;does not &lt;/em&gt;do that with script tags. So you try to be clever and use a web-friendly relative URL syntax like this:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;src&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;../../Scripts/all-src.min.js&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Sorry, that doesn’t cut it. The “&lt;code&gt;../../&lt;/code&gt;” will only work properly if the content page (which uses the master page) is nested 2-levels deep, which is not likely to be true very often.&lt;/p&gt;

&lt;p&gt;The trick is to call into &lt;code&gt;Url.Content&lt;/code&gt; or &lt;code&gt;Url.Content&lt;/code&gt; like so:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt; &lt;span class="attr"&gt;src&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;&amp;lt;%=&lt;strong&gt;Url.Content&lt;/strong&gt;(&amp;quot;&lt;/span&gt;~/&lt;span class="attr"&gt;Scripts&lt;/span&gt;/&lt;span class="attr"&gt;all-src&lt;/span&gt;.&lt;span class="attr"&gt;min&lt;/span&gt;.&lt;span class="attr"&gt;js&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;quot;)%&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;This extra step will give me a nice URL, regardless of the page’s depth in my tree. So what’s the difference between &lt;a href="http://aspnet.codeplex.com/sourcecontrol/network/Show?projectName=aspnet&amp;amp;changeSetId=23011#266520"&gt;&lt;code&gt;Url.Content&lt;/code&gt;&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.control.resolveurl.aspx"&gt;&lt;code&gt;Url.Content&lt;/code&gt;&lt;/a&gt;? &lt;code&gt;ResolveUrl&lt;/code&gt; has been around &lt;em&gt;forever&lt;/em&gt; as part of &lt;code&gt;Url.Content&lt;/code&gt;. On the other hand, &lt;code&gt;Url.Content&lt;/code&gt; is relatively new and ships as part of &lt;code&gt;Url.Content&lt;/code&gt;. Aside from that, I have no idea—if you do, &lt;a href="http://stackoverflow.com/questions/2418050"&gt;please share&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Note: these commands work pretty much everywhere—&lt;code&gt;imgs&lt;/code&gt;, &lt;code&gt;Url.Content&lt;/code&gt;, etc.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7767624464875146298-4418479828736584084?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/4418479828736584084/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=4418479828736584084" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/4418479828736584084?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/4418479828736584084?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2010/03/building-urls-for-src-attributes-in.html" title="Building URLs for “SRC” Attributes in ASP.NET MVC" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry gd:etag="W/&quot;C08BQHc8cSp7ImA9WxBbEEU.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-2686761601337954493</id><published>2010-03-08T15:20:00.001-05:00</published><updated>2010-03-08T15:57:31.979-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-08T15:57:31.979-05:00</app:edited><title>+/-20 Years of Computing</title><content type="html">&lt;p&gt;In less than &lt;a href="http://twitter.com/mharen/statuses/10184506556"&gt;140 characters&lt;/a&gt;: &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Great new things by decade: 90s: make/save data; 00s: find data; 10s: visualize data, extract greater meaning; 20s: democratize data&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;In detail:&lt;/p&gt;  &lt;h4&gt;1990s&lt;/h4&gt;  &lt;p&gt;The 90s were an incredible time. This was the decade where most computing focused on generating data and saving it. The conventional wisdom of the day seemed to be that, through a magical process, massive amounts of data could be used to solve anything. This was the era of the chess playing super computer, &lt;a href="http://en.wikipedia.org/wiki/Deep_Blue_(chess_computer)"&gt;Deep Blue&lt;/a&gt;. This was the “anything is possible” childhood of the Internet.&lt;/p&gt;  &lt;h4&gt;2000s&lt;/h4&gt;  &lt;p&gt;Then came Google. Google made the 2000s the year of search. By then, what it had started in 1998 had reach a seriously huge critical mass. Early in the decade, though, many people and companies struggled to understand the Internet. This was a scary time for me as I saw some &lt;a href="http://en.wikipedia.org/wiki/Dot-com_bubble#List_of_companies_significant_to_the_bubble"&gt;high profile collapses&lt;/a&gt; like &lt;a href="http://en.wikipedia.org/wiki/Pets.com"&gt;Pets.com&lt;/a&gt; learn some hard lessons in business fundamentals (e.g. 1,000,000 views * $0/view = $0).&lt;/p&gt;  &lt;p&gt;It’s during this time that businesses based on good foundations of revenue and purpose really grew. This was the decade of search. Entire generations learned that by typing a few keywords into a box could lead you to damn near anything you wanted to know. Organizations and aspiring individuals learned that by pushing information to the Internet in a public way, they could capitalize on this traffic. This was a cool decade. &lt;/p&gt;  &lt;p&gt;That brings us to today.&lt;/p&gt;  &lt;h4&gt;2010s&lt;/h4&gt;  &lt;p&gt;We’re starting to feel a little overloaded by the massive amounts of information available to us. The ability to find a dataset, track it over a period of time and compare it to another dataset is a fairly challenging task today. This is where I expect to see some big “Wows” in 2010—visualization of data. &lt;/p&gt;  &lt;p&gt;I’ve seen &lt;a href="http://www.ted.com/talks/blaise_aguera_y_arcas_demos_photosynth.html"&gt;some&lt;/a&gt; &lt;a href="http://www.ted.com/talks/blaise_aguera.html"&gt;absolutely&lt;/a&gt; &lt;a href="http://www.ted.com/talks/gary_flake_is_pivot_a_turning_point_for_web_exploration.html"&gt;amazing&lt;/a&gt; &lt;a href="http://www.ted.com/talks/hans_rosling_shows_the_best_stats_you_ve_ever_seen.html"&gt;things&lt;/a&gt; coming from TED lately (&lt;em&gt;go watch those now&lt;/em&gt;) and am excited for what fiscally strong companies and universities can create. Enabling non-PhDs to extract meaning and value out of massive amounts of data has been on the radar for the last 20 years—I think we’re finally to a point where it can happen on a grand scale. &lt;/p&gt;  &lt;p&gt;Computing power is no longer a limitation. &lt;/p&gt;  &lt;p&gt;Connectivity is no longer a limitation. &lt;/p&gt;  &lt;p&gt;We will seem some very impressive and innovative ways to make sense and meaning of data very soon.&lt;/p&gt;  &lt;h4&gt;&lt;/h4&gt;  &lt;h4&gt;2020s&lt;/h4&gt;  &lt;p&gt;I think the success of data visualization will lead to passionate movements to democratize data. Around 2020, it will no longer be acceptable to conceal, hide, or privatize data. There will be a very successful movement to make government data and university data available via extremely accessible means—via APIs or methods that probably don’t exist today. Individuals will adopt the use of standards and contribute—for free—to the pool of data. This &lt;a href="http://en.wikipedia.org/wiki/Long_Tail"&gt;long-tail&lt;/a&gt; effect will be interesting if not incredible. &lt;/p&gt;  &lt;p&gt;Organizations will jump on board and contribute to this stream by dropping the unsuccessful pay-walls they constructed in the 2010s. Vague patents, which will be distorted and abused in the 2010s to monetize data will be invalidated or expire and the flood gates will open.&lt;/p&gt;  &lt;p&gt;In 2028, people will start discussing the merits of a &lt;a href="http://en.wikipedia.org/wiki/Census"&gt;conventional census&lt;/a&gt;—a reinvigoration of arguments made leading up to the 2020 census. Doing away with the census—which seemed ridiculous in 2018—will have a lot of support. We’ll do one anyway (at great expense) but it’ll be the last time. Around this time (2030), near-real-time data of greater quality than today’s census numbers will be available to all of us.&lt;/p&gt;  &lt;h4&gt;In Summary&lt;/h4&gt;  &lt;p&gt;I’m excited. &lt;/p&gt;  &lt;p&gt;Thanks to the Internet, I’ll end up back on some future incarnation of this page to see how completely and utterly wrong I was about everything (I can’t wait).&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7767624464875146298-2686761601337954493?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/2686761601337954493/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=2686761601337954493" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/2686761601337954493?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/2686761601337954493?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2010/03/20-years-of-computing.html" title="+/-20 Years of Computing" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></entry><entry gd:etag="W/&quot;D0cAQX4zeip7ImA9WxBbEEo.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-3295725829814248273</id><published>2010-03-08T13:38:00.001-05:00</published><updated>2010-03-08T14:04:00.082-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-08T14:04:00.082-05:00</app:edited><title>Creating/Submitting a Patch to a Subversion Repo</title><content type="html">&lt;p&gt;I’ve been told that these programming posts are not interesting or funny. For those that have no interest in programming, I offer the following jokes:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;“I don't think I could stab somebody, cause I'm really bad at a Capri Sun.”&lt;/p&gt;    &lt;p&gt;“I hope God speaks English. If I get up to heaven and have to point at a menu, I'm gonna be pissed.”&lt;/p&gt;    &lt;p&gt;“I hope we find a cure for every major disease, because I'm tired of walking 5K. I'm pretty sure I don't have to sweat for cancer. I'll write a check.” &lt;/p&gt;    &lt;p&gt;–&lt;a href="http://www.danieltosh.com/"&gt;Daniel Tosh&lt;/a&gt; (&lt;a href="http://en.wikiquote.org/wiki/Daniel_Tosh"&gt;via&lt;/a&gt;)&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Now would be a good time for you to stop reading.&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;I use Subversion as my primary version control system. It’s awesome. I have a few users that have read-only rights to this repo and only occasionally make changes themselves. In these cases, I can’t provide commit rights to the repo so what are we to do? Patches.&lt;/p&gt;  &lt;p&gt;A patch is basically a change set wrapped up into a single tidy file. The patch can be created by one dev and sent to another to be applied to the VCS. SVN, like most VCSs has very good support for patches. This post describes how to create one.&lt;/p&gt;  &lt;p&gt;First, you should update your working directory if possible with “SVN Update”:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_IKD9WtY5kxU/S5VEGnQ7XSI/AAAAAAAAAqo/Qxqm-DKt618/image%5B2%5D.png?imgmax=800" width="449" height="294" /&gt; &lt;/p&gt;  &lt;p&gt;Normally you would go to the Commit screen to apply your changes. Since you don’t have commit access, this won’t work, so instead right-click and go to “TortoiseSVN” &amp;gt; “Create Patch”:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_IKD9WtY5kxU/S5VEHOyv1rI/AAAAAAAAAqs/VoaH7wbAaiU/image%5B5%5D.png?imgmax=800" width="519" height="290" /&gt; &lt;/p&gt;  &lt;p&gt;A dialog will show you all the changes it has detected; you can double click each file to diff it. Choose the changes you want included in the patch and click “OK”:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_IKD9WtY5kxU/S5VEHTa2UbI/AAAAAAAAAqw/viJ1aMvMLhY/image%5B8%5D.png?imgmax=800" width="417" height="392" /&gt; &lt;/p&gt;  &lt;p&gt;Save the patch somewhere handy:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_IKD9WtY5kxU/S5VEHxUPigI/AAAAAAAAAq0/YcyAkQJVNUs/image%5B11%5D.png?imgmax=800" width="571" height="469" /&gt; &lt;/p&gt;  &lt;p&gt;Send the patch file off to your committer and you’re done! Go ahead and open it up in a text editor if you want to see how these work. It’s basically a snippet of each of the pieces of code you changed, all bundled up into a nice text file.&lt;/p&gt;  &lt;h3&gt;Applying a Patch to a Subversion Repo&lt;/h3&gt;  &lt;p&gt;Of course the process of applying patches is simple, too. Right-click on the patch file and choose “TortoiseSVN” &amp;gt; “Apply Patch”:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh6.ggpht.com/_IKD9WtY5kxU/S5VEIGxMayI/AAAAAAAAAq4/yPmm9gP1Dog/image%5B14%5D.png?imgmax=800" width="458" height="402" /&gt; &lt;/p&gt;  &lt;p&gt;Choose the SVN working directory to which the patch should be applied:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_IKD9WtY5kxU/S5VEIw2q5mI/AAAAAAAAAq8/3hLIJoBetJU/image%5B17%5D.png?imgmax=800" width="719" height="599" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;You’ll see a list of the patched files and have the opportunity to review each change:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_IKD9WtY5kxU/S5VEJGTKozI/AAAAAAAAArA/_PepYur6bNo/image%5B20%5D.png?imgmax=800" width="216" height="183" /&gt; &lt;/p&gt;  &lt;p&gt;Then right click to apply some or all of the changes into the working directory you chose.&lt;/p&gt;  &lt;p&gt;The patch has now been applied to your working directory—now would be a good time to commit it via normal means (right-click &amp;gt;&amp;#160; “SVN Commit”):&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_IKD9WtY5kxU/S5VEJWXojiI/AAAAAAAAArE/O5rHVH7IOos/image%5B23%5D.png?imgmax=800" width="320" height="278" /&gt; &lt;/p&gt;  &lt;p&gt;It might seem a little complicated at first, but after you do it once or twice it’ll click as a convenient and effective way to share change sets.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7767624464875146298-3295725829814248273?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/3295725829814248273/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=3295725829814248273" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/3295725829814248273?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/3295725829814248273?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2010/03/creatingsubmitting-patch-to-subversion.html" title="Creating/Submitting a Patch to a Subversion Repo" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry gd:etag="W/&quot;CkIFRnY8eyp7ImA9WxBUGE4.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-8942524026891437938</id><published>2010-03-05T18:08:00.001-05:00</published><updated>2010-03-05T18:08:37.873-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-05T18:08:37.873-05:00</app:edited><title>Active Directory Look-Up</title><content type="html">&lt;p&gt;I’ve been told that these programming posts are not interesting or funny. For those that have no interest in programming, I offer the following joke:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;“I was gonna get a candy bar; the button I was supposed to push was ‘HH’, so I went to the side, I found the ‘H’ button, I pushed it twice. F’in...potato chips came out, man, because they had an ‘HH’ button for Christ's sake! You need to let me know. I'm not familiar with the concept of ‘HH’. I did not learn my AA-BB-CC's. God god, dammit dammit” –&lt;a href="http://www.mitchhedberg.net/"&gt;Mitch Hedberg&lt;/a&gt; (&lt;a href="http://en.wikiquote.org/wiki/Mitch_Hedberg"&gt;via&lt;/a&gt;)&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Now would be a good time for you to stop reading.&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;I’ve been working on an app that’s defers authentication to the company’s Active Directory. Rather than ask user’s to fill in profile info like a display name, I decided to pull this info out of the directory.&lt;/p&gt;  &lt;p&gt;This turned out to be ridiculously easy after adding a reference to &lt;code&gt;System.DirectoryServices.AccountManagement to the project&lt;/code&gt;:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; (var PC = &lt;span class="kwrd"&gt;new&lt;/span&gt; PrincipalContext(ContextType.Domain))
{
    var UserPrincipal = Principal.FindByIdentity(PC, userName);
}&lt;/pre&gt;

&lt;p&gt;In this case, we’re passing along the user’s NT name, including the domain to help make it unique (e.g. “domain\user”) and getting back an object of type &lt;a href="http://msdn.microsoft.com/en-us/library/system.directoryservices.accountmanagement.principal(v=VS.90).aspx"&gt;System.DirectoryServices.AccountManagement.Principal&lt;/a&gt;, which has some &lt;a href="http://msdn.microsoft.com/en-us/library/system.directoryservices.accountmanagement.principal_members(v=VS.90).aspx"&gt;nice properties&lt;/a&gt; like &lt;code&gt;DisplayName&lt;/code&gt; and &lt;code&gt;Sid&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Since I’m running this app as a domain user, I don’t even have to configure the directory connection (which is nice, because that part’s a pain).&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;OK so I have the user’s name, but I’m rarely a fan of duplicating data. But I need a &lt;em&gt;local &lt;/em&gt;copy of the user’s name to keep things nice and speedy (plus hitting the domain for a person’s name all the time is a little silly, too). &lt;/p&gt;

&lt;p&gt;My compromise is that I update my local copy with the directory’s profile data each time the user logs in. I’m already hitting the domain to authenticate the user any way so it’s not any extra work. This should take care of the rare situation that someone’s name or profile info changes without requiring anyone to do anything.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7767624464875146298-8942524026891437938?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/8942524026891437938/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=8942524026891437938" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/8942524026891437938?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/8942524026891437938?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2010/03/active-directory-look-up.html" title="Active Directory Look-Up" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry gd:etag="W/&quot;AkQCRXY8eSp7ImA9WxBUGE0.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-1962699667511968541</id><published>2010-03-05T11:59:00.001-05:00</published><updated>2010-03-05T11:59:24.871-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-05T11:59:24.871-05:00</app:edited><title>HTML/JS: Progressive Enhancement</title><content type="html">&lt;p&gt;The great thing about a semantic approach to web development is how nice and easy it can be to make progressive enhancements.&lt;/p&gt;  &lt;p&gt;For example, suppose I have a “what’s this” help link beside some potentially confusing statement:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_IKD9WtY5kxU/S5E4apdc-xI/AAAAAAAAAqg/P7sivkWjM7M/image%5B11%5D.png?imgmax=800" width="771" height="538" /&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Nothing fancy here—just a link with a _blank target (&lt;a href="http://jsbin.com/unuqo/3/edit"&gt;source&lt;/a&gt;, &lt;a href="http://jsbin.com/unuqo/3"&gt;demo&lt;/a&gt;):&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;p&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Hello World 
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;a&lt;/span&gt; &lt;span class="attr"&gt;href&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;/help/tips&amp;quot;&lt;/span&gt;
     &lt;span class="attr"&gt;target&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;_blank&amp;quot;&lt;/span&gt; 
     &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;Hello World Help&amp;quot;&lt;/span&gt;
     &lt;span class="attr"&gt;class&lt;/span&gt;&lt;span class="kwrd"&gt;=&amp;quot;help-link&amp;quot;&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;(what's this?)&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;a&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;p&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;It’s not very pretty but it gets the job done without any Javascript. Let’s make it sexy:&lt;/p&gt;

&lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_IKD9WtY5kxU/S5E4bK5JP8I/AAAAAAAAAqk/zV6hHkZYPOE/image%5B8%5D.png?imgmax=800" width="771" height="538" /&gt; &lt;/p&gt;

&lt;p&gt;Here we’ve augmented the help link with a nice &lt;a href="http://jqueryui.com/home"&gt;jQuery UI&lt;/a&gt; &lt;a href="http://jqueryui.com/demos/dialog/"&gt;dialog&lt;/a&gt; instead of a browser popup (&lt;a href="http://jsbin.com/unuqo/4/edit"&gt;source&lt;/a&gt;, &lt;a href="http://jsbin.com/unuqo/4"&gt;demo&lt;/a&gt;):&lt;/p&gt;

&lt;pre class="csharpcode"&gt;$(&lt;span class="kwrd"&gt;function&lt;/span&gt;(){
  
  $(&lt;span class="str"&gt;'.help-link'&lt;/span&gt;).click(&lt;span class="kwrd"&gt;function&lt;/span&gt;(){
    
    $(&lt;span class="str"&gt;'&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;'&lt;/span&gt;)
      .attr(&lt;span class="str"&gt;'title'&lt;/span&gt;, &lt;span class="kwrd"&gt;this&lt;/span&gt;.title)
      .load(&lt;span class="kwrd"&gt;this&lt;/span&gt;.href)
      .dialog({
        modal: &lt;span class="kwrd"&gt;true&lt;/span&gt;,
        buttons: {
          Ok: &lt;span class="kwrd"&gt;function&lt;/span&gt; () {
            $(&lt;span class="kwrd"&gt;this&lt;/span&gt;).dialog(&lt;span class="str"&gt;'close'&lt;/span&gt;);
          }
        },
        width: 600,
        height: 350    
      });
    
    &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;false&lt;/span&gt;;
  });
  
});​&lt;/pre&gt;

&lt;p&gt;This doesn’t require any changes to the HTML/CSS—it uses existing attributes like &lt;code&gt;href&lt;/code&gt; and &lt;code&gt;title&lt;/code&gt; to wire itself up to the link. And, if JS is disabled or broken, &lt;em&gt;the link will still work&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;By applying incremental enhancements in this fashion, we can easily maintain decent support for less-capable browsers while keeping our code clean and elegant.&lt;/p&gt;

&lt;p&gt;You might notice, too, that this JS snippet is looking at a class (&lt;code&gt;help-link&lt;/code&gt;), not an &lt;code&gt;id&lt;/code&gt;. Since it infers everything it needs to show the dialog from the link itself, this snippet will work on &lt;strong&gt;any&lt;/strong&gt; link in the page tagged with the &lt;code&gt;help-link&lt;/code&gt; class. Nice, right?&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7767624464875146298-1962699667511968541?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/1962699667511968541/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=1962699667511968541" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/1962699667511968541?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/1962699667511968541?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2010/03/htmljs-progressive-enhancement.html" title="HTML/JS: Progressive Enhancement" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry gd:etag="W/&quot;CEcFSHY9cSp7ImA9WxBUF0s.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-5988567194595023898</id><published>2010-03-04T23:06:00.001-05:00</published><updated>2010-03-04T23:06:59.869-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-04T23:06:59.869-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Technology" /><title>Generating Super Shiny, Hopefully Secure Tokens</title><content type="html">&lt;p&gt;I’ve been told that these programming posts are not interesting or funny. For those that have no interest in programming, I offer the following joke:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;“My friend had a burrito. The next day he said, ‘That burrito did not agree with me.’ I was like, ‘Was the disagreement over whether or not you’d have diarrhea? Let me guess who won.’” –&lt;a href="http://www.demetrimartin.com/"&gt;Demetri Martin&lt;/a&gt; (&lt;a href="http://captainpinhead.wordpress.com/2006/10/01/demetri-martin-quotes/"&gt;via&lt;/a&gt;)&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Now would be a good time for you to stop reading.&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;I was working on a little security related code today which required the generation of unique and random tokens. I’m always nervous working with crypto because it’s so easy to fail. &lt;/p&gt;  &lt;p&gt;But here I am, ready to fail.&lt;/p&gt;  &lt;p&gt;So like I said, I need to create a bunch of tokens—blocks of text or numbers. They can’t be easily guessed and need to be unique. Let’s see if I can’t screw this up.&lt;/p&gt;  &lt;pre class="csharpcode"&gt;        &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
        &lt;span class="rem"&gt;/// Generate a decently long string o random characters, suitable for tokens&lt;/span&gt;
        &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
        &lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;a string of gobbledygook&amp;lt;/returns&amp;gt;&lt;/span&gt;
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; GenerateKey()
        {
            var RandomBytes = &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;byte&lt;/span&gt;[
                6 * 10 &lt;span class="rem"&gt;// use a multiple of 6 to get a full base64 output &lt;a href="http://en.wikipedia.org/wiki/Base64"&gt;http://en.wikipedia.org/wiki/Base64&lt;/span&gt;
&lt;/a&gt;                - 16 &lt;span class="rem"&gt;// compensate for the 16-byte guid we're going to add in &lt;/span&gt;
                ];

            &lt;span class="rem"&gt;// fill the buffer with garbage (this is threadsafe)&lt;/span&gt;
            BetterRandom.GetBytes(RandomBytes);

            &lt;span class="rem"&gt;// get a guid, which will be unique enough for us&lt;/span&gt;
            var UniqueBytes = Guid.NewGuid().ToByteArray();

            &lt;span class="rem"&gt;// encode the garbage as friendly, printable characters&lt;/span&gt;
            var AllBytes = &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;byte&lt;/span&gt;[RandomBytes.Length + UniqueBytes.Length];
            UniqueBytes.CopyTo(AllBytes, 0);
            RandomBytes.CopyTo(AllBytes, UniqueBytes.Length);

            &lt;span class="kwrd"&gt;return&lt;/span&gt; Convert.ToBase64String(AllBytes);
        }
        &lt;span class="kwrd"&gt;static&lt;/span&gt; RandomNumberGenerator BetterRandom = &lt;span class="kwrd"&gt;new&lt;/span&gt; RNGCryptoServiceProvider();&lt;/pre&gt;

&lt;p&gt;Basically I take two components—a 16-bit &lt;a href="http://en.wikipedia.org/wiki/Globally_Unique_Identifier"&gt;GUID&lt;/a&gt;, and a 44-byte chunk of random bits. The GUID would &lt;a href="http://blogs.msdn.com/oldnewthing/archive/2008/06/27/8659071.aspx"&gt;normally be enough&lt;/a&gt; to satisfy me as they are pretty much unique (and the Win32 algorithm might even guarantee them to be unique when considering a single machine) &lt;em&gt;but&lt;/em&gt;, I was afraid they might be predictable as they &lt;a href="http://blogs.msdn.com/oldnewthing/archive/2008/06/27/8659071.aspx"&gt;aren’t actually all that random&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;How’d I come up with 44 bytes (352 bits)? It looks nice. I guessed a few numbers until I got the encoded output to be of reasonable size. Which brings me to the Base64 conversion. This just takes the binary blob of bits and turns them into simple, printable characters so I can pass them around in URLs.&lt;/p&gt;

&lt;p&gt;If you’re know of any weaknesses with this approach, please share! Something like this will eventually guard something about as valuable as a garden gnome, so I’m not too worried about it yet. It’s certainly more secure than the simple passwords most of &lt;em&gt;us&lt;/em&gt; use.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7767624464875146298-5988567194595023898?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/5988567194595023898/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=5988567194595023898" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/5988567194595023898?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/5988567194595023898?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2010/03/generating-super-shiny-hopefully-secure.html" title="Generating Super Shiny, Hopefully Secure Tokens" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry gd:etag="W/&quot;CUIFSH4zfCp7ImA9WxBUF04.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-374034373883976650</id><published>2010-03-04T15:11:00.001-05:00</published><updated>2010-03-04T15:11:59.084-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-04T15:11:59.084-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Technology" /><title>Class Inheritance Throw Back</title><content type="html">&lt;p&gt;Another question I answered recently took me way back to my college classes on programming language theory. In those classes we studied the internals of languages in greater detail than I’d care to remember. We also build a &lt;a href="http://en.wikipedia.org/wiki/Scheme_(programming_language)"&gt;Scheme&lt;/a&gt; scanner, parser, printer, too, which was fun.&lt;/p&gt;  &lt;p&gt;Anyway, the question today was: given a base class “Animal” and a derived class “Dog”, in what order are the constructors and destructors called when the child class is instantiated and destroyed?&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/_IKD9WtY5kxU/S5AUDhDvoOI/AAAAAAAAAqc/ja1HAcLRQM8/image%5B2%5D.png?imgmax=800" width="73" height="148" /&gt; &lt;/p&gt;  &lt;p&gt;I haven’t touched C++ for a long time but after thinking about it for a few seconds, this is what would make sense to me:&lt;/p&gt;  &lt;p&gt;new Dog(): &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Animal()&lt;/li&gt;    &lt;li&gt;Dog()&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;delete Dog():&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Dog()&lt;/li&gt;    &lt;li&gt;Animal()&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;The constructor part is the &lt;a href="http://www.yoda.arachsys.com/csharp/constructors.html"&gt;same in C#&lt;/a&gt; (my current language of choice) so that was obvious, but we don’t really have destructors in C# (we have IDisposable) so i had to think about that logically a bit. &lt;/p&gt;  &lt;p&gt;The gist is: &lt;strong&gt;constructors are executed top down, and destructors are executed bottom up&lt;/strong&gt;. I like digging into the details and the nuances of these things…&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7767624464875146298-374034373883976650?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/374034373883976650/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=374034373883976650" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/374034373883976650?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/374034373883976650?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2010/03/class-inheritance-throw-back.html" title="Class Inheritance Throw Back" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry gd:etag="W/&quot;AkcARH44fSp7ImA9WxBUF0g.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-9146268454194304250</id><published>2010-03-04T14:23:00.001-05:00</published><updated>2010-03-04T22:00:45.035-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-04T22:00:45.035-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Technology" /><title>Algorithms Throw Back</title><content type="html">&lt;p&gt;I was given a question today that really took me back. Here’s a hint: it had to do with &lt;a href="http://en.wikipedia.org/wiki/Binary_search_tree"&gt;binary search trees&lt;/a&gt;, data structures, and pretty printing.&lt;/p&gt;  &lt;p&gt;I haven’t touched a BST in six years so it took some priming to get me going.&lt;/p&gt;  &lt;p align="center"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh4.ggpht.com/_IKD9WtY5kxU/S5AIumzhfCI/AAAAAAAAAqY/IBHalH7hDGs/image%5B2%5D.png?imgmax=800" width="187" height="134" /&gt;(&lt;a href="http://people.ksp.sk/~kuko/bak/index.html"&gt;BST builder&lt;/a&gt;)&lt;/p&gt;  &lt;p&gt;The task was to print this tree level by level. So the output should be 3, 1, 6, 2, 5, 7, 4. If you’re a programmer, I encourage you to solve this problem as an exercise before looking at my solution. It was humbling for me.&lt;/p&gt;  &lt;p&gt;After wasting a half hour messing around with recursion, I was given a pretty nice hint to do it iteratively with a queue. &lt;/p&gt;  &lt;p&gt;I still failed miserably with my good old paper and pencil, but afterwards set out to do it in a more comfortable environment (C#).&lt;/p&gt;  &lt;p&gt;Here’s my basic node class (structs are for sissys):&lt;/p&gt;  &lt;pre class="csharpcode"&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Node
    {
        &lt;span class="kwrd"&gt;public&lt;/span&gt; Node(&lt;span class="kwrd"&gt;int&lt;/span&gt; &lt;span class="kwrd"&gt;value&lt;/span&gt;, Node left = &lt;span class="kwrd"&gt;null&lt;/span&gt;, Node right = &lt;span class="kwrd"&gt;null&lt;/span&gt;)
        {
            Value = &lt;span class="kwrd"&gt;value&lt;/span&gt;; Left = left; Right = right;
        }
        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Value { get; set; }
        &lt;span class="kwrd"&gt;public&lt;/span&gt; Node Left { get; set; }
        &lt;span class="kwrd"&gt;public&lt;/span&gt; Node Right { get; set; }
    }&lt;/pre&gt;

&lt;p&gt;And my main program:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;    &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Main(&lt;span class="kwrd"&gt;string&lt;/span&gt;[] args)
    {
        Node n = &lt;span class="kwrd"&gt;new&lt;/span&gt; Node(3);
        n.Left = &lt;span class="kwrd"&gt;new&lt;/span&gt; Node(1, &lt;span class="kwrd"&gt;null&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; Node(2));
        n.Right = &lt;span class="kwrd"&gt;new&lt;/span&gt; Node(6, &lt;span class="kwrd"&gt;new&lt;/span&gt; Node(5, &lt;span class="kwrd"&gt;new&lt;/span&gt; Node(4)), &lt;span class="kwrd"&gt;new&lt;/span&gt; Node(7));

        PrettyPrintByLevel(n);
        Console.ReadKey();
    }&lt;/pre&gt;

&lt;p&gt;And the magic:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;    &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; PrettyPrintByLevel(Node n)
    {
        Queue&amp;lt;Node&amp;gt; Nodes = &lt;span class="kwrd"&gt;new&lt;/span&gt; Queue&amp;lt;Node&amp;gt;();
        Nodes.Enqueue(n);

        &lt;span class="kwrd"&gt;do&lt;/span&gt;
        {
            Node QNode = Nodes.Dequeue();
            Console.WriteLine(QNode.Value);

            &lt;span class="kwrd"&gt;if&lt;/span&gt; (QNode.Left != &lt;span class="kwrd"&gt;null&lt;/span&gt;) Nodes.Enqueue(QNode.Left);
            &lt;span class="kwrd"&gt;if&lt;/span&gt; (QNode.Right != &lt;span class="kwrd"&gt;null&lt;/span&gt;) Nodes.Enqueue(QNode.Right);

        } &lt;span class="kwrd"&gt;while&lt;/span&gt; (Nodes.Count &amp;gt; 0);
    }&lt;/pre&gt;

&lt;p&gt;A quick test reveals that it works:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;pre class="csharpcode"&gt;3 1 6 2 5 7 4&lt;/pre&gt;
&lt;/blockquote&gt;
Yay! So what did I learn today? I’m rusty on the basics and need to do some more &lt;a href="http://projecteuler.net/"&gt;Project Euler problems&lt;/a&gt;. 

&lt;p&gt;I’ve taken this opportunity to brush up on some Java. Here’s the same app in the similar, but different Java:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; main(String[] args) {
        &lt;span class="rem"&gt;// build up a tree&lt;/span&gt;
        Node n = &lt;span class="kwrd"&gt;new&lt;/span&gt; Node(3, &lt;span class="kwrd"&gt;null&lt;/span&gt;, &lt;span class="kwrd"&gt;null&lt;/span&gt;);
        n.Left = &lt;span class="kwrd"&gt;new&lt;/span&gt; Node(1, &lt;span class="kwrd"&gt;null&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; Node(2, &lt;span class="kwrd"&gt;null&lt;/span&gt;, &lt;span class="kwrd"&gt;null&lt;/span&gt;));
        n.Right = &lt;span class="kwrd"&gt;new&lt;/span&gt; Node(6, &lt;span class="kwrd"&gt;new&lt;/span&gt; Node(5, &lt;span class="kwrd"&gt;new&lt;/span&gt; Node(4, &lt;span class="kwrd"&gt;null&lt;/span&gt;, &lt;span class="kwrd"&gt;null&lt;/span&gt;), &lt;span class="kwrd"&gt;null&lt;/span&gt;), &lt;span class="kwrd"&gt;new&lt;/span&gt; Node(7, &lt;span class="kwrd"&gt;null&lt;/span&gt;, &lt;span class="kwrd"&gt;null&lt;/span&gt;));

        &lt;span class="rem"&gt;// print out the tree to the console&lt;/span&gt;
        PrettyPrintByLevel(n);
    }

    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; PrettyPrintByLevel(Node n) {
        Queue&amp;lt;Node&amp;gt; Nodes = &lt;span class="kwrd"&gt;new&lt;/span&gt; LinkedList&amp;lt;Node&amp;gt;();
        Nodes.add(n);

        &lt;span class="kwrd"&gt;do&lt;/span&gt;
        {
            Node QNode = Nodes.remove();
            System.&lt;span class="kwrd"&gt;out&lt;/span&gt;.println(QNode.Value);

            &lt;span class="kwrd"&gt;if&lt;/span&gt; (QNode.Left != &lt;span class="kwrd"&gt;null&lt;/span&gt;) Nodes.add(QNode.Left);
            &lt;span class="kwrd"&gt;if&lt;/span&gt; (QNode.Right != &lt;span class="kwrd"&gt;null&lt;/span&gt;) Nodes.add(QNode.Right);

        } &lt;span class="kwrd"&gt;while&lt;/span&gt; (Nodes.peek() != &lt;span class="kwrd"&gt;null&lt;/span&gt;);        
        &lt;span class="rem"&gt;// process the queue until it's empty&lt;/span&gt;
        &lt;span class="rem"&gt;// peeking for a null element is certainly faster (or as fast) as&lt;/span&gt;
        &lt;span class="rem"&gt;// calling for the list's length over and over again&lt;/span&gt;
    }&lt;/pre&gt;

&lt;p&gt;It’s pretty much the same thing.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7767624464875146298-9146268454194304250?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/9146268454194304250/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=9146268454194304250" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/9146268454194304250?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/9146268454194304250?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2010/03/algorithms-throw-back.html" title="Algorithms Throw Back" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total></entry><entry gd:etag="W/&quot;DUECQnY4cSp7ImA9WxBUFUU.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-5386675230827585005</id><published>2010-03-02T22:41:00.001-05:00</published><updated>2010-03-02T22:41:03.839-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-02T22:41:03.839-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Technology" /><category scheme="http://www.blogger.com/atom/ns#" term="Work" /><title>Word Document Automation with .NET 4: New Doc From Template</title><content type="html">&lt;p&gt;With all the Word automation stuff I’ve been working through, it was nice to find something easy today. I wanted to create a base template and use it to start my docs from. So I created the template in Word as usual and saved it as a .dotx. &lt;/p&gt;  &lt;p&gt;Then, to start new docs from this, just include it in the &lt;code&gt;.Add()&lt;/code&gt; call:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;WordApp = &lt;span class="kwrd"&gt;new&lt;/span&gt; Application();

&lt;span class="rem"&gt;// open the template as a new doc&lt;/span&gt;
var Doc = WordApp.Documents.Add(&lt;strong&gt;PathToTemplateFile&lt;/strong&gt;);&lt;/pre&gt;

&lt;p&gt;Easy does it.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7767624464875146298-5386675230827585005?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/5386675230827585005/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=5386675230827585005" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/5386675230827585005?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/5386675230827585005?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2010/03/word-document-automation-with-net-4-new.html" title="Word Document Automation with .NET 4: New Doc From Template" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry gd:etag="W/&quot;Dk4CR384fyp7ImA9WxBUFUg.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-6238270940120043354</id><published>2010-03-02T13:36:00.001-05:00</published><updated>2010-03-02T13:36:06.137-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-02T13:36:06.137-05:00</app:edited><title>Leave SQL Server’s Cost Threshold for Parallelism Alone</title><content type="html">&lt;p&gt;I’ve been told that these programming posts are not interesting or funny. For those that have no interest in programming, I offer the following joke:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;“I like fruit baskets because it gives you the ability to mail someone a piece of fruit without appearing insane. Like, if someone just mailed you an apple you’d be like ‘Huh? What the hell is this?’, but if it’s in a fruit basket you’re like ‘This is &lt;em&gt;nice!&lt;/em&gt;.’” –&lt;a href="http://www.demetrimartin.com/"&gt;Demetri Martin&lt;/a&gt; (&lt;a href="http://captainpinhead.wordpress.com/2006/10/01/demetri-martin-quotes/"&gt;via&lt;/a&gt;)&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Now would be a good time for you to stop reading.&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;&lt;a href="http://www.urbandictionary.com/define.php?term=sad+panda"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" border="0" align="right" src="https://www.7chan.org/a/src/125981194793.png" width="120" height="120" /&gt;&lt;/a&gt;A while back I was performance-testing a new SQL Server cluster. This machine was years-better than the system it was replacing and the perf-test was showing it. Everything I threw at it was flying—this thing was screaming fast.&lt;/p&gt;  &lt;p&gt;Then we started load testing. This was basically an integration test where we turned on everything at once and &lt;a href="http://en.wikipedia.org/wiki/Up_to_eleven"&gt;cranked it to 11&lt;/a&gt;. Only we didn’t get to 11 because our server fell over at 2, making me a sad panda. The server started throwing strange and never-before-seen (by me) errors about problems with memory, threads, timeouts, etc. It looked like this:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh6.ggpht.com/_IKD9WtY5kxU/S41akiwiScI/AAAAAAAAAqQ/ylYDSDFbNOk/image%5B5%5D.png?imgmax=800" width="555" height="322" /&gt; &lt;/p&gt;  &lt;p&gt;We had barely loaded the machine with concurrency and it was freaking out. It’d run in spurts of blazing glory, then fail to a grinding halt. After a lot of personal freaking out (we had a very, very tight schedule measured in minutes), I discovered the culprit: parallelism. &lt;/p&gt;  &lt;p&gt;Normally you would think parallelism would be a good thing—many cores make light work (this machine had 16!). Unfortunately that’s just not so in all cases. &lt;strong&gt;The overhead to split a query into parallel chunks, execute the chunks, and join the results together is significant.&lt;/strong&gt; It turns out it’s extremely significant for simple queries and increases the complexity/load required to execute them dramatically.&lt;/p&gt;  &lt;p&gt;Fortunately, SQL Server knows all this and has a setting for it:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_IKD9WtY5kxU/S41ak0AmyjI/AAAAAAAAAqU/m82FXuofc_4/image%5B2%5D.png?imgmax=800" width="498" height="381" /&gt; &lt;/p&gt;  &lt;p&gt;The &lt;a href="http://msdn.microsoft.com/en-us/library/aa196716(SQL.80).aspx"&gt;cost threshold for parallelism&lt;/a&gt;. This value is in seconds. When SQL Server estimates a query will take longer than x seconds to be executed, the query is executed in &lt;em&gt;parallel&lt;/em&gt;; otherwise &lt;em&gt;serial&lt;/em&gt;.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Do not set this to a very low value like my DBA apparently did. &lt;/strong&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7767624464875146298-6238270940120043354?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/6238270940120043354/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=6238270940120043354" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/6238270940120043354?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/6238270940120043354?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2010/03/leave-sql-servers-cost-threshold-for.html" title="Leave SQL Server’s Cost Threshold for Parallelism Alone" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry gd:etag="W/&quot;DEAARnkycCp7ImA9WxBUFEU.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-5937417014952307036</id><published>2010-03-01T18:39:00.001-05:00</published><updated>2010-03-01T18:39:07.798-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-01T18:39:07.798-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Household" /><category scheme="http://www.blogger.com/atom/ns#" term="Random Updates" /><category scheme="http://www.blogger.com/atom/ns#" term="Family" /><category scheme="http://www.blogger.com/atom/ns#" term="Baby" /><category scheme="http://www.blogger.com/atom/ns#" term="Ruminations" /><title>Ruminations: Multiple Births; Congratulations</title><content type="html">&lt;p&gt;I am afraid if I ever have twins or triplets that I would try to carry too many at one time and drop one, both, all, etc. Oops!&lt;/p&gt;  &lt;p&gt;And that's my segway into my congratulations to B+T on their new double-dose of parenthood. Here's a list of things to keep you occupied during your downtime (infants are boring):&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;N/A &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;...you won't be having any of that. Sorry. Now let's &lt;a href="http://xkcd.com/605/"&gt;extrapolate your family&lt;/a&gt;:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://xkcd.com/605/"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="By the third trimester, there will be hundreds of babies inside you." border="0" alt="Extrapolating" src="http://imgs.xkcd.com/comics/extrapolating.png" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;At this rate (if my calculations are correct), the trend is slightly alarming:&lt;/p&gt; &lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_IKD9WtY5kxU/S4xQGbdlZpI/AAAAAAAAAqI/ufiv0Fivwmg/image%5B14%5D.png?imgmax=800" width="556" height="376" /&gt;   &lt;p&gt;Of course the total number of kids you have will be a bit more dramatic:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_IKD9WtY5kxU/S4xQGo6cmhI/AAAAAAAAAqM/9hFLILSxPQ8/image%5B17%5D.png?imgmax=800" width="555" height="376" /&gt; &lt;/p&gt;  &lt;p&gt;The only thing I can conclude from this is that you might want to refocus your house-hunting for something in the country. With lots of room.&lt;/p&gt;  &lt;p&gt;In any case, best of luck to you and enjoy these first few weeks as a family of five! Let me know if I can help in any way (I just might).&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7767624464875146298-5937417014952307036?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/5937417014952307036/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=5937417014952307036" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/5937417014952307036?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/5937417014952307036?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2010/03/ruminations-multiple-births.html" title="Ruminations: Multiple Births; Congratulations" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry gd:etag="W/&quot;AkcNQHY_eip7ImA9WxBUFEo.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-8463590731751041338</id><published>2010-03-01T16:11:00.001-05:00</published><updated>2010-03-01T16:14:51.842-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-01T16:14:51.842-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Technology" /><category scheme="http://www.blogger.com/atom/ns#" term="Work" /><title>Moving List Items Between Lists</title><content type="html">&lt;p&gt;I often apply a push-pull pattern when working with business/data interfaces. I’m talking about something like this:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh6.ggpht.com/_IKD9WtY5kxU/S4wtlTgEbmI/AAAAAAAAAqA/l-oZQN3uEPo/image%5B2%5D.png?imgmax=800" width="249" height="126" /&gt; &lt;/p&gt;  &lt;p&gt;I don’t much like these so I came up with something similar that works well for small datasets which I’ll describe here. Here it is &lt;a href="http://jsbin.com/ucoqi"&gt;in action&lt;/a&gt;:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://jsbin.com/ucoqi"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_IKD9WtY5kxU/S4wtlm3CkyI/AAAAAAAAAqE/yzg-EgTglBs/image%5B6%5D.png?imgmax=800" width="197" height="105" /&gt;&lt;/a&gt; and here’s how to &lt;a href="http://jsbin.com/ucoqi/edit"&gt;build it&lt;/a&gt;. First, the basic layout:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;body&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ul&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;='list1'&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;li&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Item 1 &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;img&lt;/span&gt; &lt;span class="attr"&gt;class&lt;/span&gt;&lt;span class="kwrd"&gt;='icon move'&lt;/span&gt; &lt;span class="attr"&gt;src&lt;/span&gt;&lt;span class="kwrd"&gt;='blank.png'&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;li&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;li&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Item 2 &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;img&lt;/span&gt; &lt;span class="attr"&gt;class&lt;/span&gt;&lt;span class="kwrd"&gt;='icon move'&lt;/span&gt; &lt;span class="attr"&gt;src&lt;/span&gt;&lt;span class="kwrd"&gt;='blank.png'&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;li&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;li&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Item 3 &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;img&lt;/span&gt; &lt;span class="attr"&gt;class&lt;/span&gt;&lt;span class="kwrd"&gt;='icon move'&lt;/span&gt; &lt;span class="attr"&gt;src&lt;/span&gt;&lt;span class="kwrd"&gt;='blank.png'&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;li&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;li&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Item 4 &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;img&lt;/span&gt; &lt;span class="attr"&gt;class&lt;/span&gt;&lt;span class="kwrd"&gt;='icon move'&lt;/span&gt; &lt;span class="attr"&gt;src&lt;/span&gt;&lt;span class="kwrd"&gt;='blank.png'&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;li&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ul&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ul&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;='list2'&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;li&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Item 5 &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;img&lt;/span&gt; &lt;span class="attr"&gt;class&lt;/span&gt;&lt;span class="kwrd"&gt;='icon move'&lt;/span&gt; &lt;span class="attr"&gt;src&lt;/span&gt;&lt;span class="kwrd"&gt;='blank.png'&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;li&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;li&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Item 6 &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;img&lt;/span&gt; &lt;span class="attr"&gt;class&lt;/span&gt;&lt;span class="kwrd"&gt;='icon move'&lt;/span&gt; &lt;span class="attr"&gt;src&lt;/span&gt;&lt;span class="kwrd"&gt;='blank.png'&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;li&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;li&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Item 7 &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;img&lt;/span&gt; &lt;span class="attr"&gt;class&lt;/span&gt;&lt;span class="kwrd"&gt;='icon move'&lt;/span&gt; &lt;span class="attr"&gt;src&lt;/span&gt;&lt;span class="kwrd"&gt;='blank.png'&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;li&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;li&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Item 8 &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;img&lt;/span&gt; &lt;span class="attr"&gt;class&lt;/span&gt;&lt;span class="kwrd"&gt;='icon move'&lt;/span&gt; &lt;span class="attr"&gt;src&lt;/span&gt;&lt;span class="kwrd"&gt;='blank.png'&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;li&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ul&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;body&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;html&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;​&lt;/pre&gt;

&lt;p&gt;What I want to do is have each &lt;code&gt;li&lt;/code&gt; hop to the opposing list when its move button is clicked. It’s very simple with jQuery’s live event binding (&lt;a href="http://jsbin.com/ucoqi/1"&gt;demo&lt;/a&gt;, &lt;a href="http://jsbin.com/ucoqi/1/edit"&gt;source&lt;/a&gt;):&lt;/p&gt;

&lt;pre class="csharpcode"&gt;  $(&lt;span class="kwrd"&gt;function&lt;/span&gt;(){
    $(&lt;span class="str"&gt;'ul#list1 .move'&lt;/span&gt;).live(&lt;span class="str"&gt;'click'&lt;/span&gt;, &lt;span class="kwrd"&gt;function&lt;/span&gt;(){
      $(&lt;span class="kwrd"&gt;this&lt;/span&gt;).closest(&lt;span class="str"&gt;'li'&lt;/span&gt;).appendTo(&lt;span class="str"&gt;'ul#list2'&lt;/span&gt;);
    });
    
    $(&lt;span class="str"&gt;'ul#list2 .move'&lt;/span&gt;).live(&lt;span class="str"&gt;'click'&lt;/span&gt;, &lt;span class="kwrd"&gt;function&lt;/span&gt;(){
      $(&lt;span class="kwrd"&gt;this&lt;/span&gt;).closest(&lt;span class="str"&gt;'li'&lt;/span&gt;).appendTo(&lt;span class="str"&gt;'ul#list1'&lt;/span&gt;);
    });
  });&lt;/pre&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;These events aren’t bound to the items themselves. Rather they sit higher up the DOM and, through some event delegation magic, are handled by any &lt;code&gt;li&lt;/code&gt; matching the selector (including elements appended in the future). So when an &lt;code&gt;li&lt;/code&gt;’s &lt;code&gt;move&lt;/code&gt; icon is clicked, the event handler walks up the DOM until it finds the &lt;code&gt;li&lt;/code&gt; element, and moves it to the other list via a call to &lt;code&gt;appendTo()&lt;/code&gt;. This technique can be combined with &lt;a href="http://jqueryui.com/demos/sortable/"&gt;jQuery UI’s sortable component&lt;/a&gt;, too, for drag/drop and reorder support, too.&lt;/p&gt;

&lt;p&gt;It’s also really easy to add animation (&lt;a href="http://jsbin.com/ucoqi/3"&gt;demo&lt;/a&gt;, &lt;a href="http://jsbin.com/ucoqi/3/edit"&gt;source&lt;/a&gt;):&lt;/p&gt;

&lt;pre class="csharpcode"&gt;  $(&lt;span class="kwrd"&gt;function&lt;/span&gt;(){
    $(&lt;span class="str"&gt;'ul#list1 .move'&lt;/span&gt;).live(&lt;span class="str"&gt;'click'&lt;/span&gt;, &lt;span class="kwrd"&gt;function&lt;/span&gt;(){
      $li = $(&lt;span class="kwrd"&gt;this&lt;/span&gt;).closest(&lt;span class="str"&gt;'li'&lt;/span&gt;);
      $li.fadeOut(&lt;span class="str"&gt;'slow'&lt;/span&gt;, &lt;span class="kwrd"&gt;function&lt;/span&gt;(){ $li.appendTo(&lt;span class="str"&gt;'ul#list2'&lt;/span&gt;).fadeIn(); });
    });
    
    $(&lt;span class="str"&gt;'ul#list2 .move'&lt;/span&gt;).live(&lt;span class="str"&gt;'click'&lt;/span&gt;, &lt;span class="kwrd"&gt;function&lt;/span&gt;(){
      $li = $(&lt;span class="kwrd"&gt;this&lt;/span&gt;).closest(&lt;span class="str"&gt;'li'&lt;/span&gt;);
      $li.fadeOut(&lt;span class="str"&gt;'slow'&lt;/span&gt;, &lt;span class="kwrd"&gt;function&lt;/span&gt;(){ $li.appendTo(&lt;span class="str"&gt;'ul#list1'&lt;/span&gt;).fadeIn(); });
    });
  });&lt;/pre&gt;

&lt;p&gt;Now we’re getting to the point where some refactoring might be appropriate (&lt;a href="http://jsbin.com/ucoqi/5"&gt;demo&lt;/a&gt;, &lt;a href="http://jsbin.com/ucoqi/5/edit"&gt;source&lt;/a&gt;):&lt;/p&gt;

&lt;pre class="csharpcode"&gt;  $.fn.pushTo = &lt;span class="kwrd"&gt;function&lt;/span&gt;(toSelector)
  {
    $&lt;span class="kwrd"&gt;this&lt;/span&gt; = $(&lt;span class="kwrd"&gt;this&lt;/span&gt;);
    return $&lt;span class="kwrd"&gt;this&lt;/span&gt;.fadeOut(&lt;span class="str"&gt;'slow'&lt;/span&gt;, &lt;span class="kwrd"&gt;function&lt;/span&gt;(){ $&lt;span class="kwrd"&gt;this&lt;/span&gt;.appendTo(toSelector).fadeIn(); });   
  };
  
  $(&lt;span class="kwrd"&gt;function&lt;/span&gt;(){
    $(&lt;span class="str"&gt;'ul#list1 .move'&lt;/span&gt;).live(&lt;span class="str"&gt;'click'&lt;/span&gt;, &lt;span class="kwrd"&gt;function&lt;/span&gt;(){
      $(&lt;span class="kwrd"&gt;this&lt;/span&gt;).closest(&lt;span class="str"&gt;'li'&lt;/span&gt;).pushTo(&lt;span class="str"&gt;'ul#list2'&lt;/span&gt;);
    });
    
    $(&lt;span class="str"&gt;'ul#list2 .move'&lt;/span&gt;).live(&lt;span class="str"&gt;'click'&lt;/span&gt;, &lt;span class="kwrd"&gt;function&lt;/span&gt;(){
      $(&lt;span class="kwrd"&gt;this&lt;/span&gt;).closest(&lt;span class="str"&gt;'li'&lt;/span&gt;).pushTo(&lt;span class="str"&gt;'ul#list1'&lt;/span&gt;);
    });
  });&lt;/pre&gt;

&lt;p&gt;It’s not really any less code, but we’ve moved the messy animation pieces out into a chainable function. I could have moved the &lt;code&gt;.closest()&lt;/code&gt; pieces into the function, too, but that would make the &lt;code&gt;pushTo()&lt;/code&gt; method a little too specific to this task for my taste. Since we have the animation isolated to one line, we can easily change it to slide the items in and out (&lt;a href="http://jsbin.com/ucoqi/7"&gt;demo&lt;/a&gt;, &lt;a href="http://jsbin.com/ucoqi/7/edit"&gt;source&lt;/a&gt;):&lt;/p&gt;

&lt;pre class="csharpcode"&gt;  $.fn.pushTo = &lt;span class="kwrd"&gt;function&lt;/span&gt;(toSelector)
  {
    $&lt;span class="kwrd"&gt;this&lt;/span&gt; = $(&lt;span class="kwrd"&gt;this&lt;/span&gt;);
    $&lt;span class="kwrd"&gt;this&lt;/span&gt;.slideUp(&lt;span class="str"&gt;'slow'&lt;/span&gt;, &lt;span class="kwrd"&gt;function&lt;/span&gt;(){ $&lt;span class="kwrd"&gt;this&lt;/span&gt;.appendTo(toSelector).slideDown(); });   
    &lt;span class="kwrd"&gt;return&lt;/span&gt; $&lt;span class="kwrd"&gt;this&lt;/span&gt;;
  };&lt;/pre&gt;

&lt;p&gt;Finally, if you use something like this in a real app, use ‘fast’ for the animation speed. I’m using ‘slow’ here to make it obvious. In practice, though, it’d be very annoying. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7767624464875146298-8463590731751041338?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/8463590731751041338/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=8463590731751041338" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/8463590731751041338?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/8463590731751041338?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2010/03/moving-list-items-between-lists.html" title="Moving List Items Between Lists" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry gd:etag="W/&quot;CkUGRHo-cCp7ImA9WxBUFEo.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-2710358635289209308</id><published>2010-03-01T14:03:00.001-05:00</published><updated>2010-03-01T14:03:45.458-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-01T14:03:45.458-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Technology" /><category scheme="http://www.blogger.com/atom/ns#" term="Work" /><title>Word Document Automation with .NET 4: Attach Styles From a Template</title><content type="html">&lt;p&gt;I’ve been working with document generation a &lt;a href="http://blog.wassupy.com/2010/02/word-document-automation-with-net-4.html"&gt;bit&lt;/a&gt; &lt;a href="http://blog.wassupy.com/2010/02/word-document-automation-with-net-4_27.html"&gt;lately&lt;/a&gt;. The latest hurdle I’ve had to jump is related to styles. I’ve found that the technique I’m using to merge styles is nice and easy but has one undesired feature: each source doc brings its own styles with it, overwriting any existing styles that have already been imported as it goes. This is nice in a lot of ways, but not what I want at the moment.&lt;/p&gt;  &lt;p&gt;After a lot of trial and error, I’ve come up with a super simple way to apply a single set of styles to the finished document:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; StyleDocument(Document document, &lt;span class="kwrd"&gt;string&lt;/span&gt; templateFile)
{
    document.CopyStylesFromTemplate(templateFile);
}&lt;/pre&gt;

&lt;p&gt;That’s it! This will take all the styles from the given .dotx or .docx file and apply them to the given document object. If you only have a file path of the document that needs to be styled, you’ll need to open/close it, too, with this overload (in addition to the above method):&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; StyleDocument(&lt;span class="kwrd"&gt;string&lt;/span&gt; file, &lt;span class="kwrd"&gt;string&lt;/span&gt; templateFile)
{
    Application WordApp = &lt;span class="kwrd"&gt;null&lt;/span&gt;;

    &lt;span class="kwrd"&gt;try&lt;/span&gt;
    {
        WordApp = &lt;span class="kwrd"&gt;new&lt;/span&gt; Application();
        var Document = WordApp.Documents.Open(file);
        StyleDocument(Document, templateFile);
    }
    &lt;span class="kwrd"&gt;finally&lt;/span&gt;
    {
        DisposeApp(WordApp);
    }
}&lt;/pre&gt;

&lt;p&gt;Where &lt;code class="csharpcode"&gt;DisposeApp(…)&lt;/code&gt; is just a helper to cleanup my mess:&lt;/p&gt;

&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; DisposeApp(Application WordApp)
{
    &lt;span class="kwrd"&gt;if&lt;/span&gt; (WordApp != &lt;span class="kwrd"&gt;null&lt;/span&gt;)
    {
        &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (var Doc &lt;span class="kwrd"&gt;in&lt;/span&gt; WordApp.Documents)
        {
            (Doc &lt;span class="kwrd"&gt;as&lt;/span&gt; _Document).Close();
        }
        (WordApp &lt;span class="kwrd"&gt;as&lt;/span&gt; _Application).Quit();

        System.Runtime.InteropServices.Marshal.FinalReleaseComObject(WordApp);
    }
}&lt;/pre&gt;

&lt;p&gt;This technique is far, far nicer than working with the styles manually.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7767624464875146298-2710358635289209308?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/2710358635289209308/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=2710358635289209308" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/2710358635289209308?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/2710358635289209308?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2010/03/word-document-automation-with-net-4.html" title="Word Document Automation with .NET 4: Attach Styles From a Template" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry gd:etag="W/&quot;AkYAR34-fCp7ImA9WxBUFEw.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-819745325985470693</id><published>2010-02-28T23:35:00.001-05:00</published><updated>2010-02-28T23:35:46.054-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-28T23:35:46.054-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="In the News" /><category scheme="http://www.blogger.com/atom/ns#" term="Math" /><title>How the Richter Scale Works</title><content type="html">&lt;p&gt;I saw &lt;a href="http://www.examiner.com/x-4454-Geopolitics-Examiner~y2010m2d28-Chiles-earthquake-500-times-stronger-yet-less-destructive-than-Haitis-Photos"&gt;this headline&lt;/a&gt;:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;Chile’s earthquake 500 times stronger yet less destructive than Haiti’s&lt;/strong&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;and started wondering: how Chile’s quake could be 500x as powerful as Haiti’s when their respective Richter scale magnitudes are 8.8 vs. 7.0? The “less destructive” part is interesting, too, but everyone’s already talking about that so I’ll focus on the scale.&lt;/p&gt;  &lt;p&gt;The first clue is that the scale is &lt;a href="http://en.wikipedia.org/wiki/Logarithm"&gt;logarithmic&lt;/a&gt;. That means that each increment of 1 is a 10x increase in magnitude. If you were to plot &lt;em&gt;x&lt;/em&gt; vs. &lt;em&gt;log&lt;sub&gt;10&lt;/sub&gt;(x)&lt;/em&gt;, it might look like this:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_IKD9WtY5kxU/S4tEH9A4jjI/AAAAAAAAApY/bibWf2HfNVc/image%5B11%5D.png?imgmax=800" width="656" height="402" /&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Well, that’s not very revealing until you realize that the &lt;em&gt;x&lt;/em&gt;-axis is increasing logarithmically. Consider the same data but with the &lt;em&gt;x&lt;/em&gt;-axis presented linearly:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_IKD9WtY5kxU/S4tEIdxSFyI/AAAAAAAAApc/01mTlXYxzss/image%5B8%5D.png?imgmax=800" width="656" height="402" /&gt;&lt;/p&gt;  &lt;p&gt;Now we’re talking. Each increment on the &lt;em&gt;y&lt;/em&gt;-axis is a &lt;strong&gt;10x &lt;/strong&gt;increment on the y-axis. i.e. 8 is 10x greater in magnitude than a 7:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;10&lt;sup&gt;8&lt;/sup&gt;/10&lt;sup&gt;7&lt;/sup&gt; = 10&lt;/sup&gt;&lt;/sup&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;So it follows then that an 8.8 (Chile) vs. 7.0 (Haiti) would be:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;10&lt;sup&gt;8.8&lt;/sup&gt;/10&lt;sup&gt;7&lt;/sup&gt; = 63&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Thus an 8.8 is 63 times greater in magnitude than a 7. Wow. OK so how do we get to 500x more destructive? It would seem that the news is using a different factor: energy. I didn’t dig into all the math behind it but the &lt;a href="http://en.wikipedia.org/wiki/Richter_magnitude_scale#Richter_magnitudes"&gt;gist of it&lt;/a&gt; seems to be that while the Richter scale measures raw amplitude of the little pencil on the paper wheel/strip triggered by the earthquake's waves, the actual energy factor is much higher than 10:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Because of the logarithmic basis of the scale, each whole number increase in magnitude represents a tenfold increase in measured amplitude; in terms of energy, each whole number increase corresponds to an &lt;strong&gt;increase of about 31.6 times&lt;/strong&gt; the amount of energy released.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;So I guess the news people are applying this to the log scale with a &lt;em&gt;base of 31.6 instead of 10&lt;/em&gt;. Let’s check:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;31.6&lt;sup&gt;8.8&lt;/sup&gt;/31.7&lt;sup&gt;7&lt;/sup&gt; = 501&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Hooray! I honestly didn’t know that would work until I got to this point and calculated it (phew!). So this makes me wonder how effective a scale is when it’s not…intuitive at all. Certainly a simple, scientific number is helpful, but I’m not sure this is the right number to use in casual conversation. &lt;/p&gt;  &lt;p&gt;Instead, numbers related to life lost, people displaced, or damage are probably more relevant and appropriate to compare. For example, the &lt;a href="http://online.wsj.com/article/SB10001424052748704089904575094013194396670.html?mod=WSJ-World-LeadStory"&gt;current mortality estimates&lt;/a&gt; are: Chile 700, Haiti 220,000:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;220000/700 = 314&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The quake in Haiti has killed (to date) 314 times more people than the quake in Chile. (That article also explains the 500 figure pretty well—I should have read it before writing this post :P)&lt;/p&gt;  &lt;p&gt;On a very related note, there’s a super cool &lt;a href="http://www.wnyc.org/shows/radiolab/episodes/2009/10/09"&gt;Radio Lab podcast&lt;/a&gt; about numbers which explores the idea that we count logarithmically when born but learn to count absolutely as children. Neat.&lt;/p&gt;  &lt;p&gt;Also of note: decibels—a measurement of sound intensity is in &lt;a href="http://en.wikipedia.org/wiki/Logarithmic_unit#Examples"&gt;logarithmic units&lt;/a&gt;, too, as is &lt;a href="http://en.wikipedia.org/wiki/PH"&gt;pH&lt;/a&gt; in chemistry.&lt;/p&gt;  &lt;p&gt;Finally, for tons of info on Earthquakes, checkout the &lt;a href="http://earthquake.usgs.gov/earthquakes/"&gt;USGS&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/7767624464875146298-819745325985470693?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/819745325985470693/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=819745325985470693" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/819745325985470693?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/819745325985470693?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2010/02/how-richter-scale-works.html" title="How the Richter Scale Works" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">2</thr:total></entry><entry gd:etag="W/&quot;D0MMRX86fip7ImA9WxBUE0w.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-3000357493300901195</id><published>2010-02-27T19:04:00.001-05:00</published><updated>2010-02-27T19:04:44.116-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-27T19:04:44.116-05:00</app:edited><title>Why Twitter is Awesome</title><content type="html">&lt;p&gt;I don’t understand Twitter—how it works, how it makes money, or anything. As a computer engineer, I marvel at how impressive it is in terms of scale. For example, they are now crunching &lt;a href="http://mashable.com/2010/02/22/twitter-50-million-tweets/"&gt;50,000,000 tweets per day&lt;/a&gt;. That’s incredible.&lt;/p&gt;  &lt;p&gt;&lt;img style="display: block; float: none; margin-left: auto; margin-right: auto" src="http://cdn.mashable.com/wp-content/uploads/2010/02/chart-tweets-per-day3-e1266872028279.png" /&gt;&lt;/p&gt;  &lt;p&gt;Volume doesn’t make it awesome, though. Most of those tweets are about what uninteresting people are eating, watching, etc. Here’s why it’s awesome: I am empowered to connect with people in otherwise unreachable places. This calls for some examples:&lt;/p&gt;  &lt;h4&gt;Example 1: Microsoft&lt;/h4&gt;  &lt;p&gt;I recently ranted a bit about Visual Studio 2010 RC crashes:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;If you crash on me one more damn time, VS2010, I will drop kick you onto the roof of my building. I'm not even kidding. &lt;a href="http://twitter.com/mharen/status/9607164906"&gt;9:58 PM Feb 24th&lt;/a&gt;&lt;/p&gt;    &lt;p&gt;It's official, VS2010 is getting taped to a ball and kicked onto the roof of my office tomorrow. Hope you're happy...(I warned you). &lt;a href="http://twitter.com/mharen/status/9609708666"&gt;10:59 PM Feb 24th&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This brought a very nice reply from someone I’ve never heard of (@Pilchie):&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;@mharen: Are you using a touch screen? Seen &lt;a href="http://bit.ly/dlT7ez"&gt;http://bit.ly/dlT7ez&lt;/a&gt; ? &lt;a href="http://twitter.com/Pilchie/status/9610121141"&gt;11:09 PM Feb 24th&lt;/a&gt;&amp;#160;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;It turns out that @Pilchie is “Dev Lead for C# IntelliSense/Refactoring/etc at Microsoft”. Well how about that? In a mere 10 minutes, I was getting help from not just Microsoft, but the guy who works on the product I was complaining about. And his link worked!&lt;/p&gt;  &lt;h4&gt;Example 2: Stackoverflow/Codinghorror&lt;/h4&gt;  &lt;p&gt;I was working on a project which is using a lot of the same libraries that Stackoverflow uses. I ran into trouble with one of the components: I couldn’t figure out which version to use. So I pinged the lead developer/co-creator of SO:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;@&lt;a href="http://twitter.com/codinghorror"&gt;codinghorror&lt;/a&gt; where do i get the best wmd editor for use with markdownsharp? your version on google code? &lt;a href="http://twitter.com/mharen/status/8832078048"&gt;7:30 PM Feb 8th&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;And his very prompt response:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;r @&lt;a href="http://twitter.com/mharen"&gt;mharen&lt;/a&gt; our version is on Google Code, or you can dig through the fork-splosion on github and try to guess which version is &amp;quot;best&amp;quot; &lt;a href="http://twitter.com/codinghorror/status/8832188858"&gt;7:33 PM Feb 8th&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;In &lt;strong&gt;&lt;em&gt;three&lt;/em&gt;&lt;/strong&gt; minutes I had my answer from the top guy of the a product that’s used by bajillions (if not gajillions) of people. Even if he hadn’t answered, I was hoping that someone else might (this wasn’t a private query).&lt;/p&gt;  &lt;h4&gt;Example 3: Red Gate’s Neil Davidson&lt;/h4&gt;  &lt;p&gt;Via Twitter, I discovered a neat little book on software pricing. I tweeted about it:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;40% in and still interesting... RT @&lt;a href="http://twitter.com/spolsky"&gt;spolsky&lt;/a&gt;: A short ebook about software product pricing &lt;a href="http://retwt.me/1bmXM"&gt;http://retwt.me/1bmXM&lt;/a&gt; (from @&lt;a href="http://twitter.com/neildavidson"&gt;neildavidson&lt;/a&gt;) &lt;a href="http://twitter.com/mharen/status/5391952110"&gt;9:10 AM Nov 3rd, 2009&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;A half-hour later, I see this in my feed:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;@&lt;a href="http://twitter.com/mharen"&gt;mharen&lt;/a&gt; Glad you're liking the eBook! If you have time, could you post a review on Amazon once you've finished? ( &lt;a href="http://bit.ly/18xFJx)"&gt;http://bit.ly/18xFJx)&lt;/a&gt;&amp;#160;&lt;a href="http://twitter.com/NeilDavidson/status/5392536276"&gt;9:37 AM Nov 3rd, 2009&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;It’s at this point that I realize who wrote the book: &lt;a href="http://www.neildavidson.com/"&gt;Neil Davidson&lt;/a&gt;, co-founder/joint CEO of &lt;a href="http://www.red-gate.com/"&gt;Red Gate Software&lt;/a&gt;, and founder&amp;#160; of the &lt;a href="http://blog.businessofsoftware.org/"&gt;Business of Software conferences&lt;/a&gt; among other things. A cool guy to get to know, no doubt. I finished the book and left a review as he asked and took the opportunity to ask about one of his products:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;@&lt;a href="http://twitter.com/NeilDavidson"&gt;NeilDavidson&lt;/a&gt; you bet; we use a lot of your products btw--thanks! What's up with Log Rescue not supporting SQL &amp;gt;2000? Anything planned? &lt;a href="http://twitter.com/mharen/status/5392617100"&gt;9:40 AM Nov 3rd, 2009&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;To which I got a very simple and candid reply (the beauty of the 140 character limit!):&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;@&lt;a href="http://twitter.com/mharen"&gt;mharen&lt;/a&gt; We're not going to do any more work on SQL Log Rescue. Lots of people used it, but nobody bought, and SQL 2000 work would be huge &lt;a href="http://twitter.com/NeilDavidson/status/5392660455"&gt;9:42 AM Nov 3rd, 2009&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;hr /&gt;  &lt;p&gt;It’s so cool that this simple medium enables and promotes these types of quick conversations. In 2/3 of these cases, I wasn’t even trying to initiate communication—others were listening for certain things and &lt;em&gt;they found me&lt;/em&gt;. &lt;/p&gt;  &lt;p&gt;When I first starting toying with Twitter it seemed that its signal-to-noise ratio was cripplingly low. Now I see that by following keywords—not users—the signal is strong.&lt;/p&gt;  &lt;p&gt;It also has a unique ability to cut through the BS by forcing you to choose your words carefully. I like that.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7767624464875146298-3000357493300901195?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/3000357493300901195/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=3000357493300901195" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/3000357493300901195?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/3000357493300901195?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2010/02/why-twitter-is-awesome.html" title="Why Twitter is Awesome" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></entry><entry gd:etag="W/&quot;D0QNQXk9fip7ImA9WxBUEkQ.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-4164212781646386520</id><published>2010-02-27T13:29:00.001-05:00</published><updated>2010-02-27T13:29:50.766-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-27T13:29:50.766-05:00</app:edited><title>Fun with Google’s Public Data</title><content type="html">&lt;p&gt;I was going to do a post about our world’s exploding population growth and stumbled upon Google’s awesome &lt;a href="http://www.google.com/publicdata?ds=wb-wdi&amp;amp;met=sp_pop_totl&amp;amp;q=world+population#met=sp_pop_totl&amp;amp;idim=country:USA:GBR:JPN:DEU:CAN:MEX:RUS:VNM"&gt;public data service&lt;/a&gt; with my first research query:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.google.com/publicdata?ds=wb-wdi&amp;amp;met=sp_pop_totl&amp;amp;q=world+population#met=sp_pop_totl&amp;amp;idim=country:USA:GBR:JPN:DEU:CAN:MEX:RUS:VNM"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_IKD9WtY5kxU/S4lkmauS6sI/AAAAAAAAApM/CsofLoLU5kU/image%5B13%5D.png?imgmax=800" width="487" height="386" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I haven’t been able to uncover an index for what types of things you can show here but a little &lt;a href="http://www.google.com/search?q=site:http://www.google.com/publicdata+co2"&gt;searching&lt;/a&gt; will get you other things.&lt;/p&gt;  &lt;p&gt;Anyway, so this is what I was looking for initially (&lt;a href="http://www.vaughns-1-pagers.com/history/world-population-growth.htm"&gt;data source&lt;/a&gt;):&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_IKD9WtY5kxU/S4lkm_1AF6I/AAAAAAAAApQ/VvHXJnr9Ni4/image%5B23%5D.png?imgmax=800" width="865" height="521" /&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;And since the last 200 years:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_IKD9WtY5kxU/S4lknNWhXiI/AAAAAAAAApU/bMDbqRVCGUg/image%5B27%5D.png?imgmax=800" width="865" height="521" /&gt; &lt;/p&gt;  &lt;p&gt;Clearly my source data could be more complete. Even with the gaps, though, the exploding trend is obvious. It comes with this neat, mind-blowing factoid, too:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;The total number of humans that have &lt;b&gt;ever lived&lt;/b&gt; has been estimated at &lt;b&gt;110 billion&lt;/b&gt;.      &lt;br /&gt;&lt;b&gt;Approximately 6% of all those people are alive today.&lt;/b&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;em&gt;Wow&lt;/em&gt;. With the modern improvements to &lt;a href="http://www.google.com/publicdata?ds=wb-wdi&amp;amp;q=lifespan#met=sp_dyn_le00_in&amp;amp;tdim=true"&gt;life expectancy&lt;/a&gt; and high rate of population growth (&lt;a href="http://en.wikipedia.org/wiki/File:World_population_growth_-_time_between_each_billion-person_growth.jpg"&gt;10-15 years per billion&lt;/a&gt;), it might be a while before this 6% figure stabilizes (i.e. stops growing). &lt;/p&gt;  &lt;p&gt;I’m not suggesting that this is a bad thing—not at all. I just find it interesting.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7767624464875146298-4164212781646386520?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/4164212781646386520/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=4164212781646386520" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/4164212781646386520?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/4164212781646386520?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2010/02/fun-with-googles-public-data.html" title="Fun with Google’s Public Data" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry gd:etag="W/&quot;CkUHSX0_fSp7ImA9WxBUEkQ.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-4556252145497583206</id><published>2010-02-27T12:02:00.001-05:00</published><updated>2010-02-27T12:03:58.345-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-27T12:03:58.345-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Technology" /><category scheme="http://www.blogger.com/atom/ns#" term="Work" /><title>Word Document Automation with .NET 4: Update All Fields</title><content type="html">&lt;p&gt;&lt;/p&gt;  &lt;p&gt;I’ve been told that these programming posts are not interesting or funny. For those that have no interest in programming, I offer the following joke:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;I hope the next time I move I get a real easy phone number, something that's real easy to remember. Something like two two two two two two two two. I would say &amp;quot;Sweet.&amp;quot; And then people would say, &amp;quot;Mitch, how do I get a hold of you?&amp;quot; I'd say, &amp;quot;Just press two for a while. And when I answer, you will know you have pressed two enough.&amp;quot; (&lt;a href="http://en.wikiquote.org/wiki/Mitch_Hedberg"&gt;more classics&lt;/a&gt; from the late and invariably hilarious Mitch Hedberg)&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Now would be a good time for you to stop reading. &lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;On with the show! This handy method will attempt to update all the fields in the document passed to it:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class="rem"&gt;/// Update damn near every field in the document&lt;/span&gt;
&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class="rem"&gt;/// &amp;lt;param name=&amp;quot;document&amp;quot;&amp;gt;The document in dire need of updating&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; UpdateAllFields(Document document)
{
    &lt;span class="rem"&gt;// there must be a better way than searching everything I can thing of&lt;/span&gt;
    &lt;span class="rem"&gt;// please let me know if you find one!&lt;/span&gt;

    &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (Range R &lt;span class="kwrd"&gt;in&lt;/span&gt; document.StoryRanges)
    {
        R.Fields.Update();
    }

    &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (TableOfContents T &lt;span class="kwrd"&gt;in&lt;/span&gt; document.TablesOfContents)
    {
        T.Update();
    }

    &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (Section S &lt;span class="kwrd"&gt;in&lt;/span&gt; document.Sections)
    {
        &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (HeaderFooter F &lt;span class="kwrd"&gt;in&lt;/span&gt; S.Footers)
        {
            F.Range.Select();
            F.Range.Fields.Update();
        }
        &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (HeaderFooter H &lt;span class="kwrd"&gt;in&lt;/span&gt; S.Headers)
        {
            H.Range.Select();
            H.Range.Fields.Update();
        }
    }

    &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (Shape S &lt;span class="kwrd"&gt;in&lt;/span&gt; document.Shapes)
    {
        &lt;span class="kwrd"&gt;if&lt;/span&gt; (S.Type == Microsoft.Office.Core.MsoShapeType.msoTextBox &amp;amp;&amp;amp; S.TextFrame.HasText &amp;gt; 0)
        {
            S.TextFrame.TextRange.Fields.Update();
        }
    }

    &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (Range S &lt;span class="kwrd"&gt;in&lt;/span&gt; document.Sentences)
    {
        &lt;span class="kwrd"&gt;if&lt;/span&gt; (S.ShapeRange.Count &amp;gt; 0)
        {
            &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (Shape Shape &lt;span class="kwrd"&gt;in&lt;/span&gt; S.ShapeRange)
            {
                &lt;span class="kwrd"&gt;if&lt;/span&gt; (Shape.Type == Microsoft.Office.Core.MsoShapeType.msoTextBox)
                {
                    Shape.TextFrame.TextRange.Fields.Update();
                }
            }
        }
    }

    document.Application.ActiveWindow.View.Type = WdViewType.wdMasterView;
    document.Application.ActiveWindow.View.Type = WdViewType.wdPrintPreview;
}&lt;/pre&gt;
&lt;span style="widows: 2; text-transform: none; text-indent: 0px; border-collapse: separate; font: medium cambria; white-space: normal; orphans: 2; letter-spacing: normal; color: rgb(0,0,0); word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px" class="Apple-style-span"&gt;&lt;span style="text-align: left; line-height: 16px; font-family: verdana, arial, sans-serif; color: rgb(51,51,51); font-size: 13px" class="Apple-style-span"&gt;
    &lt;p&gt;To use this, add the following references to your project:&lt;/p&gt;

    &lt;ul&gt;
      &lt;li&gt;Microsoft.Office.Interop.Word, v12&lt;/li&gt;

      &lt;li&gt;Office, v12&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/span&gt;&lt;/span&gt;

&lt;p&gt;It makes me cry a little to brute force every container I can think of this way. Surely there’s a better way. Maybe I could just traverse the documents DOM an update anything that looks like a field castable to a Field…I’ll think about that. Until then, this seems to work…&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7767624464875146298-4556252145497583206?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/4556252145497583206/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=4556252145497583206" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/4556252145497583206?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/4556252145497583206?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2010/02/word-document-automation-with-net-4_27.html" title="Word Document Automation with .NET 4: Update All Fields" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></entry><entry gd:etag="W/&quot;AkUMQH07fSp7ImA9WxBUEkU.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-1509638969943687793</id><published>2010-02-27T11:31:00.001-05:00</published><updated>2010-02-27T11:31:21.305-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-27T11:31:21.305-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Technology" /><category scheme="http://www.blogger.com/atom/ns#" term="Work" /><title>Word Document Automation with .NET 4</title><content type="html">&lt;p&gt;I’ve been toying around with some document generation lately and thought I’d share a bit of what I’ve learned. Here’s a method for extracting a list of custom properties in use in the document:&lt;/p&gt;  &lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;span class="rem"&gt;/// Retrieves custom properties from a given Word document&lt;/span&gt;
&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;span class="rem"&gt;/// &amp;lt;param name=&amp;quot;file&amp;quot;&amp;gt;Full path to the Word document&amp;lt;/param&amp;gt;&lt;/span&gt;
&lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;A dictionary representation of the document's custom properties&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; Dictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, &lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; GetDocProperties(&lt;span class="kwrd"&gt;string&lt;/span&gt; file)
{
    Application WordApp = &lt;span class="kwrd"&gt;null&lt;/span&gt;;
    var DocProperties = &lt;span class="kwrd"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, &lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt;();

    &lt;span class="kwrd"&gt;try&lt;/span&gt;
    {
        &lt;span class="rem"&gt;// spin up a new WinWord.exe&lt;/span&gt;
        WordApp = &lt;span class="kwrd"&gt;new&lt;/span&gt; Application();

        &lt;span class="rem"&gt;// open the specified document&lt;/span&gt;
        WordApp.Documents.Open(file);

        &lt;span class="rem"&gt;// grab the custom properties container&lt;/span&gt;
        dynamic CustomProps = WordApp.ActiveDocument.CustomDocumentProperties;

        &lt;span class="rem"&gt;// extract each property&lt;/span&gt;
        &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (var Prop &lt;span class="kwrd"&gt;in&lt;/span&gt; CustomProps)
        {
            DocProperties.Add(Prop.Name, Prop.Value);
        }
    }
    &lt;span class="kwrd"&gt;finally&lt;/span&gt;
    {
        &lt;span class="rem"&gt;// close doc and shutdown word&lt;/span&gt;
        &lt;span class="kwrd"&gt;if&lt;/span&gt; (WordApp != &lt;span class="kwrd"&gt;null&lt;/span&gt;)
        {
            &lt;span class="kwrd"&gt;if&lt;/span&gt; (WordApp.ActiveDocument != &lt;span class="kwrd"&gt;null&lt;/span&gt;)
            {
                WordApp.ActiveDocument.Close();
            }
            WordApp.Quit();
        }
    }

    &lt;span class="rem"&gt;// return properties&lt;/span&gt;
    &lt;span class="kwrd"&gt;return&lt;/span&gt; DocProperties;
}&lt;/pre&gt;

&lt;p&gt;This is so much easier and cleaner with .NET4’s new dynamic capabilities and how nice it plays with COM. To use this, add the following references to your project:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Microsoft.Office.Interop.Word, v12 &lt;/li&gt;

  &lt;li&gt;Office, v12 &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/7767624464875146298-1509638969943687793?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/1509638969943687793/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=1509638969943687793" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/1509638969943687793?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/1509638969943687793?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2010/02/word-document-automation-with-net-4.html" title="Word Document Automation with .NET 4" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry gd:etag="W/&quot;DkEMRHo8eip7ImA9WxBSFEg.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-1285243480271951248</id><published>2009-12-21T22:56:00.001-05:00</published><updated>2009-12-21T23:04:45.472-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-21T23:04:45.472-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Household" /><category scheme="http://www.blogger.com/atom/ns#" term="Family" /><title>Bad Haircuts</title><content type="html">&lt;p&gt;A while back I got the worst haircut I’ve ever gotten. I could tell because when men get haircuts, they go unacknowledged (my wife usually doesn’t even notice!). But people noticed me this time.&lt;/p&gt;  &lt;p&gt;I could see the flurry of familiar questions each horrified/amused onlooker mentally dismissed when they first met me after the cut…did he cut his own hair? Is that a wig? Did he pay for that? Then I’d invariably see their eyes trace a circle around my head as they imagined the bowl that must have been used as a cutting template. It came out something like this:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_IKD9WtY5kxU/SzBDZ0eZpcI/AAAAAAAAAkY/vk6cm69Vu6c/image%5B7%5D.png?imgmax=800" width="379" height="273" /&gt;&lt;/p&gt;  &lt;p&gt;Maybe I got what I deserved by going to a place called Fantastic Sams and paying a mere $11.&lt;/p&gt;  &lt;p&gt;But wait, since it’s almost Tuesday, let’s make this a twofer. A few months later I went to a Great Clips that had just opened by our house. It turns out that it’s a terrible idea to go to a haircutter’s grand opening. Let me guide you through the cut…&lt;/p&gt;  &lt;p&gt;So there I was looking a little scruffy, hoping for a trim, so I hopped into the chair and described what I wanted. The cutter gets started and does the clipper thing and some scissors and we start to talking. I ask my usual question which is something about how busy they are (not). &lt;/p&gt;  &lt;p&gt;She said she didn’t know anything about it because she just started and, in fact, is graduating soon…&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;“From…cosmetology school?”&lt;/p&gt;    &lt;p&gt;“No, high school.”&lt;/p&gt;    &lt;p&gt;“Oh, so you’re in like a vocational school or something?”&lt;/p&gt;    &lt;p&gt;“No, high school.”&lt;/p&gt;    &lt;p&gt;“Oh, so you’re planning to go into cosmetology school?”&lt;/p&gt;    &lt;p&gt;“No.”&lt;/p&gt;    &lt;p&gt;Awesome. “So have you been working in this business long?”&lt;/p&gt;    &lt;p&gt;“No…this place just opened and they were hiring so…here we are!”&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Hmmm so no training required at all…awesome. So she’s cutting my hair and doing the clippers and scissors and clippers and scissors and &lt;em&gt;back again &lt;/em&gt;to clippers…? I’m detecting a problem. It seems she’s going back and forth—temple to temple—with the clippers and moving towards the top of my head as she goes. I suggest that we stop with the clippers&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;“hmmm that’s probably enough with the clippers” &lt;/p&gt;    &lt;p&gt;“I know, I just can’t get it even…” buzzzzzzz&lt;/p&gt;    &lt;p&gt;“Ok, it looks good…no—yep it’s great—no…no—ok there, now it’s great.” No more need for those clippers…or scissors. “We’re done here.” (it went something like that).&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;So I was done and had what I guess was just a hack job that resembled something like this:&lt;/p&gt;  &lt;p align="center"&gt;&lt;img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" border="0" src="http://www.bloggerdad.com/wp-content/uploads/2009/04/bad-hair-day.jpg" width="181" height="240" /&gt;(&lt;a href="http://www.flickr.com/photos/fordbuchanan/3263291855/"&gt;artist&lt;/a&gt; rendering)&lt;/p&gt;  &lt;p&gt;Then I’m not sure how this happened, but Sarah (who only rarely gets her hair cut), decided to get a trim and got the same person! I swear I didn’t know, babe—honest!&lt;/p&gt;  &lt;p&gt;Sarah asked for a trim up to her shoulders—about an inch. The cutter took about 3 inches off. When Sarah’s hair was flying fast and free well above her shoulders, the cutter suggested that her hair bounced up quite a bit with its curl. Her hair is not curly. At all.&lt;/p&gt;  &lt;p&gt;After the cut, Sarah thought she got a mediocre cut but didn’t think much of it until we put our stories together. She apparently had some good conversation herself. My favorite response came when Sarah asked the cutter if she grew up cutting her family members’ hair:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;“Oh no, I’m not allowed to cut my little sister's hair.”&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Wow. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7767624464875146298-1285243480271951248?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/1285243480271951248/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=1285243480271951248" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/1285243480271951248?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/1285243480271951248?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2009/12/bad-haircuts.html" title="Bad Haircuts" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">0</thr:total></entry><entry gd:etag="W/&quot;D08ASH0zeCp7ImA9WxNUGE0.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-2646746167609327463</id><published>2009-11-08T00:08:00.008-05:00</published><updated>2009-11-09T17:30:49.380-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-11-09T17:30:49.380-05:00</app:edited><title>New Website</title><content type="html">My super amazing wife has started her own blog.  It is phenomenal.  Some of the best stuff I've read in a LONG time.  Seriously.  You should &lt;a href="http://footedjammies.blogspot.com"&gt;check it out&lt;/a&gt;.  Oh, and this is totally not her hijacking my site*
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
&lt;span style="font-size:75%;"&gt;*actually it is&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7767624464875146298-2646746167609327463?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/2646746167609327463/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=2646746167609327463" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/2646746167609327463?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/2646746167609327463?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2009/11/new-website.html" title="New Website" /><author><name>Sarah</name><uri>http://www.blogger.com/profile/18189414451031613419</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="06413247301414368786" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">3</thr:total></entry><entry gd:etag="W/&quot;AkYEQHo6eSp7ImA9WxNXE0s.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-3703184017243683621</id><published>2009-09-30T23:35:00.001-04:00</published><updated>2009-09-30T23:35:01.411-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-09-30T23:35:01.411-04:00</app:edited><title>Food Allergies != Fun</title><content type="html">&lt;p&gt;Sarah and I grew up without allergies and in allergy-free homes with allergy-free extended families and mostly allergy-free friends. That’s why it’s so strange to us that Maya has unpleasant sensitivities to so many different foods. &lt;/p&gt;  &lt;p&gt;The confirmed list of banned foods includes:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Tomatoes&lt;/li&gt;    &lt;li&gt;Pineapple&lt;/li&gt;    &lt;li&gt;Blueberries&lt;/li&gt;    &lt;li&gt;Dairy&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;And some recent probable foods:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Soy&lt;/li&gt;    &lt;li&gt;Corn&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;In case you haven’t checked a food label recently, that means she can’t eat anything. No cheese, ice cream, ketchup, fruit salad, anything sweetened with corn syrup (e.g. almost everything), anything with soybeans or soybean oil (everything else), or anything with butter in it.&lt;/p&gt;  &lt;p&gt;Maybe I’m being a little dramatic—she’s not going to starve—it’s just very difficult to get used to and impossible to eat meals prepared by others. She gets by on a solid diet of delicious home-cooked meals, supplemented with scrambled eggs and peanut butter.&lt;/p&gt;  &lt;p&gt;Fortunately, Sarah’s taken this all in stride. She bakes all of our bread and sandwich buns (you &lt;em&gt;cannot &lt;/em&gt;find buns that are safe for her to eat at a regular store—it’s crazy), and somehow prepares three meals a day for her and dinner for us without the above ingredients…and they’re &lt;em&gt;good&lt;/em&gt;.&lt;/p&gt;  &lt;p&gt;So as you might imagine, we’ve become quite good at reading food labels. We love that labels are often very clear, including nice bold statement like “contains milk, soy”, but sometimes they hide ingredients behind phrases like “natural flavors” and “spices”. As a parent trying to figure out why my almost-two-year-old daughter is sensitive to a dish it’s very helpful to know what’s actually in it. Concealing ingredients behind groupings like those is very frustrating for us.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="image" border="0" alt="image" align="right" src="http://lh3.ggpht.com/_IKD9WtY5kxU/SsQjX8o_2JI/AAAAAAAAAjI/WrnSw0-rkz0/image%5B17%5D.png?imgmax=800" width="149" height="240" /&gt;A recent example of our struggle is Progresso chicken broth. What’s in chicken broth you say? According to the product label, the website, the toll free number on the back of the box, and the letter they sent us, this is what’s in there:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font size="1"&gt;Ingredients: &lt;u&gt;Chicken Broth&lt;/u&gt;, Sea Salt, Sugar, Autolyzed Yeast Extract, Carrot Puree, &lt;u&gt;Natural Flavor&lt;/u&gt;, Salt, Chicken Powder, Chicken Fat*, Celery Juice Concentrate, Onion Powder, Chicken Meat, Carrot Juice Concentrate, &lt;u&gt;Spices&lt;/u&gt;, Onion Juice Concentrate, Garlic Powder. [underlining added]&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Oh, so the first ingredient in broth is…broth. That makes sense. So Sarah emailed and called Progresso to find out what exactly are: chicken broth, natural flavor, and spices. I’m wondering what chicken powder is, too, but that’s for another day. Their response: &lt;strong&gt;we don’t know&lt;/strong&gt; (i.e. they don’t tell us so we can’t tell you). I called again and pressed further and was simply told to stop buying Progresso Broth if I was worried about it because they can’t tell me what’s in it.&lt;/p&gt;  &lt;p&gt;Well that was frustrating. This as a great example of a company failing to win a customer. There’s probably a dozen reasons not to tell us what’s behind those ingredients but I can’t think of one that really stands up to scrutiny. It’s not like we’re going to start making our own broth. Plus, if I was a real competitor, I would think more scientific approaches to figuring out what is in the box would be more fruitful. Instead of giving us a complete, uncensored list of ingredients like Superior Touch did for their &lt;a href="http://www.superiortouch.com/retail/products/better-than-bouillon"&gt;Better Than Bullion&lt;/a&gt; product (they were awesome—completely answered our questions in a single phone call), they took our name and promised a call back. &lt;em&gt;Days &lt;/em&gt;later, the callback was unhelpful. Weeks later, we received a package from General Mills, Progresso’s parent company. This contained a letter with the same unhelpful answer: we won’t tell you what’s in there, but thanks! &lt;/p&gt;  &lt;p&gt;As expected, they included some coupons for more broth (which we can’t use in anything Maya touches because we still don’t know what’s in it). &lt;em&gt;Unexpected&lt;/em&gt;, though, was the reason for the package: they included a bunch of General Mills-themed matchbox cars. Seriously—we have four of these things:&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://lh4.ggpht.com/_IKD9WtY5kxU/SsQjYDZTOjI/AAAAAAAAAjM/NsqArqIBN24/s1600-h/IMG_6340%5B5%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="IMG_6340" border="0" alt="IMG_6340" src="http://lh5.ggpht.com/_IKD9WtY5kxU/SsQjYibi1II/AAAAAAAAAjQ/BYwIkP4zmNE/IMG_6340_thumb%5B6%5D.jpg?imgmax=800" width="243" height="200" /&gt;&lt;/a&gt; &lt;a href="http://lh4.ggpht.com/_IKD9WtY5kxU/SsQjYyWYc2I/AAAAAAAAAjU/kvmcJozhBSA/s1600-h/IMG_6337%5B5%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="IMG_6337" border="0" alt="IMG_6337" src="http://lh5.ggpht.com/_IKD9WtY5kxU/SsQjZMpMpDI/AAAAAAAAAjY/pcyz9MHSeCo/IMG_6337_thumb%5B7%5D.jpg?imgmax=800" width="256" height="200" /&gt;&lt;/a&gt;    &lt;br /&gt;&lt;font size="1"&gt;(Charlotte pictured, not Maya)&lt;/font&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Maya &lt;strong&gt;loves&lt;/strong&gt; them. So, Progresso, thanks for the coupons and the toys—I guess we’re even. I wish I could feed your product to my child, though!&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7767624464875146298-3703184017243683621?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/3703184017243683621/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=3703184017243683621" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/3703184017243683621?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/3703184017243683621?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2009/09/food-allergies-fun.html" title="Food Allergies != Fun" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></entry><entry gd:etag="W/&quot;DUIARXY9cSp7ImA9WxNXEUQ.&quot;"><id>tag:blogger.com,1999:blog-7767624464875146298.post-8061968897139307502</id><published>2009-09-29T00:03:00.001-04:00</published><updated>2009-09-29T00:12:24.869-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-09-29T00:12:24.869-04:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Ruminations" /><title>To Fail Or Not To Fail; Plus Bonus Ruminations</title><content type="html">&lt;p&gt;A hilarious meme popular in my social group right now is that of the fail. This is inspired by many popular sites, the most notable being &lt;a href="http://failblog.org/"&gt;FailBlog&lt;/a&gt;. a “fail” is an act of failure concluded with the (typically third-party) exclamation “fail”. Some examples:&lt;/p&gt;  &lt;p&gt;While trying to refill a honey bear, I over filled causing quite a mess. Upon seeing my error, a witness is right to proclaim, “Fail!”. This is also increasingly popular in photos. For example, FailBlog is full of sign fails and science fails like these:&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="http://failblog.org/2009/08/30/sports-recognition-fail/"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_IKD9WtY5kxU/SsGG6z9cxEI/AAAAAAAAAho/fKXXO4XBZpM/image%5B10%5D.png?imgmax=800" width="364" height="484" /&gt;&lt;/a&gt;&lt;a href="http://failblog.org/2009/08/28/reflection-fail/"&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://lh5.ggpht.com/_IKD9WtY5kxU/SsGG7qxJkBI/AAAAAAAAAhs/ARyLNNUEVx4/image%5B11%5D.png?imgmax=800" width="504" height="252" /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;But you already know this. Why would I spend so much time defining a fail? Because apparently it’s not so obvious to a certain group of &lt;a href="http://community.babycenter.com/post/a13943225/fail_pictures_stole_from_the_june_board"&gt;BabyCenter moms&lt;/a&gt;. Here are a few Fail fails:&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_IKD9WtY5kxU/SsGG8fhggOI/AAAAAAAAAhw/5fD-aEamP7A/image%5B35%5D.png?imgmax=800" width="362" height="303" /&gt;&lt;/p&gt;  &lt;p&gt;What’s the fail? Are they not girls? Is one of them not yours?&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://lh5.ggpht.com/_IKD9WtY5kxU/SsGG9OdrtdI/AAAAAAAAAh0/1NHeav3fwqQ/image%5B34%5D.png?imgmax=800" width="358" height="478" /&gt; But they &lt;em&gt;do&lt;/em&gt; match. You don’t get how this works…&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://lh3.ggpht.com/_IKD9WtY5kxU/SsGG-Oq90VI/AAAAAAAAAh4/cNvkNlYKMag/image%5B33%5D.png?imgmax=800" width="356" height="517" /&gt;&lt;/p&gt;  &lt;p&gt;Is it because the kid isn’t smiling at your song? Or is this a song lyric grammar fail? Sigh…&lt;/p&gt;  &lt;p&gt;Sometimes, it’s a genuine fail, but needs a much, much shorter title (e.g. “Fail”):&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://lh6.ggpht.com/_IKD9WtY5kxU/SsGG_MfsEhI/AAAAAAAAAh8/fdNJ2DWup38/image%5B32%5D.png?imgmax=800" width="365" height="322" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;The problem is that &lt;strong&gt;a true fail is self evident &lt;/strong&gt;and most of these are not. Adding extra words to the caption should only carefully be done to add an extra punch. &lt;/p&gt;  &lt;p&gt;   &lt;hr /&gt;&lt;/p&gt;  &lt;p&gt;In the spirit of all things fail, here are a few pics I snapped on the way to work recently:&lt;/p&gt;  &lt;p align="center"&gt;&amp;#160;&lt;a href="http://lh5.ggpht.com/_IKD9WtY5kxU/SsGG_qblOSI/AAAAAAAAAiA/YJxbCIKLYh4/s1600-h/200909040745_130%5B4%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="200909040745_130" border="0" alt="200909040745_130" src="http://lh5.ggpht.com/_IKD9WtY5kxU/SsGHANezPKI/AAAAAAAAAiE/qiXc30zY9oI/200909040745_130_thumb%5B10%5D.jpg?imgmax=800" width="644" height="374" /&gt;&lt;/a&gt;&lt;font size="4"&gt;&lt;strong&gt;       &lt;br /&gt;Commute Fail&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p align="center"&gt;&amp;#160;&lt;a href="http://lh4.ggpht.com/_IKD9WtY5kxU/SsGHAkpcYDI/AAAAAAAAAiI/_o7KShaRT6o/s1600-h/200909040745_131%5B5%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="200909040745_131" border="0" alt="200909040745_131" src="http://lh5.ggpht.com/_IKD9WtY5kxU/SsGHBLnHDwI/AAAAAAAAAiM/m-KS-43RgwE/200909040745_131_thumb%5B9%5D.jpg?imgmax=800" width="644" height="471" /&gt;&lt;/a&gt;    &lt;br /&gt;&lt;font size="4"&gt;&lt;strong&gt;Fire Fighting FTW&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;On my way to work the fire truck pulled out in front of me and while I waited at a traffic light, they extinguished the flames shooting out of that car. Good work guys!&lt;/p&gt;  &lt;p&gt;Here’s another encountered while trying to start up a VM on my Windows 7 machine (for those lucky enough to not be familiar with this, it’s the &lt;a href="http://en.wikipedia.org/wiki/Blue_Screen_of_Death"&gt;BSOD&lt;/a&gt;—what you see when your computer decides to suddenly stop working):&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_IKD9WtY5kxU/SsGHBe7dCII/AAAAAAAAAiQ/13Cx6qaWl-I/s1600-h/200909231419_160%5B6%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="200909231419_160" border="0" alt="200909231419_160" src="http://lh5.ggpht.com/_IKD9WtY5kxU/SsGHBzAsxHI/AAAAAAAAAiU/kKgTBPHF0NI/200909231419_160_thumb%5B7%5D.jpg?imgmax=800" width="236" height="244" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;If you want some more funny pics, check out some &lt;a href="http://www.huffingtonpost.com/2009/09/21/the-funniest-protest-sign_n_292342.html"&gt;recent protester signs&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;While I’m dumping photos off my phone, here are some non-fail ruminations.&lt;/p&gt;  &lt;p&gt;Once a year, Starbucks &lt;em&gt;seduces&lt;/em&gt; its coffee loyalists (warning: avoid mental image!):&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_IKD9WtY5kxU/SsGHCBkTkFI/AAAAAAAAAiY/J8S2-MaL_qY/s1600-h/200909121601_152%5B5%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="200909121601_152" border="0" alt="200909121601_152" src="http://lh3.ggpht.com/_IKD9WtY5kxU/SsGHCvTrwNI/AAAAAAAAAic/kCZXzbvA0Vs/200909121601_152_thumb%5B10%5D.jpg?imgmax=800" width="301" height="484" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;And on the other side of the same easel, we’ve got a number of problems. We’re missing an apostrophe, it’s already well after 2pm, and what does that mean about the tax? It’s applicable some places but not here, where I am? &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_IKD9WtY5kxU/SsGHC2hC0pI/AAAAAAAAAig/HPFasge4f0Q/s1600-h/200909121602_153%5B5%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="200909121602_153" border="0" alt="200909121602_153" src="http://lh6.ggpht.com/_IKD9WtY5kxU/SsGHDZW_mWI/AAAAAAAAAik/ZLVNXlSO_QU/200909121602_153_thumb%5B7%5D.jpg?imgmax=800" width="309" height="484" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Impressive hand-writing, though!&lt;/p&gt;  &lt;p&gt;Pictures don’t do this next one justice. It was the saddest water feature I’ve seen in a long time:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/_IKD9WtY5kxU/SsGHDmsEazI/AAAAAAAAAio/bsZ-xpnZxgc/s1600-h/200909090852_142%5B4%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="200909090852_142" border="0" alt="200909090852_142" src="http://lh3.ggpht.com/_IKD9WtY5kxU/SsGHEMK174I/AAAAAAAAAis/NNXDqf33YFA/200909090852_142_thumb%5B2%5D.jpg?imgmax=800" width="364" height="484" /&gt;&lt;/a&gt;&amp;#160; &lt;/p&gt;  &lt;p&gt;Despite its imposing size, it had just one little stream of water which did not do well to cover up the pump or wires powering the thing.&lt;/p&gt;  &lt;p&gt;On to more serious matters: getting busy. Here’s family prevention section at Target:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_IKD9WtY5kxU/SsGHEo4iOlI/AAAAAAAAAiw/p5gf_5jRuY0/s1600-h/200909051417_137%5B4%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="200909051417_137" border="0" alt="200909051417_137" src="http://lh4.ggpht.com/_IKD9WtY5kxU/SsGHE2vTpgI/AAAAAAAAAi0/kjJ0Xrsh-CU/200909051417_137_thumb%5B2%5D.jpg?imgmax=800" width="364" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;A few observations:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The top two shelves are only necessary if something from a lower self has let you down or wasn’t in use&lt;/li&gt;    &lt;li&gt;A purchase from the lower shelves is probably always done with a smile (thus the cool product names)&lt;/li&gt;    &lt;li&gt;Purchases from the top shelves, however, are undoubtedly nervous buys (even if you’re &lt;em&gt;trying &lt;/em&gt;to become pregnant), and thus the professional product names (peeing on a stick never looked so…idk)&lt;/li&gt;    &lt;li&gt;This could be a nice (i.e. hilarious) way to bring up the pregnancy topic with your significant other. Simply peruse the aisle and instead of reaching in for some family prevention, pick up some family detection&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Anyone remember Microsoft Bob? Here’s a kid’s version available today:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_IKD9WtY5kxU/SsGHFe0XE5I/AAAAAAAAAi4/ATQdSXUC3Us/s1600-h/200909071201_140%5B6%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="200909071201_140" border="0" alt="200909071201_140" src="http://lh4.ggpht.com/_IKD9WtY5kxU/SsGHFrr0wxI/AAAAAAAAAi8/dhxYWQTlhYk/200909071201_140_thumb%5B4%5D.jpg?imgmax=800" width="364" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt; And finally, I leave you with something that rarely happens as planned:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_IKD9WtY5kxU/SsGHFyrQ1AI/AAAAAAAAAjA/QPawGoeeMMo/s1600-h/200909141852_156%5B4%5D.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="200909141852_156" border="0" alt="200909141852_156" src="http://lh3.ggpht.com/_IKD9WtY5kxU/SsGHGXbU_zI/AAAAAAAAAjE/igxkVcp2vEA/200909141852_156_thumb%5B2%5D.jpg?imgmax=800" width="644" height="484" /&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/7767624464875146298-8061968897139307502?l=blog.wassupy.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.wassupy.com/feeds/8061968897139307502/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="https://www.blogger.com/comment.g?blogID=7767624464875146298&amp;postID=8061968897139307502" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/8061968897139307502?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7767624464875146298/posts/default/8061968897139307502?v=2" /><link rel="alternate" type="text/html" href="http://blog.wassupy.com/2009/09/to-fail-or-not-to-fail-plus-bonus.html" title="To Fail Or Not To Fail; Plus Bonus Ruminations" /><author><name>Michael Haren</name><uri>http://www.blogger.com/profile/15213283306298286949</uri><email>mharen@gmail.com</email><gd:extendedProperty name="OpenSocialUserId" value="08593184108454837054" /></author><thr:total xmlns:thr="http://purl.org/syndication/thread/1.0">1</thr:total></entry></feed>
