<?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>spamguy &#187; programming</title>
	<atom:link href="http://blog.spamguy.org/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.spamguy.org</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Tue, 09 Feb 2010 16:42:27 +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>DropDownList Drops The GridView Ball</title>
		<link>http://blog.spamguy.org/2009/03/05/dropdownlist-drops-the-gridview-ball/</link>
		<comments>http://blog.spamguy.org/2009/03/05/dropdownlist-drops-the-gridview-ball/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 23:57:24 +0000</pubDate>
		<dc:creator>spamguy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.spamguy.org/?p=177</guid>
		<description><![CDATA[When .NET 2.0 makes things easy, it makes them brain-dead easy. But when it makes things hard, you wish you were working as a greeter at Wal-Mart. Take GridView editing. If you accept Microsoft&#8217;s TextBox method of editing GridView cells, you&#8217;re golden. Sometimes you need DropDownLists in place of TextBoxes, and that takes a teensy [...]]]></description>
			<content:encoded><![CDATA[<p>When .NET 2.0 makes things easy, it makes them brain-dead easy. But when it makes things hard, you wish you were working as a greeter at Wal-Mart. Take GridView editing. If you accept Microsoft&#8217;s TextBox method of editing GridView cells, you&#8217;re golden. Sometimes you need DropDownLists in place of TextBoxes, and that takes a teensy bit more work:</p>
<p>[code lang="csharp"]<asp:GridView ID="gvProgramRoles" runat="server" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="dsProgramRoles"></p>
<columns>
		<asp:TemplateField HeaderText="Program Role"><br />
			<itemTemplate><%# Eval("Role") %></itemTemplate><br />
			<editItemTemplate><br />
				<asp:DropDownList runat="server" ID="ddlEditRole" DataSourceID="dsProgramRoleList" DataTextField="Name" DataValueField="ID"></asp:DropDownList><br />
			</editItemTemplate><br />
		</asp:TemplateField><br />
		<asp:CommandField ShowEditButton="True" ShowDeleteButton="true" /><br />
	</columns>
</asp:GridView><br />
[/code]</p>
<p>There&#8217;s a microscopic UI flaw in this approach: when the user clicks &#8216;Edit,&#8217; the selected DropDownList item is the first (index 0), not the item that matches the cell&#8217;s text. Uniting the two is surprisingly harsh, since the text disappears before the DDL appears. After many unfruitful searches for an answer, one long blog post has a solution. <a href="http://johnpadillaweb.spaces.live.com/blog/cns!85080ACE7B1F5195!115.entry">A very dirty but awesomely easy solution.</a> Use the DDL&#8217;s ValidationGroup field as short-term memory!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.spamguy.org/2009/03/05/dropdownlist-drops-the-gridview-ball/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The CakePHP Is A Lie</title>
		<link>http://blog.spamguy.org/2008/07/01/the-cakephp-is-a-lie/</link>
		<comments>http://blog.spamguy.org/2008/07/01/the-cakephp-is-a-lie/#comments</comments>
		<pubDate>Tue, 01 Jul 2008 07:42:57 +0000</pubDate>
		<dc:creator>spamguy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.spamguy.org/?p=125</guid>
		<description><![CDATA[CakePHP is out of my life. For good.
After six weeks of microconfiguring .htaccess files and begging IRC&#8217;s #cakephp for help on inexplicably broken code, I had produced nothing of value. I am a patient man, but I expect some fruition from my studies. I am clearly not alone: my post about .htaccess files rocketed to [...]]]></description>
			<content:encoded><![CDATA[<p>CakePHP is out of my life. For good.</p>
<p>After six weeks of <a href="http://blog.spamguy.org/2008/06/07/cakephp-and-htaccess-enemies-forever/">microconfiguring .htaccess files</a> and begging IRC&#8217;s #cakephp for help on inexplicably broken code, I had produced nothing of value. I am a patient man, but I expect some fruition from my studies. I am clearly not alone: my post about .htaccess files rocketed to the #2 spot on Google&#8217;s search for &#8216;htaccess cakephp&#8217;.</p>
<p>On Saturday morning I burned it all down, cleaned up the ashes, and started fresh with CodeIgniter, which has many similar qualities to CakePHP. Good news: it has a tiny footprint (one app is &lt; 50kB) and no .htaccess files. Bad news: no AJAX helpers ((<a href="http://expressionengine.com/blog/entry/expressionengine_20_fully_codeignited/">They&#8217;re working on it.</a> In the meantime, do what I did and pick up <a href="http://www.jquery.com">jQuery</a>.)), no templates, and CodeIgniter&#8217;s name makes inventing blog title gags nigh impossible. I&#8217;ll live.</p>
<p>To compare timeframes: In six weeks of study, I produced 10 lines of unjustifiably non-functioning code. In an hour and a half, I had CodeIgnite working with Eclipse (the small footprint helps) and had produced the test app CakePHP couldn&#8217;t handle. That&#8217;s 0.15% of the time.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.spamguy.org/2008/07/01/the-cakephp-is-a-lie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OS X&#039;s Nervous Tics</title>
		<link>http://blog.spamguy.org/2008/06/20/os-xs-nervous-tics/</link>
		<comments>http://blog.spamguy.org/2008/06/20/os-xs-nervous-tics/#comments</comments>
		<pubDate>Sat, 21 Jun 2008 03:51:21 +0000</pubDate>
		<dc:creator>spamguy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Macs]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.spamguy.org/?p=122</guid>
		<description><![CDATA[There are no shortage of metronome apps available for the Mac. One app, Dr. Betotte, is so hardcore I wouldn&#8217;t know the difference between it and a dialysis machine.
Each and every single Mac metronome is missing an excellent opportunity through the Apple Remote. A musician&#8217;s instrument of choice and his Macintosh may be several metres [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.macupdate.com/search.php?starget=mu&amp;keywords=metronome&amp;arch=all&amp;os=macosx&amp;order=date">There are no shortage of metronome apps available for the Mac.</a> One app, <a href="http://homepage.mac.com/seishu/ssworks/drbetotte/drbetotte.html">Dr. Betotte</a>, is so hardcore I wouldn&#8217;t know the difference between it and a dialysis machine.</p>
<p>Each and every single Mac metronome is missing an excellent opportunity through the Apple Remote. A musician&#8217;s instrument of choice and his Macintosh may be several metres apart, so implementing Apple Remote functionality would avoid constant running back and forth to</p>
<ul>
<li>start/stop</li>
<li>change tempo</li>
<li>change volume</li>
</ul>
<p>I bring this up so any prospective developers looking to shove another clone into an oversaturated market (or, more likely, already-existing narcissistic clone developers googling their product) get the clue. Arguably I could write such a Cocoa app myself, but I never finished <em>Metal Gear Solid 2</em>, and I need to get on that first. Uh, yeah.</p>
<p>In fact, it&#8217;s not even as hard as Cocoa. <a href="http://gravityapps.com/sofacontrol/overview/">Sofa Control</a> is one of the few shareware apps I&#8217;ve ever registered, and it makes the process as easy as editing a flat file.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.spamguy.org/2008/06/20/os-xs-nervous-tics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CakePHP and .htaccess, Enemies Forever</title>
		<link>http://blog.spamguy.org/2008/06/07/cakephp-and-htaccess-enemies-forever/</link>
		<comments>http://blog.spamguy.org/2008/06/07/cakephp-and-htaccess-enemies-forever/#comments</comments>
		<pubDate>Sat, 07 Jun 2008 21:55:13 +0000</pubDate>
		<dc:creator>spamguy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.spamguy.org/?p=117</guid>
		<description><![CDATA[I reiterate last week&#8217;s post about CakePHP: the documentation sucks. They do not put nearly enough emphasis on troubleshooting, because for most adopters of the framework, setting up your first working app is rarely a straight shot.
Case in point. It took a week of research to pick up an important point: if any one of [...]]]></description>
			<content:encoded><![CDATA[<p>I reiterate last week&#8217;s post about CakePHP: the documentation sucks. They do not put nearly enough emphasis on troubleshooting, because for most adopters of the framework, setting up your first working app is rarely a straight shot.</p>
<p>Case in point. It took a week of research to pick up an important point: if any one of four .htaccess files are missing, bits of your CakePHP app <strong>will not work</strong>. Not might&#8230;<strong>will</strong>. For me, the symptom was broken CSS: the HREF in</p>
<p><code lang="html">
<link rel="stylesheet" type="text/css" href="/blogtest/css/cake.generic.css" /></code></p>
<p>pointed to nowhere, and nothing existed to forward it to a valid location.</p>
<p>Unfortunately .htaccess files tend to disappear easily, especially when manipulating directories. Filenames beginning with &#8216;.&#8217; do not show up, so simple drag-and-drop operations from an operating system&#8217;s GUI leaves out .htaccess because you can&#8217;t see it.</p>
<p>Good news is in store, though. <a href="http://www.ninjavspenguin.com/blog/2007/01/21/cakephp-install-multiple-subdirectories-500-error/">Working through this tutorial</a> set me straight, and I have a flawless application once again.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.spamguy.org/2008/06/07/cakephp-and-htaccess-enemies-forever/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eclipse and CakePHP, BFF</title>
		<link>http://blog.spamguy.org/2008/05/30/eclipse-and-cakephp-bff/</link>
		<comments>http://blog.spamguy.org/2008/05/30/eclipse-and-cakephp-bff/#comments</comments>
		<pubDate>Fri, 30 May 2008 14:00:13 +0000</pubDate>
		<dc:creator>spamguy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.spamguy.org/?p=114</guid>
		<description><![CDATA[As popular and awesome as CakePHP is, there just isn&#8217;t enough documentation on it. I guarantee many hours or days learning to wrangle with it.
Using Eclipse to maintain CakePHP projects is even worse. Precisely one tutorial exists, and it just doesn&#8217;t, um, cut the cake. It left me more confused than before I started.
After spending [...]]]></description>
			<content:encoded><![CDATA[<p>As popular and awesome as <a href="http://www.cakephp.org">CakePHP</a> is, there just isn&#8217;t enough documentation on it. I guarantee many hours or days learning to wrangle with it.</p>
<p>Using Eclipse to maintain CakePHP projects is even worse. <a href="http://bakery.cakephp.org/articles/view/setting-up-eclipse-to-work-with-cake">Precisely one tutorial exists</a>, and it just doesn&#8217;t, um, cut the cake. It left me more confused than before I started.</p>
<p>After spending an hour on IRC&#8217;s #cakephp, one very patient user guided me through the process. By the end of the session, all I really needed was a visualisation of the setup. He took a desktop snap and sent it to me. Bam! Eclipse and CakePHP were together in five minutes.</p>
<p>In the interest of aiding visual learners out there and filling in the gaps left by the CakePHP/Eclipse tutorial, I pass this image on to you.</p>
<p style="text-align: center;"><a href="http://blog.spamguy.org/wp-content/uploads/2008/05/picture1.png"><img class="alignnone size-thumbnail wp-image-115 aligncenter" title="cakephp_eclipse" src="http://blog.spamguy.org/wp-content/uploads/2008/05/picture1-150x150.png" alt="Eclipse setup for CakePHP work" width="150" height="150" /></a></p>
<p style="text-align: left;">As the tutorial mentions, you will be creating two separate Eclipse projects: one for Cake core, and another for your project. Select everything inside /cake/cake and copy it into the core project; using /cake/cake as an include path works too. ((<span style="text-decoration: line-through;">My biggest criticism yet of CakePHP: the developers didn&#8217;t spend any time thinking of the repercussions from naming a directory and its child the same thing.</span>))</p>
<p style="text-align: left;">In your other project, use the core as an included project (right-click or whatever on <em>Include Paths &gt; Configure Include Path</em>). Finally, select everything inside /cake/app and copy it into your project (again, including /cake/app is also valid).</p>
<p style="text-align: left;">That should work. If it doesn&#8217;t, feel free to comment below, though I&#8217;m likely to be of insufficient help. Otherwise, <a href="http://www.youtube.com/watch?v=RthZgszykLs">hum to yourself</a> as you happily code away:</p>
<blockquote><p>
This was a triumph<br/><br />
I&#8217;m making a note here: &#8216;HUGE SUCCESS&#8217;&#8230;
</p></blockquote>
<p>Responses to comments after the jump&#8230;<br />
<span id="more-114"></span></p>
<p style="text-align: left;"><strong>Update</strong>: ryanb correctly notes that my criticism of poor directory naming choices was incorrect. I had unwisely named the directory containing the cake core the same thing, <em>cake</em>, creating the mind-numbing <em>cake/cake</em>. I managed to correct this a few weeks ago, but regretfully never edited out the misstatement from the blog. I sincerely apologise.</p>
<p style="text-align: left;">On the reverse side, ryanb does me injustice for blaming the developers for making a lousy tutorial. Never, in any step in the blogging process, did I link official CakePHP development with the tutorial. I did say the documentation is weak, and I did cite the tutorial, but I didn&#8217;t say the tutorial and the documentation were the same thing. The aesthetics of the official documentation and the roughness of the tutorial should be enough to differentiate the two. Admittedly a clarifying statement would have helped, but it never occured to me.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.spamguy.org/2008/05/30/eclipse-and-cakephp-bff/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Butt Loop</title>
		<link>http://blog.spamguy.org/2008/05/13/butt-loop/</link>
		<comments>http://blog.spamguy.org/2008/05/13/butt-loop/#comments</comments>
		<pubDate>Wed, 14 May 2008 05:27:18 +0000</pubDate>
		<dc:creator>spamguy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.spamguy.org/2008/05/13/butt-loop/</guid>
		<description><![CDATA[Artist unknown. I&#8217;ve always questioned the wisdom of certain programming keywords (for? try? catch? bunt?), so a puerile programming language makes just as much sense&#8230;maybe more.



UPDATE: Much changes in a year. About February 2009 I added the webcomic Saturday Morning Breakfast Cereal to my daily RSS rounds. Revisiting this post today (almost May 2009), I [...]]]></description>
			<content:encoded><![CDATA[<p><del datetime="2009-04-30T15:27:55+00:00">Artist unknown.</del> I&#8217;ve always questioned the wisdom of certain programming keywords (for? try? catch? bunt?), so a puerile programming language makes just as much sense&#8230;maybe more.</p>
<p><a title="Butt Loop" href="http://blog.spamguy.org/wp-content/uploads/2008/05/1210741932909.gif"><img src="http://blog.spamguy.org/wp-content/uploads/2008/05/1210741932909.gif" alt="Butt Loop" /></a></p>
<p><strong><br />
</strong></p>
<p><strong>UPDATE:</strong> Much changes in a year. About February 2009 I added the webcomic <a href="http://www.smbc-comics.com/">Saturday Morning Breakfast Cereal</a> to my daily RSS rounds. Revisiting this post today (almost May 2009), I immediately recognise the art as being from said comic. Another loose end tied up.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.spamguy.org/2008/05/13/butt-loop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Will Code For Bacon</title>
		<link>http://blog.spamguy.org/2008/04/26/will-write-code-for-bacon/</link>
		<comments>http://blog.spamguy.org/2008/04/26/will-write-code-for-bacon/#comments</comments>
		<pubDate>Sat, 26 Apr 2008 23:52:02 +0000</pubDate>
		<dc:creator>spamguy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Austin]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.spamguy.org/2008/04/26/will-write-code-for-bacon/</guid>
		<description><![CDATA[I encountered a man wearing this T-shirt at Eeyore&#8217;s Birthday Party today, of all places. It explains my position in life so well. I want one.


]]></description>
			<content:encoded><![CDATA[<p>I encountered a man wearing this T-shirt at <a href="http://eeyores.sexton.com/">Eeyore&#8217;s Birthday Party</a> today, of all places. It explains my position in life so well. I want one.</p>
<p><a href="http://blog.spamguy.org/wp-content/uploads/2008/04/25183504v1_240x240_front.jpg" title="Will Code For Bacon"></a></p>
<p style="text-align: center"><a href="http://blog.spamguy.org/wp-content/uploads/2008/04/25183504v1_240x240_front.jpg" title="Will Code For Bacon"><img src="http://blog.spamguy.org/wp-content/uploads/2008/04/25183504v1_240x240_front.jpg" alt="Will Code For Bacon" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.spamguy.org/2008/04/26/will-write-code-for-bacon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>END;</title>
		<link>http://blog.spamguy.org/2007/10/11/end/</link>
		<comments>http://blog.spamguy.org/2007/10/11/end/#comments</comments>
		<pubDate>Thu, 11 Oct 2007 06:08:26 +0000</pubDate>
		<dc:creator>spamguy</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://spamguy.org/blog/?p=12</guid>
		<description><![CDATA[I have particular trouble getting SQL triggers and procedures to work. They&#8217;re just syntactically grumpy. Tonight, for example, I spent an hour, perhaps two, debugging a syntax error in a four-line trigger. Given the examples supplied in the above links, how can I go wrong?
[code lang="SQL"]CREATE TRIGGER myTrigger AFTER INSERT ON table1
	FOR EACH ROW BEGIN
		INSERT [...]]]></description>
			<content:encoded><![CDATA[<p>I have particular trouble getting SQL <a href="http://dev.mysql.com/doc/refman/5.0/en/triggers.html">triggers</a> and <a href="http://dev.mysql.com/doc/refman/5.0/en/stored-procedures.html">procedures</a> to work. They&#8217;re just syntactically grumpy. Tonight, for example, I spent an hour, perhaps two, debugging a syntax error in a four-line trigger. Given the examples supplied in the above links, how can I go wrong?</p>
<pre>[code lang="SQL"]CREATE TRIGGER myTrigger AFTER INSERT ON table1
	FOR EACH ROW BEGIN
		INSERT INTO table2
		(
			foreignid,
			timestamp,
			zerogoeshere
		)
		VALUES
		(
			NEW.id,
			NOW(),
			0
                );
	END;[/code]</pre>
<p>Only after brute experimentation did I discover the problem. If your trigger has only one statement (<em>e.g.</em>,  INCLUDE), not only are BEGIN-END; superfluous, <strong>they won&#8217;t work</strong>. Keep the statement by itself:</p>
<pre>[code lang="sql"]CREATE TRIGGER myTrigger AFTER INSERT ON table1
	FOR EACH ROW
		INSERT INTO table2
		(
			foreignid,
			timestamp,
			zerogoeshere
		)
		VALUES
		(
			NEW.id,
			NOW(),
			0
                );[/code]</pre>
<p>That&#8217;s utterly ridiculous. What if C++ returned a syntax error for typing</p>
<pre>[code lang="cpp"]if (lameBoolFlag)
{
     cout >> "Your flag is true, shit-for-brains!" >> endl;
}[/code]</pre>
<p>I hope this will help someone, somewhere. Lord knows Google searches save my ass every day whilst coding.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.spamguy.org/2007/10/11/end/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
