<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Oren Nachman</title>
	
	<link>http://www.nachmore.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sat, 13 Apr 2013 02:18:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/OrenNachman" /><feedburner:info uri="orennachman" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>comiXology Promo: Download all of the comics</title>
		<link>http://feedproxy.google.com/~r/OrenNachman/~3/eDWmewyt5XA/</link>
		<comments>http://www.nachmore.com/2013/comixology-promo-download-all-of-the-comics/#comments</comments>
		<pubDate>Sat, 13 Apr 2013 02:18:38 +0000</pubDate>
		<dc:creator>Oren</dc:creator>
		
		<guid isPermaLink="false">http://www.nachmore.com/?p=322</guid>
		<description><![CDATA[While sitting in a particularly long meeting today I happened to receive an email from comiXology inviting me to claim my &#8220;over 700 free comics&#8221;. While this is an extremely cool promotion it is somewhat limited in that to get all of the comics (I read a lot and I also don&#8217;t have time to [...]]]></description>
			<content:encoded><![CDATA[<p>While sitting in a particularly long meeting today I happened to receive an email from comiXology inviting me to claim my &#8220;over 700 free comics&#8221;. While this is an extremely cool promotion it is somewhat limited in that to get all of the comics (I read a lot and I also don&#8217;t have time to sift through all of the comics to find the ones that I want) you have to click &#8220;Buy&#8221; on each one.</p>
<p>So, what does a developer stuck in a meeting do when struck with such a problem? 30 minutes later we have the solution to both problems &#8211; <a href="https://github.com/nachmore/grab-comixology">https://github.com/nachmore/grab-comixology</a></p>
<p>Grab the <a href="https://github.com/nachmore/grab-comixology/blob/master/download_comixology.zip">download</a>, run the app, stick in your promo url and your password and watch the browser (IE) come to life in front of you and add all 723 comics to your cart. All you have to do then is check out! You can find the complete FAQ <a href="https://github.com/nachmore/grab-comixology/blob/master/README.md">here</a>.</p>
<p>Have fun reading!</p>
<img src="http://feeds.feedburner.com/~r/OrenNachman/~4/eDWmewyt5XA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nachmore.com/2013/comixology-promo-download-all-of-the-comics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.nachmore.com/2013/comixology-promo-download-all-of-the-comics/</feedburner:origLink></item>
		<item>
		<title>HOWTO: Run Bastion on Windows 8</title>
		<link>http://feedproxy.google.com/~r/OrenNachman/~3/Zb9D175CUxw/</link>
		<comments>http://www.nachmore.com/2012/howto-run-bastion-on-windows-8/#comments</comments>
		<pubDate>Mon, 30 Jul 2012 04:31:56 +0000</pubDate>
		<dc:creator>Oren</dc:creator>
		
		<guid isPermaLink="false">http://www.nachmore.com/?p=308</guid>
		<description><![CDATA[After playing the Bastion demo in Chrome&#8217;s Native Client I recently picked up a full copy care of  Humble Bundle, only to have it crash immediately on startup on Windows 8. Turns out the culprit is a missing XNA redistributable - you can install it directly from Bastion&#8217;s install directory (C:\Program Files (x86)\Bastion\xnafx31_redist.msi). Happy Hunting!]]></description>
			<content:encoded><![CDATA[<p>After playing the Bastion demo in Chrome&#8217;s Native Client I recently picked up a full copy care of  <a href="http://www.humblebundle.com/">Humble Bundle</a>, only to have it crash immediately on startup on Windows 8.</p>
<p>Turns out the culprit is a missing XNA redistributable - you can install it directly from Bastion&#8217;s install directory (C:\Program Files (x86)\Bastion\xnafx31_redist.msi).</p>
<p>Happy Hunting!</p>
<img src="http://feeds.feedburner.com/~r/OrenNachman/~4/Zb9D175CUxw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nachmore.com/2012/howto-run-bastion-on-windows-8/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.nachmore.com/2012/howto-run-bastion-on-windows-8/</feedburner:origLink></item>
		<item>
		<title>Last Minute Perf Video for Mango</title>
		<link>http://feedproxy.google.com/~r/OrenNachman/~3/CqgKjTC-W-k/</link>
		<comments>http://www.nachmore.com/2012/last-minute-perf-video-for-mango/#comments</comments>
		<pubDate>Wed, 11 Jul 2012 06:11:21 +0000</pubDate>
		<dc:creator>Oren</dc:creator>
		
		<guid isPermaLink="false">http://www.nachmore.com/?p=305</guid>
		<description><![CDATA[I had the opportunity to join Microsoft Research and this year&#8217;s Interns at a recent XAPfest event (a regular internal Windows Phone development event) and give a performance talk for Mango / Tango (i.e. WP 7.x) &#8211; here&#8217;s hoping it&#8217;s the last one before we move on to Windows Phone 8! To check it (and my bad [...]]]></description>
			<content:encoded><![CDATA[<p>I had the opportunity to join Microsoft Research and this year&#8217;s Interns at a recent XAPfest event (a regular internal Windows Phone development event) and give a performance talk for Mango / Tango (i.e. WP 7.x) &#8211; here&#8217;s hoping it&#8217;s the last one before we move on to Windows Phone 8!</p>
<p>To check it (and my bad hair day) skip to 1:23:30 at <a href="http://research.microsoft.com/apps/video/default.aspx?id=168593&amp;l=i">http://research.microsoft.com/apps/video/default.aspx?id=168593&amp;l=i</a> or listen from the start if you&#8217;re new to Windows Phone development in general for a great overview from Shawn Henry.</p>
<img src="http://feeds.feedburner.com/~r/OrenNachman/~4/CqgKjTC-W-k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nachmore.com/2012/last-minute-perf-video-for-mango/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.nachmore.com/2012/last-minute-perf-video-for-mango/</feedburner:origLink></item>
		<item>
		<title>WP Emulator Crashing on Windows 8? Here’s a Fix</title>
		<link>http://feedproxy.google.com/~r/OrenNachman/~3/OGL27G5aKYs/</link>
		<comments>http://www.nachmore.com/2012/wp-emulator-crashing-on-windows-8-heres-a-fix/#comments</comments>
		<pubDate>Mon, 25 Jun 2012 19:07:19 +0000</pubDate>
		<dc:creator>Oren</dc:creator>
		
		<guid isPermaLink="false">http://www.nachmore.com/?p=303</guid>
		<description><![CDATA[Don&#8217;t you just hate it when you upgrade to a new OS (even when it&#8217;s a beta) and everything works amazingly well, except for that one critical bit of infrastructure that just fails? That&#8217;s kind of how you might be feeling if you boot up your brand spanking new Windows 8 install, install VS 2010 [...]]]></description>
			<content:encoded><![CDATA[<p>Don&#8217;t you just hate it when you upgrade to a new OS (even when it&#8217;s a beta) and everything works amazingly well, except for that one critical bit of infrastructure that just fails? That&#8217;s kind of how you might be feeling if you boot up your brand spanking new Windows 8 install, install VS 2010 and the WP 7.1 SDK, followed by the 7.1.1. update to get the emulator and Tango support, boot up your project &#8211; hit F5&#8230; drum roll&#8230; emulator crashes. Sigh.</p>
<p><strong>Luckily, there&#8217;s an easy fix!</strong></p>
<p>Rename all of the *.dess files under %systemdrive%\programdata\Microsoft\XDE and restart the emulator, and all should be good.</p>
<p><strong>What&#8217;s going on?</strong></p>
<p>For some reason the saved state of the emulator is getting corrupted, by renaming these files (which could probably be safely deleted) you&#8217;re forcing the emulator to recreate them (shutdown may be a little slower the first time you close the emulator).</p>
<img src="http://feeds.feedburner.com/~r/OrenNachman/~4/OGL27G5aKYs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nachmore.com/2012/wp-emulator-crashing-on-windows-8-heres-a-fix/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.nachmore.com/2012/wp-emulator-crashing-on-windows-8-heres-a-fix/</feedburner:origLink></item>
		<item>
		<title>HOWTO: Download Boot Camp 4.0</title>
		<link>http://feedproxy.google.com/~r/OrenNachman/~3/qJPmKsLCR74/</link>
		<comments>http://www.nachmore.com/2012/howto-download-boot-camp-4-0/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 06:48:15 +0000</pubDate>
		<dc:creator>Oren</dc:creator>
		
		<guid isPermaLink="false">http://www.nachmore.com/?p=301</guid>
		<description><![CDATA[I recently (this afternoon) found myself having to install Windows 7 on a large number of mac mini&#8217;s, without an OS X installation CD. Downloading the software through Boot Camp assistant didn&#8217;t seem to work eitherso I went ahead and installed Windows anyway while hunting for a way to get at the drivers without a [...]]]></description>
			<content:encoded><![CDATA[<p>I recently (this afternoon) found myself having to install Windows 7 on a large number of mac mini&#8217;s, without an OS X installation CD. Downloading the software through Boot Camp assistant didn&#8217;t seem to work eitherso I went ahead and installed Windows anyway while hunting for a way to get at the drivers without a CD.</p>
<p>Turns out this isn&#8217;t the easiest thing in the world. The only downloads on Apple&#8217;s site are updates, and not Boot Camp itself. Some further digging turned up <a href="https://groups.google.com/group/macenterprise/msg/4df985a358d6022c?pli=1">this</a> post which points towards an <a href="http://swscan.apple.com/content/catalogs/others/index-lion-snowleopard-leopard.merged-1.sucatalog">Apple update catalog</a>. Once you have that, getting the Windows software is easy:</p>
<ol>
<li>Grab a copy of 7-zip</li>
<li>Search through the <a href="http://swscan.apple.com/content/catalogs/others/index-lion-snowleopard-leopard.merged-1.sucatalog">catalog </a>for product 041-0694</li>
<li>Download the pkg file (it&#8217;s around 600mb)</li>
<li>Extract the pkg file with 7-zip</li>
<li>Here&#8217;s the fun part &#8211; keep extracting the largest files as you go (Payload,  WindowsSupport.dmg etc) until you hit 0.APPLE_ISO</li>
<li>Rename 0.APPLE_ISO to 0.iso and extract that with 7-zip and run setup.exe
<ol>
<li>Alternatively you can simply burn the iso file onto a CD</li>
</ol>
</li>
</ol>
<p>Good Luck!</p>
<img src="http://feeds.feedburner.com/~r/OrenNachman/~4/qJPmKsLCR74" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nachmore.com/2012/howto-download-boot-camp-4-0/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://www.nachmore.com/2012/howto-download-boot-camp-4-0/</feedburner:origLink></item>
		<item>
		<title>Got Phantom Menus? RefreshScreen is here to help</title>
		<link>http://feedproxy.google.com/~r/OrenNachman/~3/A9-hKKO6-Ig/</link>
		<comments>http://www.nachmore.com/2011/got-phantom-menus-refreshscreen-is-here-to-help/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 23:06:41 +0000</pubDate>
		<dc:creator>Oren</dc:creator>
		
		<guid isPermaLink="false">http://www.nachmore.com/?p=297</guid>
		<description><![CDATA[The fact that my (full updated)  video card will occasionally blue screen my screen after playing Flash videos aside, my next biggest video card related gripe is floating phantom menus: You know the ones &#8211; those ones that stick around, in front of everything, after you click on a random menu item. They only seem to go [...]]]></description>
			<content:encoded><![CDATA[<p>The fact that my (full updated)  video card will occasionally blue screen my screen after playing Flash videos aside, my next biggest video card related gripe is floating phantom menus:</p>
<p><a href="http://www.nachmore.com/wp-content/uploads/2011/11/floating.png"><img class="aligncenter size-full wp-image-298" title="Floating Phantom Menus" src="http://www.nachmore.com/wp-content/uploads/2011/11/floating.png" alt="Floating Phantom Menus" width="231" height="93" /></a></p>
<p>You know the ones &#8211; those ones that stick around, in front of everything, after you click on a random menu item. They only seem to go away when you restart your system or force a screen resolution change. Since that involves multiple clicks and a dialog I&#8217;ve written a tiny, one line, screen refresher. Run it to exorcise those menus!</p>
<p>Note: Unfortunately this doesn&#8217;t solve the actual problem that causes this, so you&#8217;ll probably get more phantoms afterwards.</p>
<p><a href="http://www.nachmore.com/files/RefreshScreen.exe">Grab the EXE</a></p>
<p><a href="http://www.nachmore.com/files/RefreshScreen.zip">Grab the Project</a> (VS2010, C++)</p>
<p>P.S. For reference, all the code does is call <a href="http://msdn.microsoft.com/en-us/library/dd183411(v=VS.85).aspx">ChangeDisplaySettings </a>with (NULL, 0) in order to refresh the screen settings from the registry.</p>
<img src="http://feeds.feedburner.com/~r/OrenNachman/~4/A9-hKKO6-Ig" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nachmore.com/2011/got-phantom-menus-refreshscreen-is-here-to-help/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.nachmore.com/2011/got-phantom-menus-refreshscreen-is-here-to-help/</feedburner:origLink></item>
		<item>
		<title>Windows Phone Power Tools 1.1</title>
		<link>http://feedproxy.google.com/~r/OrenNachman/~3/inqegrHR4AU/</link>
		<comments>http://www.nachmore.com/2011/windows-phone-power-tools-1-1/#comments</comments>
		<pubDate>Wed, 21 Sep 2011 05:31:07 +0000</pubDate>
		<dc:creator>Oren</dc:creator>
		
		<guid isPermaLink="false">http://www.nachmore.com/?p=289</guid>
		<description><![CDATA[Grab them here I received a fair amount of feedback about the first version of the Power Tools mainly focused around the UI (people like modern today) and around &#8220;bug #1&#8220;, which prevented files from uploading to the correct path in IsolatedStorage. I&#8217;ve just pushed a major UI rehaul to something somewhat more Metro-ish, loosely [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://wptools.codeplex.com/">Grab them here</a></p>
<p>I received a fair amount of feedback about the first version of the Power Tools mainly focused around the UI (people like modern today) and around &#8220;<a href="http://wptools.codeplex.com/workitem/1">bug #1</a>&#8220;, which prevented files from uploading to the correct path in IsolatedStorage.</p>
<p>I&#8217;ve just pushed a major UI rehaul to something somewhat more Metro-ish, loosely styled off Zune. It uses a combination of custom styles that you can find in the source tree and <a href="http://code.jenkinsfamily.com.au/mahapps.metro/overview">MahApps.Metro</a>. I&#8217;ve also fixed the upload bug and other miscellaneous bits of polish here and there. This probably should have been a 2.0 or a 1.5 but it seemed to soon <img src='http://www.nachmore.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>As always, feedback is welcome, though a reminder that this is not a Microsoft official tool.</p>
<p><a href="http://www.nachmore.com/wp-content/uploads/2011/09/file_browser_1.1.png"><img class="aligncenter size-full wp-image-290" title="file_browser_1.1" src="http://www.nachmore.com/wp-content/uploads/2011/09/file_browser_1.1.png" alt="" width="569" height="410" /></a> <a href="http://www.nachmore.com/wp-content/uploads/2011/09/install_update.png"><img class="aligncenter size-full wp-image-291" title="install_update" src="http://www.nachmore.com/wp-content/uploads/2011/09/install_update.png" alt="" width="569" height="410" /></a></p>
<img src="http://feeds.feedburner.com/~r/OrenNachman/~4/inqegrHR4AU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nachmore.com/2011/windows-phone-power-tools-1-1/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.nachmore.com/2011/windows-phone-power-tools-1-1/</feedburner:origLink></item>
		<item>
		<title>Windows Phone Power Tools</title>
		<link>http://feedproxy.google.com/~r/OrenNachman/~3/IEWbtUvj2O0/</link>
		<comments>http://www.nachmore.com/2011/windows-phone-power-tools/#comments</comments>
		<pubDate>Tue, 13 Sep 2011 08:50:21 +0000</pubDate>
		<dc:creator>Oren</dc:creator>
		
		<guid isPermaLink="false">http://www.nachmore.com/?p=285</guid>
		<description><![CDATA[Necessity may be the mother of invention, but it&#8217;s also often the mother of Open Source tools which are not really reinventing the wheel, but perhaps make our lives just that little bit easier (or more functional). A common pain point, especially as more and more developers move their apps to Mango is testing update [...]]]></description>
			<content:encoded><![CDATA[<p>Necessity may be the mother of invention, but it&#8217;s also often the mother of Open Source tools which are not really reinventing the wheel, but perhaps make our lives just that little bit easier (or more functional). A common pain point, especially as more and more developers move their apps to Mango is testing update scenarios and exploring the IsolatedStorage of a developer app, both extremely handy debugging tools to have that either don&#8217;t exist (updating developer apps is not really possible) or are very basic (the IsolatedStorage Explorer tool that ships with the SDK).</p>
<p>To this end, I&#8217;ve published a little Open Source app that I&#8217;m dubbing the &#8220;Windows Phone Power Tools&#8221; that allow you to do just that &#8211; update developer xaps, visually explore the IsolatedStorage structure of your apps and a bunch of other small, but handy, features.</p>
<p>You can check it out on codeplex: <a href="http://wptools.codeplex.com/">http://wptools.codeplex.com</a></p>
<p><a href="http://www.nachmore.com/wp-content/uploads/2011/09/1.png"><img class="aligncenter size-full wp-image-286" title="1" src="http://www.nachmore.com/wp-content/uploads/2011/09/1.png" alt="" width="535" height="334" /></a></p>
<p><a href="http://www.nachmore.com/wp-content/uploads/2011/09/1.png"></a><a href="http://www.nachmore.com/wp-content/uploads/2011/09/2.png"><img class="aligncenter size-full wp-image-287" title="2" src="http://www.nachmore.com/wp-content/uploads/2011/09/2.png" alt="" width="535" height="334" /></a></p>
<img src="http://feeds.feedburner.com/~r/OrenNachman/~4/IEWbtUvj2O0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nachmore.com/2011/windows-phone-power-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.nachmore.com/2011/windows-phone-power-tools/</feedburner:origLink></item>
		<item>
		<title>Windows Phone App Lookup Tool</title>
		<link>http://feedproxy.google.com/~r/OrenNachman/~3/f1v6WjU_Yho/</link>
		<comments>http://www.nachmore.com/2011/windows-phone-app-lookup-tool/#comments</comments>
		<pubDate>Tue, 12 Jul 2011 09:46:25 +0000</pubDate>
		<dc:creator>Oren</dc:creator>
		
		<guid isPermaLink="false">http://www.nachmore.com/?p=280</guid>
		<description><![CDATA[Ever ended up with an application&#8217;s GUID but not with the app&#8217;s name? Probably not, but just in case you do ever need to reverse lookup a Windows Phone&#8217;s app name from its GUID, you can grab App Lookup. It&#8217;s also Open Source (i.e. not official Microsoft), so feel free to grab it, fork it [...]]]></description>
			<content:encoded><![CDATA[<p>Ever ended up with an application&#8217;s GUID but not with the app&#8217;s name?</p>
<p>Probably not, but just in case you do ever need to reverse lookup a Windows Phone&#8217;s app name from its GUID, you can grab <a href="http://applookup.codeplex.com/">App Lookup</a>. It&#8217;s also Open Source (i.e. not official Microsoft), so feel free to <a href="http://applookup.codeplex.com/SourceControl/list/changesets">grab it</a>, fork it and send through pull requests!</p>
<p><a href="http://www.nachmore.com/wp-content/uploads/2011/07/app_lookup.png"><img class="aligncenter size-full wp-image-281" title="app_lookup" src="http://www.nachmore.com/wp-content/uploads/2011/07/app_lookup.png" alt="" width="525" height="175" /></a></p>
<p>How&#8217;s that for a short one? <img src='http://www.nachmore.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<img src="http://feeds.feedburner.com/~r/OrenNachman/~4/f1v6WjU_Yho" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nachmore.com/2011/windows-phone-app-lookup-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.nachmore.com/2011/windows-phone-app-lookup-tool/</feedburner:origLink></item>
		<item>
		<title>Getting Started with Node.js and Mango (Sockets)</title>
		<link>http://feedproxy.google.com/~r/OrenNachman/~3/0fa9xEpcWHs/</link>
		<comments>http://www.nachmore.com/2011/getting-started-with-node-js-and-mango-sockets/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 06:29:31 +0000</pubDate>
		<dc:creator>Oren</dc:creator>
		
		<guid isPermaLink="false">http://www.nachmore.com/?p=275</guid>
		<description><![CDATA[It&#8217;s been a while since I&#8217;ve found time to blog &#8211; but it&#8217;s not like I&#8217;ve left you in cold hands. Rohan has been doing a great job posting on the Silverlight for Windows Phone Performance blog (check it out if you haven&#8217;t yet). On a completely non-performance related topic (we&#8217;ll get to those in [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a while since I&#8217;ve found time to blog &#8211; but it&#8217;s not like I&#8217;ve left you in cold hands. Rohan has been doing a great job posting on the <a href="/b/slmperf/">Silverlight for Windows Phone Performance blog</a> (check it out if you haven&#8217;t yet).</p>
<p>On a completely non-performance related topic (we&#8217;ll get to those in the next couple of blog posts), I&#8217;ve been meaning to play around with <a href="http://nodejs.org/">Node.js</a> for a while, and when a colleague posed a question about using it with Mango, I thought it might be a great excuse to polish off the <a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=26648">Beta 2 tools</a> (get them while they&#8217;re hot!) and do some Socketing!</p>
<p>First things first &#8211; grab <a href="http://www.7-zip.org/download.html">7zip</a> (if you don&#8217;t have it already), and <a href="http://node-js.prcn.co.cc/">Node.js binaries for Windows</a> (or<a href="https://github.com/joyent/node/wiki/Installation"> build it yourself</a>). Extract these to a convenient location and you should be good to go.</p>
<p>We&#8217;re going to use the Hello World sample ripped straight from the Node.js homepage, with one extra debugging addition (highlighted in yellow) and a practical change (highlighted in green &#8211; see &#8220;gotcha!&#8221; below):</p>
<pre style="color: #000000; background-color: #ffffff; font-family: 'Courier New';"><span style="color: #800000; font-weight: bold;">var</span> http <span style="color: #808030;">=</span> require<span style="color: #808030;">(</span><span style="color: #0000e6;">'http'</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
http<span style="color: #808030;">.</span>createServer<span style="color: #808030;">(</span><span style="color: #800000; font-weight: bold;">function</span> <span style="color: #808030;">(</span>req<span style="color: #808030;">,</span> res<span style="color: #808030;">)</span> <span style="color: #800080;">{</span>
  res<span style="color: #808030;">.</span>writeHead<span style="color: #808030;">(</span><span style="color: #008c00;">200</span><span style="color: #808030;">,</span> <span style="color: #800080;">{</span><span style="color: #0000e6;">'Content-Type'</span><span style="color: #800080;">:</span> <span style="color: #0000e6;">'text/plain'</span><span style="color: #800080;">}</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
  res<span style="color: #808030;">.</span>end<span style="color: #808030;">(</span><span style="color: #0000e6;">'Hello World</span><span style="color: #0f69ff;">\n</span><span style="color: #0000e6;">'</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
<span style="background-color: #ffff00;"> console<span style="color: #808030;">.</span><span style="color: #800000; font-weight: bold;">log</span><span style="color: #808030;">(</span><span style="color: #0000e6;">'Sent message'</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span> </span><span style="color: #800080;">}</span><span style="color: #808030;">)</span><span style="color: #808030;">.</span>listen<span style="color: #808030;">(</span><span style="color: #008c00;">1337</span><span style="color: #808030;">,</span> <span style="color: #0000e6;">"<span style="background-color: #00ff00;">192.168.2.125</span>"</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
console<span style="color: #808030;">.</span><span style="color: #800000; font-weight: bold;">log</span><span style="color: #808030;">(</span><span style="color: #0000e6;">'Server running at http://<span style="background-color: #00ff00;">192.168.2.125</span>:1337/'</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span></pre>
<p><strong><span style="color: #ff0000; font-size: medium;"><br />
Gotcha Warning!</span></strong></p>
<p>A common mistake at this point is to stick with the sample&#8217;s use of 127.0.0.1 (locahost). This will work great from your browser, but not from the emulator or your device (regardless of whether it is connected to WiFi or tethered via Zune). This is because the emulator and the device join the network as *new* devices which means they get a newly assigned IP address and they act just as though they were a machine on the network. This leads to 127.0.0.1 pointing back to themselves, which is not allowed, leaving you with a &#8220;NetworkDown&#8221; network error. Instead, make sure to set your IP to your local LAN address (usually starts with 192.168.X.X or 10.X.X.X). You can find your exact IP address from cmd by typing &#8220;ipconfig&#8221; and looking for the address that corresponds to your local network.</p>
<p><strong><span style="font-size: medium;">Testing the Server</span></strong></p>
<p>Now, save your modified script somewhere somewhere convenient (I saved it to c:\nodejs\bin\servers\helloworld.js) and then launch the server with a simple:</p>
<p><span style="color: #ffffff; font-family: courier new,courier; background-color: #000000;">C:\nodejs\bin&gt;node servers/helloworld.js<br />
</span><span style="color: #ffffff; font-family: courier new,courier; background-color: #000000;">Server running at http://192.168.2.125:1337/</span></p>
<p>Note the use of UNIX style paths&#8230; If you see any errors at this point it&#8217;s most likely path related. Fix your path so it is relative to your binary and you should be good to go. Need to verify that everything is working? Fire up your browser and enter <a href="http://localhost:1337">http://localhost:1337</a> and you should see &#8220;Hello World!&#8221;.</p>
<p><strong>Note:</strong> When launching the server you may get the Windows warning dialog about a program accessing the network, feel free to set the settings to whatever you are comfortable with, just note that Node.js will need at least local network access so that you can talk to it from the emulator / a device over WiFi.</p>
<p><span style="font-size: medium;"><strong>Let&#8217;s get me some Windows Phone!</strong></span></p>
<p>We&#8217;re up and running, so time to get our hands dirty with some C# code. Open Visual Studio and start a new C# Windows Phone application targetting &#8220;Windows Phone 7l.1&#8243; (which is the code target name for Mango). The project that we create is going to do something extremely simple &#8211; it&#8217;s going to open the socket, send a request for data (it&#8217;s really a dummy request since this server isn&#8217;t really waiting for a real request) and then displays the response, verbatim, on the screen.</p>
<p>Once you have the project created add a button (btnStart), which will kick the whole process off, and a textblock (txtServerResponse) to contain the server response. We&#8217;re not going to use binding to simplify the sample, but you can certainly do that instead. Add a Click handler to the button by double clicking on it and add the following code to MainPage.xaml.cs. The code is heavily documented so should answer any further questions you might have. I&#8217;ve also stuck a zipped version of the project (including the mini-server) which you can use to experiment with.</p>
<pre style="color: #000000; background: #ffffff; font-family: 'Courier New';"><span style="color: #0000ff; font-weight: bold;">private</span> Socket _socket;

<span style="color: #0000ff; font-weight: bold;">private</span> <span style="color: #0000ff; font-weight: bold;">void</span> btnStart_Click<span style="color: #808030;">(</span><span style="color: #0000ff; font-weight: bold;">object</span> sender<span style="color: #808030;">,</span> RoutedEventArgs e<span style="color: #808030;">)</span>
<span style="color: #000000;">{</span>
    <span style="color: #008000;">// the message to send to the server</span>
    <span style="color: #0000ff; font-weight: bold;">byte</span><span style="color: #808030;">[</span><span style="color: #808030;">]</span> message <span style="color: #808030;">=</span> UTF8Encoding<span style="color: #808030;">.</span>UTF8<span style="color: #808030;">.</span>GetBytes<span style="color: #808030;">(</span><span style="color: #0000ff;">"</span><span style="color: #0000e6;">GET / HTTP/1.1\nHost: localhost\n\n</span><span style="color: #0000ff;">"</span><span style="color: #808030;">)</span><span style="color: #000000;">;</span>

    <span style="color: #008000;">// the address we'll be connecting to</span>
    IPAddress address  <span style="color: #808030;">=</span> <span style="color: #0000ff; font-weight: bold;">new</span> IPAddress<span style="color: #808030;">(</span><span style="color: #0000ff; font-weight: bold;">new</span> <span style="color: #0000ff; font-weight: bold;">byte</span><span style="color: #808030;">[</span><span style="color: #808030;">]</span> <span style="color: #000000;">{</span><span style="color: #008c00;">192</span><span style="color: #808030;">,</span> <span style="color: #008c00;">168</span><span style="color: #808030;">,</span> <span style="color: #008c00;">2</span><span style="color: #808030;">,</span> <span style="color: #008c00;">125</span><span style="color: #000000;">}</span><span style="color: #808030;">)</span><span style="color: #000000;">;</span>

    <span style="color: #008000;">// an endpoint translates into the complete destination - address + port</span>
    <span style="color: #008000;">// you can also use a DnsEndpoint to look up an IP address from a hostname</span>
    IPEndPoint endpoint <span style="color: #808030;">=</span> <span style="color: #0000ff; font-weight: bold;">new</span> IPEndPoint<span style="color: #808030;">(</span>address<span style="color: #808030;">,</span> <span style="color: #008c00;">1337</span><span style="color: #808030;">)</span><span style="color: #000000;">;</span>

    <span style="color: #008000;">// all socket operations are asynchronous on the phone so you must set up </span>
    <span style="color: #008000;">// a SocketAsyncEventArgs object to let the socket know how to act</span>
    SocketAsyncEventArgs args <span style="color: #808030;">=</span> <span style="color: #0000ff; font-weight: bold;">new</span> SocketAsyncEventArgs<span style="color: #808030;">(</span><span style="color: #808030;">)</span> <span style="color: #000000;">{</span> RemoteEndPoint <span style="color: #808030;">=</span> endpoint <span style="color: #000000;">}</span><span style="color: #000000;">;</span>

    <span style="color: #008000;">// don't allow multiple clicks before the request finishes</span>
    btnStart<span style="color: #808030;">.</span>IsEnabled <span style="color: #808030;">=</span> <span style="color: #0000ff; font-weight: bold;">false</span><span style="color: #000000;">;</span>

    <span style="color: #008000;">// create our socket, note that it isn't connected yet</span>
    _socket <span style="color: #808030;">=</span> <span style="color: #0000ff; font-weight: bold;">new</span> Socket<span style="color: #808030;">(</span>AddressFamily<span style="color: #808030;">.</span>InterNetwork<span style="color: #808030;">,</span> SocketType<span style="color: #808030;">.</span>Stream<span style="color: #808030;">,</span> ProtocolType<span style="color: #808030;">.</span>Tcp<span style="color: #808030;">)</span><span style="color: #000000;">;</span>

    <span style="color: #008000;">// set up the call back to be called when we finish connecting to the socket</span>
    args<span style="color: #808030;">.</span>Completed <span style="color: #808030;">+</span><span style="color: #808030;">=</span> <span style="color: #0000ff; font-weight: bold;">new</span> EventHandler<span style="color: #808030;">&lt;</span>SocketAsyncEventArgs<span style="color: #808030;">&gt;</span><span style="color: #808030;">(</span>OnSocketConnected<span style="color: #808030;">)</span><span style="color: #000000;">;</span>

    <span style="color: #008000;">// neat trick - setting the buffer of a socket before it connects will cause the socket to send</span>
    <span style="color: #008000;">// that data as soon as it connects</span>
    args<span style="color: #808030;">.</span>SetBuffer<span style="color: #808030;">(</span>message<span style="color: #808030;">,</span> <span style="color: #008c00;">0</span><span style="color: #808030;">,</span> message<span style="color: #808030;">.</span>Length<span style="color: #808030;">)</span><span style="color: #000000;">;</span>

    <span style="color: #008000;">// boom! we're off</span>
    _socket<span style="color: #808030;">.</span>ConnectAsync<span style="color: #808030;">(</span>args<span style="color: #808030;">)</span><span style="color: #000000;">;</span>
<span style="color: #000000;">}</span>

<span style="color: #0000ff; font-weight: bold;">void</span> OnSocketConnected<span style="color: #808030;">(</span><span style="color: #0000ff; font-weight: bold;">object</span> sender<span style="color: #808030;">,</span> SocketAsyncEventArgs e<span style="color: #808030;">)</span>
<span style="color: #000000;">{</span>
    <span style="color: #0000ff; font-weight: bold;">if</span> <span style="color: #808030;">(</span>e<span style="color: #808030;">.</span>SocketError <span style="color: #808030;">!</span><span style="color: #808030;">=</span> SocketError<span style="color: #808030;">.</span>Success<span style="color: #808030;">)</span>
    <span style="color: #000000;">{</span>
        <span style="color: #008000;">// don't forget that we're now on a background thread so anything that interacts with</span>
        <span style="color: #008000;">// the UI thread (MessageBoxes, updating UI etc) has to be dispatched back</span>
        Dispatcher<span style="color: #808030;">.</span>BeginInvoke<span style="color: #808030;">(</span><span style="color: #808030;">(</span><span style="color: #808030;">)</span> <span style="color: #808030;">=</span><span style="color: #808030;">&gt;</span>
        <span style="color: #000000;">{</span>
            MessageBox<span style="color: #808030;">.</span>Show<span style="color: #808030;">(</span><span style="color: #0000ff;">"</span><span style="color: #0000e6;">(Connect) Socket error! </span><span style="color: #0000ff;">"</span> <span style="color: #808030;">+</span> e<span style="color: #808030;">.</span>SocketError<span style="color: #808030;">.</span>ToString<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #000000;">;</span>
        <span style="color: #000000;">}</span><span style="color: #808030;">)</span><span style="color: #000000;">;</span>
        <span style="color: #0000ff; font-weight: bold;">return</span><span style="color: #000000;">;</span>
    <span style="color: #000000;">}</span>

    <span style="color: #008000;">// we're done with the connect + send, time to receive</span>

    <span style="color: #008000;">// create a buffer for the respone</span>
    <span style="color: #0000ff; font-weight: bold;">byte</span><span style="color: #808030;">[</span><span style="color: #808030;">]</span> buffer <span style="color: #808030;">=</span> <span style="color: #0000ff; font-weight: bold;">new</span> <span style="color: #0000ff; font-weight: bold;">byte</span><span style="color: #808030;">[</span><span style="color: #008c00;">1024</span><span style="color: #808030;">]</span><span style="color: #000000;">;</span>

    <span style="color: #008000;">// create the Socket event args for this receive</span>
    SocketAsyncEventArgs args <span style="color: #808030;">=</span> <span style="color: #0000ff; font-weight: bold;">new</span> SocketAsyncEventArgs<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #000000;">;</span>

    <span style="color: #008000;">// set a buffer for the receive - the size will be the maximum amount read</span>
    args<span style="color: #808030;">.</span>SetBuffer<span style="color: #808030;">(</span>buffer<span style="color: #808030;">,</span> <span style="color: #008c00;">0</span><span style="color: #808030;">,</span> <span style="color: #008c00;">1024</span><span style="color: #808030;">)</span><span style="color: #000000;">;</span>

    <span style="color: #008000;">// we have to come back somewhere after the receive completed</span>
    args<span style="color: #808030;">.</span>Completed <span style="color: #808030;">+</span><span style="color: #808030;">=</span> <span style="color: #0000ff; font-weight: bold;">new</span> EventHandler<span style="color: #808030;">&lt;</span>SocketAsyncEventArgs<span style="color: #808030;">&gt;</span><span style="color: #808030;">(</span>OnSocketReceive<span style="color: #808030;">)</span><span style="color: #000000;">;</span>

    <span style="color: #008000;">// kick off the actual receive</span>
    _socket<span style="color: #808030;">.</span>ReceiveAsync<span style="color: #808030;">(</span>args<span style="color: #808030;">)</span><span style="color: #000000;">;</span>
<span style="color: #000000;">}</span>

<span style="color: #0000ff; font-weight: bold;">void</span> OnSocketReceive<span style="color: #808030;">(</span><span style="color: #0000ff; font-weight: bold;">object</span> sender<span style="color: #808030;">,</span> SocketAsyncEventArgs e<span style="color: #808030;">)</span>
<span style="color: #000000;">{</span>
    <span style="color: #0000ff; font-weight: bold;">if</span> <span style="color: #808030;">(</span>e<span style="color: #808030;">.</span>SocketError <span style="color: #808030;">!</span><span style="color: #808030;">=</span> SocketError<span style="color: #808030;">.</span>Success<span style="color: #808030;">)</span>
    <span style="color: #000000;">{</span>
        Dispatcher<span style="color: #808030;">.</span>BeginInvoke<span style="color: #808030;">(</span><span style="color: #808030;">(</span><span style="color: #808030;">)</span> <span style="color: #808030;">=</span><span style="color: #808030;">&gt;</span>
        <span style="color: #000000;">{</span>
            MessageBox<span style="color: #808030;">.</span>Show<span style="color: #808030;">(</span><span style="color: #0000ff;">"</span><span style="color: #0000e6;">(Receive) Socket error! </span><span style="color: #0000ff;">"</span> <span style="color: #808030;">+</span> e<span style="color: #808030;">.</span>SocketError<span style="color: #808030;">.</span>ToString<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #000000;">;</span>
        <span style="color: #000000;">}</span><span style="color: #808030;">)</span><span style="color: #000000;">;</span>

        <span style="color: #0000ff; font-weight: bold;">return</span><span style="color: #000000;">;</span>
    <span style="color: #000000;">}</span>

    <span style="color: #008000;">// the response comes back as a byte array, so convert it to a string</span>
    <span style="color: #008000;">// Note: usually you would read from the buffer and then call _socket.ReceiveAsync(e)</span>
    <span style="color: #008000;">// again until e.BytesTransferred == 0 (signals end of the receive), for this example</span>
    <span style="color: #008000;">// we're going to keep it simple</span>
    <span style="color: #0000ff; font-weight: bold;">string</span> response <span style="color: #808030;">=</span> UTF8Encoding<span style="color: #808030;">.</span>UTF8<span style="color: #808030;">.</span>GetString<span style="color: #808030;">(</span>e<span style="color: #808030;">.</span>Buffer<span style="color: #808030;">,</span> <span style="color: #008c00;">0</span><span style="color: #808030;">,</span> e<span style="color: #808030;">.</span>BytesTransferred - 1<span style="color: #808030;">)</span><span style="color: #000000;">;</span>

    <span style="color: #008000;">// we have our response now update the UI thread</span>
    Dispatcher<span style="color: #808030;">.</span>BeginInvoke<span style="color: #808030;">(</span><span style="color: #808030;">(</span><span style="color: #808030;">)</span> <span style="color: #808030;">=</span><span style="color: #808030;">&gt;</span>
    <span style="color: #000000;">{</span>
        txtServerResponse<span style="color: #808030;">.</span>Text <span style="color: #808030;">=</span> response<span style="color: #000000;">;</span>
        btnStart<span style="color: #808030;">.</span>IsEnabled     <span style="color: #808030;">=</span> <span style="color: #0000ff; font-weight: bold;">true</span><span style="color: #000000;">;</span>
    <span style="color: #000000;">}</span><span style="color: #808030;">)</span><span style="color: #000000;">;</span>
<span style="color: #000000;">}</span></pre>
<p><strong><span style="font-size: medium;">What does it look like?</span></strong></p>
<p><span style="font-size: small;"><strong><a href="http://www.nachmore.com/wp-content/uploads/2011/07/nodejs_screenshot.png"><img class="aligncenter size-full wp-image-276" title="NodeJs Mango Sample in flight" src="http://www.nachmore.com/wp-content/uploads/2011/07/nodejs_screenshot.png" alt="" width="289" height="527" /></a><br />
</strong></span></p>
<p><strong><span style="font-size: medium;">Questions? </span></strong></p>
<p>Feel free to leave comments below &#8211; Good Luck!</p>
<p><a href="http://www.nachmore.com/files/NodeJsSample.zip">Download the solution + js file</a></p>
<img src="http://feeds.feedburner.com/~r/OrenNachman/~4/0fa9xEpcWHs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.nachmore.com/2011/getting-started-with-node-js-and-mango-sockets/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.nachmore.com/2011/getting-started-with-node-js-and-mango-sockets/</feedburner:origLink></item>
	</channel>
</rss>
