<?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>CodeCube.NET</title>
	<atom:link href="http://codecube.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://codecube.net</link>
	<description>Joel Martinez' weblog</description>
	<lastBuildDate>Fri, 12 Mar 2010 15:39:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Get Googling Orlando!</title>
		<link>http://codecube.net/2010/03/get-googling-orlando/</link>
		<comments>http://codecube.net/2010/03/get-googling-orlando/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 15:39:37 +0000</pubDate>
		<dc:creator>Joel Martinez</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[highspeed]]></category>

		<guid isPermaLink="false">http://codecube.net/?p=299</guid>
		<description><![CDATA[I&#8217;m pretty happy to see the City of Orlando kicking off this effort: http://www.getgoogling.com/

If you are reading this blog and live in the Orlando area, please take a few moments and map yourself and at least fill out the google survey. Then spread the word, it would be pretty awesome to see this come to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m pretty happy to see the City of Orlando kicking off this effort: <a href="http://www.getgoogling.com/">http://www.getgoogling.com/</a></p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="http://www.youtube.com/v/RTnJNVHBPMk&amp;rel=0&amp;color1=0x6699&amp;color2=0x54abd6&amp;hl=en_US&amp;feature=player_embedded&amp;fs=1" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/RTnJNVHBPMk&amp;rel=0&amp;color1=0x6699&amp;color2=0x54abd6&amp;hl=en_US&amp;feature=player_embedded&amp;fs=1" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>If you are reading this blog and live in the Orlando area, please take a few moments and map yourself and at least fill out the google survey. Then spread the word, it would be pretty awesome to see this come to Orlando <img src='http://codecube.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://codecube.net/2010/03/get-googling-orlando/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Of Choppers, Physics, and Challenge</title>
		<link>http://codecube.net/2010/03/of-choppers-physics-and-challenge/</link>
		<comments>http://codecube.net/2010/03/of-choppers-physics-and-challenge/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 04:46:33 +0000</pubDate>
		<dc:creator>Joel Martinez</dc:creator>
				<category><![CDATA[XNA]]></category>

		<guid isPermaLink="false">http://codecube.net/?p=290</guid>
		<description><![CDATA[After receiving some sage advice from Andy &#8220;The ZMan&#8221; Dunn, I posted up the prototype of a game that I am working on for play test on the XNA Creator&#8217;s Club site:
http://forums.xna.com/forums/t/49219.aspx

The game focuses on controlling a small 2d chopper through a maze. There are &#8220;fans&#8221; which push and pull the chopper into the walls [...]]]></description>
			<content:encoded><![CDATA[<p>After receiving some sage advice from <a href="http://www.indiegameguy.com/blogs/zman/default.aspx">Andy &#8220;The ZMan&#8221; Dunn</a>, I posted up the prototype of a game that I am working on for play test on the XNA Creator&#8217;s Club site:<br />
<a href="http://forums.xna.com/forums/t/49219.aspx">http://forums.xna.com/forums/t/49219.aspx</a></p>
<p><a href="http://forums.xna.com/forums/t/49219.aspx"><img class="alignnone size-thumbnail wp-image-296" title="playtest 1 gamebox" src="http://codecube.net/wp-content/uploads/2010/02/gamebox-150x150.jpg" alt="" width="150" height="150" /></a></p>
<p>The game focuses on controlling a small 2d chopper through a maze. There are &#8220;fans&#8221; which push and pull the chopper into the walls which of course will make it more difficult to navigate.</p>
<p>I got the idea after my brother-in-law received a small indoor helicopter for christmas. We all had so much fun trying to carefully control it (as much as one can control those tiny copters) and even trying to land it strange places like the blade of a ceiling fan. I thought that it would be fun to play a game that required the same skill. I was able to fairly quickly make a simple prototype (even simpler than what I posted up for playtest) using the <a href="http://flatredball.com">FlatRedBall engine</a>&#8217;s built in acceleration and collision functions.</p>
<p>The prototype I posted up is quite rough around the edges as it is just a prototype; But the idea is to get the community&#8217;s feedback early, before you have invested a lot of blood, sweat, and tears into a game. If you wait until the end to get a playtest, you will be so invested in what you&#8217;ve been working on that you will resist they playtester&#8217;s feedback. I hope to get some good ideas about possible directions that I could take it in &#8230; and hopefully it will validate the direction that I&#8217;ve already got in my mind. But who knows, I might get an idea that I was not expecting. That&#8217;s the great thing about getting it in front of other people early.</p>
<p>We will see just how far along I can get before my<a href="http://www.orlandocodecamp.com"> Orlando Code Camp</a> presentation, which incidentally, is about actually finishing a game (this game). I&#8217;ll definitely have more to post on this topic after the codecamp <img src='http://codecube.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://codecube.net/2010/03/of-choppers-physics-and-challenge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Acer t230h Review</title>
		<link>http://codecube.net/2010/03/acer-t230h-review/</link>
		<comments>http://codecube.net/2010/03/acer-t230h-review/#comments</comments>
		<pubDate>Sat, 06 Mar 2010 15:32:39 +0000</pubDate>
		<dc:creator>Joel Martinez</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[multitouch]]></category>

		<guid isPermaLink="false">http://codecube.net/?p=291</guid>
		<description><![CDATA[I settled on the Acer T230H multitouch monitor

So far, I&#8217;m happy enough with it. When I plugged it into the USB port on my computer, windows 7 already had drivers for it so it was kind of nice that I did not have to install any extra software; Though I haven&#8217;t installed the software disc [...]]]></description>
			<content:encoded><![CDATA[<p>I <a href="http://codecube.net/2010/02/which-multitouch-monitor-to-buy/">settled</a> on the Acer T230H multitouch monitor</p>
<p><a href="http://codecube.net/wp-content/uploads/2010/02/Acer-T230H.jpg"><img class="aligncenter size-full wp-image-277" title="Acer T230H" src="http://codecube.net/wp-content/uploads/2010/02/Acer-T230H.jpg" alt="" width="300" height="254" /></a></p>
<p>So far, I&#8217;m happy enough with it. When I plugged it into the USB port on my computer, windows 7 already had drivers for it so it was kind of nice that I did not have to install any extra software; Though I haven&#8217;t installed the software disc that came with the monitor so I don&#8217;t know if there are any extra niceties that come with it.</p>
<p>The first thing that hit me was how large and nice the screen is. Definitely a great picture. Of course the first thing I did was fire up MS Paint, which natively supports multiple touch points. Single finger manipulation (I&#8217;ll have to trademark that one) works really well and is quite accurate. Two fingers however seems to be pretty buggy, especially when you move the touchpoints near each other.</p>
<p>I&#8217;m looking forward to programming against some of the <a href="http://codecube.net/2010/02/state-of-multitouch-with-xna/">APIs</a> that are available. In particular, I&#8217;m looking forward to experimenting with new interface models rather than the usual textboxes, buttons, tree views, and menus.</p>
]]></content:encoded>
			<wfw:commentRss>http://codecube.net/2010/03/acer-t230h-review/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reusing PHPBB&#8217;s Authentication System</title>
		<link>http://codecube.net/2010/02/reusing-phpbbs-authentication-system/</link>
		<comments>http://codecube.net/2010/02/reusing-phpbbs-authentication-system/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 06:00:42 +0000</pubDate>
		<dc:creator>Joel Martinez</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://codecube.net/?p=281</guid>
		<description><![CDATA[Question:
What&#8217;s the easiest way to let a custom application re-use accounts from a PHPBB installation?
Answer:
The first thing that occurred to me was that I&#8217;d have to look over the PHPBB user tables, connect to mysql, and read the user&#8217;s password (which I assume is hashed) to do the authentication. The second idea I had was [...]]]></description>
			<content:encoded><![CDATA[<p>Question:</p>
<p>What&#8217;s the easiest way to let a custom application re-use accounts from a PHPBB installation?</p>
<p>Answer:</p>
<p>The first thing that occurred to me was that I&#8217;d have to look over the PHPBB user tables, connect to mysql, and read the user&#8217;s password (which I assume is hashed) to do the authentication. The second idea I had was to write a proxy service in PHP that I could call from my custom app.</p>
<p>Both of those options seemed like an awful pain in the butt. Then I had an epiphany, if you take a look at the ideals behind REST services, one could reason that PHPBB already exposes a REST service for logging in.</p>
<p>What if I simply used the already exposed HTML form as a sort of pseudo web service?</p>
<p>Making HTTP posts with C# is pretty easy, but I didn&#8217;t want to try to remember what the syntax was for the API; So I did a quick search online and found a nice little class that makes it really easy:<br />
<a href="http://geekswithblogs.net/rakker/archive/2006/04/21/76044.aspx">http://geekswithblogs.net/rakker/archive/2006/04/21/76044.aspx</a></p>
<p>With this class in hand, I used <a href="http://getfirebug.com/">FireBug</a> while logging in to the PHPBB and inspected the post variables. Easy, there were only four variables posted:</p>
<ul>
<li>autologin=on</li>
<li>login=Login</li>
<li>username=<em>[My Username]</em></li>
<li>password=<em>[My Password]</em></li>
</ul>
<p>I grabbed the URL it was posting to and added the variables (see the example below). Once I get the result back, a simple regular expression parses through the HTML and figures out if the login was successful or not. The result worked surprisingly well &#8230; the method below takes a username, password, and url. The URL will look something like this:</p>
<p>http://mywebsite.com/forum/ucp.php?mode=login&amp;sid=9cd8b8da2649060b9d22d297f27a1dc7</p>
<blockquote>
<pre>private static bool Authenticate(string username, string password, string url)
{
    PostSubmitter post = new PostSubmitter();
    post.Url = url;

    post.PostItems.Add("autologin", "on");
    post.PostItems.Add("login", "Login");
    post.PostItems.Add("username", username);
    post.PostItems.Add("password", password);
    post.Type = PostSubmitter.PostTypeEnum.Post;
    string result = post.Post();

    string loggedinstring = string.Format("Logout \\[ {0} \\]", username);
    Regex r = new Regex(loggedinstring, RegexOptions.IgnoreCase);
    var match = r.Match(result);

    return match.Success;
}</pre>
</blockquote>
<p><em>Disclaimer:</em> I&#8217;ve only tried this code with one instance of phpbb, not sure if it will work with other versions. The point of this was that we can trivially reuse existing user stores that are already exposed on the web via simple html forms.</p>
]]></content:encoded>
			<wfw:commentRss>http://codecube.net/2010/02/reusing-phpbbs-authentication-system/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Which MultiTouch Monitor To Buy?</title>
		<link>http://codecube.net/2010/02/which-multitouch-monitor-to-buy/</link>
		<comments>http://codecube.net/2010/02/which-multitouch-monitor-to-buy/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 01:45:50 +0000</pubDate>
		<dc:creator>Joel Martinez</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[multitouch]]></category>

		<guid isPermaLink="false">http://codecube.net/?p=275</guid>
		<description><![CDATA[Last week, I pondered the state of multitouch with XNA. And I mentioned that I was considering buying a multi-touch enabled monitor from Dell. Well, over the last few days I have been shopping around on line and I&#8217;ve been pleasantly surprised to find that there are several others on the market.
Acer t230h

Dell SX2210

HP L2105tm

Because [...]]]></description>
			<content:encoded><![CDATA[<p>Last week, I pondered the <a href="http://codecube.net/2010/02/state-of-multitouch-with-xna/">state of multitouch with XNA</a>. And I mentioned that I was considering buying a multi-touch enabled monitor from Dell. Well, over the last few days I have been shopping around on line and I&#8217;ve been pleasantly surprised to find that there are several others on the market.</p>
<p><strong>Acer t230h</strong></p>
<p><a href="http://us.acer.com/acer/product.do?LanguageISOCtxParam=en&amp;rcond5e.c2att92=169&amp;inu49e.current.c2att92=169&amp;link=ln314e&amp;CountryISOCtxParam=US&amp;kcond47e.c2att92=169&amp;rcond159e.att21k=1&amp;kcond48e.c2att101=62721&amp;rcond190e.att21k=1&amp;acond23=US&amp;rcond4e.att21k=1&amp;sp=page17e&amp;rcond157e.c2att92=169&amp;ctx1g.c2att92=169&amp;rcond42e.att21k=1&amp;kcond50e.c2att92=169&amp;rcond45e.att21k=1&amp;rcond158e.c2att1=0&amp;ctx2.c2att1=0&amp;inu53e.current.c2att92=169&amp;rcond38e.c2att1=25&amp;var13e=US&amp;rcond44e.c2att1=0&amp;rcond186e.c2att92=169&amp;rcond3e.c2att1=0&amp;rcond28e.attN2B2F2EEF=3264&amp;rcond189e.c2att1=0&amp;ctx1.att21k=1&amp;CRC=2844506398#wrAjaxHistory=2"><img class="alignnone size-full wp-image-277" title="Acer T230H" src="http://codecube.net/wp-content/uploads/2010/02/Acer-T230H.jpg" alt="" width="300" height="254" /></a></p>
<p><strong>Dell SX2210</strong></p>
<p><a href="http://accessories.us.dell.com/sna/products/Displays/productdetail.aspx?c=us&amp;l=en&amp;s=dhs&amp;cs=19&amp;sku=320-1172"><img class="alignnone size-full wp-image-278" title="Dell SX2210" src="http://codecube.net/wp-content/uploads/2010/02/Dell-SX2210.jpg" alt="" width="379" height="439" /></a></p>
<p><strong>HP L2105tm</strong></p>
<p><a href="http://accessories.us.dell.com/sna/products/Displays/productdetail.aspx?c=us&amp;l=en&amp;s=dhs&amp;cs=19&amp;sku=320-1172"></a><a href="http://h10010.www1.hp.com/wwpc/us/en/sm/WF06a/382087-382087-64283-3181050-3181048-4031739.html"><img class="size-full wp-image-276" title="HP L2105tm" src="http://codecube.net/wp-content/uploads/2010/02/HP-L2105tm.jpg" alt="" width="400" height="400" /></a></p>
<p>Because of the technique they&#8217;re using to do finger tracking, all the monitors only support two touchpoints at a time. Makes me wish that a homegrown solution like the optical <a href="../2009/02/converting-a-lifecam-vx-5000-to-see-ir/">webcam based solution</a> I experimented with a while back was more feasible.</p>
<p>The HP L2105tm is the most inexpensive offering, but also, seems to have other deficiencies such as a slower response time than the other two monitors. The Dell monitor is nice because it has a built-in webcam, which is something that I&#8217;ve been interested in having for a while, but is ultimately secondary. The Acer T230H is the one that is currently capturing my interest; it&#8217;s the largest monitor of the three at 23 inches, and according to the specs has the best contrast ratio.</p>
<p>So, does anyone have any suggestions on which monitor I should go with? My primary goal is to have hardware that I can program multitouch enabled XNA games with <img src='http://codecube.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://codecube.net/2010/02/which-multitouch-monitor-to-buy/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Steam and XNA Redux</title>
		<link>http://codecube.net/2010/02/steam-and-xna-redux/</link>
		<comments>http://codecube.net/2010/02/steam-and-xna-redux/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 23:45:05 +0000</pubDate>
		<dc:creator>Joel Martinez</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://codecube.net/?p=269</guid>
		<description><![CDATA[I love it when information travels at the speed of internet. I posted a little blurb yesterday about whether or not Steam would publish XNA games. It was based on an email that I sent them, and the response I got back. Very quickly, a few commenters mentioned that it would be trivial to write [...]]]></description>
			<content:encoded><![CDATA[<p>I love it when information travels at the speed of internet. I posted a little blurb yesterday about whether or not <a href="http://codecube.net/2010/02/will-steam-publish-xna-games/">Steam would publish XNA games</a>. It was based on an email that I sent them, and the response I got back. Very quickly, a few commenters mentioned that it would be trivial to write some c++ interop code to interface with the steamworks API. <a href="http://nickgravelyn.com/">Nick</a> also mentioned that there had in fact been several XNA games already published.</p>
<p>After a bit of online sleuthing (ie. searching Bing for &#8220;<a href="http://www.bing.com/search?q=xna+steam">xna steam</a>&#8220;) I came  across said XNA games on steam and, via one of the developer&#8217;s websites sent him an email. He was very nice and responded with:</p>
<blockquote><p>Too bad they responded in such a way&#8230; usually they are very nice at Valve.</p>
<p>But yeah, they wrote a little C# wrapper for their Steamworks-dll.<br />
They also made their installer script look for the dependencies (.NET<br />
&amp; XNA redist)<br />
&#8230;<br />
I didn&#8217;t really do anything to achieve this, they had<br />
already decided to release the game when we ran into problems because<br />
of the code being in C#, so they just put a guy on solving it.</p></blockquote>
<p>This of course correlates with some of the other comments on my post saying that it would be trivial to write the wrapper; and in fact, even with my own assumptions before I even posted the blog entry. But the point I was trying to make was that I find Steam&#8217;s approach to developers rather strange. One of the <a href="http://www.steampowered.com/steamworks/FAQ.php">FAQs from the steamworks site</a> reads:</p>
<blockquote><p><strong>10. My game is in early development stages, don&#8217;t I need to plan for the SDK integration now?</strong><br />
The Steamworks SDK is easy to integrate, so you can wait until your game is further along in the development cycle before worrying about it.</p></blockquote>
<p>Their approach is basically one of don&#8217;t call us, we&#8217;ll call you. Unless your game gets lots of publicity (for example, winning an indie contest) you will have to actively seek them out and pitch your game to them.</p>
<p>Contrast this with the approach that Microsoft is taking with <a href="http://creators.xna.com">XBox Live Indie Games</a>. They provide an SDK, they provide hosting, they provide distribution, they provide some marketing &#8230; all for less than ten bucks a month ($99 a year). This model is so much more appealing to me as a developer because it is low risk (yes, $99 a year is low risk). If I end up not developing anything, or development goes longer than expected &#8230; I&#8217;m out $99 bucks at most.</p>
<p>If only Microsoft would extend <a href="http://www.microsoft.com/games/en-US/index.aspx">xblig onto Windows</a> &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://codecube.net/2010/02/steam-and-xna-redux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Will Steam Publish XNA Games?</title>
		<link>http://codecube.net/2010/02/will-steam-publish-xna-games/</link>
		<comments>http://codecube.net/2010/02/will-steam-publish-xna-games/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 01:32:35 +0000</pubDate>
		<dc:creator>Joel Martinez</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://codecube.net/?p=261</guid>
		<description><![CDATA[Update: The short answer is, Yes &#8230; the longer answer is here: Steam and XNA Redux
After all this tablet hype started, I began to get excited about the possibilities of new markets emerging for touch enabled windows games. As Steam is currently one of the most robust and popular game distribution networks on windows, I [...]]]></description>
			<content:encoded><![CDATA[<p><em>Update: The short answer is, Yes &#8230; the longer answer is here: <a href="http://codecube.net/2010/02/steam-and-xna-redux/">Steam and XNA Redux</a></em></p>
<p>After all this <a href="http://www.engadget.com/2010/01/06/the-hp-slate/">tablet</a> <a href="http://www.dancewithshadows.com/tech/x2-itablet-windows-7-web-tablet-announced/">hype</a> started, I began to get excited about the possibilities of new markets emerging for touch enabled windows games. As Steam is currently one of the most robust and popular game distribution networks on windows, I was curious to know whether a game written with XNA could be published via Steam.</p>
<p>I visited their <a href="http://www.steampowered.com/steamworks/index.php">Steamworks developer site</a> and the offering is very attractive: Anti-Piracy/DRM, Cloud Storage, Matchmaking, DLC. coupled with the fact that many gamers I know (a statistically insignificant metric, I know) trust and use Steam, and it warranted a further look.  So I emailed them and asked simply (edited for further brevity):</p>
<blockquote><p>From: Joel Martinez<br />
To: steamworks@valvesoftware.com</p>
<p>Hello, I was wondering if the Steamworks API is usable from a game written in C# &#8230; [I] would like to know if Steam would support games written using the XNA Framework.</p></blockquote>
<p>Took them a few weeks to get back to me, but they answered succinctly:</p>
<blockquote><p>From: Steam<br />
To: Joel Martinez</p>
<p>Hello Joel,<br />
We do not directly support games written using the XNA framework.  Steamworks is written in C++</p></blockquote>
<p>A shame really.</p>
]]></content:encoded>
			<wfw:commentRss>http://codecube.net/2010/02/will-steam-publish-xna-games/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>State of Multitouch with XNA</title>
		<link>http://codecube.net/2010/02/state-of-multitouch-with-xna/</link>
		<comments>http://codecube.net/2010/02/state-of-multitouch-with-xna/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 02:53:43 +0000</pubDate>
		<dc:creator>Joel Martinez</dc:creator>
				<category><![CDATA[XNA]]></category>

		<guid isPermaLink="false">http://codecube.net/?p=257</guid>
		<description><![CDATA[I&#8217;ve been very interested in multitouch every since I saw Johnny Lee&#8217;s awesome finger tracking videos. Specifically, multitouch as it relates to game development. With the impending release of windows 7 tablet PCs, I have hopes that it might open up new possibilities and markets for games on the windows platform. I&#8217;m planning on picking [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been very interested in multitouch every since I saw Johnny Lee&#8217;s awesome <a href="http://www.youtube.com/watch?v=0awjPUkBXOU&amp;feature=youtube_gdata">finger tracking</a> videos. Specifically, multitouch as it relates to game development. With the impending release of windows 7 tablet PCs, I have hopes that it might open up new possibilities and markets for games on the windows platform. I&#8217;m planning on picking up a <a href="http://accessories.us.dell.com/sna/products/Displays/productdetail.aspx?c=us&amp;l=en&amp;s=dhs&amp;cs=19&amp;sku=320-1172">Dell SX2210 monitor</a> to start playing with it.</p>
<p>I sought out to find out the state of multitouch. So far, I&#8217;m not too impressed. Here are two great references to get you started:</p>
<ul>
<li><a href="http://www.brianpeek.com/blog/archive/2010/01/13/multi-touch-madness-slides-and-code.aspx">Multitouch Madness</a>: Brian Peek posted the slides and source code to a presentation he gave on multitouch. I really wish I could have been there but the source code and slides are a great resource.</li>
<li><a href="http://xna-uk.net/blogs/randomchaos/archive/2010/02/10/xna-and-windows-7-multi-touch.aspx">XNA And Windows 7 Multitouch</a>: Great article that shows how to get a touch enabled xna window rendering in windows forms.</li>
</ul>
<p>The thing that I walked away with is that the solutions that Microsoft seems to be proposing have pretty specific dependencies on windows forms, wpf, and silverlight.  All things that I would rather not really deal with when I am making an XNA game. I would really prefer not to have to resort to making and managing my own window. In addition to the APIs not even really being available; Brian&#8217;s slides mention that System.Windows.Input.Manipulations isn&#8217;t even redistributable yet until .NET 4.0 is released.</p>
<p>So I&#8217;m going to be looking into how one can take advantage of the built-in touch APIs without onerous dependencies on unreleased assemblies and hacking windows forms in the near future. Anyone have any tips on where to get started?</p>
]]></content:encoded>
			<wfw:commentRss>http://codecube.net/2010/02/state-of-multitouch-with-xna/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom Transactions</title>
		<link>http://codecube.net/2010/02/custom-transactions/</link>
		<comments>http://codecube.net/2010/02/custom-transactions/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 17:01:10 +0000</pubDate>
		<dc:creator>Joel Martinez</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Transaction]]></category>

		<guid isPermaLink="false">http://codecube.net/?p=248</guid>
		<description><![CDATA[If you haven&#8217;t used TransactionScope from the System.Transactions namespace, you don&#8217;t know what you&#8217;re missing.  This system, introduced with .NET 2.0 provides a flexible mechanism for allowing your code to take part in transactions.  Many of the built-in subsystems such as ADO.NET automatically enlist in these transactions, but the real power comes from the fact [...]]]></description>
			<content:encoded><![CDATA[<p>If you haven&#8217;t used TransactionScope from the System.Transactions namespace, you don&#8217;t know what you&#8217;re missing.  This system, introduced with .NET 2.0 provides a flexible mechanism for allowing your code to take part in transactions.  Many of the built-in subsystems such as ADO.NET automatically enlist in these transactions, but the real power comes from the fact that you can allow your own custom code to also take part in ambient transactions.</p>
<p>Recently at work, I wanted to perform a transaction across several unrelated modules with a custom resource. Of course TransactionScope was the first solution brought up. Unfortunately, after some analysis, I realized that this wasn&#8217;t going to work for us; We have existing database code in those modules that have different conditions in which the transaction would be rolled back.</p>
<p>We needed a way to have multiple transaction scopes, each with different conditions of success or failure. I started thinking about how to accomplish this, and decided to write my own implementation which mimics the TransactionScope, but lets me control things a bit closer.  So I came up with a class which can be used like this:</p>
<blockquote>
<pre>using (Txn scope = Txn.New&lt;MyScope&gt;())
{
    // ... do work

    scope.Commit();
}</pre>
</blockquote>
<p>Notice that the usage pattern is nearly identical to the TransactionScope API &#8230; put the scope in a using statement, and call .Commit if the work was completed.  In the example above, the MyScope class is defined quite simply as:</p>
<blockquote><pre>public class MyScope : Txn
{
    protected override void OnStart()
    {
        Console.WriteLine(&quot;\tstarting&quot;);
    }

    protected override void OnCommit()
    {
        Console.WriteLine(&quot;\tcommitting&quot;);
    }

    protected override void OnRollback()
    {
        Console.WriteLine(&quot;\trolling back&quot;);
    }
}</pre>
</blockquote>
<p>All you have to do is inherit from the Txn class, and implement three methods:  OnStart, which occurs when the transaction is first beginning; OnCommit, which is invoked only when the top-most scope exits and all sub transactions were committed successfully; And OnRollback, which as you might imagine is only called if the transaction (or a subtransaction) was not committed successfully.</p>
<p>One difference between this API and the regular TransactionScope is that only one instance of &#8220;MyScope&#8221; will be created when the top-most transaction is first created.  As I&#8217;ve alluded to, you can nest transactions just as you can with TransactionScope.  And each scope must be committed if the entire transaction is to be completed.</p>
<p>The Txn class can be found below:</p>
<blockquote><pre>public abstract class Txn : IDisposable
{
    private Queue&lt;bool&gt; committed = new Queue&lt;bool&gt;();

    public Txn()
    {
    }

    [ThreadStatic]
    public static bool committable = true;

    [ThreadStatic]
    public static int depth = 0;

    [ThreadStatic]
    public static Txn current;

    protected abstract void OnStart();
    protected abstract void OnCommit();
    protected abstract void OnRollback();

    public void Commit()
    {
        this.committed.Enqueue(true);
    }

    void IDisposable.Dispose()
    {
        if (committed.Count == 0 || !committed.Dequeue())
        {
            committable = false;
        }

        depth--;
        if (depth == 0)
        {
            if (committable)
            {
                this.OnCommit();
            }
            else
            {
                this.OnRollback();
            }

            current = null;
        }
    }

    public static T New&lt;T&gt;() where T : Txn, new()
    {
        depth++;

        if (current == null)
        {
            current = new T();
        }

        if (depth == 1)
        {
            // first transaction, assume committable
            committable = true;
            current.OnStart();
        }

        return current as T;
    }

    #region IDisposable Members

    #endregion
}</pre>
</blockquote>
<p>There is one caveat to mention. My requirement was to run this code in a windows service. The entire scope of the transaction would be single threaded, but there would be multiple ongoing transactions at once. To support this scenario, notice that some of the internal state of the Txn class uses the [ThreadStatic] attribute. This means that the API can be used from multiple threads at once and each thread would have its own state.  </p>
<p>Of course, this might be a problem if you want to use this in an ASP.NET project. I&#8217;ve <a href="http://blog.ngensoft.net/2009/11/02/static-access-to-request-specific-data/">written about this issue</a> before. There is probably a way to make this work using the techniques I outlined in that article, but I haven&#8217;t given it a lot of thought (because I didn&#8217;t need to).  But I thought I&#8217;d share the work I did in case it is useful for anyone else.  </p>
]]></content:encoded>
			<wfw:commentRss>http://codecube.net/2010/02/custom-transactions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scurvy.Test v1.2 Released</title>
		<link>http://codecube.net/2010/01/scurvy-test-v1-2-released/</link>
		<comments>http://codecube.net/2010/01/scurvy-test-v1-2-released/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 20:29:13 +0000</pubDate>
		<dc:creator>Joel Martinez</dc:creator>
				<category><![CDATA[Scurvy Media]]></category>
		<category><![CDATA[XNA]]></category>

		<guid isPermaLink="false">http://codecube.net/?p=245</guid>
		<description><![CDATA[Quick on the heals of yesterday&#8217;s post, I&#8217;ve released v1.2 of Scurvy.Test. This is the first official release of the framework and improvements over the initial announcement are mainly centered around the status reporting of test pass/failure.  I also upgraded the solution to vs 2k8 and xnags 3.1.
Here&#8217;s the changelog if you&#8217;re interested:

Introduced TestStatusReporter to [...]]]></description>
			<content:encoded><![CDATA[<p>Quick on the heals of yesterday&#8217;s post, I&#8217;ve released<a href="http://scurvytest.codeplex.com/"> v1.2 of Scurvy.Test</a>. This is the first official release of the framework and improvements over the initial announcement are mainly centered around the status reporting of test pass/failure.  I also upgraded the solution to vs 2k8 and xnags 3.1.</p>
<p>Here&#8217;s the changelog if you&#8217;re interested:</p>
<ul>
<li>Introduced TestStatusReporter to make reporting test status easier. DefaultReporter writes to the debug output, while the test console app implements a custom ConsoleReporter that writes it out to the stdout instead.</li>
<li>Added additional methods and overloads to the Assert class for more assert options and the ability to replace your own custom TestStatusReporter instance.</li>
<li>Added XBox version of Scurvy.Test assembly</li>
<li>Upgraded solution to visual studio 2008</li>
<li>now using SVN bindings instead of TFS Explorer</li>
<li>Upgraded sample xna project to GS 3.1</li>
<li>Added custom XNA test status reporter to sample project</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://codecube.net/2010/01/scurvy-test-v1-2-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
