<?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>( f o o b a r . l u ) &#187; Coding Voodoo</title>
	<atom:link href="http://foobar.lu/wp/category/coding/feed/" rel="self" type="application/rss+xml" />
	<link>http://foobar.lu/wp</link>
	<description>coding should be fun</description>
	<lastBuildDate>Wed, 31 Mar 2010 11:39:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>SPSS, MS-SQL2008 &amp; bigint</title>
		<link>http://foobar.lu/wp/2010/03/31/spss-ms-sql2008-bigint/</link>
		<comments>http://foobar.lu/wp/2010/03/31/spss-ms-sql2008-bigint/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 11:39:08 +0000</pubDate>
		<dc:creator>exhuma.twn</dc:creator>
				<category><![CDATA[Coding Voodoo]]></category>

		<guid isPermaLink="false">http://foobar.lu/wp/?p=97</guid>
		<description><![CDATA[There seems to be an issue with SPSS while reading data from an MS-SQL-Server instance. Notably with the SQL datatype &#8220;bigint&#8221;. Assume the following SPSS syntax:
GET DATA
&#160; &#160;/TYPE=ODBC
&#160; &#160;/CONNECT='DSN=my_dsn;SERVER=server_name;Trusted_Connection=yes;DATABASE=db_name'
&#160; &#160;/SQL = 'SELECT year FROM &#160;my_table'
.
EXECUTE.
If the field in question (in this case: &#8220;year&#8221;) is of SQL-type &#8220;bigint&#8221; then SPSS will show these values in the [...]]]></description>
			<content:encoded><![CDATA[<p>There seems to be an issue with SPSS while reading data from an MS-SQL-Server instance. Notably with the SQL datatype &#8220;bigint&#8221;. Assume the following SPSS syntax:</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;width:530px"><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">GET DATA<br />
&nbsp; &nbsp;/TYPE=ODBC<br />
&nbsp; &nbsp;/CONNECT='DSN=my_dsn;SERVER=server_name;Trusted_Connection=yes;DATABASE=db_name'<br />
&nbsp; &nbsp;/SQL = 'SELECT year FROM &nbsp;my_table'<br />
.<br />
EXECUTE.</div></div>
<p>If the field in question (in this case: &#8220;year&#8221;) is of SQL-type &#8220;bigint&#8221; then SPSS will show these values in the majority of the cases as &#8220;MISSING&#8221;. Sporadically some values appear, but they are completely wrong.</p>
<p>Once the cause is known (problem with the &#8220;biging&#8221; type), the solution is straight-forward: Cast the type to another appropriate type which is understood by SPSS. Which type you choose obviously depends on the values stored in the affected fields. Casting blindly to &#8220;int&#8221; <strong>may</strong> (I haven&#8217;t tested this!) resolve in strange results if the values lie outside of the &#8220;int&#8221; range (-2^31 to 2^31-1). In this case you may need to cast it to something alphanumeric like &#8220;varchar&#8221; and re-cast it in SPSS into &#8220;Numeric&#8221;. As said, I haven&#8217;t tested this but I thought it might be worth mentioning!</p>
<p>So, here&#8217;s the above query with the appropriate cast:</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;width:530px"><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">GET DATA<br />
&nbsp; &nbsp;/TYPE=ODBC<br />
&nbsp; &nbsp;/CONNECT='DSN=my_dsn;SERVER=server_name;Trusted_Connection=yes;DATABASE=db_name'<br />
&nbsp; &nbsp;/SQL = 'SELECT CONVERT(int, year) AS year FROM &nbsp;my_table'<br />
.<br />
EXECUTE.</div></div>
<p>Note also that in this case you need to add an alias for the column ( &#8220;&#8230; AS year&#8221; ). Otherwise SPSS will return it as &#8220;VXXX&#8221; (where XXX is a sequential number).</p>
<p>I have tested this solution on all combinations of SPSS 11.5, SPSS 18, SQL-Server 2008 64bit, SQL-Server 2008 Express 32bit. And casting the value worked every time.</p>
<p>Depending on your use, it may be helpful to create views which do the casting. I have not yet tried this, but I don&#8217;t see a reason why it shouldn&#8217;t work. Additionally, it might be noteworthy that I have only encountered this problem with &#8220;bigint&#8221; so far. There <strong>may</strong> be problems with other types as well. I expect, casting them to something else should work there too.</p>
]]></content:encoded>
			<wfw:commentRss>http://foobar.lu/wp/2010/03/31/spss-ms-sql2008-bigint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dialog buttons not responding in Eclipse under KDE/GNOME</title>
		<link>http://foobar.lu/wp/2010/02/01/dialog-buttons-not-responding-in-eclipse-under-kdegnome/</link>
		<comments>http://foobar.lu/wp/2010/02/01/dialog-buttons-not-responding-in-eclipse-under-kdegnome/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 09:50:01 +0000</pubDate>
		<dc:creator>wickeddoc</dc:creator>
				<category><![CDATA[Coding Voodoo]]></category>

		<guid isPermaLink="false">http://foobar.lu/wp/2010/02/01/dialog-buttons-not-responding-in-eclipse-under-kdegnome/</guid>
		<description><![CDATA[In case you&#8217;re running into the same trouble as me, that dialog buttons are not &#8220;clickable&#8221; anymore under Eclipse, just add the following line to one of your linux startup scripts to fix the problem:
export GDK_NATIVE_WINDOWS=1
]]></description>
			<content:encoded><![CDATA[<p>In case you&#8217;re running into the same trouble as me, that dialog buttons are not &#8220;clickable&#8221; anymore under Eclipse, just add the following line to one of your linux startup scripts to fix the problem:</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;width:530px"><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">export GDK_NATIVE_WINDOWS=1</div></div>
]]></content:encoded>
			<wfw:commentRss>http://foobar.lu/wp/2010/02/01/dialog-buttons-not-responding-in-eclipse-under-kdegnome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mayflower Zend Framework Cheatsheet</title>
		<link>http://foobar.lu/wp/2009/12/31/mayflower-zend-framework-cheatsheet/</link>
		<comments>http://foobar.lu/wp/2009/12/31/mayflower-zend-framework-cheatsheet/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 11:14:33 +0000</pubDate>
		<dc:creator>wickeddoc</dc:creator>
				<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://foobar.lu/wp/?p=75</guid>
		<description><![CDATA[Several weeks ago I was scouting the Internet for a Zend Framework cheatsheet and I found a blog entry somewhere about a Zend Framework Cheatsheet Poster, created by a German company called Mayflower.
On their blog they say, if you&#8217;re an eager Zend Framework developer and want to get your copy of their Cheatsheet poster, you&#8217;ll [...]]]></description>
			<content:encoded><![CDATA[<p>Several weeks ago I was scouting the Internet for a Zend Framework cheatsheet and I found a blog entry somewhere about a <strong>Zend Framework Cheatsheet Poster</strong>, created by a German company called <strong><a href="http://www.mayflower.de">Mayflower</a></strong>.</p>
<p>On their blog they say, if you&#8217;re an eager Zend Framework developer and want to get your copy of their Cheatsheet poster, you&#8217;ll just have to send them an email and you&#8217;ll get this great Poster delivered to your office or home or whatever, <strong>free of charge</strong>. So that&#8217;s what I did and guess what, a week later I received this very useful poster in the mail.<br />
So if you are a Zend Framework developer yourself and want to own this cool poster, don&#8217;t be shy, just send an email to Björn Schotte over at Mayflower.</p>
<p>Here&#8217;s a photo of the poster in our office @ <strong><a href="http://www.vo.lu">Visual Online, Luxembourg</a></strong></p>
<p><img src="http://www.foobar.lu/mayflower.jpg" alt="Mayflower Zend Framework Cheatsheet Poster" /></p>
]]></content:encoded>
			<wfw:commentRss>http://foobar.lu/wp/2009/12/31/mayflower-zend-framework-cheatsheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unable to easy_install psycopg2 on debian</title>
		<link>http://foobar.lu/wp/2009/10/29/unable-to-easy_install-psycopg2-on-debian/</link>
		<comments>http://foobar.lu/wp/2009/10/29/unable-to-easy_install-psycopg2-on-debian/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 15:18:30 +0000</pubDate>
		<dc:creator>exhuma.twn</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://foobar.lu/wp/?p=66</guid>
		<description><![CDATA[Problem:
$ easy_install psycopg2
Searching for psycopg2 &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<h3>Problem:</h3>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;width:530px"><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">$ easy_install psycopg2<br />
Searching for psycopg2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
Reading http://pypi.python.org/simple/psycopg2/ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
Reading http://initd.org/projects/psycopg2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
Reading http://initd.org/pub/software/psycopg/ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
Best match: psycopg2 2.0.13 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
Downloading http://initd.org/pub/software/psycopg/psycopg2-2.0.13.tar.gz &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
Processing psycopg2-2.0.13.tar.gz &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
Running psycopg2-2.0.13/setup.py -q bdist_egg --dist-dir /tmp/easy_install-cHE0C_/psycopg2-2.0.13/egg-dist-tmp-x-CxRS &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
error: Setup script exited with error: No such file or directory</div></div>
<h3>Solution:</h3>
<p>This most likely indicates that you are missing the &#8220;libpq&#8221; headers:</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;width:530px"><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">sudo aptitude install libpq-dev</div></div>
<p>should solve the problem</p>
]]></content:encoded>
			<wfw:commentRss>http://foobar.lu/wp/2009/10/29/unable-to-easy_install-psycopg2-on-debian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend Studio forgetting about your ZF Project</title>
		<link>http://foobar.lu/wp/2009/06/16/zend-studio-forgetting-about-your-zf-project/</link>
		<comments>http://foobar.lu/wp/2009/06/16/zend-studio-forgetting-about-your-zf-project/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 14:40:21 +0000</pubDate>
		<dc:creator>wickeddoc</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://foobar.lu/wp/?p=56</guid>
		<description><![CDATA[as a php developer i&#8217;m using zend studio for eclipse on a daily basis. sometimes zend studio forgets about my zend framework projects, especially projects which are hosted on a SVN repository. i close my project, reopen it, and for no obvious reasons zend studio no longer recognizes it as a zend framework project. huch!?
until [...]]]></description>
			<content:encoded><![CDATA[<p>as a php developer i&#8217;m using zend studio for eclipse on a daily basis. sometimes zend studio forgets about my zend framework projects, especially projects which are hosted on a SVN repository. i close my project, reopen it, and for no obvious reasons zend studio no longer recognizes it as a zend framework project. huch!?</p>
<p>until now i was unable to find a real solution to my problem, but here&#8217;s a little workaround which should get you up and running again, in case you&#8217;re running into the same problem.</p>
<p>close the project, then just open the .project file at the root of your project in your favourite text editor and check the &#8216;natures&#8217; section, make sure it contains the following line:</p>
<div class="codecolorer-container xml twitlight" style="overflow:auto;white-space:nowrap;width:530px"><div class="xml codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="sc3"><span class="re1">&lt;nature<span class="re2">&gt;</span></span></span>org.zend.php.framework.ZendFrameworkNature<span class="sc3"><span class="re1">&lt;/nature<span class="re2">&gt;</span></span></span></div></div>
<p>that should do the trick.</p>
]]></content:encoded>
			<wfw:commentRss>http://foobar.lu/wp/2009/06/16/zend-studio-forgetting-about-your-zf-project/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Add creation and modification timestamps to an Excel worksheet</title>
		<link>http://foobar.lu/wp/2009/02/19/add-creation-and-modification-timestamps-to-an-excel-worksheet/</link>
		<comments>http://foobar.lu/wp/2009/02/19/add-creation-and-modification-timestamps-to-an-excel-worksheet/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 14:14:47 +0000</pubDate>
		<dc:creator>exhuma.twn</dc:creator>
				<category><![CDATA[Coding Voodoo]]></category>

		<guid isPermaLink="false">http://foobar.lu/wp/?p=45</guid>
		<description><![CDATA[Please, for the love of $deity do not hit me&#8230;.. This is going to be a post about excel!
Excel is a horrid solution for data entry, and even worse for data archival. And yet, it&#8217;s one of the most commonly used solutions. One of the most useful information in any given data-set is the information [...]]]></description>
			<content:encoded><![CDATA[<p>Please, for the love of $deity do not hit me&#8230;.. This is going to be a post about excel!</p>
<p>Excel is a horrid solution for data entry, and even worse for data archival. And yet, it&#8217;s one of the most commonly used solutions. One of the most useful information in any given data-set is the information about <em>when</em> the information was <em>created</em> and <em>when</em> it was <em>last modified</em>. This is something that any decent developer in charge of a data collection (let&#8217;s just call it that for now) will add to each data record.</p>
<p>Alas, a lot of non-it people manage and store their data in excel worksheets. And that is OK with me as long as they pay attention to data archival. In it&#8217;s most simple form, data archival can be achieved by storing the data as a CSV file <strong>and</strong> <strong>including</strong> the following metadata:</p>
<ul>
<li>Which column represents which value (the name of the variable)</li>
<li>The data type (number, text, date, &#8230;) of each column</li>
<li>If a column is &#8220;coded&#8221;, please also include the meaning of each code.<br />
For example a &#8220;Yes&#8221;, &#8220;No&#8221;, &#8220;Maybe&#8221; column might be stored as &#8220;1&#8243;, &#8220;2&#8243; and &#8220;3&#8243;. Which means in it&#8217;s most basic nature it&#8217;s a numeric variable, but the different values have a meaning attached to them. So: Add this list in your metadata description.</li>
<li>If any computations or checks are performed on the values, please add them to the metadata document as well!</li>
</ul>
<p>Even if the timestamp values might seem superflous at first, it will be of <strong>great</strong> help to anyone tracing errors in the data. Imagine that you would at some point need to fix some values that were entered/modified during a specific time period for whatever reason. Without this most basic bit of information you will be up for a treat. However, if it&#8217;s been rigurously implemented since the beginning, you&#8217;ll have the problem solved in no time.</p>
<p>Now, each halfway serious database system will offer you this kind of functionality out-of-the-box. But Excel <strong>is no database system</strong> (I intentionally left out the word &#8220;management&#8221; as this issue is a bit more general!). So it does not offer you a straight-forward way to solve this. But even if it&#8217;s not straight-forward, it&#8217;s simple enough for about anyone using Excel do add this bit of information.</p>
<p>Assuming that you use the first two columns (numbered 1 and 2 in excel) of your worksheet to add creation- and modification timestamps simply open up the Visual Basic editor (found in Tools-&gt;Macro or somesuch), next, in your project tree (in the top left of the screen) select your workbook (the .xls file), and in it&#8217;s sub-tree double-click the Worksheet that should have the timestamps set automatically.</p>
<p>Then copy/paste the following text into the just opened code editor and you&#8217;re done. I hope the comments will give some insight as to what happens. Note that in this case I will ignore the first row of the sheet, and obviously, the first two columns. If that does not suit your needs, feel free to change this script to your liking.</p>
<div class="codecolorer-container vb twitlight" style="overflow:auto;white-space:nowrap;width:530px"><div class="vb codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="co1">'<br />
</span><span class="co1">' Callback which is called when a cell in a workbook changes<br />
</span><span class="co1">' @param Target: The cell that changed it's value<br />
</span><span class="co1">'<br />
</span><span class="kw1">Private</span> <span class="kw1">Sub</span> Worksheet_Change(<span class="kw1">ByVal</span> Target <span class="kw1">As</span> Range)<br />
&nbsp; &nbsp;<span class="co1">' We will ignore any changes in the first row, as it contains header labels<br />
</span> &nbsp; <span class="kw1">If</span> Target.Row = 1 <span class="kw1">Then</span> <span class="kw1">Exit</span> <span class="kw1">Sub</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp;<span class="co1">' As we set the values of column 1 and 2 we won't need to capture changes in these either<br />
</span> &nbsp; <span class="kw1">If</span> Target.Column = 1 <span class="kw1">Or</span> Target.Column = 2 <span class="kw1">Then</span> <span class="kw1">Exit</span> <span class="kw1">Sub</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp;<span class="co1">' We will update the timestamp in column 2 *always* (last changed time)<br />
</span> &nbsp; Cells(Target.Row, 2) = Now<br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp;<span class="co1">' We will update the timestamp in column 1 only if it is empty (creation time)<br />
</span> &nbsp; <span class="kw1">If</span> IsEmpty(Cells(Target.Row, 1)) <span class="kw1">Then</span><br />
&nbsp; &nbsp; &nbsp;Cells(Target.Row, 1) = Now<br />
&nbsp; &nbsp;<span class="kw1">End</span> <span class="kw1">If</span><br />
<span class="kw1">End</span> <span class="kw1">Sub</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://foobar.lu/wp/2009/02/19/add-creation-and-modification-timestamps-to-an-excel-worksheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python startup (command completion &amp; history)</title>
		<link>http://foobar.lu/wp/2008/08/21/python-startup-command-completion-history/</link>
		<comments>http://foobar.lu/wp/2008/08/21/python-startup-command-completion-history/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 11:18:17 +0000</pubDate>
		<dc:creator>exhuma.twn</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://foobar.lu/wp/2008/08/21/python-startup-command-completion-history/</guid>
		<description><![CDATA[If you want command completion and a history in your python shell, export the PYTHONSTARTUP env var (export PYTHONSTARTUP=$HOME/.pystartup) in your bashrc and create a file ~/.pystartup with the following contents:
import atexit
import os
import readline
import rlcompleter

historyPath = os.path.expanduser&#40;&#34;~/.pyhistory&#34;&#41;

def save_history&#40;historyPath=historyPath&#41;:
import readline
readline.write_history_file&#40;historyPath&#41;

if os.path.exists&#40;historyPath&#41;:
readline.read_history_file&#40;historyPath&#41;

readline.parse_and_bind&#40;'tab: complete'&#41;

atexit.register&#40;save_history&#41;
del os, atexit, readline, rlcompleter, save_history, historyPath
]]></description>
			<content:encoded><![CDATA[<p>If you want command completion and a history in your python shell, export the <em>PYTHONSTARTUP</em> env var (<em>export PYTHONSTARTUP=$HOME/.pystartup) </em>in your bashrc and create a file ~/.pystartup with the following contents:</p>
<div class="codecolorer-container python twitlight" style="overflow:auto;white-space:nowrap;width:530px"><div class="python codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="kw1">import</span> <span class="kw3">atexit</span><br />
<span class="kw1">import</span> <span class="kw3">os</span><br />
<span class="kw1">import</span> <span class="kw3">readline</span><br />
<span class="kw1">import</span> <span class="kw3">rlcompleter</span><br />
<br />
historyPath = <span class="kw3">os</span>.<span class="me1">path</span>.<span class="me1">expanduser</span><span class="br0">&#40;</span><span class="st0">&quot;~/.pyhistory&quot;</span><span class="br0">&#41;</span><br />
<br />
<span class="kw1">def</span> save_history<span class="br0">&#40;</span>historyPath=historyPath<span class="br0">&#41;</span>:<br />
<span class="kw1">import</span> <span class="kw3">readline</span><br />
<span class="kw3">readline</span>.<span class="me1">write_history_file</span><span class="br0">&#40;</span>historyPath<span class="br0">&#41;</span><br />
<br />
<span class="kw1">if</span> <span class="kw3">os</span>.<span class="me1">path</span>.<span class="me1">exists</span><span class="br0">&#40;</span>historyPath<span class="br0">&#41;</span>:<br />
<span class="kw3">readline</span>.<span class="me1">read_history_file</span><span class="br0">&#40;</span>historyPath<span class="br0">&#41;</span><br />
<br />
<span class="kw3">readline</span>.<span class="me1">parse_and_bind</span><span class="br0">&#40;</span><span class="st0">'tab: complete'</span><span class="br0">&#41;</span><br />
<br />
<span class="kw3">atexit</span>.<span class="me1">register</span><span class="br0">&#40;</span>save_history<span class="br0">&#41;</span><br />
<span class="kw1">del</span> <span class="kw3">os</span>, <span class="kw3">atexit</span>, <span class="kw3">readline</span>, <span class="kw3">rlcompleter</span>, save_history, historyPath</div></div>
]]></content:encoded>
			<wfw:commentRss>http://foobar.lu/wp/2008/08/21/python-startup-command-completion-history/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simplifying a polygon</title>
		<link>http://foobar.lu/wp/2008/02/10/simplifying-a-polygon/</link>
		<comments>http://foobar.lu/wp/2008/02/10/simplifying-a-polygon/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 21:50:50 +0000</pubDate>
		<dc:creator>exhuma.twn</dc:creator>
				<category><![CDATA[Coding Voodoo]]></category>

		<guid isPermaLink="false">http://foobar.lu/wp/2008/02/10/simplifying-a-polygon/</guid>
		<description><![CDATA[As you may know, polygons are sensitive to the ordering in which vertices are put in. What is more, the normals of a polygon face depend on the direction of the face.
This usually is not a problem when the polygon is constructed by a graphics-savvy person. If, however (as in my case), the polygons are [...]]]></description>
			<content:encoded><![CDATA[<p>As you may know, polygons are sensitive to the ordering in which vertices are put in. What is more, the normals of a polygon face depend on the direction of the face.</p>
<p>This usually is not a problem when the polygon is constructed by a graphics-savvy person. If, however (as in my case), the polygons are edited in a user frontend, and if the target audience for that UI may not be aware of the problem, you might run into trouble.</p>
<p>I strongly believe, that details like this should be hidden from the less technically-inclined people, so they can get thei job done without swearing at the UI. And therefore be more productive. This piece of javascript allows you to &#8220;simplify&#8221;an array of 2D-Points by sorting it accordingly. The resulting array will construct a simple polygon with always outward-facing normals.</p>
<p>This uses the well-known paradigm of taking a reference point and then &#8220;swiping&#8221; counter-clockwise over the available points. Depending on the reference point (and the available vertices), the end-results may vary. So it may not really result in what the user expected. Having an undo ready at hand should prove useful. However, this algorithm assumes the most likely case, in which the reference point is set to the centroid of the polygon.</p>
<p>The entry-point function is this algorithm is &#8220;simplify_polygon&#8221;. Feel free to play around with it. Documentation is sparse, but if you know your trig you should figure it out by yourself. It&#8217;s fairly straightforward.</p>
<p>Note: The 4-way branch in the &#8220;angle&#8221; function could be simplified. It is as it is because my mind was locked in the 4 quadrants when writing it. Didn&#8217;t feel like changing it yet <img src='http://foobar.lu/wp/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><span id="more-35"></span></p>
<div class="codecolorer-container javascript twitlight" style="overflow:auto;white-space:nowrap;width:530px;height:400px"><div class="javascript codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="coMULTI">/*<br />
&nbsp;* Calculate the centroid of an array of 2D points<br />
&nbsp;*/</span><br />
<span class="kw2">function</span> centroid<span class="br0">&#40;</span>arr<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp;<span class="kw2">var</span> sumx<span class="sy0">=</span><span class="nu0">0</span><span class="sy0">;</span><br />
&nbsp; &nbsp;<span class="kw2">var</span> sumy<span class="sy0">=</span><span class="nu0">0</span><span class="sy0">;</span><br />
&nbsp; &nbsp;<span class="kw2">var</span> count<span class="sy0">=</span><span class="nu0">0</span><span class="sy0">;</span><br />
&nbsp; &nbsp;<span class="kw1">for</span> <span class="br0">&#40;</span>i <span class="kw1">in</span> arr<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; sumx <span class="sy0">+=</span> arr<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; sumy <span class="sy0">+=</span> arr<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; count<span class="sy0">++;</span><br />
&nbsp; &nbsp;<span class="br0">&#125;</span><br />
&nbsp; &nbsp;<span class="kw1">return</span> <span class="kw2">new</span> Array<span class="br0">&#40;</span> sumx<span class="sy0">/</span>count<span class="sy0">,</span> sumy<span class="sy0">/</span>count <span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span><br />
<br />
<span class="coMULTI">/*<br />
&nbsp;* Calculate the dotproduct of 2 2D vectors<br />
&nbsp;*/</span><br />
<span class="kw2">function</span> dotproduct<span class="br0">&#40;</span>a<span class="sy0">,</span> b<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp;<span class="kw1">return</span> a<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">*</span>b<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">+</span>a<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="sy0">*</span>b<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span><br />
<br />
<span class="coMULTI">/*<br />
&nbsp;* Return the euclidian distance between 2 2D-points<br />
&nbsp;*/</span><br />
<span class="kw2">function</span> distance<span class="br0">&#40;</span>a<span class="sy0">,</span> b<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp;<span class="kw2">var</span> dx <span class="sy0">=</span> a<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">-</span>b<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp;<span class="kw2">var</span> dy <span class="sy0">=</span> a<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="sy0">-</span>b<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp;<span class="kw1">return</span> Math.<span class="me1">sqrt</span><span class="br0">&#40;</span>Math.<span class="me1">pow</span><span class="br0">&#40;</span>dx<span class="sy0">,</span><span class="nu0">2</span><span class="br0">&#41;</span> <span class="sy0">+</span> Math.<span class="me1">pow</span><span class="br0">&#40;</span>dy<span class="sy0">,</span><span class="nu0">2</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="br0">&#125;</span><br />
<br />
<span class="coMULTI">/*<br />
&nbsp;* Convert radians to degrees<br />
&nbsp;*/</span><br />
<span class="kw2">function</span> deg<span class="br0">&#40;</span>rad<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw1">return</span> <span class="br0">&#40;</span><span class="nu0">180</span> <span class="sy0">/</span> Math.<span class="me1">PI</span><span class="br0">&#41;</span> <span class="sy0">*</span> rad<span class="sy0">;</span><br />
<span class="br0">&#125;</span><br />
<br />
<span class="coMULTI">/*<br />
&nbsp;* Calculate the angle between two 2D-Vectors with an optional reference point<br />
&nbsp;*/</span><br />
<span class="kw2">function</span> angle<span class="br0">&#40;</span>a<span class="sy0">,</span> b<span class="sy0">,</span> ref<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp;<span class="kw1">if</span> <span class="br0">&#40;</span>ref <span class="sy0">==</span> undefined<span class="br0">&#41;</span> <span class="br0">&#123;</span> ref <span class="sy0">=</span> <span class="kw2">new</span> Array<span class="br0">&#40;</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">0</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="br0">&#125;</span><br />
&nbsp; &nbsp;<span class="kw2">var</span> shifted_a <span class="sy0">=</span> <span class="kw2">new</span> Array<span class="br0">&#40;</span> a<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">-</span>ref<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">,</span> a<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="sy0">-</span>ref<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp;<span class="kw2">var</span> shifted_b <span class="sy0">=</span> <span class="kw2">new</span> Array<span class="br0">&#40;</span> b<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">-</span>ref<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">,</span> b<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="sy0">-</span>ref<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="br0">&#41;</span><span class="sy0">;</span><br />
<br />
&nbsp; &nbsp;<span class="kw2">var</span> dx <span class="sy0">=</span> &nbsp;b<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span> <span class="sy0">-</span> ref<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp;<span class="kw2">var</span> dy <span class="sy0">=</span> &nbsp;b<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span> <span class="sy0">-</span> ref<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp;<span class="kw2">var</span> origin <span class="sy0">=</span> <span class="kw2">new</span> Array<span class="br0">&#40;</span><span class="nu0">0</span><span class="sy0">,</span><span class="nu0">0</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<br />
&nbsp; &nbsp;<span class="kw1">if</span> <span class="br0">&#40;</span>dx <span class="sy0">&gt;=</span> <span class="nu0">0</span> <span class="sy0">&amp;&amp;</span> dy <span class="sy0">&gt;=</span> <span class="nu0">0</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">var</span> dp <span class="sy0">=</span> dotproduct<span class="br0">&#40;</span>shifted_a<span class="sy0">,</span> shifted_b<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">var</span> norm <span class="sy0">=</span> distance<span class="br0">&#40;</span>origin<span class="sy0">,</span> shifted_a<span class="br0">&#41;</span> <span class="sy0">*</span> distance<span class="br0">&#40;</span>origin<span class="sy0">,</span> shifted_b<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw1">return</span> deg<span class="br0">&#40;</span> Math.<span class="me1">acos</span><span class="br0">&#40;</span> dp <span class="sy0">/</span> <span class="br0">&#40;</span> norm <span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp;<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">&#40;</span>dx <span class="sy0">&lt;</span> <span class="nu0">0</span> <span class="sy0">&amp;&amp;</span> dy <span class="sy0">&gt;</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">var</span> dp <span class="sy0">=</span> dotproduct<span class="br0">&#40;</span>shifted_a<span class="sy0">,</span> shifted_b<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">var</span> norm <span class="sy0">=</span> distance<span class="br0">&#40;</span>origin<span class="sy0">,</span> shifted_a<span class="br0">&#41;</span><span class="sy0">*</span>distance<span class="br0">&#40;</span>origin<span class="sy0">,</span> shifted_b<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw1">return</span> deg<span class="br0">&#40;</span> Math.<span class="me1">acos</span><span class="br0">&#40;</span> dp <span class="sy0">/</span> <span class="br0">&#40;</span> norm <span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp;<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">&#40;</span>dx <span class="sy0">&lt;</span> <span class="nu0">0</span> <span class="sy0">&amp;&amp;</span> dy <span class="sy0">&lt;</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">var</span> dp <span class="sy0">=</span> dotproduct<span class="br0">&#40;</span>shifted_a<span class="sy0">,</span> shifted_b<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">var</span> norm <span class="sy0">=</span> distance<span class="br0">&#40;</span>origin<span class="sy0">,</span> shifted_a<span class="br0">&#41;</span><span class="sy0">*</span>distance<span class="br0">&#40;</span>origin<span class="sy0">,</span> shifted_b<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="nu0">360</span><span class="sy0">-</span>deg<span class="br0">&#40;</span> Math.<span class="me1">acos</span><span class="br0">&#40;</span> dp <span class="sy0">/</span> <span class="br0">&#40;</span> norm <span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp;<span class="br0">&#125;</span> <span class="kw1">else</span> <span class="kw1">if</span> <span class="br0">&#40;</span>dx <span class="sy0">&gt;</span> <span class="nu0">0</span> <span class="sy0">&amp;&amp;</span> dy <span class="sy0">&lt;</span> <span class="nu0">0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">var</span> dp <span class="sy0">=</span> dotproduct<span class="br0">&#40;</span>shifted_a<span class="sy0">,</span> shifted_b<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">var</span> norm <span class="sy0">=</span> distance<span class="br0">&#40;</span>origin<span class="sy0">,</span> shifted_a<span class="br0">&#41;</span><span class="sy0">*</span>distance<span class="br0">&#40;</span>origin<span class="sy0">,</span> shifted_b<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="nu0">360</span><span class="sy0">-</span>deg<span class="br0">&#40;</span> Math.<span class="me1">acos</span><span class="br0">&#40;</span> dp <span class="sy0">/</span> <span class="br0">&#40;</span> norm <span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp;<span class="br0">&#125;</span><br />
<span class="br0">&#125;</span><br />
<br />
<span class="coMULTI">/*<br />
&nbsp;* Re-orders the vertices given in &lt;pts&gt; such that a simple polygon<br />
&nbsp;* will be constructed.<br />
&nbsp;*/</span><br />
<span class="kw2">function</span> simplify_polygon<span class="br0">&#40;</span>pts<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp;<span class="kw2">var</span> pts2 <span class="sy0">=</span> <span class="kw2">new</span> Array<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp;<span class="kw2">var</span> c <span class="sy0">=</span> centroid<span class="br0">&#40;</span>pts<span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp;<span class="kw2">var</span> r <span class="sy0">=</span> <span class="kw2">new</span> Array<span class="br0">&#40;</span>c<span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">+</span><span class="nu0">10</span><span class="sy0">,</span> c<span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp;<span class="kw1">for</span> <span class="br0">&#40;</span>i <span class="kw1">in</span> pts<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; pts2<span class="br0">&#91;</span>pts2.<span class="me1">length</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="kw2">new</span> Array<span class="br0">&#40;</span>pts<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">0</span><span class="br0">&#93;</span><span class="sy0">,</span> pts<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="br0">&#91;</span><span class="nu0">1</span><span class="br0">&#93;</span><span class="sy0">,</span> angle<span class="br0">&#40;</span>r<span class="sy0">,</span> pts<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="sy0">,</span> c<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp;<span class="br0">&#125;</span><br />
&nbsp; &nbsp;pts2.<span class="me1">sort</span><span class="br0">&#40;</span><span class="kw2">function</span> compare<span class="br0">&#40;</span>a<span class="sy0">,</span>b<span class="br0">&#41;</span><span class="br0">&#123;</span> <span class="kw1">return</span> a<span class="br0">&#91;</span><span class="nu0">2</span><span class="br0">&#93;</span><span class="sy0">-</span>b<span class="br0">&#91;</span><span class="nu0">2</span><span class="br0">&#93;</span><span class="sy0">;</span> <span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
&nbsp; &nbsp;<span class="kw1">for</span> <span class="br0">&#40;</span>i <span class="kw1">in</span> pts2<span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; pts<span class="br0">&#91;</span>i<span class="br0">&#93;</span> <span class="sy0">=</span> pts2<span class="br0">&#91;</span>i<span class="br0">&#93;</span><span class="sy0">;</span><br />
&nbsp; &nbsp;<span class="br0">&#125;</span><br />
&nbsp; &nbsp;<span class="kw1">return</span> pts<span class="sy0">;</span><br />
<span class="br0">&#125;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://foobar.lu/wp/2008/02/10/simplifying-a-polygon/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Vim script (mapping) to generate python getters and setters</title>
		<link>http://foobar.lu/wp/2007/12/31/vim-script-mapping-to-generate-python-getters-and-setters/</link>
		<comments>http://foobar.lu/wp/2007/12/31/vim-script-mapping-to-generate-python-getters-and-setters/#comments</comments>
		<pubDate>Mon, 31 Dec 2007 09:59:46 +0000</pubDate>
		<dc:creator>exhuma.twn</dc:creator>
				<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://foobar.lu/wp/2007/12/31/vim-script-mapping-to-generate-python-getters-and-setters/</guid>
		<description><![CDATA[Somethin that I need quite often is to create custom accessors and mutators for class-attributes. For example convert this:
class MyClass&#40;object&#41;:
&#160; &#160;
&#160; &#160;def __init__&#40;self&#41;:
&#160; &#160; &#160; self.has_changes = False
&#160; &#160; &#160; self.some_attribute = False
into this:
class MyClass&#40;object&#41;:
&#160; &#160;
&#160; &#160;def __init__&#40;self&#41;:
&#160; &#160; &#160; self.__has_changes = False
&#160; &#160; &#160; self.__some_attribute = False

&#160; &#160;def get_some_attribute&#40;self&#41;:
&#160; &#160; &#160; &#34;Accessor: some_attribute&#34;
&#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Somethin that I need quite often is to create custom accessors and mutators for class-attributes. For example convert this:</p>
<div class="codecolorer-container python twitlight" style="overflow:auto;white-space:nowrap;width:530px"><div class="python codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="kw1">class</span> MyClass<span class="br0">&#40;</span><span class="kw2">object</span><span class="br0">&#41;</span>:<br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp;<span class="kw1">def</span> <span class="kw4">__init__</span><span class="br0">&#40;</span><span class="kw2">self</span><span class="br0">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">has_changes</span> = <span class="kw2">False</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.<span class="me1">some_attribute</span> = <span class="kw2">False</span></div></div>
<p>into this:</p>
<div class="codecolorer-container python twitlight" style="overflow:auto;white-space:nowrap;width:530px"><div class="python codecolorer" style="font-family:Monaco,Lucida Console,monospace"><span class="kw1">class</span> MyClass<span class="br0">&#40;</span><span class="kw2">object</span><span class="br0">&#41;</span>:<br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp;<span class="kw1">def</span> <span class="kw4">__init__</span><span class="br0">&#40;</span><span class="kw2">self</span><span class="br0">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.__has_changes = <span class="kw2">False</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.__some_attribute = <span class="kw2">False</span><br />
<br />
&nbsp; &nbsp;<span class="kw1">def</span> get_some_attribute<span class="br0">&#40;</span><span class="kw2">self</span><span class="br0">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; <span class="st0">&quot;Accessor: some_attribute&quot;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="kw2">self</span>.__some_attribute<br />
<br />
&nbsp; &nbsp;<span class="kw1">def</span> set_some_attribute<span class="br0">&#40;</span><span class="kw2">self</span>, <span class="kw2">input</span><span class="br0">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; <span class="st0">&quot;Mutator: some_attribute&quot;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.__some_attribute = <span class="kw2">input</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw2">self</span>.__has_changes = <span class="kw2">True</span><br />
<br />
&nbsp; &nbsp;some_attribute = <span class="kw2">property</span><span class="br0">&#40;</span>get_some_attribute, set_some_attribute<span class="br0">&#41;</span><br />
<br />
&nbsp; &nbsp;<span class="kw1">def</span> get_has_changes<span class="br0">&#40;</span><span class="kw2">self</span><span class="br0">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; <span class="st0">&quot;Accessor: has_changes&quot;</span><br />
&nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="kw2">self</span>.__has_changes<br />
<br />
&nbsp; &nbsp;has_changes = <span class="kw2">property</span><span class="br0">&#40;</span>get_has_changes<span class="br0">&#41;</span></div></div>
<p>This particular example allows an easy tracking if a class contains changes. Without the need of calling <tt>myclass.get_some_attribute()</tt> or <tt>myclass.set_some_attribute(foo)</tt>. You can simply do <tt>myclass.some_attribute = foo</tt> and the <tt>has_changes</tt> attribut will change accordingly.</p>
<p>If your class has many attributes, writing custom accessors and mutators can be tedious. So here&#8217;s a small Vim-mapping that get&#8217;s you started. Sure, you may still need to fine-tune some generated code, but the bulk is there.</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;width:530px"><div class="text codecolorer" style="font-family:Monaco,Lucida Console,monospace">&lt;font color=&quot;#808bed&quot;&gt;nmap&lt;/font&gt; &lt;font color=&quot;#c080d0&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;F6&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&lt;/font&gt; yyP&lt;font color=&quot;#c080d0&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;home&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&lt;/font&gt;widef get_&lt;font color=&quot;#c080d0&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;end&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&lt;/font&gt;(self):&lt;font color=&quot;#c080d0&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;esc&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;down&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;esc&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&lt;/font&gt;yyP&amp;gt;&amp;gt;I&amp;quot;Accessor: &lt;font color=&quot;#c080d0&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;end&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&lt;/font&gt;&amp;quot;&lt;font color=&quot;#c080d0&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;esc&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;down&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&lt;/font&gt;yyP&amp;gt;&amp;gt;Ireturn self.__&lt;font color=&quot;#c080d0&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;esc&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&lt;/font&gt;o&lt;font color=&quot;#c080d0&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;esc&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;down&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&lt;/font&gt;yyPIdef set_&lt;font color=&quot;#c080d0&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;end&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&lt;/font&gt;(self, input):&lt;font color=&quot;#c080d0&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;esc&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;down&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&lt;/font&gt;yyP&amp;gt;&amp;gt;I&amp;quot;Mutator: &lt;font color=&quot;#c080d0&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;end&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&lt;/font&gt;&amp;quot;&lt;font color=&quot;#c080d0&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;esc&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;down&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&lt;/font&gt;yyP&amp;gt;&amp;gt;Iself.__&lt;font color=&quot;#c080d0&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;end&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&lt;/font&gt; = input&lt;font color=&quot;#c080d0&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;esc&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&lt;/font&gt;o&lt;font color=&quot;#c080d0&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;esc&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;down&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;home&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&lt;/font&gt;wveyA = property(get_&lt;font color=&quot;#c080d0&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;esc&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&lt;/font&gt;pA, set_&lt;font color=&quot;#c080d0&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;esc&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&lt;/font&gt;pA)&lt;font color=&quot;#c080d0&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;esc&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&lt;/font&gt;o&lt;font color=&quot;#c080d0&quot;&gt;&amp;lt;&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;esc&lt;/font&gt;&lt;font color=&quot;#c080d0&quot;&gt;&amp;gt;&lt;/font&gt;</div></div>
<p>Put this into your vimrc, or (like I do) into the ~/.vim/ftplugin/python.vim file so it get&#8217;s only loaded for python files. Then you only need to write the attribute name of the class, put your cursor on that line, be sure to be in normal mode (hit a few time &lt;esc&gt;) <img src='http://foobar.lu/wp/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  and hit F6</p>
<p>If you want to change the shortcut, simply change the first parameter to this mapping line.</p>
]]></content:encoded>
			<wfw:commentRss>http://foobar.lu/wp/2007/12/31/vim-script-mapping-to-generate-python-getters-and-setters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Schneiderman&#8217;s Golden Rules</title>
		<link>http://foobar.lu/wp/2007/10/19/schneidermans-golden-rules/</link>
		<comments>http://foobar.lu/wp/2007/10/19/schneidermans-golden-rules/#comments</comments>
		<pubDate>Fri, 19 Oct 2007 08:55:24 +0000</pubDate>
		<dc:creator>exhuma.twn</dc:creator>
				<category><![CDATA[Coding Voodoo]]></category>

		<guid isPermaLink="false">http://foobar.lu/wp/2007/10/19/schneidermans-golden-rules/</guid>
		<description><![CDATA[NEVER forget these simple rules. Every computer application with a user interface will benefit from them.
It&#8217;s really worth it. People will love you for it. Trust me  
I personally find that using an ordered list is somewhat misleading. Every point should be considered with equal importance. That&#8217;s why I will change to &#8220;ol&#8221; tag [...]]]></description>
			<content:encoded><![CDATA[<p><strong>NEVER</strong> forget these simple rules. <strong>Every</strong> computer application with a user interface <em>will</em> benefit from them.</p>
<p>It&#8217;s really worth it. People will love you for it. Trust me <img src='http://foobar.lu/wp/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>I personally find that using an ordered list is somewhat misleading. Every point should be considered with equal importance. That&#8217;s why I will change to &#8220;ol&#8221; tag to an &#8220;ul&#8221; tag now <img src='http://foobar.lu/wp/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<ul>
<li><strong>Strive for consistency.</strong> As we shall see below, it is important for a user interface to be consistent on many levels. For example, screen layouts should be consistent from one screen to another. In an environment using a graphical user interface (GUI), this also implies consistency from one application to another. </li>
<li><strong>Enable frequent users to use shortcuts.</strong> Frequent users (or, power users) may be turned off by overly tedious procedures. Allow those users a less tedious procedure for accomplishing a given task.</li>
<li><strong>Offer informative feedback.</strong> Users need to see the consequences of their actions. If a user enters a command but the computer does not show that it is either processing or has processed that command, this can leave the user confused and disoriented.</li>
<li><strong>Design dialogues to yield closure.</strong> Interacting with a computer is somewhat like a dialogue or conversation. Every task should have a beginning, a middle and an end. It is important for the user to know when a task is at its end. The user needs to have the feeling that a task has reached closure.</li>
<li><strong>Offer simple error handling.</strong> User errors should be designed into the system. Another way of stating this is that no user action should be considered an error that is beyond the ability of the system to manage. If the user makes a mistake, the user should receive useful, concise and clear information about the nature of the mistake. It should be easy for the user to undo his or her mistake.</li>
<li><strong>Permit easy reversal of actions.</strong> More generally, users must be permitted to undo what they have done, whether it is in the nature of an error or not.</li>
<li><strong>Support internal locus of control.</strong> User satisfaction is high when the user feels that he or she is in control and user satisfaction is low when the user feels that the computer is in control. Design interfaces to reinforce the feeling that the user is the focus of control in the human-computer interaction.</li>
<li><strong>Reduce short-term memory load.</strong> Human short-term memory is remarkably limited. Psychologists often quote Miller&#8217;s law to the effect that short-term memory is limited to seven discrete pieces of information. Do everything possible to free the user&#8217;s memory burden. For example, instead of asking the user to type in the name of a file which is going to be retrieved, present the user with a list of files currently available.</li>
</ul>
<p>See page 74-75 Scheiderman: Designing the User Interface, 3rd</p>
]]></content:encoded>
			<wfw:commentRss>http://foobar.lu/wp/2007/10/19/schneidermans-golden-rules/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
