<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Development on billpg industries™</title><link>https://owl.billpg.com/tags/development/</link><description>Recent content in Development on billpg industries™</description><generator>Hugo</generator><language>en-us</language><copyright>© William Godfrey.</copyright><lastBuildDate>Sat, 05 Sep 2026 14:41:07 +0000</lastBuildDate><atom:link href="https://owl.billpg.com/tags/development/index.xml" rel="self" type="application/rss+xml"/><item><title>I Wrote a NuGet Package!</title><link>https://owl.billpg.com/i-wrote-a-nuget-package/</link><pubDate>Sat, 05 Sep 2026 14:41:07 +0000</pubDate><guid>https://owl.billpg.com/i-wrote-a-nuget-package/</guid><description>&lt;p&gt;I’ve been working a little in the world of &lt;strong&gt;HTTP Authentication&lt;/strong&gt;. When you connect a system to another system, there’s usually a set of tokens that get passed around and managed and sometimes accidentally pushed to a public git repo.&lt;/p&gt;
&lt;p&gt;When you try to connect to a website that requires a user login, you’ll be sent back a &lt;strong&gt;&lt;code&gt;401&lt;/code&gt;&lt;/strong&gt; response with a &lt;strong&gt;&lt;code&gt;WWW-Authenticate:&lt;/code&gt;&lt;/strong&gt; header. Except you won’t. You’ll be sent a 302 redirect to a login page.&lt;/p&gt;</description></item><item><title>"Too Clever By Half"</title><link>https://owl.billpg.com/too-clever-by-half/</link><pubDate>Tue, 03 Mar 2026 19:29:01 +0000</pubDate><guid>https://owl.billpg.com/too-clever-by-half/</guid><description>&lt;figure class="wp-block-image aligncenter size-full"&gt;
&lt;img src="https://owl.billpg.com/images/Too-Clever-By-Half.png" class="wp-image-1429" /&gt;
&lt;figcaption&gt;Wilf's Programmers' Workshop, PC Plus, November, 1991.&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;This was my first ever publication. Wilf Hey, writer of the &lt;strong&gt;Programmers’ Workshop&lt;/strong&gt; column in PC Plus, had run a contest to write what we’d now call a &lt;em&gt;quine&lt;/em&gt;, but which he described as a “self‑creating program”, one that tells you what it does by producing its own source.&lt;/p&gt;
&lt;p&gt;By coincidence, I had just been experimenting with PKZIP’s ability to create self‑extracting EXE files. ZIP archives fused with the decompressor into a single executable. It occurred to me that if I took a few liberties with the definition of “programming language”, I could use that mechanism to produce a rather cheeky entry.&lt;/p&gt;</description></item><item><title>Python’s Truthiness: A Code Smell Worth Sniffing</title><link>https://owl.billpg.com/pythons-truthiness-a-code-smell-worth-sniffing/</link><pubDate>Mon, 17 Nov 2025 18:20:51 +0000</pubDate><guid>https://owl.billpg.com/pythons-truthiness-a-code-smell-worth-sniffing/</guid><description>&lt;p&gt;Python lets you use any value in &lt;code&gt;if&lt;/code&gt; and &lt;code&gt;while&lt;/code&gt; conditions, not just Booleans. This permissiveness relies on a concept known as “truthiness”. Values like &lt;code&gt;None&lt;/code&gt;, &lt;code&gt;0&lt;/code&gt;, &lt;code&gt;&amp;quot;&amp;quot;&lt;/code&gt;, and empty collections are treated as false and everything else is true.&lt;/p&gt;
&lt;p&gt;It’s convenient. It’s idiomatic. It’s also, I argue, a code smell.&lt;/p&gt;
&lt;h3 id="the-bug-that-changed-my-mind"&gt;The Bug That Changed My Mind&lt;/h3&gt;
&lt;p&gt;Here’s a real example from one of my side projects:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code class="language-wp-block-code" data-lang="wp-block-code"&gt;def final_thing_count() -&amp;gt; Optional[int]:
 &amp;#34;&amp;#34;&amp;#34;Returns an integer count of things, but only
 if the number of things is complete. If there may
 yet be things to come, returns None to indicate 
 the count isn&amp;#39;t final.&amp;#34;&amp;#34;&amp;#34;
 # Code Redacted.

current_thing_count: Optional[int] = final_thing_count()
if current_thing_count:
 # Process the final count of things.
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Looks fine, right? But it’s broken.&lt;/p&gt;</description></item><item><title>Dear string-to-integer parsers...</title><link>https://owl.billpg.com/dear-string-to-integer-parsers/</link><pubDate>Tue, 29 Jul 2025 17:11:17 +0000</pubDate><guid>https://owl.billpg.com/dear-string-to-integer-parsers/</guid><description>&lt;p&gt;These are very useful functions that any language with distinct string and integer types will include in their standard library. Pass in a string with decimal digits and it&amp;rsquo;ll return the equivalent in the binary integer form that you can do mathematics with.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;d like to make a modest proposal that I&amp;rsquo;d find very useful, and maybe you, dear reader, would too.&lt;/p&gt;
&lt;figure class="wp-block-image size-full"&gt;
&lt;img src="https://owl.billpg.com/images/Swift_by_Tristan_Ferne_cropped.jpg" class="wp-image-1080" /&gt;
&lt;figcaption&gt;"The rich man in his castle, the poor man at his gate. He made them, high or lowly, and ordered their estate."&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h2 id="who-me"&gt;Who me?&lt;/h2&gt;
&lt;p&gt;Specifically, I&amp;rsquo;m thinking of parser functions that work like this&amp;hellip;&lt;/p&gt;</description></item><item><title>What type of UUID should I use?</title><link>https://owl.billpg.com/what-type-of-uuid-should-i-use/</link><pubDate>Thu, 17 Apr 2025 17:29:32 +0000</pubDate><guid>https://owl.billpg.com/what-type-of-uuid-should-i-use/</guid><description>&lt;p&gt;UUIDs, &lt;strong&gt;Universally Unique IDs&lt;/strong&gt;, are handy 128 bit IDs. Their values are unique, universally, hence the name.&lt;/p&gt;
&lt;p&gt;(If you work with Microsoft, you call them GUIDs. I do primarily think of them as GUIDs, but I&amp;rsquo;m going to stick with calling them UUIDs for this article, as I think that name is more common.)&lt;/p&gt;
&lt;p&gt;These are useful for IDs. Thanks to their universal uniqueness, you could have a distributed set of machines, each producing their own IDs, without any co-ordination necessary, even completely disconnected from each other, without worrying about any of those IDs colliding.&lt;/p&gt;</description></item><item><title>I want a less powerful programming language for Christmas.</title><link>https://owl.billpg.com/i-want-a-less-powerful-programming-language-for-christmas/</link><pubDate>Wed, 12 Feb 2025 21:44:24 +0000</pubDate><guid>https://owl.billpg.com/i-want-a-less-powerful-programming-language-for-christmas/</guid><description>&lt;p&gt;I&amp;rsquo;m writing this because I&amp;rsquo;m hoping someone will respond, telling me that what I want already exists. I have a specific itch and my suspicion is that developing a whole programming language and runtime is the only way to scratch that itch.&lt;/p&gt;
&lt;p&gt;Please tell me I&amp;rsquo;m wrong.&lt;/p&gt;
&lt;h2 id="dear-father-christmas"&gt;Dear Father Christmas&amp;hellip;&lt;/h2&gt;
&lt;p&gt;If you&amp;rsquo;ve ever written a web service, you&amp;rsquo;ve almost certainly had situations where you&amp;rsquo;ve taken a bunch of bytes from a completely untrusted stranger and passed those bytes into a JSON parser. What&amp;rsquo;s more you&amp;rsquo;ll have done that without validating the bytes first.&lt;/p&gt;</description></item><item><title>Write Your Own POP3 Service</title><link>https://owl.billpg.com/pop3-write-your-own/</link><pubDate>Fri, 26 Mar 2021 18:31:19 +0000</pubDate><guid>https://owl.billpg.com/pop3-write-your-own/</guid><description>&lt;p&gt;So, you want to write a POP3 service? That&amp;rsquo;s great. In this post, we&amp;rsquo;ll walk through building a simple POP3 service that uses a folder full of EML files as a mailbox and serves them to anyone logging in.&lt;/p&gt;
&lt;h2 id="getting-started"&gt;Getting Started&lt;/h2&gt;
&lt;p&gt;I&amp;rsquo;m assuming you are already set-up to be writing and building C# code. If you have Windows, the free version of Visual Studio 2019 is great. (Or use a more recent version if one exists.) Visual Studio Code is great on Linux too.&lt;/p&gt;</description></item><item><title>NEVER sanitize your inputs!</title><link>https://owl.billpg.com/never-sanitize-your-inputs/</link><pubDate>Sun, 08 Sep 2013 20:18:00 +0000</pubDate><guid>https://owl.billpg.com/never-sanitize-your-inputs/</guid><description>&lt;div style="clear: both; text-align: center;"&gt;
&lt;img src="https://owl.billpg.com/images/exploits_of_a_mom-300x92.png" title="No!" data-border="0" /&gt;
&lt;/div&gt;
&lt;p&gt;I&amp;rsquo;ve seen &lt;a href="http://xkcd.com/327/"&gt;this cartoon&lt;/a&gt; being linked-to in so many comment threads and forums. Anytime its even a little bit applicable, someone will post a link to this cartoon. It has become so pervasive that if you &lt;a href="https://www.google.com/search?q=327"&gt;search Google for &amp;ldquo;327&amp;rdquo;&lt;/a&gt;, it’ll be the third link returned, right after the Wikipedia pages for &lt;a href="http://en.wikipedia.org/wiki/327"&gt;the year&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/BMW_327"&gt;the car&lt;/a&gt;. &lt;a href="https://www.google.com/search?q=328"&gt;Search &amp;ldquo;328&amp;rdquo;&lt;/a&gt; and the &lt;a href="http://xkcd.com/328/"&gt;next XKCD&lt;/a&gt; is no-where to be seen. The lesson, according to this character and so many real people on the internet, is to sanitize your inputs. The school in the cartoon didn&amp;rsquo;t sanitize its inputs - and one of its database tables got deleted! Ask anyone about developing websites and they will tell you the first lesson is always to sanitize your inputs. In this day and age you&amp;rsquo;d have to be crazy not to sanitize your inputs. Trouble is, sanitizing your inputs is very bad advice.&lt;/p&gt;</description></item><item><title>PHP - Some strings are more equal than others</title><link>https://owl.billpg.com/php-some-strings-are-more-equal-than-others/</link><pubDate>Sun, 29 Apr 2012 21:33:00 +0000</pubDate><guid>https://owl.billpg.com/php-some-strings-are-more-equal-than-others/</guid><description>&lt;div style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;
&lt;img src="https://owl.billpg.com/images/Equal_in_stature_by_Kevin_Dooley-218x300.jpg" data-border="0" width="232" height="320" /&gt;
&lt;/div&gt;
&lt;p&gt;You may have recently read about the PHP programming language, when it was found that if you compare the two strings &lt;code&gt;&amp;quot;922337203685477580&lt;/code&gt;&lt;strong&gt;&lt;code&gt;7&lt;/code&gt;&lt;/strong&gt;&lt;code&gt;&amp;quot;&lt;/code&gt; and &lt;code&gt;&amp;quot;922337203685477580&lt;/code&gt;&lt;strong&gt;&lt;code&gt;8&lt;/code&gt;&lt;/strong&gt;&lt;code&gt;&amp;quot;&lt;/code&gt; with the &lt;code&gt;==&lt;/code&gt; operator, PHP will report these as identical. Most of the time PHP does the right thing, but you need to be careful about these exceptions to the rule.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bugs.php.net/bug.php?id=54547"&gt;This was reported as a bug to the people who maintain PHP&lt;/a&gt;, but they responded that regarding these two strings as equal was really the correct thing to do. Programmers who feel these two strings should be treated as different should instead use the &lt;code&gt;===&lt;/code&gt; operator. This operator checks if two strings are equal, but this time, means it!&lt;/p&gt;</description></item><item><title>Construct something else! (C#)</title><link>https://owl.billpg.com/construct-something-else-c/</link><pubDate>Sun, 12 Sep 2010 11:34:00 +0000</pubDate><guid>https://owl.billpg.com/construct-something-else-c/</guid><description>&lt;p&gt;&lt;em&gt;Please read my &lt;a href="https://owl.billpg.com/redditd-followup-to-construct-something-else/"&gt;follow-up post&lt;/a&gt; after reading this one.&lt;/em&gt; &lt;img src="https://owl.billpg.com/images/s200_1052409181_82fefcfd49_b.jpg" data-align="right" data-border="0" width="160" height="200" /&gt;Quoth &lt;a href="http://stackoverflow.com/users/283212/rjw"&gt;rjw&lt;/a&gt; &lt;a href="http://stackoverflow.com/questions/2352259/can-constructor-return-a-subclass"&gt;on stackoverflow&lt;/a&gt;&amp;hellip;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Given the following client code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    var obj = new Class1();
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Is there any way to modify the constructor of Class1 so that it will actually return a subclass (or some other alternate implementation) instead?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;C# compiler guru, &lt;a href="http://blogs.msdn.com/b/ericlippert/"&gt;Eric Lippert&lt;/a&gt; commented&amp;hellip;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;We are considering adding a feature &amp;ldquo;extension new&amp;rdquo; which would essentially allow you to make a static factory method that would be called when the &amp;ldquo;new&amp;rdquo; operator is used, much as extension methods are called when the &amp;ldquo;.&amp;rdquo; operator is used. It would be a nice syntactic sugar for the factory. If you have a really awesome scenario where this sort of pattern would be useful, I&amp;rsquo;d love to see an example.&lt;/p&gt;</description></item><item><title>Wishing for a destructor (C#)</title><link>https://owl.billpg.com/wishing-for-a-destructor-c/</link><pubDate>Sun, 28 Mar 2010 16:13:00 +0000</pubDate><guid>https://owl.billpg.com/wishing-for-a-destructor-c/</guid><description>&lt;div style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;
&lt;p&gt;&lt;img src="https://owl.billpg.com/images/s200_3251000099_59e269af6b_b.jpg" data-border="0" width="133" height="200" /&gt; &lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;I like the C# programming language. It feels like C++ done right, divesting itself of much of the C legacy that complicates matters so much. When I do programming, I prefer to use this language. Having to go back and deal with C++ just doesn&amp;rsquo;t give me that warm feeling like it used to.&lt;/p&gt;
&lt;p&gt;But, I have a pet peeve that I miss from C++.&lt;/p&gt;</description></item><item><title>is, then as (C#)</title><link>https://owl.billpg.com/is-then-as-c/</link><pubDate>Mon, 07 Dec 2009 21:11:00 +0000</pubDate><guid>https://owl.billpg.com/is-then-as-c/</guid><description>&lt;div style="clear: both; text-align: center;"&gt;
&lt;p&gt;&lt;a href="http://www.flickr.com/photos/preef/114158003/" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img src="https://owl.billpg.com/images/s200_fruit-stack.jpg" data-border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The C# language has a pair of related operators, &lt;strong&gt;is&lt;/strong&gt; and &lt;strong&gt;as&lt;/strong&gt;. Say you have an object, &lt;em&gt;x&lt;/em&gt;, and you want to know if its really type &lt;em&gt;Form&lt;/em&gt; underneath.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;(x is Form)&lt;/strong&gt; will &lt;em&gt;be true&lt;/em&gt; if it is, or &lt;em&gt;false&lt;/em&gt; if it isn&amp;rsquo;t. The &lt;strong&gt;as&lt;/strong&gt; operator will actually perform the conversion, returning &lt;em&gt;null&lt;/em&gt; if it can&amp;rsquo;t be converted to that type.&lt;/p&gt;</description></item></channel></rss>