<?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>Tommy&#039;s Blog &#187; Programming</title>
	<atom:link href="http://twwilliams.com/blog/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://twwilliams.com/blog</link>
	<description>Discovering and learning</description>
	<lastBuildDate>Wed, 31 Dec 2008 17:06:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Putting formatted text on the clipboard</title>
		<link>http://twwilliams.com/blog/2008/08/22/putting-formatted-text-on-the-clipboard/</link>
		<comments>http://twwilliams.com/blog/2008/08/22/putting-formatted-text-on-the-clipboard/#comments</comments>
		<pubDate>Fri, 22 Aug 2008 21:27:14 +0000</pubDate>
		<dc:creator>Tommy Williams</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://twwilliams.com/blog/2008/08/22/putting-formatted-text-on-the-clipboard/</guid>
		<description><![CDATA[Working with the Windows clipboard in managed code is both easy and hard. It’s easy because all you need to do in order to put a bit of text on the clipboard is this:
Clipboard.SetText(&#34;Put this on the clipboard&#34;);


It’s hard because you can’t just do something like this in order to get formatted text:

Clipboard.SetHtml('&#60;a href=&#34;http://twwilliams.com/&#62;A link&#60;/a&#62;&#34;');




The [...]]]></description>
			<content:encoded><![CDATA[<p>Working with the Windows clipboard in managed code is both easy and hard. It’s easy because all you need to do in order to put a bit of text on the clipboard is this:</p>
<blockquote><pre class="code"><span style="color: #2b91af">Clipboard</span>.SetText(<span style="color: #a31515">&quot;Put this on the clipboard&quot;</span>);</pre>
</blockquote>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>It’s hard because you can’t just do something like this in order to get formatted text:</p>
<blockquote>
<pre class="code"><span style="color: #2b91af">Clipboard</span>.SetHtml(<span style="color: #a31515">'&lt;a href=&quot;http://twwilliams.com/&gt;A link&lt;/a&gt;&quot;'</span>);</pre>
</blockquote>
<p><a href="http://11011.net/software/vspaste"></a></p>
</p>
</p>
<p>The Windows clipboard requires content to be in special formats if you have anything other than text and the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.clipboard.aspx">System.Windows.Forms.Clipboard</a> class doesn’t provide any convenience methods for handling HTML. But writing your own isn’t too hard.</p>
<p><a href="http://blogs.msdn.com/jmstall/archive/2007/01/21/html-clipboard.aspx"><strong>Mike Stall provides the solution</strong></a><strong>.</strong></p>
<p>In essence, you need to wrap your HTML fragment in a specially-formatted header and then put that on the clipboard.</p>
<p>One thing Mike doesn’t address in his sample is how to set the plain-text version of an HTML fragment so that you can still paste to places like Notepad that don’t support formatted output.</p>
<p>If you only set the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.dataformats.aspx">System.Windows.Forms.DataFormats</a>.Html part of the clipboard, when you go to Notepad and paste, you will get nothing. So you also need to set the DataFormats.Text part. But it gets a little bit more complicated because you can’t just do this:</p>
<blockquote>
<pre class="code"><span style="color: #2b91af">Clipboard</span>.SetText(htmlString, <span style="color: #2b91af">TextDataFormat</span>.Html);
<span style="color: #2b91af">Clipboard</span>.SetText(plainTextString, <span style="color: #2b91af">TextDataFormat</span>.Text);</pre>
</blockquote>
<p>If you do this, you’re setting two values to the clipboard in succession and you will only have the last one (in this case, the plain text) on the clipboard. To set both formats, you need to use a <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.dataobject.aspx">System.Windows.Forms.DataObject</a>:</p>
<blockquote>
<pre class="code"><span style="color: #2b91af">DataObject </span>dataObj = <span style="color: blue">new </span><span style="color: #2b91af">DataObject</span>();
dataObj.SetData(<span style="color: #2b91af">DataFormats</span>.Text, plainTextString);
dataObj.SetData(<span style="color: #2b91af">DataFormats</span>.Html,
                <span style="color: #2b91af">HtmlFragment</span>.GetClipboardFormatted(htmlString));
<span style="color: #2b91af">Clipboard</span>.SetDataObject(dataObj);</pre>
<p>  <a href="http://11011.net/software/vspaste"></a></p></blockquote>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>In this example, the HtmlFragment.GetClipboardFormatted(htmlString) is a method I adapted from Mike Stall’s example that returns the formatted string rather than putting it directly on the clipboard as in his example.</p>
</p>
</p>
</p>
<p>The last thing to remember about working with the clipboard: your program must run in single-threaded apartment mode so set the <a href="http://msdn.microsoft.com/en-us/library/system.stathreadattribute.aspx">[STAThread] attribute</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://twwilliams.com/blog/2008/08/22/putting-formatted-text-on-the-clipboard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to change your screen resolution using C#</title>
		<link>http://twwilliams.com/blog/2008/08/21/how-to-change-your-screen-resolution-using-c/</link>
		<comments>http://twwilliams.com/blog/2008/08/21/how-to-change-your-screen-resolution-using-c/#comments</comments>
		<pubDate>Fri, 22 Aug 2008 00:25:08 +0000</pubDate>
		<dc:creator>Tommy Williams</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://twwilliams.com/blog/2008/08/21/how-to-change-your-screen-resolution-using-c/</guid>
		<description><![CDATA[My laptop gets confused when it goes in or comes out of the docking station and always picks the wrong resolution for the monitor. Part of this might be due to a difference in aspect ratios: the laptop screen is a widescreen model (width:height is 4:3) while the monitor connected to the docking station is [...]]]></description>
			<content:encoded><![CDATA[<p>My laptop gets confused when it goes in or comes out of the docking station and always picks the wrong resolution for the monitor. Part of this might be due to a difference in aspect ratios: the laptop screen is a widescreen model (width:height is 4:3) while the monitor connected to the docking station is 5:4.</p>
<p>I have gotten pretty good at <span class="code">Win-R, desk.cpl&lt;enter&gt;, Alt-R, &lt;right&gt;</span> (or <span class="code">&lt;right&gt;&lt;right&gt;&lt;right&gt;</span> as the case may be), <span class="code">&lt;enter&gt;, &lt;left&gt;&lt;enter&gt;</span> but I would still rather do something quicker.</p>
<p>So this morning I decided to write a bit of C# to handle it. I didn’t know of anything that ships in the .NET Framework to handle this directly so I went off to <a href="http://pinvoke.net/">pinvoke.net</a> and found <a href="http://pinvoke.net/default.aspx/user32/EnumDisplaySettings.html">what I was looking for</a>.</p>
<p>The code example is formatted strangely but they link to a <a title="CodeProject: Dynamic Screen Resolution" href="http://www.codeproject.com/csharp/CSDynamicScrRes.asp?df=100&amp;forumid=38736&amp;select=800137">sample on CodeProject</a> that presents it a bit more clearly. It is a bit strange that the class he created changes the resolution in its <strong>constructor</strong> rather than through a method. It is just a sample, after all.</p>
]]></content:encoded>
			<wfw:commentRss>http://twwilliams.com/blog/2008/08/21/how-to-change-your-screen-resolution-using-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ADO.NET vNext CTP is live</title>
		<link>http://twwilliams.com/blog/2006/08/15/adonet-vnext-ctp-is-live/</link>
		<comments>http://twwilliams.com/blog/2006/08/15/adonet-vnext-ctp-is-live/#comments</comments>
		<pubDate>Tue, 15 Aug 2006 20:20:21 +0000</pubDate>
		<dc:creator>Tommy Williams</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Work]]></category>

		<guid isPermaLink="false">http://twwilliams.com/blog/2006/08/15/adonet-vnext-ctp-is-live/</guid>
		<description><![CDATA[Happy day today: the ADO.NET vNext CTP is available.&#160;We have&#160;worked hard to get this out the door and we&#8217;re anxious to know what you think. You can discuss it at the ADO.NET Technology Preview forum on MSDN.
Alex has been bugging me to write about the experience of pulling this Community Technology Preview together to provide [...]]]></description>
			<content:encoded><![CDATA[<p>Happy day today: <a href="http://blogs.msdn.com/adonet/archive/2006/08/15/701479.aspx">the ADO.NET vNext CTP is available.</a>&nbsp;We have&nbsp;worked hard to get this out the door and we&#8217;re anxious to know what you think. You can discuss it at <a href="http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=533&amp;SiteID=1">the ADO.NET Technology Preview forum on MSDN</a>.</p>
<p><a href="http://blogs.msdn.com/alexbarn">Alex</a> has been bugging me to write about the experience of pulling this Community Technology Preview together to provide an in-the-trenches view of things. I&#8217;m still too excited about the release to know what I would write but I&#8217;m sure there will be something in the next few days.</p>
<p>In the meantime, enjoy!</p>
<p><strong>Update:</strong> <a href="http://blogs.msdn.com/adonet/archive/2006/08/15/701499.aspx">Sanjay Nagamangalam has made a screencast</a> showing some of the Visual Studio tools in action.</p>
<p><strong>Tags:</strong> <a href="http://technorati.com/tag/ADO.NET" rel="tag">ADO.NET</a>, <a href="http://technorati.com/tag/work" rel="tag">work</a>, <a href="http://technorati.com/tag/Microsoft" rel="tag">Microsoft</a>, <a href="http://technorati.com/tag/database" rel="tag">database</a>, <a href="http://technorati.com/tag/programming" rel="tag">programming</a>, <a href="http://technorati.com/tag/CTP" rel="tag">CTP</a></p>
]]></content:encoded>
			<wfw:commentRss>http://twwilliams.com/blog/2006/08/15/adonet-vnext-ctp-is-live/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Translating from cmd.exe to PowerShell: dir</title>
		<link>http://twwilliams.com/blog/2006/07/30/translating-from-cmdexe-to-powershell-dir/</link>
		<comments>http://twwilliams.com/blog/2006/07/30/translating-from-cmdexe-to-powershell-dir/#comments</comments>
		<pubDate>Sun, 30 Jul 2006 17:27:23 +0000</pubDate>
		<dc:creator>Tommy Williams</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://twwilliams.com/blog/2006/07/30/translating-from-cmdexe-to-powershell-dir/</guid>
		<description><![CDATA[After a long hiatus from Monad, err, PowerShell, I have started working with it again now that Release Candidate 1 is available.
One thing that frustrated me when I last used the shell was figuring out how to do all the things I was used to doing with dir in cmd.exe. Things like dir /o:d to [...]]]></description>
			<content:encoded><![CDATA[<p>After a long hiatus from Monad, err, PowerShell, I have started working with it again now that <a title="Download PowerShell RC1" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=2B0BBFCD-0797-4083-A817-5E6A054A85C9&#038;displaylang=en">Release Candidate 1 is available.</a></p>
<p>One thing that frustrated me when I last used the shell was figuring out how to do all the things I was used to doing with dir in cmd.exe. Things like dir /o:d to order by date, or dir /a:r to show me all the read-only files seemed to take a huge amount of typing in Monad.</p>
<p>It can still take a bit of typing in PowerShell but last night I decided to make a little table that translated common actions in cmd.exe&#8217;s dir to PowerShell&#8217;s get-childitem. There are two lines for each entry in the table. One is the &#8220;full&#8221; version without use of parameter shortening or use of built-in aliases, and the second is the shortest I could make the command using the aliases that ship with PowerShell. My one concession: even in the full version I never use get-childitem. I always use &#8220;dir.&#8221;</p>
<table>
<tr>
<td><strong>cmd.exe</strong></td>
<td><strong>PowerShell</strong></td>
</tr>
<tr>
<td>dir</td>
<td>dir</td>
</tr>
<tr>
<td>dir /s</td>
<td>dir -recurse</td>
</tr>
<tr>
<td> </td>
<td>dir -r</td>
</tr>
<tr>
<td>dir /s *.txt</td>
<td>dir -recurse -include *.txt</td>
</tr>
<tr>
<td> </td>
<td>dir -r -i *.txt</td>
</tr>
<tr>
<td>dir /s %temp%\*.txt  </td>
<td>dir -recurse -include *.txt $env:temp</td>
</tr>
<tr>
<td> </td>
<td>dir -r -i *.txt $env:temp</td>
</tr>
<tr>
<td>dir /o:-d</td>
<td>dir | sort-object -descending {$_.LastWriteTime}</td>
</tr>
<tr>
<td> </td>
<td>dir | sort -des LastWriteTime</td>
</tr>
<tr>
<td>dir /a:d</td>
<td>dir | where-object {$_.PSIsContainer}</td>
</tr>
<tr>
<td> </td>
<td>dir | ? {$_.PSIsContainer}</td>
</tr>
<tr>
<td>dir /a:-d</td>
<td>dir | where-object {$_.PSIsContainer}</td>
</tr>
<tr>
<td> </td>
<td>dir | ? {!$_.PSIsContainer}</td>
</tr>
<tr>
<td>dir /a:d /o:-d</td>
<td>dir | where-object {$_.PSIsContainer} | sort -descending {$_.LastWriteTime}</td>
</tr>
<tr>
<td> </td>
<td>dir | ? {$_.PSIsContainer} | sort -des LastWriteTime</td>
</tr>
<tr>
<td>dir /a:hd</td>
<td>dir -force | where-object {$_.Attributes -like &#8216;*Hidden*&#8217; -and $_.PSIsContainer}</td>
</tr>
<tr>
<td> </td>
<td>dir -fo | ? {$_.Attributes -like &#8216;*H*&#8217; -and $_.PSIsContainer}</td>
</tr>
<tr>
<td>dir /b</td>
<td>dir | format-table Name -hideTableHeaders</td>
</tr>
<tr>
<td> </td>
<td>dir | ft Name -h</td>
</tr>
</table>
<p> </p>
<p>One nice thing about functions in PowerShell: / and &#8211; are legal in function names. So, in my profile, I&#8217;ve defined functions with names like dir/o-d and dir/s to get back to the short commands I&#8217;m used to.</p>
<p>Coming soon: a list of things you can do with get-childitem in PowerShell that aren&#8217;t possible with dir in cmd.exe.</p>
<p><strong>Tags:</strong> <a href="http://technorati.com/tag/PowerShell" rel="tag">PowerShell</a>, <a href="http://technorati.com/tag/scripting" rel="tag">scripting</a>, <a href="http://technorati.com/tag/shell" rel="tag">shell</a>, <a href="http://technorati.com/tag/howto" rel="tag">howto</a></p>
]]></content:encoded>
			<wfw:commentRss>http://twwilliams.com/blog/2006/07/30/translating-from-cmdexe-to-powershell-dir/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Strong typing epiphany</title>
		<link>http://twwilliams.com/blog/2006/03/01/strong-typing-epiphany/</link>
		<comments>http://twwilliams.com/blog/2006/03/01/strong-typing-epiphany/#comments</comments>
		<pubDate>Thu, 02 Mar 2006 04:58:42 +0000</pubDate>
		<dc:creator>Tommy Williams</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://twwilliams.com/blog/2006/03/01/strong-typing-epiphany/</guid>
		<description><![CDATA[It has nothing to do with skills at the keyboard, but with programming languages and environments. For the first time ever, while working on a small, self-contained script, I missed having static typing and a compiler to help verify what I was doing. I almost fell off my chair when I realized it.
Let&#8217;s back up [...]]]></description>
			<content:encoded><![CDATA[<p>It has nothing to do with skills at the keyboard, but with programming languages and environments. For the first time ever, while working on a small, self-contained script, I missed having <a title="Strongly-typed programming language - Wikipedia, the free encyclopedia" href="http://en.wikipedia.org/wiki/Strongly_typed">static typing</a> and a compiler to help verify what I was doing. I almost fell off my chair when I realized it.</p>
<p>Let&#8217;s back up and I&#8217;ll try to explain what this is about. As usual, I&#8217;ll ignore all kinds of details to try to get the idea across.</p>
<p>There are lots of different ways of classifying programming languages. One distinction that has always been relevant to me is that between <strong>scripting</strong> and <strong>compiled </strong>languages. Scripting languages (and here I&#8217;m including things like Perl, VBScript, and PHP) lack two features that, in my simple classification scheme, belong to compiled languages: <strong>strongly typed variables</strong> and, of course, <strong>compilation.</strong></p>
<p>But that lack of features is, to me, <strong>a good thing. </strong>When trying to write a quick program, strong typing and compilation get in the way. <strong>Strong typing</strong> requires you to be careful about the way you use data and variables in your program &#8212; the way you handle things like numbers or text. Spending time to get that right can slow you down. <strong>Compilation</strong> is an extra step in the process. With a scripting language, you just write the code and then run it. But with a compiled language, you have to write the code, then compile it, <em>then</em> run it. That compilation step may only take a few seconds, but when you&#8217;re doing it dozens of times while building the program, it adds up. Edit-compile-run <em>is</em> a noticeable difference between Edit-run.</p>
<p>I have never doubted the value of strong typing, or static typing and type safety, anyway, in large programs with multiple people collaborating on it. There&#8217;s tremendous value in the structure those systems impose.</p>
<p>But until today I had never wanted those features/burdens when working on scripts. The script I&#8217;m working with is about 500 lines and was written several months ago. Now that we&#8217;re working on the next version of our product, the assumptions that were made when the script was first written are no longer valid &#8212; it needs to handle more possibilities.</p>
<p>So I&#8217;m reworking the script to handle these possibilities. And the <em>logic </em>of what I&#8217;m doing &#8212; the actual purpose of the script &#8212; is very simple. But there are enough variables and subroutines, and they&#8217;re used enough places, that there are plenty of opportunities to make mistakes, often just with a typo. Maybe the variable is <em>abcVariable</em> and the first five times I type it correctly, but the sixth time I type <em>abVariable</em>. With a compiled language, the error would be flagged before the program could run. But in a scripting language, I can&#8217;t know that the error exists until I run the program. You may have heard the terms <strong>compile time</strong> and <strong>run time.</strong> This is the distinction.</p>
<p>In this case, the script takes a few minutes to complete its work and restoring the system to its previous state (so that I could try the script again) takes a few more minutes. To make things even more dangerous, the script copies and deletes files. If I make a mistake in some of that code, I could erase a whole lot more than I intended. And it&#8217;s no fun restoring from backup.</p>
<p>So, working in the scripting language, I have had to pull bits and pieces out as I&nbsp;make&nbsp;changes and put them&nbsp;into <em>another</em> script, write a bit of code to run those bits and pieces, and test&nbsp;things piecemeal as I go.</p>
<p>This is the first time that I&#8217;ve been handling a scripting task where I would have been <strong>faster with a compiled language.<em> </em></strong>It&#8217;s pretty darned surprising to me.</p>
<p>And, please, all you fans of Ruby or Python, don&#8217;t tell me I&#8217;m an idiot because your language could solve these problems. If I had the luxury of using Ruby or Python &#8212; or even taking the time to rewrite the script in a compiled language &#8212; I would. But we <a href="http://blogs.msdn.com/chris_pratley/archive/2006/02/27/540366.aspx">have a budget</a> and I can&#8217;t spend&nbsp;enough&nbsp;of it on this to rewrite it.</p>
<p class="tags"><strong>Tags:</strong> <a href="http://technorati.com/tag/development" rel="tag">development</a>, <a href="http://technorati.com/tag/strongtyping" rel="tag">strongtyping</a>, <a href="http://technorati.com/tag/scripting" rel="tag">scripting</a>, <a href="http://technorati.com/tag/compiled" rel="tag">compiled</a><br /><strong>del.icio.us tags:</strong> <a href="http://del.icio.us/twwilliams/development" rel="tag">development</a>, <a href="http://del.icio.us/twwilliams/strongtyping" rel="tag">strongtyping</a>, <a href="http://del.icio.us/twwilliams/scripting" rel="tag">scripting</a>, <a href="http://del.icio.us/twwilliams/compiled" rel="tag">compiled</a></p>
]]></content:encoded>
			<wfw:commentRss>http://twwilliams.com/blog/2006/03/01/strong-typing-epiphany/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Refactor Pro now supports Visual Studio 2005</title>
		<link>http://twwilliams.com/blog/2006/02/28/refactor-pro-now-supports-visual-studio-2005/</link>
		<comments>http://twwilliams.com/blog/2006/02/28/refactor-pro-now-supports-visual-studio-2005/#comments</comments>
		<pubDate>Wed, 01 Mar 2006 06:24:50 +0000</pubDate>
		<dc:creator>Tommy Williams</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://twwilliams.com/blog/2006/02/28/refactor-pro-now-supports-visual-studio-2005/</guid>
		<description><![CDATA[Refactor Pro now supports Visual Studio 2005, and there&#8217;s a trial version available. It expires on the 20th of March. I&#8217;m almost afraid to try it out &#8212; I may grow so attached that I&#8217;ll just have to spend the US$99 and buy it when the demo expires.
Tags: Development, refactoring, refactorpro, visualstudiodel.icio.us tags: Development, refactoring, [...]]]></description>
			<content:encoded><![CDATA[<p>Refactor Pro now supports Visual Studio 2005, and <a title="Refactor! Pro for Visual Studio .NET Downloads" href="http://www.devexpress.com/Downloads/NET/Refactor/">there&#8217;s a trial version available.</a> It expires on the 20th of March. I&#8217;m almost afraid to try it out &#8212; I may grow so attached that I&#8217;ll just <em>have</em> to spend the US$99 and buy it when the demo expires.</p>
<p class="tags"><strong>Tags:</strong> <a href="http://technorati.com/tag/development" rel="tag">Development</a>, <a href="http://technorati.com/tag/refactoring" rel="tag">refactoring</a>, <a href="http://technorati.com/tag/refactorpro" rel="tag">refactorpro</a>, <a href="http://technorati.com/tag/visualstudio" rel="tag">visualstudio</a><br /><strong>del.icio.us tags:</strong> <a href="http://del.icio.us/twwilliams/development" rel="tag">Development</a>, <a href="http://del.icio.us/twwilliams/refactoring" rel="tag">refactoring</a>, <a href="http://del.icio.us/twwilliams/refactorpro" rel="tag">refactorpro</a>, <a href="http://del.icio.us/twwilliams/visualstudio" rel="tag">visualstudio</a></p>
]]></content:encoded>
			<wfw:commentRss>http://twwilliams.com/blog/2006/02/28/refactor-pro-now-supports-visual-studio-2005/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A little structure goes a long way</title>
		<link>http://twwilliams.com/blog/2006/02/22/a-little-structure-goes-a-long-way/</link>
		<comments>http://twwilliams.com/blog/2006/02/22/a-little-structure-goes-a-long-way/#comments</comments>
		<pubDate>Wed, 22 Feb 2006 23:29:47 +0000</pubDate>
		<dc:creator>Tommy Williams</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://twwilliams.com/blog/2006/02/22/a-little-structure-goes-a-long-way/</guid>
		<description><![CDATA[Natural language processing is one of the holy grails&#160;of computer science. Why should people have to learn special, strange languages for interacting with the computer? Very few people can construct a workable query using SQL, for example. Why can&#8217;t we just ask the computer questions the same way we would ask another person using natural [...]]]></description>
			<content:encoded><![CDATA[<p>Natural language processing is one of the holy grails&nbsp;of computer science. Why should people have to learn special, strange languages for interacting with the computer? Very few people can construct a workable query using <acronym title="Structured Query Language">SQL</acronym>, <a title="Introduction to SQL" href="http://www.w3schools.com/sql/sql_intro.asp">for example</a>. Why can&#8217;t we just ask the computer questions the same way we would ask another person using <strong>natural language?</strong></p>
<p>We&#8217;ve found out in the decades since <a title="Arthur C. Clarke: 2001: a space odyssey" href="http://www.sfsite.com/~silverag/2001.html">Arthur C. Clarke wrote about HAL</a> that it&#8217;s very hard to write software that can understand natural language. And humans, bless our hearts, are remarkably skilled at <strong>adapting</strong>. So even as difficult as structured languages may be, it&#8217;s still easier for people to learn to speak &#8220;computer.&#8221;</p>
<p><a title="Playing Travel Agent" href="http://www.shahine.com/omar/PermaLink,guid,62266c9f-7ad4-4114-905f-42bfceb89a6f.aspx">Omar Shahine shows</a> how to create a little &#8220;Magic Word&#8221; for <a href="http://www.bayden.com/SlickRun/">SlickRun</a> to search for flights using <a href="http://www.mobissimo.com/">Mobissimo</a>. He got the idea from <a title="Natural Language Doesn't Have to Be Natural" href="http://www.redyawning.com/users/hyperionab/Natural+Language+Doesn't+Have+to+Be+Natural/blog.aspx?blogid=2464">Aditya Bansod</a>&nbsp;who points out that natural language &#8212; something better than formal, structured languages &#8212; doesn&#8217;t have to be strictly natural.</p>
<p>So&nbsp;the Web &#8212; specifically, search engines &#8212; are showing us another possibility. They&#8217;ve trained us to put phrases in quotation marks and use + to note words that are important and &#8211; to indicate those we don&#8217;t want to see. They&#8217;ve even taught us that we don&#8217;t need to write complete sentences: just enter some terms that make sense. Map sites like <a href="http://local.live.com/">Windows Live Local</a> and <a href="http://maps.google.com/">Google Maps</a>, the structured input format for addresses (one field for street address, one for city, one for state, one for zip &#8212; you know the stuff you fill out every time you buy something online) has been banished in favor of a single field. Enter an address like <em>100 Main St, Some City, Washington</em> and the system can parse it. It&#8217;s amazing how much nicer the experience is.</p>
<p>Maybe we don&#8217;t need true natural language processing. Maybe we don&#8217;t even want it. What I&#8217;ve seen so far of <strong>semi-natural language</strong> queries seems very good indeed.</p>
<p>P.S. I&#8217;ve got thoughts about how this relates to tagging vs. formal hierarchies, and how tagging&nbsp;&#8211; especially collaborative tagging &#8211;&nbsp;complements these semi-structured language approaches.</p>
<p class="tags"><strong>Tags:</strong> <a href="http://technorati.com/tag/ui" rel="tag">UI</a>, <a href="http://technorati.com/tag/interface" rel="tag">interface</a>, <a href="http://technorati.com/tag/query" rel="tag">query</a>, <a href="http://technorati.com/tag/structure" rel="tag">structure</a>, <a href="http://technorati.com/tag/language" rel="tag">language</a>, <a href="http://technorati.com/tag/computer" rel="tag">computer</a><br /><strong>del.icio.us tags:</strong> <a href="http://del.icio.us/twwilliams/ui" rel="tag">UI</a>, <a href="http://del.icio.us/twwilliams/interface" rel="tag">interface</a>, <a href="http://del.icio.us/twwilliams/query" rel="tag">query</a>, <a href="http://del.icio.us/twwilliams/structure" rel="tag">structure</a>, <a href="http://del.icio.us/twwilliams/language" rel="tag">language</a>, <a href="http://del.icio.us/twwilliams/computer" rel="tag">computer</a></p>
]]></content:encoded>
			<wfw:commentRss>http://twwilliams.com/blog/2006/02/22/a-little-structure-goes-a-long-way/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Why does PHP have to be professional-grade?</title>
		<link>http://twwilliams.com/blog/2006/02/20/why-does-php-have-to-be-professional-grade/</link>
		<comments>http://twwilliams.com/blog/2006/02/20/why-does-php-have-to-be-professional-grade/#comments</comments>
		<pubDate>Tue, 21 Feb 2006 01:59:32 +0000</pubDate>
		<dc:creator>Tommy Williams</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://twwilliams.com/blog/2006/02/20/why-does-php-have-to-be-professional-grade/</guid>
		<description><![CDATA[Tim Bray complains that all the PHP code he has seen has been &#8220;messy, unmaintainable crap.&#8221; The responses he has posted mostly confirm his opinion, saying things like, &#8220;it really needs to clean its act up to appeal to people coming from other programming languages, instead of just people coming from dreamweaver.&#8221; Or &#8220;it hasn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>Tim Bray <a title="ongoing - On PHP" href="http://www.tbray.org/ongoing/When/200x/2006/02/17/PHP">complains that all the PHP code he has seen</a> has been &#8220;messy, unmaintainable crap.&#8221; The responses he has posted mostly confirm his opinion, saying things like, &#8220;it really needs to clean its act up to appeal to people coming from other programming languages, instead of just <STRONG>people coming from dreamweaver</STRONG>.&#8221; Or &#8220;it hasn&rsquo;t been proven that users *can&rsquo;t* write clean, comprehensible, maintainable PHP &#8211; but it also hasn&rsquo;t been proven that anyone can.&#8221;</p>
<p><a title="On PHP - My Thoughts" href="http://www.fiftyfoureleven.com/weblog/web-development/programming-and-scripts/on-php">One response</a>, perhaps unintentionally, points out the absolute beauty of PHP: &#8220;<STRONG>people with little or no education in the realm of programming are programming.</STRONG>&#8221; Hallelujah! Too bad that he introduces that beautiful statement with this lead-in: &#8220;Herein lies the main problem.&#8221;</p>
<p>Fine. So PHP isn&#8217;t &#8220;professional grade.&#8221; But it can be used to do some pretty amazing things. The software <a title="Wordpress" href="http://www.wordpress.org/">that powers this blog</a>, and thousands of others, is written in PHP. I wasn&#8217;t surprised to see it&nbsp;called out as an example of poor code.</p>
<p>Does it matter? No. The easy entry to programming that PHP offers is letting people with ideas &#8212; people with passion for things that are <strong>not software</strong> &#8212; to produce some magnificent work.</p>
<p>So it&#8217;s hard to refactor. So it doesn&#8217;t scale. So it&#8217;s impossible for someone else to come along and maintain it. <strong>That&#8217;s OK</strong>. We have dozens of languages and programming environments that scale up to big teams and big demands and that promote good software practices.</p>
<p>Why not have a language that doesn&#8217;t value the enterprise first? Isn&#8217;t there room for the hobbyist?</p>
<p>This argument against PHP feels a lot like the one the professional journalists have been throwing at amateur bloggers. There&#8217;s certainly room for both journalists and bloggers; if anything, we&#8217;re hearing that it&#8217;s the professionals that are at risk in the imaginary journalists vs. bloggers showdown.</p>
<p>I&#8217;m not trying to discount the value of well-written software: over the past decades, we&#8217;ve learned a lot about the value of disciplined, well-designed code. Just don&#8217;t forget the value of the folks with the ideas and the passion to implement them. We need software that supports them. And if they make a mess along the way? It&#8217;s fine with me.</p>
<p><strong>Update (2006-Feb-27):</strong> <a title="Babble" href="http://weblog.burningbird.net/2006/02/25/babble">Shelley Powers</a>, writing about all the languages she has learned over the years, also points out the value of PHP&#8217;s ease-of-entry and its ubiquity. It&#8217;s an entertaining article in its own right, even if you don&#8217;t care about PHP.</p>
<p class="tags"><strong>Tags:</strong> <a href="http://technorati.com/tag/php" rel="tag">PHP</a>, <a href="http://technorati.com/tag/programming" rel="tag">programming</a>, <a href="http://technorati.com/tag/software" rel="tag">software</a>, <a href="http://technorati.com/tag/development" rel="tag">development</a><br /><strong>del.icio.us tags:</strong> <a href="http://del.icio.us/twwilliams/php" rel="tag">PHP</a>, <a href="http://del.icio.us/twwilliams/programming" rel="tag">programming</a>, <a href="http://del.icio.us/twwilliams/software" rel="tag">software</a>, <a href="http://del.icio.us/twwilliams/development" rel="tag">development</a></p>
]]></content:encoded>
			<wfw:commentRss>http://twwilliams.com/blog/2006/02/20/why-does-php-have-to-be-professional-grade/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Productive weekend</title>
		<link>http://twwilliams.com/blog/2006/02/19/productive-weekend/</link>
		<comments>http://twwilliams.com/blog/2006/02/19/productive-weekend/#comments</comments>
		<pubDate>Mon, 20 Feb 2006 06:08:16 +0000</pubDate>
		<dc:creator>Tommy Williams</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://twwilliams.com/blog/2006/02/19/productive-weekend/</guid>
		<description><![CDATA[It&#8217;s been quite a weekend. I finally got fed up with dasBlog hanging the worker threads on my old blog site* so I decided to move all the content to Wordpress and start up a new blog. No single part of the process was hard, but there were a lot of moving pieces. Among other [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been quite a weekend. I finally got fed up with dasBlog hanging the worker threads on my old blog site* so I decided to move all the content to Wordpress and start up a new blog. No single part of the process was hard, but there were a lot of moving pieces. Among other things, I:</p>
<ul>
<li>Wrote a C# app to convert all my dasBlog content into an RSS file for importing into Wordpress.</li>
<li>Set up two Wordpress blogs (one to hold <a title="Tommy Blogs (retired)" href="http://twwilliams.com/oldblog/">the archived content</a> and one &#8212; this one &#8212; for future posts).</li>
<li>Designed a set of Apache RewriteRules to handle the various permalinks that dasBlog uses.</li>
<li>Wrote a C# app to generate the RewriteRules to map the old permalinks to the Wordpress permalinks.</li>
<li>Set up 404 handlers and other redirection for old pages at tommyblogs.com.</li>
<li>Wrote a Windows Forms apps to easily let me add Technorati and del.icio.us tags to my posts</li>
</ul>
<p>What remains in the blog migration?</p>
<ul>
<li>Handle categories redirection</li>
<li>Remap various Feedburner category feeds</li>
<li>Monitor logs and see what I&#8217;ve missed</li>
<li>Transfer the domain name from the current host to 1and1.com and save myself about $15 a month.</li>
</ul>
<p>* Old blog site: tommyblogs.com. The problem (I think) was actually happening due to &#8212; what else? &#8212; spammers. They were hitting my site with some generic comment post code. They weren&#8217;t even bothering to see what fields were there, they were just POSTing to the forms. Somehow, though, this was corrupting the ViewState on the pages and dasBlog didn&#8217;t have the exception handling in place to deal with it. In fact, it was apparently throwing up dialog boxes. When enough of these things hit, I consumed all the threads available to me (since there was no one on the server to click &#8220;OK&#8221; on the dialog), and the site was hung until I emailed the hosting provider and asked them to cycle my site.</p>
<p class="tags"><strong>Tags:</strong> <a href="http://technorati.com/tag/programming" rel="tag">Programming</a>, <a href="http://technorati.com/tag/c#" rel="tag">C#</a>, <a href="http://technorati.com/tag/apache" rel="tag">Apache</a>, <a href="http://technorati.com/tag/blog" rel="tag">blog</a>, <a href="http://technorati.com/tag/migration" rel="tag">migration</a><br /><strong>del.icio.us tags:</strong> <a href="http://del.icio.us/twwilliams/programming" rel="tag">Programming</a>, <a href="http://del.icio.us/twwilliams/c#" rel="tag">C#</a>, <a href="http://del.icio.us/twwilliams/apache" rel="tag">Apache</a>, <a href="http://del.icio.us/twwilliams/blog" rel="tag">blog</a>, <a href="http://del.icio.us/twwilliams/migration" rel="tag">migration</a></p>
]]></content:encoded>
			<wfw:commentRss>http://twwilliams.com/blog/2006/02/19/productive-weekend/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>
