<?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>evardsson.com: stuff that w0rks &#187; Best Practices</title>
	<atom:link href="http://www.evardsson.com/blog/category/best-practices/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.evardsson.com/blog</link>
	<description>tweaks and hacks, php, python, music, home and ???</description>
	<lastBuildDate>Thu, 29 Jul 2010 19:25:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Daylight Saving Time Headaches</title>
		<link>http://www.evardsson.com/blog/2009/11/03/daylight-saving-time-headaches/</link>
		<comments>http://www.evardsson.com/blog/2009/11/03/daylight-saving-time-headaches/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 04:26:29 +0000</pubDate>
		<dc:creator>Sjan Evardsson</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[SysAdmin]]></category>

		<guid isPermaLink="false">http://www.evardsson.com/blog/?p=382</guid>
		<description><![CDATA[I have never been particularly fond of the concept of Daylight Saving Time (cutting one off of a blanket and sewing to the other end does not make a longer blanket.) This time around, though, I ran into an issue involving the perfect combination of a monthly cron job, a server set to local time [...]]]></description>
			<content:encoded><![CDATA[<p>I have never been particularly fond of the concept of Daylight Saving Time (cutting one off of a blanket and sewing to the other end does not make a longer blanket.) This time around, though, I ran into an issue involving the perfect combination of a monthly cron job, a server set to local time and the switch from Daylight Saving to Standard Time on the first of the month.</p>
<p>At precisely 1:14 am on the first day of the month the cron job ran, as it does the first day of every month, and picked a raffle winner for one of our client&#8217;s monthly contests. At 2:00 am the time on the server rolled back to 1:00 am in accordance with the switch to Standard Time for the US. Fourteen minutes later the job ran again, and picked another winner.</p>
<p>Whoops. Now our system has awarded two people a single prize. Telling the second one to get the prize that they didn&#8217;t really win would not get us any points with the client, as their customer would be upset. Likewise, charging the client for the second prize is a non-starter, as it is, in fact, our fault. When I inherited these systems I looked through all the cron jobs to get a feel for what the system is doing and when. What didn&#8217;t occur to me, however, was that jobs scheduled at the wrong time of day could fall victim to Daylight Saving/Standard Time change-overs.</p>
<p>Any daily job that runs between 1:00 am and 2:00 am will fail to run once a year (Standard -&gt; Daylight Saving when clocks jump ahead an hour) and will run twice once a year (Daylight Saving -&gt; Standard Time when clocks fall back from 2:00 am to 1:00 am).  Weekly jobs that run between 1:00 am and 2:00 am on Sundays will likewise misbehave, while monthly jobs, regardless of day of the month, have a small chance of experiencing one of these issues. In this case, the job runs on the 1st, which happened to be the first Sunday in November, and bang: error.</p>
<p>Needless to say, we modified all the cron jobs to ensure than none of them start between 1:00 am and 2:00 am.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Daylight+Saving+Time+Headaches+http://9zebb.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.evardsson.com/blog/2009/11/03/daylight-saving-time-headaches/&amp;submitHeadline=Daylight+Saving+Time+Headaches" title="Post to Yahoo Buzz"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-buzz.png" alt="Post to Yahoo Buzz" /></a> <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.evardsson.com/blog/2009/11/03/daylight-saving-time-headaches/&amp;submitHeadline=Daylight+Saving+Time+Headaches" title="Post to Yahoo Buzz">Buzz This Post</a> <a class="tt" href="http://delicious.com/post?url=http://www.evardsson.com/blog/2009/11/03/daylight-saving-time-headaches/&amp;title=Daylight+Saving+Time+Headaches" title="Post to Delicious"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-delicious.png" alt="Post to Delicious" /></a> <a class="tt" href="http://delicious.com/post?url=http://www.evardsson.com/blog/2009/11/03/daylight-saving-time-headaches/&amp;title=Daylight+Saving+Time+Headaches" title="Post to Delicious">Delicious</a> <a class="tt" href="http://digg.com/submit?url=http://www.evardsson.com/blog/2009/11/03/daylight-saving-time-headaches/&amp;title=Daylight+Saving+Time+Headaches" title="Post to Digg"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-digg.png" alt="Post to Digg" /></a> <a class="tt" href="http://digg.com/submit?url=http://www.evardsson.com/blog/2009/11/03/daylight-saving-time-headaches/&amp;title=Daylight+Saving+Time+Headaches" title="Post to Digg">Digg This Post</a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=Daylight+Saving+Time+Headaches&amp;link=http://www.evardsson.com/blog/2009/11/03/daylight-saving-time-headaches/" title="Post to Ping.fm"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-ping.png" alt="Post to Ping.fm" /></a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=Daylight+Saving+Time+Headaches&amp;link=http://www.evardsson.com/blog/2009/11/03/daylight-saving-time-headaches/" title="Post to Ping.fm">Ping This Post</a> <a class="tt" href="http://reddit.com/submit?url=http://www.evardsson.com/blog/2009/11/03/daylight-saving-time-headaches/&amp;title=Daylight+Saving+Time+Headaches" title="Post to Reddit"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-reddit.png" alt="Post to Reddit" /></a> <a class="tt" href="http://reddit.com/submit?url=http://www.evardsson.com/blog/2009/11/03/daylight-saving-time-headaches/&amp;title=Daylight+Saving+Time+Headaches" title="Post to Reddit">Reddit</a> <a class="tt" href="http://stumbleupon.com/submit?url=http://www.evardsson.com/blog/2009/11/03/daylight-saving-time-headaches/&amp;title=Daylight+Saving+Time+Headaches" title="Post to StumbleUpon"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-su.png" alt="Post to StumbleUpon" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://www.evardsson.com/blog/2009/11/03/daylight-saving-time-headaches/&amp;title=Daylight+Saving+Time+Headaches" title="Post to StumbleUpon">Stumble This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.evardsson.com/blog/2009/11/03/daylight-saving-time-headaches/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Data Scrubbing: Is there a right way?</title>
		<link>http://www.evardsson.com/blog/2009/09/09/data-scrubbing-is-there-a-right-way/</link>
		<comments>http://www.evardsson.com/blog/2009/09/09/data-scrubbing-is-there-a-right-way/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 01:01:51 +0000</pubDate>
		<dc:creator>Sjan Evardsson</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.evardsson.com/blog/?p=376</guid>
		<description><![CDATA[An article yesterday from ars technica got me wondering. In my former position we often &#8220;scrubbed&#8221; databases for sample data from which to work. And certainly one can see the value in working with data with personally identifiable information removed for the purposes of business or health-care informatics, service level determinations, quality of service surveys, [...]]]></description>
			<content:encoded><![CDATA[<p>An <a href="http://arstechnica.com/tech-policy/news/2009/09/your-secrets-live-online-in-databases-of-ruin.ars">article yesterday from ars technica</a> got me wondering. In my former position we often &#8220;scrubbed&#8221; databases for sample data from which to work. And certainly one can see the value in working with data with personally identifiable information removed for the purposes of business or health-care informatics, service level determinations, quality of service surveys, and so on. Yet, according to <a href="http://privacy.cs.cmu.edu/dataprivacy/papers/LIDAP-WP4abstract.html">a study at Carnegie Mellon University</a>:</p>
<blockquote><p>87% (216 million of 248 million) of the population in the United States had reported characteristics that likely made them unique based only on {<em>5-digit ZIP</em>, <em>gender</em>, <em>date of birth</em>}.</p></blockquote>
<p>This seems to be the balance point: 3 pieces of non-anonymized data are enough to identify the majority of the population. (Think, &#8220;Three Strikes! You&#8217;re out!&#8221;) So what do we do when we need solid, anonymous data from which to work?</p>
<p>Taking the example of the health records from the article linked above, I would think that the following steps would be enough to fully scrub the data beyond where &#8220;reidentification&#8221; would not be possible. Since this is medical records we can safely (I feel) assume that randomizing the gender is a non-starter. (&#8220;Wow, according to this data 14% of all men went to the Emergency Room with pregnancy-related complications!&#8221;)</p>
<p>And since this data is taken from an area where the zip codes are known we are already at two strikes. So why did they not randomize the dates of birth? It would be difficult to do in the case of infants beyond a few days or weeks, since many of the health issues are related to their age in months. But for anyone over the age of 8 it should be simple enough to randomize the month and date of birth, and allow a set of ranges for randomizing the year of birth. If we assume a 20% range up or down we gain a lattitude of possible years of birth which increases the older the patient actually is. Another possibility is to give everyone the same date of birth, differing only in the year. (Jan 1, xxxx).</p>
<p>This of course means that any reporting done on age is meaningless, but it also means that the data can more safely be widely distributed. In cases where exact age and gender are required for study it would be better to merge data from many different areas, covering as many cities, counties, states and regions as possible. In this case we would still need to weigh the risks, as all three pieces of data would still be available, although at a much higher level of trail and error. In the case mentioned by ars technica the study covered seven zip codes. Perhaps spreading the information over a few hundred would make it much less worth the effort to sort through them all to try to identify individuals, and even then one would expect multiple possible hits.</p>
<p>The need for real data for statistical analysis and study is not going to go away. When you are considering releasing scrubbing data to release a &#8220;sanitized&#8221; version it would be good to keep the mantra &#8220;Three Strikes! You&#8217;re out!&#8221; in mind. When it comes to data for testing software operation, however, I still think the better method is complete randomization. Totally bogus data that has the look and feel of &#8220;real&#8221; data. (Which is no doubt why all the bogus users in my test dbs live in different cities, in different states, and at addresses ranging from 123 to 999 on Any Street!)</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Data+Scrubbing%3A+Is+there+a+right+way%3F+http://4fa6s.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.evardsson.com/blog/2009/09/09/data-scrubbing-is-there-a-right-way/&amp;submitHeadline=Data+Scrubbing%3A+Is+there+a+right+way%3F" title="Post to Yahoo Buzz"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-buzz.png" alt="Post to Yahoo Buzz" /></a> <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.evardsson.com/blog/2009/09/09/data-scrubbing-is-there-a-right-way/&amp;submitHeadline=Data+Scrubbing%3A+Is+there+a+right+way%3F" title="Post to Yahoo Buzz">Buzz This Post</a> <a class="tt" href="http://delicious.com/post?url=http://www.evardsson.com/blog/2009/09/09/data-scrubbing-is-there-a-right-way/&amp;title=Data+Scrubbing%3A+Is+there+a+right+way%3F" title="Post to Delicious"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-delicious.png" alt="Post to Delicious" /></a> <a class="tt" href="http://delicious.com/post?url=http://www.evardsson.com/blog/2009/09/09/data-scrubbing-is-there-a-right-way/&amp;title=Data+Scrubbing%3A+Is+there+a+right+way%3F" title="Post to Delicious">Delicious</a> <a class="tt" href="http://digg.com/submit?url=http://www.evardsson.com/blog/2009/09/09/data-scrubbing-is-there-a-right-way/&amp;title=Data+Scrubbing%3A+Is+there+a+right+way%3F" title="Post to Digg"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-digg.png" alt="Post to Digg" /></a> <a class="tt" href="http://digg.com/submit?url=http://www.evardsson.com/blog/2009/09/09/data-scrubbing-is-there-a-right-way/&amp;title=Data+Scrubbing%3A+Is+there+a+right+way%3F" title="Post to Digg">Digg This Post</a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=Data+Scrubbing%3A+Is+there+a+right+way%3F&amp;link=http://www.evardsson.com/blog/2009/09/09/data-scrubbing-is-there-a-right-way/" title="Post to Ping.fm"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-ping.png" alt="Post to Ping.fm" /></a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=Data+Scrubbing%3A+Is+there+a+right+way%3F&amp;link=http://www.evardsson.com/blog/2009/09/09/data-scrubbing-is-there-a-right-way/" title="Post to Ping.fm">Ping This Post</a> <a class="tt" href="http://reddit.com/submit?url=http://www.evardsson.com/blog/2009/09/09/data-scrubbing-is-there-a-right-way/&amp;title=Data+Scrubbing%3A+Is+there+a+right+way%3F" title="Post to Reddit"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-reddit.png" alt="Post to Reddit" /></a> <a class="tt" href="http://reddit.com/submit?url=http://www.evardsson.com/blog/2009/09/09/data-scrubbing-is-there-a-right-way/&amp;title=Data+Scrubbing%3A+Is+there+a+right+way%3F" title="Post to Reddit">Reddit</a> <a class="tt" href="http://stumbleupon.com/submit?url=http://www.evardsson.com/blog/2009/09/09/data-scrubbing-is-there-a-right-way/&amp;title=Data+Scrubbing%3A+Is+there+a+right+way%3F" title="Post to StumbleUpon"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-su.png" alt="Post to StumbleUpon" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://www.evardsson.com/blog/2009/09/09/data-scrubbing-is-there-a-right-way/&amp;title=Data+Scrubbing%3A+Is+there+a+right+way%3F" title="Post to StumbleUpon">Stumble This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.evardsson.com/blog/2009/09/09/data-scrubbing-is-there-a-right-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keeping Gentoo Fresh</title>
		<link>http://www.evardsson.com/blog/2009/05/31/keeping-gentoo-fresh/</link>
		<comments>http://www.evardsson.com/blog/2009/05/31/keeping-gentoo-fresh/#comments</comments>
		<pubDate>Sun, 31 May 2009 21:36:06 +0000</pubDate>
		<dc:creator>Sjan Evardsson</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.evardsson.com/blog/?p=330</guid>
		<description><![CDATA[I had a converstion with a friend about Linux distros earlier today, and I was asked why I choose to run Gentoo on my web server. He told me that Gentoo was too hard to maintain on a server, and that when it came time to upgrade something (like Apache or PHP) due to security [...]]]></description>
			<content:encoded><![CDATA[<p>I had a converstion with a friend about Linux distros earlier today, and I was asked why I choose to run <a href="http://www.gentoo.org">Gentoo</a> on my web server. He told me that Gentoo was too hard to maintain on a server, and that when it came time to upgrade something (like Apache or PHP) due to security patches that it took too long, and too often failed. I was confused by this so I asked for clarification. What he described was the pain of updating anything on a &#8220;stale&#8221; Gentoo machine.</p>
<p>Unlike so many of the other popular distros, Gentoo does not, by default, use pre-compiled packages. So unlike doing <code>rpm -i</code> or <code>apt-get install</code> doing <code>emerge</code> on Gentoo requires that the package you are installing, and any missing dependencies, are pulled in as source code and compiled. When you think about adding packages like, say, Lynx, the process takes only a few minutes on a moderately decent machine. (Mine is a PII 966 and Lynx took about 4 minutes start to finish). When you talk about upgrading something like Apache, however, the length of time it takes depends not only on the speed of the machine, but how many of its dependencies are out of date. In fact, if you fail to update regularly you can run into an issue where not only are most of your files out of date, but your system profile is out of date and you need to do some serious wrenching to get the whole thing working again. In the times that this has happened to me (twice) I was able to get the system up-to-date once, and just gave up and reinstalled a newer version the second time. (These were both rarely used VMs, and not production boxes.) However, <a href="http://www.gentoo.org/doc/en/gentoo-upgrading.xml">updating the profile</a> on a &#8220;fresh&#8221; Gentoo is (in my experience) a painless procedure of <code>rm /etc/make.profile &amp;&amp; ln -sf /usr/portage/profiles/<em>profile_name</em> /etc/make.profile &amp;&amp; emerge -uND world</code> (uND : update newuse deep: update, take into account new use settings from the profile and make.conf, and include deep dependencies).</p>
<p>So how do I avoid the &#8220;stale&#8221; Gentoo syndrome? I take a three-step approach.</p>
<ol>
<li>A daily cron job runs <code>emerge -puvD world</code> (puvD : pretend update verbose deep : just tells you what would be emerged, in an update, verbosely, and include deep dependencies) and emails me the output. This enables me to see each morning which packages have updates available.</li>
<li>Every day that I have the time for it I log into the machine and run <code>emerge -uD world</code> and follow it up with <code>etc-update</code> (if needed) and <code>revdep-rebuild</code> if any libraries were included in the updates. (I save building new kernels for Sundays, and that doesn&#8217;t happen all that often, but I do like to always run the latest.)</li>
<li>I check the messages from emerge to see if there are any special configuration changes that need to happen post-install that cannot be handled by etc-update. For instance, changing configurations in <code>/etc/conf.d/<em>packagename</em></code>, new profiles or anything of that sort.</li>
</ol>
<p>Ok, so I like to keep my system on the latest and keep a shiny new everything on it. How does that compare with something like, say, Debian? In Debian (and Debian-based distros) you can update packages to a certain point, after which the package for that version of Debian is no longer supported or updated. So you need to upgrade your version, and your kernel, which you do with <code>apt-get upgrade dist</code>. Seems easy enough. And how does Gentoo handle version upgrades? It doesn&#8217;t need to. If you keep your system up-to-date in the way I described your system will match whatever the latest Gentoo release has. In fact, I built my web server using Gentoo 2006.0 and have been keeping it up-to-date since then. (Gentoo seems to have stopped doing the biannual releases, btw &#8211; they are now releasing updated minimal install CDs nearly weekly for each architecture.)</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Keeping+Gentoo+Fresh+http://fztrw.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.evardsson.com/blog/2009/05/31/keeping-gentoo-fresh/&amp;submitHeadline=Keeping+Gentoo+Fresh" title="Post to Yahoo Buzz"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-buzz.png" alt="Post to Yahoo Buzz" /></a> <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.evardsson.com/blog/2009/05/31/keeping-gentoo-fresh/&amp;submitHeadline=Keeping+Gentoo+Fresh" title="Post to Yahoo Buzz">Buzz This Post</a> <a class="tt" href="http://delicious.com/post?url=http://www.evardsson.com/blog/2009/05/31/keeping-gentoo-fresh/&amp;title=Keeping+Gentoo+Fresh" title="Post to Delicious"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-delicious.png" alt="Post to Delicious" /></a> <a class="tt" href="http://delicious.com/post?url=http://www.evardsson.com/blog/2009/05/31/keeping-gentoo-fresh/&amp;title=Keeping+Gentoo+Fresh" title="Post to Delicious">Delicious</a> <a class="tt" href="http://digg.com/submit?url=http://www.evardsson.com/blog/2009/05/31/keeping-gentoo-fresh/&amp;title=Keeping+Gentoo+Fresh" title="Post to Digg"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-digg.png" alt="Post to Digg" /></a> <a class="tt" href="http://digg.com/submit?url=http://www.evardsson.com/blog/2009/05/31/keeping-gentoo-fresh/&amp;title=Keeping+Gentoo+Fresh" title="Post to Digg">Digg This Post</a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=Keeping+Gentoo+Fresh&amp;link=http://www.evardsson.com/blog/2009/05/31/keeping-gentoo-fresh/" title="Post to Ping.fm"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-ping.png" alt="Post to Ping.fm" /></a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=Keeping+Gentoo+Fresh&amp;link=http://www.evardsson.com/blog/2009/05/31/keeping-gentoo-fresh/" title="Post to Ping.fm">Ping This Post</a> <a class="tt" href="http://reddit.com/submit?url=http://www.evardsson.com/blog/2009/05/31/keeping-gentoo-fresh/&amp;title=Keeping+Gentoo+Fresh" title="Post to Reddit"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-reddit.png" alt="Post to Reddit" /></a> <a class="tt" href="http://reddit.com/submit?url=http://www.evardsson.com/blog/2009/05/31/keeping-gentoo-fresh/&amp;title=Keeping+Gentoo+Fresh" title="Post to Reddit">Reddit</a> <a class="tt" href="http://stumbleupon.com/submit?url=http://www.evardsson.com/blog/2009/05/31/keeping-gentoo-fresh/&amp;title=Keeping+Gentoo+Fresh" title="Post to StumbleUpon"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-su.png" alt="Post to StumbleUpon" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://www.evardsson.com/blog/2009/05/31/keeping-gentoo-fresh/&amp;title=Keeping+Gentoo+Fresh" title="Post to StumbleUpon">Stumble This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.evardsson.com/blog/2009/05/31/keeping-gentoo-fresh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Portable code</title>
		<link>http://www.evardsson.com/blog/2009/02/01/portable-code/</link>
		<comments>http://www.evardsson.com/blog/2009/02/01/portable-code/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 00:57:20 +0000</pubDate>
		<dc:creator>Sjan Evardsson</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.evardsson.com/blog/?p=298</guid>
		<description><![CDATA[When developing applications against a single RDBMS there is no need to worry about portability. However, when you are developing with the idea that the application may be deployed against any of a range of RDBMSes then you need to start thinking about how you formulate your queries, table structures, etc. While it is common [...]]]></description>
			<content:encoded><![CDATA[<p>When developing applications against a single RDBMS there is no need to worry about portability. However, when you are developing with the idea that the application may be deployed against any of a range of RDBMSes then you need to start thinking about how you formulate your queries, table structures, etc. While it is common practice to have separate classes for working with different databases, there are some things you can do to make that even easier.</p>
<p><strong>ENUMs are EVIL</strong></p>
<p>Developers who spend a lot of time developing against MySQL get into the habit of creating ENUM fields. (I will admit a certain amount of guilt here, too). This is not only not portable, but it doesn&#8217;t work quite the way you would expect. Even though the values in the ENUM are meant to be the only values you can insert into that field, MySQL does not enforce this quite the way you might think it should.</p>
<p>As an example:</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4c52a0035e7f6">
<div class="synthi_header" style="font-weight:bold;"> SQL <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4c52a0035e7f6').style.display='block';document.getElementById('plain_synthi_4c52a0035e7f6').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
CREATE TABLE enumevil (
    id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
    evil ENUM('foo','bar','baz') NOT NULL DEFAULT 'foo'
);
Query OK, 0 rows affected (0.01 sec)
INSERT INTO enumevil (evil) VALUES ('bip');
Query OK, 1 row affected, 1 warning (0.02 sec)
SELECT * FROM enumevil;
+----+------+
| id | evil |
+----+------+
|  1 |      |
+----+------+
1 row IN SET (0.00 sec)
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4c52a0035e7f6">
<div class="synthi_header" style="font-weight:bold;"> SQL <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4c52a0035e7f6').style.display='block';document.getElementById('styled_synthi_4c52a0035e7f6').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="sql" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> enumevil <span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; id INTEGER <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span> <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; evil ENUM<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;foo&#8217;</span>,<span style="color: #ff0000;">&#8216;bar&#8217;</span>,<span style="color: #ff0000;">&#8216;baz&#8217;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">&#8216;foo&#8217;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">Query OK, <span style="color: #cc66cc;">0</span> rows affected <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0.01</span> sec<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> enumevil <span style="color: #66cc66;">&#40;</span>evil<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;bip&#8217;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">Query OK, <span style="color: #cc66cc;">1</span> row affected, <span style="color: #cc66cc;">1</span> warning <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0.02</span> sec<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #993333; font-weight: bold;">SELECT</span> * <span style="color: #993333; font-weight: bold;">FROM</span> enumevil;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">+<span style="color: #808080; font-style: italic;">&#8212;-+&#8212;&#8212;+</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">| id | evil |</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">+<span style="color: #808080; font-style: italic;">&#8212;-+&#8212;&#8212;+</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">|&nbsp; <span style="color: #cc66cc;">1</span> |&nbsp; &nbsp; &nbsp; | </div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">+<span style="color: #808080; font-style: italic;">&#8212;-+&#8212;&#8212;+</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #cc66cc;">1</span> row <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #993333; font-weight: bold;">SET</span> <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0.00</span> sec<span style="color: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
<p>Rather than spitting back an error, it quietly sets the value of the ENUM field to the empty string. That is not in the list of allowed values nor is it the default. So you are left with checking the values in code before inserting (which you should do anyway &#8211; see the next section on referential integrity.)</p>
<p>Instead of using an ENUM field consider this:</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4c52a00364a34">
<div class="synthi_header" style="font-weight:bold;"> SQL <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4c52a00364a34').style.display='block';document.getElementById('plain_synthi_4c52a00364a34').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
CREATE TABLE noevil_enum_choice (
    choice VARCHAR(3) NOT NULL PRIMARY KEY
);
INSERT INTO noevil_enum_choice VALUES ('foo');
INSERT INTO noevil_enum_choice VALUES ('bar');
INSERT INTO noevil_enum_choice VALUES ('baz');
CREATE TABLE noevil (
    id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
    choice VARCHAR(3) NOT NULL REFERENCES noevil_enum_choice.choice
);
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4c52a00364a34">
<div class="synthi_header" style="font-weight:bold;"> SQL <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4c52a00364a34').style.display='block';document.getElementById('styled_synthi_4c52a00364a34').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="sql" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> noevil_enum_choice <span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; choice VARCHAR<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> noevil_enum_choice <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;foo&#8217;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> noevil_enum_choice <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;bar&#8217;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> noevil_enum_choice <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;baz&#8217;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> noevil <span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; id INTEGER <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span> <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; choice VARCHAR<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">REFERENCES</span> noevil_enum_choice.choice</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
<p>Although MySQL does not enforce referential integrity, this is now something can be easily converted to PostgreSQL as:</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4c52a0036ada6">
<div class="synthi_header" style="font-weight:bold;"> SQL <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4c52a0036ada6').style.display='block';document.getElementById('plain_synthi_4c52a0036ada6').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
CREATE TABLE noevil_enum_choice (
    choice VARCHAR(3) NOT NULL PRIMARY KEY
);
INSERT INTO noevil_enum_choice VALUES ('foo');
INSERT INTO noevil_enum_choice VALUES ('bar');
INSERT INTO noevil_enum_choice VALUES ('baz');
CREATE TABLE noevil (
    id SERIAL PRIMARY KEY,
    choice VARCHAR(3) NOT NULL REFERENCES noevil_enum_choice(choice)
);
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4c52a0036ada6">
<div class="synthi_header" style="font-weight:bold;"> SQL <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4c52a0036ada6').style.display='block';document.getElementById('styled_synthi_4c52a0036ada6').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="sql" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> noevil_enum_choice <span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; choice VARCHAR<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> noevil_enum_choice <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;foo&#8217;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> noevil_enum_choice <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;bar&#8217;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> noevil_enum_choice <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&#8216;baz&#8217;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> noevil <span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; id SERIAL <span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span>,</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; choice VARCHAR<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">REFERENCES</span> noevil_enum_choice<span style="color: #66cc66;">&#40;</span>choice<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #66cc66;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
<p>And PostgreSQL <em>does</em> enforce referential integrity. This also makes it easier to expand your choice list by just inserting a new row.</p>
<p><strong>Referential Integrity</strong></p>
<p>On the flip-side of the coin, developers who spend a good deal of time developing against PostgreSQL come to rely on the referential integrity built in to that RDBMS. While there is nothing wrong with that, your code should enforce this as well, if you want to be able to move from one RDBMS to another. In the example above we could rely on PostgreSQL&#8217;s REFERENCES statement to kick back an error whenever a bad value (like &#8216;bip&#8217;) is inserted into the choice field of the noevil table. However, as soon as you move your application to MySQL or sqlite it will happily insert anything you like into that field (with MySQL truncating it to three characters).</p>
<p>This is why it is important for your applications to take into consideration their own referential integrity. Here&#8217;s some python to illustrate:</p>
<div class="synthi_code" style="display:none;" id ="plain_synthi_4c52a00370dd4">
<div class="synthi_header" style="font-weight:bold;"> Python <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('styled_synthi_4c52a00370dd4').style.display='block';document.getElementById('plain_synthi_4c52a00370dd4').style.display='none';return false">Show Styled Code</a>]:</span></div>
<pre style="width:100%;overflow:auto;">
import string
from spdo import *

class noevil(object):
    __init__(self, choice):
        self.db = SPDO('test')
        self.choices = []
        mydict = self.db.select(&#034;SELECT * FROM noevil_enum_choice&#034;)
        for c in mydict:
            self.choices.append(c['choice'])
        if choice not in choices:
            ex[] = [&#034;Invalid value for choice: &#034;, choice, &#034; Valid options are: &#034;]
            for c in self.choices:
                ex.append[c]
                ex.append[&#034; &#034;]
            raise Exception(string.join(ex, ''))
        # continue with normal processing here
</pre>
</div>
<div class="synthi_code" style="display:block;" id ="styled_synthi_4c52a00370dd4">
<div class="synthi_header" style="font-weight:bold;"> Python <span  class="synthi_button"style="font-weight:lighter;font-size:smaller;">[<a href="#" onClick="javascript:document.getElementById('plain_synthi_4c52a00370dd4').style.display='block';document.getElementById('styled_synthi_4c52a00370dd4').style.display='none';return false">Show Plain Code</a>]:</span></div>
<div class="python" style="font-family: monospace;">
<ol>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">string</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #ff7700;font-weight:bold;">from</span> spdo <span style="color: #ff7700;font-weight:bold;">import</span> *</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp;</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;"><span style="color: #ff7700;font-weight:bold;">class</span> noevil<span style="color: black;">&#40;</span><span style="color: #008000;">object</span><span style="color: black;">&#41;</span>:</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, choice<span style="color: black;">&#41;</span>:</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">self</span>.<span style="color: black;">db</span> = SPDO<span style="color: black;">&#40;</span><span style="color: #483d8b;">&#8216;test&#8217;</span><span style="color: black;">&#41;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">self</span>.<span style="color: black;">choices</span> = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; &nbsp; &nbsp; mydict = <span style="color: #008000;">self</span>.<span style="color: black;">db</span>.<span style="color: #dc143c;">select</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;SELECT * FROM noevil_enum_choice&quot;</span><span style="color: black;">&#41;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">for</span> c <span style="color: #ff7700;font-weight:bold;">in</span> mydict:</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008000;">self</span>.<span style="color: black;">choices</span>.<span style="color: black;">append</span><span style="color: black;">&#40;</span>c<span style="color: black;">&#91;</span><span style="color: #483d8b;">&#8216;choice&#8217;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> choice <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #ff7700;font-weight:bold;">in</span> choices:</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ex<span style="color: black;">&#91;</span><span style="color: black;">&#93;</span> = <span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;Invalid value for choice: &quot;</span>, choice, <span style="color: #483d8b;">&quot; Valid options are: &quot;</span><span style="color: black;">&#93;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">for</span> c <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">self</span>.<span style="color: black;">choices</span>:</div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ex.<span style="color: black;">append</span><span style="color: black;">&#91;</span>c<span style="color: black;">&#93;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ex.<span style="color: black;">append</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot; &quot;</span><span style="color: black;">&#93;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">raise</span> <span style="color: #008000;">Exception</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">string</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>ex, <span style="color: #483d8b;">&#8221;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></div>
</li>
<li style="font-weight: bold;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal; font-size: 1.2em;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># continue with normal processing here </span></div>
</li>
</ol>
</div>
</div>
<p>This is by no means the entirety of the topic, or even more than merest tip of the iceberg, but it is a good place to start.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Portable+code+http://zobcy.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.evardsson.com/blog/2009/02/01/portable-code/&amp;submitHeadline=Portable+code" title="Post to Yahoo Buzz"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-buzz.png" alt="Post to Yahoo Buzz" /></a> <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.evardsson.com/blog/2009/02/01/portable-code/&amp;submitHeadline=Portable+code" title="Post to Yahoo Buzz">Buzz This Post</a> <a class="tt" href="http://delicious.com/post?url=http://www.evardsson.com/blog/2009/02/01/portable-code/&amp;title=Portable+code" title="Post to Delicious"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-delicious.png" alt="Post to Delicious" /></a> <a class="tt" href="http://delicious.com/post?url=http://www.evardsson.com/blog/2009/02/01/portable-code/&amp;title=Portable+code" title="Post to Delicious">Delicious</a> <a class="tt" href="http://digg.com/submit?url=http://www.evardsson.com/blog/2009/02/01/portable-code/&amp;title=Portable+code" title="Post to Digg"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-digg.png" alt="Post to Digg" /></a> <a class="tt" href="http://digg.com/submit?url=http://www.evardsson.com/blog/2009/02/01/portable-code/&amp;title=Portable+code" title="Post to Digg">Digg This Post</a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=Portable+code&amp;link=http://www.evardsson.com/blog/2009/02/01/portable-code/" title="Post to Ping.fm"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-ping.png" alt="Post to Ping.fm" /></a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=Portable+code&amp;link=http://www.evardsson.com/blog/2009/02/01/portable-code/" title="Post to Ping.fm">Ping This Post</a> <a class="tt" href="http://reddit.com/submit?url=http://www.evardsson.com/blog/2009/02/01/portable-code/&amp;title=Portable+code" title="Post to Reddit"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-reddit.png" alt="Post to Reddit" /></a> <a class="tt" href="http://reddit.com/submit?url=http://www.evardsson.com/blog/2009/02/01/portable-code/&amp;title=Portable+code" title="Post to Reddit">Reddit</a> <a class="tt" href="http://stumbleupon.com/submit?url=http://www.evardsson.com/blog/2009/02/01/portable-code/&amp;title=Portable+code" title="Post to StumbleUpon"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-su.png" alt="Post to StumbleUpon" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://www.evardsson.com/blog/2009/02/01/portable-code/&amp;title=Portable+code" title="Post to StumbleUpon">Stumble This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.evardsson.com/blog/2009/02/01/portable-code/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Disclosure of Website Vulnerabilities Illegal?</title>
		<link>http://www.evardsson.com/blog/2007/01/16/disclosure-of-website-vulnerabilities-illegal/</link>
		<comments>http://www.evardsson.com/blog/2007/01/16/disclosure-of-website-vulnerabilities-illegal/#comments</comments>
		<pubDate>Tue, 16 Jan 2007 19:57:00 +0000</pubDate>
		<dc:creator>Sjan Evardsson</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://localhost/wordpress/?p=4</guid>
		<description><![CDATA[A discussion on Slashdot earlier today brought up the question. It seems that Eric McCarty, a student at Purdue University in Dr. Pascal Meunier&#8217;s CS390 &#8211; Secure Computing, discovered, and reported, a flaw he found on the Physics department website. When that site was hacked two months later (most likely through a different flaw, since [...]]]></description>
			<content:encoded><![CDATA[<p>A <a href="http://it.slashdot.org/article.pl?sid=07/01/16/2039222">discussion</a>  on <a href="http://slashdot.org/" rel="tag">Slashdot</a>  earlier today brought up the question. It seems that Eric McCarty, a student at Purdue University in Dr. Pascal Meunier&#8217;s CS390 &#8211; Secure Computing, discovered, and <a href="http://www.csoonline.com/read/010107/fea_vuln.html">reported</a>, a flaw he found on the Physics department website. When that site was hacked two months later (most likely through a different flaw, since the one reported by McCarty was patched) law enforcement came looking for Mr. McCarty. In this particular case McCarty came forward, and was eventually cleared. However, it did change how Dr. Meunier teaches his class. He no longer recommends disclosure, but recommends that one eliminates all evidence of the discovery from their computer and say nothing.</p>
<p>I see this as a particularly disturbing direction in which to move.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Disclosure+of+Website+Vulnerabilities+Illegal%3F+http://835e5.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.evardsson.com/blog/2007/01/16/disclosure-of-website-vulnerabilities-illegal/&amp;submitHeadline=Disclosure+of+Website+Vulnerabilities+Illegal%3F" title="Post to Yahoo Buzz"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-buzz.png" alt="Post to Yahoo Buzz" /></a> <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.evardsson.com/blog/2007/01/16/disclosure-of-website-vulnerabilities-illegal/&amp;submitHeadline=Disclosure+of+Website+Vulnerabilities+Illegal%3F" title="Post to Yahoo Buzz">Buzz This Post</a> <a class="tt" href="http://delicious.com/post?url=http://www.evardsson.com/blog/2007/01/16/disclosure-of-website-vulnerabilities-illegal/&amp;title=Disclosure+of+Website+Vulnerabilities+Illegal%3F" title="Post to Delicious"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-delicious.png" alt="Post to Delicious" /></a> <a class="tt" href="http://delicious.com/post?url=http://www.evardsson.com/blog/2007/01/16/disclosure-of-website-vulnerabilities-illegal/&amp;title=Disclosure+of+Website+Vulnerabilities+Illegal%3F" title="Post to Delicious">Delicious</a> <a class="tt" href="http://digg.com/submit?url=http://www.evardsson.com/blog/2007/01/16/disclosure-of-website-vulnerabilities-illegal/&amp;title=Disclosure+of+Website+Vulnerabilities+Illegal%3F" title="Post to Digg"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-digg.png" alt="Post to Digg" /></a> <a class="tt" href="http://digg.com/submit?url=http://www.evardsson.com/blog/2007/01/16/disclosure-of-website-vulnerabilities-illegal/&amp;title=Disclosure+of+Website+Vulnerabilities+Illegal%3F" title="Post to Digg">Digg This Post</a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=Disclosure+of+Website+Vulnerabilities+Illegal%3F&amp;link=http://www.evardsson.com/blog/2007/01/16/disclosure-of-website-vulnerabilities-illegal/" title="Post to Ping.fm"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-ping.png" alt="Post to Ping.fm" /></a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=Disclosure+of+Website+Vulnerabilities+Illegal%3F&amp;link=http://www.evardsson.com/blog/2007/01/16/disclosure-of-website-vulnerabilities-illegal/" title="Post to Ping.fm">Ping This Post</a> <a class="tt" href="http://reddit.com/submit?url=http://www.evardsson.com/blog/2007/01/16/disclosure-of-website-vulnerabilities-illegal/&amp;title=Disclosure+of+Website+Vulnerabilities+Illegal%3F" title="Post to Reddit"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-reddit.png" alt="Post to Reddit" /></a> <a class="tt" href="http://reddit.com/submit?url=http://www.evardsson.com/blog/2007/01/16/disclosure-of-website-vulnerabilities-illegal/&amp;title=Disclosure+of+Website+Vulnerabilities+Illegal%3F" title="Post to Reddit">Reddit</a> <a class="tt" href="http://stumbleupon.com/submit?url=http://www.evardsson.com/blog/2007/01/16/disclosure-of-website-vulnerabilities-illegal/&amp;title=Disclosure+of+Website+Vulnerabilities+Illegal%3F" title="Post to StumbleUpon"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-su.png" alt="Post to StumbleUpon" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://www.evardsson.com/blog/2007/01/16/disclosure-of-website-vulnerabilities-illegal/&amp;title=Disclosure+of+Website+Vulnerabilities+Illegal%3F" title="Post to StumbleUpon">Stumble This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.evardsson.com/blog/2007/01/16/disclosure-of-website-vulnerabilities-illegal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Surf carefully</title>
		<link>http://www.evardsson.com/blog/2006/10/03/surf-carefully/</link>
		<comments>http://www.evardsson.com/blog/2006/10/03/surf-carefully/#comments</comments>
		<pubDate>Tue, 03 Oct 2006 15:39:00 +0000</pubDate>
		<dc:creator>Sjan Evardsson</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://localhost/wordpress/?p=19</guid>
		<description><![CDATA[Although it has been said many, many times, be careful how you surf. Make sure your machine is patched, you have anti-virus and spy ware blockers, blah blah blah. Well, if a picture is worth a thousand words, then maybe this video will shed some light on the subject (sorry &#8211; it is an ad [...]]]></description>
			<content:encoded><![CDATA[<p>Although it has been said many, many times, be careful how you surf. Make sure your machine is patched, you have anti-virus and spy ware blockers, blah blah blah.</p>
<p>Well, if a picture is worth a thousand words, then maybe <a href="http://www.youtube.com/watch?v=3atmWmWCwlw">this video</a>  will shed some light on the subject (sorry &#8211; it is an ad for McAfee, which I neither use nor recommend &#8211; just my personal preference) .</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=Surf+carefully+http://tbyxb.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.evardsson.com/blog/2006/10/03/surf-carefully/&amp;submitHeadline=Surf+carefully" title="Post to Yahoo Buzz"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-buzz.png" alt="Post to Yahoo Buzz" /></a> <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.evardsson.com/blog/2006/10/03/surf-carefully/&amp;submitHeadline=Surf+carefully" title="Post to Yahoo Buzz">Buzz This Post</a> <a class="tt" href="http://delicious.com/post?url=http://www.evardsson.com/blog/2006/10/03/surf-carefully/&amp;title=Surf+carefully" title="Post to Delicious"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-delicious.png" alt="Post to Delicious" /></a> <a class="tt" href="http://delicious.com/post?url=http://www.evardsson.com/blog/2006/10/03/surf-carefully/&amp;title=Surf+carefully" title="Post to Delicious">Delicious</a> <a class="tt" href="http://digg.com/submit?url=http://www.evardsson.com/blog/2006/10/03/surf-carefully/&amp;title=Surf+carefully" title="Post to Digg"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-digg.png" alt="Post to Digg" /></a> <a class="tt" href="http://digg.com/submit?url=http://www.evardsson.com/blog/2006/10/03/surf-carefully/&amp;title=Surf+carefully" title="Post to Digg">Digg This Post</a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=Surf+carefully&amp;link=http://www.evardsson.com/blog/2006/10/03/surf-carefully/" title="Post to Ping.fm"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-ping.png" alt="Post to Ping.fm" /></a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=Surf+carefully&amp;link=http://www.evardsson.com/blog/2006/10/03/surf-carefully/" title="Post to Ping.fm">Ping This Post</a> <a class="tt" href="http://reddit.com/submit?url=http://www.evardsson.com/blog/2006/10/03/surf-carefully/&amp;title=Surf+carefully" title="Post to Reddit"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-reddit.png" alt="Post to Reddit" /></a> <a class="tt" href="http://reddit.com/submit?url=http://www.evardsson.com/blog/2006/10/03/surf-carefully/&amp;title=Surf+carefully" title="Post to Reddit">Reddit</a> <a class="tt" href="http://stumbleupon.com/submit?url=http://www.evardsson.com/blog/2006/10/03/surf-carefully/&amp;title=Surf+carefully" title="Post to StumbleUpon"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-su.png" alt="Post to StumbleUpon" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://www.evardsson.com/blog/2006/10/03/surf-carefully/&amp;title=Surf+carefully" title="Post to StumbleUpon">Stumble This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.evardsson.com/blog/2006/10/03/surf-carefully/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A simple intro to database normalization</title>
		<link>http://www.evardsson.com/blog/2006/08/30/a-simple-intro-to-database-normalization/</link>
		<comments>http://www.evardsson.com/blog/2006/08/30/a-simple-intro-to-database-normalization/#comments</comments>
		<pubDate>Wed, 30 Aug 2006 22:45:00 +0000</pubDate>
		<dc:creator>Sjan Evardsson</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://localhost/wordpress/?p=25</guid>
		<description><![CDATA[I found a very clear, well-written introductory example to database normalization on devshed. Although it is in the MySQL portion of the site, it applies equally well across the board to other RDBMSs. To get more details on normalization, the normal forms, and general good database development in general, check out Database Design for Mere [...]]]></description>
			<content:encoded><![CDATA[<p>I found a very clear, well-written introductory <a href="http://www.devshed.com/c/a/MySQL/An-Introduction-to-Database-Normalization/">example</a> to database normalization on devshed. Although it is in the MySQL portion of the site, it applies equally well across the board to other RDBMSs.</p>
<p>To get more details on normalization, the normal forms, and general good database development in general, check out <a href="http://www.amazon.com/Database-Design-Mere/dp/0201752840/sr=8-1/qid=1156966801/ref=pd_bbs_1/002-0285788-0488009?ie=UTF8">Database Design for Mere Mortals: A Hands-On Guide to Relational Database Design, Second Edition</a> by Michael J. Hernandez. Without a doubt the most useful db development book I&#8217;ve ever laid my hands on.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=A+simple+intro+to+database+normalization+http://xpyyh.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.evardsson.com/blog/2006/08/30/a-simple-intro-to-database-normalization/&amp;submitHeadline=A+simple+intro+to+database+normalization" title="Post to Yahoo Buzz"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-buzz.png" alt="Post to Yahoo Buzz" /></a> <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.evardsson.com/blog/2006/08/30/a-simple-intro-to-database-normalization/&amp;submitHeadline=A+simple+intro+to+database+normalization" title="Post to Yahoo Buzz">Buzz This Post</a> <a class="tt" href="http://delicious.com/post?url=http://www.evardsson.com/blog/2006/08/30/a-simple-intro-to-database-normalization/&amp;title=A+simple+intro+to+database+normalization" title="Post to Delicious"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-delicious.png" alt="Post to Delicious" /></a> <a class="tt" href="http://delicious.com/post?url=http://www.evardsson.com/blog/2006/08/30/a-simple-intro-to-database-normalization/&amp;title=A+simple+intro+to+database+normalization" title="Post to Delicious">Delicious</a> <a class="tt" href="http://digg.com/submit?url=http://www.evardsson.com/blog/2006/08/30/a-simple-intro-to-database-normalization/&amp;title=A+simple+intro+to+database+normalization" title="Post to Digg"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-digg.png" alt="Post to Digg" /></a> <a class="tt" href="http://digg.com/submit?url=http://www.evardsson.com/blog/2006/08/30/a-simple-intro-to-database-normalization/&amp;title=A+simple+intro+to+database+normalization" title="Post to Digg">Digg This Post</a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=A+simple+intro+to+database+normalization&amp;link=http://www.evardsson.com/blog/2006/08/30/a-simple-intro-to-database-normalization/" title="Post to Ping.fm"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-ping.png" alt="Post to Ping.fm" /></a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=A+simple+intro+to+database+normalization&amp;link=http://www.evardsson.com/blog/2006/08/30/a-simple-intro-to-database-normalization/" title="Post to Ping.fm">Ping This Post</a> <a class="tt" href="http://reddit.com/submit?url=http://www.evardsson.com/blog/2006/08/30/a-simple-intro-to-database-normalization/&amp;title=A+simple+intro+to+database+normalization" title="Post to Reddit"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-reddit.png" alt="Post to Reddit" /></a> <a class="tt" href="http://reddit.com/submit?url=http://www.evardsson.com/blog/2006/08/30/a-simple-intro-to-database-normalization/&amp;title=A+simple+intro+to+database+normalization" title="Post to Reddit">Reddit</a> <a class="tt" href="http://stumbleupon.com/submit?url=http://www.evardsson.com/blog/2006/08/30/a-simple-intro-to-database-normalization/&amp;title=A+simple+intro+to+database+normalization" title="Post to StumbleUpon"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-su.png" alt="Post to StumbleUpon" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://www.evardsson.com/blog/2006/08/30/a-simple-intro-to-database-normalization/&amp;title=A+simple+intro+to+database+normalization" title="Post to StumbleUpon">Stumble This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.evardsson.com/blog/2006/08/30/a-simple-intro-to-database-normalization/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>10 Windows Password Myths</title>
		<link>http://www.evardsson.com/blog/2006/08/02/10-windows-password-myths/</link>
		<comments>http://www.evardsson.com/blog/2006/08/02/10-windows-password-myths/#comments</comments>
		<pubDate>Wed, 02 Aug 2006 14:56:00 +0000</pubDate>
		<dc:creator>Sjan Evardsson</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://localhost/wordpress/?p=29</guid>
		<description><![CDATA[I saw this article (Ten Windows Password Myths) over at Security Focus and thought it was worth sharing. And something I didn&#8217;t know about Windows (2000/XP) passwords: If your password is 15 characters or longer, Windows stores the constant AAD3B435B51404EEAAD3B435B51404EE as your LM hash, which is equivalent to a null password. The nice thing about [...]]]></description>
			<content:encoded><![CDATA[<p>I saw this article (<a href="http://www.securityfocus.com/infocus/1554">Ten Windows Password Myths</a>) over at <a href="http://www.securityfocus.com">Security Focus</a>  and thought it was worth sharing. And something I didn&#8217;t know about Windows (2000/XP) passwords:</p>
<blockquote><p>If your password is 15 characters or longer, Windows stores the constant AAD3B435B51404EEAAD3B435B51404EE as your LM hash, which is equivalent to a null password.</p></blockquote>
<p>The nice thing about that is that it then becomes impossible for your password to be cracked from the SAM database, since we kow it isn&#8217;t actually null.</p>
<p>Perhaps the most interesting point the article makes, (and though it has been made many times before it bears repeating) is that despite every other security measure we put into place, without strong passwords our defenses are easily overcome.</p>
<p align="left"><a class="tt" href="http://twitter.com/home/?status=10+Windows+Password+Myths+http://pfsk2.th8.us" title="Post to Twitter"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-twitter.png" alt="Post to Twitter" /></a> <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.evardsson.com/blog/2006/08/02/10-windows-password-myths/&amp;submitHeadline=10+Windows+Password+Myths" title="Post to Yahoo Buzz"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-buzz.png" alt="Post to Yahoo Buzz" /></a> <a class="tt" href="http://buzz.yahoo.com/submit?submitUrl=http://www.evardsson.com/blog/2006/08/02/10-windows-password-myths/&amp;submitHeadline=10+Windows+Password+Myths" title="Post to Yahoo Buzz">Buzz This Post</a> <a class="tt" href="http://delicious.com/post?url=http://www.evardsson.com/blog/2006/08/02/10-windows-password-myths/&amp;title=10+Windows+Password+Myths" title="Post to Delicious"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-delicious.png" alt="Post to Delicious" /></a> <a class="tt" href="http://delicious.com/post?url=http://www.evardsson.com/blog/2006/08/02/10-windows-password-myths/&amp;title=10+Windows+Password+Myths" title="Post to Delicious">Delicious</a> <a class="tt" href="http://digg.com/submit?url=http://www.evardsson.com/blog/2006/08/02/10-windows-password-myths/&amp;title=10+Windows+Password+Myths" title="Post to Digg"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-digg.png" alt="Post to Digg" /></a> <a class="tt" href="http://digg.com/submit?url=http://www.evardsson.com/blog/2006/08/02/10-windows-password-myths/&amp;title=10+Windows+Password+Myths" title="Post to Digg">Digg This Post</a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=10+Windows+Password+Myths&amp;link=http://www.evardsson.com/blog/2006/08/02/10-windows-password-myths/" title="Post to Ping.fm"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-ping.png" alt="Post to Ping.fm" /></a> <a class="tt" href="http://ping.fm/ref/?method=microblog&amp;title=10+Windows+Password+Myths&amp;link=http://www.evardsson.com/blog/2006/08/02/10-windows-password-myths/" title="Post to Ping.fm">Ping This Post</a> <a class="tt" href="http://reddit.com/submit?url=http://www.evardsson.com/blog/2006/08/02/10-windows-password-myths/&amp;title=10+Windows+Password+Myths" title="Post to Reddit"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-reddit.png" alt="Post to Reddit" /></a> <a class="tt" href="http://reddit.com/submit?url=http://www.evardsson.com/blog/2006/08/02/10-windows-password-myths/&amp;title=10+Windows+Password+Myths" title="Post to Reddit">Reddit</a> <a class="tt" href="http://stumbleupon.com/submit?url=http://www.evardsson.com/blog/2006/08/02/10-windows-password-myths/&amp;title=10+Windows+Password+Myths" title="Post to StumbleUpon"><img class="nothumb" src="http://www.evardsson.com/blog/wp-content/plugins/tweet-this/icons/tt-su.png" alt="Post to StumbleUpon" /></a> <a class="tt" href="http://stumbleupon.com/submit?url=http://www.evardsson.com/blog/2006/08/02/10-windows-password-myths/&amp;title=10+Windows+Password+Myths" title="Post to StumbleUpon">Stumble This Post</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.evardsson.com/blog/2006/08/02/10-windows-password-myths/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
