<?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>Kristof Neirynck</title>
	<atom:link href="http://www.crydust.be/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.crydust.be/blog</link>
	<description>yet another webdev blog</description>
	<lastBuildDate>Wed, 05 May 2010 16:13:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Internet Explorer Platform Preview randomness is biased</title>
		<link>http://www.crydust.be/blog/2010/03/16/internet-explorer-platform-preview-randomness-is-biased/</link>
		<comments>http://www.crydust.be/blog/2010/03/16/internet-explorer-platform-preview-randomness-is-biased/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 21:39:57 +0000</pubDate>
		<dc:creator>Kristof Neirynck</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.crydust.be/blog/?p=147</guid>
		<description><![CDATA[After installing Internet Explorer Platform Preview 1.9.7745.6019 the first thing I did was check out its javascript performance on my own scripts. It turns out to have a very wierd output for Math.random. Test your browsers Math.random() function and see for yourself. Update: This seems to be fixed in Explorer Platform Preview 1.9.7766.6000.]]></description>
			<content:encoded><![CDATA[<p>After installing Internet <a href="http://ie.microsoft.com/testdrive/">Explorer Platform Preview</a> 1.9.7745.6019 the first thing I did was check out its javascript performance on my own scripts. It turns out to have a very wierd output for Math.random. <a href="http://www.crydust.be/lab/random/">Test your browsers Math.random() function</a> and see for yourself.</p>
<p><b>Update:</b> This seems to be fixed in Explorer Platform Preview 1.9.7766.6000.</p>

]]></content:encoded>
			<wfw:commentRss>http://www.crydust.be/blog/2010/03/16/internet-explorer-platform-preview-randomness-is-biased/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom model binder to avoid decimal separator problems</title>
		<link>http://www.crydust.be/blog/2009/07/30/custom-model-binder-to-avoid-decimal-separator-problems/</link>
		<comments>http://www.crydust.be/blog/2009/07/30/custom-model-binder-to-avoid-decimal-separator-problems/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 10:52:55 +0000</pubDate>
		<dc:creator>Kristof Neirynck</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>

		<guid isPermaLink="false">http://www.crydust.be/blog/?p=116</guid>
		<description><![CDATA[I bumped into an issue while trying to get the open source ASP.NET MVC project NerdDinner running on my laptop. The Create action in the DinnersController just wouldn&#8217;t work. This was due to Latitude and Longitude values being set with a different decimal separator than my server expected. It got &#34;0.0&#34; instead of &#34;0,0&#34; which [...]]]></description>
			<content:encoded><![CDATA[<p>I bumped into an issue while trying to get the open source ASP.NET MVC project <a href="http://nerddinner.codeplex.com/">NerdDinner</a> running on my laptop. The <code>Create</code> action in the <code>DinnersController</code> just wouldn&#8217;t work. This was due to <code>Latitude</code> and <code>Longitude</code> values being set with a different decimal separator than my server expected. It got &quot;0.0&quot; instead of &quot;0,0&quot; which the <code>Double.parse</code> function didn&#8217;t understand. A client-side JavaScript wrote these values into hidden fields, so it was a bit difficult for me to understand at first. I wrote a custom model binder to solve this for all fields of type <code>double</code> at once.</p>
<p>As I&#8217;m still learning ASP.NET MVC, my solution may not be the optimal one.</p>

<span id="more-116"></span>

<p>Create a custom model binder that will only react differently to <code>double</code> values.</p>
<pre class="prettyprint">
using System;
using System.Globalization;
using System.Web.Mvc;

namespace NerdDinner.Helpers {
  public class CustomModelBinder : DefaultModelBinder {

    public CustomModelBinder()
      : base() {
    }

    public override object BindModel(ControllerContext controllerContext, 
      ModelBindingContext bindingContext) {
      
      object result = null;

      // Don't do this here!
      // It might do bindingContext.ModelState.AddModelError
      // and there is no RemoveModelError!
      // 
      // result = base.BindModel(controllerContext, bindingContext);

      if (bindingContext.ModelType == typeof(double)) {

        string modelName = bindingContext.ModelName;
        string attemptedValue = bindingContext.ValueProvider[modelName].AttemptedValue;

        // Depending on cultureinfo the NumberDecimalSeparator can be &quot;,&quot; or &quot;.&quot;
        // Both &quot;.&quot; and &quot;,&quot; should be accepted, but aren't.
        string wantedSeperator = NumberFormatInfo.CurrentInfo.NumberDecimalSeparator;
        string alternateSeperator = (wantedSeperator == &quot;,&quot; ? &quot;.&quot; : &quot;,&quot;);

        if (attemptedValue.IndexOf(wantedSeperator) == -1 
          &amp;&amp; attemptedValue.IndexOf(alternateSeperator) != -1) {
          attemptedValue = attemptedValue.Replace(alternateSeperator, wantedSeperator);
        }

        try {
          result = double.Parse(attemptedValue, NumberStyles.Any);
        }
        catch (FormatException e) {
          bindingContext.ModelState.AddModelError(modelName, e);
        }

      }
      else {
        result = base.BindModel(controllerContext, bindingContext);
      }

      return result;
    }
  }
}
</pre>

<p>Change the <code>DefaultBinder</code> in <code>Global.asax</code>.</p>
<pre class="prettyprint">
void Application_Start() {
  //[SNIP]
  ModelBinders.Binders.DefaultBinder = new CustomModelBinder();
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.crydust.be/blog/2009/07/30/custom-model-binder-to-avoid-decimal-separator-problems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE8 aggressive caching fix</title>
		<link>http://www.crydust.be/blog/2009/03/20/ie8-aggressive-caching-fix/</link>
		<comments>http://www.crydust.be/blog/2009/03/20/ie8-aggressive-caching-fix/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 10:08:42 +0000</pubDate>
		<dc:creator>Kristof Neirynck</dc:creator>
				<category><![CDATA[asp]]></category>

		<guid isPermaLink="false">http://www.crydust.be/blog/?p=93</guid>
		<description><![CDATA[Apparently Internet Explorer 8 has a more aggressive caching mechanism than any other browser I&#8217;ve ever met. To fix it I&#8217;ve added the following to almost every dynamic page on my server. &#60;% // prevent caching (asp classic jscript) Response.CacheControl = &#34;no-cache&#34;; Response.AddHeader(&#34;Pragma&#34;, &#34;no-cache&#34;); Response.Expires = -1; %&#62; &#60;% ' prevent caching (asp classic vbscript) [...]]]></description>
			<content:encoded><![CDATA[<p>Apparently Internet Explorer 8 has a more aggressive caching mechanism than any other browser I&#8217;ve ever met. To fix it I&#8217;ve added the following to almost every dynamic page on my server.</p>

<pre class="prettyprint">
&lt;%
// prevent caching (asp classic jscript)
Response.CacheControl = &quot;no-cache&quot;;
Response.AddHeader(&quot;Pragma&quot;, &quot;no-cache&quot;);
Response.Expires = -1;
%&gt;
</pre>

<pre class="prettyprint">
&lt;%
' prevent caching (asp classic vbscript) '
Response.CacheControl = &quot;no-cache&quot;
Response.AddHeader &quot;Pragma&quot;, &quot;no-cache&quot;
Response.Expires = -1
%&gt;
</pre>

<pre class="prettyprint">
&lt;?php
// prevent caching (php)
header('Cache-Control: no-cache');
header('Pragma: no-cache');
header('Expires: ' . gmdate(DATE_RFC1123, time()-1));
?&gt;
</pre>

<pre class="prettyprint">
// prevent caching (C#)
//Response.AddHeader(&quot;Cache-Control&quot;, &quot;no-cache&quot;);
//Response.AddHeader(&quot;Pragma&quot;, &quot;no-cache&quot;);
//Response.Expires = -1;

Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
Response.Cache.SetExpires(DateTime.MinValue);
</pre>

<p>More information here: <a href="http://support.microsoft.com/kb/234067">How to prevent caching in Internet Explorer</a></p>


]]></content:encoded>
			<wfw:commentRss>http://www.crydust.be/blog/2009/03/20/ie8-aggressive-caching-fix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight vs Flash Chess</title>
		<link>http://www.crydust.be/blog/2009/03/16/silverlight-vs-flash-chess/</link>
		<comments>http://www.crydust.be/blog/2009/03/16/silverlight-vs-flash-chess/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 08:45:03 +0000</pubDate>
		<dc:creator>Kristof Neirynck</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://www.crydust.be/blog/?p=89</guid>
		<description><![CDATA[<p>After seeing the <a href="http://silverlight.net/themes/silverlight/community/gallerydetail.aspx?cat=sl2#vid1812">Silverlight Chess</a> sample I immediately started work on a flash version. It needs a lot of optimizing, not a single variable type was set, so it's not a very fair fight. Anyway ... flash is about 10x faster than the ie7 js engine on my machine. But still a lot slower than silverlight.</p>]]></description>
			<content:encoded><![CDATA[<p>After seeing the <a href="http://silverlight.net/themes/silverlight/community/gallerydetail.aspx?cat=sl2#vid1812">Silverlight Chess</a> sample I immediately started work on a flash version. It needs a lot of optimizing, not a single variable type was set, so it&#8217;s not a very fair fight. Anyway &#8230; flash is about 10x faster than the ie7 js engine on my machine. But still a lot slower than silverlight.</p>
<span id="more-89"></span>
<p>Compare for yourself:</p>
<ul>
<li><a href="http://www.crydust.be/lab/chess/silverlight_vs_js/Default.html">silverlight vs javascript</a> (unchanged original)</li>
<li><a href="http://www.crydust.be/lab/chess/silverlight_vs_flash/Default.html">silverlight vs flash</a> (js delegates all logic to flash, silverlight code unchanged)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.crydust.be/blog/2009/03/16/silverlight-vs-flash-chess/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Generate Excel files in ASP Classic</title>
		<link>http://www.crydust.be/blog/2009/03/02/generate-excel-files-in-asp-classic/</link>
		<comments>http://www.crydust.be/blog/2009/03/02/generate-excel-files-in-asp-classic/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 20:14:40 +0000</pubDate>
		<dc:creator>Kristof Neirynck</dc:creator>
				<category><![CDATA[asp]]></category>

		<guid isPermaLink="false">http://www.crydust.be/blog/?p=78</guid>
		<description><![CDATA[<p>Generating Excel files in ASP Classic is not as easy as I thought. I hope someone finds use in this little piece of code that shows a way to export data to csv and to xls.</p>]]></description>
			<content:encoded><![CDATA[<p>Generating Excel files in ASP Classic is not as easy as I thought. I hope someone finds use in this little piece of code that shows a way to export data to csv and to xls.</p>

<span id="more-78"></span>

<pre class="prettyprint">
&lt;%@LANGUAGE=&quot;JAVASCRIPT&quot; CODEPAGE=&quot;65001&quot;%&gt;
&lt;%

function getData(connectionString, sql){
    var result = null;
    var adStateOpen = 1;
    var connection = new ActiveXObject(&quot;ADODB.CONNECTION&quot;);
    try{
        connection.Open(connectionString);
    } catch(e1){
        return null;
    }
    if (connection.State !== adStateOpen) {
        return null;
    }
    try{
        var recordset = connection.Execute(sql);
    } catch(e2){
        return null;
    }
    if (!recordset.EOF) {
        result = recordset.GetRows().toArray();
        recordset.Close();
    }
    recordset = null;
    connection.Close();
    connection = null;
    return result;
}


function writeCsvHttpHeaders(filename){
    Response.ContentType = &quot;text/csv&quot;;
    Response.Charset = &quot;utf-8&quot;;
    Response.AddHeader(&quot;Content-Disposition&quot;, 
            &quot;attachment; filename=&quot;+filename+&quot;.csv&quot;);
}

function writeXlsHttpHeaders(filename){
    Response.ContentType = &quot;application/vnd.ms-excel&quot;;
    Response.Charset = &quot;utf-8&quot;;
    Response.AddHeader(&quot;Content-Disposition&quot;, 
            &quot;attachment; filename=&quot;+filename+&quot;.xls&quot;);
}

function getXlsStart(){
    return &quot;&quot;
    + &quot;&lt;html&gt;\n&quot;
    + &quot;&lt;head&gt;\n&quot;
    + &quot;&lt;meta http-equiv=\&quot;Content-Type\&quot; &quot;
    + &quot;content=\&quot;text/html; charset=UTF-8\&quot;&gt;\n&quot;
    + &quot;&lt;style type=\&quot;text/css\&quot;&gt;\n&quot;
    + &quot;html, body, table {\n&quot;
    + &quot;    margin: 0;\n&quot;
    + &quot;    padding: 0;\n&quot;
    + &quot;    font-size: 11pt;\n&quot;
    + &quot;}\n&quot;
    + &quot;table, th, td { \n&quot;
    + &quot;    border: 0.1pt solid #D0D7E5;\n&quot;
    + &quot;    border-collapse: collapse;\n&quot;
    + &quot;    border-spacing: 0;\n&quot;
    + &quot;}\n&quot;
    + &quot;&lt;/style&gt;\n&quot;
    + &quot;&lt;/head&gt;\n&quot;
    + &quot;&lt;body&gt;\n&quot;
    + &quot;&lt;table&gt;\n&quot;
    + &quot;&quot;;
}

function getXlsEnd(){
    return &quot;&quot;
    + &quot;&lt;/table&gt;\n&quot;
    + &quot;&lt;/body&gt;\n&quot;
    + &quot;&lt;/html&gt;&quot;
    + &quot;&quot;;
}

function csvEscape(val){
    if (typeof val === &quot;number&quot;) {
        return val.toString(10).replace(&quot;.&quot;, &quot;,&quot;);
    } else if (typeof val === &quot;string&quot;) {
        if (val.indexOf(&quot;\&quot;&quot;) !== -1) {
            return &quot;\&quot;&quot;+val.replace(/&quot;/g, &quot;\&quot;\&quot;&quot;)+&quot;\&quot;&quot;;
        } else if (val.indexOf(&quot;;&quot;) !== -1) {
            return &quot;\&quot;&quot;+val+&quot;\&quot;&quot;;
        } else {
            return val;
        }
    } else if (val === null) {
        return &quot;#NULL#&quot;;
    } else if (val === undefined) {
        return &quot;#UNDEFINED#&quot;;
    } else {
        return &quot;#ERROR#&quot;;
    }
}

function writeCsv(filename, data, columnCount){
    writeCsvHttpHeaders(filename);
    // utf-8 BOM (very important for special characters)
    Response.Write(&quot;\uFEFF&quot;);
    for (var i=0, il=data.length; i&lt;il; i+=columnCount) {
        for (var j=0; j&lt;columnCount; j++) {
            Response.Write(csvEscape(data[i+j]));
            if (j !== columnCount-1) {
                Response.Write(&quot;;&quot;);
            }
        }
        Response.Write(&quot;\n&quot;);
        // prevent Response Buffering Limit Exceeded
        if (i % 1000 === 0) {
            Response.Flush();
        }
    }
}

function xlsEscape(val){
    if (typeof val === &quot;number&quot;) {
        return val.toString(10).replace(&quot;.&quot;, &quot;,&quot;);
    } else if (typeof val === &quot;string&quot;) {
        return Server.HTMLEncode(val);
    } else if (val === null)  {
        return &quot;#NULL#&quot;;
    } else if (val === undefined)  {
        return &quot;#UNDEFINED#&quot;;
    } else {
        return &quot;#ERROR#&quot;;
    }
}

function writeXls(filename, data, columnCount){
    writeXlsHttpHeaders(filename);
    Response.Write(getXlsStart());
    for (var i=0, il=data.length; i&lt;il; i+=columnCount) {
        Response.Write(&quot;&lt;tr&gt;&quot;);
        for (var j=0; j&lt;columnCount; j++) {
            Response.Write(&quot;&lt;td&gt;&quot;);
            Response.Write(xlsEscape(data[i+j]));
            Response.Write(&quot;&lt;/td&gt;&quot;);
        }
        Response.Write(&quot;&lt;/tr&gt;\n&quot;);
        // prevent Response Buffering Limit Exceeded
        if (i % 1000 === 0) {
            Response.Flush();
        }
    }
    Response.Write(getXlsEnd());
}

function main(){
    var filetype = Request.QueryString(&quot;filetype&quot;)();
    var connectionString = &quot;Provider=SQLOLEDB.1;&quot;
    + &quot;Data Source=LAPTOP\\SQLEXPRESS;&quot;
    + &quot;User ID=internal;&quot;
    + &quot;Password=internal;&quot;
    + &quot;Initial Catalog=trees_in_sql&quot;;
    var sql = &quot;&quot;
    + &quot;SELECT id \n&quot;
    + &quot;, name \n&quot;
    + &quot;FROM People \n&quot;
    + &quot;;&quot;;
    var filename = &quot;filename&quot;;
    var columnCount = 2;
    
    var data = getData(connectionString, sql);
    if (data !== null) {
        Response.Clear();
        if (filetype === &quot;csv&quot;) {
            writeCsv(filename, data, columnCount);
        } else {
            writeXls(filename, data, columnCount);
        }
    } else {
        Response.Write(&quot;Error, no data found&quot;);
    }
    Response.End();
}

main();

%&gt;
</pre>

<p>Resources:</p>
<ul>
<!--
dead link
<li><a href="http://www.netdominus.co.uk/knowledgebase/mod/resource/view.php?id=182">Styling Excel cells with mso-number-format</a></li>
&#8211;>
<li><a href="http://agoric.com/sources/software/htmltoExcel">From HTML to Excel</a></li>
<li><a href="http://stackoverflow.com/questions/440892/how-to-output-an-excel-xls-file-from-classic-asp/594928#594928">How to output an Excel *.xls file from classic ASP</a></li>
<li><a href="http://www.w3schools.com/media/media_mimeref.asp">Multimedia MIME Reference</a></li>
<li><a href="http://classicasp.aspfaq.com/general/how-do-i-prompt-a-save-as-dialog-for-an-accepted-mime-type.html">How do I prompt a &quot;Save As&quot; dialog for an accepted mime type?</a></li>
<li><a href="http://www.c-sharpcorner.com/UploadFile/kaushikborah28/79Nick08302007171404PM/79Nick.aspx">Creating a dynamic Excel using HTML</a></li>
<li><a href="http://www.phpsolvent.com/wordpress/?p=265">MS Excel is making me look bad</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.crydust.be/blog/2009/03/02/generate-excel-files-in-asp-classic/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Selecting a random employee with adjacency tables</title>
		<link>http://www.crydust.be/blog/2009/02/24/selecting-a-random-employee-with-adjacency-tables/</link>
		<comments>http://www.crydust.be/blog/2009/02/24/selecting-a-random-employee-with-adjacency-tables/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 08:30:36 +0000</pubDate>
		<dc:creator>Kristof Neirynck</dc:creator>
				<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.crydust.be/blog/?p=75</guid>
		<description><![CDATA[In my previous blogpost I mentioned a way to retrieve the entire tree from a hierarchy stored with adjacency tables. Now I&#8217;ve got a way to retrieve a random employee in an organisation. I use ORDER BY NEWID() to randomize the order and TOP 1 to get only one result. WITH Bosses (id, boss_id, name, [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://www.crydust.be/blog/2009/02/24/adjacency-tables/">previous blogpost</a> I mentioned a way to retrieve the entire tree from a hierarchy stored with adjacency tables. Now I&#8217;ve got a way to retrieve a random employee in an organisation.</p>

<p>I use ORDER BY NEWID() to randomize the order and TOP 1 to get only one result.</p>

<pre class="prettyprint">
WITH Bosses (id, boss_id, name, depth, hierarchy)
AS (
	SELECT id
	, boss_id
	, name
	, 0
	, name
	FROM People
	WHERE boss_id IS NULL
	
	UNION ALL
	
	SELECT People.id
	, People.boss_id
	, People.name
	, Bosses.depth + 1
	, CONVERT(VARCHAR(50), Bosses.hierarchy + ' &gt; ' + People.name)
	FROM People
	, Bosses
	WHERE People.boss_id = Bosses.id
)
SELECT TOP 1 * 
FROM Bosses
WHERE depth &gt;= 2
ORDER BY NEWID();
</pre>]]></content:encoded>
			<wfw:commentRss>http://www.crydust.be/blog/2009/02/24/selecting-a-random-employee-with-adjacency-tables/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adjacency tables</title>
		<link>http://www.crydust.be/blog/2009/02/24/adjacency-tables/</link>
		<comments>http://www.crydust.be/blog/2009/02/24/adjacency-tables/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 22:42:21 +0000</pubDate>
		<dc:creator>Kristof Neirynck</dc:creator>
				<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.crydust.be/blog/?p=71</guid>
		<description><![CDATA[I&#8217;m well aware that adjacency tables aren&#8217;t the newest way of storing hierarchies in a database. Personally I prefer to use nested sets. But on this one project I had to work with a legacy database. It took me quite a while to find out how to retrieve an entire tree in one requests. This [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m well aware that adjacency tables aren&#8217;t the newest way of storing hierarchies in a database. Personally I prefer to use nested sets. But on this one project I had to work with a legacy database. It took me quite a while to find out how to retrieve an entire tree in one requests. This is obviously needed to speed up queries on large amounts of data.</p>

<p>This query is here to help me remember how to do it.</p>

<pre class="prettyprint">
DROP TABLE People;

CREATE TABLE People (
id INT NOT NULL PRIMARY KEY IDENTITY
, boss_id INT
, name VARCHAR(50)
);

SET IDENTITY_INSERT People ON

INSERT INTO People (id, boss_id, name)
          SELECT 1, NULL, 'Bert'
UNION ALL SELECT 2, 1, 'Sylvie'
UNION ALL SELECT 3, 1, 'Sylvia'
UNION ALL SELECT 4, 2, 'Davy'
UNION ALL SELECT 5, 2, 'Xavier'
UNION ALL SELECT 6, 3, 'Kristof'
UNION ALL SELECT 7, 3, 'Piet';

WITH Bosses (id, boss_id, name, depth, hierarchy)
AS (
	SELECT id
	, boss_id
	, name
	, 0
	, name
	FROM People
	WHERE boss_id IS NULL
	
	UNION ALL
	
	SELECT People.id
	, People.boss_id
	, People.name
	, Bosses.depth + 1
	, CONVERT(VARCHAR(50), Bosses.hierarchy + ' &gt; ' + People.name)
	FROM People
	, Bosses
	WHERE People.boss_id = Bosses.id
)
SELECT * 
FROM Bosses
ORDER BY Bosses.hierarchy;
</pre>

<table>
<tr><th>id</th><th>boss_id</th><th>name</th><th>depth</th><th>hierarchy</th></tr>
<tr><td>1</td><td>NULL</td><td>Bert</td><td>0</td><td>Bert</td></tr>
<tr><td>3</td><td>1</td><td>Sylvia</td><td>1</td><td>Bert &gt; Sylvia</td></tr>
<tr><td>6</td><td>3</td><td>Kristof</td><td>2</td><td>Bert &gt; Sylvia &gt; Kristof</td></tr>
<tr><td>7</td><td>3</td><td>Piet</td><td>2</td><td>Bert &gt; Sylvia &gt; Piet</td></tr>
<tr><td>2</td><td>1</td><td>Sylvie</td><td>1</td><td>Bert &gt; Sylvie</td></tr>
<tr><td>4</td><td>2</td><td>Davy</td><td>2</td><td>Bert &gt; Sylvie &gt; Davy</td></tr>
<tr><td>5</td><td>2</td><td>Xavier</td><td>2</td><td>Bert &gt; Sylvie &gt; Xavier</td></tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.crydust.be/blog/2009/02/24/adjacency-tables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Css in Flex</title>
		<link>http://www.crydust.be/blog/2008/08/29/css-in-flex/</link>
		<comments>http://www.crydust.be/blog/2008/08/29/css-in-flex/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 15:58:26 +0000</pubDate>
		<dc:creator>Kristof Neirynck</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://www.crydust.be/blog/?p=68</guid>
		<description><![CDATA[I had some issues today to change the background color of a button in Flex. The up-skin was set for the Button selector which meant setting the fill-colors property for the Button.special selector had no effect. Setting the up-skin to null was the only solution. This was easy to do in code with setStyle, but [...]]]></description>
			<content:encoded><![CDATA[<p>
I had some issues today to change the background color of a button in Flex. The up-skin was set for the Button selector which meant setting the fill-colors property for the Button.special selector had no effect. Setting the up-skin to null was the only solution. This was easy to do in code with setStyle, but I wanted to do it in css. Writing null wasn&#8217;t quite enough. Apearently you need to use ClassReference(null). Hope this helps someone out.
</p>

<pre>
Button {
  up-skin: Embed(source='img/example.png');
}
Button.special{
  <strong>up-skin: ClassReference(null);</strong>
  fill-alphas: 1.0, 1.0;
  fill-colors: #00FF00, #00FF00;
}
</pre>]]></content:encoded>
			<wfw:commentRss>http://www.crydust.be/blog/2008/08/29/css-in-flex/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>2M08 Silverlight</title>
		<link>http://www.crydust.be/blog/2008/05/23/2m08-silverlight-2/</link>
		<comments>http://www.crydust.be/blog/2008/05/23/2m08-silverlight-2/#comments</comments>
		<pubDate>Fri, 23 May 2008 11:25:19 +0000</pubDate>
		<dc:creator>Kristof Neirynck</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.crydust.be/blog/?p=66</guid>
		<description><![CDATA[A hands-on workshop about Silverlight 2.0. The many MacBooks that are available are probably set up for the Air session this afternoon. Our speaker informs us &#34;We wont be using those&#34;, quickly followed by &#34;Silverlight is a cross platform &#8230;&#34;. Blend has loads of panels and properties. Nesting controls is possible. You can have a [...]]]></description>
			<content:encoded><![CDATA[<p>A hands-on workshop about Silverlight 2.0.</p>

<p>The many MacBooks that are available are probably set up for the Air session this afternoon. Our speaker informs us &quot;We wont be using those&quot;, quickly followed by &quot;Silverlight is a cross platform &#8230;&quot;.</p>

<p>Blend has loads of panels and properties. Nesting controls is possible. You can have a video inside a button.</p>

<p>Changes in Blend are detected in Visual studio. It helps to do a rebuild in Blend to make shure Visual studio isn&#8217;t working on an old version. Design view isn&#8217;t fully supported there yet. Double clicking on a button doesn&#8217;t get you a onClick handler yet.</p>

<p>Silverlight uses layout managers like Flex. Buttons have a content property which enables design and programming to be done separately. You can create some kind of color palette of <em>Brush Resources</em> in Blend which translates to <em>SolidColorBrush</em> elements in XAML. Visual studio has intellisence for XAML which makes it easier to type in there than in Blend. Fullscreen is supported but must be initiated by the user. Controls have a background and a border while other elements have a fill and a stroke. Blend has some glitches when setting properties on multiple controls. Switching to XAML code is the normal reaction to that. Not shure how designers will react to that. Hope these things are fixed when it goes out of beta.</p>

<p>The presentation was quite good, but I&#8217;m not sure weather I&#8217;m going to dump flash for this.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crydust.be/blog/2008/05/23/2m08-silverlight-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>on Air Brussels</title>
		<link>http://www.crydust.be/blog/2008/04/23/on-air-brussels/</link>
		<comments>http://www.crydust.be/blog/2008/04/23/on-air-brussels/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 20:52:39 +0000</pubDate>
		<dc:creator>Kristof Neirynck</dc:creator>
				<category><![CDATA[AIR]]></category>

		<guid isPermaLink="false">http://www.crydust.be/blog/?p=63</guid>
		<description><![CDATA[<p>A long overdue overview of the on Air event in Brussels.</p>]]></description>
			<content:encoded><![CDATA[<p>A long overdue overview of the on Air event in Brussels.</p>
<span id="more-63"></span>

<h3>Keynote (Serge Jespers)</h3>
<ul>
<li>AIR 1.1 expected middle of 2008 and it will have multi language support (Dutch not confirmed, but French will be in there)</li>
<li>Impressive demo of os integration: drag and drop image from air app on ubuntu in virtual machine to mac desktop</li>
<li><a href="http://adobemax08.com/">MAX 2008</a> will be in Milan</li>
<li>I asked Serge behind the scenes about <a href="http://shu-player.com/">shu</a> and he said adobe isn&#8217;t sure weather they&#8217;ll allow it.</li>
</ul>

<h3>Building your first Adobe AIR application with Adobe Flex (Mike Chambers)</h3>
<p>Two links:</p>
<ul>
<li><a href="http://adobe.com/go/air">Everything Air</a></li>
<li><a href="http://onair.adobe.com/api/">Loads of feeds about the tour</a></li>
</ul>

<h3>Building your first AIR application with HTML and JavaScript (Kevin Hoyt)</h3>
<ul>
<li><a href="http://livedocs.adobe.com/air/1/devappshtml/help.html?content=AIR_Introspector_1.html">Air introspector</a> is like a firebug for Air.</li>
<li><a href="http://www.aptana.com/studio">Aptana Studio</a> is the best javascript editor ever. Great code completion.</li>
<li>The eval() function doesn&#8217;t work in html component after onload. This is also a problem for setTimeout. Most javascript frameworks have already been adapted.</li>
<li><a href="http://webplicity.net/flexigrid/">flexigrid</a> converts html table into interactive flex tables</li>
</ul>

<h3>Leveraging HTML and JavaScript within Adobe AIR (Ryan Stewart)</h3>
<p><a href="http://livedocs.adobe.com/air/1/devappshtml/ByteArrays_3.html">Reading a zip file with air</a> is accessible from javascript. This gives me perspectives for quite a few apps.</p>

<h3>Deploying and Updating AIR Applications (Serge Jespers)</h3>
<ul>
<li>Signing your Air apps is not only recommended, it changes the warning in the installer into something less scary. <a href="http://www.thawte.com/">Thawte</a> is selling certificates (299 $ / year = 190 € / year)</li>
<li>New <a href="http://labs.adobe.com/wiki/index.php/AIR_Badge">Air install badge</a> in beta.</li>
</ul>

<h3>Introduction to SQLite in Adobe AIR (Peter Elst)</h3>
<p>You can <a href="http://www.peterelst.com/blog/2008/04/18/sqlite-in-adobe-air-session-video/">watch it yourself</a> and the <a href="http://www.peterelst.com/blog/2008/04/07/introduction-to-sqlite-in-adobe-air/">slides and apps</a> are online too. This was my favorite session of the day. There is something about storing flvs from youtube in a local database that is so cool &#8230;</p>

<h3>Developing Secure AIR Applications (Oliver Goldman)</h3>
<p>Among many other things Oliver recommended to check the version number yourself when upgrading to prevent downgrade attacks. You can&#8217;t rely on the user to look at it himself.</p>

<h3>Using JavaScript Frameworks in AIR Applications (Andre Charland)</h3>
<ul>
<li>Andre put his <a href="http://nitobi.com/air/">slides and apps</a> online</li>
<li><a href="http://xtnd.us/">Xtnd code completion for jquery</a> in Dreamweaver</li>
<li><a href="http://about.stompernet.com/scrutinizer">Scrutinizer</a> is a browser with blurriness built-in like my own <a href="http://www.crydust.be/blog/2008/02/27/silver-explorer/">Silver Explorer</a>. Behind the scenes Andre told me he&#8217;s thinking about integrating it with <a href="http://robotreplay.com/">RobotReplay</a> so he can replay user interactions and show the part around the mouse cursor in clear sight but blur everything around it. Looks promising.</li>
</ul>

<h3>AIR Conditioning (Lee Brimelow)</h3>
<p>Lee showed us a lot of really fun apps, you can find <a href="http://theflashblog.com/?p=342">his slides here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.crydust.be/blog/2008/04/23/on-air-brussels/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
