<?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>BLARGH!! for the people</title>
	<atom:link href="http://blargh.tommymontgomery.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blargh.tommymontgomery.com</link>
	<description>It&#039;s time to bring forth the rhythm and the rhyme</description>
	<lastBuildDate>Fri, 09 Jul 2010 04:03:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PHP is Dead</title>
		<link>http://blargh.tommymontgomery.com/2010/07/php-is-dead/</link>
		<comments>http://blargh.tommymontgomery.com/2010/07/php-is-dead/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 04:03:13 +0000</pubDate>
		<dc:creator>tmont</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[rants]]></category>

		<guid isPermaLink="false">http://blargh.tommymontgomery.com/?p=528</guid>
		<description><![CDATA[PHP is dead. Probably.
Allow me to preface this with some context. I ]]></description>
			<content:encoded><![CDATA[<p>PHP is dead. Probably.</p>
<p>Allow me to preface this with some context. <span style="color: #FF99FF">I <3 PHP</span>. It&#8217;s probably my favorite language for a variety of reasons, but the number one reason being I&#8217;m pretty expert at it. But I&#8217;m not above recognizing that the majority of PHP programmers are generally idiot script kiddies, and don&#8217;t know how to write code that is not terrible. In that way, all PHP programmers get a bad name, because, like in all other aspects of life, the morons far outnumber us geniuses. It&#8217;s our cross to bear.</p>
<p>Anyway, PHP is dead. Probably. Here&#8217;s why.</p>
<h2>PHP is Stagnating</h2>
<p>PHP 4 was released in <a href="http://www.php.net/archive/2000.php">May 2000</a>. PHP 5 was released in <a href="http://www.php.net/archive/2004.php#5.0.0">July 2004</a>. PHP 4.4 was released in July 2005. PHP 5.3 was released in <a href="http://www.php.net/archive/2009.php#id2009-06-30-1">June 2009</a>.</p>
<p>These dates are not enumerated here to poke fun at the slow release cycle of PHP (I&#8217;ll get to the core team later). Rather, it&#8217;s to illustrate a point. Here are some numbers that I pulled from some random data dump from <a href="http://www.nexen.net/chiffres_cles/phpversion/18829-toutes_les_stats_php_en_telechargement.php">some non-English site</a> that&#8217;s probably totally legit:</p>
<pre class="brush: sql;">
SELECT
	SUBSTRING(libelle, 1, 1) `php version`,
	SUM(nombre) `count`
FROM stats
WHERE libelle REGEXP '^[3-6](\\.\\d(\\.\\d)?)?$'
AND `date` LIKE '2008-10-06%'
GROUP BY SUBSTRING(libelle, 1, 1)
</pre>
<pre class="brush: plain;">
php version  count
-----------  -------
3               8096
4            2396211
5            1977067
6                 23
</pre>
<p>If it&#8217;s not abundantly clear to you unwashed masses what a &#8220;libelle&#8221; is, I&#8217;m pretty sure that&#8217;s &#8220;label&#8221; in some kind of European language. The dataset represents a census documenting what technologies people use to power their sites. Basically, this query is saying that in October of 2008, 2.3 million people used PHP 4 on their website and 1.9 million people used PHP 5 on their web site.</p>
<p>At that time, PHP 5 had been stable for 4 years, and PHP 4 had been stable for 8 years. Their usage in production is pretty much even. PHP 5 added a lot of features, such as, you know, <strong>object-oriented programming</strong>. And yet it takes ten years (and counting) for PEAR to get off their asses and convert their code to PHP 5.</p>
<p>For those who don&#8217;t know, PEAR is the PHP Extension Application Repository. It&#8217;s a packaging mechanism similar to <kbd>yum</kbd> or <kbd>apt-get</kbd>, as well as a repository for extensions to the PHP language written in PHP (as opposed to PECL, which are extensions to the PHP language written in C). It defined a coding standard, and generally did a lot of good for the PHP community, except that it&#8217;s written in freaking PHP 4, and the coding standard is embarrassingly terrible.</p>
<p>For example, they prefix member variables with underscores to indicate that it&#8217;s not public, since PHP 4 didn&#8217;t have the notion of member variable accessibility. PHP 4 also didn&#8217;t have the notion of static. You should see the way they implement the singleton pattern in PHP 4. It&#8217;s pretty hilarious.</p>
<p>PHP 4 also didn&#8217;t pass objects by reference. That means you manually had to insert ampersands <strong>everywhere</strong> to make sure that your objects wouldn&#8217;t be treated like a value type. And when I say everywhere, I mean everywhere. This is a very common occurrence in PHP 4:</p>
<pre class="brush: php;">
$myReferenceType =&amp; new AwesomeClass();
</pre>
<p>DEAR GOD YOU COULDN&#8217;T EVEN USE THE NEW KEYWORD WITHOUT EXPLICITLY DEFINING THE REFERENCE. WHY ARE PEOPLE STILL USING THIS VERSION OF PHP?</p>
<p>This is all a long way of saying that PHP 4 is hideously outdated, both in calendar time and technologically, and yet it remains very prominent. I die a little inside when I see someone using a host that&#8217;s rocking Apache 1.3 and PHP 4.3. It&#8217;s like seeing someone using the cgi-bin directory. Aren&#8217;t we past that yet? This isn&#8217;t 1997 anymore.</p>
<p>The same argument goes for PHP 5.3 as well. It added some sorely missing features, such as namespaces and true anonmyous functions, as well as a plethora of classes in the SPL, and yet no one is upgrading. It&#8217;s been a year, and people are still creating classes called <kbd><strong>Awesome_Controller_Abstract</strong></kbd> instead of using namespaces like a normal person. It&#8217;s heartbreaking.</p>
<p>This is what will cause PHP to always be slightly behind the curve technologically: its users&#8217; snail&#8217;s pace upgrade rate. Eventually, its one strength, the extremely low barrier to entry, will be nullified as other languages figure out how to be more accessible to the masses.</p>
<h2>The PHP Core team is separated from reality</h2>
<p>So, I imagine this is a problem for a lot of languages, and I&#8217;m definitely making unfair blanket statements, but I want to bring it up for one very specific reason. Try to read the next sentence without laughing.</p>
<p><code>In PHP, the namespace separator is the backslash.</code></p>
<p>You laughed, didn&#8217;t you?</p>
<p>Allow me to give a bit of backstory without citing any sources.</p>
<p>There was fairly raging debate among the core developers on what to use for the namespace separator in the months before PHP 5.3 was released. You see, it wasn&#8217;t as simple as you might think, because PHP isn&#8217;t primarily an object-oriented language.</p>
<p>The original solution was to use the <a href="http://php.net/manual/en/keyword.paamayim-nekudotayim.php">paamayim nekudotayim</a> (<strong>scope resolution operator</strong>, but the Hebrew version is way cooler) as a namespace separator. But oh no! That caused problems in situations like this:</p>
<pre class="brush: php;">
//bar.php
namespace Bar;

function foo() {}

//meanwhile, in baz.php
require_once bar.php;

class Bar {
  static function foo() {}
}

Bar::foo(); //which foo gets called? in the Bar namespace or in the Bar class?
</pre>
<p>So, the core team realized they had a problem. There were several solutions:</p>
<ol>
<li>Only apply namespaces to OO code (classes, interfaces, etc.)</li>
<li>Change the namespace separator character to something unambiguous</li>
</ol>
<p>Hindsight is always 20/20, but the second option there seems pretty retarded to me. It&#8217;s hard to find an unambiguous character in any language that has previous releases, because they&#8217;re all being used. What happens is you&#8217;ll end up choosing a character that&#8217;s hard to type (i.e. one you have to press shift for), or you&#8217;ll choose something that&#8217;s unambiguous technically (meaning not significantly used) but has ambiguous semantics (like, say, the escape character in every language besides T-SQL).</p>
<p>At one point, the core team actually created a matrix where each row was a different character (I think the triple colon was in the running at one point, which would probably be even more awesome when translated to Hebrew), and each column had funny stuff like &#8220;is hard to type&#8221; with a numeric value. The last column summed up the numeric values and the row with the highest number was the winner. It was all very democratic (THROUGH PURPLE MOUNTAIN MAJESTIES&#8230;).</p>
<p>The backslash won.</p>
<p>Well, kind of. Pretty much everybody who typed code for a living hated the backslash because, you know, IT&#8217;S THE BACKSLASH. Nobody wants to look at that.</p>
<p>But PHP is an open source project, which means most or all of them don&#8217;t get paid to work on it, so that means that the easiest solution will win. And in this case, the easiest solution was the one that was already done. One of the core developers got tired of the bickering and the matrices and the Hebrew and he spent a weekend implementing the backslash namespace separator and committed it to the branch. Then he wrote tests covering all possible cases, and created a patch against trunk.</p>
<p>He had everyone at &#8220;tests&#8221; and &#8220;patch&#8221;. And that&#8217;s how the backslash became the namespace separator for PHP.</p>
<p>This was all a a long way of saying their decision was made with their brains instead of their guts. If they used their guts, they would have realized that NOBODY GIVES A CRAP ABOUT NAMESPACES EXCEPT PEOPLE WHO DO OBJECT-ORIENTED CODE. Nobody cares if the 4000 lines of random functions in <kbd>stuff.php</kbd> is in a namespace. The only people who care about namespaces are those that experienced it in another language (like say, an object-oriented language) and would want to apply the same organizational structure to their PHP code. And those people are only writing classes and interfaces. </p>
<p>Ergo, they should have ignored the collision issues illustrated above, only applied namespaces to classes and interfaces, and rocked the <strong>PAAMAYIM NEKUDOTAYIM</strong> like it was going out of style. But since the PHP core team are experts in C, not PHP, they didn&#8217;t really realize this.</p>
<p>Instead, we are condemned to a life full of backslashes. I&#8217;ve already started a support group.</p>
<h2>PHP 6 is a disaster area</h2>
<p>I don&#8217;t have a lot to say about this, except that it seems like it&#8217;s an absolute disaster. The main thing going on in PHP 6 is unicode support. </p>
<p><code>yay.</code></p>
<p>I&#8217;m not totally sure why that&#8217;s so awesome, but it&#8217;s a lot of work, and it isn&#8217;t going well. Again I&#8217;m not going to cite any sources, but it&#8217;s been in the works for about two years to add unicode support to PHP, and I don&#8217;t think it&#8217;s very close to being done.</p>
<p>The problem seems to be that they can&#8217;t just add unicode support, because every extension would be incompatible. So they&#8217;re trying to retroactively add unicode support to everything at once, which is as terrible as it sounds. I could be making all this up, but it sounds similar to something I might have read once.</p>
<p>Basically, they&#8217;re attempting to add a feature that will be of minimal value, and it&#8217;s taking forever. Instead, they could be adding cool things, like some of these:</p>
<ul>
<li><a href="http://wiki.php.net/rfc/propertygetsetsyntax">C#-style properties</a></li>
<li><a href="http://wiki.php.net/rfc/autoboxing">Auto-boxing</a></li>
<li><a href="http://wiki.php.net/rfc/horizontalreuse">Traits</a></li>
<li><a href="http://wiki.php.net/rfc/enum">Enumerations</a></li>
<li><a href="http://wiki.php.net/rfc/fcallfcall">Function call chaining</a> (oh god yes)</li>
<li><a href="http://wiki.php.net/rfc/static-classes">Static classes</a></li>
</ul>
<h2>In Conclusion</h2>
<p>PHP is dying. Probably. I hope I&#8217;m wrong, because I think PHP is a very expressive, convenient language. It has, by far, the best function library of any language. It also has, by far, the best documentation of any language, as well as a giant, open community around it. For those reasons, I hope it doesn&#8217;t die. But I&#8217;ve seen little evidence that it&#8217;s not going to march straight to hell.</p>
]]></content:encoded>
			<wfw:commentRss>http://blargh.tommymontgomery.com/2010/07/php-is-dead/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Refresh Current Page in JavaScript</title>
		<link>http://blargh.tommymontgomery.com/2010/05/refresh-current-page-in-javascript/</link>
		<comments>http://blargh.tommymontgomery.com/2010/05/refresh-current-page-in-javascript/#comments</comments>
		<pubDate>Sun, 09 May 2010 23:55:26 +0000</pubDate>
		<dc:creator>tmont</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://blargh.tommymontgomery.com/?p=513</guid>
		<description><![CDATA[It&#8217;s more annoying than it sounds. You could do the classic:

window.location = window.location; //refresh lol!

But you&#8217;ll get screwed if there is a fragment, like, say, http://example.com/index.html#section1. The page won&#8217;t refresh. Or rather, it will, but browsers won&#8217;t send a request to the server if the url contains a fragment. It will just try to navigate [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s more annoying than it sounds. You could do the classic:</p>
<pre class="brush: jscript;">
window.location = window.location; //refresh lol!
</pre>
<p>But you&#8217;ll get screwed if there is a <a href="http://www.w3.org/TR/WD-html40-970708/htmlweb.html#h-4.1.1">fragment</a>, like, say, <kbd>http://example.com/index.html#section1</kbd>. The page won&#8217;t refresh. Or rather, it will, but browsers won&#8217;t send a request to the server if the url contains a fragment. It will just try to navigate to that fragment within the document.</p>
<p>Solution: be awesome.</p>
<pre class="brush: jscript;">
(function(){
  var refreshCookie = &quot;mysite.refreshFragment&quot;;

  var refresh = function() {
    var url = window.location.href;
    var fragmentPosition = url.lastIndexOf(&quot;#&quot;);
    if (fragmentPosition &gt;= 0) {
      if (fragmentPosition !== url.length - 1) {
        $.cookie(refreshCookie, url.substring(fragmentPosition + 1)); //store the fragment in a cookie
      }
      url = url.substring(0, fragmentPosition);
    }
    window.location.href = url;
  };

  var applyFragmentFromCookie = function() {
    var fragment = $.cookie(refreshCookie);
    if (fragment !== null) {
      window.location.href += &quot;#&quot; + fragment;
      $.cookie(refreshCookie, null); //delete cookie
    }
  };

  //reapply the fragment (if necessary) when the page is loaded
  $(document).ready(applyFragmentFromCookie);

  //expose to the public (you would of course properly namespace this, right?)
  window.refresh = refresh;
}());

//then, when you wanted to refresh the page...
refresh();
</pre>
<p>I use the <a href="http://plugins.jquery.com/project/cookie">jQuery cookie plugin</a>, because all the kids nowadays are using jQuery. Substitute your own <a href="http://www.dustindiaz.com/top-ten-javascript/">cookie handling framework</a>, or roll your own (I&#8217;ve done it, it&#8217;s not enjoyable).</p>
<p><a href="http://tmont.com/experiments/javascript-refresh/">See it in action.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blargh.tommymontgomery.com/2010/05/refresh-current-page-in-javascript/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Subversion, Apache, nginx and &#8220;Entity Too Large&#8221;</title>
		<link>http://blargh.tommymontgomery.com/2010/05/subversion-apache-nginx-and-entity-too-large/</link>
		<comments>http://blargh.tommymontgomery.com/2010/05/subversion-apache-nginx-and-entity-too-large/#comments</comments>
		<pubDate>Wed, 05 May 2010 04:00:48 +0000</pubDate>
		<dc:creator>tmont</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://blargh.tommymontgomery.com/?p=502</guid>
		<description><![CDATA[tl;dr: add client_max_body_size 10m; to your nginx vhost.
This one took me a while to track down. My brother uses my subversion repository, and he was trying to commit a 1MB flash file. The TortoiseSVN error he got back was: 

This was a bit perplexing. I figured it was some sort of mod_dav setting I had [...]]]></description>
			<content:encoded><![CDATA[<p><strong>tl;dr: add <kbd>client_max_body_size 10m;</kbd> to your nginx vhost.</strong></p>
<p>This one took me a while to track down. <a href="http://bob.tmont.com/">My brother</a> uses my subversion repository, and he was trying to commit a 1MB flash file. The TortoiseSVN error he got back was: </p>
<p><img src="http://blargh.tommymontgomery.com/wp-content/uploads/2010/05/CommitError.png" alt="" title="CommitError" width="659" height="301" class="aligncenter size-full wp-image-503" /></p>
<p>This was a bit perplexing. I figured it was some sort of <kbd>mod_dav</kbd> setting I had never encountered, so I turned to Google. Google spouted a bunch of stuff about where to put your SSL directives in your Apache configuration, some stuff about Apache not handling the <kbd>Content-Length</kbd> header correctly, some promising mailing list threads about using the <kbd>LimitXMLRequestBody</kbd> <kbd>mod_dav</kbd> directive, and a bunch of stuff about some idiots trying to commit 4GB files to a subversion server running on Windows.</p>
<p>None of these were my problem.</p>
<p>It turns out I needed to add another keyword to my search. After I searched for <em>svn apache <strong>nginx</strong> &#8220;entity too large&#8221;</em>, the <a href="http://digita.la/2009/2/12/nginx-subversion-and-413-s">first hit</a> took me home. Like everyone else who is awesome, I&#8217;m using nginx as a proxy to Apache running <kbd>mod_dav</kbd>. nginx&#8217;s configuration was getting hit first, and Apache and Subversion had nothing to do with anything.</p>
<p>It turns out the default maximum request body size for nginx is 1MB, exactly the size my brother was trying commit to the repository. Adding this one line in my virtual host solved it all:</p>
<pre class="brush: plain; highlight: [5];">
server {
    listen 80;
    server_name svn.tommymontgomery.com;

    client_max_body_size 10m;

    location / {
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_pass http://svn.tommymontgomery.com:8080;
    }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blargh.tommymontgomery.com/2010/05/subversion-apache-nginx-and-entity-too-large/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Seven CSS Tricks No One Should Ever Have to Memorize</title>
		<link>http://blargh.tommymontgomery.com/2010/05/seven-css-tricks-no-one-should-ever-have-to-memorize/</link>
		<comments>http://blargh.tommymontgomery.com/2010/05/seven-css-tricks-no-one-should-ever-have-to-memorize/#comments</comments>
		<pubDate>Sun, 02 May 2010 01:24:07 +0000</pubDate>
		<dc:creator>tmont</dc:creator>
				<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://blargh.tommymontgomery.com/?p=489</guid>
		<description><![CDATA[CSS is kinda cool, or at least it would be if everybody used the same browser. Instead, they don&#8217;t, so doing stuff with CSS is mostly impossible. There are few super annoying hacks and tricks that I use every six months but can never remember, and then end up scouring the internet looking for an [...]]]></description>
			<content:encoded><![CDATA[<p>CSS is kinda cool, or at least it would be if everybody used the same browser. Instead, they don&#8217;t, so doing stuff with CSS is mostly impossible. There are few super annoying hacks and tricks that I use every six months but can never remember, and then end up scouring the internet looking for an implementation that&#8217;s not on <a href="http://www.webmasterworld.com/">webmasterworld.com</a>. Seriously, how is that site still so far up in the Google rankings? It&#8217;s so terrible.</p>
<p>Anyway, I&#8217;ve compiled a short list of seven things that I&#8217;m constantly googling for. Note that this isn&#8217;t a list of &#8220;Tommy&#8217;s 101 CSS tricks for beginers (sic)!&#8221;. This is a list of things I can&#8217;t be bothered to remember. I already know all of the basic stuff, and I&#8217;m assuming you do too.</p>
<h2>1. Reset</h2>
<p><a href="http://meyerweb.com/eric/tools/css/reset/">Reset CSS by Eric Meyer</a></p>
<pre class="brush: css; collapse: true; light: false; toolbar: true;">
/* v1.0 | 20080212 */

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
	margin: 0;
	padding: 0;
	border: 0;
	outline: 0;
	font-size: 100%;
	vertical-align: baseline;
	background: transparent;
}
body {
	line-height: 1;
}
ol, ul {
	list-style: none;
}
blockquote, q {
	quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: '';
	content: none;
}

/* remember to define focus styles! */
:focus {
	outline: 0;
}

/* remember to highlight inserts somehow! */
ins {
	text-decoration: none;
}
del {
	text-decoration: line-through;
}

/* tables still need 'cellspacing=&quot;0&quot;' in the markup */
table {
	border-collapse: collapse;
	border-spacing: 0;
}
</pre>
<p>The reset CSS creates an even playing field across all browsers, by removing the default styles that each applies. If you want to create a cross-browser compatible web app, then use this, and don&#8217;t question it.</p>
<h2>2. Clearfix</h2>
<p><a href="http://perishablepress.com/press/2009/12/06/new-clearfix-hack/">Clearfix</a></p>
<pre class="brush: css; collapse: true; light: false; toolbar: true;">
/* new clearfix */
.clearfix:after {
	visibility: hidden;
	display: block;
	font-size: 0;
	content: &quot; &quot;;
	clear: both;
	height: 0;
	}
* html .clearfix             { zoom: 1; } /* IE6 */
*:first-child+html .clearfix { zoom: 1; } /* IE7 */
</pre>
<p>This hack has gone through a few iterations, so I don&#8217;t know who the original author is. I use the one described at the link above. Use this if all child elements are <kbd>float</kbd>ed, and you want the parent element to retain its &#8220;assumed&#8221; height. Useful for horizontal menus made up of floated <kbd>li</kbd>s. Give your <kbd>&lt;ul&gt;</kbd> a <kbd>clearfix</kbd>.</p>
<h2>3. MIR Image Replacement</h2>
<p><a href="http://www.stuffandnonsense.co.uk/archives/examples/malarkey-method-example.html">Malarkey Image Replacement Examples</a></p>
<pre class="brush: css; collapse: true; light: false; toolbar: true;">
.mir { letter-spacing : -1000em; }
/* Just for Opera, but hide from MacIE */
/*\*/html&gt;body .mir { letter-spacing : normal; text-indent : -999em; overflow : hidden;}
/* End of hack */
</pre>
<p>This is a useful hack for when you want your fancy menus/giant <kbd>h1</kbd> tag to gracefully degrade when styles are removed. Slap a <kbd>class="mir"</kbd> on it, give it some text, and you&#8217;re good to go. See the examples for examples (derp).</p>
<h2>4. 100% height</h2>
<p><a href="http://www.tutwow.com/tips/quick-tip-css-100-height/comment-page-2/#comment-1481">CSS 100% Height</a></p>
<pre class="brush: css; collapse: true; light: false; toolbar: true;">
html { height:100%; }
body { min-height:100%; }
#content { min-height:100%; }
</pre>
<p>While you can of course solve this (and the world&#8217;s) problem with tables, you shouldn&#8217;t. Because tables suck, much like <a href="http://urmomisugly.com/">urmom</a>. But seriously, this is an incredibly difficult problem with an extremely simple solution.</p>
<h2>5. Center an unordered list</h2>
<p><a href="http://www.cssplay.co.uk/menus/centered.html">Centering a floated menu</a></p>
<pre class="brush: css; collapse: true; light: false; toolbar: true;">
.container {
  width:100%;
  overflow:hidden;
}
ul#menu2 {
  margin:0 auto;
  list-style-type:none;
  float:left;
  position:relative;
  left:50%;
}
#menu2 li {
  float:left;
  position:relative;
  right:50%;
}
</pre>
<p>You won&#8217;t figure this one out on your own. Stop trying.</p>
<h3>Tommy&#8217;s Steps to Success</h3>
<ol>
<li>Ctrl+C</li>
<li>Ctrl+V</li>
<li>???</li>
<li>Profit</li>
</ol>
<h2>6. Opacity in IE</h2>
<p><a href="http://joseph.randomnetworks.com/archives/2006/08/16/css-opacity-in-internet-explorer-ie/">CSS Opacity in IE</a></p>
<pre class="brush: css; collapse: true; light: false; toolbar: true;">
.something-with-opacity {
  opacity: 0.5; /* everybody under the sun except IE */
  filter: alpha(opacity = 50); /* IE */
}
</pre>
<p>You might also need that <kbd>zoom: 1</kbd> crap for elements that don&#8217;t <a href="http://msdn.microsoft.com/en-us/library/bb250481(VS.85).aspx">have layout</a>.</p>
<h2>7. Vertically center a block element</h2>
<p><a href="http://www.jakpsatweb.cz/css/css-vertical-center-solution.html">Vertically Centering in CSS</a> or <a href="http://phrogz.net/css/vertical-align/index.html">How (Not) to Vertically Center Content</a></p>
<p>If you already know the width and height of the container, then you should be able to figure out how to vertically center something by using math (hint: division) and absolute positioning. If it&#8217;s more fluid, then you&#8217;re probably screwed.</p>
<p>For inline elements, use <kbd>line-height</kbd>. For block elements, use JavaScript. If that&#8217;s not an option, then you can <em>attempt</em> at implementing something like the above links, but I wouldn&#8217;t hold your breath. It&#8217;s mostly impossible.</p>
<p>If absolute positioning is not an option, you can try the <kbd>display: table-cell; vertical-align: middle</kbd> route, but it&#8217;s a crapshoot, and it doesn&#8217;t seem to work in all browsers. Using <kbd>position: absolute; top: 50%;</kbd> is viable as long as you know the height of the element and don&#8217;t care about absolutely positioning something.</p>
<p>Of course, you could <kbd>valign</kbd> yourself to success if you&#8217;re using tables, but you wouldn&#8217;t be stupid enough to do something like that, would you?</p>
]]></content:encoded>
			<wfw:commentRss>http://blargh.tommymontgomery.com/2010/05/seven-css-tricks-no-one-should-ever-have-to-memorize/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Get Computed Style in JavaScript</title>
		<link>http://blargh.tommymontgomery.com/2010/04/get-computed-style-in-javascript/</link>
		<comments>http://blargh.tommymontgomery.com/2010/04/get-computed-style-in-javascript/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 10:25:15 +0000</pubDate>
		<dc:creator>tmont</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://blargh.tommymontgomery.com/?p=476</guid>
		<description><![CDATA[The computed style of an element incorporates external CSS (via stylesheets), inline styles and styles prescribed via JavaScript. It&#8217;s most commonly used to get the default style of an element if it&#8217;s not specifically assigned via styles, i.e. the default style that the browser gives an element. It&#8217;s a very undocumented part of JavaScript engines, [...]]]></description>
			<content:encoded><![CDATA[<p>The computed style of an element incorporates external CSS (via stylesheets), inline styles and styles prescribed via JavaScript. It&#8217;s most commonly used to get the default style of an element if it&#8217;s not specifically assigned via styles, i.e. the default style that the browser gives an element. It&#8217;s a very undocumented part of JavaScript engines, and, of course, there are multiple implementations. For more details, read <a href="http://blog.stchur.com/2006/06/21/css-computed-style/">this blog post</a>.</p>
<p>For my <a href="http://linkurious.com/">Linkurious</a> project, I needed to get the computed style of an element in a cross browser way. I came up with an implementation that works in every version of every browser (within reason, the <a href="http://www.armory.com/~spectre/cwi/hl/">C64</a> is not supported), and is easy to use.</p>
<p>I&#8217;ll leave the details of how it works as an exercise to the reader. I will say that this is a good example of how to use a closure to improve the efficiency of a function. Notice that the cross-browser garbage is only executed once, not on each call.</p>
<pre class="brush: jscript;">
//must be executed on or after the domready event, since it (may) require document.body to be non-null
var getComputedStyle = function() {
  var func = null;
  if (document.defaultView &amp;&amp; document.defaultView.getComputedStyle) {
    func = document.defaultView.getComputedStyle;
  } else if (typeof(document.body.currentStyle) !== &quot;undefined&quot;) {
    func = function(element, anything) {
      return element[&quot;currentStyle&quot;];
    };
  }

  return function(element, style) {
    return func(element, null)[style];
  }
}();

//and use like so:
getComputedStyle(document.getElementById(&quot;foo&quot;), &quot;display&quot;); //might return &quot;inline-block&quot;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blargh.tommymontgomery.com/2010/04/get-computed-style-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linq Walk</title>
		<link>http://blargh.tommymontgomery.com/2010/03/linq-walk/</link>
		<comments>http://blargh.tommymontgomery.com/2010/03/linq-walk/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 08:05:57 +0000</pubDate>
		<dc:creator>tmont</dc:creator>
				<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://blargh.tommymontgomery.com/?p=460</guid>
		<description><![CDATA[So, we all know Linq is rad. Not in that silly faux-SQL syntax, but in the manly, declarative, fluent syntax.
But the sad part is that there is no walk extension method. Walk is a functional programming staple that iterates over a collection of stuff and applies a callback to each one. In PHP, there is [...]]]></description>
			<content:encoded><![CDATA[<p>So, we all know <a href="http://msdn.microsoft.com/en-us/netframework/aa904594.aspx">Linq</a> is rad. Not in that silly faux-SQL syntax, but in the manly, declarative, fluent syntax.</p>
<p>But the sad part is that there is no <kbd>walk</kbd> extension method. Walk is a functional programming staple that iterates over a collection of stuff and applies a callback to each one. In PHP, there is <a href="http://php.net/manual/en/function.array-walk.php"><kbd>array_walk</kbd></a>, in JavaScript there is <a href="http://javascriptkit.com/jsref/arrays.shtml"><kbd>each</kbd></a>.</p>
<p>You might be thinking, &#8220;but there is a <kbd>ForEach()</kbd> extension method on <kbd>List</kbd>!&#8221;. And you would be wrong, because there is a subtle, yet important difference between <kbd>IEnumerable</kbd> and <kbd>IList</kbd>.</p>
<p><kbd>IEnumerable</kbd> is late-binding. That means you can do whatever you want to it, but execution is deferred until you actually enumerate the enumeration, i.e. using a <kbd>foreach</kbd> construct. In a list, there is no deferred execution. This deferred execution is accomplished through the magic of closures and expression trees. Read up on them.</p>
<p>In the meantime, here is a fluent implementation of <kbd>walk</kbd>:</p>
<pre class="brush: csharp;">
public static class LinqExtensions {
	public static IEnumerable&lt;T&gt; Walk&lt;T&gt;(this IEnumerable&lt;T&gt; source, Action&lt;T&gt; action) {
		foreach (var t in source) {
			action(t);
			yield return t;
		}
	}
}
</pre>
<p>You can prove that this is in fact using deferred execution with a simple test:</p>
<pre class="brush: csharp;">
class Program {

	class Foo {
		public int Bar { get; set; }

		public override string ToString() {
			return string.Format(&quot;Foo(Bar={0})&quot;, Bar);
		}
	}

	static void Main() {
		IEnumerable&lt;Foo&gt; foos = new[] { new Foo { Bar = 2 }, new Foo { Bar = 1 }, new Foo { Bar = 3 } };

		Console.WriteLine(&quot;IEnumerable.Walk():&quot;);
		foos.Walk(Console.WriteLine);
		Console.WriteLine();

		Console.WriteLine(&quot;List.ForEach():&quot;);
		foos.ToList().ForEach(Console.WriteLine);
		Console.WriteLine();

		Console.ReadLine();
	}

}
</pre>
<p>The output looks like this:<br />
<img src="http://blargh.tommymontgomery.com/wp-content/uploads/2010/03/linqwalk1.png" alt="linqwalk" title="linqwalk" width="287" height="123" class="aligncenter size-full wp-image-468" /></p>
<p>Notice that nothing got printed the first time through, using the <kbd>Walk()</kbd> extension method. There&#8217;s your deferred execution. That means our extension method did not enumerate the enumeration, so it&#8217;s safe and efficient to use walk in a normal linq expression where you are depending on deferred execution, like this:</p>
<pre class="brush: csharp;">
IEnumerable&lt;Foo&gt; foos = new[] { new Foo { Bar = 2 }, new Foo { Bar = 1 }, new Foo { Bar = 3 } };

Console.WriteLine(&quot;Doing more stuff:&quot;);
var listOStuff = foos
	.Where(foo =&gt; foo.Bar &gt;= 2)
	.Walk(foo =&gt; foo.Bar += 10)
	.Select(foo =&gt; new Baz { Foofy = foo })
	.Walk(baz =&gt; baz.Foofy.Bar--)
	.OrderBy(baz =&gt; baz.Foofy.Bar);

foreach (var stuff in listOStuff) {
	Console.WriteLine(stuff);
}

Console.ReadLine();
</pre>
<p><img src="http://blargh.tommymontgomery.com/wp-content/uploads/2010/03/linqwalk2.png" alt="linqwalk2" title="linqwalk2" width="360" height="110" class="aligncenter size-full wp-image-466" /></p>
<p>Well, maybe that&#8217;s not &#8220;normal.&#8221; Whatever.</p>
]]></content:encoded>
			<wfw:commentRss>http://blargh.tommymontgomery.com/2010/03/linq-walk/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sudoku Solver: 2006-style</title>
		<link>http://blargh.tommymontgomery.com/2010/03/sudoku-solver-2006-style/</link>
		<comments>http://blargh.tommymontgomery.com/2010/03/sudoku-solver-2006-style/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 06:52:32 +0000</pubDate>
		<dc:creator>tmont</dc:creator>
				<category><![CDATA[java]]></category>
		<category><![CDATA[lulz]]></category>

		<guid isPermaLink="false">http://blargh.tommymontgomery.com/?p=451</guid>
		<description><![CDATA[College was such a carefree time. I wasn&#8217;t jaded, or cynical, or experienced (at least not in the way you&#8217;re thinking). I didn&#8217;t care about testability, or code coverage, or documentation, or design patterns, or any of the crap that plagues my thoughts whenever I sit down to write code. I would just sit at [...]]]></description>
			<content:encoded><![CDATA[<p>College was such a carefree time. I wasn&#8217;t jaded, or cynical, or experienced (at least not in the way you&#8217;re thinking). I didn&#8217;t care about testability, or code coverage, or documentation, or design patterns, or any of the crap that plagues my thoughts whenever I sit down to write code. I would just sit at my computer, fire up ye olde <a href="http://www.modelworks.com/index.html">JPad Pro</a> and churn out steaming mounds of code.</p>
<p><a href="http://dilbert.com/fast/2001-05-27/"><img src="http://blargh.tommymontgomery.com/wp-content/uploads/2010/03/steamingmoundsofcode.gif" alt="steamingmoundsofcode" title="steamingmoundsofcode" width="560" height="250" class="aligncenter size-full wp-image-452" /></a></p>
<p>I recently found a <del>cool</del> thing I created while in college: a <a href="http://en.wikipedia.org/wiki/Sudoku">Sudoku</a> solver. It&#8217;s nothing new or innovative, but it <em>is</em> coolish looking. And it&#8217;s a Java applet! Remember those?</p>
<p>It might just be amusing to look at the HTML source and laugh at my foolish naïvete. No doctype? Not quoting HTML attributes? 1998-style <a href="http://www.dustindiaz.com/web-1-point-oh-techniques/">mouse rollovers</a>? <acronym>JPEG</acronym>s? Not using swing? The futhermucking <kbd>&lt;applet&gt;</kbd> tag!? You might have to see it to believe it.</p>
<p><a href="http://tmont.com/sudoku-solver/sudoku.html">Be delighted</a>.</p>
<p>Stay cool over the summer, guys.</p>
<p><strong>PS</strong>: on a more up-to-date note, I had to change the name of the <kbd>isValid()</kbd> method because it was causing <kbd>NullPointerException</kbd>s during the panel/applet init phase. I guess the order of method calling changed since 1.4?</p>
<p><strong>PPS</strong>: obviously I shouldn&#8217;t have been overriding <kbd>Component.isValid()</kbd>, but I didn&#8217;t know what I was doing. I was only 20!</p>
]]></content:encoded>
			<wfw:commentRss>http://blargh.tommymontgomery.com/2010/03/sudoku-solver-2006-style/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Uncountable vs. Infinite</title>
		<link>http://blargh.tommymontgomery.com/2010/02/uncountable-vs-infinite/</link>
		<comments>http://blargh.tommymontgomery.com/2010/02/uncountable-vs-infinite/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 07:50:33 +0000</pubDate>
		<dc:creator>tmont</dc:creator>
				<category><![CDATA[math]]></category>

		<guid isPermaLink="false">http://blargh.tommymontgomery.com/?p=427</guid>
		<description><![CDATA[What does it mean to be infinite? Never-ending? What about uncountable? Is the set of integers uncountable? How about the real numbers? What&#8217;s the difference?
Questions from a freshman math student, no doubt. The uncountable vs. infinite problem is a turning point in the quest for a bachelor&#8217;s degree in mathematics. To be crude, it&#8217;s the [...]]]></description>
			<content:encoded><![CDATA[<p>What does it mean to be infinite? Never-ending? What about uncountable? Is the set of integers uncountable? How about the real numbers? What&#8217;s the difference?</p>
<p>Questions from a freshman math student, no doubt. The uncountable vs. infinite problem is a turning point in the quest for a bachelor&#8217;s degree in mathematics. To be crude, it&#8217;s the &#8220;shit or get off the pot time&#8221; for the aspiring undergrad. It&#8217;s also one of the coolest definitions in mathematics, because it&#8217;s paradoxical and basically impossible to explain without also proving it. Not very many problems are like that.</p>
<p>This problem has to do with the cardinality of sets: &#8220;prove that such-and-such set is countable&#8221;. Not surprisingly, this comes up a lot in discrete mathematics and group/ring theory, since both topics use sets as input and output to problems.</p>
<h2>Infinitude</h2>
<p>So what does it mean to be infinite? That&#8217;s actually the easy one: it goes on forever. The set of integers is infinite, because, for example, there&#8217;s no upper bound on how high you can count. The natural numbers [1, 2, ... n-1, n, n+1, ...] are also infinite, for the exact same reason. Yet it seems like the natural numbers should be half the size of the integers, since it&#8217;s really just the set of integers without the negative ones. Yet both sets are infinite, and we still have <img src="http://quicklatex.com/cache/ql_0437549a601a0f9462a91e36f3d5be8b.gif" alt="\mathbb{N} \subset \mathbb{Z}" title="\mathbb{N} \subset \mathbb{Z}" style="vertical-align: -1px; border: none;"/>.</p>
<p>So we have two infinite sets, and one is a subset of the other. We already have a paradox, and I haven&#8217;t even gotten to countability yet. Isn&#8217;t math fun?</p>
<h2>Countability</h2>
<p>So, how is uncountable different? Well, actually, the definition of <strong>countable</strong> is really the interesting part here. The formal definition of countable is:</p>
<blockquote><p>A set is considered countable if it is isomorphic to the natural numbers.</p></blockquote>
<p>Like any good mathematical definition, it leaves you searching for a dictionary. Basically, it means that a set is countable if you can come up with a function that maps every element in the set to a <strong>distinct</strong> element in the natural numbers. If you think about that for a minute, it kind of makes sense. The natural numbers are also known as &#8220;the counting numbers&#8221;. If you can represent another set as a function that maps to [1, 2, 3 ...], then you&#8217;ve just proven that it&#8217;s fundamentally equivalent to the counting numbers, so it should be countable. Of course, a proof by grammar isn&#8217;t really acceptable, but for the purposes of comprehension, it might help. Or not. Whatever.</p>
<p>So, obviously, the natural numbers are countable, because the function <img src="http://quicklatex.com/cache/ql_9e5ce5881bdfa98f9786671ce238817e.gif" alt="f(x)=x|x\in\mathbb{N}" title="f(x)=x|x\in\mathbb{N}" style="vertical-align: -5px; border: none;"/> maps every element <img src="http://quicklatex.com/cache/ql_9dd4e461268c8034f5c8564e155c67a6.gif" alt="x" title="x" style="vertical-align: 0px; border: none;"/> in the natural numbers (<img src="http://quicklatex.com/cache/ql_9b3ecd4f5f0cc174717f19cec0743fcd.gif" alt="\mathbb{N}" title="\mathbb{N}" style="vertical-align: 0px; border: none;"/>) to itself.</p>
<h2>Diagonalization</h2>
<p>Now, we come to <a href="http://en.wikipedia.org/wiki/Georg_Cantor">Cantor</a>, and his <a href="http://en.wikipedia.org/wiki/Cantor%27s_diagonal_argument">proof by diagonalization</a>. Basically, Cantor came up with a simple of way of expressing the countability of sets using a matrix where the diagonals of the matrix are significant. But the theory of that is not important right now. Right now we&#8217;re going to use diagonalization to prove that the <a href="http://en.wikipedia.org/wiki/Rational_number">rational numbers</a> (<img src="http://quicklatex.com/cache/ql_5eac308e29708e918ed13a88a4249b74.gif" alt="\mathbb{Q}" title="\mathbb{Q}" style="vertical-align: -3px; border: none;"/>) are countable.</p>
<p>Let&#8217;s put the rational numbers in a matrix, such that the pattern is obvious.</p>
<p><img src="http://quicklatex.com/cache/ql_d5fa83926dc7d9495919bdf41f8bd165.gif" alt="\left( \begin{array}{ccccc} 1/1 & 1/2 & 1/3 & 1/4 & \ldots \\ 2/1 & 2/2 & 2/3 & 2/4 & \ldots \\ 3/1 & 3/2 & 3/3 & 3/4 & \ldots \\ 4/1 & 4/2 & 4/3 & 4/4 & \ldots \\ \ldots & \ldots & \ldots & \ldots & \ldots \\ \end{array} \right) " title="\left( \begin{array}{ccccc} 1/1 & 1/2 & 1/3 & 1/4 & \ldots \\ 2/1 & 2/2 & 2/3 & 2/4 & \ldots \\ 3/1 & 3/2 & 3/3 & 3/4 & \ldots \\ 4/1 & 4/2 & 4/3 & 4/4 & \ldots \\ \ldots & \ldots & \ldots & \ldots & \ldots \\ \end{array} \right) " style="vertical-align: -50px; border: none;"/></p>
<p>If the pattern&#8217;s not obvious, we&#8217;re enumerating the rational numbers, starting in the top left corner with <img src="http://quicklatex.com/cache/ql_0fcabfa8af576ebe76de84b71f9b15ff.gif" alt="1/1" title="1/1" style="vertical-align: -5px; border: none;"/>. To the east, the denominators increment, and to the south the numerators increment. By enumerating the rationals in this way, it should be equally obvious that given an infinitely large matrix, we would generate <strong>every single</strong> rational number. For example, where would <img src="http://quicklatex.com/cache/ql_2886f116be65d77307bc58c5741ea193.gif" alt="117/934" title="117/934" style="vertical-align: -5px; border: none;"/> be? It would be at the intersection of the 117th column and the 934th row.</p>
<p>Now, Cantor&#8217;s diagonalization comes in to prove that the rationals are countable. If we use a pen and traverse the matrix starting at the top left corner at <img src="http://quicklatex.com/cache/ql_0fcabfa8af576ebe76de84b71f9b15ff.gif" alt="1/1" title="1/1" style="vertical-align: -5px; border: none;"/>, we can traverse it in such a way that our pen never leaves the table, and we hit each number only once. This graphic should help visualize it:</p>
<p><img src="http://blargh.tommymontgomery.com/wp-content/uploads/2010/02/diagonlization.png" alt="diagonalization" title="diagonalization" width="251" height="120" class="aligncenter size-full wp-image-445" /></p>
<p>QED.</p>
<p>How does this prove that the rationals are countable? Well, we just showed that we can enumerate every single rational number, and traverse them in a unique way such that we only hit each rational number once. There&#8217;s your isomorphism. If you really want, you can put that sentence in the form of a function, but I&#8217;ll leave that as an exercise to the reader.</p>
]]></content:encoded>
			<wfw:commentRss>http://blargh.tommymontgomery.com/2010/02/uncountable-vs-infinite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to be an Awesome Open Source Developer</title>
		<link>http://blargh.tommymontgomery.com/2010/02/how-to-be-an-awesome-open-source-developer/</link>
		<comments>http://blargh.tommymontgomery.com/2010/02/how-to-be-an-awesome-open-source-developer/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 10:46:20 +0000</pubDate>
		<dc:creator>tmont</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://blargh.tommymontgomery.com/?p=411</guid>
		<description><![CDATA[I&#8217;m a big fan of open source. Capitalism is awesome, but it inspires and encourages greed, so it&#8217;s nice to see somebody defying that system by working hard at something, and then giving it away for free.
Of course, you&#8217;re at the mercy of whatever kind of limping scrod they shove out their codehole, but hey, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a big fan of open source. Capitalism is awesome, but it inspires and encourages greed, so it&#8217;s nice to see somebody defying that system by working hard at something, and then giving it away for free.</p>
<p>Of course, you&#8217;re at the mercy of whatever kind of limping scrod they shove out their codehole, but hey, it&#8217;s free! </p>
<p><a href="http://dilbert.com/fast/2006-08-02/"><img src="http://blargh.tommymontgomery.com/wp-content/uploads/2010/02/limpingscrod.gif" alt="limpingscrod" title="limpingscrod" width="560" height="174" class="aligncenter size-full wp-image-412" /></a></p>
<p>Quite often, their stuff sucks, or they don&#8217;t maintain it, or it doesn&#8217;t compile, or it doesn&#8217;t work, or it only works in certain environments, or whatever. But every so often, you find that one nugget of well-maintained and well-written rad that makes you love America! Or in this case, it makes you love the Netherlands.</p>
<p><img src="http://blargh.tommymontgomery.com/wp-content/uploads/2010/02/netherlands.png" alt="netherlands" title="netherlands" width="342" height="252" class="aligncenter size-full wp-image-413" /></p>
<p>I was following up on <a href="/2009/08/transliteration-in-php/">on this post</a> and trying to compile the <a href="http://pecl.php.net/package/translit">PECL translit</a> extension on 64-bit Windows. Obviously, I was destined to fail. And fail I did. So then I emailed the author of the extension with a cry for help:</p>
<blockquote style="font-family: Consolas, monospace"><p>I was curious if the translit extension is available for Windows. I noticed there was no configuration file for it, so I attempted to hack together a config.w32 and build it but didn&#8217;t have much luck. Is it conceivable that this extension is buildable on Windows?</p>
<p>I&#8217;m trying to build it for PHP 5.3 on x64, which probably isn&#8217;t helping my chances&#8230;</p>
<p>Anyway, the documentation I found didn&#8217;t mention if it was even viable on PHP 5.3, so I could be barking up a dead tree. For the record, the error was pretty immediate and looked like this:</p>
<p>C:\code\php64\php-5.3.1\ext\translit\data\compact_underscores.c : fatal error C1083: Cannot open compiler generated file: &#8216;x64\Release_TS\ext\translit\data/compact_underscores.obj&#8217;: No such file or directory</p>
<p>Thanks,<br />
Tommy
</p></blockquote>
<p>I didn&#8217;t really expect anything back for a while. I know he&#8217;s a busy guy, and there hadn&#8217;t really been any updates to this extension for a couple years, but I figured I&#8217;d give it a shot. In 3.5 hours, I had a reply that said, basically, &#8220;I&#8217;m not sure if it works on Windows, but you can pull the latest from SVN to make it build. I just built it on 64-bit Windows but I haven&#8217;t tested them.&#8221; And then he <strong>freaking attached the compiled DLLs</strong>. Both thread-safe and non-thread-safe versions. Seriously. Here&#8217;s proof:</p>
<p><img src="http://blargh.tommymontgomery.com/wp-content/uploads/2010/02/fromderick.png" alt="fromderick" title="fromderick" width="651" height="408" class="aligncenter size-full wp-image-421" /></p>
<p>That&#8217;s dedication to maintaining your project. Not only did he answer my question, but he went the extra mile of verifying that it was a solution himself. </p>
<p><a href="http://derickrethans.nl/">Derick Rethans</a>, you are rad. There needs to be more open source developers like you.</p>
<p><strong>PS:</strong> I checked out the latest version of translit from the SVN repository he specified and rebuilt, and it totally worked.</p>
<p><img src="http://blargh.tommymontgomery.com/wp-content/uploads/2010/02/translit.png" alt="translit" title="translit" width="599" height="171" class="aligncenter size-full wp-image-419" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blargh.tommymontgomery.com/2010/02/how-to-be-an-awesome-open-source-developer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting null values in anonymous object initializer in C#</title>
		<link>http://blargh.tommymontgomery.com/2010/02/setting-null-values-in-anonymous-object-initializer-in-c/</link>
		<comments>http://blargh.tommymontgomery.com/2010/02/setting-null-values-in-anonymous-object-initializer-in-c/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 09:12:20 +0000</pubDate>
		<dc:creator>tmont</dc:creator>
				<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://blargh.tommymontgomery.com/?p=404</guid>
		<description><![CDATA[The spec claims you can&#8217;t do this:
It is a compile-time error for an expression in an anonymous object initializer to be of the null type.

And you can&#8217;t. Directly.

var obj = new {
  Value = null //syntax error: &#34;cannot assign null to anonymous type property&#34;
};

var obj = new {
  Value = (object)null //full of [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://msdn.microsoft.com/en-us/library/ms364047%28VS.80%29.aspx#cs3spec_topic6">spec claims</a> you can&#8217;t do this:</p>
<blockquote><p>It is a compile-time error for an expression in an anonymous object initializer to be of the null type.</p>
</blockquote>
<p>And you can&#8217;t. Directly.</p>
<pre class="brush: csharp;">
var obj = new {
  Value = null //syntax error: &quot;cannot assign null to anonymous type property&quot;
};

var obj = new {
  Value = (object)null //full of win
};

//seriously, it works
Console.WriteLine(obj.Value == null); //True
</pre>
<p>Somebody please explain to me why this works.</p>
]]></content:encoded>
			<wfw:commentRss>http://blargh.tommymontgomery.com/2010/02/setting-null-values-in-anonymous-object-initializer-in-c/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
