<?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>nathandemick.com &#187; web development</title>
	<atom:link href="http://nathandemick.com/archive/web-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://nathandemick.com</link>
	<description></description>
	<lastBuildDate>Sat, 28 Aug 2010 00:13:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Salty!</title>
		<link>http://nathandemick.com/2007/09/salty/</link>
		<comments>http://nathandemick.com/2007/09/salty/#comments</comments>
		<pubDate>Thu, 27 Sep 2007 14:09:53 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.bitter-gamer.com/?p=75</guid>
		<description><![CDATA[So, I am in no way a cryptographer&#8230; I read Neal Stephenson&#8217;s The Cryptonomicon, but that&#8217;s about it. Plus, I don&#8217;t really have to do much with password security in web apps&#8230; usually  securing a directory with .htaccess is as much as I have to do. Sometimes I need to write my own session-based [...]]]></description>
			<content:encoded><![CDATA[<p>So, I am in no way a cryptographer&#8230; I read Neal Stephenson&#8217;s <em>The Cryptonomicon</em>, but that&#8217;s about it. Plus, I don&#8217;t really have to do much with password security in web apps&#8230; usually  securing a directory with .htaccess is as much as I have to do. Sometimes I need to write my own session-based password system, due to some hosts not running Apache. Anyway, for these simple systems, the password is usually stored in plaintext&#8230; the system is in place really only to deter, not to prevent attacks. I may change my mind on this if I get screwed by it in the future, but for the present, it&#8217;s good enough. However, when creating a system that allows users to make their own accounts, more care needs to be taken. Since people often use the same password in many different areas, obtaining a password in one place can lead to identity theft. So I whipped up this cute little salt generator. Remember, if you are using a salt, you should probably store it so you can validate passwords later. There may be better encryption methods in PHP, but I&#8217;m really just scratching the surface right now.</p>
<pre>
// Encrypt the password with Blowfish and a salt - 16 chars starting with $2$
$salt='$2$';
$salt_length=16;

// Chars to choose from to generate the salt
$chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!@#$%^&#038;*";

//Generate the salt string
while(strlen($salt)< $salt_length)
	$salt.=$chars{mt_rand(0,strlen($chars)-1)};

$hashed_password=crypt($password, $salt);
</pre>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://nathandemick.com/2007/09/salty/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Safari 2 = no input tag styles</title>
		<link>http://nathandemick.com/2007/09/safari-2-no-input-tag-styles/</link>
		<comments>http://nathandemick.com/2007/09/safari-2-no-input-tag-styles/#comments</comments>
		<pubDate>Wed, 26 Sep 2007 13:00:54 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.bitter-gamer.com/?p=74</guid>
		<description><![CDATA[So I just realized that Safari 2 doesn&#8217;t allow text input tags to be styled. What the heck, eh? I was confused for a while, since I had been using the Safari 3 beta on Windows, and it worked there. Then I get the Mac and nothing works to style those stupid tags. With Apple&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>So I just realized that Safari 2 doesn&#8217;t allow text input tags to be styled. What the heck, eh? I was confused for a while, since I had been using the Safari 3 beta on Windows, and it worked there. Then I get the Mac and <em>nothing works</em> to style those stupid tags. With Apple&#8217;s &#8220;oh yeah, standards, we got &#8216;em haha suck it IE&#8221; attitude, I can&#8217;t believe they would leave this in. Standardization of user interface elements aside, all the other browsers do this, so it&#8217;s about darn time. My recourse is to say &#8220;Sorry!&#8221; to the Safari 2 folks. I simply can&#8217;t do anything about how crappy forms will look to you.</p>
]]></content:encoded>
			<wfw:commentRss>http://nathandemick.com/2007/09/safari-2-no-input-tag-styles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Switchin&#8217; ain&#8217;t easy</title>
		<link>http://nathandemick.com/2007/09/switchin-aint-easy/</link>
		<comments>http://nathandemick.com/2007/09/switchin-aint-easy/#comments</comments>
		<pubDate>Wed, 19 Sep 2007 17:39:46 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.bitter-gamer.com/?p=71</guid>
		<description><![CDATA[So, I&#8217;ve had my Mac Pro for a while, and am finally starting to get used to it. For a while, though, it was super frustrating   to work on; one of the hardest things about switching computing platforms is the minor inconsistencies. For example, in Windows Explorer, hitting &#8216;return&#8217; will open a selected [...]]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;ve had my Mac Pro for a while, and am finally starting to get used to it. For a while, though, it was super frustrating   to work on; one of the hardest things about switching computing platforms is the minor inconsistencies. For example, in Windows Explorer, hitting &#8216;return&#8217; will open a selected folder, and &#8216;F2&#8242; will rename it. In the OS X Finder, &#8216;Command-O&#8217; opens a folder, and &#8216;return&#8217; will rename it. Mouse behavior is quite different as well, with OS X using a very non-intuitive mouse acceleration algorithm. I had just gotten used to &#8216;Home&#8217; and &#8216;End&#8217; moving my text-editor&#8217;s cursor to the beginning and end of a line, but OS X&#8217;s default behavior moves the cursor to the beginning/end of the document. </p>
<p>Fortunately for me, it&#8217;s relatively easy to edit key mappings in OS X, which means that the functionality I&#8217;m used to has mostly returned. For the mouse issue, I had to install a Microsoft mouse driver, which conflicted with the mouse control panel option for a while. </p>
<p>On a somewhat related note, have I mentioned that the Mighty Mouse is horrible? It doesn&#8217;t fit my hand at all, has a worthless &#8220;scroll wheel&#8221; nubbin, and flaky left/right-click support. Sadly, back when I was working at my old job, I had thought about buying one, even going so far as to make some low bids on eBay. I think this piece o&#8217; junk is going up there for some other sod. I do like the Mac keyboard, though (not the new, shallow version). The keys, while not clicky, have an appropriate amount of tactile feedback. The keyboard itself is much narrower than my Model M IBM keyboard, though, which took a bit of time to get used to as well. </p>
<p>All in all, I&#8217;m pretty happy about my purchase&#8230; a little bit bitter about getting the shaft in terms of RAM and HD space (1 GB/250 GB in a machine of this class? Ridiculous! Plus no Bluetooth or WiFi=superlame), but prices for that stuff will keep going down. I&#8217;m glad to be using a more versatile machine, albeit one that&#8217;s a massive investment.</p>
]]></content:encoded>
			<wfw:commentRss>http://nathandemick.com/2007/09/switchin-aint-easy/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Web dev tips #2</title>
		<link>http://nathandemick.com/2007/08/web-dev-tips-2/</link>
		<comments>http://nathandemick.com/2007/08/web-dev-tips-2/#comments</comments>
		<pubDate>Fri, 31 Aug 2007 16:01:10 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.bitter-gamer.com/?p=68</guid>
		<description><![CDATA[So, this probably doesn&#8217;t apply to a lot of folks, but if you&#8217;re trying to use tables for page layout (i.e. for HTML emails), you may notice that Firefox inserts blank space at the bottom of each image that you just can&#8217;t get rid of. The cause is that the &#60;img&#62; tag has the &#8220;display: [...]]]></description>
			<content:encoded><![CDATA[<p>So, this probably doesn&#8217;t apply to a lot of folks, but if you&#8217;re trying to use tables for page layout (i.e. for HTML emails), you may notice that Firefox inserts blank space at the bottom of each image that you just can&#8217;t get rid of. The cause is that the &lt;img&gt; tag has the &#8220;display: inline&#8221; property, which means that Firefox allows space for &#8220;descenders&#8221; (i.e. the parts of letters that go below the baseline; examples: jgpq). The solution in table layouts is to assign each image the &#8220;display: block&#8221; property. Alternately, you can use adjust the &#8220;vertical-align&#8221; property on the image. <a href="http://www.askthecssguy.com/2006/11/inline_images_showing_a_gap_of_1.html">Here&#8217;s a page</a> with a more detailed look at the problem/solution.</p>
<p>Another thing I just wanted to mention for my own reference was short conditionals in PHP. Example:</p>
<pre>
&lt;?
	if(empty($_GET['id']))
		echo 'No ID';
	else
		echo 'ID: '.$_GET['id'];
?&gt;
</pre>
<p>Can be replaced with:</p>
<pre>
&lt;?=empty($_GET['id'])?'No ID':'ID: '.$_GET['id']?&gt;
</pre>
<p>The syntax can be broken down into CONDITIONAL ? IF TRUE : IF FALSE</p>
<p>It&#8217;s basically just a way to make your code concise and look esoteric while doing so.</p>
]]></content:encoded>
			<wfw:commentRss>http://nathandemick.com/2007/08/web-dev-tips-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add me to the &#8220;tool&#8221; list</title>
		<link>http://nathandemick.com/2007/08/add-me-to-the-tool-list/</link>
		<comments>http://nathandemick.com/2007/08/add-me-to-the-tool-list/#comments</comments>
		<pubDate>Wed, 29 Aug 2007 03:45:17 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.bitter-gamer.com/?p=66</guid>
		<description><![CDATA[
So, uh, yeah&#8230; after that long-winded diatribe the other week denouncing Apple&#8217;s product lineup, I, for some reason, got it into my head that I would buy a Mac Pro. To be honest, I can&#8217;t really think of the reasons why&#8230; they were basically a lot of small things that added up (i.e. just got [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.bitter-gamer.com/wp-content/uploads/2007/08/macpro_outlet_icon.thumbnail.jpg' alt='Mac Pro case' style="border: 3px solid #ccc; float: right; margin: 0px 0px 0px 15px" /><br />
So, uh, yeah&#8230; after that long-winded diatribe the other week denouncing Apple&#8217;s product lineup, I, for some reason, got it into my head that I would buy a Mac Pro. To be honest, I can&#8217;t really think of the reasons why&#8230; they were basically a lot of small things that added up (i.e. just got on salary, work in a Mac shop, nice virtualization software). I figured I&#8217;d sell the PC and use the laptop until I had some cash squirreled away to devote to a $2.5k machine. Well, I told my employer that I was seriously considering getting the Mac Pro, and he went ahead and bought me Photoshop CS3 and VMWare Fusion today. Plus I&#8217;m going to get his 20-inch Cinema display as a hand-me-down. Well, that was enough for me to take the plunge and buy this stupidly freaking expensive computer. I did get a refurb, which netted me about 15% off the list price for the Quad 2.66 GHz system. A pretty big justification was the fact that I can probably use this machine reliably for at least 3 years (barring component failure); it&#8217;s just that overpowered. So anyway. You guys (read: Andy) can make fun of me now.</p>
]]></content:encoded>
			<wfw:commentRss>http://nathandemick.com/2007/08/add-me-to-the-tool-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XHTML?</title>
		<link>http://nathandemick.com/2007/08/xhtml/</link>
		<comments>http://nathandemick.com/2007/08/xhtml/#comments</comments>
		<pubDate>Wed, 29 Aug 2007 02:53:41 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.bitter-gamer.com/?p=64</guid>
		<description><![CDATA[Recently I built some pages for a client, and one of the client contacts came back wanting to use validated XHTML. The guy in question was all, &#8220;It looks weird in IE!&#8221;
I cursed under my breath, and then looked at the pages he sent back to me. All he had done was add an XHTML [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I built some pages for a client, and one of the client contacts came back wanting to use validated XHTML. The guy in question was all, &#8220;It looks weird in IE!&#8221;</p>
<p>I cursed under my breath, and then looked at the pages he sent back to me. All he had done was add an XHTML doctype to each page. Running them through a validator produced millions of errors. That&#8217;s when I decided to read a bit on what XHTML actually does.</p>
<p><b>Benefits of XHTML</b></p>
<ol>
<li>Stricter syntax rules &#8211; always have well-formed documents</li>
</ol>
<p></p>
<p><b>Detriments of XHTML</b></p>
<ol>
<li>Stricter syntax rules &#8211; more difficult to update</li>
<li>Needs to be served with proper MIME type; not &#8220;text/html&#8221;
<ol>
<li>View <a href="http://www.hixie.ch/advocacy/xhtml" title="http://www.hixie.ch/advocacy/xhtml">http://www.hixie.ch/advocacy/xhtml</a> regarding serving XHTML as &#8220;text/html&#8221;</li>
</ol>
</li>
<li>Not supported by IE
<ol>
<li>XML declaration causes &#8220;quirks&#8221; mode when document is served as &#8220;text/html&#8221;</li>
<li>IE doesn&#8217;t handle MIME type &#8220;application/xhtml+xml&#8221;</li>
<li>&#8220;Unless the document is recognised as XHTML, you cannot use any of the features XHTML offers over HTML.&#8221;</li>
</ol>
</li>
</ol>
<p></p>
<p>Sadly, after reading about all this stuff, I realized that I had been making some unwitting mistakes in my HTML for quite a while now, such as inserting a space and slash at the end of single tags (i.e. &lt;br /&gt; instead of &lt;br&gt;). Plus, I haven&#8217;t been validating my code&#8230; mostly just due to laziness on my part. </p>
<p>Anyway, the long and short of the story is that I learned a lot about doctype declarations, and that XHTML is mostly hype, in terms of accessibility and features. Using the HTML 4.01 Strict doctype will probably ensure that your document will be accessible in its&#8217; original presentation for years to come (if you even care that long).</p>
]]></content:encoded>
			<wfw:commentRss>http://nathandemick.com/2007/08/xhtml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Where&#8217;s the freakin&#8217; Mac?</title>
		<link>http://nathandemick.com/2007/08/wheres-the-freakin-mac/</link>
		<comments>http://nathandemick.com/2007/08/wheres-the-freakin-mac/#comments</comments>
		<pubDate>Thu, 09 Aug 2007 14:41:41 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.bitter-gamer.com/?p=63</guid>
		<description><![CDATA[Sometimes I disgust myself. I have (personally) owned one Apple computer (G3 iBook) in my life, yet still follow Apple product announcements like a blind, gibbering sheep. This is in spite of some pretty decent reasons not to like the platform. For one, Macs&#8217;re expensive &#8212; and the &#8220;added benefits&#8221; of included software like iLife [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes I disgust myself. I have (personally) owned one Apple computer (G3 iBook) in my life, yet still follow Apple product announcements like a blind, gibbering sheep. This is in spite of some pretty decent reasons not to like the platform. For one, Macs&#8217;re expensive &mdash; and the &#8220;added benefits&#8221; of included software like iLife don&#8217;t really apply to me, since I don&#8217;t use &#8216;em. For another, when I tried to buy a &#8220;refurbished&#8221; MacBook Pro last year, both units Apple sent me were physically defective&#8230; I was on the receiving end of some crap customer service there. Plus, <a href="http://www.wired.com/gadgets/mac/commentary/cultofmac/2006/01/70072" title="Jobs vs. Gates">Steve Jobs is kind of a douche</a>. Still, though, in spite of everything, I do like MacOS X. It&#8217;s got a familiar Unix shell under all the eye candy nonsense, and there are a lot of great programs for it&#8230; I would love to use <a href="http://macromates.com/" title="TextMate">TextMate</a> and <a href="http://www.panic.com/transmit/" title="Transmit">Transmit</a> or <a href="http://www.panic.com/coda/" title="Coda">Coda</a>. And to be fair, for the extra money you pay, you do get the benefits of a closed hardware/software platform&#8230; everything usually just works, which is what I&#8217;m desiring now-a-days. </p>
<p>The big thing, though, is that there&#8217;s a gap in Apple&#8217;s product lineup: a huge gap between the Mac Mini and Mac Pro. I need two monitors for development work (which nixes the Mini), but don&#8217;t need the two dual-core CPUs that drive the price up on the Mac Pro. Some dude <a href="http://blogs.smugmug.com/don/2007/08/08/wheres-the-mac/" title="Where's the Mac?">wrote an article</a> about the issue, which I endorse wholeheartedly. When I went into the local Apple store for a &#8220;hiring event,&#8221; I was the only person who didn&#8217;t own a Mac &mdash; I cited the fact that Apple didn&#8217;t offer what I needed from a professional standpoint, but it didn&#8217;t go over well with the zealots at the store.</p>
<p>Until something changes at Apple, I&#8217;m sticking to the tried and true platform of Wintel.</p>
]]></content:encoded>
			<wfw:commentRss>http://nathandemick.com/2007/08/wheres-the-freakin-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web dev tips #1</title>
		<link>http://nathandemick.com/2007/08/web-dev-tips-1/</link>
		<comments>http://nathandemick.com/2007/08/web-dev-tips-1/#comments</comments>
		<pubDate>Wed, 08 Aug 2007 14:09:56 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.bitter-gamer.com/?p=62</guid>
		<description><![CDATA[If you&#8217;ve ever had to do &#8220;print&#8221; stylesheets, I&#8217;m sure it&#8217;s been exasperating. I mean, seriously&#8230; who prints web pages (Aside from people in my office, who print everything)? I saw a post on 37signals&#8217; blog regarding print stylesheets that inspired me. That link isn&#8217;t actually the original article, but the gist is similar: set [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve ever had to do &#8220;print&#8221; stylesheets, I&#8217;m sure it&#8217;s been exasperating. I mean, seriously&#8230; who prints web pages (Aside from people in my office, who print <em>everything</em>)? I saw a <a href="http://www.37signals.com/svn/posts/554-little-css-print-stylesheet-tip" title="post on 37signals' blog">post on 37signals&#8217; blog</a> regarding print stylesheets that inspired me. That link isn&#8217;t actually the original article, but the gist is similar: set <code>display: none</code> for each extraneous element. Easy!</p>
<p>These guys also inspired me with <a href="http://www.37signals.com/svn/posts/414-home-and-end-two-of-the-most-useful-yet-underrated-keys-on-the-keyboard" title="Home and End keys">another little bit of labor-saving information</a>: the &#8216;Home&#8217; and &#8216;End&#8217; keys. In your browser, Home takes you to the top of a page, while End goes all the way to the bottom. Amazing how often I use these keys now, in addition to the &#8216;Page Up&#8217; and &#8216;Page Down&#8217; for scrolling through pages. Plus, in your (non-Emacs) text editor, Home moves the cursor to the start of a line, while End goes to&#8230; you guessed it&#8230; the end of a line.</p>
]]></content:encoded>
			<wfw:commentRss>http://nathandemick.com/2007/08/web-dev-tips-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Modifying dateTimeOptionTag() in CakePHP</title>
		<link>http://nathandemick.com/2007/07/modifying-datetimeoptiontag-in-cakephp/</link>
		<comments>http://nathandemick.com/2007/07/modifying-datetimeoptiontag-in-cakephp/#comments</comments>
		<pubDate>Thu, 26 Jul 2007 14:03:55 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://www.bitter-gamer.com/?p=50</guid>
		<description><![CDATA[CakePHP has all sorts of nifty form helpers that I would ordinarily never use, except for the fact that they get put in the auto-generated views. The helper that creates a day/month/year select tag automatically lists years from like 1947-2017&#8230; way too many. I normally don&#8217;t care, but a client complained about it this morning, [...]]]></description>
			<content:encoded><![CDATA[<p>CakePHP has all sorts of nifty form helpers that I would ordinarily never use, except for the fact that they get put in the auto-generated views. The helper that creates a day/month/year select tag automatically lists years from like 1947-2017&#8230; way too many. I normally don&#8217;t care, but a client complained about it this morning, so I had to go searching around for a way to fix it. Rather than go into the code itself, I prefer to be lazy and just search the net to see if anyone else has written something about it. Jackpot! Some dude has written how to <a href="http://szellemszar.blog.hu/2007/02/01/custom_starting_year_for_date_time_selec" title="Modifying dateTimeOptionTag() in CakePHP">modify the dateTimeOptionTag()</a>. </p>
<p>In case that page goes blank, the gist is editing<br />
<code>/cake/libs/view/helpers/html.php</code>, which is the HTML Helper. Find the calls to yearOptionTag(), and change the third and fourth parameters to your start and end year, respectively. I used <code>date("Y")</code> and <code>date("Y", strtotime("+4 years"))</code>.</p>
<p><strong>[Edit]</strong> Alternately, just modify yearOptionTag() itself&#8230; the place to change the code is pretty obvious.</p>
]]></content:encoded>
			<wfw:commentRss>http://nathandemick.com/2007/07/modifying-datetimeoptiontag-in-cakephp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
