<?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>Jory's blog &#187; Programming</title>
	<atom:link href="http://blog.jorygeerts.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.jorygeerts.com</link>
	<description>Just another WordPress weblog, or something like that</description>
	<lastBuildDate>Tue, 20 Jul 2010 20:57:54 +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>Life Changes</title>
		<link>http://blog.jorygeerts.com/2009/10/11/an-update-on-me/</link>
		<comments>http://blog.jorygeerts.com/2009/10/11/an-update-on-me/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 14:15:06 +0000</pubDate>
		<dc:creator>Jory</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[My life]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.jorygeerts.com/?p=57</guid>
		<description><![CDATA[A bunch of things changed in my life recently. Some big changes, other small. The first of these, is the half year internship at GeoTax I started on september first. At GeoTax, they develop software to help municipalities execute a bunch of Dutch laws. My job there is that of software developer. They use a [...]]]></description>
			<content:encoded><![CDATA[<p>A bunch of things changed in my life recently. Some big changes, other small. The first of these, is the half year internship at <a title="Go to the website of my employer for the next five or so months" href="http://www.geotax.nl/">GeoTax</a> I started on september first. At GeoTax, they develop software to help <a title="Difficult word, huh. I didn't know it either untill I tried to translate 'gemeente'." href="http://en.wikipedia.org/wiki/Municipality">municipalities</a> execute a bunch of Dutch laws. My job there is that of software developer. They use a pretty cool enviroment with a lot of new toys for me to play with. (Or one, Oracle. Another is JBoss Application Server.) I&#8217;m really enjoying it there &#8211; lots of nice and really smart people, a great project to work on. The money is nice too, and I really don&#8217;t mind working from 8.30 to 5. What does suck, is that in order to be there at 8.30 I have to leave my house at 7.15, and I&#8217;m normally home around 6.10.</p>
<p>Another thing that changed, is that for a few months now, I&#8217;v been doing squash. Its a pretty fun game and I&#8217;m really feeling better, healthier then I did back when I didn&#8217;t do any sports. (Even though since I started at GeoTax I&#8217;ve been less active when you look at the total picture &#8211; I go there by train, while I used to go to school on my bike, which is a 45 minute drive.) Its strange how two 45 minute sessions a week (which is my goal) can make you feel like you have way more energy.</p>
<p>Between the internship and squashing, I have way less time then I used to. As a result of that, I&#8217;m making much less hours at work these days (not that big an issue, as the internship also pays pretty good), I&#8217;ve had to cut back on the TV shows I follow (all good shows got cancelled anyway) and I&#8217;m reading far less (as in, from a few chapters a day, to one or two a week). I&#8217;m also spending much less time online. I don&#8217;t read half the articles I would have read if I had the time, and my activity at Zetaboards Support has dropped to an all time low.</p>
<p>Oh, and I have a girlfriend these days. I try to spend what little free time I have with her.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jorygeerts.com/2009/10/11/an-update-on-me/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Tricking browsers that are storing passwords</title>
		<link>http://blog.jorygeerts.com/2008/02/09/tricking-browsers-that-are-storing-passwords/</link>
		<comments>http://blog.jorygeerts.com/2008/02/09/tricking-browsers-that-are-storing-passwords/#comments</comments>
		<pubDate>Sat, 09 Feb 2008 15:55:53 +0000</pubDate>
		<dc:creator>Jory</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[The Internet]]></category>

		<guid isPermaLink="false">http://blog.jorygeerts.com/2008/02/09/tricking-browsers-that-are-storing-passwords/</guid>
		<description><![CDATA[For a system that I&#8217;m working on that I plan to, at some point, release as open source product, I am going to implement a system so that, to get the specific pages, you need to enter your password even if you are logged in. If you do, you will remain &#8220;super-authed&#8221; untill you close [...]]]></description>
			<content:encoded><![CDATA[<p>For a system that I&#8217;m working on that I plan to, at some point, release as open source product, I am going to implement a system so that, to get the specific pages, you need to enter your password even if you are logged in. If you do, you will remain &#8220;super-authed&#8221; untill you close the browser. This would prevent, ie, my little sister to use my laptop, go to my website and have full power because I&#8217;m still logged in. But as I was working on it, a question arose: How good is this, taking into account that most people will just end up storing the password in their browser. Obviously, there are ways around that. (Using a random name for the password field each time is probally enough.) But, by doing that, I will be breaking browser functionalities. Do I really want to do that?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jorygeerts.com/2008/02/09/tricking-browsers-that-are-storing-passwords/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Error reporting</title>
		<link>http://blog.jorygeerts.com/2007/12/29/error-reporting/</link>
		<comments>http://blog.jorygeerts.com/2007/12/29/error-reporting/#comments</comments>
		<pubDate>Sat, 29 Dec 2007 20:30:45 +0000</pubDate>
		<dc:creator>Jory</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.jorygeerts.com/2007/12/29/error-reporting/</guid>
		<description><![CDATA[This has been a draft for a while, so things are probally outdated but I&#8217;m still wondering about this, so here goes&#8230; I have been doing a lot more PHP lately then I have in a long while and that, plus the prospect of a pretty big project I will hopefully start on during the [...]]]></description>
			<content:encoded><![CDATA[<p><em>This has been a draft for a while, so things are probally outdated but I&#8217;m still wondering about this, so here goes&#8230;</em></p>
<p>I have been doing a lot more PHP lately then I have in a long while and that, plus the prospect of a pretty big project I will hopefully start on during the summer, made me think a bit about error reporting. I&#8217;m not talking about E_ALL vs E_, err, 0. I&#8217;m talking about what to tell the user when either (s)he or the application screws up.<br />
<span id="more-30"></span><br />
As explaining is easier by example, here&#8217;s one: your application has a login section which grants access to who knows what. A user wants to log in, has the correct username but the wrong password. Do you simple tell them &#8220;invalid credentials&#8221; or is it something along the lines of &#8220;Sorry, $prettyusername, but the password you provided does not match the one in our database. You may try again[link to #login]. You can also recover your password[link to password recovery]&#8220;?<br />
From where I stand, both have there up- and downsides. Just telling them they didn&#8217;t enter valid credentials isn&#8217;t anywhere near userfriendly, but if the user is someone who is trying to break into the application I don&#8217;t want to tell them anything.</p>
<p>So, what is more important, being friendly to your users or giving people that try to break in as little help as possible?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jorygeerts.com/2007/12/29/error-reporting/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Know what to use where</title>
		<link>http://blog.jorygeerts.com/2007/01/11/know-what-to-use-where/</link>
		<comments>http://blog.jorygeerts.com/2007/01/11/know-what-to-use-where/#comments</comments>
		<pubDate>Thu, 11 Jan 2007 19:16:09 +0000</pubDate>
		<dc:creator>Jory</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.jorygeerts.com/2007/01/11/know-what-to-use-where/</guid>
		<description><![CDATA[Making something in PHP isn&#8217;t hard. Things get harder when it needs to be secure and when speed becomes relevant. But what to do when things really have to be at there absolute fastest? What if every &#181;second counts? What if a single extra CPU cycle needed to run your script can cost a man [...]]]></description>
			<content:encoded><![CDATA[<p>Making something in PHP isn&#8217;t hard. Things get harder when it needs to be secure and when speed becomes relevant. But what to do when things really have to be at there absolute fastest? What if every &micro;second counts? What if a single extra CPU cycle needed to run your script can cost a man his life? Read on.<br />
<span id="more-18"></span>Ok, so an extra CPU cycle needed to run a PHP script won&#8217;t save lives.. I thought it sounded nice.<br />
I oftenly see people use functions in places where, sure, they work, but others would do the exact same, much faster. And to be honest, I can&#8217;t blame those people. Its not like there is a guide on it (if there is / you have one, leave a comment with the URL, please. Thanks.) and figuring out what function can do something the fastest requires you to know all functions that can do what you want, plus doing some decent testing on all of them. The latter is a big problem, &#8217;cause as we all know, us programmers are lazy. <img src='http://blog.jorygeerts.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Anyway, for those that really are, I&#8217;m going to post some of the benchmarks I ran myself on stuff.</p>
<h3 id="#how-i-benchmark">How I benchmark</h3>
<p>First a short elaboration on how I run my benchmarks.<br />
I benchmark things at a verry basic level. Setup some stuff, start a timer, do something xx times (normally 100,000 or 1,000,000, though it may be up or down a zero for verry light or heavy things.), run what I&#8217;m comparing it against the same ammoung of times, print out how long both took. Like I said, <em>verry</em> basic. <img src='http://blog.jorygeerts.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  <small>Note to self: Finish that class for automating this, soon..</small><br />
For those who care: I run stuff on a Intel Pentium 4, 3066 MHz (23 x 133) (Northwood HyperThreading), 2 X Corsair VS1GB400C3, plugged into a MSI MS-6575E motherboard. My OS of use is Windows XP Professional running Apache/2.0.59 &amp; PHP/5.2.0. (That about sums it up, right?)</p>
<h3 id="isset-vs-array_key_exists">isset() vs array_key_exists()</h3>
<p><small>Note that there is a difference between the two. isset($array[$index]) returns false even if it is actually set to NULL, whereas array_key_exists() returns true. Thank you Jeremy for pointing this out.</small>For a project I&#8217;m working on with <a href="http://pmurdoch.com/blog/">Pete</a>, I&#8217;m oftenly checking if an index is set in a array. I normally use <a href="http://php.net/isset">isset</a> to do this, but sometimes, for no reason, use <a href="http://php.net/array_key_exists">array_key_exists()</a> instead. When I looked over some code I has written, I noticed this, and decided to see which is better. I used an array containing incremently more letters of the alphabet, untill an element held all. (So 0 => &#8216;a&#8217;, 1 => &#8216;ab&#8217;,&#8230;24 => &#8216;abc&#8230;xyz&#8217;) I then had both isset() and array_key_exists() check elements 0 trough 26 (of which all but 26 would be set) 1,000,000 times. (So, 27,000,000 calls to both functions.) There are the results:<br />
<blockquote>In total, this benchmark took 16.87498 seconds.<br />
Times where spend like this:<br />
isset() took 1.5900671482 seconds.<br />
array_key_exists() took 15.2848100662 seconds.</p></blockquote>
<p>This suprised me, as I would have assumed array_key_exists would be faster. I then wondered, would there be a difference if the keys would be alphanumerical, instead of just numerical?<br />
So, first, I made another benchmark. It was exactly the same, except for the array used; it now was array(&#8216;a&#8217; => &#8216;a&#8217;,&#8230;&#8217;abc..xyz&#8217;=>&#8217;abc&#8230;xyz&#8217;); I did still have both functions check if a numerical value was set. While not 100% unexpectable, this didn&#8217;t seem to make a big difference. I then had the functions call the alphanumerical indexes (&#8216;a&#8217; => &#8216;abc..xyz&#8217;) and as 27th check, I used &#8216;zyx..cba&#8217;. My results:<br />
<blockquote>In total, this benchmark took 23.82291 seconds.<br />
Times where spend like this:<br />
isset() took 4.5246219635 seconds.<br />
array_key_exists() took 19.2981789112 seconds.</p></blockquote>
<p>While still not exactly what I expected (a function written to check if a key is set in an array should be faster then a function written to check if a variable is set and that happens to be able to do the same for array indexes, right?) I do find the relative increases interesting. Even though isset() is still much faster, it seems array_key_exists() is has much less problems with strings. (Note: I tested with different lengh loops, and found that the fact that the used time went up about 4 seconds for each is a coincidense.) I won&#8217;t write a conclusion, because I <strike>suck at writing those</strike> don&#8217;t want to make my own thoughts seem like facts, but I know I&#8217;ll be sticking with isset() from now on. Isset(), faster in executing <em>and writing</em>. <img src='http://blog.jorygeerts.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  Oh, if your interested in seeing what exactly I did, and how it runs on your system (users of other platforms, both hard- as softwarematic, I&#8217;d like to see your results.), just for you, <a href="http://blog.jorygeerts.com/wp-content/uploads/2007/01/isset-vs-array_key_exists.rar">I uploaded a package containing the file here</a>.</p>
<h3>Thats it</h3>
<p>for now, at least. Yea, I suck at writing out more then one thing at a time. I&#8217;m going to post follow-up articles lateron. I hope somebody gets something usefull out of this. <img src='http://blog.jorygeerts.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.jorygeerts.com/2007/01/11/know-what-to-use-where/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
