<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Global Nerdy &#187; C</title>
	<atom:link href="http://www.globalnerdy.com/tag/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.globalnerdy.com</link>
	<description>Tech Evangelist Joey deVilla on software development, tech news and other nerdy stuff</description>
	<lastBuildDate>Thu, 19 Nov 2009 02:16:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Windows API Code Pack for .NET Framework Released</title>
		<link>http://www.globalnerdy.com/2009/08/12/windows-api-code-pack-for-net-framework-released/</link>
		<comments>http://www.globalnerdy.com/2009/08/12/windows-api-code-pack-for-net-framework-released/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 19:05:21 +0000</pubDate>
		<dc:creator>Joey deVilla</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[APIs]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[managed code]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://www.globalnerdy.com/2009/08/12/windows-api-code-pack-for-net-framework-released/</guid>
		<description><![CDATA[Until now, taking advantage of the UI improvements in Windows 7 (and even some features in Vista) took a fair bit of work – there was a lot of stuff that wasn’t available through the .NET Framework. You’d have to either switch to C++ or resort to hacks in order to access these goodies.
That’s all [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><a href="http://code.msdn.microsoft.com/WindowsAPICodePack"><img style="border-right-width: 0px; margin: 0px 0px 10px 10px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Windows 7 logo and Microsoft .NET logo" border="0" alt="Windows 7 logo and Microsoft .NET logo" align="right" src="http://www.globalnerdy.com/wordpress/wp-content/uploads/2009/08/windows_7_plus_dotnet.jpg" width="366" height="168" /></a><strong>Until now, taking advantage of the UI improvements in Windows 7 (and even some features in Vista) took a fair bit of work</strong> – there was a lot of stuff that wasn’t available through the .NET Framework. You’d have to either switch to C++ or resort to hacks in order to access these goodies.</p>
<p><strong><a href="http://code.msdn.microsoft.com/WindowsAPICodePack">That’s all changed with the newly-released Windows API Code Pack for Microsoft .NET Framework.</a></strong> Written in C# – with some DirectX stuff written in C++ – this library acts as a wrapper that gives managed code access to features including:</p>
<ul>
<li>Windows 7 Taskbar Jump Lists, Icon Overlay, Progress Bar, Tabbed Thumbnails, and Thumbnail Toolbars. </li>
<li>Windows 7 Libraries, Known Folders, non-file system containers. </li>
<li>Windows Shell Search API support, a hierarchy of Shell Namespace entities, and Drag and Drop functionality for Shell Objects. </li>
<li>Explorer Browser Control. </li>
<li>Shell property system. </li>
<li>Windows Vista and Windows 7 Common File Dialogs, including custom controls. </li>
<li>Windows Vista and Windows 7 Task Dialogs. </li>
<li>Direct3D 11.0, Direct3D 10.1/10.0, DXGI 1.0/1.1, Direct2D 1.0, DirectWrite, Windows Imaging Component (WIC) APIs. (DirectWrite and WIC have partial support) </li>
<li>Sensor Platform APIs </li>
<li>Extended Linguistic Services APIs </li>
<li>Power Management APIs </li>
<li>Application Restart and Recovery APIs </li>
<li>Network List Manager APIs </li>
<li>Command Link control and System defined Shell icons </li>
<li>Shell search API support </li>
<li>Drag and drop functionality for Shell objects </li>
<li>Support for Direct2D/Direct3D interoperability </li>
<li>Support for typography and font enumeration DirectWrite APIs </li>
</ul>
<p>The system requirements are:</p>
<ul>
<li>.NET Framework 3.5 SP1 or later </li>
<li>Windows 7 RTM (although many features will work on prior versions) </li>
<li>DirectX features require <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=c17ba869-9671-4330-a63e-1fd44e0e2505&amp;displaylang=en">Windows SDK for Windows 7 RTM</a> </li>
<li>Some Direct3D samples require the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=24a541d6-0486-4453-8641-1eee9e21b282&amp;displaylang=en">March 2009 release of the DirectX SDK</a> </li>
</ul>
<p>We’ll cover the Windows API Code Pack for Microsoft .NET Framework over the next little while in a couple of places – certainly on this blog, as well as at the <a href="http://techdays.ca/">TechDays 2009</a> cross-Canada conference in the <em>Optimizing Your Apps for the Windows 7 Experience </em>session.</p>
<p><a href="http://code.msdn.microsoft.com/WindowsAPICodePack"><img style="border-right-width: 0px; margin: 0px 10px 10px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Down arrow" border="0" alt="Down arrow" align="left" src="http://www.globalnerdy.com/wordpress/wp-content/uploads/2009/08/down.jpg" width="48" height="48" /></a> </p>
<p><strong><a href="http://code.msdn.microsoft.com/WindowsAPICodePack">Download Windows API Code Pack for Microsoft .NET Framework (v1.0)</a></strong></p>
<p>&#160;</p>
<p class="alert"><a href="http://blogs.msdn.com/cdndevs/archive/2009/08/12/windows-api-code-pack-for-net-framework-released.aspx">This article also appears in <em>Canadian Developer Connection</em>.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.globalnerdy.com/2009/08/12/windows-api-code-pack-for-net-framework-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Interview at MeshU</title>
		<link>http://www.globalnerdy.com/2009/04/13/my-interview-at-meshu/</link>
		<comments>http://www.globalnerdy.com/2009/04/13/my-interview-at-meshu/#comments</comments>
		<pubDate>Mon, 13 Apr 2009 14:22:25 +0000</pubDate>
		<dc:creator>Joey deVilla</dc:creator>
				<category><![CDATA[Meetups]]></category>
		<category><![CDATA[Play]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Toronto]]></category>
		<category><![CDATA[What Joey Did]]></category>
		<category><![CDATA[accordion]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[MeshU]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Music]]></category>
		<category><![CDATA[song parodies]]></category>

		<guid isPermaLink="false">http://www.globalnerdy.com/2009/04/13/my-interview-at-meshu/</guid>
		<description><![CDATA[No tech workshop is complete without a little goofing around on an accordion, and I certainly didn’t want the MeshU day of workshops (which preceded the Mesh Conference) to be incomplete. I did a quick interview with Anita Kuno in which I performed a classic computer programmer song parody and promoted The Empire, which you [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><strong>No tech workshop is complete without a little goofing around on an accordion,</strong> and I certainly didn’t want the <a href="http://meshu.ca/">MeshU</a> day of workshops (which preceded the <a href="http://meshconference.com/">Mesh Conference</a>) to be incomplete. I did a quick interview with <a href="http://twitter.com/anteaya">Anita Kuno</a> in which I performed a classic computer programmer song parody and promoted The Empire, which you can see in the video below:</p>
<p align="center"><object type="application/x-shockwave-flash" data="http://www.filemobile.com/static/widgets/videoplayerv2/videoplayer_v2.swf" width="600" height="360"  allowScriptAccess="always"><param name="movie" value="http://www.filemobile.com/static/widgets/videoplayerv2/videoplayer_v2.swf" /><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="FlashVars" value="mid=892607&amp;ext=238" /><param name="menu" value="false" /><embed src="http://www.filemobile.com/static/widgets/videoplayerv2/videoplayer_v2.swf" type="application/x-shockwave-flash" allowFullScreen="true" width="640" height="360" flashvars="mid=892607&#038;ext=238" allowScriptAccess="always" /></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.globalnerdy.com/2009/04/13/my-interview-at-meshu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Default and Named Parameters in C# 4.0 / Sith Lord in Training</title>
		<link>http://www.globalnerdy.com/2009/03/12/default-and-named-parameters-in-c-40-sith-lord-in-training/</link>
		<comments>http://www.globalnerdy.com/2009/03/12/default-and-named-parameters-in-c-40-sith-lord-in-training/#comments</comments>
		<pubDate>Thu, 12 Mar 2009 18:07:15 +0000</pubDate>
		<dc:creator>Joey deVilla</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[What Joey Did]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[default arguments]]></category>
		<category><![CDATA[default parameters]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[named arguments]]></category>
		<category><![CDATA[named parameters]]></category>
		<category><![CDATA[Sith Lord in Training]]></category>

		<guid isPermaLink="false">http://www.globalnerdy.com/2009/03/12/default-and-named-parameters-in-c-40-sith-lord-in-training/</guid>
		<description><![CDATA[Round Trip
 Back when I was working for OpenCola (from January 2000 through January 2002), the start-up cofounded by Cory Doctorow, I was doing a lot of work using beta versions of C# to build prototype peer-to-peer applications that got demoed to some large companies, including Microsoft, who were kind enough to provide us with [...]]]></description>
			<content:encoded><![CDATA[<p></p><h3>Round Trip</h3>
<p><a href="http://www.globalnerdy.com/tag/sith-lord-in-training/"><img style="border-right-width: 0px; margin: 0px 0px 5px 10px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="sith_lord_in_training" border="0" alt="sith_lord_in_training" align="right" src="http://www.globalnerdy.com/wordpress/wp-content/uploads/2009/03/sith-lord-in-training.jpg" width="172" height="240" /></a> Back when I was working for <a href="http://en.wikipedia.org/wiki/Opencola">OpenCola</a> (from January 2000 through January 2002), the start-up cofounded by <a href="http://craphound.com/">Cory Doctorow</a>, I was doing a lot of work using beta versions of C# to build prototype peer-to-peer applications that got demoed to some large companies, including Microsoft, who were kind enough to provide us with betas of <a href="http://en.wikipedia.org/wiki/Microsoft_Visual_Studio#Visual_Studio_.NET_.282002.29">Visual Studio .NET</a> and Windows XP.</p>
<p>I graduated to the 1.0 version when it came out. Even during the year after I left OpenCola (or more accurately, got the boot), I continued to write applications in C#, from things like a sales app for people who were selling practice certification tests to a trivia game for a company that was pitching it to <em><a href="http://www.maxim.com/">Maxim</a></em>. I do manage to land some interesting jobs from time to time.</p>
<p>That changed on Bastille Day 2003, my first day as <a href="http://www.tucowsinc.com/">Tucows’</a> Technical Evangelist, or as the title originally read, “Technical Community Development Coordinator”. Tucows’ client base were people who wanted to resell things like domain names and email, and as such were largely hosting companies. This in turn meant that they were using languages that you might consider “webbier”: open source dynamically-typed languages like Perl, PHP, Python and Ruby. I did what I could to stay away from Perl, I’d coded in PHP and Python for work before, and I picked up Ruby along the way.</p>
<p>Feeling a bit restless, I left Tucows in late 2007 to do Ruby on Rails development at what turned out to be Toronto’s worst-run startup, possibly ever. After that, it was project management at <a href="http://b5media.com/">b5media</a>, where I used Ruby to implement some “housekeeping” scripts. Although I hit up Microsoft Evangelist <a href="http://davidcrow.ca/">David Crow</a> for a copy of Visual Studio so I could try out <a href="http://creators.xna.com/">XNA</a>, I really didn’t pay too much attention to C#. I installed it on my machine, wrote a lazy “Hello, World” app – a single WinForm with a button that displayed a MessageBox with the word “poop” when you clicked it – and promptly forgot about it.</p>
<p>The situation changed <a href="http://www.globalnerdy.com/2008/09/26/this-guns-for-hire/">when I got laid off in September</a> and then <a href="http://www.globalnerdy.com/2008/10/17/company-man-or-the-new-job/">got hired as a Developer Evangelist for “The Empire” in October</a>. Suddenly, I’m back in a world with a three-versions-later Visual Studio and a two-and-a-bit-versions-later of C# and .NET. I’ve got the programming know-how and the language basics down cold; it’s the changes in the language and library – generics, LINQ and a bunch of 2- and 3-letter acronyms beginning with “W” – that keep catching me by surprise.</p>
<p>Luckily, management is cool with my first year being a “learning journey”. They’re really interested in how I mix my schmoozing and community-building skills with a love of technology and programming and don’t mind that my first year is a “learning journey”. They especially don’t mind if I share what I learn along the way, which is what this series of articles, <strong><em>Sith Lord in Training</em></strong>, is all about. As I learn more about C# and the .NET framework, both present versions and the upcoming 4.0 versions, I’ll write about them here.</p>
<h3>Default Parameters in C# 4.0</h3>
<p>Suppose that you’ve got a method that takes a single boolean argument. Here’s how the argument affects what the method does&quot;:</p>
<ul>
<li>If the argument is anything other than true or if no argument is provided, the method performs its normal task. </li>
<li>If the argument is true, the method performs its task, plus some additional stuff. </li>
</ul>
<p>Here’s the Ruby implementation:</p>
<blockquote><pre># Ruby

def myMethod(doSomethingOptional = false)
    puts &quot;Doing my regular thing.&quot;
    if doSomethingOptional
        puts &quot;Doing the optional thing.&quot;
    end
end</pre>
</blockquote>
<p><code>doSomethingOptional</code> is a parameter with a default value. If <code>myMethod</code> is called without any parameters, <code>doSomethingOptional</code> is given the default value of <code>false</code>.</p>
<p>Unfortunately, the current 3.0 version of C# doesn’t support parameter defaults. The way to emulate this behaviour is to use method overloading:</p>
<ul>
<li>One method to handle cases where no parameter is given </li>
<li>Another method to handle cases where a parameter is given </li>
</ul>
<p>Here’s the implementation in C# 3.0:</p>
<blockquote>
<pre>// C# 3.0

public void MyMethod()
{
    MyMethod(false);
}

public void MyMethod(bool doSomethingOptional)
{
   Console.WriteLine(&quot;Doing my regular thing.&quot;);
   if (doSomethingOptional)
   {
       Console.WriteLine(&quot;Doing the optional thing.&quot;);
   }
}</pre>
</blockquote>
<p>That’s a bit long-winded for something that should be pretty simple. Luckily, this has been fixed in C# 4.0:</p>
<blockquote>
<pre>// C# 4.0

public void MyMethod(bool doSomethingOptional = false)
{
   Console.WriteLine(&quot;Doing my regular thing.&quot;);
   if (doSomethingOptional)
   {
       Console.WriteLine(&quot;Doing the optional thing.&quot;);
   }
}</pre>
</blockquote>
<p>And with that, the long-winded (and unnecessary, at least to my mind) method overloading workaround vanishes. Yay!</p>
<h3>Named Parameters in C# 4.0</h3>
<p>Named parameters make the meaning of the parameters explicit, as long as the parameter names themselves are pretty meaningful. Contrast the following call:</p>
<blockquote>
<pre>drawCircle(100, 200, 200, &quot;yellow&quot;)</pre>
</blockquote>
<p>with this, which is supported in Python:</p>
<blockquote>
<pre>drawCircle(radius = 100, x = 200, y = 200, color = &quot;yellow&quot;)</pre>
</blockquote>
<p>C# 3.0 doesn’t support named parameters, but C# 4.0 does. Here’s how you’d call <code>MyMethod</code> in C# 4.0 using them:</p>
<blockquote>
<pre>myMethod(doSomethingOptional: true)</pre>
</blockquote>
<p>As for the Python <code>drawCircle</code> method in the example above. here’s how you’d call it in C# 4.0:</p>
<blockquote>
<pre>DrawCircle(radius: 100, x: 200, y: 200, color: &quot;yellow&quot;)</pre>
</blockquote>
<p>If this syntax is giving you some <em>deja vu</em>, it might be because it’s reminding you of Objective-C, where the call would look something like this:</p>
<blockquote>
<pre>[someObject drawCircleWithRadius:100 x:200 y:200 color:&quot;yellow&quot;]</pre>
</blockquote>
<h3>See the Video</h3>
<p>If you’d like to see more about default and named parameters in C# 4.0, there’s a video on the Chanel 9 site that covers them quite extensively. <a href="http://channel9.msdn.com/shows/10-4/10-4-Episode-12-Simplifying-Your-Code-With-C-40/">Go check it out!</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.globalnerdy.com/2009/03/12/default-and-named-parameters-in-c-40-sith-lord-in-training/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>A Fix for the Error in Hour 9 of &#8220;Teach Yourself ASP.NET Ajax in 24 Hours&#8221; / Client-Side Error Handling in ASP.NET Ajax in .NET 3.5</title>
		<link>http://www.globalnerdy.com/2008/12/03/a-fix-for-the-error-in-hour-9-of-teach-yourself-aspnet-ajax-in-24-hours-client-side-error-handling-in-aspnet-ajax-in-net-35/</link>
		<comments>http://www.globalnerdy.com/2008/12/03/a-fix-for-the-error-in-hour-9-of-teach-yourself-aspnet-ajax-in-24-hours-client-side-error-handling-in-aspnet-ajax-in-net-35/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 19:40:55 +0000</pubDate>
		<dc:creator>Joey deVilla</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ASP.NET 3.5]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[errata]]></category>
		<category><![CDATA[error handling]]></category>
		<category><![CDATA[exception handling]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PageRequestManager]]></category>
		<category><![CDATA[ScriptManager]]></category>

		<guid isPermaLink="false">http://www.globalnerdy.com/2008/12/03/a-fix-for-the-error-in-hour-9-of-teach-yourself-aspnet-ajax-in-24-hours-client-side-error-handling-in-aspnet-ajax-in-net-35/</guid>
		<description><![CDATA[While following the exercises in the book Teach Yourself ASP.NET Ajax in 24 Hours – one of the few books I’ve been able to find on Ajax for ASP.NET 3.5 – I found an error in the “Hour 9” chapter in the example that covers client-side error-handling (it starts on page 137). I’ve reported this [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><a href="http://www.amazon.com/Sams-Teach-Yourself-ASP-NET-Hours/dp/0672329670"><img style="border-right-width: 0px; margin: 0px 0px 10px 10px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Cover of &quot;Teach Yourself ASP.NET Ajax in 24 Hours&quot;" border="0" alt="Cover of &quot;Teach Yourself ASP.NET Ajax in 24 Hours&quot;" align="right" src="http://www.globalnerdy.com/wordpress/wp-content/uploads/2008/12/teach-yourself-aspnet-ajax-in-24-hours.jpg" width="185" height="240" /></a>While following the exercises in the book <em><a href="http://www.amazon.com/Sams-Teach-Yourself-ASP-NET-Hours/dp/0672329670"><strong>Teach Yourself ASP.NET Ajax in 24 Hours</strong></a></em> – one of the few books I’ve been able to find on Ajax for ASP.NET 3.5 – I found an error in the “Hour 9” chapter in the example that covers client-side error-handling (it starts on page 137). I’ve reported this error to the publisher and with any luck, they’ll post a corrected version on their support web page for the book.</p>
<p>I’ve done some searching and haven’t found anything covering this error so I thought I’d cover it here. Better still, I’ll also cover the fix, which turns out to be quite simple. If you’ve been trying out the code in the book and wondering why it doesn’t work, relax: at least in this case, it’s not your fault.</p>
<p>In the course of covering the error and how to fix it, I’ll also talk about how ASP.NET handles exceptions raised by asynchronous postbacks and how you can make use of it to make better user interfaces. Even if you don’t have a copy of <em>Teach Yourself ASP.NET Ajax in 24 Hours,</em> you should find this article an interesting introduction to client-side error handling in ASP.NET Ajax.</p>
<h3>Unhandled Exceptions and Asynchronous Postbacks</h3>
<p>In ASP.NET Ajax, if an exception is raised during an asynchronous postback and isn’t handled on the server side – that is, in the code-behind – it gets passed along to the client side. What happens on the client side depends on which version of ASP.NET you’re using:</p>
<ul>
<li><strong>In ASP.NET Ajax 1.0,</strong> the server-side exception object is serialized into <a href="http://www.json.org/">JSON</a>. The JSON is sent to the client, which displays the exception’s message property in an alert box. </li>
<li><strong>In ASP.NET Ajax for .NET 3.5,</strong> the server-side exception is still serialized into JSON and the JSON is still sent to the client. However, instead of displaying the exception’s message property in an alert box – a presumptuous design decision, if you want my opinion – the client throws the exception, which gives you the opportunity to handle it on the client side as you please. </li>
</ul>
<p>(In this article, I’ll stick to covering ASP.NET Ajax for .NET 3.5.)</p>
<p>This is quite different from most other web application frameworks, where an exception raised as the result of an <a href="http://www.w3.org/TR/XMLHttpRequest/">XMLHttpRequest</a> call to the server results in some kind of “error” page from the server (or a blank page, if you’re suppressing error reporting). </p>
<p>To illustrate this, let’s put together a simple ASP.NET Ajax application. It’s a single page with a single button, that if clicked, throws an exception.</p>
<p>Here’s the code for the page layout. It’s pretty straightforward:</p>
<p><strong>Listing 1: <code>Default.aspx</code> – Layout for the page of our simple ASP.NET Ajax application<em>.</em></strong></p>
<p> <code>
<pre>&lt;%@ Page Language=&quot;C#&quot; AutoEventWireup=&quot;true&quot;
CodeBehind=&quot;Default.aspx.cs&quot; Inherits=&quot;WebApplication1._Default&quot; %&gt;

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;
&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;

&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; &gt;
&lt;head runat=&quot;server&quot;&gt;
    &lt;title&gt;Error Handling Demo 1&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
    &lt;form id=&quot;form1&quot; runat=&quot;server&quot;&gt;

        &lt;div&gt;
            &lt;asp:ScriptManager ID=&quot;ScriptManager1&quot; runat=&quot;server&quot; /&gt;
            &lt;asp:UpdatePanel runat=&quot;server&quot; ID=&quot;UpdatePanel1&quot;&gt;
                &lt;ContentTemplate&gt;
                    &lt;asp:Button runat=&quot;server&quot; ID=&quot;Button1&quot;
                    Text=&quot;Click Me&quot; OnClick=&quot;Button1_OnClick&quot; /&gt;
                &lt;/ContentTemplate&gt;
            &lt;/asp:UpdatePanel&gt;
        &lt;/div&gt;

    &lt;/form&gt;
&lt;/body&gt;

&lt;/html&gt;</pre>
<p></code></p>
<p>Some notes about the code:</p>
<ul>
<li>The <code>ScriptManager</code> control at the top of the form enables Ajax by ensuring that the JavaScript needed to support ASP.NET Ajax on the client side is downloaded to the browser. </li>
<li>The <code>UpdatePanel</code> control determines the controls that trigger asynchronous postbacks and defines the region of the page that can be updated via Ajax. </li>
<li><code>Button1</code> is the button control that we want to throw an exception when clicked. We’ll set it to call the <code>Button1_OnClick</code> method, which will contain the exception-throwing code. </li>
</ul>
<p>The code-behind is very simple. In it, we define a single method: the event handler <code>Button1_OnClick</code>, which is called in response when the user clicks <code>Button1</code>. All we want it to do is throw an exception that uniquely identifies itself:</p>
<p><strong>Listing 2: <code>Default.aspx.cs</code> – Code-behind for the page of our very simple example app<em>.</em></strong></p>
<p><code></p>
<pre>using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Button1_OnClick(object sender, EventArgs e)
        {
            throw new Exception(&quot;Click!&quot;);
        }
    }
}</pre>
<p></code></p>
<h4>Running with Debugging vs. Running Without Debugging</h4>
<p>Listing 1 and 2 give us enough to make our simple app work. It’s time to take it for a spin.</p>
<p>Here’s something that doesn’t get covered in <em>Teach Yourself ASP.NET Ajax in 24 Hours: </em>what happens when you try to run this app <em>with</em> debugging (starting it by hitting F5 in Visual Studio or “Start Debugging” under the “Debug” menu)? </p>
<p>Here’s a screenshot of what happened for me: <img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="simple_app_with_debugging" border="0" alt="simple_app_with_debugging" src="http://www.globalnerdy.com/wordpress/wp-content/uploads/2008/12/simple-app-with-debugging.jpg" width="567" height="417" /> </p>
<p>With debugging on, the unhandled exception thrown in <code>Button1_OnClick</code> is caught by the debugger. Normally, this sort of error-catching behaviour is welcome, but in this particular case, it gets in the way of what we’re trying to achieve: having an exception on the server side and passing it along to the user’s browser to handle.</p>
<p>If we run the same app without debugging, we get the effect we want: the exception is raised on the server side, but the server-side part of the application doesn’t halt with an error message. Instead, the client shows the error message.</p>
<p>Here’s a screenshot. Note that the error message includes the string “Click!”, which is the argument in the throw statement the <code>Button1_OnClick</code> event handler. Thanks to this, we can be pretty certain that the error message is the result of our deliberately-thrown exception:</p>
<p><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://www.globalnerdy.com/wordpress/wp-content/uploads/2008/12/image.png" width="502" height="327" /></p>
<p>Now that we have the exception that we threw on the server side being handled on the client side, let’s do something with it.&#160; </p>
</p>
<h3>Handling Exceptions Passed from the Server on the Client Side</h3>
<p>Let’s do something simple – let’s catch the exception caused by the button click, and instead of having a JavaScript error box pop up, let’s make a couple of changes to the button:</p>
<ul>
<li>Change its text to “This button has been disabled for your safety.” </li>
<li>Disable it. </li>
</ul>
<p>To handle exceptions on the client side, we need to write some client-side JavaScript. Luckily, this is made simple by the number of handy utility classes defined in the scripts downloaded to the client by the <code>ScriptManager</code> component. In this case, we’re going to make use of the <code><a href="http://msdn.microsoft.com/en-us/library/bb311028.aspx">Sys.Webforms.PageRequestManager</a></code> class to deal with the exception because it provides us with the following:</p>
<ul>
<li>The <code><a href="http://msdn.microsoft.com/en-us/library/bb383810.aspx">endRequest</a></code> event, which is raised after an asynchronous postback has completed and control is returned to the browser. </li>
<li>The <code>add_endRequest</code> method, which specifies a method to call when the <code>endRequest</code> event is raised. </li>
</ul>
<p>Here’s the JavaScript, which we’ll put in a file called <code>ErrorHandler.js</code>:</p>
<p><strong>Listing 3: <code>ErrorHandler.js</code> &#8212; Client-side error handler for our very simple example app<em>.</em></strong></p>
<p><code></p>
<pre>Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

function EndRequestHandler(sender, args)
{
    if (args.get_error() != undefined) {
        $get('Button1').value = &quot;This button has been disabled for your safety.&quot;;
        $get('Button1').disabled = true;
        args.set_errorHandled(true);
    }
}</pre>
<p></code></p>
<p>The script performs the following:</p>
<ul>
<li>It registers the method <code>EndRequestHandler</code> as the method to call whenever the <code>endRequest</code> event is raised. </li>
<li>It defined the method <code>EndRequestHandler</code>, which does the following:
<ul>
<li>If an exception did occur during the asynchronous callback:&quot;
<ul>
<li>The button’s text is changed </li>
<li>The button is disabled </li>
<li>The error is reported as handled, which allows the application to continue </li>
</ul>
</li>
</ul>
</li>
</ul>
<p>Now that we have this client-side code, we need to get it to the client. We do this by using the <code>Scripts</code> section of the <code>ScriptManager</code> to send this file to the client. The listing below shows the updated layout code for our simple application. I’ve highlighted the change in the listing below:</p>
<p><strong>Listing 4: Revised <code>Default.aspx</code> – Layout for the page of our simple ASP.NET Ajax application<em>.</em></strong></p>
<p><code></p>
<pre>&lt;%@ Page Language=&quot;C#&quot; AutoEventWireup=&quot;true&quot; CodeBehind=&quot;Default.aspx.cs&quot; Inherits=&quot;WebApplication1._Default&quot; %&gt;

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;

&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; &gt;
&lt;head runat=&quot;server&quot;&gt;
    &lt;title&gt;Error Handling Demo 1&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
    &lt;form id=&quot;form1&quot; runat=&quot;server&quot;&gt;

        &lt;div&gt;
            <b>&lt;asp:ScriptManager ID=&quot;ScriptManager1&quot; runat=&quot;server&quot;&gt;
                &lt;Scripts&gt;
                    &lt;asp:ScriptReference Path=&quot;~/ErrorHandler.js&quot; /&gt;
                &lt;/Scripts&gt;
            &lt;/asp:ScriptManager&gt;</b>
            &lt;asp:UpdatePanel runat=&quot;server&quot; ID=&quot;UpdatePanel1&quot;&gt;
                &lt;ContentTemplate&gt;
                    &lt;asp:Button runat=&quot;server&quot; ID=&quot;Button1&quot;
                    Text=&quot;Click Me&quot; OnClick=&quot;Button1_OnClick&quot; /&gt;
                &lt;/ContentTemplate&gt;
            &lt;/asp:UpdatePanel&gt;
        &lt;/div&gt;

    &lt;/form&gt;
&lt;/body&gt;

&lt;/html&gt;</pre>
<p></code></p>
<p><strong></strong></p>
<p>The <code>Scripts</code> section of the <code>ScriptManager</code> lets us specify scripts to be sent to the client along with the page, with each script specified in a <code>ScriptReference</code> tag.</p>
<p>When we run the app (remember, <em>without </em>debugging on) with these changes and click the button, here’s what we get:</p>
<p><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Button with text &quot;This button has been disabled for your safety&quot;" border="0" alt="Button with text &quot;This button has been disabled for your safety&quot;" src="http://www.globalnerdy.com/wordpress/wp-content/uploads/2008/12/sample-app-revised-screenshot.gif" width="401" height="43" /> </p>
<p>In a later article, I’ll look at other ways of using client-side error handling in ASP.NET Ajax in .NET 3.5.</p>
<h3>The Error in <em>Teach Yourself ASP.NET Ajax in 24 Hours</em></h3>
<p>Here’s the page layout code for the error-handling example in <em>Teach Yourself ASP.NET Ajax in 24 Hours</em>. The code-behind for the page and the client-side JavaScript are fine, it’s this code that has the error. See if you can spot what’s amiss:</p>
<p><strong>Listing 5: <code>Default.aspx</code> &#8212; Page layout of client-side error-handling example in Hour 9 of <em>Teach Yourself ASP.NET Ajax in 24 Hours.</em></strong></p>
<p><code></p>
<pre>&lt;%@ Page Language=&quot;C#&quot; AutoEventWireup=&quot;true&quot; CodeBehind=&quot;Default.aspx.cs&quot; Inherits=&quot;WebApplication1._Default&quot; %&gt;

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;

&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; &gt;
&lt;head runat=&quot;server&quot;&gt;
    &lt;title&gt;&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
    &lt;form id=&quot;form1&quot; runat=&quot;server&quot;&gt;

        &lt;div&gt;
            &lt;asp:ScriptManager ID=&quot;ScriptManager1&quot; runat=&quot;server&quot; /&gt;
            &lt;asp:UpdatePanel runat=&quot;server&quot; ID=&quot;UpdatePanel1&quot;&gt;
                &lt;ContentTemplate&gt;
                    &lt;asp:Button runat=&quot;server&quot; ID=&quot;Button1&quot;
                    Text=&quot;Click Me&quot; OnClick=&quot;Button1_OnClick&quot; /&gt;
                &lt;/ContentTemplate&gt;
            &lt;/asp:UpdatePanel&gt;
        &lt;/div&gt;

        &lt;br /&gt;&lt;br /&gt;

        &lt;div id=&quot;Message&quot; style=&quot;visibility: hidden;&quot;&gt;
            &lt;asp:HyperLink ID=&quot;HyperLink1&quot; runat=&quot;server&quot;
                           Font-Bold=&quot;true&quot;
                           Text=&quot;Error Occurred...&quot;
                           Font-Italic=&quot;true&quot;
                           ForeColor=&quot;red&quot; &gt;
            &lt;/asp:HyperLink&gt;
        &lt;/div&gt;

    &lt;/form&gt;
&lt;/body&gt;

&lt;/html&gt;</pre>
<p></code></p>
<p>Just for kicks, here’s what happens when you click on the button in the app using the code straight from <em>Teach Yourself ASP.NET Ajax in 24 Hours</em>:</p>
<p><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="Screen capture of resulting error message from original &quot;Teach Yourself ASP.NET Ajax in 24 Hours&quot; application" border="0" alt="Screen capture of resulting error message from original &quot;Teach Yourself ASP.NET Ajax in 24 Hours&quot; application" src="http://www.globalnerdy.com/wordpress/wp-content/uploads/2008/12/screen-capture-1.gif" width="582" height="337" /></p>
<p>The mistake is simple: although there is some error-handling client-side JavaScript in the app, it’s not referenced in the <code>ScriptManager</code> tag, which means it’s not sent to the client. Without error-handling code on the client side, the exception is thrown, there’s nothing to catch it and the user is presented with the standard error dialog box.</p>
<p>The fix is equally simple: reference the script in the <code>ScriptManager</code> tag’s <code>Scripts</code> section:</p>
<p><code></p>
<pre>&lt;asp:ScriptManager ID=&quot;ScriptManager1&quot; runat=&quot;server&quot;&gt;
    &lt;Scripts&gt;
        &lt;asp:ScriptReference Path=&quot;~/ErrorHandlingScript.js&quot; /&gt;
    &lt;/Scripts&gt;
&lt;/asp:ScriptManager&gt;</pre>
<p></code></p>
<p>Once that’s done, the program works as promised.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.globalnerdy.com/2008/12/03/a-fix-for-the-error-in-hour-9-of-teach-yourself-aspnet-ajax-in-24-hours-client-side-error-handling-in-aspnet-ajax-in-net-35/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The C# &#8220;Yellow Book&#8221;: Free as in Beer and Good as in Beginner&#8217;s Guide</title>
		<link>http://www.globalnerdy.com/2008/11/24/the-c-yellow-book-free-as-in-beer-and-good-as-in-beginners-guide/</link>
		<comments>http://www.globalnerdy.com/2008/11/24/the-c-yellow-book-free-as-in-beer-and-good-as-in-beginners-guide/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 02:15:07 +0000</pubDate>
		<dc:creator>Joey deVilla</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[beginners]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[cheap]]></category>
		<category><![CDATA[free as in beer]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[students]]></category>

		<guid isPermaLink="false">http://www.globalnerdy.com/2008/11/24/the-c-yellow-book-free-as-in-beer-and-good-as-in-beginners-guide/</guid>
		<description><![CDATA[ 
As a new Microsoftie and programmer returning to C# after a six-year absence, I have a lot of learning and re-learning ahead of me. In preparation for this, I spent the better part of an afternoon in the “Computers” section of my neighbourhood bookstore going through the C# programming books, sorting the gems from [...]]]></description>
			<content:encoded><![CDATA[<p></p><p><a target="_blank" href="http://www.globalnerdy.com/wordpress/wp-content/uploads/2008/11/c-sharp-yellow-book.jpg"><img style="border-right-width: 0px; margin: 0px 0px 0px 10px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Cover of the &quot;C Sharp Yellow Book&quot;" border="0" alt="Cover of the &quot;C Sharp Yellow Book&quot;" align="right" src="http://www.globalnerdy.com/wordpress/wp-content/uploads/2008/11/c-sharp-yellow-book-thumb.jpg" width="250" height="382" /></a> </p>
<p>As a new Microsoftie and programmer returning to C# after a six-year absence, I have a lot of learning and re-learning ahead of me. In preparation for this, I spent the better part of an afternoon in the “Computers” section of my neighbourhood bookstore going through the C# programming books, sorting the gems from the junk. I took the “beginner’s mind” approach and looked at all the books on the shelves, regardless of the skill level they were written for, even the books that devoted whole chapters to basic concepts like looping and branching. At the very least, it would give me an idea of the current state of programming literature was like in the .NET world.</p>
<p>A couple of weeks later, I stumbled across the <strong><a target="_blank" href="http://csharpcourse.com/">C# “Yellow Book”</a></strong>. It’s the standard book for first year computer science students at the <a href="http://www.hull.ac.uk/">University of Hull</a> (I know of it thanks to <a target="_blank" href="http://en.wikipedia.org/wiki/University_of_Hull#In_popular_culture">a <em>Black Adder</em> episode</a>) and written by <a target="_blank" href="http://www.robmiles.com/">Rob Miles</a>, a <a target="_blank" href="http://mvp.support.microsoft.com/">Microsoft MVP</a> and lecturer at that university. Each computer science student there is given a free-as-in-beer printed copy of the book, <strong><a target="_blank" href="http://www.csharpcourse.com/">and now anyone can get a free-as-in-beer PDF copy online</a></strong>.</p>
<p>The C# Yellow Book is quite good, and can easily hold its own against some of the commercial C# books I’ve seen, which typically sell for about $35. It’s written in a clear and breezy style, explains it concepts well, has examples that <em>actually work</em> (I tried some out just for kicks) and often goes beyond typical beginners’ books with many asides called “Programmers’ Points” that explain good programming technique. Its 185 pages cover most of the basic C# language &#8212; and most of the example code is run in console mode except for the section near the end that covers basic <a target="_blank" href="http://en.wikipedia.org/wiki/Windows_Forms">Windows Forms</a>. After finishing this book, you should have enough background material to tackle an intermediate book on C# or introductory books on .NET topics like <a target="_blank" href="http://windowsclient.net/">GUI programming</a>, <a target="_blank" href="http://www.asp.net/">ASP.NET</a> or even game development for the PC, Xbox 360 and Zune (yeah, really, the <em>Zune</em>) with <a target="_blank" href="http://msdn.microsoft.com/en-us/xna/default.aspx">XNA</a>.</p>
<p>I’d say that Rob has a strong incentive to make the book as good as possible because it’s the basis of a course at his university and because he can get some rather immediate feedback from its readership. If only that was true for a professor of mine back at <a target="_blank" href="http://queensu.ca/">Crazy Go Nuts University</a>, whose Pascal programming book (it was the eighties) had terrible examples, an incomprehensible presentation and writing style and annual revisions to foil used-book sales and to force each new class to buy the latest edition. Kudos to Rob and the computer science department at Hull for giving away the course textbook for free!</p>
<p>If you’re a starving student looking to learn Windows programming, I’d recommend getting your hands on a copy of Rob Miles’ free-as-in-beer C# “Yellow Book” and pair it with Microsoft’s free-as-in-beer <a target="_blank" href="http://www.microsoft.com/express/vcsharp/">Visual C# 2008 Express Edition</a>. Alas, I can’t point you to any free-as-in-beer computers.</p>
<h3>Links</h3>
<ul>
<li><a target="_blank" href="http://csharpcourse.com/">Rob Miles’ C# “Yellow Book”</a></li>
<li><a target="_blank" href="http://www.microsoft.com/express/vcsharp/">Visual C# 2008 Express Edition</a></li>
<li><a target="_blank" href="http://windowsclient.net/">WindowsClient.NET</a>: The official site for GUI development in Windows, covering both Windows Forms and the new GUI framework, WPF.</li>
<li><a target="_blank" href="http://www.asp.net/">ASP.NET</a>: The official site for ASP.NET, Microsoft’s framework for web application development.</li>
<li><a target="_blank" href="http://msdn.microsoft.com/en-us/xna/default.aspx">XNA Developer Center</a>: The official site for XNA, Microsoft’s game development framework.</li>
<li><a target="_blank" href="http://creators.xna.com/en-US/">XNA Creators Club</a>: The online community for XNA game developers.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.globalnerdy.com/2008/11/24/the-c-yellow-book-free-as-in-beer-and-good-as-in-beginners-guide/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>C++ Pointers for Kids</title>
		<link>http://www.globalnerdy.com/2008/11/22/c-pointers-for-kids/</link>
		<comments>http://www.globalnerdy.com/2008/11/22/c-pointers-for-kids/#comments</comments>
		<pubDate>Sat, 22 Nov 2008 21:32:35 +0000</pubDate>
		<dc:creator>Joey deVilla</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[complex made simple]]></category>
		<category><![CDATA[Funny]]></category>
		<category><![CDATA[pointers]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://www.globalnerdy.com/2008/11/22/c-pointers-for-kids/</guid>
		<description><![CDATA[Here&#8217;s a fun little claymation video showing called Pointer Fun with Binky&#160;that explains C++ pointers “to kids”. Why can&#8217;t all programming be taught this way?

My favourite phrase of the moment, thanks to this video, is &#8220;Magic Wand of Dereferencing&#8221;.
[Found via Being Cellfish.]
]]></description>
			<content:encoded><![CDATA[<p></p><p>Here&#8217;s a fun little claymation video showing called <strong><em><a href="http://www.youtube.com/watch?v=UvoHwFvAvQE">Pointer Fun with Binky</a></em>&#160;</strong>that explains C++ pointers “to kids”. Why can&#8217;t all programming be taught this way?</p>
<p style="text-align: center"><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/UvoHwFvAvQE&amp;hl=en&amp;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/UvoHwFvAvQE&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p>My favourite phrase of the moment, thanks to this video, is &#8220;Magic Wand of Dereferencing&#8221;.</p>
<p>[Found via <a href="http://blogs.msdn.com/cellfish/archive/2008/10/31/c-pointer-basics-for-kids.aspx"><cite>Being Cellfish</cite></a>.]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.globalnerdy.com/2008/11/22/c-pointers-for-kids/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Salmagundi for Friday, November 7th, 2008</title>
		<link>http://www.globalnerdy.com/2008/11/07/salmagundi-for-friday-november-7th-2008/</link>
		<comments>http://www.globalnerdy.com/2008/11/07/salmagundi-for-friday-november-7th-2008/#comments</comments>
		<pubDate>Fri, 07 Nov 2008 22:18:20 +0000</pubDate>
		<dc:creator>Joey deVilla</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Play]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software and Services]]></category>
		<category><![CDATA[What Joey Did]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[documentation]]></category>
		<category><![CDATA[Games]]></category>
		<category><![CDATA[MSDN]]></category>
		<category><![CDATA[PDC]]></category>
		<category><![CDATA[PDC2008]]></category>
		<category><![CDATA[social bookmarking]]></category>
		<category><![CDATA[videogames]]></category>
		<category><![CDATA[XNA]]></category>
		<category><![CDATA[Zero Punctuation]]></category>

		<guid isPermaLink="false">http://www.globalnerdy.com/2008/11/07/salmagundi-for-friday-november-7th-2008/</guid>
		<description><![CDATA[Interview with Chris Slemp, MSDN
 
Here’s another video interview featuring Yours Truly at the PDC: it’s with Chris Slemp, Program Manager for the Server and Tools Online group at Microsoft. In the interview, we talk about MSDN and its new social bookmarking feature.
Click here to watch the video.
“Grim Fandango’s” Puzzle Document
 
If you’re looking to [...]]]></description>
			<content:encoded><![CDATA[<p></p><h3>Interview with Chris Slemp, MSDN</h3>
<p><a href="http://blogs.msdn.com/cdndevs/archive/2008/11/06/canucks-at-pdc-social-bookmarking-at-msdn.aspx"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="joey_devilla_chris_slemp" border="0" alt="joey_devilla_chris_slemp" src="http://www.globalnerdy.com/wordpress/wp-content/uploads/2008/11/joey-devilla-chris-slemp.jpg" width="414" height="233" /></a> </p>
<p>Here’s another video interview featuring Yours Truly at the PDC: it’s with <a href="http://blogs.msdn.com/cslemp/"><strong>Chris Slemp</strong></a>, Program Manager for the Server and Tools Online group at Microsoft. In the interview, we talk about MSDN and its new social bookmarking feature.</p>
<p><strong><a href="http://blogs.msdn.com/cdndevs/archive/2008/11/06/canucks-at-pdc-social-bookmarking-at-msdn.aspx">Click here to watch the video.</a></strong></p>
<h3>“Grim Fandango’s” Puzzle Document</h3>
<p><a href="http://www.doublefine.com/news.php/site/comments/just_one_more_grim_thing/"><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="grim_fandango_puzzle_document" border="0" alt="grim_fandango_puzzle_document" src="http://www.globalnerdy.com/wordpress/wp-content/uploads/2008/11/grim-fandango-puzzle-document.jpg" width="500" height="375" /></a> </p>
<p>If you’re looking to get into the mind of a game designer and the design of one of the most highly-regarded computer adventures games, be sure to check out the <strong><a href="http://www.doublefine.com/news.php/site/comments/just_one_more_grim_thing/">Grim Fandango Puzzle Document</a></strong>. Tim Schafer, in “a temporary fit of Cake-induced Grim nostalgia,” decided to put the game’s puzzle design document online in PDF form (it’s 2.3MB in size). </p>
<p><a href="http://www.geero.net/2008/11/anatomy-of-a-classic.html">Here’s a great summary of the Grim Fandango Puzzle Document</a>, written by Andy Geers:</p>
<blockquote><p>I use that word &quot;crafted&quot; because that&#8217;s exactly what this newly released document shows: true craftsmanship. We see the incredible attention to detail, the pacing of the narrative as it builds and as the puzzles get increasingly sophisticated, always coaxing the player along with them. As somebody whose spent the last few years trying to write <a href="http://www.geero.net/bible-games.html">my own adventure game</a>, what struck me most about this document is the sheer <em>simplicity</em> of it &#8211; it&#8217;s well established that it takes a great deal of clarity and hard work to boil down something so vast as Grim Fandango into such a simple representation that conveys so much information in such a succinct way.</p>
</blockquote>
<p>It’s a considerably more interesting read than most specs.</p>
<h3>My Job-Related Reading List</h3>
<p>Nothing gives you that frozen-caveman-thawed-in-modern-times feeling like returning to a software platform after not developing in it in seven years. Getting back into the swing of Microsoft’s development tools has been fun so far, but it is, as a lot of people have told me, like drinking from the firehose.</p>
<p><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="reading_list_nov_2008" border="0" alt="reading_list_nov_2008" src="http://www.globalnerdy.com/wordpress/wp-content/uploads/2008/11/reading-list-nov-2008.jpg" width="483" height="208" /> </p>
<p>To quickly get acclimated with C#, ASP.NET and XNA, I’m expensing the following books I bought today:</p>
<ul>
<li><strong><em><a href="http://www.amazon.com/2008-NET-Platform-Fourth-Windows-Net/dp/1590598849/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1226095180&amp;sr=1-1">Pro C# 2008 and the .NET 3.5 Platform</a> </em></strong>by Andrew Troelsen </li>
<li><strong><em><a href="http://www.amazon.com/Professional-ASP-NET-3-5-VB-Programmer/dp/0470187573">Professional ASP.NET 3.5 in C# and VB</a></em> </strong>by Bill Evjen, Scott Hanselman and Devin Rader </li>
<li><strong><em><a href="http://www.amazon.com/Beginning-XNA-2-0-Game-Programming/dp/1590599241/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1226095299&amp;sr=1-1">Beginning XNA 2.0 Game Programming</a></em></strong> by Alexandre Santos Lobao, Bruno Pereira Evangelista, and Jose Antonio Leal de Farias </li>
</ul>
<p>I’ll let you know what I think of these books as I read them.</p>
<h3>“Zero Punctuation” Reviews</h3>
<p>And finally, a couple of reviews from my all-time favourite game reviewer, Ben “Yahtzee” Croshaw. The first one’s for <em>Saints Row 2</em>, which includes a great argument for why it might actually be a better game than <em>Grand Theft Auto IV</em> as well as a brilliant concept for a new game:</p>
<p style="text-align: center"><embed src="http://static.escapistmagazine.com/media/global/movies/player/FlowPlayerDark.2.2.4-tm.swf?config=%7Bembedded%3Atrue%2CplayList%3A%5B+%7B+%27url%27%3A312%2C%27linkUrl%27%3A%27http%3A%2F%2Fwww.escapistmagazine.com%2Fvideos%2Fview%2Fzero-punctuation%2F312-Saints-Row-2%27%2C%27linkWindow%27%3A%27_top%27%2C%27name%27%3A%27Saints%2BRow%2B2%27+%7D+%5D%2CsplashImageFile%3A%27http%3A%2F%2Fwww.escapistmagazine.com%2Fglobal%2Fcastfire%2Fsplash%2F312.jpg%27%2CshowVolumeSlider%3Atrue%2Cpid%3A%27html_test%27%2CinitialScale%3A%27fit%27%2Cloop%3Afalse%2CautoPlay%3Afalse%2CautoBuffering%3Afalse%2CusePlayOverlay%3Afalse%2CautoRewind%3Atrue%2CbufferLength%3A15%2CmenuItems%3A%5Bfalse%2Cfalse%2Cfalse%2Cfalse%2Ctrue%2Ctrue%5D%7D" allowfullscreen="true" allowscriptaccess="always" quality="high" bgcolor="#333333" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" height="328" width="400" wmode="opaque"></embed></p>
<p>and here’s the latest review, for <em>Dead Space</em>, which he summarizes as “competent but bland”. Luckily, his review is anything but…</p>
<p style="text-align: center"><embed src="http://static.escapistmagazine.com/media/global/movies/player/FlowPlayerDark.2.2.4-tm.swf?config=%7Bembedded%3Atrue%2CplayList%3A%5B+%7B+%27url%27%3A333%2C%27linkUrl%27%3A%27http%3A%2F%2Fwww.escapistmagazine.com%2Fvideos%2Fview%2Fzero-punctuation%2F333-Dead-Space%27%2C%27linkWindow%27%3A%27_top%27%2C%27name%27%3A%27Dead%2BSpace%27+%7D+%5D%2CsplashImageFile%3A%27http%3A%2F%2Fwww.escapistmagazine.com%2Fglobal%2Fcastfire%2Fsplash%2F333.jpg%27%2CshowVolumeSlider%3Atrue%2Cpid%3A%27html_test%27%2CinitialScale%3A%27fit%27%2Cloop%3Afalse%2CautoPlay%3Afalse%2CautoBuffering%3Afalse%2CusePlayOverlay%3Afalse%2CautoRewind%3Atrue%2CbufferLength%3A15%2CmenuItems%3A%5Bfalse%2Cfalse%2Cfalse%2Cfalse%2Ctrue%2Ctrue%5D%7D" allowfullscreen="true" allowscriptaccess="always" quality="high" bgcolor="#333333" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer" height="328" width="400" wmode="opaque"></embed></p>
]]></content:encoded>
			<wfw:commentRss>http://www.globalnerdy.com/2008/11/07/salmagundi-for-friday-november-7th-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Going Down Memory Lane with C</title>
		<link>http://www.globalnerdy.com/2008/09/16/going-down-memory-lane-with-c/</link>
		<comments>http://www.globalnerdy.com/2008/09/16/going-down-memory-lane-with-c/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 04:00:03 +0000</pubDate>
		<dc:creator>Joey deVilla</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[What Joey Did]]></category>
		<category><![CDATA[Arduino progamming language]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[my sordid past]]></category>
		<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://www.globalnerdy.com/?p=1417</guid>
		<description><![CDATA[The July 25, 1994 issue of Time magazine.
The computer science student phase of my academic career (the less said about the previous phase, in which I was an electrical engineering student, the better) ran from 1991 to a successful conclusion in 1994. 
If you are like me, you strongly connect memories with the music of [...]]]></description>
			<content:encoded><![CDATA[<p></p><p class="center"><a href="http://www.time.com/time/magazine/0,9263,7601940725,00.html"><img src="http://www.globalnerdy.com/wordpress/wp-content/uploads/2008/09/time_magazine_july_25_1994.jpg" alt="July 25, 1994 issue of Time magazine" title="July 25, 1994 issue of Time magazine" width="300" height="395" /></a><br /><span class="caption">The July 25, 1994 issue of <cite>Time</cite> magazine.</span></p>
<p>The computer science student phase of my academic career (the less said about the previous phase, in which I was an electrical engineering student, the better) ran from 1991 to a successful conclusion in 1994. </p>
<p>If you are like me, you strongly connect memories with the music of the time; you could say that my computer science student phase ran from the time of Nirvana&#8217;s <a href="http://en.wikipedia.org/wiki/Nevermind"><cite>Nevermind</cite></a> and Soundgarden&#8217;s <a href="http://en.wikipedia.org/wiki/Badmotorfinger"><cite>Badmotorfinger</cite></a> to Green Day&#8217;s <a href="http://en.wikipedia.org/wiki/Dookie"><cite>Dookie</cite></a> and The Offspring&#8217;s <a href="http://en.wikipedia.org/wiki/Smash_(album)"><cite>Smash</cite></a>. Let&#8217;s just say that I often showed up to my classes and labs in a flannel shirt.</p>
<p class="center"><img src="http://www.globalnerdy.com/wordpress/wp-content/uploads/2008/09/nirvana_nevermind_green_day_dookie.jpg" alt="Album covers: Nirvana&#039;s &quot;Nevermind&quot; and Green Day&#039;s &quot;Dookie&quot;" title="Album covers: Nirvana&#039;s &quot;Nevermind&quot; and Green Day&#039;s &quot;Dookie&quot;" width="500" height="250" /></p>
<p>(If that last paragraph makes you think &#8220;Whoa, that was a long time ago!&#8221;, you&#8217;ll be blown away by the fact that the initial work on C ran from the time of the Beatles&#8217; <a href="http://en.wikipedia.org/wiki/Abbey_Road_(album)"><cite>Abbey Road</cite></a> to Led Zeppelin&#8217;s <a href="http://en.wikipedia.org/wiki/Houses_of_the_Holy"><cite>Houses of the Holy</cite></a>. A fair number of you probably weren&#8217;t even born then.)</p>
<h3>My Student Language of Choice</h3>
<p>I don&#8217;t know what the situation was like at other schools, but at the time, computer science students at <a href="http://queensu.ca/">Crazy Go Nuts University</a> were allowed to hand in programming assignments using the following languages:</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Pascal_programming_language">Pascal</a></li>
<li><a href="http://en.wikipedia.org/wiki/Turing_(programming_language)">Turing</a></li>
<li><a href="http://en.wikipedia.org/wiki/C_(programming_language)">C</a></li>
</ul>
<p>(Remember, there was no Java back then. The <a href="http://www.cafeaulait.org/slides/hope/02.html">Green Project</a>, from which the language/platform sprang, was still ongoing at this time, and Java was still going by its <a href="http://ei.cs.vt.edu/book/chap1/java_hist.html">&#8220;Oak&#8221;</a> codename.)</p>
<p>The general recommendation that came from most of my professors was to use Turing. They told us that it was a kinder, gentler language than Pascal and even more so than C, which they implied was designed by dyslexic aliens. When some of us suggested that it might be better to use a language that saw actual use in the real world, many of them countered with the argument that learning principles of computing was more important than learning specific languages. We might&#8217;ve responded by pointing out that <a href="http://research.cs.queensu.ca/~cordy/">one of our professors</a> was a co-creator of Turing and probably got a <a href="http://en.wikipedia.org/wiki/Vigorish">vig</a> for every Turing installation (it was a commercial language), but that might have been an academic career-limiting move.</p>
<p>I ignored their recommendations and went with C. In the lab, I used good ol&#8217; <code>cc</code>. At home, it was <a href="http://en.wikipedia.org/wiki/Turbo_C">Turbo C</a> at first, and later, when I got my first Mac (a <a href="http://www.everymac.com/systems/apple/mac_quadra/stats/mac_quadra_660av.html">Quadra 660AV</a> bought with money from DJing), <a href="http://www.mactech.com/articles/mactech/Vol.07/07.09/ThinkC5.0/">Think C</a>.</p>
<p>I never used C in my professional career. <a href="http://craphound.com/nonfic/mackerel.html">My first job out of school</a> took me away from a world where input and output was all <code>printf()</code> and <code>scanf()</code> to interactive CD-ROMs and Macromedia Director (now <a href="http://www.adobe.com/products/director/">Adobe Director</a> and 7 versions later), and after that, the languages remained pretty high level: Visual Basic, Python, Java, C#, <a href="http://www.nsbasic.com/palm/">NSBasic</a>, PHP and Ruby, with only a slight detour through through Visual C++ and C++Builder.</p>
<h3>My C Books Back Then</h3>
<p class="center"><a href="http://cm.bell-labs.com/cm/cs/cbook/"><img src="http://www.globalnerdy.com/wordpress/wp-content/uploads/2008/09/the_c_programming_language.jpg" alt="Cover of &quot;The C Programming Language&quot;" title="Cover of &quot;The C Programming Language&quot;" width="220" height="287" /></a></p>
<p>It&#8217;s almost impossible to talk about C without mentioning &#8220;K&#038;R&#8221;, the nickname for what is considered to be the official bible of C, <a href="http://cm.bell-labs.com/cm/cs/cbook/"><strong><cite>The C Programming Language</cite></strong></a>, which was written by <a href="http://en.wikipedia.org/wiki/Brian_Kernighan">Brian Kernighan</a> and <a href="http://en.wikipedia.org/wiki/Dennis_Ritchie">Dennis Ritchie</a>. The latest edition of the book &#8212; the second edition &#8212; is a bit long in the tooth as it was written in 1988, but for the most part, everything in this book should still apply to the current <a href="http://en.wikipedia.org/wiki/C99">C99</a> standard.</p>
<p>I never owned a copy of the book in my student days. I signed it out when necessary from the electrical engineering/computer science library in <a href="http://www.queensu.ca/secretariat/History/bldgs/walt.html">Walter Light Hall</a>. I <em>did</em> own a copy for a brief period in 2002 when my <a href="http://www.joeydevilla.com/2007/11/14/forgiving-the-deadbeat-ex-housemates-debt/">deadbeat ex-housemate</a> left a lot of his stuff behind, but I sold it (along with most of his stuff) in order to recoup some of the money lost from his stiffing me on rent, utilities, groceries and the largest domestic phone bill I&#8217;ve ever grappled with.</p>
<p class="center"><a href="http://www.cs.ucsc.edu/~pohl/abc4.html"><img src="http://www.globalnerdy.com/wordpress/wp-content/uploads/2008/09/a_book_on_c.jpg" alt="Cover of &quot;A Book on C&quot;" title="Cover of &quot;A Book on C&quot;" width="220" height="318" /></a></p>
<p>The books I had while at Crazy Go Nuts University were the second edition of <a href="http://www.cs.ucsc.edu/~pohl/abc4.html"><strong><cite>A Book on C</cite></strong></a> and <cite>Understanding C Pointers</cite> (a book that seems to be no longer in print). I liked <cite>A Book on C</cite> enough to pick up the fourth edition on sale a couple of years ago, and someone out there has forgotten to give me back my copy of <cite>Understanding C Pointers</cite> (you know who you are!).</p>
<h3>Back to C</h3>
<p>I&#8217;ve decided to get back into C for a number of reasons.</p>
<p class="center"><img src="http://www.globalnerdy.com/wordpress/wp-content/uploads/2008/09/internet_tough_guy_magazine.jpg" alt="&quot;Internet Tough Guy&quot; Magazine" title="&quot;Internet Tough Guy&quot; Magazine" width="300" height="440" /></p>
<p>I have to admit that one of those reasons is completely irrational: it&#8217;s ego. There&#8217;s certain geek cred that comes with having at least some proficiency in C. While I had those bragging rights back in school, I can&#8217;t honestly claim them now; I haven&#8217;t even written a file whose name ends in <code>.c</code> in over a decade. Luckily, I had a pretty good grasp of C back in school, and the noodling I&#8217;ve been doing with good old <code>gcc</code> suggests that I&#8217;ve still got it, which is pretty reassuring. </p>
<p class="center"><img src="http://www.globalnerdy.com/wordpress/wp-content/uploads/2008/09/iphone_arduino_mac_guy.jpg" alt="iPhone, Arduino 480 and the &quot;Mac Guy&quot;" title="iPhone, Arduino 480 and the &quot;Mac Guy&quot;" width="487" height="273" /></p>
<p>I&#8217;ve also been meaning to do some development with things that are programmed in C or C dialects:</p>
<ul>
<li>The <a href="http://arduino.cc/"><strong>Arduino</strong></a> electronics prototyping platform has its own programming language based on C. I&#8217;ve been meaning to try out hardware hacking with the folks at the local group <a href="http://hackerspaces.org/wiki/HackLabTO">HacklabTO</a>.</li>
<li>I&#8217;ve also been thinking about putting together some <strong>Mac OS X</strong> and <strong>iPhone</strong> apps, which require <a href="http://en.wikipedia.org/wiki/Objective-C">Objective-C</a>.</li>
<li>I&#8217;ve even been thinking about doing some <strong>GTK</strong> noodling, which is done in good ol&#8217; C.</li>
</ul>
<p class="center"><img src="http://www.globalnerdy.com/wordpress/wp-content/uploads/2008/09/homer_simpson_brain.jpg" alt="Homer Simpson&#039;s brain x-ray" title="Homer Simpson&#039;s brain x-ray" width="410" height="307" /></p>
<p>Finally, there&#8217;s the matter of just making myself a better programmer by working in C by refreshing my knowledge of the low-level stuff that C requires you to work with, and also the &#8220;brain stretch&#8221; that comes with working with a language and environment (what with going back to strong typing, compiling and <strong>make</strong>) that I haven&#8217;t worked in for some time.</p>
<p>I&#8217;ll be doing some C coding in my spare time, as well as noodling with the Arduino programming languane and Objective-C, and I&#8217;ll be posting my notes, observations and experiences here. As I&#8217;m fond of saying on this blog, watch this space!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.globalnerdy.com/2008/09/16/going-down-memory-lane-with-c/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How Map/Reduce/Filter Can Rock Your World</title>
		<link>http://www.globalnerdy.com/2008/06/16/how-mapreducefilter-can-rock-your-world/</link>
		<comments>http://www.globalnerdy.com/2008/06/16/how-mapreducefilter-can-rock-your-world/#comments</comments>
		<pubDate>Mon, 16 Jun 2008 20:48:27 +0000</pubDate>
		<dc:creator>Joey deVilla</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[dynamic languages]]></category>
		<category><![CDATA[enumerable]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[fold]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[reduce]]></category>

		<guid isPermaLink="false">http://globalnerdy.com/?p=1734</guid>
		<description><![CDATA[Better late than never: C# 3.0 will feature map, reduce and filter, and Dare &#8220;Carnage4Life&#8221; Obasanjo explains how to rock these features. He concludes the article with &#8220;If your programming language doesn&#8217;t support lambda functions or have map/reduce/filter functions built in, you just might be a Blub Programmer who is missing out on being more [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Better late than never: <a href="http://www.25hoursaday.com/weblog/2008/06/16/FunctionalProgrammingInC30HowMapReduceFilterCanRockYourWorld.aspx"><strong>C# 3.0 will feature <code>map</code>, <code>reduce</code> and <code>filter</code>, and Dare &#8220;Carnage4Life&#8221; Obasanjo explains how to rock these features.</strong></a> He concludes the article with &#8220;If your programming language doesn&#8217;t support lambda functions or have map/reduce/filter functions built in, you just might be a <a href="http://weblog.raganwald.com/2006/10/are-we-blub-programmers.html">Blub Programmer</a> who is missing out on being more productive because your programming language doesn&#8217;t support &#8216;esoteric&#8217; or &#8216;weird&#8217; features,&#8221; which sounds kind of weird in an article about C#, a language that could only be Blubbier if its name were BlubLang or Blub#. I suspect I&#8217;ve woken up in some upside-down parallel universe again!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.globalnerdy.com/2008/06/16/how-mapreducefilter-can-rock-your-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Read C Declarations</title>
		<link>http://www.globalnerdy.com/2008/02/06/how-to-read-c-declarations/</link>
		<comments>http://www.globalnerdy.com/2008/02/06/how-to-read-c-declarations/#comments</comments>
		<pubDate>Wed, 06 Feb 2008 15:31:09 +0000</pubDate>
		<dc:creator>Joey deVilla</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[declarations]]></category>
		<category><![CDATA[tips and tricks]]></category>

		<guid isPermaLink="false">http://globalnerdy.com/2008/02/06/how-to-read-c-declarations/</guid>
		<description><![CDATA[Here&#8217;s a handy guide to reading C declarations, where things can get very confusing very quickly. Quick &#8212; what&#8217;s being declared in the line &#8220;int (*(*vtable)[])();&#8221; ?
]]></description>
			<content:encoded><![CDATA[<p></p><p><a href="http://www.antlr.org/wiki/display/CS652/How+To+Read+C+Declarations"><strong>Here&#8217;s a handy guide to reading C declarations,</strong></a> where things can get very confusing very quickly. Quick &#8212; what&#8217;s being declared in the line &#8220;<code>int (*(*vtable)[])();</code>&#8221; ?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.globalnerdy.com/2008/02/06/how-to-read-c-declarations/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
