<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6678663096227679678</id><updated>2011-11-27T19:10:14.046-05:00</updated><category term='C#'/><category term='Google APIs'/><category term='invalid character'/><category term='Visual Studio'/><category term='remote debugger'/><category term='Subversion'/><category term='Javascript'/><category term='Database'/><category term='SQL Server'/><category term='components for the 64-bit debugger are not registered'/><category term='Error'/><category term='wix'/><category term='rant'/><category term='ASP.NET'/><category term='Quirks'/><title type='text'>James Schubert's Development Blog</title><subtitle type='html'>This blog is intended to help me keep track of development issues.  I will share things that I find, which may help you.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>35</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-7341374948021014952</id><published>2010-02-13T19:45:00.005-05:00</published><updated>2010-03-11T13:22:17.194-05:00</updated><title type='text'>Google Chrome Extension: New Tab Redirect!  STEP BY STEP</title><content type='html'>Background&lt;br /&gt;
&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;(see &lt;/span&gt;&lt;a bitly="BITLY_PROCESSED" href="http://code.google.com/chrome/extensions/overview.html"&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;http://code.google.com/chrome/extensions/overview.html&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt; for a thorough background of Chrome Extension development)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;A Google Chrome Extension is a mini web application which runs in its own process and can perform actions at a browser-level or page-level. &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;An extension consists (or may consist) of a number of parts:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;manifest.json&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Web files (html, js, css, images)&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;NPAPI Plugins&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;background.html (the long-running process)&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;All of these files are bundled into a package with a .crx file extension.  When uploading your extension to the Google Chrome Extensions Gallery, you only zip up the files your extension needs and Google will package it properly for you.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;The manifest.json file is a file which specifies properties of your extension in JavaScript Object Notation (aka JSON).   For a quick intro to JSON, check out &lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;a bitly="BITLY_PROCESSED" href="http://www.learn-ajax-tutorial.com/Json.cfm"&gt;http://www.learn-ajax-tutorial.com/Json.cfm&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;The Manifest File&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;manifest.json:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: Consolas, "Courier New", Courier, Monospace;
background-color: #ffffff;
/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt; &lt;br /&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;  "name": "New Tab Redirect!",&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;  "description": "Sets a user-specified URL to load in new tabs.",&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;  "version": "0.0.1.109",&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;  "background_page": "background.html",&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;  "options_page":"options.html",&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;  "chrome_url_overrides": {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    "newtab": "redirect.html"&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;  },&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    "permissions": ["tabs"],&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    "icons": {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    "128": "icon128.png",&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    "19":"icon19.png"&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;  }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;(end manifest.json)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;The name, description, version, background_page, and options_page key/value pairs are pretty self-explanatory. &lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;The &lt;b&gt;"chrome_url_overrides" &lt;/b&gt;section is interesting.  As you can see, the value for this entry is itself an object.  This object allows me to override "newtab" with my own page, "redirect.html".  Currently, the chromium team will only allow you to override newtab, however, I anticipate they'll allow you to override other pages in the future.  For a list of url constants used within Chrome, check out the &lt;a bitly="BITLY_PROCESSED" href="http://src.chromium.org/svn/branches/206/src/chrome/common/url_constants.cc"&gt;url_constants.cc&lt;/a&gt; file in the source code repository.  Possible future overrides would be anything that is listed near the end of that file as '&lt;span class="Apple-style-span" style="font-family: monospace; font-size: medium; white-space: pre-wrap;"&gt;const char kChromeUI*Host[]' &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
Back to the file.  "permissions" takes an array of requested permissions.  New Tab Redirect! requires permissions to update tabs.  This is because we're not only redirecting to html web-hosted sites; New Tab Redirect allows you to set web pages, local files, or inherent Chrome pages.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;"icons" specifies the location of the icons your extension will use.  These icons will be displayed in the Gallery and in the Extensions page within Google Chrome&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;b&gt;Remember&lt;/b&gt;:  You must change your version number when updating your publicly hosted extension, or else Chrome won't find a new version and your users will not be updated.&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;b&gt;The Background Page&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;background.html&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: Consolas, "Courier New", Courier, Monospace;
background-color: #ffffff;
/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt; &lt;br /&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &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;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;head&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &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;="text/javascript"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;String.prototype.startsWith = &lt;span class="kwrd"&gt;function&lt;/span&gt;(str){&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; (&lt;span class="kwrd"&gt;this&lt;/span&gt;.indexOf(str) === 0);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt; &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; url = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; newTabId = undefined;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; protocol =  undefined;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;&lt;span class="kwrd"&gt;var&lt;/span&gt; allowedProtocols = [&lt;span class="str"&gt;"http://"&lt;/span&gt;,&lt;span class="str"&gt;"https://"&lt;/span&gt;,&lt;span class="str"&gt;"about:"&lt;/span&gt;,&lt;span class="str"&gt;"file://"&lt;/span&gt;, &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;  &lt;span class="str"&gt;"file:\\", "&lt;/span&gt;file:&lt;span class="rem"&gt;///", "chrome://","chrome-internal://"];&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt; &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;&lt;span class="kwrd"&gt;function&lt;/span&gt; setUrl(url) {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt;(protocolPasses(url) &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;          &amp;amp;&amp;amp; url.length &amp;gt; 8) { &lt;span class="rem"&gt;/* 8 is arbitrary */&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;            &lt;span class="kwrd"&gt;this&lt;/span&gt;.url = url;     &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;        } &lt;span class="kwrd"&gt;else&lt;/span&gt; {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;            protocol = &lt;span class="str"&gt;'http://'&lt;/span&gt;; &lt;span class="rem"&gt;/* force http */&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;            &lt;span class="kwrd"&gt;var&lt;/span&gt; right = url.split(&lt;span class="str"&gt;'://'&lt;/span&gt;)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt;(right != undefined &amp;amp;&amp;amp; right != &lt;span class="kwrd"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; right.length &amp;gt; 1) {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;                &lt;span class="kwrd"&gt;this&lt;/span&gt;.url = protocol + right[1];&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;            } &lt;span class="kwrd"&gt;else&lt;/span&gt; { &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;                &lt;span class="rem"&gt;/* this will redirect to http:// if url is empty */&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;                &lt;span class="kwrd"&gt;this&lt;/span&gt;.url = protocol + url; }    &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;        }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;        localStorage[&lt;span class="str"&gt;"url"&lt;/span&gt;]  = &lt;span class="kwrd"&gt;this&lt;/span&gt;.url;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;        &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;    &lt;span class="kwrd"&gt;function&lt;/span&gt; protocolPasses(url) {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt;(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(url) == &lt;span class="str"&gt;'undefined'&lt;/span&gt; || url == &lt;span class="kwrd"&gt;null&lt;/span&gt;) { &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;false&lt;/span&gt;; }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (url.startsWith(allowedProtocols[3]) &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;            &amp;amp;&amp;amp; !url.startsWith(allowedProtocols[5])) {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;            url.replace(allowedProtocols[3], allowedProtocols[5]);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;        } &lt;span class="kwrd"&gt;else&lt;/span&gt; &lt;span class="kwrd"&gt;if&lt;/span&gt; (url.startsWith(allowedProtocols[4])) {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;            url.replace(allowedProtocols[4], allowedProtocols[5]);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;        }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;        &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;        &lt;span class="kwrd"&gt;for&lt;/span&gt;(&lt;span class="kwrd"&gt;var&lt;/span&gt; p &lt;span class="kwrd"&gt;in&lt;/span&gt; allowedProtocols) {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt;(url.startsWith(allowedProtocols[p])) { &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;true&lt;/span&gt;;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;        }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;false&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;&lt;span class="kwrd"&gt;function&lt;/span&gt; init() {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;   url = localStorage[&lt;span class="str"&gt;"url"&lt;/span&gt;] || &lt;span class="str"&gt;"http://www.facebook.com"&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  48:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;&lt;span class="kwrd"&gt;function&lt;/span&gt; r(tabId) {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  50:  &lt;/span&gt;    chrome.tabs.update(tabId, {&lt;span class="str"&gt;"url"&lt;/span&gt;:&lt;span class="kwrd"&gt;this&lt;/span&gt;.url});&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  51:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  52:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  53:  &lt;/span&gt;chrome.tabs.onUpdated.addListener(&lt;span class="kwrd"&gt;function&lt;/span&gt;(tabId,info,tab) {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  54:  &lt;/span&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (info.status === &lt;span class="str"&gt;'loading'&lt;/span&gt;)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  55:  &lt;/span&gt;        console.log(&lt;span class="str"&gt;'Loading url ... '&lt;/span&gt; + tab.url)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  56:  &lt;/span&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt;(info.status === &lt;span class="str"&gt;'complete'&lt;/span&gt;)&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  57:  &lt;/span&gt;        console.log(&lt;span class="str"&gt;'Finished loading url ... '&lt;/span&gt; + tab.url)&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  58:  &lt;/span&gt;});&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  59:  &lt;/span&gt; &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  60:  &lt;/span&gt;chrome.tabs.onCreated.addListener(&lt;span class="kwrd"&gt;function&lt;/span&gt;(tab) {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  61:  &lt;/span&gt;    newTabId = tab.id&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  62:  &lt;/span&gt;});&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  63:  &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="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  64:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;head&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  65:  &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="attr"&gt;onload&lt;/span&gt;&lt;span class="kwrd"&gt;="init()"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;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;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  66:  &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;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;(end background.html)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;This page is pretty self-explanatory for the most part.  The background page is your long-running process, and is usually used to house any variables that are shared between pages.  However, this isn't a necessity of Chrome Extension architecture.  Every page in an extension can interact with any other page through chrome.extension.getViews()  or chrome.extension.getBackgroundPage() .  Because of the nature of New Tab Redirect, I've used a background page.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;One thing of note is the initialization of the extension.  Since the operation is fairly simple, allowing a user to specify a url and then redirecting to that url, the only thing I need to worry about immediately is the url.  This is stored using HTML 5's local storage.  If the url doesn't exit, I set it to facebook.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;The setUrl function is located in the Background page and is called from options.html.  It is located here so the options page isn't trying to set the url variable that is maintained by the background page.  This function checks my array of allowed protocols and validates the url with some simple rules.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;r(tabId) is the function which actually updates the tab when the protocol isn't an http or https protocol.  The function name is short because the the code in redirect.html should be as concise as possible.  This function calls the chrome.tabs.update method (one culprit behind the tabs permission requirement)&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;That tabId is provided via the redirect.html, which gets the currently created tab's id.  However, again note that this processing only occurs when the url is local.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;b&gt;Options&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;b&gt;&lt;br /&gt;
&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Because the options page is simple html and styles, I'll only include the JavaScript which sets the url.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;options.js&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: Consolas, "Courier New", Courier, Monospace;
background-color: #ffffff;
/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt; &lt;br /&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;String.prototype.startsWith = function(str) {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;    return (this.indexOf(str)===0);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;var chromePages = {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    Extensions : "chrome://extensions/",&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    History : "chrome://history/",&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    Downloads : "chrome://downloads/",&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    NewTab : "chrome-internal://newtab/"&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;var aboutPages = ["about:blank","about:version", "about:plugins","about:cache", &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    "about:memory","about:histograms","about:dns",&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    "chrome://extensions/","chrome://history/",&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    "chrome://downloads/","chrome-internal://newtab/"];&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;var popularPages = { &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;    "Facebook":"www.facebook.com",&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;    "MySpace":"www.myspace.com",&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;    "Twitter":"www.twitter.com",&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;    "Digg":"www.digg.com",&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;    "Delicious":"www.delicious.com",&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;    "Slashdot":"www.slashdot.org"&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;};&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;    &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;// save options to localStorage.&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;function save_options() {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;    var url = $('#custom-url').val();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;    if(url == ""){&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;        url = aboutPages[0];&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;    &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;    if( $.inArray(String(url), aboutPages) || isValidURL(url)) {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;        save(true,url);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;    } else {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;        save(false,url);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;    }        &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt; &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;function save(good,url) {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;    if(good) {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;        chrome.extension.getBackgroundPage().setUrl(url);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;        $('#status').text("Options Saved.");&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;    } else {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;        $('#status').text( url + " is invalid. Try again (http:// is required)");    &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;    &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;    $('#status').css("display", "block");&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;    setTimeout(function(){&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  48:  &lt;/span&gt;        $('#status').slideUp("fast").css("display", "none");&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;    }, 1050);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  50:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  51:  &lt;/span&gt; &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  52:  &lt;/span&gt;// Restores select box state to saved value from localStorage.&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  53:  &lt;/span&gt;function restore_options() {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  54:  &lt;/span&gt;    var url = chrome.extension.getBackgroundPage().url || "http://www.facebook.com/";    &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  55:  &lt;/span&gt;     $('#custom-url').val(url);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  56:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  57:  &lt;/span&gt; &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  58:  &lt;/span&gt;function isValidURL(url) {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  59:  &lt;/span&gt;    var urlRegxp = /^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([\w]+)(.[\w]+){1,2}$/;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  60:  &lt;/span&gt;    if (urlRegxp.test(url) != true) {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  61:  &lt;/span&gt;        return false;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  62:  &lt;/span&gt;    } else {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  63:  &lt;/span&gt;        return true;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  64:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  65:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  66:  &lt;/span&gt; &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  67:  &lt;/span&gt;function saveQuickLink(url){&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  68:  &lt;/span&gt;    var uurl = unescape(url);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  69:  &lt;/span&gt;     $('#custom-url').val(uurl);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  70:  &lt;/span&gt;     save(true,uurl);&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  71:  &lt;/span&gt;     return false;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  72:  &lt;/span&gt;}&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  73:  &lt;/span&gt; &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  74:  &lt;/span&gt;$(document).ready(function(){&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  75:  &lt;/span&gt;    restore_options();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  76:  &lt;/span&gt;    $.each(chromePages, function(k,v) {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  77:  &lt;/span&gt;        var anchor = "&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;"javascript:saveQuickLink('"&lt;/span&gt;+&lt;span class="attr"&gt;v&lt;/span&gt;+&lt;span class="kwrd"&gt;"');\"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;"+k+"&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;&lt;/span&gt;";&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  78:  &lt;/span&gt;        $('#chromes').append("&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;" + anchor + "&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;");&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  79:  &lt;/span&gt;    });&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  80:  &lt;/span&gt;    $.each(aboutPages, function() {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  81:  &lt;/span&gt;        if(this.startsWith("about:")) { /* quick fix to handle chrome pages elsewhere */&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  82:  &lt;/span&gt;            var anchor = "&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;"javascript:saveQuickLink('"&lt;/span&gt;+&lt;span class="attr"&gt;this&lt;/span&gt;+&lt;span class="kwrd"&gt;"');\"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;"+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;&lt;/span&gt;";&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  83:  &lt;/span&gt;            $('#abouts').append("&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;" + anchor + "&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;");&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  84:  &lt;/span&gt;        }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  85:  &lt;/span&gt;    });&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  86:  &lt;/span&gt;    $.each(popularPages, function(k,v) {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  87:  &lt;/span&gt;        var anchor = "&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;"javascript:saveQuickLink('"&lt;/span&gt;+&lt;span class="attr"&gt;v&lt;/span&gt;+&lt;span class="kwrd"&gt;"');\"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;"+k+"&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;&lt;/span&gt;";&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  88:  &lt;/span&gt;        $('#popular').append("&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;" + anchor + "&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;");&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  89:  &lt;/span&gt;    });&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  90:  &lt;/span&gt;});&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;(end options.js)&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;As you can see, I've included jQuery for dom manipulation.  I decided to do this because jQuery is so small and because the Options page can be whatever size you'd like (keeping in mind user experience, of course).  This saved me some time from writing out a little bit of javascript.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Of note here is how I build the lists of Chrome pages, About pages, and Popular pages.  This isn't included in the options.html file, which only has placeholders for the unordered lists.  This allows  me to go in and provide a page name and url for chromePages and popularPages, or just the url for aboutPages.  If I want to add anything in the future, I'll just add a key/value pair (or url) to one of these objects.  If I want to remove, likewise, I only touch the respective object.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Quick links (one from an above-mentioned object) are saved automatically, bypassing the url checking regex.  However, you'll notice in the save_options function that I check first to see if the url is in the list of about pages, this is because a user will most likely enter &lt;b&gt;about:memory&lt;/b&gt; or any valid url, and whould be less likely to enter &lt;b&gt;chrome-internal://newtab/.  &lt;/b&gt;In the future, I will probably add checks on all objects before checking a valid url, but this kind of thing happens in incremental development.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;As you can see, if the user gets to save the url, the function &lt;b&gt;setUrl&lt;/b&gt; from the background page is called via &lt;b&gt;chrome.extension.getBackgroundPage().setUrl(url);  &lt;/b&gt;Following good user interface techniques, we have to let the user know what happened, which is what the next line and the rest of the function accomplishes.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;Note: &lt;/b&gt;The new tab url is &lt;b&gt;chrome-internal://&lt;/b&gt; instead of &lt;b&gt;chrome://&lt;/b&gt;.  Why is this, do you think?  Don't think too hard, though.  It's simple: redirect.html is now &lt;b&gt;chrome://newtab/&lt;/b&gt;, because I've told chrome to override the newtab with my own file.  You can test it out by typing &lt;a bitly="BITLY_PROCESSED" href="chrome://newtab/"&gt;chrome://newtab&lt;/a&gt; into Google Chrome.  Try chrome-internal://newtab and see what happens?  This can only be called internally, hence the name, and must be called from within an extension via chrome.tabs.update.  If you don't use this internal url, when you set the url to chrome://newtab and hit CTRL+T or click the '+' tab, your tab will keep trying to call itself, and eventually stop, after doing nothing meaningful.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Redirect.html&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Finally, the beast that does it all.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;redirect.html&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: Consolas, "Courier New", Courier, Monospace;
background-color: #ffffff;
/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt; &lt;br /&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;!&lt;/span&gt;&lt;span class="html"&gt;DOCTYPE&lt;/span&gt; &lt;span class="attr"&gt;html&lt;/span&gt; &lt;span class="attr"&gt;PUBLIC&lt;/span&gt; &lt;span class="kwrd"&gt;"-//W3C//DTD HTML 4.01 Transitional//EN"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &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;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;head&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;meta&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="generator"&lt;/span&gt; &lt;span class="attr"&gt;content&lt;/span&gt;=&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="kwrd"&gt;"HTML Tidy for Windows (vers 14 February 2006), see www.w3.org"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;      Redirecting...&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &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;="text/javascript"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    &lt;span class="kwrd"&gt;var&lt;/span&gt; wid, tid;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt; &lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    &lt;span class="kwrd"&gt;function&lt;/span&gt; r() {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; url = localStorage[&lt;span class="str"&gt;"url"&lt;/span&gt;] || &lt;span class="str"&gt;""&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (url.toLowerCase().indexOf(&lt;span class="str"&gt;"http:"&lt;/span&gt;) === 0 || &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;            url.toLowerCase().indexOf(&lt;span class="str"&gt;"https:"&lt;/span&gt;) === 0) {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;            document.location.href = url;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;        } &lt;span class="kwrd"&gt;else&lt;/span&gt; {&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;            chrome.windows.getCurrent(&lt;span class="kwrd"&gt;function&lt;/span&gt;(w) {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;                wid = w.id;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;                chrome.tabs.getSelected(wid, &lt;span class="kwrd"&gt;function&lt;/span&gt;(t) {&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;                    tid = t.id;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;                });&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;            });&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;            chrome.extension.getBackgroundPage().r(tid);&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;        }&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;    }&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &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="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;head&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &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="attr"&gt;onload&lt;/span&gt;&lt;span class="kwrd"&gt;="setTimeout('r()',100);r();return false;"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;    Redirecting...&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;br&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;em&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;If your page doesn't load within 5 seconds, &lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;      &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;="javascript:r()"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;click here&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;em&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &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;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &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;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;(end redirect.html)&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;b&gt;Note:&lt;/b&gt; I have run the redirect.html file through HTML Tidy and a JavaScript formatter at &lt;a bitly="BITLY_PROCESSED" href="http://jsbeautifier.org/"&gt;http://jsbeautifier.org/&lt;/a&gt;, but this file should be as compact as possible.  If you were to download New Tab Redirect and look at the source code, you'd see this code is all on one line.   I'm writing this for your enjoyment, though, and one-liners aren't fun to look at.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;The only thing special about this file is the the onload function.  You'll notice how it runs r after 100 ms, then runs it again.  There is quite an odd situation here: Chrome either has to initialize localStorage, doesn't allow us to get the current window and tab id immediately,  or the processing required to do so takes longer than 100ms.  You could, honestly, run the redirect function through a loop until it redirects (considering the &lt;b&gt;document.location.href&lt;/b&gt; will immediately redirect the browser tab.  If the url specified by the user is local, the function gets the current window, and from that the id of the current tab, and passes that to the background page's function.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;I've been asked by a user or two to remove the redirect message, but I'll keep it for now.  I consider a message necessary if, for some reason, a future release of Chrome breaks the extension.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;The current source code for New Tab Redirect can be accessed via your Chrome Extensions directory after installing the extension, and is availing at the &lt;a bitly="BITLY_PROCESSED" href="http://code.google.com/p/newtabredirect/"&gt;New Tab Redirect Project Page&lt;/a&gt; on Google Code.&lt;/span&gt;&lt;br /&gt;
&lt;span class="Apple-style-span" style="font-size: medium;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;If you have any questions or comments about this extension, please contact me.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-7341374948021014952?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/7341374948021014952/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=7341374948021014952' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/7341374948021014952'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/7341374948021014952'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2010/02/google-chrome-extension-new-tab.html' title='Google Chrome Extension: New Tab Redirect!  STEP BY STEP'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-297620942474457948</id><published>2010-02-10T12:43:00.004-05:00</published><updated>2010-02-10T12:49:57.379-05:00</updated><title type='text'>Quickly create a Dictionary using Linq to Objects</title><content type='html'>When working with collections or lists, sometimes you just need to get a simple dictionary.&lt;div&gt;There are a number of ways to do this, but the ToDictionary method seems promising. &lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;For isntance:&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: Consolas, "Courier New", Courier, Monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;IList&amp;lt;Person&amp;gt; people = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;Person&amp;gt;();&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;people.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; Person &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;        FirstName = &lt;span class="str"&gt;"Jim"&lt;/span&gt;, &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;        LastName=&lt;span class="str"&gt;"Schubert"&lt;/span&gt;, &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;        Age=29, &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;        Phone=&lt;span class="str"&gt;"123-333-4444"&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    });&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;people.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; Person &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;        FirstName = &lt;span class="str"&gt;"Joe"&lt;/span&gt;, &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;        LastName=&lt;span class="str"&gt;"Schubert"&lt;/span&gt;, &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;        Age=25, &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;        Phone=&lt;span class="str"&gt;"800-999-1111"&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;    });&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;    &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;Dictionary&amp;lt;&lt;span class="kwrd"&gt;int&lt;/span&gt;,&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; names = people.ToDictionary(k =&amp;gt; k.Age, v =&amp;gt; v.FirstName);&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;br /&gt;&lt;br /&gt;There may not be many uses for this type of syntax, but simple transformations like this make Linq fun.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-297620942474457948?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/297620942474457948/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=297620942474457948' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/297620942474457948'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/297620942474457948'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2010/02/quickly-create-dictionary-using-linq-to.html' title='Quickly create a Dictionary using Linq to Objects'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-6690417969812331833</id><published>2010-01-24T11:36:00.003-05:00</published><updated>2010-01-24T11:47:15.323-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rant'/><title type='text'>Mixing Business Logic and the Presentation Layer... Why do people do it?</title><content type='html'>In .NET Application Architecture Guide, 2nd Edition, the writers explicitly say:&lt;div&gt;
&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;blockquote&gt;&lt;div&gt;&lt;b&gt;Do not mix different types of components in the same logical layer.&lt;/b&gt; Start by identifying different areas of concern, and then group components associated with each area of concern into logical layers. For example, the UI layer should not contain business processing components, but instead should contain components used to handle user input and process user requests.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;This is the standard way of developing today.  However, I've seen time and again where a developer will do ALL of the business logic processing in the presentation layer.  More than merely being annoying, this is wrong for a number of reasons including:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;redundancy in code&lt;/li&gt;&lt;li&gt;"scattered" logic&lt;/li&gt;&lt;li&gt;poor abstraction&lt;/li&gt;&lt;li&gt;data access in the presentation layer&lt;/li&gt;&lt;li&gt;strong-coupling&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;That's just to name a few.  Every time I see this coding snafu occur, I think to myself, "Do  I just not know what I'm doing?"  After all, it's much more seasoned developers doing this.  Then, I remind myself that object-oriented programming has changed dramatically over the past 10 years.  &lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;I can understand some points of view "Too much abstraction is a bad thing!", "Keep the logic as close to where you're using it as possible!", "I don't understand what you mean by &lt;i&gt;business logic.&lt;/i&gt;"  But, ignorance of norms and coding standards doesn't inherently and automagically produce good, clean, scalable code.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;N-tier architecture has now become the norm, but is it too much to ask for some logical layering within a tier?&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-6690417969812331833?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/6690417969812331833/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=6690417969812331833' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/6690417969812331833'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/6690417969812331833'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2010/01/mixing-business-logic-and-presentation.html' title='Mixing Business Logic and the Presentation Layer... Why do people do it?'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-7806544147815289302</id><published>2010-01-06T12:50:00.001-05:00</published><updated>2010-01-06T12:52:17.000-05:00</updated><title type='text'>Free Software Architecture eBooks on MSDN</title><content type='html'>&lt;div&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=ce40e4e1-9838-4c89-a197-a373b2a60df2&amp;amp;displaylang=en"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Microsoft Application Architecture Guide, 2nd Edition&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=3C81C38E-ABFC-484F-A076-CF99B3485754&amp;amp;displaylang=en"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Enterprise Solution Patterns Using Microsoft .NET&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=0D95803A-59D7-46E2-8DFA-01905846AC67&amp;amp;displaylang=en"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Data Access Architecture Guide&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;Found via &lt;/span&gt;&lt;/span&gt;&lt;a href="http://apparchguide.codeplex.com/"&gt;&lt;span class="Apple-style-span"  style="font-family:arial;"&gt;&lt;span class="Apple-style-span" style="font-size: medium;"&gt;http://apparchguide.codeplex.com/&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-7806544147815289302?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/7806544147815289302/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=7806544147815289302' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/7806544147815289302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/7806544147815289302'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2010/01/free-software-architecture-ebooks-on.html' title='Free Software Architecture eBooks on MSDN'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-8460342885428849973</id><published>2009-12-22T16:52:00.002-05:00</published><updated>2009-12-22T16:57:56.056-05:00</updated><title type='text'>UpdatePanel won't AsycPostback for anything.</title><content type='html'>I spent a lot of time today and Friday trying to get my UpdatePanel to be handled properly.  No matter what I did, my asynchronous triggers were only posting back.  I searched and searched, and couldn't find anything.  Then, I ran across a post on asp.net's forum which had the answer.&lt;div&gt;
&lt;blockquote&gt;&amp;lt;xhtmlConformance mode="Legacy"/&gt; :&lt;/blockquote&gt;&lt;blockquote&gt;Change Legacy to Strict or Transitional&lt;/blockquote&gt;
&lt;/div&gt;&lt;div&gt;Don't you love Microsoft?&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;Other things I searched for in order to find this answer:&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;"IsInAsyncPostBack false masterpage", "UpdatePanel only postback", "asp:AsyncPostBackTrigger won't work"&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-8460342885428849973?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/8460342885428849973/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=8460342885428849973' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/8460342885428849973'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/8460342885428849973'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/12/updatepanel-wont-asycpostback-for.html' title='UpdatePanel won&apos;t AsycPostback for anything.'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-9104287420666297116</id><published>2009-12-20T17:08:00.003-05:00</published><updated>2009-12-20T17:12:27.423-05:00</updated><title type='text'>Google Chrome Extension: New Tab Redirect!</title><content type='html'>Thanks to the blizzard this weekend, I've been alone and stuck inside long enough to write an extension for Google Chrome.  It's called "New Tab Redirect!" and it allows you to customize the page displayed when you add a new tab (either with CTRL+T or clicking the (+) in the title bar).&lt;div&gt;
&lt;/div&gt;&lt;div&gt;&lt;p&gt;A cool thing about the extension is that it allows you to specify about: pages, URLs, or local files.&lt;/p&gt;&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;&lt;p&gt;The extension is available in the extension Gallery: &lt;a href="http://bit.ly/info/8oNcya"&gt;http://bit.ly/info/8oNcya&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-9104287420666297116?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/9104287420666297116/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=9104287420666297116' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/9104287420666297116'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/9104287420666297116'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/12/google-chrome-extension-new-tab.html' title='Google Chrome Extension: New Tab Redirect!'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-1572030267138629960</id><published>2009-12-17T11:18:00.003-05:00</published><updated>2009-12-17T11:21:15.714-05:00</updated><title type='text'>jQuery check/uncheck all Checkboxes in ASP.NET</title><content type='html'>For some odd reason, ASP.NET GridView wraps html elements in a span element.  When you apply a CssClass to the asp:CheckBox  for instance,  you will have a span with that class and inside you'll have an input with type=checkbox.  &lt;div&gt;
&lt;/div&gt;&lt;div&gt;So how do you access all of the checkboxes?&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;
&lt;p&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: Consolas, "Courier New", Courier, Monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;            $('.chkAllSelector &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; input:checkbox').click(function() {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;                $('.chkRowSelector &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; input:checkbox').each(&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;                    function(){&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;                        this.checked = $('.chkAllSelector &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; input:checkbox').attr('checked');&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;                    }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;                );&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;            });&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;            $('.chkRowSelector &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; input:checkbox').click(function() {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;            if ($('.chkAllSelector &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; input:checkbox').is(':checked') &amp;amp;&amp;amp; !($(this).is(':checked')))&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;                { $('.chkAllSelector &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; input:checkbox').removeAttr('checked'); }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;            });&lt;/pre&gt;
&lt;/div&gt;
&lt;/p&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-1572030267138629960?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/1572030267138629960/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=1572030267138629960' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/1572030267138629960'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/1572030267138629960'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/12/jquery-checkuncheck-all-checkboxes-in.html' title='jQuery check/uncheck all Checkboxes in ASP.NET'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-2017659109244606445</id><published>2009-12-16T13:01:00.003-05:00</published><updated>2009-12-16T13:08:05.663-05:00</updated><title type='text'>Extending IDataReader</title><content type='html'>&lt;div&gt;&lt;p&gt;I like to access my DataReader objects via column name.  Unfortunately, IDataReader supports getting items via integer indexer.&lt;/p&gt;&lt;/div&gt;
&lt;div&gt;&lt;p&gt;To overcome this *obstacle*, I've written an extension method I'd like to share.  It checks to see whether a column exists and has a value associated with it.&lt;/p&gt;&lt;/div&gt;
&lt;div&gt;&lt;p&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: Consolas, "Courier New", Courier, Monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &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;class&lt;/span&gt; IDataReaderExtension&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;        &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;        &lt;span class="rem"&gt;/// Adds the HasValue property to an IDataReader, which checks based on Column name&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;        &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;        &lt;span class="rem"&gt;/// &amp;lt;param name="reader"&amp;gt;An IDataReader object&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;        &lt;span class="rem"&gt;/// &amp;lt;param name="column"&amp;gt;The string column name&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;        &lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;boolean&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &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;bool&lt;/span&gt; HasValue(&lt;span class="kwrd"&gt;this&lt;/span&gt; IDataReader reader, &lt;span class="kwrd"&gt;string&lt;/span&gt; column)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;        {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (reader.GetSchemaTable().Columns.Contains(column))&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;                &lt;span class="kwrd"&gt;return&lt;/span&gt; reader[column] != &lt;span class="kwrd"&gt;null&lt;/span&gt; || reader[column] != DBNull.Value;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;            &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;                &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;false&lt;/span&gt;;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;        }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;/div&gt;
&lt;/p&gt;&lt;/div&gt;

&lt;div&gt;&lt;p&gt;
In order to use this method, you can now check:
&lt;/p&gt;&lt;/div&gt;

&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: Consolas, "Courier New", Courier, Monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt;(reader.HasValue(&lt;span class="str"&gt;"MY_COLUMN"&lt;/span&gt;))&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    myObject.ColumnInfo = Convert.ToString(reader[&lt;span class="str"&gt;"MY_COLUMN"&lt;/span&gt;]);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-2017659109244606445?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/2017659109244606445/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=2017659109244606445' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/2017659109244606445'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/2017659109244606445'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/12/extending-idatareader.html' title='Extending IDataReader'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-2507653810268135695</id><published>2009-11-04T20:58:00.005-05:00</published><updated>2009-11-04T21:02:16.424-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Error'/><category scheme='http://www.blogger.com/atom/ns#' term='Database'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>Microsoft SQL Server's Database Publishing Wizard BatchParser error</title><content type='html'>&lt;a href="http://download.microsoft.com/download/4/4/D/44DBDE61-B385-4FC2-A67D-48053B8F9FAD/SQLServer2005_XMO_x64.msi"&gt;http://download.microsoft.com/download/4/4/D/44DBDE61-B385-4FC2-A67D-48053B8F9FAD/SQLServer2005_XMO_x64.msi&lt;/a&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;&lt;br&gt;
&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="  color: rgb(48, 51, 45); -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-family:'Segoe UI', 'Microsoft Sans Serif', Arial, Geneva, sans-serif;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;Could not load file or assembly 'Microsoft.SqlServer.BatchParser, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.   Installing the above file will fix this problem on 64-bit machines!&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="  color: rgb(48, 51, 45); -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-family:'Segoe UI', 'Microsoft Sans Serif', Arial, Geneva, sans-serif;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="  color: rgb(48, 51, 45); -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-family:'Segoe UI', 'Microsoft Sans Serif', Arial, Geneva, sans-serif;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="  color: rgb(48, 51, 45); -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; font-family:'Segoe UI', 'Microsoft Sans Serif', Arial, Geneva, sans-serif;"&gt;&lt;span class="Apple-style-span"  style="font-size:medium;"&gt;I remember having a hard time finding the answer to this problem about a year ago, and I just ran into it again. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-2507653810268135695?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://download.microsoft.com/download/4/4/D/44DBDE61-B385-4FC2-A67D-48053B8F9FAD/SQLServer2005_XMO_x64.msi' title='Microsoft SQL Server&apos;s Database Publishing Wizard BatchParser error'/><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/2507653810268135695/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=2507653810268135695' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/2507653810268135695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/2507653810268135695'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/11/microsoft-sql-servers-database.html' title='Microsoft SQL Server&apos;s Database Publishing Wizard BatchParser error'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-5635991118814944144</id><published>2009-11-03T10:56:00.004-05:00</published><updated>2009-11-03T11:01:42.582-05:00</updated><title type='text'></title><content type='html'>&lt;a href="http://datacogs.com/datablogs/archive/2005/01/28/209.aspx"&gt;http://datacogs.com/datablogs/archive/2005/01/28/209.aspx&lt;/a&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;Recently, I converted a project from VS2003 to VS2008.  The conversion deleted a file which wasn't needed in VS2008.  When I tried to "rollback" the source from source control to run in VS2003, it wouldn't rung.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;Taken from the link above:&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"   style="  ;font-family:Verdana, Geneva, Arial, Helvetica, sans-serif;font-size:11px;"&gt;
&lt;div&gt;If you have a project file c:\Inetpub\wwwroot\Folder\fred.csproj then you need a corresponding webinfo file fred.csproj.webinfo.  The contents of the webinfo file looks like this:
&lt;p&gt;
&amp;lt;VisualStudioUNCWeb&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;br&gt;&lt;br&gt;
    &amp;lt;Web URLPath = "http://localhost/Folder/fred.csproj" /&gt;
&lt;br&gt;&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;lt;/VisualStudioUNCWeb&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-5635991118814944144?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/5635991118814944144/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=5635991118814944144' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/5635991118814944144'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/5635991118814944144'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/11/httpdatacogs.html' title=''/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-2284997813637826348</id><published>2009-11-01T21:33:00.003-05:00</published><updated>2009-11-01T21:34:39.278-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Subversion'/><title type='text'>Free Subversion Book by O'Reilly</title><content type='html'>O'Reilly Media has released a free subversion book, located at &lt;a href="http://svnbook.red-bean.com/"&gt;http://svnbook.red-bean.com/&lt;/a&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;It's downloadable as a PDF, single-page HTML and multi-page HTML.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-2284997813637826348?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://svnbook.red-bean.com/' title='Free Subversion Book by O&apos;Reilly'/><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/2284997813637826348/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=2284997813637826348' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/2284997813637826348'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/2284997813637826348'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/11/free-subversion-book-by-oreilly.html' title='Free Subversion Book by O&apos;Reilly'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-7823287191115755164</id><published>2009-08-28T16:26:00.007-04:00</published><updated>2009-08-28T16:48:18.172-04:00</updated><title type='text'>Python 3.0 handles Dictionary differently</title><content type='html'>&lt;style type="text/css"&gt;
div.padded {padding-bottom:3px;margin:2px}
    &lt;/style&gt;
    &lt;div class="padded"&gt;
      I read through Python 3.0 from Developer's Library about 2 months ago. I
      decided to skim through another introductory level book used at &lt;a href=
      "http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-189January--IAP--2008/CourseHome/"&gt;
      MIT&lt;/a&gt; so I could try keeping Python 2.5.x and Python 3.x separate.
    &lt;/div&gt;
    &lt;div class="padded"&gt;
      While reading about Python 3.0, I didn't catch this difference.
      Dictionary processing has changed a little bit in the new version of
      Python.
    &lt;/div&gt;
    &lt;div class="padded"&gt;
      For instance:
    &lt;/div&gt;
    &lt;div class="padded"&gt;
      &lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
      &lt;pre class="csharpcode"&gt;
Python 2.5.x (pg 112 from MIT's reading material):
&lt;span class="kwrd"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; letterCounts = {}
&lt;span class="kwrd"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; for letter in "Mississippi":
letterCounts[letter] = letterCounts.get (letter, 0) + 1
&lt;span class="kwrd"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; letterCounts
{’M’: 1, ’s’: 4, ’p’: 2, ’i’: 4}
&lt;span class="kwrd"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; letterItems = letterCounts.items()
&lt;span class="kwrd"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; letterItems.sort()
&lt;span class="kwrd"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; print letterItems
[(’M’, 1), (’i’, 4), (’p’, 2), (’s’, 4)]
Python 3.1.x:
&lt;span class="kwrd"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; letterCounts = {}
&lt;span class="kwrd"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; for letter in "Mississippi":
letterCounts[letter] = letterCounts.get (letter, 0) + 1
&lt;span class="kwrd"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; letterCounts
{'i': 4, 'p': 2, 's': 4, 'M': 1}
&lt;span class="kwrd"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; letterItems = list(letterCounts.items())
&lt;span class="kwrd"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; letterItems.sort()
&lt;span class="kwrd"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; letterItems
[('M', 1), ('i', 4), ('p', 2), ('s', 4)]
&lt;/pre&gt;
    &lt;/div&gt;
    &lt;div class="padded"&gt;
      This is a slight difference in code. In fact, the Python 3 code will work
      in previous versions. But, if you tried the Python 2.5.x code in Python
      3, you will notice that letterItems can not be sorted. This is because
      "letterItems = letterCounts.items()" returns type: &amp;lt;class
      'dict_items'&amp;gt;
    &lt;/div&gt;
    &lt;div class="padded"&gt;
      An explanation of what is going on can be found &lt;a href=
      "http://www.devx.com/opensource/Article/42353/1763/page/5"&gt;here&lt;/a&gt;.
    &lt;/div&gt;
    &lt;div class="padded"&gt;
      &lt;span class="Apple-style-span" style=
      " border-collapse: collapse; font-family:Arial, Helvetica, sans-serif;font-size:13px;"&gt;
      "Python 3.0 changes &lt;tt&gt;keys()&lt;/tt&gt;, &lt;tt&gt;values()&lt;/tt&gt; and
      &lt;tt&gt;items()&lt;/tt&gt; so they return a lightweight set-like object,
      effectively making them behave like the old&lt;tt&gt;iter*&lt;/tt&gt; methods, and
      removed the &lt;tt&gt;iter*&lt;/tt&gt; methods themselves. In Python 3.0"&lt;/span&gt;
    &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-7823287191115755164?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/7823287191115755164/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=7823287191115755164' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/7823287191115755164'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/7823287191115755164'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/08/python-30-handles-dictionary.html' title='Python 3.0 handles Dictionary differently'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-6837571051313813110</id><published>2009-08-14T01:37:00.002-04:00</published><updated>2009-08-14T01:39:22.585-04:00</updated><title type='text'>Ruby and Python in your script tags!</title><content type='html'>I came across this weeks ago, and I'm surprised I never posted it.  This is a javascript 'framework' to add ruby and python languages in your script tags.  It's a pretty awesome idea.  I haven't really tested it out, but it's worth taking a look at:&lt;div&gt;
&lt;/div&gt;&lt;div&gt;&lt;a href="http://visitmix.com/labs/gestalt/"&gt;http://visitmix.com/labs/gestalt/&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-6837571051313813110?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://visitmix.com/labs/gestalt/' title='Ruby and Python in your script tags!'/><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/6837571051313813110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=6837571051313813110' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/6837571051313813110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/6837571051313813110'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/08/ruby-and-python-in-your-script-tags.html' title='Ruby and Python in your script tags!'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-5148313623540148456</id><published>2009-08-05T01:21:00.006-04:00</published><updated>2009-08-05T01:42:24.416-04:00</updated><title type='text'>Keeping busy with ASP.NET MVC</title><content type='html'>&lt;div&gt;&lt;p&gt;I'm looking for a job in "the worst recession since the great depression" blah blah blah.  It really sucks.&lt;/p&gt;
&lt;/div&gt;&lt;div&gt;&lt;p&gt;To keep busy, I've been doing some 'freelance' work.  I've been trying to expand more into MVC products by deploying a RadiantCMS site in Ruby on Rails and an e-business site I'm developing in ASP.NET MVC.&lt;/p&gt;&lt;/div&gt;&lt;div&gt;&lt;p&gt;I'm liking the entire MVC mantra of &lt;i&gt;keeping it DRY&lt;/i&gt;, or &lt;i&gt;Don't Repeat Yourself&lt;/i&gt;.  I don't know if it's because I've always hated repeating myself and this idea really hits home with me, or if it's just because it's a huge change from what I've encountered professionally and academically.  Whatever it is, I love it.&lt;/p&gt;&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;&lt;p&gt;One thing I love about ASP.NET MVC is it's heavy use of extension methods as "Helpers".  It's easy to go overboard with helpers, but I like them anyway.  One nice thing about them is that if you are like me, and sometimes forget to close some HTML tags, helpers can fix that.&lt;/p&gt;&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;For instance, if you're always writing div tags and adding id and class attributes, you can standardize the procedure with the following two methods (I overloaded them to accept objects just as ASP.NET MVC does):&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;&lt;p&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: Consolas, "Courier New", Courier, Monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;  &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;    &lt;span class="rem"&gt;/// Returns a DIV with specified attributes&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="rem"&gt;/// &amp;lt;param name="helper"&amp;gt;HtmlHelper class to extend&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="rem"&gt;/// &amp;lt;param name="contents"&amp;gt;Contents of the DIV element&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    &lt;span class="rem"&gt;/// &amp;lt;param name="htmlAttributes"&amp;gt;Attributes to apply to the DIV element&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    &lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;string&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &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; Div(&lt;span class="kwrd"&gt;this&lt;/span&gt; HtmlHelper helper, &lt;span class="kwrd"&gt;string&lt;/span&gt; contents, &lt;span class="kwrd"&gt;object&lt;/span&gt; htmlAttributes)&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; Div(helper, contents, &lt;span class="kwrd"&gt;new&lt;/span&gt; RouteValueDictionary(htmlAttributes));&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;    &lt;span class="rem"&gt;/// Returns a DIV with specified attributes&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;    &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;    &lt;span class="rem"&gt;/// &amp;lt;param name="helper"&amp;gt;HtmlHelper class to extend&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;    &lt;span class="rem"&gt;/// &amp;lt;param name="contents"&amp;gt;Contents of the DIV elemtn&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;    &lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;string&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &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; Div(&lt;span class="kwrd"&gt;this&lt;/span&gt; HtmlHelper helper, &lt;span class="kwrd"&gt;string&lt;/span&gt; contents, &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;        IDictionary&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;, &lt;span class="kwrd"&gt;object&lt;/span&gt;&amp;gt; htmlAttributes)&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;        TagBuilder tagBuilder = &lt;span class="kwrd"&gt;new&lt;/span&gt; TagBuilder(&lt;span class="str"&gt;"div"&lt;/span&gt;)&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;        {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;             InnerHtml = contents.NewlineToHtmlBreak() ?? &lt;span class="kwrd"&gt;string&lt;/span&gt;.Empty&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;        };&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt;(htmlAttributes != &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;        {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;            tagBuilder.MergeAttributes(htmlAttributes);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;        }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; tagBuilder.ToString();&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;div&gt;this allows you to do the following in a View:&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;&lt;p&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: Consolas, "Courier New", Courier, Monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&amp;lt;%= Html.Div(&lt;span class="str"&gt;"&amp;lt;p&amp;gt;This is content in left_box and helper method&amp;lt;/p&amp;gt;"&lt;/span&gt;, &lt;span class="kwrd"&gt;new&lt;/span&gt; {@&lt;span class="kwrd"&gt;class&lt;/span&gt;=&lt;span class="str"&gt;"left_box"&lt;/span&gt;}) %&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;&lt;p&gt;You could, of course, call the methods Tag and pass in the string value of the tag to create, eg. a, div, p, em, etc.  Then, you would have a fairly generic helper to standardize all of your tags!&lt;/p&gt;&lt;/div&gt;
&lt;div&gt;&lt;p&gt;Even the NewlineToHtmlBreak method on String class is an extension method which calls String.Replace(Environment.Newline, "&amp;lt;br /&amp;gt;") on the string input.  I've done this because it's easier/faster to rely on Intellisense to hit .n+TAB than to type out the entire method.  Like I said, it is very easy to go overboard with Helpers!&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-5148313623540148456?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/5148313623540148456/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=5148313623540148456' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/5148313623540148456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/5148313623540148456'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/08/keeping-busy-with-aspnet-mvc.html' title='Keeping busy with ASP.NET MVC'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-563825952501221364</id><published>2009-07-08T15:04:00.003-04:00</published><updated>2009-07-08T15:08:20.794-04:00</updated><title type='text'>Job Hunting</title><content type='html'>Now that I've graduated from VCU, it's time to find a job.   My wife and I started this year with plans to move out of state, but things came up and we've decided to stay in the area.  That decision came a little too late, and I passed up on a couple of really good opportunities.  I currently have a few prospects.&lt;div&gt;
&lt;/div&gt;&lt;div&gt;If anyone hears of any openings for an Application Developer/System Engineer, send the info my way.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-563825952501221364?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/563825952501221364/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=563825952501221364' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/563825952501221364'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/563825952501221364'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/07/job-hunting.html' title='Job Hunting'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-289991617347636938</id><published>2009-06-17T18:38:00.024-04:00</published><updated>2009-10-30T23:58:47.028-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='Google APIs'/><title type='text'>Quake Tracker using Google Maps API v3 and XML/Atom feed</title><content type='html'>&lt;div&gt;&lt;a href="http://www.ipreferjim.com/maps/quakes.html"&gt;http://www.ipreferjim.com/maps/quakes.html&lt;/a&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;For this, I used the following:&lt;div&gt;&lt;ul&gt;&lt;li&gt;Google Maps API v3 (&lt;a href="http://code.google.com/apis/maps/documentation/v3/"&gt;http://code.google.com/apis/maps/documentation/v3/&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;jQuery v1.3.2 (&lt;a href="http://jquery.com/"&gt;http://jquery.com/&lt;/a&gt;)&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;First, you will need to include the google maps api in your header:&lt;/div&gt;&lt;div&gt;&lt;blockquote&gt;&amp;lt;script src="http://maps.google.com/maps/api/js?sensor=true" type="text/javascript"&amp;gt;&lt;/blockquote&gt;This line of code is slightly different from the v2 API because an API key isn't needed.  This will probably change in the near future.  It is also necessary to load jQuery, which can be done by downloading it from the above link, or loading it via Google's AJAX API.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;When the document is ready:&lt;/div&gt;&lt;div&gt;
&lt;p&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: Consolas, "Courier New", Courier, Monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;
&lt;/p&gt;&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="rem"&gt;// init map&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;var map;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;$(document).ready(function(){&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;  var latlng = &lt;span class="kwrd"&gt;new&lt;/span&gt; google.maps.LatLng(35.6802, -121.1165);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;  var myOptions = {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;     zoom: 3,&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    center: latlng,&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    mapTypeControl: &lt;span class="kwrd"&gt;true&lt;/span&gt;,&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    navigationControl: &lt;span class="kwrd"&gt;true&lt;/span&gt;,&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    mapTypeId: google.maps.MapTypeId.SATELLITE&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    };&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;  map = &lt;span class="kwrd"&gt;new&lt;/span&gt; google.maps.Map(document.getElementById(&lt;span class="str"&gt;"map"&lt;/span&gt;), myOptions);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;});&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/div&gt;&lt;div&gt;When the map is ready:&lt;/div&gt;&lt;div&gt;
&lt;p&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: Consolas, "Courier New", Courier, Monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;
&lt;/p&gt;&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="rem"&gt;// SEE : http://www.xml.com/pub/a/2007/10/10/jquery-and-xml.html&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;$(&lt;span class="str"&gt;'#map'&lt;/span&gt;).ready(function(){&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;  $.ajax({&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    type: &lt;span class="str"&gt;"GET"&lt;/span&gt;,&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    url: &lt;span class="str"&gt;"getxml.php?q=http://www.earthquake.usgs.gov/eqcenter/catalogs/7day-M2.5.xml"&lt;/span&gt;,&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    dataType: &lt;span class="str"&gt;"xml"&lt;/span&gt;,&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    success: function(xml){&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;            $(xml).find(&lt;span class="str"&gt;'entry'&lt;/span&gt;).each(function(){&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;                &lt;span class="rem"&gt;// Retrieve all needed values from XML&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;                var title = $(&lt;span class="kwrd"&gt;this&lt;/span&gt;).find(&lt;span class="str"&gt;'title'&lt;/span&gt;).text();&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;                var updated = $(&lt;span class="kwrd"&gt;this&lt;/span&gt;).find(&lt;span class="str"&gt;'updated'&lt;/span&gt;).text();&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;                var link = $(&lt;span class="kwrd"&gt;this&lt;/span&gt;).find(&lt;span class="str"&gt;'link'&lt;/span&gt;).text();&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;                var summary = $(&lt;span class="kwrd"&gt;this&lt;/span&gt;).find(&lt;span class="str"&gt;'summary'&lt;/span&gt;).text();&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;                var coord = $(&lt;span class="kwrd"&gt;this&lt;/span&gt;).find(&lt;span class="str"&gt;'georss\\:point'&lt;/span&gt;).eq(0).text();&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;                &lt;span class="kwrd"&gt;if&lt;/span&gt;(!coord){var coord = $(&lt;span class="kwrd"&gt;this&lt;/span&gt;).find(&lt;span class="str"&gt;'point'&lt;/span&gt;).text();};&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;                var points = coord.split(&lt;span class="str"&gt;' '&lt;/span&gt;);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;                var latitude = parseFloat(points[0]);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;                var longitude = parseFloat(points[1]);    &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;                var elev = $(&lt;span class="kwrd"&gt;this&lt;/span&gt;).find(&lt;span class="str"&gt;'georss\\:elev'&lt;/span&gt;).eq(0).text();&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;                &lt;span class="kwrd"&gt;if&lt;/span&gt;(!elev){var elev = $(&lt;span class="kwrd"&gt;this&lt;/span&gt;).find(&lt;span class="str"&gt;'elev'&lt;/span&gt;).text();};&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;                var htmlString = &lt;span class="str"&gt;"&amp;lt;b&amp;gt;"&lt;/span&gt; + title + &lt;span class="str"&gt;"&amp;lt;/b&amp;gt;"&lt;/span&gt; + &lt;span class="str"&gt;"&amp;lt;p&amp;gt;"&lt;/span&gt; + summary + &lt;span class="str"&gt;"&amp;lt;br&amp;gt;"&lt;/span&gt;;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;                &lt;span class="rem"&gt;// create a marker&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;                var myLatlng = &lt;span class="kwrd"&gt;new&lt;/span&gt; google.maps.LatLng(latitude,longitude);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;                    var marker = &lt;span class="kwrd"&gt;new&lt;/span&gt; google.maps.Marker(&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;                    {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;                        position: myLatlng,&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;                        map: map,&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;                        title: title&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;                    });&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;                &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;                    addMarkerBubble(marker, map, htmlString);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;                    &lt;span class="rem"&gt;// Show output below map&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;                    $(&lt;span class="str"&gt;'&amp;lt;li&amp;gt;&amp;lt;/li&amp;gt;'&lt;/span&gt;)&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;                        .html(title + &lt;span class="str"&gt;' (updated: '&lt;/span&gt; + updated + &lt;span class="str"&gt;') at '&lt;/span&gt; + points[0] + &lt;span class="str"&gt;', '&lt;/span&gt; + points[1])&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;                        .appendTo(&lt;span class="str"&gt;'#output'&lt;/span&gt;);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;            });&lt;span class="rem"&gt;// end each&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;        }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;    }); &lt;span class="rem"&gt;// end $.ajax&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;});&lt;span class="rem"&gt;// end function&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;function addMarkerBubble(marker, map, message){    &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;    &lt;span class="rem"&gt;// set balloon&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;    var infowindow = &lt;span class="kwrd"&gt;new&lt;/span&gt; google.maps.InfoWindow(&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;          content: message,&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;      size: &lt;span class="kwrd"&gt;new&lt;/span&gt; google.maps.Size(400,200)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  48:  &lt;/span&gt;    });        &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;    &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  50:  &lt;/span&gt;    &lt;span class="rem"&gt;// add listener to marker&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  51:  &lt;/span&gt;    google.maps.&lt;span class="kwrd"&gt;event&lt;/span&gt;.addListener(marker, &lt;span class="str"&gt;'click'&lt;/span&gt; ,function(){&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  52:  &lt;/span&gt;        infowindow.open(map,marker);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  53:  &lt;/span&gt;    });&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  54:  &lt;/span&gt;};&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div&gt;
Explanations:
&lt;/div&gt;
&lt;div&gt;First of all, I create a global variable called map, so I can use it in each function.&lt;/div&gt;
&lt;div&gt;Then, when the document is ready, I get a geographic coordinate which Google Maps builds from  maps.LatLng.  This coordinate is in California, because I know there are quakes there.&lt;/div&gt;
&lt;div&gt;Next, I've set a number of options (lines 6-12) for the map including:&lt;/div&gt;
&lt;div&gt;&lt;ul&gt;&lt;li&gt;zoom level&lt;/li&gt;&lt;li&gt;map center&lt;/li&gt;&lt;li&gt;a control to allow user to change the look of the map&lt;/li&gt;&lt;li&gt;a control to allow user to change zoom&lt;/li&gt;&lt;li&gt;default map type of "SATELLITE", which shows tectonic regions&lt;/li&gt;&lt;/ul&gt;
&lt;div&gt;The Google Maps API v3 makes it very easy to supply these options to the Map constuctor, as you can see on line 15 of the first code snippet.   The map is loaded into the DOM object supplied as the first parameter in the constructor.&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;The next snippet is the AJAX call to retrieve the feed and build the markers and info windows when the GET succeeds.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;Inside the function call, I've used jQuery's simplified DOM access for the returned XML.  On line 9 of this snippet, I find each 'entry' node and then iterate over each of these nodes to find the text of each node value. &lt;/div&gt;&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;On lines 15-16 and 20-21, I check the variables because some browsers properly process namespaced nodes and some don't.  This simple check allows the application to display properly in Chrome, Safari, Firefox, and Internet Explorer.&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;&lt;div&gt;Next, I create a marker on the map at the given coordinate and give it a title (tooltip).&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;On line 32, I call the function 'addMarkerBubble' to create an info window and add the event to the map.   After this, I add the title and updated date to a div element below the map.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-289991617347636938?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.ipreferjim.com/maps/quakes.html' title='Quake Tracker using Google Maps API v3 and XML/Atom feed'/><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/289991617347636938/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=289991617347636938' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/289991617347636938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/289991617347636938'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/06/quake-tracker-using-google-maps-api-v3.html' title='Quake Tracker using Google Maps API v3 and XML/Atom feed'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-6890069524788283089</id><published>2009-06-16T21:21:00.006-04:00</published><updated>2009-06-16T21:42:09.604-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Javascript'/><title type='text'>JavaScript &amp; CSS Modal Loading DIV</title><content type='html'>Things I've used in this:&lt;div&gt;&lt;ul&gt;&lt;li&gt;Prototype Javascript (&lt;a href="http://prototypejs.org/"&gt;http://prototypejs.org/&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;Loading image (&lt;a href="http://www.ajaxload.info/"&gt;http://www.ajaxload.info/&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;Script &amp;amp; CSS&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;What I do here is build a DIV element and show it on the page while Prototype's Ajax Request object is loading.  Then, when the Request is finished, the DIV is removed from the document.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;&lt;br&gt;Here is the script necessary to make a request and build/show/remove the DIV.&lt;br&gt;&lt;/div&gt;
&lt;div&gt;&lt;br&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: Consolas, "Courier New", Courier, Monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="rem"&gt;/** Main.js&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="rem"&gt; * @author Jim Schubert&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="rem"&gt; * (c) 2009&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="rem"&gt; */&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;function showContent(file){&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    var content = &lt;span class="kwrd"&gt;new&lt;/span&gt; Ajax.Request(file,&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;        {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;            method:&lt;span class="str"&gt;'get'&lt;/span&gt;,&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;            onLoading: showLoading(),&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;            onSuccess: function(request)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;            {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;                var contentDIV = document.getElementById(&lt;span class="str"&gt;'content'&lt;/span&gt;);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;                contentDIV.innerHTML = &lt;span class="str"&gt;""&lt;/span&gt;;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;                contentDIV.innerHTML = request.responseText;    &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;                &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;                closeLoading();                        &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;            },&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;            onFailure: function(){ alert(&lt;span class="str"&gt;'Cannot process your request.'&lt;/span&gt;);}&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;            &lt;span class="rem"&gt;// onComplete: closeLoading()&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;        });&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;};&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;function onImgError(source) {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;  source.src = &lt;span class="str"&gt;"img/img_error.png"&lt;/span&gt;;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;  &lt;span class="rem"&gt;// disable onerror to prevent endless loop&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;  source.onerror = &lt;span class="str"&gt;""&lt;/span&gt;;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;  &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;true&lt;/span&gt;;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;};        &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;function showLoading() {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;    &lt;span class="rem"&gt;// create div element&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;    var overlayDIV = document.createElement(&lt;span class="str"&gt;'div'&lt;/span&gt;);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;    var loadingDIV = document.createElement(&lt;span class="str"&gt;'div'&lt;/span&gt;);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;    overlayDIV.setAttribute(&lt;span class="str"&gt;'id'&lt;/span&gt;, &lt;span class="str"&gt;'overlay'&lt;/span&gt;);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;    overlayDIV.setAttribute(&lt;span class="str"&gt;'class'&lt;/span&gt;, &lt;span class="str"&gt;'overlay'&lt;/span&gt;);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;    overlayDIV.style.visibility = &lt;span class="str"&gt;'visible'&lt;/span&gt;;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;    &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;    loadingDIV.setAttribute(&lt;span class="str"&gt;'id'&lt;/span&gt;, &lt;span class="str"&gt;'loading'&lt;/span&gt;);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;    loadingDIV.setAttribute(&lt;span class="str"&gt;'class'&lt;/span&gt;, &lt;span class="str"&gt;'modalPopup'&lt;/span&gt;);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;    loadingDIV.innerHTML = &lt;span class="str"&gt;'&amp;lt;center&amp;gt;&amp;lt;img src="img/ajax-loader.gif"&amp;gt;&amp;lt;br&amp;gt;Loading...&amp;lt;/center&amp;gt;'&lt;/span&gt;;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;        &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;    overlayDIV.appendChild(loadingDIV);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;    var content = document.getElementById(&lt;span class="str"&gt;'bodyDocument'&lt;/span&gt;);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (content) {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;        content.appendChild(overlayDIV);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;        var overlay = document.getElementById(&lt;span class="str"&gt;'overlay'&lt;/span&gt;);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  48:  &lt;/span&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (overlay) {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;            overlay.style.visibility = &lt;span class="str"&gt;'visible'&lt;/span&gt;;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  50:  &lt;/span&gt;            overlay.style.height = &lt;span class="str"&gt;'100%'&lt;/span&gt;;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  51:  &lt;/span&gt;        }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  52:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  53:  &lt;/span&gt;    &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  54:  &lt;/span&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;true&lt;/span&gt;;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  55:  &lt;/span&gt;};&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  56:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  57:  &lt;/span&gt;function closeLoading(){&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  58:  &lt;/span&gt;    var overlayDIV = document.getElementById(&lt;span class="str"&gt;'overlay'&lt;/span&gt;);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  59:  &lt;/span&gt;    var loadingDIV = document.getElementById(&lt;span class="str"&gt;'loading'&lt;/span&gt;);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  60:  &lt;/span&gt;    &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  61:  &lt;/span&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (overlayDIV) {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  62:  &lt;/span&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (loadingDIV) {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  63:  &lt;/span&gt;            overlayDIV.removeChild(loadingDIV);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  64:  &lt;/span&gt;            document.getElementById(&lt;span class="str"&gt;'bodyDocument'&lt;/span&gt;).removeChild(overlayDIV);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  65:  &lt;/span&gt;        }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  66:  &lt;/span&gt;        &lt;span class="rem"&gt;// else {alert("can't find loadingDIV")}&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  67:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  68:  &lt;/span&gt;    &lt;span class="rem"&gt;// else{ alert("Can't find overlay.");}&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  69:  &lt;/span&gt;    &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  70:  &lt;/span&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;true&lt;/span&gt;;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  71:  &lt;/span&gt;};&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;div&gt;&lt;br&gt;Here is the stylesheet needed to make the dialog "modal".&lt;br&gt;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: Consolas, "Courier New", Courier, Monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;.overlay {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;    visibility: hidden;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    position: absolute;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    left: 0px;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    top: 0px;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    width:100%;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    height:100%;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    text-align:center;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    z-index: 1000;    &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    filter:alpha(opacity=70) !important;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    opacity:0.8 !important;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;    elevation:above !important;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;    &lt;span class="rem"&gt;/* background-color:Gray !important; */&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;    background-image: url(../img/overlay.png);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;}&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;.modalPopup &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;{&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;    display: block;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;    margin-left: auto;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;    margin-right: auto;    &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;    width:180px;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;    margin: 100px auto;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;    background-color:#F1F1F1 !important;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;    border:1px solid #000;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;    padding:15px;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;    text-align:center;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;    elevation:above !important;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;&lt;br&gt;
In order to use this code, you'll have to give your body tag an id of 'bodyDocument', and the div tag to receive your ajax request should be called 'content'.
&lt;br&gt;
I've also included an image error detecting script, which replaces broken images with a default image.  Unfortunately, if you're trying to produce 100% compliant HTML documents, this won't be compliant unless you're using HTML5.
In order to use this, you'll have to do something like &amp;lt;img src='asdf.gif' onerror='javascript:onImgError(this)' alt='image'&amp;gt;&lt;br&gt;
I've left some code commented out, which will help in debugging your efforts. And, in the stylesheet, you have the option of using a flat background instead of a PNG with transparency.
&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-6890069524788283089?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/6890069524788283089/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=6890069524788283089' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/6890069524788283089'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/6890069524788283089'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/06/javascript-css-modal-loading-div.html' title='JavaScript &amp; CSS Modal Loading DIV'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-3683603693566755017</id><published>2009-05-18T00:43:00.004-04:00</published><updated>2009-05-18T00:49:39.434-04:00</updated><title type='text'>Example Ruby code</title><content type='html'>&lt;p&gt;I decided to do some of those Facebook puzzles in Ruby. I won't post everything I do, because I would consider that cheating (after all, you can win prizes!).
&lt;/p&gt;
&lt;p&gt;
However, considering this is a very simple script, and I'm doing it more for learning Ruby than to enter into Facebook's puzzles, I will post this one.
&lt;/p&gt;
&lt;p&gt;
This is the first puzzle, called Hoppity Hop:
&lt;/p&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;pre class="csharpcode"&gt;
&lt;span class="kwrd"&gt;private&lt;/span&gt;
@file_exists = &lt;span class="kwrd"&gt;false&lt;/span&gt;
def get_integer(filename)
    &lt;span class="kwrd"&gt;if&lt;/span&gt; File::exists?(filename)
        file = File.open(filename) 
        line = file.gets.strip!
        file.close
        @file_exists = &lt;span class="kwrd"&gt;true&lt;/span&gt;
        &lt;span class="kwrd"&gt;return&lt;/span&gt; line.to_i
    &lt;span class="kwrd"&gt;else&lt;/span&gt;
        @file_exists = &lt;span class="kwrd"&gt;false&lt;/span&gt;
        &lt;span class="kwrd"&gt;return&lt;/span&gt; 0 #zero files present
    end
end

def get_string(num)
    &lt;span class="kwrd"&gt;if&lt;/span&gt;(num%3 == 0 &amp;amp;&amp;amp; num%5 == 0)
        print &lt;span class="str"&gt;"Hop\n"&lt;/span&gt;
    elsif num%3 == 0
        print &lt;span class="str"&gt;"Hoppity\n"&lt;/span&gt;
    elsif num%5 == 0
        print &lt;span class="str"&gt;"Hophop\n"&lt;/span&gt;
    &lt;span class="kwrd"&gt;else&lt;/span&gt;
        &lt;span class="kwrd"&gt;return&lt;/span&gt; #nothing
    end    
end

def hip_hop(arg)
    num = get_integer(arg)
    &lt;span class="kwrd"&gt;if&lt;/span&gt;(num &amp;gt; 0 &amp;amp;&amp;amp; @file_exists)        
        &lt;span class="kwrd"&gt;for&lt;/span&gt; i &lt;span class="kwrd"&gt;in&lt;/span&gt; 1..num.to_i
            get_string(i)
        end
    &lt;span class="kwrd"&gt;else&lt;/span&gt;
        puts &lt;span class="str"&gt;"File not found"&lt;/span&gt;
    end
end

&lt;span class="kwrd"&gt;public&lt;/span&gt;

arg = ARGV[0].to_s # &lt;span class="kwrd"&gt;this&lt;/span&gt; &lt;span class="kwrd"&gt;is&lt;/span&gt; the name of the file
&lt;span class="kwrd"&gt;if&lt;/span&gt;(/\D/ =~ arg)
    puts &lt;span class="str"&gt;"Please enter a positive integer as the filename."&lt;/span&gt;
&lt;span class="kwrd"&gt;else&lt;/span&gt;
    unless arg == nil
        hip_hop(arg)
    end
end&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-3683603693566755017?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/3683603693566755017/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=3683603693566755017' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/3683603693566755017'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/3683603693566755017'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/05/example-ruby-code.html' title='Example Ruby code'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-2882511528833370424</id><published>2009-05-09T18:06:00.004-04:00</published><updated>2009-05-09T18:13:00.062-04:00</updated><title type='text'>Ruby on Rails, Aptana Studio</title><content type='html'>This weekend, I decided to give Ruby on Rails a go, considering I just finished school and I'll have plenty of free time to explore.&lt;div&gt;
I downloaded &lt;a href="http://www.aptana.com/studio/download"&gt;Aptana Studio&lt;/a&gt; and installed Ruby, Rails, PHP, and a few extra ruby gems for fun.  Then, I went over to the &lt;a href="http://guides.rails.info/getting_started.html"&gt;Rails Guide&lt;/a&gt; to follow along and do some learnin'.  At the end of the guide, I ran the completed blog application and received errors.  A little googling helped me find &lt;a href="http://railsforum.com/viewtopic.php?id=27456"&gt;the solution&lt;/a&gt;.&lt;div&gt;
Apparently, Aptana doesn't install the latest build of gems from its repositories, and the guide was written for the newest version.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;As noodlygod writes on the forum linked above:
&lt;blockquote&gt;Hello, I just thought I'd post something as I had the same problem on Windows.&lt;/blockquote&gt;&lt;blockquote&gt;
I tried running the command "gem install rails --source http://gem.rubyonrails.org" but I received the error: "actionpack requires rack (&gt;= 0.9.0, runtime)"&lt;/blockquote&gt;&lt;blockquote&gt;
So I ran "gem install rack" which installed something
And then "gem install rails --source http://gem.rubyonrails.org" and it installed 2.3.0 just fine.&lt;/blockquote&gt;&lt;blockquote&gt;
Based on this post: http://railsforum.com/viewtopic.php?pid=89050
I also changed my rails version in environment.rb to "2.3.0" and renamed "application.rb" to "application_controller.rb" and everything is working. Thanks a bunch for the info!&lt;/blockquote&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-2882511528833370424?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/2882511528833370424/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=2882511528833370424' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/2882511528833370424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/2882511528833370424'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/05/ruby-on-rails-aptana-studio.html' title='Ruby on Rails, Aptana Studio'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-3797921621668877507</id><published>2009-04-30T22:40:00.003-04:00</published><updated>2009-04-30T22:50:50.403-04:00</updated><title type='text'>Useful Serialization Methods of LINQ to SQL objects</title><content type='html'>I am just going through a project for my senior "Projects in Information Systems" class, commenting most of the complex logic.  I came across these two methods I wrote to serialze LINQ to SQL objects.  They came in pretty handy, so I thought I'd share even though they don't have error-handling.  I'm not too embarrassed. &lt;div&gt;
&lt;/div&gt;&lt;div&gt;The way I used them was pretty ghetto, I was having troubles getting the objects I needed to serialize to be used in a Session object (I thnk it had something to do with an Order_Details table having two foreign keys to the same table, Ledger, for an IN and OUT field).  Anyway, I serialed the object to XML and just stored the whole string into a listBox's value.  I know that's begging for poor performance, and overriding the data validation checks is opening the ASP.NET page up for security issues, but the only people who are going to use this are me and my instructor.  So, it was a quick work around. I could have stored it in a Session Object as a string, but then I would have had to call some funky work around for the listBox.  Anyway, enough about that.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;

&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: Consolas, "Courier New", Courier, Monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;        &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;        &lt;span class="rem"&gt;/// Serializes a LINQ object to an XML string&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;        &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;        &lt;span class="rem"&gt;/// &amp;lt;typeparam name="T"&amp;gt;Type of the Object&amp;lt;/typeparam&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;        &lt;span class="rem"&gt;/// &amp;lt;param name="linqObject"&amp;gt;The LINQ object to convert&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;        &lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;string&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &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; SerializeLINQtoXML&amp;lt;T&amp;gt;(T linqObject)&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;        {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;            &lt;span class="rem"&gt;// see http://msdn.microsoft.com/en-us/library/bb546184.aspx&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;            DataContractSerializer dcs = &lt;span class="kwrd"&gt;new&lt;/span&gt; DataContractSerializer(linqObject.GetType());&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;            StringBuilder sb = &lt;span class="kwrd"&gt;new&lt;/span&gt; StringBuilder();&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;            XmlWriter writer = XmlWriter.Create(sb);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;            dcs.WriteObject(writer, linqObject);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;            writer.Close();&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; sb.ToString();&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;        }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;        &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;        &lt;span class="rem"&gt;/// Deserializes an XML string to a LINQ object&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;        &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;        &lt;span class="rem"&gt;/// &amp;lt;typeparam name="T"&amp;gt;The type of the LINQ Object&amp;lt;/typeparam&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;        &lt;span class="rem"&gt;/// &amp;lt;param name="input"&amp;gt;XML input&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;        &lt;span class="rem"&gt;/// &amp;lt;returns&amp;gt;Type of the LINQ Object&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; T DeserializeLINQfromXML&amp;lt;T&amp;gt;(&lt;span class="kwrd"&gt;string&lt;/span&gt; input)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;        {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;            DataContractSerializer dcs = &lt;span class="kwrd"&gt;new&lt;/span&gt; DataContractSerializer(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(T));&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;            TextReader treader = &lt;span class="kwrd"&gt;new&lt;/span&gt; StringReader(input);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;            XmlReader reader = XmlReader.Create(treader);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;            T linqObject = (T)dcs.ReadObject(reader, &lt;span class="kwrd"&gt;true&lt;/span&gt;);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;            reader.Close();&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; linqObject;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;        }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-3797921621668877507?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/3797921621668877507/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=3797921621668877507' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/3797921621668877507'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/3797921621668877507'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/04/useful-serialization-methods-of-linq-to.html' title='Useful Serialization Methods of LINQ to SQL objects'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-8935398552155066902</id><published>2009-04-25T15:34:00.004-04:00</published><updated>2009-04-25T15:50:14.275-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Quirks'/><title type='text'>Storing Generics in ASP.NET Profile object</title><content type='html'>&lt;div&gt;Sometimes, I'll come across a problem that I research for an hour or two.  When I find the solution, I think "Wow, that should have been the first thing I tried!"
&lt;/div&gt;&lt;div&gt;This is one of those occasions. &lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;&lt;br&gt;I decided to use the ASP.NET profile instead of Session objects to store a list of products.  So, in web.config, I tried a number of "work-arounds" that I found online, including:&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;&lt;p&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;

&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;profile&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;...&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;properties&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="RecentlyViewed"&lt;/span&gt; &lt;span class="attr"&gt;allowAnonymous&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="System.Collections.Generic.List`1[Model.Product]"&lt;/span&gt; &lt;span class="attr"&gt;serializeAs&lt;/span&gt;&lt;span class="kwrd"&gt;="Xml"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;properties&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;profile&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;&lt;br&gt;The problem I was having, and it seems a lot of people are having, is that &lt;i&gt;System.Collections.Generic.List`1[Model.Product]&lt;/i&gt; throws an error.  For some people, it seems to work.  Well, I tried changing the lt and gt in the generic list so  the XML would parse it as it is written in the code-behind.  That didnt work.&lt;/div&gt;
&lt;div&gt;&lt;p&gt;The solution: Create a class which inherits from List&amp;lt;Model.Product&amp;gt;&lt;/p&gt;&lt;/div&gt;&lt;div&gt;For instance:&lt;/div&gt;
&lt;div&gt;
&lt;p&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: Consolas, "Courier New", Courier, Monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; Model&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;{&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;    &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;    &lt;span class="rem"&gt;/// This class wraps the Generic List into a class to serialize in Profile provider&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    [Serializable]&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; RecentlyViewed : List&amp;lt;Model.Product&amp;gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; RecentlyViewed()&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;        {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;        }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;p&gt;This works beautifully!  Now, in web.config, you can do the following:&lt;/p&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;p&gt; &lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: Consolas, "Courier New", Courier, Monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;profile&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;...&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;properties&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="RecentlyViewed"&lt;/span&gt; &lt;span class="attr"&gt;allowAnonymous&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="Model.RecentlyViewed"&lt;/span&gt; &lt;span class="attr"&gt;serializeAs&lt;/span&gt;&lt;span class="kwrd"&gt;="Xml"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;properties&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;profile&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt; &lt;/p&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-8935398552155066902?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/8935398552155066902/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=8935398552155066902' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/8935398552155066902'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/8935398552155066902'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/04/storing-generics-in-aspnet-profile.html' title='Storing Generics in ASP.NET Profile object'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-41248461083204455</id><published>2009-04-14T16:19:00.004-04:00</published><updated>2009-04-14T16:28:24.281-04:00</updated><title type='text'>Displaying multiple fields in a Dropdownlist's DataTextField</title><content type='html'>I've encountered this problem on occasion, where I want to display more than one field in a dropdownlist's DataTextField property.  In the past, I've overcome this problem by rewriting a SQL statement, or adding another column in the database itself to accomodate my needs.&lt;div&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;div&gt;In one of my classes (INFO 465: Projects in Information Systems @ VCU), we're working from a database which we're not allowed to change.  The reason we can't change it is because the instructor uses the same database for his examples.  I could just write another method into my business logic layer, but it would get cluttered pretty quickly.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;So, I decided to make use of LINQ and found the following solution:&lt;/div&gt;
&lt;div&gt;&lt;br&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;

&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;ddlUsers.DataSource = BLL.Employee.GetEmployees()&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;                .Select(be =&amp;gt; &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;                    &lt;span class="kwrd"&gt;new&lt;/span&gt; { &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;                        ID = be.Id, &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;                        FullName = String.Format(&lt;span class="str"&gt;"{0}{1}{2}"&lt;/span&gt;, &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;                                    be.LastName,&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;                                    (!&lt;span class="kwrd"&gt;string&lt;/span&gt;.IsNullOrEmpty(be.FirstName) ? &lt;span class="str"&gt;", "&lt;/span&gt; : &lt;span class="kwrd"&gt;string&lt;/span&gt;.Empty),&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;                                    be.FirstName)&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;                        }).AsEnumerable();&lt;/pre&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;br&gt;
This takes the List of Business Entity objects and uses the LINQ select statement to generate an implicit/anonymous object from that.  The only downfall to this method is that the new object only has local scope.  But, since I'm only using this in a dropdown, it's a pretty nifty trick.
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-41248461083204455?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/41248461083204455/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=41248461083204455' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/41248461083204455'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/41248461083204455'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/04/displaying-multiple-fields-in.html' title='Displaying multiple fields in a Dropdownlist&apos;s DataTextField'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-3441845687256782533</id><published>2009-04-01T13:56:00.004-04:00</published><updated>2009-04-01T14:07:22.110-04:00</updated><title type='text'>T-SQL Multi-Table Delete</title><content type='html'>I was trying to run a DELETE query on multiple tables and I kept getting this error:


&lt;b&gt;The DELETE statement conflicted with the REFERENCE constraint&lt;/b&gt;
&lt;div&gt;I'm not that great with SQL, but I can get by.  DELETEs have always been somethng that have given me trouble.  So, I thought I'd share this simple fix.&lt;/div&gt;&lt;div&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;DELETE&lt;/span&gt; &lt;span class="kwrd"&gt;FROM&lt;/span&gt; PRODUCT
&lt;span class="kwrd"&gt;FROM&lt;/span&gt; BOOK
&lt;span class="kwrd"&gt;WHERE&lt;/span&gt; BOOK.ID = PRODUCT.BOOK_ID
&lt;span class="kwrd"&gt;AND&lt;/span&gt; BOOK.ID = @BOOK_ID&lt;/pre&gt;&lt;pre class="csharpcode"&gt;&lt;/pre&gt;

You just have to make sure you put the table with the FK as the first table in the query.
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;I guess I should have paid a little more attention in Database class.  We learned Oracle, which is different from Microsoft's SQL in many ways.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-3441845687256782533?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/3441845687256782533/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=3441845687256782533' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/3441845687256782533'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/3441845687256782533'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/04/t-sql-multi-table-delete.html' title='T-SQL Multi-Table Delete'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-2099837725505288748</id><published>2009-03-28T13:07:00.004-04:00</published><updated>2009-03-28T13:31:28.279-04:00</updated><title type='text'>LINQ: more like "Luckily I Never Quit"</title><content type='html'>I've been using LINQ quite a bit lately.  As the blog title says: luckily, I never quit.
&lt;p&gt;
There are a lot of things to get used to with LINQ.  For one, it uses deferred queries.  When you make a change, you must submit changes before the change is reflected in the database. Yes, this mirrors the actions when working directly with a database (COMMIT), but when you're thinking of it as application logic, it seems counter-intuitive.
&lt;p&gt;
&amp;lt;aside&amp;gt;
&lt;p&gt;
At school, I'm in a class called INFO 465: Projects in Information Systems.  The class is slow-going.  At VCU, there are three tracks of studies in Information Systems: Application Development, Business Analysis, and Network Administration.  Unfortunately, most of the people in BA and Networking are there because they don't want to do any programming at all.  You would think a class geared to using your course skills would accommodate each track equally?
&lt;p&gt;
That's not the case in this class.  There are two projects.  One is individual work and the other is group work.  The individual project is really just a large programming assignment to create an "Enterprise System" for a landscaping company.  Luckily, the company consists of the landscaper, a truck, and his helper.
&lt;p&gt;
Anyway, to get back on track, we're allowed to do our project any way we want.  Most of the people in the class chose to do Windows Forms using VB.NET examples provided by the teacher.  Good luck with that!  I chose to use ASP.NET, AJAX, Web Services, and LINQ.  I chose this route because I wanted this class to be a learning experience, not just a copy-paste session for 3 hours a week.
&lt;p&gt;
&amp;lt;/aside&amp;gt;
&lt;p&gt;
Back to LINQ.  To be quick about development, I've decided to use GridViews, DetailsViews, and LinqDataSources.  Every time I try to link a LinqDataSource to a GridView's selected key, I get this message:
&lt;p&gt;
&lt;span style="font-weight:bold;"&gt;Operator '==' incompatible with operand types 'Int32' and 'Object'&lt;/span&gt;
&lt;p&gt;
Here is an example of the LinqDataSource that throws this error:
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;pre class="csharpcode"&gt;
&amp;lt;asp:LinqDataSource ID=&lt;span class="str"&gt;"srcSelectedOrder"&lt;/span&gt; runat=&lt;span class="str"&gt;"server"&lt;/span&gt; 
        ContextTypeName=&lt;span class="str"&gt;"INFO465_First_Web.DatabaseMaps.OrdersDataContext"&lt;/span&gt; 
        EnableDelete=&lt;span class="str"&gt;"True"&lt;/span&gt; EnableInsert=&lt;span class="str"&gt;"True"&lt;/span&gt; EnableUpdate=&lt;span class="str"&gt;"True"&lt;/span&gt; TableName=&lt;span class="str"&gt;"Orders"&lt;/span&gt; 
        Where=&lt;span class="str"&gt;"Id == @Id"&lt;/span&gt;&amp;gt;
        &amp;lt;WhereParameters&amp;gt;
            &amp;lt;asp:ControlParameter ControlID=&lt;span class="str"&gt;"GridView1"&lt;/span&gt; Name=&lt;span class="str"&gt;"Id"&lt;/span&gt; 
                PropertyName=&lt;span class="str"&gt;"SelectedValue"&lt;/span&gt; Type=&lt;span class="str"&gt;"Int32"&lt;/span&gt; /&amp;gt;
        &amp;lt;/WhereParameters&amp;gt;
    &amp;lt;/asp:LinqDataSource&amp;gt;&lt;/pre&gt;

The problem is where you have the Where clause "Id == @Id".  For some reason, the data source thinks @Id is an object instead of an Int32, even though Type="Int32" in the WhereParameters.
&lt;p&gt;
The fix is the change this to Where="Id == Int32?(@Id)".  I don't know why this is.  I mean, if you're taking a primary key as the DataKeyName, it is being passed as Int32 in the WhereParameters, why do you have to cast it?  Maybe the LinqDataSource automatically converts Id == @Id to an SQL query that would look like "Id == '2'", and you have to cast to Int32 explicitly so it will look like "Id == 2" in the query?  Again, this is another place that LINQ just seems backwards.
&lt;p&gt;
Here is the fixed data source:
&lt;p&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;pre class="csharpcode"&gt;
&amp;lt;asp:LinqDataSource ID=&lt;span class="str"&gt;"srcSelectedOrder"&lt;/span&gt; runat=&lt;span class="str"&gt;"server"&lt;/span&gt; 
        ContextTypeName=&lt;span class="str"&gt;"INFO465_First_Web.DatabaseMaps.OrdersDataContext"&lt;/span&gt; 
        EnableDelete=&lt;span class="str"&gt;"True"&lt;/span&gt; EnableInsert=&lt;span class="str"&gt;"True"&lt;/span&gt; EnableUpdate=&lt;span class="str"&gt;"True"&lt;/span&gt; TableName=&lt;span class="str"&gt;"Orders"&lt;/span&gt; 
        Where=&lt;span class="str"&gt;"Id == Int32?(@Id)"&lt;/span&gt;&amp;gt;
        &amp;lt;WhereParameters&amp;gt;
            &amp;lt;asp:ControlParameter ControlID=&lt;span class="str"&gt;"GridView1"&lt;/span&gt; Name=&lt;span class="str"&gt;"Id"&lt;/span&gt; 
                PropertyName=&lt;span class="str"&gt;"SelectedValue"&lt;/span&gt; Type=&lt;span class="str"&gt;"Int32"&lt;/span&gt; /&amp;gt;
        &amp;lt;/WhereParameters&amp;gt;
    &amp;lt;/asp:LinqDataSource&amp;gt;&lt;/pre&gt;
&lt;p&gt;
(I always format my code with http://www.manoli.net/csharpformat/)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-2099837725505288748?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/2099837725505288748/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=2099837725505288748' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/2099837725505288748'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/2099837725505288748'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/03/linq-more-like-luckily-i-never-quit.html' title='LINQ: more like &quot;Luckily I Never Quit&quot;'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-245082143403630689</id><published>2009-03-19T09:17:00.002-04:00</published><updated>2009-03-19T09:19:44.036-04:00</updated><title type='text'>C++ Templated QuickSort Algorithm</title><content type='html'>It has been over a month since I posted. I've been really busy with all of my classes.

So, instead of going too in depth with anything, I'm just going to share some code we've written.  This is a QuickSort Algorithm that we adapted from the MIT Intro to Algorithms book.  We just finished it last night (less than 12 hours ago), so it's not fully tested.

&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: Consolas, "Courier New", Courier, Monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;div class="csharpcode"&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;#ifndef _QUICKSORT_H&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="preproc"&gt;#define&lt;/span&gt; _QUICKSORT_H&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;#include &amp;lt;vector&amp;gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; &lt;span class="kwrd"&gt;namespace&lt;/span&gt; std;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; QuickSort&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;{&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;    &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;&lt;span class="rem"&gt;/* &lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;&lt;span class="rem"&gt;    QuickSort Algorithm using Templates&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;&lt;span class="rem"&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;&lt;span class="rem"&gt;    Algorithm was adapted from:&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;&lt;span class="rem"&gt;        Introduction to Algorithms&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;&lt;span class="rem"&gt;        By Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;&lt;span class="rem"&gt;        Contributor Thomas H. Cormen&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;&lt;span class="rem"&gt;        Edition: 2, illustrated&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;&lt;span class="rem"&gt;        Published by MIT Press, 2001&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;&lt;span class="rem"&gt;        ISBN 0262032937, 9780262032933&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;&lt;span class="rem"&gt;        1180 pages&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;&lt;span class="rem"&gt;    Accessed March 2009&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;&lt;span class="rem"&gt;    via http://books.google.com/books?id=NLngYyWFl_YC&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;&lt;span class="rem"&gt;    See pages 145-147&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;&lt;span class="rem"&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;&lt;span class="rem"&gt;*/&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;    template&amp;lt;&lt;span class="kwrd"&gt;class&lt;/span&gt; T&amp;gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;    &lt;span class="kwrd"&gt;class&lt;/span&gt; QuickSort&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt;:&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;        vector&amp;lt;T&amp;gt; *sortingArray;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;        &lt;span class="kwrd"&gt;int&lt;/span&gt; left;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;        &lt;span class="kwrd"&gt;int&lt;/span&gt; right;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;        &lt;span class="rem"&gt;// Constructors&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;        QuickSort();&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;        QuickSort(vector&amp;lt;T&amp;gt; *sortArray);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;        QuickSort(vector&amp;lt;T&amp;gt; *sortArray, &lt;span class="kwrd"&gt;int&lt;/span&gt; startIndex, &lt;span class="kwrd"&gt;int&lt;/span&gt; endIndex);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;        &lt;span class="rem"&gt;/**********************************************************************&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;&lt;span class="rem"&gt;        * Partition and Swap Functions&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;&lt;span class="rem"&gt;        **********************************************************************/&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;        &lt;span class="kwrd"&gt;int&lt;/span&gt; Partition(vector&amp;lt;T&amp;gt; *sortArray, &lt;span class="kwrd"&gt;int&lt;/span&gt; startIndex, &lt;span class="kwrd"&gt;int&lt;/span&gt; endIndex);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;        &lt;span class="kwrd"&gt;void&lt;/span&gt; Swap(&lt;span class="kwrd"&gt;int&lt;/span&gt; l, &lt;span class="kwrd"&gt;int&lt;/span&gt; k);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;    };&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  48:  &lt;/span&gt;    template&amp;lt;&lt;span class="kwrd"&gt;class&lt;/span&gt; T&amp;gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;    QuickSort&amp;lt;T&amp;gt;::QuickSort()&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  50:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  51:  &lt;/span&gt;        sortingArray = &lt;span class="kwrd"&gt;new&lt;/span&gt; vector&amp;lt;T&amp;gt;();&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  52:  &lt;/span&gt;        left = 0;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  53:  &lt;/span&gt;        right = 0;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  54:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  55:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  56:  &lt;/span&gt;    template&amp;lt;&lt;span class="kwrd"&gt;class&lt;/span&gt; T&amp;gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  57:  &lt;/span&gt;    QuickSort&amp;lt;T&amp;gt;::QuickSort(vector&amp;lt;T&amp;gt; *sortArray)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  58:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  59:  &lt;/span&gt;        &lt;span class="kwrd"&gt;int&lt;/span&gt; startIndex = 0;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  60:  &lt;/span&gt;        &lt;span class="kwrd"&gt;int&lt;/span&gt; endIndex = 0;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  61:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  62:  &lt;/span&gt;        endIndex = (&lt;span class="kwrd"&gt;int&lt;/span&gt;)(*sortArray).size() - 1;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  63:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  64:  &lt;/span&gt;        QuickSort(sortArray, startIndex, endIndex);&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  65:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  66:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  67:  &lt;/span&gt;    template&amp;lt;&lt;span class="kwrd"&gt;class&lt;/span&gt; T&amp;gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  68:  &lt;/span&gt;    QuickSort&amp;lt;T&amp;gt;::QuickSort(vector&amp;lt;T&amp;gt; *sortArray, &lt;span class="kwrd"&gt;int&lt;/span&gt; startIndex, &lt;span class="kwrd"&gt;int&lt;/span&gt; endIndex)&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  69:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  70:  &lt;/span&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt;(startIndex &amp;gt;= endIndex)&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  71:  &lt;/span&gt;        {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  72:  &lt;/span&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt;;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  73:  &lt;/span&gt;        }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  74:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  75:  &lt;/span&gt;        &lt;span class="rem"&gt;// *initialize* the array&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  76:  &lt;/span&gt;        sortingArray = sortArray;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  77:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  78:  &lt;/span&gt;        &lt;span class="rem"&gt;// For instance: 1..n&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  79:  &lt;/span&gt;        left = startIndex;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  80:  &lt;/span&gt;        right = endIndex;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  81:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  82:  &lt;/span&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt;(left &amp;lt; right)&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  83:  &lt;/span&gt;        {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  84:  &lt;/span&gt;            &lt;span class="rem"&gt;// get pivot&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  85:  &lt;/span&gt;            &lt;span class="kwrd"&gt;int&lt;/span&gt; pivot = Partition(sortingArray, left, right);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  86:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  87:  &lt;/span&gt;            &lt;span class="rem"&gt;// sort left side&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  88:  &lt;/span&gt;            QuickSort(sortingArray, left, (pivot-1));&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  89:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  90:  &lt;/span&gt;            &lt;span class="rem"&gt;// sort right side&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  91:  &lt;/span&gt;            QuickSort(sortingArray, (pivot+1), right);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  92:  &lt;/span&gt;        }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  93:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  94:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  95:  &lt;/span&gt;    template&amp;lt;&lt;span class="kwrd"&gt;class&lt;/span&gt; T&amp;gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  96:  &lt;/span&gt;    &lt;span class="kwrd"&gt;int&lt;/span&gt; QuickSort&amp;lt;T&amp;gt;::Partition(vector&amp;lt;T&amp;gt; *sortArray, &lt;span class="kwrd"&gt;int&lt;/span&gt; startIndex, &lt;span class="kwrd"&gt;int&lt;/span&gt; endIndex)&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  97:  &lt;/span&gt;    {        &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  98:  &lt;/span&gt;        &lt;span class="rem"&gt;// initially this start - 1 when startIndex is 0.&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  99:  &lt;/span&gt;        &lt;span class="kwrd"&gt;int&lt;/span&gt; l = startIndex - 1;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 100:  &lt;/span&gt;        &lt;span class="kwrd"&gt;int&lt;/span&gt; k = endIndex;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 101:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 102:  &lt;/span&gt;        &lt;span class="kwrd"&gt;for&lt;/span&gt;(&lt;span class="kwrd"&gt;int&lt;/span&gt; i = startIndex; i &amp;lt;= k - 1; i++)&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 103:  &lt;/span&gt;        {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 104:  &lt;/span&gt;            &lt;span class="rem"&gt;// Go until you find a value smaller than the last value.&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 105:  &lt;/span&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt;((*sortArray)[i] &amp;lt;= (*sortArray)[k])&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 106:  &lt;/span&gt;            {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 107:  &lt;/span&gt;                &lt;span class="rem"&gt;// increment l&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 108:  &lt;/span&gt;                l++;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 109:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 110:  &lt;/span&gt;                &lt;span class="rem"&gt;// swap i and j&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 111:  &lt;/span&gt;                &lt;span class="rem"&gt;// NOTE: this is supposed to swap j with itself the first time.&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 112:  &lt;/span&gt;                Swap(l, i);        &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 113:  &lt;/span&gt;            }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 114:  &lt;/span&gt;        }    &lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 115:  &lt;/span&gt;        &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 116:  &lt;/span&gt;        &lt;span class="rem"&gt;// when loop is finished, swap &lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 117:  &lt;/span&gt;        Swap(l + 1, k);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 118:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 119:  &lt;/span&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; l + 1;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 120:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 121:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 122:  &lt;/span&gt;    template&amp;lt;&lt;span class="kwrd"&gt;class&lt;/span&gt; T&amp;gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 123:  &lt;/span&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; QuickSort&amp;lt;T&amp;gt;::Swap(&lt;span class="kwrd"&gt;int&lt;/span&gt; l, &lt;span class="kwrd"&gt;int&lt;/span&gt; k)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 124:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 125:  &lt;/span&gt;        &lt;span class="rem"&gt;// create temp variable&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 126:  &lt;/span&gt;        T tmp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 127:  &lt;/span&gt;        &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 128:  &lt;/span&gt;        &lt;span class="rem"&gt;// store first element in temp&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 129:  &lt;/span&gt;        tmp =(*sortingArray)[l];&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 130:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 131:  &lt;/span&gt;        &lt;span class="rem"&gt;// swap second element to first element&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 132:  &lt;/span&gt;        (*sortingArray)[l] = (*sortingArray)[k];&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 133:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 134:  &lt;/span&gt;        &lt;span class="rem"&gt;// put temp variable in second element&lt;/span&gt;&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 135:  &lt;/span&gt;        (*sortingArray)[k] = tmp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 136:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 137:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 138:  &lt;/span&gt;}&lt;/pre&gt;
&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 139:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt; 140:  &lt;/span&gt;&lt;span class="preproc"&gt;#endif&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-245082143403630689?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/245082143403630689/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=245082143403630689' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/245082143403630689'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/245082143403630689'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/03/c-templated-quicksort-algorithm.html' title='C++ Templated QuickSort Algorithm'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-5412693942963659626</id><published>2009-02-02T23:26:00.003-05:00</published><updated>2009-02-02T23:44:08.027-05:00</updated><title type='text'>My beginnings in C++</title><content type='html'>This semester (my final semester at VCU), I am taking INFO 450: Advanced Programming, which concentrates in C++.  We're learning both native and managed C++.  Our first assignment was simple: a console application to calculate the monthly payments on a car loan, based on interest rate, total loan, and loan duration.  That was pretty easy.
&lt;br&gt;&lt;br&gt;
This assignment was pretty rough.  We had to code a fully functional ATM application, which uses a hardcoded bank database, accounts, authentication, withdrawal &amp; deposit simulation, etc.  We were told that we could mirror the ATM case study at the end of our Learn to Program C# 2005 by Deitel (the book from intermediate programming).
&lt;br&gt;&lt;br&gt;
After mirroring the C# code, I kept getting error after error.  It was ridiculous how every error stemmed from how header files were used in my code.  Eventually, I worked out the problems with the header files.  Then, I kept getting this compiler error: LNK2019.  I searched and searched online, and couldn't find a suitable answer.  Finally, I retraced all my code, and realized that I had three classes (Withdrawal, Deposit, BalanceInquiry) all overriding the virtual function 'Execute' from class Transaction, but that class wasn't marked virtual.  This probably should have been the first place I looked, but keep in mind we were given this assignment the day after we learned about references.
&lt;br&gt;&lt;br&gt;
To make a long story short, I was receiving LNK2019 errors because of my virtual functions.  The error was caused by declaring the function as "virtual void Execute();" instead of "virtual void Execute() = 0;"  Embarrassingly, that little mistake took me forever to figure out.  I somewhat hope that whatever path I take in the future uses tools with less cryptic error messages.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-5412693942963659626?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/5412693942963659626/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=5412693942963659626' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/5412693942963659626'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/5412693942963659626'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/02/my-beginnings-in-c.html' title='My beginnings in C++'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-652321593634924121</id><published>2009-02-02T17:12:00.004-05:00</published><updated>2009-02-02T17:31:22.176-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>C# Insertion Sorting algorithm</title><content type='html'>Here is a console application to test an Insertion Sorting algorithm adapted from chapter 2 of MIT's Introduction to Algorithms.  I thought this might come in handy for any beginners, as well as a fun way to test your computer's performance.
&lt;br /&gt;
My desktop averages about 24.9 seconds, which, of course, depends on how scattered the integers are in the array.
&lt;br /&gt;
&lt;br /&gt;

&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: Consolas, "Courier New", Courier, Monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;div class="csharpcode"&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; InsertionSorting&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;{&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    &lt;span class="kwrd"&gt;class&lt;/span&gt; Program&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&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)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;        {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  12:  &lt;/span&gt;            &lt;span class="rem"&gt;// int[] A = {5, 2, 4, 6, 1, 3};&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  13:  &lt;/span&gt;            &lt;span class="kwrd"&gt;int&lt;/span&gt; initializer = 100000;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  14:  &lt;/span&gt;            &lt;span class="kwrd"&gt;int&lt;/span&gt;[] A = &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt;[initializer];&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  15:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  16:  &lt;/span&gt;            &lt;span class="kwrd"&gt;for&lt;/span&gt; (&lt;span class="kwrd"&gt;int&lt;/span&gt; c = 0; c &amp;lt; A.Length; c++)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  17:  &lt;/span&gt;            {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  18:  &lt;/span&gt;                A[c] = c;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  19:  &lt;/span&gt;            }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  20:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  21:  &lt;/span&gt;            &lt;span class="rem"&gt;// Random shuffle&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  22:  &lt;/span&gt;            Random rand = &lt;span class="kwrd"&gt;new&lt;/span&gt; Random();&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  23:  &lt;/span&gt;            &lt;span class="kwrd"&gt;for&lt;/span&gt; (&lt;span class="kwrd"&gt;int&lt;/span&gt; d = 0; d &amp;lt; A.Length; d++)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  24:  &lt;/span&gt;            {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  25:  &lt;/span&gt;                &lt;span class="kwrd"&gt;int&lt;/span&gt; firstInt = A[d];&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  26:  &lt;/span&gt;                &lt;span class="kwrd"&gt;int&lt;/span&gt; swapIndex = rand.Next(initializer);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  27:  &lt;/span&gt;                &lt;span class="kwrd"&gt;int&lt;/span&gt; secondInt = A[swapIndex];&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  28:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  29:  &lt;/span&gt;                A[d] = secondInt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  30:  &lt;/span&gt;                A[swapIndex] = firstInt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  31:  &lt;/span&gt;            }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  32:  &lt;/span&gt;            &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  33:  &lt;/span&gt;            &lt;span class="rem"&gt;//Console.Write("Array before sorting: ");&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  34:  &lt;/span&gt;            &lt;span class="rem"&gt;//foreach (int number in A)&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  35:  &lt;/span&gt;            &lt;span class="rem"&gt;//{&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  36:  &lt;/span&gt;            &lt;span class="rem"&gt;//    Console.Write("{0} ", number);&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  37:  &lt;/span&gt;            &lt;span class="rem"&gt;//}&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  38:  &lt;/span&gt;            &lt;span class="rem"&gt;//Console.WriteLine("");&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  39:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  40:  &lt;/span&gt;            &lt;span class="kwrd"&gt;int&lt;/span&gt; key;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  41:  &lt;/span&gt;            &lt;span class="kwrd"&gt;int&lt;/span&gt; i;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  42:  &lt;/span&gt;            &lt;span class="kwrd"&gt;int&lt;/span&gt; j;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  43:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  44:  &lt;/span&gt;            Console.Write(&lt;span class="str"&gt;"Insertion Sorting array of {0} numbers, please wait..."&lt;/span&gt;, initializer);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  45:  &lt;/span&gt;            &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  46:  &lt;/span&gt;            DateTime start = DateTime.Now;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  47:  &lt;/span&gt;            &lt;span class="kwrd"&gt;for&lt;/span&gt; (j = 1; j &amp;lt; A.Length; j++)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  48:  &lt;/span&gt;            {&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  49:  &lt;/span&gt;                key = A[j];&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  50:  &lt;/span&gt;                i = j;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  51:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  52:  &lt;/span&gt;                &lt;span class="kwrd"&gt;while&lt;/span&gt; (i &amp;gt; 0 &amp;amp;&amp;amp; A[i - 1] &amp;gt; key)&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  53:  &lt;/span&gt;                {                    &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  54:  &lt;/span&gt;                    A[i] = A[i-1];&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  55:  &lt;/span&gt;                    i--;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  56:  &lt;/span&gt;                };&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  57:  &lt;/span&gt;                &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  58:  &lt;/span&gt;                A[i] = key;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  59:  &lt;/span&gt;            }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  60:  &lt;/span&gt;            DateTime finish = DateTime.Now;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  61:  &lt;/span&gt;            &lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  62:  &lt;/span&gt;            &lt;span class="rem"&gt;//Console.Write("Array after sorting: ");&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  63:  &lt;/span&gt;            &lt;span class="rem"&gt;//foreach (int number in A)&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  64:  &lt;/span&gt;            &lt;span class="rem"&gt;//{&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  65:  &lt;/span&gt;            &lt;span class="rem"&gt;//    Console.Write("{0} ", number);&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  66:  &lt;/span&gt;            &lt;span class="rem"&gt;//}&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  67:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  68:  &lt;/span&gt;            Console.WriteLine(&lt;span class="str"&gt;""&lt;/span&gt;);&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  69:  &lt;/span&gt;            Console.WriteLine(&lt;span class="str"&gt;"Duration: {0} seconds"&lt;/span&gt;, (finish - start).ToString());&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  70:  &lt;/span&gt;        }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  71:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  72:  &lt;/span&gt;}&lt;/pre&gt;
&lt;pre&gt;&lt;span class="lnum"&gt;  73:  &lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-652321593634924121?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/652321593634924121/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=652321593634924121' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/652321593634924121'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/652321593634924121'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/02/blog-post.html' title='C# Insertion Sorting algorithm'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-5170837833915455465</id><published>2009-01-01T14:13:00.002-05:00</published><updated>2009-01-01T14:19:46.144-05:00</updated><title type='text'>Silverlight 2.0, broken XAML Intellisense fix</title><content type='html'>I installed all the necessary files for Silverlight today.  When I created a project, the xaml document didn't have intellisense and opened as a text instead of XML-based document.

I tried a few fixes, one guy recommended right-clicking on the file and choosing "Open with.." and selected XML Editor as the default.  This didn't work for me.

I tried following Karen Meier's fix &lt;a href="http://social.msdn.microsoft.com/Forums/en-US/windowssdk/thread/dd6f14ed-e582-4b49-9358-64f2afaec151/"&gt;here&lt;/a&gt;. That didn't work either.

Then, I figured I would try resetting Visual Studio.  So, checking the documentation on devenv switches, specifically &lt;a href="http://msdn.microsoft.com/en-us/library/ms241276(VS.80).aspx"&gt;this one&lt;/a&gt;, I ran devenv /resetskippkgs and checked the intellisense. This fixed my XAML intellisense!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-5170837833915455465?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/5170837833915455465/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=5170837833915455465' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/5170837833915455465'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/5170837833915455465'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2009/01/silverlight-20-broken-xaml-intellisense.html' title='Silverlight 2.0, broken XAML Intellisense fix'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-312473311299779192</id><published>2008-12-28T14:24:00.004-05:00</published><updated>2008-12-28T14:34:07.171-05:00</updated><title type='text'>Visual Studio 2010: Logging in</title><content type='html'>I downloaded &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=922B4655-93D0-4476-BDA4-94CF5F8D4814&amp;displaylang=en"&gt;Visual Studio 2010 CTP&lt;/a&gt; a week ago.  I fiddled around with it for about 30 minutes, trying to login to the accounts provided by the preview.  
From the download site:
&lt;blockquote&gt;The following logon accounts and passwords have been preconfigured on the VPC:
Administrator: TFSSETUP, password: 1Setuptfs (use this account to explore the CTP)
Administrator: Administrator,password: P2ssw0rd
User: TFSREPORTS, password: 1Reports
User: TFSSERVICE, password: 1Service&lt;/blockquote&gt;

The passwords weren't working for me, so I mixed them up. Finally, I gave up.

Today, I took a break from reading for my Winter Intercession course, and decided to run the Visual Studio 2010 image again.  I realized Virtual PC had start it up with numlock on.  Because I'm using a notebook PC, it's easy to forget that the right half of the keyboard doubles as a numeric keypad with numlock.  So, &lt;span style="font-weight:bold;"&gt;I turned numlock off&lt;/span&gt;, and I was able to log in.

I can't wait for Visual Studio 2010 to be released.  I especially like the WiX integration.  Sure, WiX offers the same integration for Visual Studio 2008, but it's nice to see Microsoft attempting to make installers less of a hassle for developers.  It took me about a week of researching different installers to finally settle on WiX.  When I get a chance, I'm going to look into custom actions using Powershell to retrieve version numbers and edit localization files with updated versions.

Now, I guess it's back to coursework.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-312473311299779192?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/312473311299779192/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=312473311299779192' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/312473311299779192'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/312473311299779192'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2008/12/visual-studio-2010-logging-in.html' title='Visual Studio 2010: Logging in'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-8596702541638984827</id><published>2008-12-22T00:33:00.003-05:00</published><updated>2008-12-22T23:44:37.395-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='invalid character'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><category scheme='http://www.blogger.com/atom/ns#' term='components for the 64-bit debugger are not registered'/><category scheme='http://www.blogger.com/atom/ns#' term='remote debugger'/><title type='text'>Visual Studio error, debugger can't start</title><content type='html'>"The components for the 64-bit debugger are not registered. Please repair your Visual Studio 2008 Remote Debugger installation via ‘Add or Remove Programs’ in Control Panel"

So, I uninstalled EVERYTHING related to Visual Studio.  I assume it was a problem with SP1 and my XP 64-bit operating system.  The reason I think this is the case: when I tried running the installer for the remote debugger from the VS2008 dvd, it had the options for repair and remove.  Running either option gave me this message:
"Error 1324: The folder path folder name contains an invalid character." 

Could that be 'Program Files (x86)' by any chance?  Why Microsoft would choose to name a system folder with a character the windows installer considers invalid is beyond me.

Anyway, the way I thought I'd share how I fixed the issue.
-Download Microsoft's Windows Install Clean Up utility from:  http://support.microsoft.com/kb/290301/
-Run the utility and remove ONLY Microsoft Visual Studio Remote Debugger
-Run the debugger setup from the dvd

Hopefully that will save someone a headache.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-8596702541638984827?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/8596702541638984827/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=8596702541638984827' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/8596702541638984827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/8596702541638984827'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2008/12/visual-studio-error-debugger-cant-start.html' title='Visual Studio error, debugger can&apos;t start'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-4593368016236187404</id><published>2008-12-19T21:42:00.010-05:00</published><updated>2008-12-28T14:48:27.651-05:00</updated><title type='text'>WiX Installer Update</title><content type='html'>One thing that has caused me quite a few problems with my WiX installer was optionally displaying a dialog to enter SQL information when the database is installed.&lt;div&gt;I may change the database to be a critical element of the intall, but I thought this would be a good share.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;Based on:&lt;/div&gt;&lt;div&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/aa368012(VS.85).aspx"&gt;http://msdn.microsoft.com/en-us/library/aa368012(VS.85).aspx&lt;/a&gt;
&lt;/div&gt;&lt;div&gt;and&lt;/div&gt;&lt;div&gt;&lt;a href="http://geekswithblogs.net/jwatson/archive/2006/11/03/96052.aspx"&gt;http://geekswithblogs.net/jwatson/archive/2006/11/03/96052.aspx&lt;/a&gt;
&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;To set the next button to display based on features chosen in the feature tree, you can do someting like this:&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt; &amp;lt publish dialog="CustomizeDlg" control="Next" event="NewDialog" value="SqlSetupDlg"&gt; 1 &amp;lt/publish&gt;

Where "Database" is the name of the feature you want to install.&lt;/div&gt;&lt;div&gt;
other access prefixes are:
&lt;ol&gt;&lt;li&gt;(none) Installer property:  Value of property (Property) table.
&lt;/li&gt;&lt;li&gt;% Environment variable:  Value of environment variable.
&lt;/li&gt;&lt;li&gt;$  Component table key:  Action state of the component.
&lt;/li&gt;&lt;li&gt;?  Component table key:  Installed state of the component.
&lt;/li&gt;&lt;li&gt;&amp;amp;  Feature table key:  Action state of the feature.
&lt;/li&gt;&lt;li&gt;!   Feature table key:  Installed state of the feature.
&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-4593368016236187404?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/4593368016236187404/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=4593368016236187404' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/4593368016236187404'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/4593368016236187404'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2008/12/wix-installer-update.html' title='WiX Installer Update'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-1828257684459607137</id><published>2008-12-15T19:04:00.006-05:00</published><updated>2008-12-29T22:43:02.233-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='wix'/><title type='text'>WiX: First impressions.</title><content type='html'>After working with WiX today, I realized that it's not perfect.  But, it isn't horrible.  Maybe my issues are from following "tutorials" that are written for WiX 2.0, while I'm using WiX 3.0.&lt;div&gt;
&lt;/div&gt;&lt;div&gt;Whatever the reason, I have encountered only a few problems so far:&lt;/div&gt;&lt;div&gt;1.  &lt; removefolder id="FolderName" on="uninstall" &amp;gt  this caused a lot of errors.  I don't know if WiX 3.0 has changed how it handles removal of folders?  I noticed when I uninstall without specifying &lt;removefolder&gt;, it actually removes the folder properly.  (I'm using this on a folder under ProgramMenuFolder)&lt;/removefolder&gt;&lt;/removefolder&gt;&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;2. Creating a new UI and adding dialogs was a pain.  Referencing my dialog with DialogRef="NewDialogName" kept throwing errors.  Quite a few google searches later, I still couldn't find a fix or a reason for the errors.  The resolution: instead of creating the dialog in a different file as a Fragment, I just added it to the file modeled after WixUI_Mondo.  After doing this, the dialog worked.  Maybe fragments are broken?  Or, maybe I wasn't compiling and linking the library properly.&lt;/div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div&gt;3.  Many tutorials refer to a tool called tallow to create a Fragment of Components/Files.  But, the tool is now called Heat.   It's a useful tool, but I'm still having problems getting Fragments that I create to work right.

That's about it, I will write up some solutions to these problems if I find them.
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-1828257684459607137?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/1828257684459607137/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=1828257684459607137' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/1828257684459607137'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/1828257684459607137'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2008/12/wix-first-impressions.html' title='WiX: First impressions.'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-8084126941850866228</id><published>2008-12-14T10:15:00.002-05:00</published><updated>2008-12-14T10:48:51.356-05:00</updated><title type='text'>Windows Installer Dilemma</title><content type='html'>My current task is to create an installer.  The dilemma:  Visual Studio doesn't provide a very robust Setup and Deployment project.

The options?
1.  Create a &lt;a href="http://wix.sf.net" target="_new"&gt;WiX Project&lt;/a&gt;
2.  Write a bootstrapper/custom GUI/etc.  and P/Invoke msi.dll
3.  InstallShield ($$$)
4.  Wise ($$$)
5.  &lt;a href="http://nsis.sf.net" target="_new"&gt;Nullsoft Scriptable Install System&lt;/a&gt;

Here's what I've run into.  WiX is pretty straight-forward and configurable.  It is also open source, so you are able to rewrite the user-interfaces to fit your needs.  The only thing is that the whole project is in XML, which means creating a dialog means setting values for buttons, labels, and textboxes manually.  I've thought about writing a short program to create the dialogs for me, which I may still do.  The problem I've found with WiX: I can't figure out how to refer to code (Assembly Info).    I have found two possibilities:  &lt;a href="http://andrewwhitten.wordpress.com/2007/09/19/how-to-insert-an-assembly-version-number-into-a-wix-script-at-build-time/" target="_new"&gt;replace WiX version via PowerShell script&lt;/a&gt; and &lt;a href="http://morten.lyhr.dk/2007/10/how-to-insert-assembly-version-number.html" target="_new"&gt;using MSBuild tasks&lt;/a&gt;.  However, my development team wants to make the project as simple as possible.  Using WiX already means that everyone will have to install WiX in order to build the file properly.  This will only be a problem until the next version of Visual Studio, which is supposed to ship with WiX installed.

Option 2 is one that I got from Rick Brewster, of &lt;a href="http://www.getpaint.net/" target="_new"&gt;Paint.NET&lt;/a&gt; fame.  Well, not directly from him.  Scott Hanselman has &lt;a href="http://www.hanselman.com/blog/HanselminutesPodcast138PaintNETWithRickBrewster.aspx" target="_new"&gt;an excellent podcast&lt;/a&gt; which details the Paint.NET installer.  It is beautiful in it's simplicity.  I'll leave a few things out, to tailor it to my discussion.

I'll start from the outside-in. 
&lt;ol&gt;&lt;li&gt;The installer comes as an executable created by NSIS (#5 above).  This installer basically acts as a zip file, which extracts the contents to the user's application folder and runs the bootstrapper.&lt;/li&gt;&lt;li&gt;The bootstrapper checks for the proper version of Windows, and .NET&lt;/li&gt;&lt;li&gt;If the requirements .NET aren't met, the .NET redistributable installer can be run from the directory.&lt;/li&gt;&lt;li&gt;When everything is good, a custom GUI setup program runs.&lt;/li&gt;&lt;li&gt;The program gathers necessary information, injecting it into the MSI installer which is actually the same one created by Visual Studio.&lt;/li&gt;&lt;li&gt;Then, any number of MSI installers can be run.&lt;/li&gt;&lt;/ol&gt;This method of staging, bootstrapping, gathering, and then running seems the most efficient.  The problem is that the whole MSI interoperability means having a full understanding of Windows Installer technology.  It is possible, however, to simplify this even further.  On the progress form, use msiexec and switches.  Because I'm not that interested in fully understanding the Windows Installer technology at the moment, this option is a little more than I want to get into.  But, I have actually started a project that uses a very similar method.

InstallShield and Wise cost money, so they are not options for me.

NSIS is another excellent option.  The only problem I see with it is that it's like learning another scripting language.  Although it is very simple, it doesn't particularly appeal to me.  XML, however, does.

So, it looks like I'm going to go with WiX as my choice to create an installer.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-8084126941850866228?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/8084126941850866228/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=8084126941850866228' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/8084126941850866228'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/8084126941850866228'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2008/12/windows-installer-dilemma.html' title='Windows Installer Dilemma'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-3967341664787346328</id><published>2008-12-13T10:55:00.002-05:00</published><updated>2008-12-13T11:04:21.027-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>.NET development</title><content type='html'>I consider myself a .NET developer.  I don't consider myself good at it.  There are always things to learn, and new facets of development that I didn't realize existed.

I plan on keeping this blog as a way to keep tabs on what I've been doing.  I am currently working at &lt;a href="http://www.agilityhealthcare.com" target="_new"&gt;Agility Healthcare Solutions&lt;/a&gt;, on a Rich Internet Application used to track patients, staff, equipment, and beds in a hospital environment using RFID.

The language of choice is C#.  Be sure to check back regularly, maybe you'll find something of use.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-3967341664787346328?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jamesschubert.blogspot.com/feeds/3967341664787346328/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6678663096227679678&amp;postID=3967341664787346328' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/3967341664787346328'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/3967341664787346328'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2008/12/net-development.html' title='.NET development'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6678663096227679678.post-5696578073309614422</id><published>1989-01-18T00:44:00.000-05:00</published><updated>2010-01-18T00:47:02.883-05:00</updated><title type='text'>James Schubert's Resume.doc</title><content type='html'>&lt;div class="Section1"&gt;&lt;p style=" margin-left:0pt; margin-right:0pt; text-align:center"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;b&gt;&lt;span style="font-size:130%;"&gt;James Schubert&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt; text-align:center"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;Phone:&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'Arial';"&gt;&lt;b&gt;&lt;span style="font-size:85%;"&gt;(507) 724-8237&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;Email: james.schubert@gmail.com&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt; text-align:center"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt; text-align:center"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;b&gt;&lt;span style="font-size:100%;"&gt;Education&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;i&gt;&lt;span style="font-size:100%;"&gt;Virginia Commonwealth University Richmond, VA&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;b&gt;&lt;span style="font-size:100%;"&gt;Bachelor of Science in Business&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;, May 2009&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;Major: Information Systems (Application Development)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;b&gt;&lt;span style="font-size:100%;"&gt;GPA: 3.98&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;b&gt;&lt;span style="font-size:100%;"&gt;Honors&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;Academic Achievement Award, Spring/Fall 2006, Spring 2007&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;William O. Edwards Scholarship for Merit, 2007-2008, 2008-2009&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;Member, Beta Gamma Sigma International Business Honor Society, 2008&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;Member, Phi Kappa Phi Honor Society, 2008&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;Student of the Year Award, Information Systems, VCU School of Business, April 2009&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;b&gt;&lt;span style="font-size:100%;"&gt;Skills&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;b&gt;&lt;span style="font-size:100%;"&gt;Design&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;b&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;(Visio, Rational Rose)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;b&gt;&lt;span style="font-size:100%;"&gt;Development&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;(C#.NET&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;, &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;Visual C++, &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;XML&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;/XSL, Python)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;b&gt;&lt;span style="font-size:100%;"&gt;Web Technologies&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt; (ASP.NET,&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;PHP, AJAX, JavaScript, jQuery, HTML, XHTML, CSS)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;b&gt;&lt;span style="font-size:100%;"&gt;Database Systems&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;b&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;(MS-SQL, MySQL, Oracle)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;b&gt;&lt;span style="font-size:100%;"&gt;Deployment&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;b&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;(Windows Installer XML v3)&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;b&gt;&lt;span style="font-size:100%;"&gt;.NET Frameworks&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt; (1.1/2.0/3.0/3.5/3.5 SP1)&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;b&gt;&lt;span style="font-size:100%;"&gt;Experience&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;i&gt;&lt;span style="font-size:100%;"&gt;September 2009-Present, Primescape Solutions, Inc. &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;i&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;i&gt;&lt;span style="font-size:100%;"&gt;Reston, VA&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;b&gt;&lt;i&gt;&lt;span style="font-size:100%;"&gt;Consultant&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul type="disc"&gt;&lt;li&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;Perform major enhancements and add functionality to a web application using ASP.NET 1.1, C# and Oracle 9i&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;Comply with coding and security standards for federal government client&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;i&gt;&lt;span style="font-size:100%;"&gt;September 2008-February 2009, Agility Healthcare Solutions &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;i&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;i&gt;&lt;span style="font-size:100%;"&gt;Richmond, VA&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;b&gt;&lt;i&gt;&lt;span style="font-size:100%;"&gt;Intern&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;b&gt;&lt;i&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul type="disc"&gt;&lt;li&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;Performed bug fixes and application enhancements in an HL7-compliant Rich Internet Application using ASP.NET&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt; 3.5&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt; and C#&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;Worked with development team as part of a mixed Agile/Scrum methodology&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt;Provided feedback on application complexity and usability to team leader&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=" margin-left:0pt; margin-right:0pt"&gt;&lt;span style="font-family:'Times New Roman';"&gt;&lt;span style="font-size:100%;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6678663096227679678-5696578073309614422?l=jamesschubert.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/5696578073309614422'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6678663096227679678/posts/default/5696578073309614422'/><link rel='alternate' type='text/html' href='http://jamesschubert.blogspot.com/2010/01/james-schubert-resumedoc.html' title='James Schubert&amp;#39;s Resume.doc'/><author><name>James Schubert</name><uri>http://www.blogger.com/profile/08550763606505277140</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='21' src='http://3.bp.blogspot.com/_qBp5YPvZS6M/SUPZ9gMzd-I/AAAAAAAADgQ/WU7UubEx-o8/s1600-R/n25520499_30613792_7526.jpg'/></author></entry></feed>
