<?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>Intrepid Blog &#187; Web development</title>
	<atom:link href="http://blog.affien.com/archives/category/computer-science/web-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.affien.com</link>
	<description>A few thoughts</description>
	<lastBuildDate>Mon, 01 Mar 2010 00:58:01 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CaCert.org</title>
		<link>http://blog.affien.com/archives/2007/12/08/cacertorg/</link>
		<comments>http://blog.affien.com/archives/2007/12/08/cacertorg/#comments</comments>
		<pubDate>Sat, 08 Dec 2007 12:20:46 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[Web development]]></category>
		<category><![CDATA[ca]]></category>
		<category><![CDATA[cacert]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[web of trust]]></category>

		<guid isPermaLink="false">http://blog.w-nz.com/archives/2007/12/08/cacertorg/</guid>
		<description><![CDATA[CaCert is a Certification Authority that works with a web of trust: people meet and assure (similar to keysigning) eachother.  If you&#8217;ve been assured by enough people you&#8217;ll be able to let your ssl server key be certified by cacert.  It&#8217;s a lot more secure than other CA&#8217;s who just give anyone a [...]]]></description>
			<content:encoded><![CDATA[<p>CaCert is a Certification Authority that works with a web of trust: people meet and assure (similar to keysigning) eachother.  If you&#8217;ve been assured by enough people you&#8217;ll be able to let your ssl server key be certified by cacert.  It&#8217;s a lot more secure than other CA&#8217;s who just give anyone a certificate who pays enough.</p>
<p>Still a hierarchical system with a CA is flawed.  When the CA is compromised, the whole system fails. PGP&#8217;s web of trust hasn&#8217;t got this weakness.</p>
<p>(Got a nice shiny cacert certified ssl certificate on my webserver now)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2007/12/08/cacertorg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stupid PHP (1) (Strings are faster than Arrays)</title>
		<link>http://blog.affien.com/archives/2007/09/23/stupid-php-1-strings-are-faster-than-arrays/</link>
		<comments>http://blog.affien.com/archives/2007/09/23/stupid-php-1-strings-are-faster-than-arrays/#comments</comments>
		<pubDate>Sun, 23 Sep 2007 17:05:14 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[Web development]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[concat]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[stupid]]></category>

		<guid isPermaLink="false">http://blog.w-nz.com/archives/2007/09/23/stupid-php-1-strings-are-faster-than-arrays/</guid>
		<description><![CDATA[When I slowly build a big string out of little bits, the worst thing to do in most languages is to just use string concatenation:
for(something) {
&#160;str += little_bit;
}
Why? Everytime a little bit is added to str, there must be a new string allocated big enough to contain str and the new little bit. Then the [...]]]></description>
			<content:encoded><![CDATA[<p>When I slowly build a big string out of little bits, the worst thing to do in most languages is to just use string concatenation:</p>
<p><code>for(something) {<br />
&nbsp;str += little_bit;<br />
}</code></p>
<p>Why? Everytime a little bit is added to <code>str</code>, there must be a new string allocated big enough to contain <code>str</code> and the new little bit. Then the actual <code>str</code> must be copied in. In most languages there are constructs to efficiently build strings like this instead of concatenating. StringBuffer in C#. StringIO in Python.</p>
<p>But no, PHP has to be stupid. There is no nice construct and you&#8217;ll end up using concatenation. So, I thought to be smart and make use of PHP array&#8217;s and <code>implode</code>. Arrays are here for having elements added and removed all the time so they are properly buffered and should be great at having lots of small elements added. And when I want to pack it all into one big string, I can use PHP&#8217;s builtin <code>implode</code> function.</p>
<p>I wanted to try it out and created two scripts: <code>a.php</code> concats a little (10byte) string one million times and <code>b.php</code> appends it to an array and then <code>implode</code>s it. And because I&#8217;m also interested in the performance of <code>implode</code> I got a script <code>c.php</code> that&#8217;s identical to <code>b.php</code> but doesn&#8217;t implode afterwards. These are the results:</p>
<table>
<tr>
<th>a.php (concat)</th>
<td>0.320s</td>
</tr>
<tr>
<th>b.php (array append and implode)</th>
<td>0.814s</td>
</tr>
<tr>
<th>c.php (array append)</th>
<td>0.732s</td>
</tr>
</table>
<p>Indeed, string concatenation with all its allocation and copying is actually faster than plain simple array appending. PHP is stupid.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2007/09/23/stupid-php-1-strings-are-faster-than-arrays/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>The (or at least a better) Solution to Spam</title>
		<link>http://blog.affien.com/archives/2007/08/14/the-or-at-least-a-better-solution-to-spam/</link>
		<comments>http://blog.affien.com/archives/2007/08/14/the-or-at-least-a-better-solution-to-spam/#comments</comments>
		<pubDate>Tue, 14 Aug 2007 16:45:34 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[SINP]]></category>
		<category><![CDATA[future of the internet]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[web of trust]]></category>

		<guid isPermaLink="false">http://blog.w-nz.com/archives/2007/08/14/the-or-at-least-a-better-solution-to-spam/</guid>
		<description><![CDATA[There is no easy way to distinguish between a human and a spambot.  It&#8217;s an arms race which we&#8217;ll always be behind.  I&#8217;m talking here about spam in more general&#8212;not only on e-mail but also on for instance Wikipedia or on blogposts.  Even if we would have a perfect-solution to test whether [...]]]></description>
			<content:encoded><![CDATA[<p>There is no easy way to distinguish between a human and a spambot.  It&#8217;s an arms race which we&#8217;ll always be behind.  I&#8217;m talking here about spam in more general&#8212;not only on e-mail but also on for instance Wikipedia or on blogposts.  Even if we would have a perfect-solution to test whether there is a human behind something, we still have to combat cheap labour in India:  real people spamming &#8220;by hand&#8221;.</p>
<p>I think the solution is a <a href="http://en.wikipedia.org/wiki/Web_of_Trust">Web of Trust</a> similar to that of PGP.  An identity (not necessarily a person) publishes who she trusts (not to be spammy/phishy) or not trusts.  Ideally everyone would be in one big web.  Only someone who my blog  via-via trusts may post.</p>
<p>Obviously one still may gather trust of people over time and enter the web of trust and then start spamming with that identity.  However, then that identity will be marked untrusted by people and also the people who initially marked the identity as trusted will be less trusted.  Also, there are way more sophisticated measures of establishment in the web/trust to conceive than just being trusted via-via by one identity. </p>
<p>There is no way to prevent spam perfectly, but the amount of work that has to go in to making an identity trusted and established in the web is several orders of magnitude greater than any other protection we have.  The big problem: we don&#8217;t have such an ubiquitous web of trust yet.  (Yes, it&#8217;ll be in <a href="http://blog.w-nz.com/archives/2006/07/01/sinp/">SINP</a> if I&#8217;ll get around to working on it)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2007/08/14/the-or-at-least-a-better-solution-to-spam/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>The Future of the Internet</title>
		<link>http://blog.affien.com/archives/2007/05/06/the-future-of-the-internet/</link>
		<comments>http://blog.affien.com/archives/2007/05/06/the-future-of-the-internet/#comments</comments>
		<pubDate>Sun, 06 May 2007 17:07:41 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[Web development]]></category>
		<category><![CDATA[future]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[p2p]]></category>
		<category><![CDATA[web of trust]]></category>

		<guid isPermaLink="false">http://blog.w-nz.com/archives/2007/05/06/the-future-of-the-internet/</guid>
		<description><![CDATA[One of the prominent people behind the current internet discusses the history (telephony, wire oriented), the current (IP, endpoint oriented) and the future (?, data oriented) at google tech talks.
A short synopsis:  the internet is having trouble at the moment for it has been designed in a time the problem was different.  In [...]]]></description>
			<content:encoded><![CDATA[<p>One of the prominent people behind the current internet discusses the history (telephony, wire oriented), the current (IP, endpoint oriented) and the future (?, data oriented) <a href="http://video.google.com/videoplay?docid=-6972678839686672840&#038;hl=en<br />
">at google tech talks</a>.</p>
<p>A short synopsis:  the internet is having trouble at the moment for it has been designed in a time the problem was different.  In these days most of the data is duplicate data, which is a tremendous waste.  Also connecting to the internet (getting an address) (and resulting from that keeping everything in sync) is hard.  Van suggests and predicts a data oriented internet.  A bit like a secure P2P bittorrent network, but instead of on top of IP on the IP level.</p>
<p>It&#8217;s a very interesting talk, worth watching.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2007/05/06/the-future-of-the-internet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disappearing backgrounds in IE.</title>
		<link>http://blog.affien.com/archives/2006/12/08/disappearing-backgrounds-in-ie/</link>
		<comments>http://blog.affien.com/archives/2006/12/08/disappearing-backgrounds-in-ie/#comments</comments>
		<pubDate>Fri, 08 Dec 2006 17:33:14 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[Web development]]></category>
		<category><![CDATA[background]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[ie]]></category>

		<guid isPermaLink="false">http://blog.w-nz.com/archives/2006/12/08/disappearing-backgrounds-in-ie/</guid>
		<description><![CDATA[In Internet Explorer in some cases backgrounds disappear seemingly randomly. The fix? Add the position: relative; style entry to the concerned div tags.
]]></description>
			<content:encoded><![CDATA[<p>In Internet Explorer in some cases backgrounds disappear seemingly randomly. The fix? Add the <code>position: relative;</code> style entry to the concerned <code>div</code> tags.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2006/12/08/disappearing-backgrounds-in-ie/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Long mySQL keys</title>
		<link>http://blog.affien.com/archives/2006/12/03/long-mysql-keys/</link>
		<comments>http://blog.affien.com/archives/2006/12/03/long-mysql-keys/#comments</comments>
		<pubDate>Sun, 03 Dec 2006 22:58:03 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[Web development]]></category>
		<category><![CDATA[hash]]></category>
		<category><![CDATA[long keys]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://blog.w-nz.com/archives/2006/12/03/long-mysql-keys/</guid>
		<description><![CDATA[Instead of limiting your long key (for instance a path) to approximately 800 characters (on mySQL with generic UTF8), you can hash your key and store the hash as index.
The drawback is that you need to use a quite good hash function to avoid duplicates if you want to use it for a unique or [...]]]></description>
			<content:encoded><![CDATA[<p>Instead of limiting your long key (for instance a path) to approximately 800 characters (on mySQL with generic UTF8), you can hash your key and store the hash as index.</p>
<p>The drawback is that you need to use a quite good hash function to avoid duplicates if you want to use it for a unique or primary key. These good hash functions tend to require some computing time.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2006/12/03/long-mysql-keys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>md5(microtime())</title>
		<link>http://blog.affien.com/archives/2006/12/03/md5microtime/</link>
		<comments>http://blog.affien.com/archives/2006/12/03/md5microtime/#comments</comments>
		<pubDate>Sun, 03 Dec 2006 22:52:50 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[Web development]]></category>
		<category><![CDATA[md5]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://blog.w-nz.com/archives/2006/12/03/md5microtime/</guid>
		<description><![CDATA[Don&#8217;t use md5(microtime()). You might think it&#8217;s more secure than md5(rand()), but it isn&#8217;t.
With a decent amount of tries and a method of syncing (like a clock on your website) one can predict the result of microtime() to the millisecond. This only leaves about a 1000 different possible return values for microtime() to be guessed. [...]]]></description>
			<content:encoded><![CDATA[<p>Don&#8217;t use <code>md5(microtime())</code>. You might think it&#8217;s more secure than <code>md5(rand())</code>, but it isn&#8217;t.</p>
<p>With a decent amount of tries and a method of syncing (like a clock on your website) one can predict the result of <code>microtime()</code> to the millisecond. This only leaves about a 1000 different possible return values for <code>microtime()</code> to be guessed. That isn&#8217;t safe.</p>
<p>Just stick with <code>md5(rand())</code>, and if you&#8217;re lucky and <code>rand()</code> is backed by <code>/dev/random</code> you won&#8217;t even need the <code>md5()</code>. In both cases it will be quite a lot more secure than using <code>microtime()</code>. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2006/12/03/md5microtime/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SINP: Push versus Pull</title>
		<link>http://blog.affien.com/archives/2006/07/27/sinp-push-versus-pull/</link>
		<comments>http://blog.affien.com/archives/2006/07/27/sinp-push-versus-pull/#comments</comments>
		<pubDate>Thu, 27 Jul 2006 14:10:43 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[SINP]]></category>
		<category><![CDATA[pull]]></category>
		<category><![CDATA[push]]></category>
		<category><![CDATA[sxip]]></category>

		<guid isPermaLink="false">http://blog.w-nz.com/archives/2006/07/27/sinp-push-versus-pull/</guid>
		<description><![CDATA[SINP is pull based &#8212; I give my SINP address to someone, and he will pull the information he wants from my SINP server.
Our competitor SXIP is push based. When I use my SXIP identity I push all information I want to provide to the service &#8212; there doesn&#8217;t even have to be a SXIP [...]]]></description>
			<content:encoded><![CDATA[<p>SINP is <em>pull</em> based &#8212; I give my SINP address to someone, and he will <em>pull</em> the information he wants from my SINP server.</p>
<p>Our competitor <a href="http://www.sxip.org/">SXIP</a> is <em>push</em> based. When I use my SXIP identity I push all information I want to provide to the service &#8212; there doesn&#8217;t even have to be a SXIP server (&#8216;homesite&#8217;).</p>
<p>Push has got certain advantages over pull:</p>
<ul>
<li>Pull is <em>complexer</em>: you need more traffic and more complicated traffic. Push is <em>simpler</em>.</li>
<li>You most likely need a seperate server for pull (you need one with SINP at least), this makes you rely on your SINP server. You don&#8217;t need a real one for push.</li>
</ul>
<p>But pull too got advantages:</p>
<ul>
<li>You don&#8217;t need to actively give your information. When I&#8217;m offline someone can still pull information from my SINP identity.</li>
<li>Pull doesn&#8217;t require the actual information to go via your computer. If someone requests my creditcard number and I allow it, it won&#8217;t be redirected through the computer I&#8217;m using, which is safer.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2006/07/27/sinp-push-versus-pull/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SINP Certificates and redirects</title>
		<link>http://blog.affien.com/archives/2006/07/19/sinp-certificates-and-redirects/</link>
		<comments>http://blog.affien.com/archives/2006/07/19/sinp-certificates-and-redirects/#comments</comments>
		<pubDate>Wed, 19 Jul 2006 12:24:59 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[SINP]]></category>
		<category><![CDATA[certificates]]></category>
		<category><![CDATA[redirects]]></category>

		<guid isPermaLink="false">http://blog.w-nz.com/archives/2006/07/19/sinp-certificates-and-redirects/</guid>
		<description><![CDATA[Tuesday the 11th, we (Noud, Bram and I) had a meeting with some guys of the Security of Systems Group at the Radboud University. We discussed the security of the current SINP protocol. There hasn&#8217;t been a hard verdict on whether SINP is secure, because the SINP specification leaves a lot of details to implementations [...]]]></description>
			<content:encoded><![CDATA[<p>Tuesday the 11th, we (Noud, Bram and I) had a meeting with some guys of the Security of Systems Group at the Radboud University. We discussed the security of the current SINP protocol. There hasn&#8217;t been a hard verdict on whether SINP is secure, because the SINP specification leaves a lot of details to implementations and SINP doesn&#8217;t make hard claims on its security yet (which can be either proved or disproved).</p>
<p>The meeting has yielded two new additions to SINP: document certificates<sup>1</sup> and redirects.</p>
<p>First of, <strong>SINP document certificates</strong>. At the moment you can&#8217;t trust the information in a SINP document. I can forge my SINP document and claim that I&#8217;m Belgium, which I am not. To allow some trust which some people and services care about, we&#8217;ll allow certificates in your identity document. Basically you let someone sign a part of your SINP document and include that certificate. </p>
<p>Your goverment could sign your name in your SINP document for instance and you&#8217;d add that certificate into your document, which could be required by some services. These certificates are a bit tricky though to design, because they do need to be secure and they need to be a bit more dynamic than your usual certificate because of the way SINP documents are queried.</p>
<p>A second problem we encountered during the meeting was how to be able to trust your SINP server. I (and other tech savvy people) can set up their own SINP server, which we can fully trust because we set it up ourselves. Not so tech savvy people can&#8217;t &#8212; they need to rely on existing SINP servers. <em>The problem is whether we can trust those servers with our secrets.</em></p>
<p>Cees (if I recall correctly) coined the idea that some of your secrets are already on the internet. If you&#8217;ve got a VISA creditcard number, then VISA obviously has that creditcard number, and you trust them with it. What if VISA would store the part of your SINP identity document with your creditcardnumber on its own SINP Server?</p>
<p>Basically I go to a big SINP provider (which I don&#8217;t trust), I create a SINP identity and put in my SINP document that you can find my creditcard number under the SINP identity <code>bas@visa.com</code>. This act of redirecting clients to other SINP identities is called a <strong>SINP Redirect</strong>. SINP Redirects could also proof very usefull when you change your SINP server. The only thing you&#8217;d have to do is to set up a SINP redirect in your old identity document to your new identitiy document.</p>
<p>Both <em>SINP Certificates</em> and <em>SINP Redirects</em> will require a lot of though to implement cleanly and simple, which is tricky.</p>
<p>Any thoughts would be welcome.</p>
<p><small>1: Actually, this certificates aren&#8217;t new, Bram came up with the idea quite a while ago.</small></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2006/07/19/sinp-certificates-and-redirects/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>sinp.rb</title>
		<link>http://blog.affien.com/archives/2006/07/03/sinprb/</link>
		<comments>http://blog.affien.com/archives/2006/07/03/sinprb/#comments</comments>
		<pubDate>Sun, 02 Jul 2006 23:30:49 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[SINP]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.w-nz.com/archives/2006/07/03/sinprb/</guid>
		<description><![CDATA[irb&#62; require 'sinp'
irb&#62; c = SINP::Client.new nil, nil, [:http]
irb&#62; c.getPublicDocument('Kristy@w-nz.com').write
&#60;requested version='2'&#62;
&#60;sinp-id&#62;
        &#60;name&#62;&#60;nick&#62;kristy&#60;/nick&#62;&#60;/name&#62;
        &#60;address type='email'&#62;kbuiter@hotmail.com&#60;/address&#62;
        &#60;uri&#62;hotmail.com&#60;/uri&#62;
&#60;/sinp-id&#62;
        &#60;/requested&#62;
As you can see, I&#8217;ve almost finished the implementation of a Ruby [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p><code>irb&gt; <strong>require 'sinp'</strong><br />
irb&gt; <strong>c = SINP::Client.new nil, nil, [:http]</strong><br />
irb&gt; <strong>c.getPublicDocument('Kristy@w-nz.com').write</strong><br />
&lt;requested version='2'&gt;<br />
&lt;sinp-id&gt;<br />
        &lt;name&gt;&lt;nick&gt;kristy&lt;/nick&gt;&lt;/name&gt;<br />
        &lt;address type='email'&gt;kbuiter@hotmail.com&lt;/address&gt;<br />
        &lt;uri&gt;hotmail.com&lt;/uri&gt;<br />
&lt;/sinp-id&gt;<br />
        &lt;/requested&gt;</code></p></blockquote>
<p>As you can see, I&#8217;ve almost finished the implementation of a Ruby SINP client &#8212; I only got to finish SINP Negotiation.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2006/07/03/sinprb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
