<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Solutoire.com</title>
	
	<link>http://solutoire.com</link>
	<description>Publicing platform</description>
	<lastBuildDate>Thu, 26 Feb 2009 17:07:57 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/solutoire" /><feedburner:info uri="solutoire" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>solutoire</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Django Series 1: A custom login page</title>
		<link>http://feedproxy.google.com/~r/solutoire/~3/9OY-kXLVg58/</link>
		<comments>http://solutoire.com/2009/02/26/django-series-1-a-custom-login-page/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 17:07:57 +0000</pubDate>
		<dc:creator>Bas Wenneker</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[django series]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://solutoire.com/?p=217</guid>
		<description><![CDATA[
This is the first post in the Django series published on solutoire.com. In the series I&#8217;ll discuss and solve some of the problems I ran across while struggling with Python and Django in particular. The subjects are handled in a fast pace and the posts in this series will get you up and running quickly. [...]]]></description>
			<content:encoded><![CDATA[<p>
This is the first post in the <a href="http://www.djangoproject.com/" title="The Django project">Django</a> series published on solutoire.com. In the series I&#8217;ll discuss and solve some of the problems I ran across while struggling with Python and Django in particular. The subjects are handled in a fast pace and the posts in this series will get you up and running quickly. The posts will mainly consist of code examples and a few explanations. Most of the time I&#8217;ll refer to other websites for thorough explanations.
</p>
<p>
In this post I&#8217;ll explain how to create a custom log in page. We&#8217;ll write our own view function and form that handles the authentication. In the next post I&#8217;ll explain how to create a custom authentication backend, that lets you log in users by their email addresses instead of their username.
</p>
<h1>Setting Up The Project</h1>
<p>
I assume you&#8217;ve already <a href="http://docs.djangoproject.com/en/dev/intro/install/#intro-install" title="Install Django">installed Django</a> and that you have a database. First step is to create a new project (in my case called &#8217;solutoire&#8217;). Then, create an <a href="http://docs.djangoproject.com/en/dev/intro/tutorial01/#id3" title="Django: Projects vs Apps">app</a> in the project called &#8216;auth&#8217;. Of course you can name both whatever you like. Fire the following commands on your command line:
</p>
<pre><code>// Create a new project:
# django-admin.py startproject solutoire
// Create the authentication app:
# manage.py startapp auth
</code></pre>
<p>
Now set up your project as described in the <a href="http://docs.djangoproject.com/en/dev/intro/tutorial01/" title="Django Tutorial Step 1">Django Tutorial</a>. Make sure you&#8217;ve added the database settings in <code>settings.py</code>.
</p>
<p>
Next thing you need to do is to sync the database. Make sure you create a superuser and write down the credentials (especially the email address and the password). Run the following commands:
</p>
<pre><code>// Sync the database, create a superuser
# manage.py syncdb
// Start the development server at http://127.0.0.1:8080
# manage.py runserver 8080
</code></pre>
<h2>Creating A Log in Page</h2>
<p>
Django already has built in User authentication. To start using it, make sure <code>django.contrib.auth</code> is in the <a href="http://docs.djangoproject.com/en/dev/ref/settings/#installed-apps" title="INSTALLED_APPS setting description"><code>INSTALLED_APPS</code></a> tuple. If you don&#8217;t have it yet, add it, and run the <code>manage.py syncdb</code> again, this creates the tables in the database that you&#8217;ll need for authentication. Django also comes with <a href="http://docs.djangoproject.com/en/dev/topics/auth/?from=olddocs#built-in-forms" title="Django builtin Authentication Views">several authentication views</a>, but for now, we&#8217;ll write our own.
</p>
<p>
To facilitate a log in page, create a new directory &#8216;templates&#8217; in project folder and create a file called <code>auth.html</code> inside it. In settings.py, add the absolute path to template directory to the <a href="http://docs.djangoproject.com/en/dev/ref/settings/#template-dirs" title="TEMPLATE_DIRS setting description"><code>TEMPLATE_DIRS</code></a> setting. In my case, it looked like:
</p>
<pre><code>TEMPLATE_DIRS = (
    'E:/Django/Projects/solutoire/templates'
)
</code></pre>
<p>
We also need a view function and a template. Open up <code>auth/views.py</code> and paste the
</p>
<pre><code>// auth/views.py
from django.shortcuts import render_to_response
from django.contrib.auth import authenticate, login

def login_user(request):
    state = "Please log in below..."
    username = password = ''
    if request.POST:
        username = request.POST.get('username')
        password = request.POST.get('password')

        user = authenticate(username=username, password=password)
        if user is not None:
            if user.is_active:
                login(request, user)
                state = "You're successfully logged in!"
            else:
                state = "Your account is not active, please contact the site admin."
        else:
            state = "Your username and/or password were incorrect."

    return render_to_response('auth.html',{'state':state, 'username': username})</code></pre>
<p>
Now, copy &#038; paste the following HTML to the <code>auth.html</code> file. This is the template for the log in view. To read more about Django templates, go read <a href="http://docs.djangoproject.com/en/dev/ref/templates/api/" title="Django Template Language">Django Template Language</a> and <a href="http://docs.djangoproject.com/en/dev/ref/templates/builtins/" title="Django Built-in template tags and filters">Built-in template tags and filters</a>.
</p>
<pre><code>// templates/auth.html
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
&lt;head&gt;
&lt;title&gt;Log in&lt;/title&gt;
&lt;meta http-equiv="Content-type" content="text/html; charset=utf-8" /&gt;
&lt;style&gt;
body{
	font-family:Arial,Helvetica,sans-serif;
	font-size: 12px;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
	{{ state }}
	&lt;form action="/login/" method="post"&gt;
		{% if next %}
		&lt;input type="hidden" name="next" value="{{ next }}" /&gt;
		{% endif %}
		username: 
		&lt;input type="text" name="username" value="{{ username}}" /&gt;&lt;br /&gt;
		password:
		&lt;input type="password" name="password" value="" /&gt;&lt;br /&gt;

		&lt;input type="submit" value="Log In" /&gt;
	&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre>
<p>
In order to see the form with your browser, the <code>urlpatterns</code> variable in <code>urls.py</code> in the project root should have an entry that points to the <code>login_user</code> function defined in auth/views.py:
</p>
<pre><code>from django.conf.urls.defaults import *

# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = patterns('',
    (r'^login/$', 'auth.views.login_user'),
)</code></pre>
<p>
The form looks like this when you&#8217;re not logged in:
</p>
<div class="img">
<img src="http://solutoire.com/blog/wp-content/uploads/2009/02/login_form1.png" alt="login_form1" title="login_form1" width="238" height="110" class="alignnone size-full wp-image-240" /><br />
<i>The log in form.</i>
</div>
<p>
As you can see, the <code>render_to_response</code> function passes two variables to the auth.html template we&#8217;ve just created. Now we have everything in place for logging in users. Try it yourself, use the credentials you just wrote down when you ran the <code>manage.py syncdb</code> command (to log in, point your browser to <a href="http://127.0.0.1:8080/login" title="Your log in page">http://127.0.0.1:8080/login</a>). This code is everything you need with Django to have your own log in page. However, Django also comes with some predefined log in views. You can read more about those default templates at the <a href="http://docs.djangoproject.com/en/dev/topics/auth/?from=olddocs#other-built-in-views" title="Built-In Authentication views">Django Documentation</a>
</p>
<h2>What&#8217;s next</h2>
<p>
In the next post in the Django series we&#8217;ll will write our own authentication backend. The custom backend enables us to let users log in by their email address, instead of their username. Of course you can change the backend to your likings, for example, let users log in by their first name, email address and their password.
</p>
<h2>Download</h2>
<p>You can download all the code above in a <a href="http://www.solutoire.com/download/solutoire.django.series.1.zip">zip file</a>. When you use this code, make sure you change paths and credentials.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/solutoire?a=9OY-kXLVg58:pZ3iM0R_Kg8:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/solutoire?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=9OY-kXLVg58:pZ3iM0R_Kg8:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/solutoire?i=9OY-kXLVg58:pZ3iM0R_Kg8:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=9OY-kXLVg58:pZ3iM0R_Kg8:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/solutoire?i=9OY-kXLVg58:pZ3iM0R_Kg8:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=9OY-kXLVg58:pZ3iM0R_Kg8:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/solutoire?i=9OY-kXLVg58:pZ3iM0R_Kg8:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=9OY-kXLVg58:pZ3iM0R_Kg8:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/solutoire?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=9OY-kXLVg58:pZ3iM0R_Kg8:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/solutoire?i=9OY-kXLVg58:pZ3iM0R_Kg8:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/solutoire/~4/9OY-kXLVg58" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://solutoire.com/2009/02/26/django-series-1-a-custom-login-page/feed/</wfw:commentRss>
		<slash:comments>106</slash:comments>
		<feedburner:origLink>http://solutoire.com/2009/02/26/django-series-1-a-custom-login-page/</feedburner:origLink></item>
		<item>
		<title>Upcoming Django Series</title>
		<link>http://feedproxy.google.com/~r/solutoire/~3/CF_InDxA0zA/</link>
		<comments>http://solutoire.com/2009/02/09/upcoming-django-series/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 19:15:45 +0000</pubDate>
		<dc:creator>Bas Wenneker</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[django series]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://solutoire.com/?p=210</guid>
		<description><![CDATA[
I&#8217;m currently working with Django for a personal project. Django is a web framework written in Python that encourages rapid development and clean, pragmatic design. The Django website says it is &#8220;The Web framework for perfectionists with deadlines. Django makes it easier to build better Web apps more quickly and with better code.&#8221;. That&#8217;s exactly [...]]]></description>
			<content:encoded><![CDATA[<p>
I&#8217;m currently working with <a href="http://www.djangoproject.com/" title="Django">Django</a> for a personal project. Django is a web framework written in <a href="http://www.python.org/" title="Python Programming Language">Python</a> that encourages rapid development and clean, pragmatic design. The Django website says it is &#8220;The Web framework for perfectionists with deadlines. Django makes it easier to build better Web apps more quickly and with better code.&#8221;. That&#8217;s exactly the reason I decided to fool around with Django and Python. While I&#8217;m an experienced PHP programmer, Python is not as hard to learn like I thought it would be.
</p>
<p>In the next few weeks I&#8217;ll be releasing a series of posts in which I&#8217;ll discuss and solve some of the problems I ran across while struggling with Python and Django in particular. The first post covers writing a custom authentication backend. The second post will learn you everything about extending the default Django User object and how to combine it with the custom authentication backend. If you have special requests for explanation of topics related to Django (that are hardly documented), please let me know by leaving a comment.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/solutoire?a=CF_InDxA0zA:BOOVuwlOobc:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/solutoire?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=CF_InDxA0zA:BOOVuwlOobc:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/solutoire?i=CF_InDxA0zA:BOOVuwlOobc:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=CF_InDxA0zA:BOOVuwlOobc:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/solutoire?i=CF_InDxA0zA:BOOVuwlOobc:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=CF_InDxA0zA:BOOVuwlOobc:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/solutoire?i=CF_InDxA0zA:BOOVuwlOobc:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=CF_InDxA0zA:BOOVuwlOobc:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/solutoire?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=CF_InDxA0zA:BOOVuwlOobc:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/solutoire?i=CF_InDxA0zA:BOOVuwlOobc:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/solutoire/~4/CF_InDxA0zA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://solutoire.com/2009/02/09/upcoming-django-series/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		<feedburner:origLink>http://solutoire.com/2009/02/09/upcoming-django-series/</feedburner:origLink></item>
		<item>
		<title>Delayed Image Preloading Using Mootools</title>
		<link>http://feedproxy.google.com/~r/solutoire/~3/zkZk9uoP6No/</link>
		<comments>http://solutoire.com/2008/11/02/delayed-image-preloading-usin-mootools/#comments</comments>
		<pubDate>Sun, 02 Nov 2008 15:44:50 +0000</pubDate>
		<dc:creator>Bas Wenneker</dc:creator>
				<category><![CDATA[Mootools]]></category>
		<category><![CDATA[image preloading]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://solutoire.com/?p=190</guid>
		<description><![CDATA[
It&#8217;s almost three months ago since my last post! I&#8217;m quite busy at the moment. That&#8217;s why I&#8217;ll just write a quickie on delayed image preloading using Mootools (1.2.1, also might work with 1.2 and 1.1).

Image preloading

Most of the times you&#8217;ll need preloading when there are elements in the DOM that are hidden, but have [...]]]></description>
			<content:encoded><![CDATA[<p>
It&#8217;s almost three months ago since my last post! I&#8217;m quite busy at the moment. That&#8217;s why I&#8217;ll just write a quickie on delayed image preloading using <a href="http://www.mootools.net" title="Mootools Home">Mootools</a> (1.2.1, also might work with 1.2 and 1.1).
</p>
<h2>Image preloading</h2>
<p>
Most of the times you&#8217;ll need preloading when there are elements in the DOM that are hidden, but have an image background. On the moment the elements are shown and the images are not found in cache, the images are loaded from the server. This action has a small delay, so your element first shows up without the image background. That might confuse the visitor.
</p>
<p>Note that there are other possible scenario&#8217;s that need image preloading, but this case is a nice introduction.</p>
<h2>Delaying image preloading</h2>
<p>
Why in the world would we like to delay the preloading of the images? Well, most browsers only allow two concurrent requests at the same time to the same domain (correct me if I&#8217;m wrong). When we do the image preloading on <code><a href="http://mootools.net/docs/Utilities/DomReady" title="Mootools Documentation: DomReady">domready</a></code>, it might hold up other resources that need to be loaded. Because we preload images that are not shown when the page loads, we can delay the preloading.
</p>
<h2>The javascript</h2>
<p>
Let&#8217;s say we have a total of five images that need to be preloaded. Here&#8217;s how I would preload the image, 3 seconds after the dom is ready:
</p>
<pre class="javascript"><code>Array.each.delay(3000,this,[
	['foo.gif', 'bar.png','moo.png','tools.png', 'mootools.png'],
	function(src){var img = new Image();img.src = src;}
]);
</code></pre>
<p>
Easy huh? It delays a call to Array.each by 3000 ms. Then it passes the array of images as the first argument, and the function as the second. You can read more about <code>delay</code> at the <a href="http://mootools.net/docs/Native/Function#Function:delay" title="Mootools Documentation">Mootools Docs</a>.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/solutoire?a=zkZk9uoP6No:snaC3CLleyg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/solutoire?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=zkZk9uoP6No:snaC3CLleyg:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/solutoire?i=zkZk9uoP6No:snaC3CLleyg:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=zkZk9uoP6No:snaC3CLleyg:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/solutoire?i=zkZk9uoP6No:snaC3CLleyg:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=zkZk9uoP6No:snaC3CLleyg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/solutoire?i=zkZk9uoP6No:snaC3CLleyg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=zkZk9uoP6No:snaC3CLleyg:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/solutoire?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=zkZk9uoP6No:snaC3CLleyg:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/solutoire?i=zkZk9uoP6No:snaC3CLleyg:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/solutoire/~4/zkZk9uoP6No" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://solutoire.com/2008/11/02/delayed-image-preloading-usin-mootools/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		<feedburner:origLink>http://solutoire.com/2008/11/02/delayed-image-preloading-usin-mootools/</feedburner:origLink></item>
		<item>
		<title>Javascripts Loop Benchmarks</title>
		<link>http://feedproxy.google.com/~r/solutoire/~3/qpVZoTQOSik/</link>
		<comments>http://solutoire.com/2008/07/29/javascripts-loop-benchmarks/#comments</comments>
		<pubDate>Tue, 29 Jul 2008 18:04:27 +0000</pubDate>
		<dc:creator>Bas Wenneker</dc:creator>
				<category><![CDATA[Notes]]></category>
		<category><![CDATA[benchmark]]></category>
		<category><![CDATA[efficiency]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[looping]]></category>

		<guid isPermaLink="false">http://solutoire.com/?p=186</guid>
		<description><![CDATA[
I tested a few looping techniques in the past, but I found a benchmark page which shows over 40 looping techniques and their running times. You can find the benchmark over here.
]]></description>
			<content:encoded><![CDATA[<p>
I tested a few <a href="http://solutoire.com/2007/02/02/efficient-looping-in-javascript/" title="Efficient Looping in Javascript">looping techniques</a> in the past, but I found a benchmark page which shows over 40 looping techniques and their running times. You can find the benchmark over <a href="http://blogs.sun.com/greimer/resource/loop-test.html" title="Javascript Loop Benchmarks">here</a>.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/solutoire?a=qpVZoTQOSik:_KY7PXwSLFU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/solutoire?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=qpVZoTQOSik:_KY7PXwSLFU:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/solutoire?i=qpVZoTQOSik:_KY7PXwSLFU:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=qpVZoTQOSik:_KY7PXwSLFU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/solutoire?i=qpVZoTQOSik:_KY7PXwSLFU:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=qpVZoTQOSik:_KY7PXwSLFU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/solutoire?i=qpVZoTQOSik:_KY7PXwSLFU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=qpVZoTQOSik:_KY7PXwSLFU:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/solutoire?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=qpVZoTQOSik:_KY7PXwSLFU:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/solutoire?i=qpVZoTQOSik:_KY7PXwSLFU:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/solutoire/~4/qpVZoTQOSik" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://solutoire.com/2008/07/29/javascripts-loop-benchmarks/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://solutoire.com/2008/07/29/javascripts-loop-benchmarks/</feedburner:origLink></item>
		<item>
		<title>Writing A Feed Reader</title>
		<link>http://feedproxy.google.com/~r/solutoire/~3/f6jDRfm0ooM/</link>
		<comments>http://solutoire.com/2008/06/27/writing-a-feed-reader/#comments</comments>
		<pubDate>Fri, 27 Jun 2008 18:46:25 +0000</pubDate>
		<dc:creator>Bas Wenneker</dc:creator>
				<category><![CDATA[Mootools]]></category>
		<category><![CDATA[Feed Reader]]></category>
		<category><![CDATA[Google AJAX Feed API]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://solutoire.com/?p=175</guid>
		<description><![CDATA[
Yesterday I was playing around with the Google AJAX Feed API. With the API, you can download any public Atom or RSS feed using only javascript. By mixing the Google AJAX Feed API with MooTools 1.2, I wrote a tiny feed reader application in 30 lines of javascript goodness.



My tiny feed reader

The Feed Reader

This feed [...]]]></description>
			<content:encoded><![CDATA[<p>
Yesterday I was playing around with the <a href="http://code.google.com/apis/ajaxfeeds/" title="Google AJAX Feed API">Google AJAX Feed API</a>. With the API, you can download any public Atom or RSS feed using only javascript. By mixing the Google AJAX Feed API with <a href="http://mootools.net/" title="MooTools Javascript Framework">MooTools 1.2</a>, I wrote a <a href="http://solutoire.com/experiments/apps/feedreader/" title="Feed Reader Example">tiny feed reader</a> application in 30 lines of javascript goodness.
</p>
<div class="img">
<a href="http://solutoire.com/experiments/apps/feedreader/" title="Feed Reader Example"><img src="http://solutoire.com/blog/wp-content/uploads/2008/06/feed.png" alt="My tiny feed reader" title="feed" width="320" height="147" /></a><br />
<i>My tiny feed reader</i>
</div>
<h2>The Feed Reader</h2>
<p>
This feed reader polls the <a href="http://www.colourlovers.com/" title="COLOURlovers">COLOURlovers.com</a> Palettes feed and Colours feed every 20 seconds for new items. New items are highlighted with the MooTools <code><a href="http://docs.mootools.net/Fx/Fx.Tween#Element:highlight" title="MooTools Docs - Fx/Fx.Tween">Element.highlight()</a></code> function. The Google AJAX Feed API passes <abbr title="JavaScript Object Notation">JSON</abbr> to a callback function, which adds the new &#8216;colour&#8217; or &#8216;palette&#8217; entries to the list. Below you can see the uncommented code. The <a href="http://solutoire.com/experiments/apps/feedreader/" title="MooTools Feed Reader">feed reader example</a> contains a <a href="http://solutoire.com/experiments/apps/feedreader/scripts/feed.js">commented version</a>.
</p>
<pre><code>var Site = {
	entries: [],
	timer: 0,
	init: function(){
		this.paletteFeed = new google.feeds.Feed('http://feeds.feedburner.com/ColourloversCoup0Palettes/New');
		this.colourFeed = new google.feeds.Feed('http://feeds.feedburner.com/ColourloversCoup0Colours/New');
		this.poll.periodical(1000, this);
	},
	poll: function(){
		if (--this.timer &lt;= 0) {
			this.colourFeed.load(this.onLoadCallback.bind(this));
			this.paletteFeed.load(this.onLoadCallback.bind(this));
			this.timer = 20;
		}
		$('refresh').set('html','Refreshing feeds in ' + this.timer + ' second(s)...');
	},
	onLoadCallback:function(json){
		if (json.error) return;
		for (var i = json.feed.entries.length - 1; i &gt;= 0; i--) {
			var entry = json.feed.entries[i];
			if (!this.entries.contains(entry.title)) {
				this.entries.push(entry.title);
				$('feeds').innerHTML = ('&lt;li class=&quot;entry&quot;&gt;&lt;a href=&quot;{link}&quot; title=&quot;{title}&quot;&gt;{content}&lt;/a&gt;&lt;/li&gt;').substitute(entry) + $('feeds').innerHTML;
			}
		}
		$$('.entry').set('tween',{duration:2000}).highlight().removeClass('entry');
	}
};
google.load('feeds', '1');
window.addEvent('domready', Site.init.bind(Site));
</code></pre>
<h2>What&#8217;s next?</h2>
<ul>
<li><a href="http://code.google.com/apis/ajaxfeeds/" title="Google AJAX Feed API">Google AJAX Feed API</a></li>
<li><a href="http://docs.mootools.net/" title="MooTools Docs">MooTools Docs</a></li>
</ul>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/solutoire?a=f6jDRfm0ooM:RgnyYILEu5M:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/solutoire?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=f6jDRfm0ooM:RgnyYILEu5M:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/solutoire?i=f6jDRfm0ooM:RgnyYILEu5M:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=f6jDRfm0ooM:RgnyYILEu5M:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/solutoire?i=f6jDRfm0ooM:RgnyYILEu5M:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=f6jDRfm0ooM:RgnyYILEu5M:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/solutoire?i=f6jDRfm0ooM:RgnyYILEu5M:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=f6jDRfm0ooM:RgnyYILEu5M:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/solutoire?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=f6jDRfm0ooM:RgnyYILEu5M:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/solutoire?i=f6jDRfm0ooM:RgnyYILEu5M:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/solutoire/~4/f6jDRfm0ooM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://solutoire.com/2008/06/27/writing-a-feed-reader/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://solutoire.com/2008/06/27/writing-a-feed-reader/</feedburner:origLink></item>
		<item>
		<title>Sending Javascript Functions Over JSON</title>
		<link>http://feedproxy.google.com/~r/solutoire/~3/F-ry71olgnU/</link>
		<comments>http://solutoire.com/2008/06/12/sending-javascript-functions-over-json/#comments</comments>
		<pubDate>Thu, 12 Jun 2008 11:55:58 +0000</pubDate>
		<dc:creator>Bas Wenneker</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Flotr]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://solutoire.com/?p=172</guid>
		<description><![CDATA[
In this post I&#8217;ll present a way to send javascript functions over JSON from a php server (but it should work on other platforms too). Since PHP version 5.20 PHP includes the functions json_encode() and json_decode(). These functions encode values into JSON formatting and decode JSON formatted strings into associative arrays. The json_encode() function is [...]]]></description>
			<content:encoded><![CDATA[<p>
In this post I&#8217;ll present a way to send javascript functions over JSON from a php server (but it should work on other platforms too). Since PHP version 5.20 PHP includes the functions <code><a href="http://us.php.net/json_encode" title="PHP.net: json_encode()">json_encode()</a></code> and <code><a href="http://us.php.net/json_decode" title="PHP.net: json_decode()">json_decode()</a></code>. These functions encode values into JSON formatting and decode JSON formatted strings into <a href="http://en.wikipedia.org/wiki/Associative_array" title="Wikipedia: Associative array">associative arrays</a>. The <code>json_encode()</code> function is not able to encode a value into a (javascript) function. This is a common issue when configuring graphs from <a href="http://www.solutoire.com/flotr" title="Flotr Javascript Plotting Library">Flotr</a> (my Javascript plotting library) with JSON data. Here are my findings.
</p>
<h2>The Problem: Server-side</h2>
<p>
To get a better feeling for the problem, I&#8217;ll show you what happens when we pass an array to json_encode:
</p>
<pre class="php"><code>// Our sample array
$foo = array(
  'number'  => 1,
  'float'   => 1.5,
  'array'   => array(1,2),
  'string'  => 'bar',
  'function'=> 'function(){return "foo bar";}'
);

// Now encode the array to JSON format
$json = json_encode($foo);

// Send to to the client
echo $json;
...
// This sends the following string to the client:
{
  "number":1,
  "float":1.5,
  "array":[1,2],
  "string":"bar",
  "function":"function(){return \"foo bar\";}"
}</code></pre>
<p>
Because PHP reports some errors when we don&#8217;t enclose the &#8216;function&#8217; with quotation marks, it not possible to omit those. So basically, it&#8217;s not possible to use <code>json_encode()</code> to create a JSON formatted string with functions.
</p>
<h2>The solution</h2>
<p>
My solution is very simple:
</p>
<ul>
<li>Loop over the associative array that is about to be encoded</li>
<li>Look for values that start with a function definition (like &#8216;function(&#8217;)</li>
<li>Remember the value and replace it with a unique key (within the assoc array)</li>
<li>Encode the changed assoc array to JSON using <code>json_encode()</code></li>
<li>Replace the unique keys enclosed in quotation marks with their original values</li>
<li>Echo the json string</li>
</ul>
<p>In PHP:</p>
<pre class="php"><code>// Our sample array
$foo = array(
  'number'  => 1,
  'float'   => 1.5,
  'array'   => array(1,2),
  'string'  => 'bar',
  'function'=> 'function(){return "foo bar";}'
);

$value_arr = array();
$replace_keys = array();
foreach($foo as $key => &#038;$value){
  // Look for values starting with 'function('
  if(strpos($value, 'function(')===0){
    // Store function string.
    $value_arr[] = $value;
    // Replace function string in $foo with a 'unique' special key.
    $value = '%' . $key . '%';
    // Later on, we'll look for the value, and replace it.
    $replace_keys[] = '"' . $value . '"';
  }
}

// Now encode the array to json format
$json = json_encode($foo);

// $json looks like:
{
  "number":1,
  "float":1.5,
  "array":[1,2],
  "string":"bar",
  "function":"%function%"
}

// Replace the special keys with the original string.
$json = str_replace($replace_keys, $value_arr, $json);

// Send to to the client
echo $json;

// This echoes the following string:
{
  "number":1,
  "float":1.5,
  "array":[1,2],
  "string":"bar",
  "function":function(){return "foo bar";}
}
</code></pre>
<p>
Now the &#8216;function&#8217; key is not a String anymore, but it&#8217;s a function. So our problem is solved. When using <a href="http://www.prototypejs.org/" title="Prototype Javascript Library">Prototype</a>, it will look something like this:
</p>
<pre><code>new Ajax.Request('json_server.php', {
  method:'get',
  onSuccess: function(transport){
     var json = transport.responseText.evalJSON();
     alert(json.function()); // => alerts 'foo bar'
   }
});</code></pre>
<p>
There might be dozens of solutions to the problem stated above, but I couldn&#8217;t find &#8216;em on the net. If you know a better technique, please share it!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/solutoire?a=F-ry71olgnU:WiTMin0EEmo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/solutoire?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=F-ry71olgnU:WiTMin0EEmo:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/solutoire?i=F-ry71olgnU:WiTMin0EEmo:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=F-ry71olgnU:WiTMin0EEmo:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/solutoire?i=F-ry71olgnU:WiTMin0EEmo:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=F-ry71olgnU:WiTMin0EEmo:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/solutoire?i=F-ry71olgnU:WiTMin0EEmo:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=F-ry71olgnU:WiTMin0EEmo:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/solutoire?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=F-ry71olgnU:WiTMin0EEmo:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/solutoire?i=F-ry71olgnU:WiTMin0EEmo:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/solutoire/~4/F-ry71olgnU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://solutoire.com/2008/06/12/sending-javascript-functions-over-json/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://solutoire.com/2008/06/12/sending-javascript-functions-over-json/</feedburner:origLink></item>
		<item>
		<title>Mootools Puzzle Game</title>
		<link>http://feedproxy.google.com/~r/solutoire/~3/PhBGK7Y2hiI/</link>
		<comments>http://solutoire.com/2008/03/28/mootools-puzzle-game/#comments</comments>
		<pubDate>Fri, 28 Mar 2008 18:45:57 +0000</pubDate>
		<dc:creator>Bas Wenneker</dc:creator>
				<category><![CDATA[Mootools]]></category>
		<category><![CDATA[about]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[puzzle]]></category>

		<guid isPermaLink="false">http://solutoire.com/2008/03/28/mootools-puzzle-game/</guid>
		<description><![CDATA[
I wrote a pretty useless puzzle game that makes use of Mootools. I was updating the &#8216;about&#8217; page on this blog, and I was looking for an original way to show a picture of myself. So take a look at the the about page and play around with it.



Play with me

]]></description>
			<content:encoded><![CDATA[<p>
I wrote a pretty useless puzzle game that makes use of Mootools. I was updating the &#8216;about&#8217; page on this blog, and I was looking for an original way to show a picture of myself. So take a look at the the <a href="http://www.solutoire.com/about" title="About Bas Wenneker">about page</a> and <a href="http://www.solutoire.com/about#puzzle" title="Puzzle with me">play around</a> with it.
</p>
<div class="img">
<a href="http://solutoire.com/about#puzzle" title="Puzzle Game"><img src="http://solutoire.com/blog/wp-content/uploads/2008/03/puzzle-game.png" style="border:0px;" alt="Puzzle Game" /></a><br />
<i>Play with me</i>
</div>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/solutoire?a=PhBGK7Y2hiI:JznF6XOB6KU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/solutoire?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=PhBGK7Y2hiI:JznF6XOB6KU:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/solutoire?i=PhBGK7Y2hiI:JznF6XOB6KU:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=PhBGK7Y2hiI:JznF6XOB6KU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/solutoire?i=PhBGK7Y2hiI:JznF6XOB6KU:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=PhBGK7Y2hiI:JznF6XOB6KU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/solutoire?i=PhBGK7Y2hiI:JznF6XOB6KU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=PhBGK7Y2hiI:JznF6XOB6KU:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/solutoire?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=PhBGK7Y2hiI:JznF6XOB6KU:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/solutoire?i=PhBGK7Y2hiI:JznF6XOB6KU:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/solutoire/~4/PhBGK7Y2hiI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://solutoire.com/2008/03/28/mootools-puzzle-game/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://solutoire.com/2008/03/28/mootools-puzzle-game/</feedburner:origLink></item>
		<item>
		<title>HTML Conditional Comments</title>
		<link>http://feedproxy.google.com/~r/solutoire/~3/n5-hLVfKN9c/</link>
		<comments>http://solutoire.com/2008/03/23/html-conditional-comments/#comments</comments>
		<pubDate>Sun, 23 Mar 2008 19:12:17 +0000</pubDate>
		<dc:creator>Bas Wenneker</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[conditional comments]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[internet explorer]]></category>

		<guid isPermaLink="false">http://solutoire.com/2008/03/23/html-conditional-comments/</guid>
		<description><![CDATA[
Ever used conditional statements/comments in your html? I do, actually, use the technique quite a lot (this site, Flotr). With HTML conditional comments you can detect browser type and version. Now don&#8217;t get too excited, because it&#8217;s only supported by Internet Explorer 5+ on Windows. Nevertheless, this way of browser detection is really elegant compared [...]]]></description>
			<content:encoded><![CDATA[<p>
Ever used conditional statements/comments in your html? I do, actually, use the technique quite a lot (this site, <a href="http://www.solutoire.com/flotr" title="Flotr Project Page">Flotr</a>). With HTML conditional comments you can detect browser type and version. Now don&#8217;t get too excited, because it&#8217;s only supported by Internet Explorer 5+ on Windows. Nevertheless, this way of browser detection is really elegant compared to nasty css hacks or javascript user agent detection. This article is shows you how you can use the conditional comments for several handy purposes.
</p>
<h2>Different types of statements</h2>
<p>
There are two types of conditional statements. The first type is the so-called <strong><i>downlevel-hidden</i></strong> statement, which hides the statement from browsers that don&#8217;t support conditional comments:
</p>
<pre><code class="html">&lt;!-- This is a regular HTML comment --&gt;
&lt;!--[if IE]&gt;
&lt;p&gt;This is a downlevel-hidden conditional statement.
Browsers that don't support conditional comments,
think this is a HTML comment.&lt;/p&gt;
&lt;![endif]--&gt;</code></pre>
<p>
IE browsers will render the paragraph, but others &#8216;ll omit it, because they think it&#8217;s a HTML comment.
</p>
<p>The next type of conditional comment is the <strong><i>downlevel-revealed</i></strong> statement. The statement is rendered by browsers that don&#8217;t support conditional statements, and of course, IE 5+ browsers only render the statement when they pass the condition.</p>
<pre><code class="html">&lt;![if (gte IE 6)&amp;(lt IE 8)]&gt;
&lt;p&gt;This paragraph is shown by IE6, IE7 and all browsers
that don't support conditional comments.&lt;/p&gt;
&lt;![endif]&gt;</code></pre>
<h2>The conditions</h2>
<p>
<abbr title="Microsoft Developer Network">MSDN</abbr> has a nice list of <a href="http://msdn2.microsoft.com/en-us/library/ms537512.aspx#syntax" title="MSDN Conditional Comments">possible conditions</a>, so I&#8217;m not going to repeat that, I&#8217;ll just give some examples with an explanation.
</p>
<pre><code class="html">&lt;!--[if IE 5]&gt;&lt;p&gt;IE 5&lt;/p&gt;&lt;![endif]--&gt;
&lt;!--[if gte IE 5]&gt;&lt;p&gt;IE 5+&lt;/p&gt;&lt;![endif]--&gt;
&lt;!--[if gt IE 5]&gt;&lt;p&gt;IE 6+&lt;/p&gt;&lt;![endif]--&gt;
&lt;!--[if !(IE)]&gt;&lt;p&gt;Never shown&lt;/p&gt;&lt;![endif]--&gt;
&lt;!--[if (IE 6)|(IE 7)]&gt;&lt;p&gt;IE6 and IE7&lt;/p&gt;&lt;![endif]--&gt;
&lt;!--[if (gte IE 5)&amp;!(IE 5.5)]&gt;&lt;p&gt;IE5+ except IE5.5&lt;/p&gt;&lt;![endif]--&gt;
&lt;!--[if true]&gt;
&lt;![if IE 6]&gt;&lt;p&gt;IE6&lt;/p&gt;&lt;![endif]&gt;
&lt;![if IE 7]&gt;&lt;p&gt;IE7&lt;/p&gt;&lt;![endif]&gt;
&lt;![endif]--&gt;
&lt;![if !(IE)]&gt;&lt;p&gt;All non IE browsers&lt;/p&gt;&lt;![endif]&gt;
</code></pre>
<h2>The uses</h2>
<p>
If you take a look in the source of this page you can see the following conditional tag in between the <code>header</code> tags.
</p>
<pre><code class="html">&lt;!--[if lt IE 7]&gt;
&lt;link type=&quot;text/css&quot; rel=&quot;stylesheet&quot; href=&quot;http://solutoire.com/blog/wp-content/themes/v8.gene/styles/ie6.css&quot; /&gt;
&lt;![endif]--&gt;
</code></pre>
<p>
This conditional comment helps me with keeping my original css file free of hacks. This means that all non-IE browsers render this page just fine, but IE6- messes up most of the positioned elements. Non IE and IE7+ browsers think it&#8217;s just a HTML comment, so the css file is not loaded, but IE6- browsers load the css file that corrects the css styles.
</p>
<p>The same thing can be done for javascript files. My javascript plotting library <a href="http://solutoire.com/flotr/" title="Flotr Project Page">Flotr</a> needs <a href="http://excanvas.sourceforge.net/" title="Excanvas Project Page">Excanvas</a> to treat <a href="http://en.wikipedia.org/wiki/Vector_Markup_Language" title="Wikipedia Vector Markup Language">VML</a> as a canvas element. Excanvas is only needed for IE browsers, because most popular non IE browsers support the canvas element.</p>
<pre><code class="html">&lt;!--[if IE]&gt;&lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot; src=&quot;path/to/excanvas.js&quot;&gt;&lt;/script&gt;&lt;![endif]--&gt;
&lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot; src=&quot;path/to/prototype-x.x.x.x.js&quot;&gt;&lt;/script&gt;
&lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot; src=&quot;path/to/flotr.js&quot;&gt;&lt;/script&gt;
</code></pre>
<h2>Further reading</h2>
<p>
I recommend reading the article on MSDN about <a href="http://msdn2.microsoft.com/en-us/library/ms537512.aspx">conditional statements</a> if this post didn&#8217;t make any sense to you. Also, Peter-Paul Koch wrote a <a href="http://www.quirksmode.org/css/condcom.html">nice roundup</a> on conditional comments at his website <a href="http://www.quirksmode.org/" title="QuirksMode">quirksmode.org</a>.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/solutoire?a=n5-hLVfKN9c:d_e_DeBDmpQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/solutoire?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=n5-hLVfKN9c:d_e_DeBDmpQ:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/solutoire?i=n5-hLVfKN9c:d_e_DeBDmpQ:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=n5-hLVfKN9c:d_e_DeBDmpQ:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/solutoire?i=n5-hLVfKN9c:d_e_DeBDmpQ:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=n5-hLVfKN9c:d_e_DeBDmpQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/solutoire?i=n5-hLVfKN9c:d_e_DeBDmpQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=n5-hLVfKN9c:d_e_DeBDmpQ:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/solutoire?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=n5-hLVfKN9c:d_e_DeBDmpQ:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/solutoire?i=n5-hLVfKN9c:d_e_DeBDmpQ:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/solutoire/~4/n5-hLVfKN9c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://solutoire.com/2008/03/23/html-conditional-comments/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://solutoire.com/2008/03/23/html-conditional-comments/</feedburner:origLink></item>
		<item>
		<title>What’s in your feed reader?</title>
		<link>http://feedproxy.google.com/~r/solutoire/~3/U6nm3d80uag/</link>
		<comments>http://solutoire.com/2008/03/21/whats-in-your-feed-reader/#comments</comments>
		<pubDate>Fri, 21 Mar 2008 19:01:00 +0000</pubDate>
		<dc:creator>Bas Wenneker</dc:creator>
				<category><![CDATA[Other]]></category>
		<category><![CDATA[feeds]]></category>

		<guid isPermaLink="false">http://solutoire.com/2008/03/21/whats-in-your-feed-reader/</guid>
		<description><![CDATA[
Despite of the fact I&#8217;m always hungry for new feeds with interesting articles, I&#8217;m not able to find any new feeds lately. I asked for help from Google Alerts, which notifies me when the GoogleBot hits something I defined an alert for. Though it doesn&#8217;t come up with great content I&#8217;m looking for. That&#8217;s the [...]]]></description>
			<content:encoded><![CDATA[<p>
Despite of the fact I&#8217;m always hungry for new feeds with interesting articles, I&#8217;m not able to find any new feeds lately. I asked for help from Google Alerts, which notifies me when the GoogleBot hits something I defined an alert for. Though it doesn&#8217;t come up with great content I&#8217;m looking for. That&#8217;s the reason I&#8217;d like to ask you for helping me out, because obviously I&#8217;m looking at the wrong spot. In exchange I show you 10 of my favorite feeds.
</p>
<div class="img">
<a style="border: 0px; background:#D2E8FF;" href="http://feeds.feedburner.com/solutoire" title="Grab the Solutoire.com feed"><img  style="border: 0px;" src='http://solutoire.com/blog/wp-content/uploads/2008/03/feed-icon.png' alt='Feed icon' /></a><br />
<a href="http://feeds.feedburner.com/solutoire" title="Grab the Solutoire.com feed">Grab the Solutoire.com feed!</a>
</div>
<h2>My Feeds</h2>
<p>
I use Google Reader as my feed reader (never tried something else). I never read all feed entries, most of the time I&#8217;ve more than 1000 unread articles. Here&#8217;s an unordered list of the ones I&#8217;m dedicated to:
</p>
<h2><a href="http://www.thinkvitamin.com/" title="Vitamin">Vitamin</a> (<a href="http://feeds.feedburner.com/vitaminmasterfeed" title="Vitamin feed">feed</a>)</h2>
<p>
Vitamin is a resource for web designers, developers and entrepreneurs. The online magazine serves great content written by top authors from the web industry.</p>
<h2><a href="http://www.shauninman.com/" title="ShaunInman.com">ShaunInman.com</a> (<a href="http://www.shauninman.com/feeds/plus" title="ShaunInman.com feed">feed</a>)</h2>
<p>
Shaun Inman is a successful designer and developer. He&#8217;s also the founder of <a href="http://haveamint.com/" title="Mint">Mint</a>, the web site analytics program.</p>
<h2><a href="http://ajaxian.com/" title="Ajaxian">Ajaxian</a> (<a href="http://feeds.feedburner.com/ajaxian" title="Ajaxian feed">feed</a>)</h2>
<p>My daily piece of Ajax.</p>
<h2><a href="http://www.devlounge.net/" title="Devlounge">Devlounge</a> (<a href="http://www.devlounge.net/" title="Devlounge feed">feed</a>)</h2>
<p>Online magazine for designers and developers.</p>
<h2><a href="http://www.lifehack.org/" title="Lifehack.org">Lifehack.org</a> (<a href="http://feeds.lifehack.org/Lifehack" title="Lifehack.org feed">feed</a>)</h2>
<p>Daily digest and pointers on productivity, getting things done and lifehacks.</p>
<h2><a href="http://lifehacker.com/" title="Lifehacker">Lifehacker</a> (<a href="http://feeds.gawker.com/lifehacker/full" title="Lifehacker feed">feed</a>)</h2>
<p>Tech tricks, tips and downloads for getting things done. This site delivers up to 10 articles a day!</p>
<h2><a href="http://www.simplebits.com/" title="SimpleBits">SimpleBits</a> (<a href="http://www.simplebits.com/xml/rss.xml" title="SimpleBits feed">feed</a>)</h2>
<p>The blog/company website of designer and author Dan Cederholm.</p>
<h2><a href="http://snook.ca/jonathan/" title="Snook.ca">Snook.ca</a> (<a href="http://feeds.feedburner.com/snookca" title="Snook.ca feed">feed</a>)</h2>
<p>
Snook.ca is the site of web designer, developer, writer and speaker, Jonathan Snook. The articles on the site focus on web development, design, and freelance.
</p>
<h2><a href="http://andrewdupont.net/" title="Painfully Obvious">Painfully Obvious</a>  (<a href="http://andrewdupont.net/feed/atom/" title="Painfully Obvious feed">feed</a>)</h2>
<p>The weblog of Andrew Dupont, web interface developer and writer.</p>
<h2><a href="http://web20show.com/episodes" title="The Web 2.0 Show">The Web 2.0 Show</a> (<a href="http://feeds.feedburner.com/web20Show" title="The Web 2.0 Show feed">feed</a>)</h2>
<p>The Web 2.0 Show is a podcast about emerging technologies commonly referred to as &#8220;Web 2.0&#8243;, and is hosted by Adam Stacoviak and Josh Owens.</p>
<p style="font-size: 1.5em;font-weight:bold; text-align:center">Now, the crucial question is, what&#8217;s in your feed reader?</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/solutoire?a=U6nm3d80uag:0oL5_ef7jnU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/solutoire?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=U6nm3d80uag:0oL5_ef7jnU:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/solutoire?i=U6nm3d80uag:0oL5_ef7jnU:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=U6nm3d80uag:0oL5_ef7jnU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/solutoire?i=U6nm3d80uag:0oL5_ef7jnU:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=U6nm3d80uag:0oL5_ef7jnU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/solutoire?i=U6nm3d80uag:0oL5_ef7jnU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=U6nm3d80uag:0oL5_ef7jnU:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/solutoire?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=U6nm3d80uag:0oL5_ef7jnU:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/solutoire?i=U6nm3d80uag:0oL5_ef7jnU:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/solutoire/~4/U6nm3d80uag" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://solutoire.com/2008/03/21/whats-in-your-feed-reader/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://solutoire.com/2008/03/21/whats-in-your-feed-reader/</feedburner:origLink></item>
		<item>
		<title>Update: Mootools CSS Styled Scrollbar</title>
		<link>http://feedproxy.google.com/~r/solutoire/~3/iVWQtzPK8BY/</link>
		<comments>http://solutoire.com/2008/03/11/update-mootools-css-styled-scrollbar/#comments</comments>
		<pubDate>Tue, 11 Mar 2008 07:16:30 +0000</pubDate>
		<dc:creator>Bas Wenneker</dc:creator>
				<category><![CDATA[Mootools]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[scrollbar]]></category>

		<guid isPermaLink="false">http://solutoire.com/2008/03/11/update-mootools-css-styled-scrollbar/</guid>
		<description><![CDATA[
I&#8217;ve updated my previous post Mootools CSS Styled Scrollbar. I&#8217;ve added instructions about how to make it work with Mootools version 1.11. Also the example is updated. On the Mootools forums someone called &#8216;horseweapon&#8217; wrote a simple function that used my code to make scrollbars. I used his function to work with the example. You [...]]]></description>
			<content:encoded><![CDATA[<p>
I&#8217;ve updated my previous post <a href="http://solutoire.com/2008/03/10/mootools-css-styled-scrollbar/" title="Mootools CSS Styled Scrollbar">Mootools CSS Styled Scrollbar</a>. I&#8217;ve added instructions about how to make it work with Mootools version 1.11. Also the example is updated. On the Mootools forums someone called &#8216;horseweapon&#8217; wrote a <a href="http://forum.mootools.net/viewtopic.php?pid=43321#post-43311" title="Mootools Forums">simple function</a> that used my code to make scrollbars. I used his function to work with the example. You can see the updated example <a href="http://solutoire.com/experiments/scrollbar/index.html" title="Mootools Scrollbar Example">over here</a>.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/solutoire?a=iVWQtzPK8BY:cAfrwPcQpjI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/solutoire?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=iVWQtzPK8BY:cAfrwPcQpjI:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/solutoire?i=iVWQtzPK8BY:cAfrwPcQpjI:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=iVWQtzPK8BY:cAfrwPcQpjI:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/solutoire?i=iVWQtzPK8BY:cAfrwPcQpjI:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=iVWQtzPK8BY:cAfrwPcQpjI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/solutoire?i=iVWQtzPK8BY:cAfrwPcQpjI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=iVWQtzPK8BY:cAfrwPcQpjI:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/solutoire?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/solutoire?a=iVWQtzPK8BY:cAfrwPcQpjI:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/solutoire?i=iVWQtzPK8BY:cAfrwPcQpjI:gIN9vFwOqvQ" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/solutoire/~4/iVWQtzPK8BY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://solutoire.com/2008/03/11/update-mootools-css-styled-scrollbar/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://solutoire.com/2008/03/11/update-mootools-css-styled-scrollbar/</feedburner:origLink></item>
	</channel>
</rss>
