<?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"
	>

<channel>
	<title>Nafai's amazing technicolor dream blog!</title>
	<atom:link href="http://web.nafai.org/feed" rel="self" type="application/rss+xml" />
	<link>http://web.nafai.org</link>
	<description>"The noblest pleasure is the joy of understanding"  (Leonardo da Vinci)</description>
	<pubDate>Fri, 04 Jun 2010 11:42:38 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Best of Japanese 80&#8242;es band Wands</title>
		<link>http://web.nafai.org/archives/753</link>
		<comments>http://web.nafai.org/archives/753#comments</comments>
		<pubDate>Fri, 04 Jun 2010 11:42:38 +0000</pubDate>
		<dc:creator>Thor Asmund</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://web.nafai.org/?p=753</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><object width="250" height="400"><param name="movie" value="http://listen.grooveshark.com/widget.swf" /><param name="wmode" value="window" /><param name="allowScriptAccess" value="always" /><param name="flashvars" value="hostname=cowbell.grooveshark.com&#038;widgetID=21400986&#038;style=metal&#038;bbg=E8DA5E&#038;bfg=FFFFFF&#038;bt=FF4746&#038;bth=E8DA5E&#038;pbg=FF4746&#038;pbgh=FFFFFF&#038;pfg=E8DA5E&#038;pfgh=FF4746&#038;si=FF4746&#038;lbg=FF4746&#038;lbgh=FFFFFF&#038;lfg=E8DA5E&#038;lfgh=FF4746&#038;sb=FF4746&#038;sbh=FFFFFF&#038;p=0" /><embed src="http://listen.grooveshark.com/widget.swf" type="application/x-shockwave-flash" width="250" height="400" flashvars="hostname=cowbell.grooveshark.com&#038;widgetID=21400986&#038;style=metal&#038;bbg=E8DA5E&#038;bfg=FFFFFF&#038;bt=FF4746&#038;bth=E8DA5E&#038;pbg=FF4746&#038;pbgh=FFFFFF&#038;pfg=E8DA5E&#038;pfgh=FF4746&#038;si=FF4746&#038;lbg=FF4746&#038;lbgh=FFFFFF&#038;lfg=E8DA5E&#038;lfgh=FF4746&#038;sb=FF4746&#038;sbh=FFFFFF&#038;p=0" allowScriptAccess="always" wmode="window" /></object></p>
]]></content:encoded>
			<wfw:commentRss>http://web.nafai.org/archives/753/feed</wfw:commentRss>
		</item>
		<item>
		<title>Trying out ScribeFire</title>
		<link>http://web.nafai.org/archives/749</link>
		<comments>http://web.nafai.org/archives/749#comments</comments>
		<pubDate>Fri, 12 Feb 2010 22:00:25 +0000</pubDate>
		<dc:creator>Thor Asmund</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://web.nafai.org/archives/749</guid>
		<description><![CDATA[ScribeFire is a plugin for FireFox that facilitates adding entries to your blog from within FireFox. I am yet to find&#160; out which other nice features it has, for instance if it can grab and rescale images from websites, or quote pages.
http://www.scribefire.com/help/firstrun/

]]></description>
			<content:encoded><![CDATA[<p>ScribeFire is a plugin for FireFox that facilitates adding entries to your blog from within FireFox. I am yet to find&nbsp; out which other nice features it has, for instance if it can grab and rescale images from websites, or quote pages.</p>
<p>http://www.scribefire.com/help/firstrun/</p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=a167b034-215c-8745-91ce-f1a80725f8dd" /></div>
]]></content:encoded>
			<wfw:commentRss>http://web.nafai.org/archives/749/feed</wfw:commentRss>
		</item>
		<item>
		<title>Ny router</title>
		<link>http://web.nafai.org/archives/748</link>
		<comments>http://web.nafai.org/archives/748#comments</comments>
		<pubDate>Fri, 12 Feb 2010 21:42:39 +0000</pubDate>
		<dc:creator>Thor Asmund</dc:creator>
		
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://web.nafai.org/?p=748</guid>
		<description><![CDATA[Så fik jeg endelig taget mig sammen til at købe en ny wireless router. Valget faldt på en prisbillige N Home Router fra D-Link.

Den ser måske ikke ud af meget, men den har et væld af opsætningsmuligheder, og var forbløffende nem at få til at virke. De utallige routere jeg har haft i tidens løb [...]]]></description>
			<content:encoded><![CDATA[<p>Så fik jeg endelig taget mig sammen til at købe en ny wireless router. Valget faldt på en prisbillige N Home Router fra D-Link.</p>
<p><img src="http://3.bp.blogspot.com/_4NgOT2-fquI/SyX3FBZnqRI/AAAAAAAACAk/DpyAHHlV7Aw/s400/D-LINK-DIR-615+box.jpg" alt="" width="400" height="309" /></p>
<p>Den ser måske ikke ud af meget, men den har et væld af opsætningsmuligheder, og var forbløffende nem at få til at virke. De utallige routere jeg har haft i tidens løb har været enten meget svære at sætte op, eller har vist sig at være helt umulige at arbejde med. Senest en Huawei D100 der ikke har givet mig endet end grå hår!</p>
]]></content:encoded>
			<wfw:commentRss>http://web.nafai.org/archives/748/feed</wfw:commentRss>
		</item>
		<item>
		<title>Good article on the LINQ To SQL vs Entities</title>
		<link>http://web.nafai.org/archives/747</link>
		<comments>http://web.nafai.org/archives/747#comments</comments>
		<pubDate>Sat, 16 Jan 2010 23:08:59 +0000</pubDate>
		<dc:creator>Thor Asmund</dc:creator>
		
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://web.nafai.org/?p=747</guid>
		<description><![CDATA[Good article highlighting the advantages of both LINQ To SQL and LINQ To Entities.
http://msdn.microsoft.com/en-us/library/cc161164.aspx
]]></description>
			<content:encoded><![CDATA[<p>Good article highlighting the advantages of both LINQ To SQL and LINQ To Entities.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/cc161164.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/cc161164.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://web.nafai.org/archives/747/feed</wfw:commentRss>
		</item>
		<item>
		<title>Static DataContext? No-no</title>
		<link>http://web.nafai.org/archives/746</link>
		<comments>http://web.nafai.org/archives/746#comments</comments>
		<pubDate>Tue, 05 Jan 2010 23:00:07 +0000</pubDate>
		<dc:creator>Thor Asmund</dc:creator>
		
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://web.nafai.org/?p=746</guid>
		<description><![CDATA[It is necessary to reuse the DataContext object in an ASP.NET application, but the way to do it is a bit tricky. Especially if you have a multi-layered data model and you make several queries against the database.
The obvious - but wrong way - is to create a static instance of the DataContext somewhere in [...]]]></description>
			<content:encoded><![CDATA[<p>It is necessary to reuse the DataContext object in an ASP.NET application, but the way to do it is a bit tricky. Especially if you have a multi-layered data model and you make several queries against the database.</p>
<p>The obvious - but wrong way - is to create a static instance of the DataContext somewhere in your business model. The reason this is wrong is that the static variable will remain there for successive calls to your web application. If something goes wrong in one request, for instance if an entity is updated but for some reason the SubmitChanges fails, then this failed object will still be in the DataContext when subsequent (or concurrent) requests to your site occur.</p>
<p>This blog has a nice approach to how the DataContext can be tied to the HttpContext.</p>
<p><a href="http://www.west-wind.com/weblog/posts/246222.aspx" target="_blank">http://www.west-wind.com/weblog/posts/246222.aspx</a></p>
<p>In particular the comment by  <em>Richard Deeming </em>using an extension method looks promising.</p>
]]></content:encoded>
			<wfw:commentRss>http://web.nafai.org/archives/746/feed</wfw:commentRss>
		</item>
		<item>
		<title>Koch curve variant in C# using delegates and userPaintBox</title>
		<link>http://web.nafai.org/archives/744</link>
		<comments>http://web.nafai.org/archives/744#comments</comments>
		<pubDate>Sun, 27 Dec 2009 10:40:11 +0000</pubDate>
		<dc:creator>Thor Asmund</dc:creator>
		
		<category><![CDATA[OtAkU]]></category>

		<guid isPermaLink="false">http://web.nafai.org/?p=744</guid>
		<description><![CDATA[Why? Because I can. And because delegates are cute.  

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
   [...]]]></description>
			<content:encoded><![CDATA[<p>Why? Because I can. And because delegates are cute. <img src='http://web.nafai.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre>
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            // Setup
            turtleBox.Reset();

            KochDelegate kochFunction = null;
            kochFunction = delegate(int angle, int step, int depth)
            {
                if (depth-- < 0) return;

                turtleBox.Turn(angle);
                kochFunction(-angle, step, depth);
                turtleBox.Move(step);
                turtleBox.Turn(-angle);
                kochFunction(angle, step, depth);
                turtleBox.Move(step);
                kochFunction(angle, step, depth);
                turtleBox.Turn(-angle);
                turtleBox.Move(step);
                kochFunction(-angle, step, depth);
                turtleBox.Turn(angle);
            };

            kochFunction(90, 4, 8);
        }
    }

    public class TurtleBox : PictureBox
    {
        private Pen pen = new Pen(Color.Black);
        private Graphics graphics;

        public void Reset()
        {
            Image = new Bitmap(Size.Width, Size.Height);
            graphics = Graphics.FromImage(Image);
            graphics.Clear(Color.White);

            graphics.ResetTransform();
            graphics.ScaleTransform(1, -1);
            graphics.TranslateTransform(0, -Size.Height + 1);
            Turn(-90);
        }

        public void Turn(float angle)
        {
            graphics.RotateTransform(angle);
        }

        public new void Move(int step)
        {
            graphics.DrawLine(pen, 0, 0, 0, step);
            graphics.TranslateTransform(0, step);
        }
    }

    delegate void KochDelegate(int angle, int step, int depth);
</pre>
<p>Tuddelum</p>
<p><img class="aligncenter size-full wp-image-745" title="kochvariant" src="http://web.nafai.org/wp-content/uploads/kochvariant.png" alt="" width="300" height="299" /></pre>
]]></content:encoded>
			<wfw:commentRss>http://web.nafai.org/archives/744/feed</wfw:commentRss>
		</item>
		<item>
		<title>Reposting&#8230; How to upgrade your 1.5 developer Android phone to 1.6</title>
		<link>http://web.nafai.org/archives/743</link>
		<comments>http://web.nafai.org/archives/743#comments</comments>
		<pubDate>Tue, 22 Dec 2009 21:35:27 +0000</pubDate>
		<dc:creator>Thor Asmund</dc:creator>
		
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://web.nafai.org/?p=743</guid>
		<description><![CDATA[For those of you who, like me, have been visiting this site
http://developer.htc.com/adp.html
just to find out that the links to the official 1.6 firmware have &#8220;gone fishing&#8221;, here is a mirror that actually works.
Instructions for how to install the image can be found on the HTC website above.
Want to root your dev phone, but don&#8217;t know [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you who, like me, have been visiting this site</p>
<p><a href="http://developer.htc.com/adp.html" target="_blank">http://developer.htc.com/adp.html</a></p>
<p>just to find out that the links to the official 1.6 firmware have &#8220;gone fishing&#8221;, <a href="http://pomac.netswarm.net/mirror.html/mirror/android/adp1/android-1.6" target="_blank">here is a mirror</a> that actually works.</p>
<p>Instructions for how to install the image can be found on the HTC website above.</p>
<p>Want to root your dev phone, but don&#8217;t know which custom ROM to download? Let me recommend CyanoGen. Read more here:</p>
<p><a href="http://www.cyanogenmod.com/about" target="_blank">http://www.cyanogenmod.com/about</a></p>
<p>Happy modding!!</p>
]]></content:encoded>
			<wfw:commentRss>http://web.nafai.org/archives/743/feed</wfw:commentRss>
		</item>
		<item>
		<title>[C# Talk] : Query re-use in Linq To SQL</title>
		<link>http://web.nafai.org/archives/741</link>
		<comments>http://web.nafai.org/archives/741#comments</comments>
		<pubDate>Sat, 28 Nov 2009 22:09:05 +0000</pubDate>
		<dc:creator>Thor Asmund</dc:creator>
		
		<category><![CDATA[C#/ASP]]></category>

		<guid isPermaLink="false">http://web.nafai.org/?p=741</guid>
		<description><![CDATA[Har du også overvejet om mulighederne for query re-use i Linq To SQL? Det vil sige det at man kan genbruge dele af sine Linq To SQL queries, ved at laegge dem ud som properties i sine
datamodel-klasser.
Det er noget man normalt ikke kan i Linq fordi hvis du laver en custom
property, og vil bruge den [...]]]></description>
			<content:encoded><![CDATA[<p>Har du også overvejet om mulighederne for query re-use i Linq To SQL? Det vil sige det at man kan genbruge dele af sine Linq To SQL queries, ved at laegge dem ud som properties i sine<br />
datamodel-klasser.</p>
<p>Det er noget man normalt ikke kan i Linq fordi hvis du laver en custom<br />
property, og vil bruge den i en select statement, saa kan Linq ikke<br />
finde ud af at lave den til en expression som kan omsaettes til SQL.</p>
<p>Men jeg har fundet en maade at goere det paa alligevel! Der er vist et<br />
par andre gutter paa nettet der ogsaa har gjort det, men jeg synes<br />
alligevel det var meget sjovt at lave min egen implementering.</p>
<p>Her er et simpelt eksempel. Lad os sige du har en entity class (fx en<br />
klasse som er autogenereret af SQLMetal), vi kan jo kalde den Project.<br />
Den har bla. to properties der hedder Income og Expenses. Lad os sige du<br />
tit laver queries op mod den klasse hvor du gerne vil have Overskuddet<br />
(revenue). Revenue er defineret som Income minus Expenses. Det var nu<br />
oplagt at tilfoeje en ekstra property til Project klassen, saaledes:</p>
<pre>public partial class Project
{
  public double Revenue
  {
    get { return Income - Expenses; }
  }
}</pre>
<p>Denne property kan godt bruges til fx at populere felterne i en gridview<br />
med, EFTER du har eksekveret din query, men du kan IKKE bruge den<br />
direkte i queryen. Fx kan du ikke skrive:</p>
<pre>var ds = from p in myDataContext.projects where p.Revenue &gt; 0 select p;</pre>
<p>Det vil komme ud med en fejlmeddelelse om at propertyen Revenue ikke har<br />
nogen SQL-implementation.</p>
<p>Til redning kommer min nye extension method kaldet DynamicWhere. Hvis du<br />
skifter Where ud med DynamicWhere, og skriver din Revenue property en<br />
lille smule op, kan det lade sig goere.</p>
<p>Tricket er, at du skal lade Revenue levere en Expression&lt;Func&lt;&gt;&gt; tilbage<br />
i stedet for et resultat. Men for at queryen skal kunne acceptere<br />
at du skriver fx p.Revenue &gt; xxx saa skal Revenue jo vaere en property<br />
der leverer en double. I stedet laver du saa en statisk skygge-funktion<br />
med et andet navn som leverer en Expression tilbage. Den funktion<br />
associerer du saa med din Revenue funktion via en attribute. Saadan her:</p>
<pre>[DynamicProperty(ExpressionPropertyName = "RevenueExpr")]
public double Revenue
{
  get { return RevenueExpr.Compile().Invoke(this); }
}

public static Expression&lt;Func&lt;Project, double&gt;&gt; RevenueExpr
{
  get { return (p =&gt; p.Income - p.Expenses); }
}</pre>
<p>Jeg har ladet Revenue genbruge den associerede funktion saaledes at man<br />
ikke bliver noed til at skrive p.Income - p.Expenses to gange.</p>
<p>Klik her for at downloade <a href="http://nafai.org/software/DynamicWhere.zip">DynamicWhere som DLL projekt</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://web.nafai.org/archives/741/feed</wfw:commentRss>
		</item>
		<item>
		<title>[C# Talk] : A smarter OrderBy and OrderByDescendnig</title>
		<link>http://web.nafai.org/archives/740</link>
		<comments>http://web.nafai.org/archives/740#comments</comments>
		<pubDate>Sat, 28 Nov 2009 22:05:18 +0000</pubDate>
		<dc:creator>Thor Asmund</dc:creator>
		
		<category><![CDATA[C#/ASP]]></category>

		<guid isPermaLink="false">http://web.nafai.org/?p=740</guid>
		<description><![CDATA[Hvordan undgår man at blive nød til at kalde skiftevis OrderBy&#60;&#62; og OrderByDescendnig&#60;&#62; når man laver en custom sorting-algoritme i sit business lag i en Linq-baseret applikation? Man laver da naturligvis en extension method!
public static class ExtensionMethods
{
  public static IOrderedQueryable&#60;TSource&#62;
  OrderByDirection&#60;TSource,TKey&#62;(this IQueryable&#60;TSource&#62; source, Expression&#60;Func&#60;TSource, TKey&#62;&#62; keySelector, SortDirection sortDirection)
  {
    [...]]]></description>
			<content:encoded><![CDATA[<p>Hvordan undgår man at blive nød til at kalde skiftevis OrderBy&lt;&gt; og OrderByDescendnig&lt;&gt; når man laver en custom sorting-algoritme i sit business lag i en Linq-baseret applikation? Man laver da naturligvis en extension method!</p>
<pre>public static class ExtensionMethods
{
  public static IOrderedQueryable&lt;TSource&gt;
  OrderByDirection&lt;TSource,TKey&gt;(this IQueryable&lt;TSource&gt; source, Expression&lt;Func&lt;TSource, TKey&gt;&gt; keySelector, SortDirection sortDirection)
  {
    return sortDirection == SortDirection.Ascending ?
      source.OrderBy(keySelector) :
      source.OrderByDescending(keySelector);
  }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://web.nafai.org/archives/740/feed</wfw:commentRss>
		</item>
		<item>
		<title>[C# Talk] : LALR(1) parser in C#</title>
		<link>http://web.nafai.org/archives/739</link>
		<comments>http://web.nafai.org/archives/739#comments</comments>
		<pubDate>Mon, 16 Nov 2009 22:45:15 +0000</pubDate>
		<dc:creator>Thor Asmund</dc:creator>
		
		<category><![CDATA[C#/ASP]]></category>

		<guid isPermaLink="false">http://web.nafai.org/?p=739</guid>
		<description><![CDATA[Always being interested in parsers, I decided to try my luck on writing an LALR(1) parser in C#. Traditionally these parsers (Yacc, Bison) have been written so that you must run the scanner/lexer first, then include the output into your project as separate files.
I decided it was smarter if everything was assembled into one Parser [...]]]></description>
			<content:encoded><![CDATA[<p>Always being interested in parsers, I decided to try my luck on writing an <a href="http://en.wikipedia.org/wiki/LALR_parser" target="_blank">LALR</a>(1) parser in C#. Traditionally these parsers (Yacc, Bison) have been written so that you must run the scanner/lexer first, then include the output into your project as separate files.</p>
<p>I decided it was smarter if everything was assembled into one Parser class, which you could then instantiate in your program. I wanted to be able to configure it via a grammar <em>also </em>based on objects, build it, and then run the parser every time I wanted to parse a text string.</p>
<p>This is similar to the way the Reges class in C# works. You compile your regex first by instantiating a Regex class and give it the regex pattern, thereafter you can use it to match text strings multiple times.</p>
<p><a href="lalr1-parser">Read more here&#8230;</a></p>
]]></content:encoded>
			<wfw:commentRss>http://web.nafai.org/archives/739/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
