<?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:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Claus Topholt's Blog</title>
	<atom:link href="http://blog.topholt.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.topholt.com</link>
	<description>Real Programmers Don't Eat Quiche</description>
	<pubDate>Thu, 24 Apr 2008 09:02:44 +0000</pubDate>
	<generator>http://wordpress.org/?v=MU</generator>
	<language>en</language>
			<item>
		<title>CLR Profiler Is Your Friend</title>
		<link>http://blog.topholt.com/2008/04/08/clr-profiler-is-your-friend-lazy-loading-is-your-foe/</link>
		<comments>http://blog.topholt.com/2008/04/08/clr-profiler-is-your-friend-lazy-loading-is-your-foe/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 18:18:40 +0000</pubDate>
		<dc:creator>Claus Topholt</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[C#]]></category>

		<category><![CDATA[CLR Profiler]]></category>

		<category><![CDATA[LLBLGenPro]]></category>

		<category><![CDATA[WinDbg]]></category>

		<guid isPermaLink="false">http://claustopholt.wordpress.com/?p=40</guid>
		<description><![CDATA[This past week, I have been struggling with a strange problem on a client&#8217;s ASP.NET 2.0 website. The server, a 64-bit Windows Server 2003 with 4 Gb RAM, used up almost all available memory within a few seconds of starting the w3wp.exe (the IIS 6.0 worker process). During this excessive consumption, the CPU usage was [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This past week, I have been struggling with a strange problem on a client&#8217;s ASP.NET 2.0 website. The server, a 64-bit Windows Server 2003 with 4 Gb RAM, used up almost all available memory within a few seconds of starting the w3wp.exe (the IIS 6.0 worker process). During this excessive consumption, the CPU usage was 100%, and then dropped to 1-2% during normal operations. Then every half hour or so, another wave of 100% CPU cycles and a jump in memory consumption, then after a few minutes more CPU cycles and a steep fall in memory consumption. This would go on, wave after wave, hour after hour.</p>
<p>The problem seemed unrelated to the number of concurrent user sessions (approx. 500 at peak), and most of the time the wildly excessive memory consumption didn&#8217;t even seem to cause any problems. Yet some times - a couple of times a week - the server response times would drop dramatically or even grind to a halt, yet no OutOfMemory exceptions were ever thrown.</p>
<p>I was very determined to fix the issue, because our client expects the website, which is currently in its infancy, to scale to almost a million registered users within the next couple of years.</p>
<p>As a short term fix, the server was scaled up to 16 Gb RAM, based on the old &#8220;when in trouble, double&#8221; advice that everyone always gives without solving the underlying problem.  Well, surprise surprise, the problem scaled up as well - now the w3wp.exe could consume 7-8 Gb RAM almost right after IIS was started. In waves, just like before.</p>
<p>Using perfmon, I was able to determine that the 7-8 Gb of RAM was mostly to be found in the regular heap in generations 1 or 2. In other words, it seemed that a lot of small objects were being created (since the memory was not used by the large object heap). These objects were being used for a little while, then moved through the garbage collection system. That explained why there were no OutOfMemory exceptions - the memory was actually ready for garbage collection, there were just too many objects to handle it efficiently, so things got slowed down.</p>
<p>Next on the list was to get a fresh copy of one of the world&#8217;s most complicated debugging tools, WinDbg. Along with &#8220;sos.dll&#8221; (found in your .NET framework folder), it can be used to debug .NET memory usage, among other things. Using ADPlus, I created a memory dump of the w3wp.exe process (all 7 Gb of it), and proceeded to attempt to decipher what it all meant.</p>
<p>I should say right now that if you came here looking for advise on how to use WinDbg, you&#8217;ve come to the wrong place. The right place is <a href="http://blogs.msdn.com/tess/">http://blogs.msdn.com/tess/</a> There&#8217;s really no point going anywhere else - Tess is who you want. Either her or call Microsoft Premier Support, which is what I ended up doing.</p>
<p>Back to the matter at hand. Using WinDbg and with the help of a very nice guy from MPS, I was able to determine that my memory dump showed an abnormal amount of one specific type of object being created - SD.LLBLGen.Pro.ORMSupportClasses.EntityField. More than 7 million of these objects were lying around in memory.</p>
<p>For those who don&#8217;t know, LLBLGenPro (<a href="http://www.llblgen.com">www.llblgen.com</a>) is one of the world&#8217;s most productive Object-Relations Mapping tools for .NET development. I love it. It has literally saved me hundreds of hours of work on previous projects. It allows you to write very elegant and strongly typed code against any database engine (DB2, Oracle, MySql, MSSQL, etc), and supports lazy loading, which was used on this particular project.</p>
<p>This time, however, it seemed that I got bitten in the ass by LLBLGenPro. Somewhere, something was really malfunctioning, but based on previous experience I was pretty sure that LLBLGenPro was not directly to blame. Rather, the problem was probably caused by bad website code.</p>
<p>What to do? Well, WinDbg allows you to look at any object in the heap you like, using obscure commands such as &#8220;!dumpheap -stat&#8221; and &#8220;!dumpobject &lt;address&gt;&#8221;. However, I had 7+ million of these objects, and in all likelyhood some of those were bound to be fine/expected, while others were not. So looking at each individual object was a no-go.</p>
<p>Enter my new best friend, CLR Profiler. It&#8217;s a world class tool for debugging .NET applications that almost nobody uses, except those who are into .NET games progamming with <a href="http://creators.xna.com/" target="_blank">XNA</a> (like me). But I really think that every .NET developer should grab a copy of CLR Profiler here:</p>
<p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=A362781C-3870-43BE-8926-862B40AA0CD0&amp;displaylang=en">http://www.microsoft.com/downloads/details.aspx?FamilyId=A362781C-3870-43BE-8926-862B40AA0CD0&amp;displaylang=en</a></p>
<p>Don&#8217;t be scared by the interface or the docs, which are a little hard to comprehend. Just fire up CLRProfiler.exe and hook it up to the .NET application you want to profile. In my case, I hooked it up to the problematic ASP.NET website on a dev machine.</p>
<p>After starting up the tool, I hit the front page of the website a few times and then took a look at the CLR Profiler&#8217;s summary page. It looked like this:</p>
<p> <a href="http://claustopholt.files.wordpress.com/2008/04/clrprofiler1.png"><img class="alignnone size-full wp-image-41" src="http://claustopholt.files.wordpress.com/2008/04/clrprofiler1.png?w=450&h=269" alt="" width="450" height="269" /></a></p>
<p>The first thing to notice is the amount of garbage collections that had taken place. I had only hit the website a few times, yet generation 0 had already been collected 156 times, and generation 1 more than 50. Far too much, considering that the machine I tested this on had 1 Gb of RAM and the website is fairly simple.</p>
<p>Remember that garbage collection only takes place when it is needed. It&#8217;s not like it is scheduled to run every 2 seconds. When writing XNA games, you strive to do all your allocations at the start of the game, then never allocate another object again while the game is being played. That way, you don&#8217;t trigger any garbage collection, which causes &#8220;hiccups&#8221; because the CPU works hard during GC.</p>
<p>When looking at that summary, you may feel like you are miles away from a solution. Yet, the solution is only about 5 clicks away..!</p>
<p>Clicking on Timeline presented me with a simple (ok, insanely complex) looking overview of the garbage collection that had taken place. It looked like this:</p>
<p><a href="http://claustopholt.files.wordpress.com/2008/04/clrprofiler2.png"><img class="alignnone size-full wp-image-42" src="http://claustopholt.files.wordpress.com/2008/04/clrprofiler2.png?w=450&h=288" alt="" width="450" height="288" /></a></p>
<p>The trick here is to select as much of the timeline as you&#8217;d like to investigate. The list on the right side of the window will then be sorted according to which type has been allocated the most. In my case, it showed SD.LLBLGen.Pro.ORMSupportClasses.EntityField, just like what I found with WinDbg.</p>
<p>Now here&#8217;s why CLR Profiler is my new best friend. You can simply right-click a type and select &#8220;Show Who Allocated&#8221;. After a few seconds of work, you get the following display:</p>
<p><a href="http://claustopholt.files.wordpress.com/2008/04/clrprofiler3.png"><img class="alignnone size-full wp-image-43" src="http://claustopholt.files.wordpress.com/2008/04/clrprofiler3.png?w=450&h=257" alt="" width="450" height="257" /></a></p>
<p>How cool is that? It&#8217;s a walkthrough of the .NET application, which shows clearly how the data got to be allocated. Scrolling a bit, I found my culprit:</p>
<p><a href="http://claustopholt.files.wordpress.com/2008/04/clrprofiler4.png"><img class="alignnone size-full wp-image-44" src="http://claustopholt.files.wordpress.com/2008/04/clrprofiler4.png?w=450&h=256" alt="" width="450" height="256" /></a></p>
<p>One simple little method, AccountManager.GetAvailableCredits() was causing all this fuss. Nothing left to do except to jump into the code, find the mentioned method and see what it did.</p>
<p>It turned out that to calculate the sum of available credits, LLBLGenPro&#8217;s fancy lazy loading technique was being used to read all account lines for the user, inflate each one and sum up the amounts to get a total. It looks really neat in C# code, but is a huge performance killer. LLBLGenPro offers many other ways to solve this problem, or a stored procedure can be used. Just never use lazy loading for aggregating data.</p>
<p>Did any of this make sense? If not, I apologize. The main lesson here is to grab a copy of CLR Profiler, read the docs, view the webcast and start optimizing your code!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/claustopholt.wordpress.com/40/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/claustopholt.wordpress.com/40/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/claustopholt.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/claustopholt.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/claustopholt.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/claustopholt.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/claustopholt.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/claustopholt.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/claustopholt.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/claustopholt.wordpress.com/40/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/claustopholt.wordpress.com/40/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/claustopholt.wordpress.com/40/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.topholt.com&blog=2265085&post=40&subd=claustopholt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.topholt.com/2008/04/08/clr-profiler-is-your-friend-lazy-loading-is-your-foe/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/claustopholt-128.jpg" medium="image">
			<media:title type="html">claustopholt</media:title>
		</media:content>

		<media:content url="http://claustopholt.files.wordpress.com/2008/04/clrprofiler1.png?w=450" medium="image" />

		<media:content url="http://claustopholt.files.wordpress.com/2008/04/clrprofiler2.png?w=450" medium="image" />

		<media:content url="http://claustopholt.files.wordpress.com/2008/04/clrprofiler3.png?w=450" medium="image" />

		<media:content url="http://claustopholt.files.wordpress.com/2008/04/clrprofiler4.png?w=450" medium="image" />
	</item>
		<item>
		<title>Katharina&#8217;s First Steps</title>
		<link>http://blog.topholt.com/2008/04/05/katharinas-first-steps/</link>
		<comments>http://blog.topholt.com/2008/04/05/katharinas-first-steps/#comments</comments>
		<pubDate>Sat, 05 Apr 2008 14:33:49 +0000</pubDate>
		<dc:creator>Claus Topholt</dc:creator>
		
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://claustopholt.wordpress.com/?p=39</guid>
		<description><![CDATA[Ok, a bit of a personal post this time.. Whistling &#8220;The Grand March&#8221; from Aïda is clearly not enough for our extremely talented daughter. Today, at the age of almost 13 months old, she took her first real steps:

Cute, right? 
       ]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Ok, a bit of a personal post this time.. Whistling &#8220;The Grand March&#8221; from Aïda is clearly not enough for our extremely talented daughter. Today, at the age of almost 13 months old, she took her first real steps:</p>
<p><span style="text-align:center; display: block;"><a href="http://blog.topholt.com/2008/04/05/katharinas-first-steps/"><img src="http://img.youtube.com/vi/b-CKpoTCO4Y/2.jpg" alt="" /></a></span></p>
<p>Cute, right? <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/claustopholt.wordpress.com/39/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/claustopholt.wordpress.com/39/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/claustopholt.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/claustopholt.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/claustopholt.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/claustopholt.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/claustopholt.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/claustopholt.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/claustopholt.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/claustopholt.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/claustopholt.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/claustopholt.wordpress.com/39/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.topholt.com&blog=2265085&post=39&subd=claustopholt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.topholt.com/2008/04/05/katharinas-first-steps/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/claustopholt-128.jpg" medium="image">
			<media:title type="html">claustopholt</media:title>
		</media:content>

		<media:content url="http://img.youtube.com/vi/b-CKpoTCO4Y/2.jpg" medium="image" />
	</item>
		<item>
		<title>The Business of Silverlight</title>
		<link>http://blog.topholt.com/2008/04/04/the-business-of-silverlight/</link>
		<comments>http://blog.topholt.com/2008/04/04/the-business-of-silverlight/#comments</comments>
		<pubDate>Fri, 04 Apr 2008 19:56:00 +0000</pubDate>
		<dc:creator>Claus Topholt</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Silverlight]]></category>

		<category><![CDATA[RIA]]></category>

		<guid isPermaLink="false">http://claustopholt.wordpress.com/?p=38</guid>
		<description><![CDATA[Chris Carper, a member of the Silverlight business development team at Microsoft, has started a blog about the business impact that Silverlight is expected to have on the industry. It&#8217;s brand new, so no real gems there yet, but we&#8217;re all looking forward to hear what the Silverlight team has to say about the business side [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Chris Carper, a member of the Silverlight business development team at Microsoft, has started a blog about the business impact that Silverlight is expected to have on the industry. It&#8217;s brand new, so no real gems there yet, but we&#8217;re all looking forward to hear what the Silverlight team has to say about the business side of Rich Internet Applications..</p>
<p>Check it out here: <a href="http://silverlightbiz.blogspot.com/">http://silverlightbiz.blogspot.com/</a></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/claustopholt.wordpress.com/38/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/claustopholt.wordpress.com/38/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/claustopholt.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/claustopholt.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/claustopholt.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/claustopholt.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/claustopholt.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/claustopholt.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/claustopholt.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/claustopholt.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/claustopholt.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/claustopholt.wordpress.com/38/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.topholt.com&blog=2265085&post=38&subd=claustopholt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.topholt.com/2008/04/04/the-business-of-silverlight/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/claustopholt-128.jpg" medium="image">
			<media:title type="html">claustopholt</media:title>
		</media:content>
	</item>
		<item>
		<title>Calling ActionScript 3 from Javascript</title>
		<link>http://blog.topholt.com/2008/03/27/calling-actionscript-3-from-javascript/</link>
		<comments>http://blog.topholt.com/2008/03/27/calling-actionscript-3-from-javascript/#comments</comments>
		<pubDate>Thu, 27 Mar 2008 14:42:54 +0000</pubDate>
		<dc:creator>Claus Topholt</dc:creator>
		
		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://claustopholt.wordpress.com/?p=37</guid>
		<description><![CDATA[I really hate Javascript. It&#8217;s so inconsistent, loosely typed and annoying to debug. But there are some things that you just can&#8217;t do without Javascript. For instance, allowing an HTML page to communicate back and forth with an embedded Flex application.
The Flex documentation gives a very good example of how to call an AS3 method [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I really hate Javascript. It&#8217;s so inconsistent, loosely typed and annoying to debug. But there are some things that you just can&#8217;t do without Javascript. For instance, allowing an HTML page to communicate back and forth with an embedded Flex application.</p>
<p>The Flex documentation gives a very good example of how to call an AS3 method from Javascript. It&#8217;s simple, it&#8217;s easy to understand and it <em>doesn&#8217;t work properly in a real life scenario</em>. But let&#8217;s start with the AS3 code example from the documentation:</p>
<pre><span>function callMe(name:String):String
{
    return "busy signal";
}
ExternalInterface.<span class="resultofText">addCallback</span>("myFunction", callMe);</span></pre>
<p><span>And here&#8217;s the corresponding Javascript and object/embed tags for use in an HTML page:</span></p>
<pre><span>&lt;script language="JavaScript"&gt;
    // result gets the value "busy signal"
    var result = flashObject.myFunction("my name");
&lt;/script&gt;
...
&lt;object id="flashObject"...&gt;
    ...
    &lt;embed name="flashObject".../&gt;
&lt;/object&gt;</span></pre>
<p><span>All well and good. And it works, too. That is, except when you are dynamically adding object/embed tags with Javascript&#8217;s document.write(). Which is what you do, if you don&#8217;t want that annoying security frame around your Flex application in the browser. If you use document.write(), the above method only works in Internet Explorer. Not FireFox. Whaaa? I could have sort-of understood it, if it were the other way around.</span></p>
<p><span>Anyways. The solution, which I was unable to find in the Flex docs, is the call the flashObject&#8217;s method using the following Javascript syntax:</span></p>
<pre><span><span>    var result = document["flashObject"].myFunction("my name");</span></span></pre>
<p><span><span>Sheez. Only took me an hour to figure out. Hope someone else finds this post if they are in a similar situation.</span></span></p>
<p><span><span>I really hate Javascript.</span></span><span></span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/claustopholt.wordpress.com/37/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/claustopholt.wordpress.com/37/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/claustopholt.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/claustopholt.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/claustopholt.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/claustopholt.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/claustopholt.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/claustopholt.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/claustopholt.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/claustopholt.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/claustopholt.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/claustopholt.wordpress.com/37/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.topholt.com&blog=2265085&post=37&subd=claustopholt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.topholt.com/2008/03/27/calling-actionscript-3-from-javascript/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/claustopholt-128.jpg" medium="image">
			<media:title type="html">claustopholt</media:title>
		</media:content>
	</item>
		<item>
		<title>C# Trick: Load Embedded Resources In A Class Library</title>
		<link>http://blog.topholt.com/2008/03/18/c-trick-load-embedded-resources-in-a-class-library/</link>
		<comments>http://blog.topholt.com/2008/03/18/c-trick-load-embedded-resources-in-a-class-library/#comments</comments>
		<pubDate>Tue, 18 Mar 2008 17:31:11 +0000</pubDate>
		<dc:creator>Claus Topholt</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://claustopholt.wordpress.com/?p=36</guid>
		<description><![CDATA[Here&#8217;s a little trick in C#.
If you ever need to distribute and use resources such as text or xml files in a class library, you can use embedded resources. It&#8217;s very simple: You add a .txt file to your class library, right click it, choose Properties and set Build Action to &#8220;Embedded Resource&#8221;. Then when you [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Here&#8217;s a little trick in C#.</p>
<p>If you ever need to distribute and use resources such as text or xml files in a class library, you can use embedded resources. It&#8217;s very simple: You add a .txt file to your class library, right click it, choose Properties and set Build Action to &#8220;Embedded Resource&#8221;. Then when you need to read the file during runtime, you use Reflection:</p>
<p><font size="2"></font><font size="2"></font><font size="2" color="#2b91af">Assembly</font><font size="2"> assembly = </font><font size="2" color="#2b91af">Assembly</font><font size="2">.GetExecutingAssembly();<br />
</font><font size="2" color="#2b91af">Stream</font><font size="2"> stream = assembly.GetManifestResourceStream(</font><font size="2" color="#a31515">&#8220;MyClassLib.MyResourceFolder.MyTextFile.txt&#8221;</font><font size="2">);<br />
</font><font size="2" color="#2b91af">StreamReader</font><font size="2"> streamReader = </font><font size="2" color="#0000ff">new</font><font size="2"> </font><font size="2" color="#2b91af">StreamReader</font><font size="2">(stream);<br />
</font><font color="#2b91af">String</font><font size="2"> myText = </font><font size="2">streamReader.ReadToEnd();</font></p>
<p>That&#8217;s all. How clever is that?</p>
<p>Obviously, you would use <font size="2" color="#2b91af">XmlTextReader </font>instead, if the resource is an Xml file, etc.</p>
<p>If you don&#8217;t want to use reflection <em>every time</em> you need that chunk of text, just store it in a variable after the first read. Or you can cache it with <font size="2" color="#2b91af">HttpRuntime</font><font color="#000000">.Cache</font> or <font size="2" color="#2b91af">HttpContext</font><font color="#000000">.Current.Cache</font>, depending on whether you are working on a Windows/console or an ASP.NET application.</p>
<p><em>Edit: Fixed a small bug in the above code <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </em></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/claustopholt.wordpress.com/36/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/claustopholt.wordpress.com/36/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/claustopholt.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/claustopholt.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/claustopholt.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/claustopholt.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/claustopholt.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/claustopholt.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/claustopholt.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/claustopholt.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/claustopholt.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/claustopholt.wordpress.com/36/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.topholt.com&blog=2265085&post=36&subd=claustopholt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.topholt.com/2008/03/18/c-trick-load-embedded-resources-in-a-class-library/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/claustopholt-128.jpg" medium="image">
			<media:title type="html">claustopholt</media:title>
		</media:content>
	</item>
		<item>
		<title>Silverlight 2 beta 1 is out</title>
		<link>http://blog.topholt.com/2008/03/11/silverlight-2-beta-1-is-out/</link>
		<comments>http://blog.topholt.com/2008/03/11/silverlight-2-beta-1-is-out/#comments</comments>
		<pubDate>Tue, 11 Mar 2008 12:18:06 +0000</pubDate>
		<dc:creator>Claus Topholt</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://blog.topholt.com/2008/03/11/silverlight-2-beta-1-is-out/</guid>
		<description><![CDATA[Unfortunately I&#8217;m knee-deep in diapers and other parental leave oriented tasks, so I haven&#8217;t been able to play around with it much, but you can read more here:
 http://www.microsoft.com/presspass/press/2008/mar08/03-05MIX08PR.mspx
Edit: I have now had a bit of time to try out some things in Silverlight 2 beta 1, and my conclusions are:
- Lots of new stuff has [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Unfortunately I&#8217;m knee-deep in diapers and other parental leave oriented tasks, so I haven&#8217;t been able to play around with it much, but you can read more here:</p>
<p> <a href="http://www.microsoft.com/presspass/press/2008/mar08/03-05MIX08PR.mspx">http://www.microsoft.com/presspass/press/2008/mar08/03-05MIX08PR.mspx</a></p>
<p>Edit: I have now had a bit of time to try out some things in Silverlight 2 beta 1, and my conclusions are:</p>
<p>- Lots of new stuff has been added, such as the much anticipated networking features (Sockets, POX, etc.) as well as many new standard controls, and that&#8217;s great news!</p>
<p>- There&#8217;s even a &#8220;Go-Live&#8221; licence, which, for those unfamiliar with Microsoft terminology just means that you are welcome to build something on Silverlight 2 beta 1 and actually deploy it to the public. Nothing business-critical, mind you.</p>
<p>- The environment, toolset and plugin is still <u>far from being finished</u>. I&#8217;ve had several crashes already, and I haven&#8217;t been using it for more than a few hours. Also, sometimes my Silverlight plugin is not recognized by the sites I visit.</p>
<p>- The documentation is generally speaking much better than before, but still a long way from being finished. For instance, there is no explanation on how to load on-demand a classlibrary user control, except for an MSBuild walkthrough. No VS.NET example, and we are left guessing.</p>
<p>- And yes, the ball bounces just as bad in Silverlight <a href="http://blog.topholt.com/2008/01/12/flex-framerates/">as in Flash</a>.</p>
<p>So.. Back to Flex 3 / Flash for now. But considering the progress that Microsoft made between the Silverlight 1.1 alpha and the 2 beta 1 in about six months time, things are really moving in the right direction.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/claustopholt.wordpress.com/35/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/claustopholt.wordpress.com/35/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/claustopholt.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/claustopholt.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/claustopholt.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/claustopholt.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/claustopholt.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/claustopholt.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/claustopholt.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/claustopholt.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/claustopholt.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/claustopholt.wordpress.com/35/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.topholt.com&blog=2265085&post=35&subd=claustopholt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.topholt.com/2008/03/11/silverlight-2-beta-1-is-out/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/claustopholt-128.jpg" medium="image">
			<media:title type="html">claustopholt</media:title>
		</media:content>
	</item>
		<item>
		<title>RIA Wars Update: Silverlight 2.0 Is Coming</title>
		<link>http://blog.topholt.com/2008/03/01/ria-wars-update-silverlight-20-is-coming/</link>
		<comments>http://blog.topholt.com/2008/03/01/ria-wars-update-silverlight-20-is-coming/#comments</comments>
		<pubDate>Sat, 01 Mar 2008 13:34:18 +0000</pubDate>
		<dc:creator>Claus Topholt</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Silverlight]]></category>

		<category><![CDATA[RIA]]></category>

		<guid isPermaLink="false">http://claustopholt.wordpress.com/?p=34</guid>
		<description><![CDATA[It&#8217;s going to be an interesting spring this year; Microsoft has recently revealed some of the core functionality in the upcoming Silverlight 2.0 beta 1, which is expected to be released in the next month or so.
With Adobe Flex 3 just out, Microsoft is keen to show that their offering will be the better product, [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>It&#8217;s going to be an interesting spring this year; Microsoft has recently revealed some of the core functionality in the upcoming Silverlight 2.0 beta 1, which is expected to be released in the next month or so.</p>
<p>With Adobe Flex 3 just out, Microsoft is keen to show that their offering will be the better product, and they have certainly listened to the feedback from the  1.0 and 1.1 CTP releases, both of which were limited featurewise, frankly to the point of being useless.</p>
<p>Among the features included in Silverlight 2.0 beta 1 are:</p>
<ul>
<li>- WPF-style layout using XAML, deeply integrated with Expression Blend (the design tool)</li>
<li>- A wide array of built-in controls (you know, TextBox, CheckBox, RadioButton, Panels, etc.)</li>
<li>- Support for REST, WS*/SOAP, POX, RSS, and plain old HTTP and even Sockets - yay <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
<li>- Extensive .NET base class library support, including collections, IO, generics, threading, globalization, XML and local storage</li>
<li>- HTML/Javascript/DOM interaction with .NET code</li>
<li>- LINQ support</li>
</ul>
<p>There is more, but they are not telling about it yet.</p>
<p>So what about install size, prerequisites and browser and OS support? I&#8217;m just going to quote Scott Guthrie, who knows everything there is to know about all things .NET and Silverlight, because I can&#8217;t word this any better than him:</p>
<blockquote><p><em>&#8220;Silverlight 2 does not require the .NET Framework to be installed on a computer in order to run.  The Silverlight setup download includes everything necessary to enable all the above features (and more we&#8217;ll be talking about shortly) on a vanilla Mac OSX or Windows machine.  </em></p>
<p><em>The Beta1 release of Silverlight 2 is 4.3MB in size, and takes 4-10 seconds to install on a machine that doesn&#8217;t already have it.  Once Silverlight 2 is installed you can browse the Web and automatically run rich Silverlight applications within your browser of choice (IE, FireFox, Safari, etc).&#8221;</em></p></blockquote>
<p>Collections, threading, globalization, Sockets and local storage .. It&#8217;s going to be great! As much as I love Flex by now, I can&#8217;t wait to get my hands on Silverlight 2.0 beta 1&#8230;</p>
<p>Read Microsoft&#8217;s accouncement on Scott Guthrie&#8217;s blog <a target="_blank" href="http://weblogs.asp.net/scottgu/archive/2008/02/22/first-look-at-silverlight-2.aspx">here</a>, which includes a nice tutorial.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/claustopholt.wordpress.com/34/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/claustopholt.wordpress.com/34/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/claustopholt.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/claustopholt.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/claustopholt.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/claustopholt.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/claustopholt.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/claustopholt.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/claustopholt.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/claustopholt.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/claustopholt.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/claustopholt.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.topholt.com&blog=2265085&post=34&subd=claustopholt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.topholt.com/2008/03/01/ria-wars-update-silverlight-20-is-coming/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/claustopholt-128.jpg" medium="image">
			<media:title type="html">claustopholt</media:title>
		</media:content>
	</item>
		<item>
		<title>Flex 3 is Released</title>
		<link>http://blog.topholt.com/2008/02/29/flex-3-is-out/</link>
		<comments>http://blog.topholt.com/2008/02/29/flex-3-is-out/#comments</comments>
		<pubDate>Fri, 29 Feb 2008 08:37:22 +0000</pubDate>
		<dc:creator>Claus Topholt</dc:creator>
		
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://blog.topholt.com/2008/02/29/flex-3-is-out/</guid>
		<description><![CDATA[The long wait is over! Well, ok, the wait really wasn&#8217;t that long, because there have been three betas out of which the last two were feature complete and well functioning.
But anyways, grab it from here: www.adobe.com/flex.
       ]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The long wait is over! Well, ok, the wait really wasn&#8217;t that long, because there have been three betas out of which the last two were feature complete and well functioning.</p>
<p>But anyways, grab it from here: <a href="http://www.adobe.com/flex">www.adobe.com/flex</a>.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/claustopholt.wordpress.com/33/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/claustopholt.wordpress.com/33/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/claustopholt.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/claustopholt.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/claustopholt.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/claustopholt.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/claustopholt.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/claustopholt.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/claustopholt.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/claustopholt.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/claustopholt.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/claustopholt.wordpress.com/33/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.topholt.com&blog=2265085&post=33&subd=claustopholt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.topholt.com/2008/02/29/flex-3-is-out/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/claustopholt-128.jpg" medium="image">
			<media:title type="html">claustopholt</media:title>
		</media:content>
	</item>
		<item>
		<title>Flex, C# and Asynchronous Sockets Chat</title>
		<link>http://blog.topholt.com/2008/02/18/flex-and-c-chat-clientserver-using-sockets/</link>
		<comments>http://blog.topholt.com/2008/02/18/flex-and-c-chat-clientserver-using-sockets/#comments</comments>
		<pubDate>Mon, 18 Feb 2008 16:18:55 +0000</pubDate>
		<dc:creator>Claus Topholt</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Chat]]></category>

		<category><![CDATA[RIA]]></category>

		<category><![CDATA[Sockets]]></category>

		<guid isPermaLink="false">http://claustopholt.wordpress.com/?p=31</guid>
		<description><![CDATA[I&#8217;ve previously written about the wonders of Rich Internet Applications (RIAs), and I&#8217;ve have been looking at both Silverlight and Adobe Flex. For now, at least, I go with Flex, because it&#8217;s the mature and complete of the two.
After being sidetracked for a while with my love for casinos and games, I thought it would be [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;ve previously <a href="/2007/12/05/ria-wars-silverlight-vs-flex/">written about the wonders of Rich Internet Applications</a> (RIAs), and I&#8217;ve have been looking at both Silverlight and Adobe Flex. For now, at least, I go with Flex, because it&#8217;s the mature and complete of the two.</p>
<p>After being sidetracked for a while with my love for <a href="/2007/12/28/a-slot-machine-in-flex/">casinos</a> and <a href="/2008/01/20/arkanoid-using-torque-2d/">games</a>, I thought it would be appropriate to return to something more business-friendly. So, for my next project, I have chosen to implement a chat client/server with Flex on the frontend and C# on the backend. It could be used for customer service or be a community feature on a website.</p>
<p>I was thinking about doing the whole thing with Web Services, but that has a couple of shortcomings.</p>
<p>First of all, Web Services are stateless; Consuming a Web Service means sending one request from a client to a server and receiving one response. Each request/response pair is separate from all others - stateless. A chat application needs to be more &#8220;connected&#8221; the entire time, so that it&#8217;s possible to push things from either end to the other without the client having to continuously poll the server.</p>
<p>Secondly, Web Services include a bit of overhead in terms of SOAP envelopes, and requires code-generation (in Flex), etc., and I wanted something clean and fast. Ok, sure, my chat application probably won&#8217;t be used by thousands of simultaneous users, but why go for the Kia when you can have the Ferrari at more or less the same implementation cost?</p>
<p>The fastest ride in town is &#8220;asynchronous sockets&#8221;, and the easiest and cleanest implementation of that is using TCP. And luckily, it&#8217;s completely supported by both Flex and C#, so that&#8217;s what I went with.</p>
<p><a href="http://www.topholt.com/ChatClient/bin-release/ChatClient.html"><img border="0" src="http://claustopholt.files.wordpress.com/2008/02/chatclient.png" alt="Chat Client" /></a></p>
<p><a href="http://www.topholt.com/ChatClient/bin-release/ChatClient.html">http://www.topholt.com/ChatClient/bin-debug/ChatClient.html</a></p>
<p><strong>A Few Implementation Details</strong> </p>
<p>The chat client above is setup to use port 8000 for communications, so your firewall should allow you to make TCP connections to that port if you want to try it out. It shouldn&#8217;t be a big deal. If you download the code, you can modify it to use whatever port you like.</p>
<p>All communications are currently unsecured, which means no encryption, no authentication, no authorization and no data checks of any kind. The downside is that anyone can mess with the chat, but the upside is that you, dear readers, can grab the code and easily modify it for your own needs.</p>
<p>The application&#8217;s communications architecture is simple: Each time someone says something, a 256 byte UTF-8 encoded datagram is sent to the server and then immediately distributed to all connected clients, including the sender. That way, everyone sees what everyone is writing.</p>
<p><em>Edit: View Source on the Flash/Flex file to get the client code or <a target="_blank" href="http://www.topholt.com/ChatClient/bin-release/srcview/ChatClient.zip">download the zip</a>. And get the C# server </em><a target="_blank" href="http://www.topholt.com/ChatClient/ChatServerSolution.zip"><em>source code here</em></a><em>. It&#8217;s built with VS 2008 and compiled for .NET 3.5, but should work just as fine with 2.0.</em></p>
<p><em>Edit 2: I&#8217;m currently having server hosting problems, so I am getting ready to move my stuff to a new provider. Therefore, the chat server may be offline at times. The code is still available for download, though.</em></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/claustopholt.wordpress.com/31/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/claustopholt.wordpress.com/31/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/claustopholt.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/claustopholt.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/claustopholt.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/claustopholt.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/claustopholt.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/claustopholt.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/claustopholt.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/claustopholt.wordpress.com/31/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/claustopholt.wordpress.com/31/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/claustopholt.wordpress.com/31/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.topholt.com&blog=2265085&post=31&subd=claustopholt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.topholt.com/2008/02/18/flex-and-c-chat-clientserver-using-sockets/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/claustopholt-128.jpg" medium="image">
			<media:title type="html">claustopholt</media:title>
		</media:content>

		<media:content url="http://claustopholt.files.wordpress.com/2008/02/chatclient.png" medium="image">
			<media:title type="html">Chat Client</media:title>
		</media:content>
	</item>
		<item>
		<title>Arkanoid Using Torque 2D</title>
		<link>http://blog.topholt.com/2008/01/20/arkanoid-using-torque-2d/</link>
		<comments>http://blog.topholt.com/2008/01/20/arkanoid-using-torque-2d/#comments</comments>
		<pubDate>Sun, 20 Jan 2008 14:06:02 +0000</pubDate>
		<dc:creator>Claus Topholt</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[2D]]></category>

		<category><![CDATA[Flex]]></category>

		<category><![CDATA[Game]]></category>

		<category><![CDATA[Torque]]></category>

		<guid isPermaLink="false">http://blog.topholt.com/2008/01/20/arkanoid-using-torque-2d/</guid>
		<description><![CDATA[Right! I&#8217;m getting seriously side-tracked here. I was planning on using a bit of my spare time to investigate news on the Rich Internet Applications (RIA) front, but I found myself trying to create an Arkanoid clone in Flex.
It didn&#8217;t go too well, because Flex/Flash doesn&#8217;t update the visuals fast enough. I think it has [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Right! I&#8217;m getting seriously side-tracked here. I was planning on using a bit of my spare time to investigate news on the Rich Internet Applications (RIA) front, but I found myself trying to create an Arkanoid clone in Flex.</p>
<p>It didn&#8217;t go too well, because Flex/Flash doesn&#8217;t update the visuals fast enough. I think it has to do with the fact that Flash rendering uses a software device, instead of direct hardware access, such as through DirectX or OpenGL.</p>
<p>At any rate, I just couldn&#8217;t let the thought of creating an Arkanoid game be, so I browsed around and found GarageGames&#8217; excellent product, Torque Game Builder. Using the product&#8217;s out-of-the-box features, some sample graphics and a bit of TorqueScript, I have put together the following:</p>
<p><img src="http://claustopholt.files.wordpress.com/2008/01/arkanoidtest1.png" alt="arkanoidtest1.png" /></p>
<p>To see it in action, just download the following file, un-zip it and run the .exe file: <a href="http://www.topholt.com/arkanoid/arkanoidtest1.zip">www.topholt.com/arkanoid/arkanoidtest1.zip</a></p>
<p>I&#8217;m actually pretty happy with it, considering that it only took a few hours to put together. It uses simple rigid body physics (!) to bounce the ball, and just for fun I added rotation to the paddle.</p>
<p>There are tons of things still missing or not working correctly. Some of the collision detections are a bit off, and the physics are not completely correct - but that&#8217;s my fault, not the product&#8217;s. I think I&#8217;ll keep playing with this and see if I could make it into a real &#8220;casual&#8221; game.</p>
<p>Comments are always welcome!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/claustopholt.wordpress.com/29/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/claustopholt.wordpress.com/29/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/claustopholt.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/claustopholt.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/claustopholt.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/claustopholt.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/claustopholt.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/claustopholt.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/claustopholt.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/claustopholt.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/claustopholt.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/claustopholt.wordpress.com/29/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.topholt.com&blog=2265085&post=29&subd=claustopholt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blog.topholt.com/2008/01/20/arkanoid-using-torque-2d/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/claustopholt-128.jpg" medium="image">
			<media:title type="html">claustopholt</media:title>
		</media:content>

		<media:content url="http://claustopholt.files.wordpress.com/2008/01/arkanoidtest1.png" medium="image">
			<media:title type="html">arkanoidtest1.png</media:title>
		</media:content>
	</item>
	</channel>
</rss>