<?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>Emad Ibrahim</title>
	
	<link>http://www.emadibrahim.com</link>
	<description>web development, tech reviews, tips, tricks, blogging</description>
	<lastBuildDate>Sat, 24 Dec 2011 18:22:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/EmadIbrahim" /><feedburner:info uri="emadibrahim" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>EmadIbrahim</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>30 Days of Rails</title>
		<link>http://feedproxy.google.com/~r/EmadIbrahim/~3/92hFRWTZYrc/</link>
		<comments>http://www.emadibrahim.com/2011/12/24/30-days-of-rails/#comments</comments>
		<pubDate>Sat, 24 Dec 2011 18:22:00 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[30 Days]]></category>
		<category><![CDATA[Interesting]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[Web Dev]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/2011/12/24/30-days-of-rails/</guid>
		<description>If you haven’t noticed, I am a .net developer but I was inspired today by Matt Cutt’s TED talk to start a 30-day project.&amp;#160; I highly recommend watching it; it might inspire you too. &amp;#160; So I have decided to spend 30 days with Ruby on Rails and blog it right here. Stay tuned for [...]</description>
			<content:encoded><![CDATA[<p>If you haven’t noticed, I am a .net developer but I was inspired today by <a href="http://www.ted.com/talks/matt_cutts_try_something_new_for_30_days.html" target="_blank">Matt Cutt’s TED talk</a> to start a 30-day project.&#160; I highly recommend watching it; it might inspire you too.</p>
<p><object width="526" height="374"><param name="movie" value="http://video.ted.com/assets/player/swf/EmbedPlayer.swf"></param><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="wmode" value="transparent"></param><param name="bgColor" value="#ffffff"></param><param name="flashvars" value="vu=http://video.ted.com/talk/stream/2011U/Blank/MattCutts_2011U-320k.mp4&amp;su=http://images.ted.com/images/ted/tedindex/embed-posters/MattCutts-2011U.embed_thumbnail.jpg&amp;vw=512&amp;vh=288&amp;ap=0&amp;ti=1183&lang;=&amp;introDuration=15330&amp;adDuration=4000&amp;postAdDuration=830&amp;adKeys=talk=matt_cutts_try_something_new_for_30_days;year=2011;theme=how_we_learn;event=TED2011;tag=Culture;tag=success;&amp;preAdTag=tconf.ted/embed;tile=1;sz=512x288;" /><embed src="http://video.ted.com/assets/player/swf/EmbedPlayer.swf" pluginspace="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" bgColor="#ffffff" width="526" height="374" allowFullScreen="true" allowScriptAccess="always" flashvars="vu=http://video.ted.com/talk/stream/2011U/Blank/MattCutts_2011U-320k.mp4&#038;su=http://images.ted.com/images/ted/tedindex/embed-posters/MattCutts-2011U.embed_thumbnail.jpg&#038;vw=512&#038;vh=288&#038;ap=0&#038;ti=1183&#038;lang=&#038;introDuration=15330&#038;adDuration=4000&#038;postAdDuration=830&#038;adKeys=talk=matt_cutts_try_something_new_for_30_days;year=2011;theme=how_we_learn;event=TED2011;tag=Culture;tag=success;&#038;preAdTag=tconf.ted/embed;tile=1;sz=512x288;"></embed></object></p>
<p>&#160;</p>
<p>So I have decided to spend 30 days with Ruby on Rails and blog it right here. Stay tuned for a daily post on rails, it will be fun.&#160; I am starting my journey with TekPub’s Rails 3 production at <a href="http://tekpub.com/view/rails3/1">http://tekpub.com/view/rails3/1</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/-h7QGLuzKC7wA42DsZMw8cOfsdw/0/da"><img src="http://feedads.g.doubleclick.net/~a/-h7QGLuzKC7wA42DsZMw8cOfsdw/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/-h7QGLuzKC7wA42DsZMw8cOfsdw/1/da"><img src="http://feedads.g.doubleclick.net/~a/-h7QGLuzKC7wA42DsZMw8cOfsdw/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EmadIbrahim/~4/92hFRWTZYrc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2011/12/24/30-days-of-rails/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.emadibrahim.com/2011/12/24/30-days-of-rails/</feedburner:origLink></item>
		<item>
		<title>Nodejs on Windows</title>
		<link>http://feedproxy.google.com/~r/EmadIbrahim/~3/KxIOJf0PX1Y/</link>
		<comments>http://www.emadibrahim.com/2011/11/07/nodejs-on-windows/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 03:09:02 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[node]]></category>
		<category><![CDATA[npm]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/?p=804</guid>
		<description>This turned out to be easier than expected. Step 1: Download node.exe Get it from http://nodejs.org/#download and put it somewhere in your path e.g. c:\node Step 2: Install git Get it from here and install into your windows console if you want to use the windows command prompt instead of bash Step 3: Install NPM [...]</description>
			<content:encoded><![CDATA[<p>This turned out to be easier than expected.</p>
<h1>Step 1: Download node.exe</h1>
<p>Get it from <a href="http://nodejs.org/#download">http://nodejs.org/#download</a> and put it somewhere in your path e.g. c:\node</p>
<h1>Step 2: Install git</h1>
<p>Get it from <a href="http://code.google.com/p/msysgit/downloads/list?can=3&amp;q=official+Git">here</a> and install into your windows console if you want to use the windows command prompt instead of bash</p>
<h1>Step 3: Install NPM (node package manager)</h1>
<p>This one is a little more involved.&#160; Run the following commands (ref: <a href="http://npmjs.org/doc/README.html#Installing-on-Windows-Experimental">http://npmjs.org/doc/README.html#Installing-on-Windows-Experimental</a>)</p>
<blockquote><p>git config &#8211;system http.sslcainfo /bin/curl-ca-bundle.crt      <br />git clone &#8211;recursive git://github.com/isaacs/npm.git       <br />cd npm       <br />node cli.js install npm –gf</p>
</blockquote>
<h1>Step 4: Install express</h1>
<p>Express is a really cool <a href="http://expressjs.com">web framework</a> for nodejs and should simplify your web development considerably.&#160; This is of course optional, but here are the steps anyway.</p>
<p>create a folder for your app e.g c:\projects\myapp</p>
<blockquote><p>cd c:\projects\myapp</p>
<p>npm install –g express</p>
<p>node app.js</p>
</blockquote>
<p>Now, if you visit http:/127.0.0.1:3000 you will see a 500 error page because you are missing a dependency.&#160; npm install –d should fix it but that threw all kinds of errors in windows “couldn’t unpack blah blah”, “unknown error blah blah”, “out of memory blah blah”…&#160; Fortunately, running this command downloaded the missing dependency (jade) into the temp folder, on my machine it was at C:\Users\Emad\AppData\Local\Temp\npm-1320719310093\1320719310093-0.5456247869879007\contents\___package.npm\package (if it is not there, you can get it from <a href="https://github.com/visionmedia/jade">https://github.com/visionmedia/jade</a>)</p>
<p>I copied the content of that folder into C:\node\node_modules\jade and that took care of the problem.&#160; Now visiting <a href="http://127.0.0.1:3000/">http://127.0.0.1:3000/</a>, I see</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" border="0" src="http://files.dotnetfactory.com/2011-11-07_2159.png" /></p>
<h1>Step 5: Install linux in a Virtual machine</h1>
<p>Yes, you read that right.&#160; It is just much simpler to work with node stuff on linux.&#160; Everything just works.&#160; It seems like on windows, you are constantly swimming upstream.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/C6-zrz1mymI8tqt-VOsCdKPaPY8/0/da"><img src="http://feedads.g.doubleclick.net/~a/C6-zrz1mymI8tqt-VOsCdKPaPY8/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/C6-zrz1mymI8tqt-VOsCdKPaPY8/1/da"><img src="http://feedads.g.doubleclick.net/~a/C6-zrz1mymI8tqt-VOsCdKPaPY8/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EmadIbrahim/~4/KxIOJf0PX1Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2011/11/07/nodejs-on-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.emadibrahim.com/2011/11/07/nodejs-on-windows/</feedburner:origLink></item>
		<item>
		<title>AppHarbor + ASP.NET MVC + Orchard = Awesome</title>
		<link>http://feedproxy.google.com/~r/EmadIbrahim/~3/FYJMHhSbcQA/</link>
		<comments>http://www.emadibrahim.com/2011/05/03/appharbor-asp-net-mvc-orchard-awesome/#comments</comments>
		<pubDate>Tue, 03 May 2011 23:34:10 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[aspnetmvc]]></category>
		<category><![CDATA[cloud computing]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[tdd]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/2011/05/03/appharbor-asp-net-mvc-orchard-awesome/</guid>
		<description>ASP.NET development has come a long way.&amp;#160; It’s now easier to practice Test Driven Development (TDD) thanks to ASP.NET MVC and all the open source tools out there from Ninject to Moq to Entity Framework Code First.&amp;#160; But one thing remains real sucky in the .net world and that is deployment.&amp;#160; Have you tried deploying [...]</description>
			<content:encoded><![CDATA[<p>ASP.NET development has come a long way.&#160; It’s now easier to practice Test Driven Development (TDD) thanks to ASP.NET MVC and all the open source tools out there from <a href="http://ninject.org/" target="_blank">Ninject</a> to <a href="http://code.google.com/p/moq/" target="_blank">Moq</a> to <a href="http://msdn.microsoft.com/en-us/data/aa937723" target="_blank">Entity Framework Code First</a>.&#160; But one thing remains real sucky in the .net world and that is deployment.&#160; Have you tried deploying an Azure application?&#160; It sucks and I hate Azure for it.&#160; I created a web service using Python and deployed it on <a href="http://code.google.com/appengine/" target="_blank">Google AppEngine</a> and it was much faster to create, easier to maintain and deploy even though I knew zero Python.&#160; Deploying a site to IIS is a pain in the butt.</p>
<p>I have always been envious of how easy it was/is to deploy a rails app.&#160; It takes seconds and usually one command line.&#160; It is just awesome.&#160; So, I was really excited when a few weeks ago I ran across <a href="http://appharbor.com/" target="_blank">AppHarbor</a> and it looked too good to be true.&#160; I thought I would see how easy it would be to create a site and deploy it.&#160; Instead of creating an app from scratch though, I am going to create an Orchard website.&#160; If you haven’t seen Orchard, go <a href="http://www.orchardproject.net/" target="_blank">check it out</a>.&#160; It’s really cool.&#160; It’s a CMS/Blog engine written in ASP.NET MVC and is open source and very extensible.</p>
<p>Prerequisites: Setup git on your computer, see this <a href="http://help.github.com/win-set-up-git/" target="_blank">link</a> for instructions.</p>
<p>So, here is how to get a website up and running in seconds…</p>
<p>1 – Login to <a href="http://appharbor.com/" target="_blank">AppHarbor</a> and create a new application</p>
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2011/05/2011-05-03_1545.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2011-05-03_1545" border="0" alt="2011-05-03_1545" src="http://www.emadibrahim.com/wp-content/uploads/2011/05/2011-05-03_1545_thumb.png" width="358" height="224" /></a></p>
<p>2 – Change your new application settings to enable write-access to the file system</p>
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2011/05/2011-05-03_1607.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2011-05-03_1607" border="0" alt="2011-05-03_1607" src="http://www.emadibrahim.com/wp-content/uploads/2011/05/2011-05-03_1607_thumb.png" width="239" height="244" /></a></p>
<p>3 – Start WebMatrix and create a new site from Web Gallery</p>
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2011/05/2011-05-03_1548.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2011-05-03_1548" border="0" alt="2011-05-03_1548" src="http://www.emadibrahim.com/wp-content/uploads/2011/05/2011-05-03_1548_thumb.png" width="486" height="227" /></a></p>
<p>4 – Choose Orchard and name your website</p>
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2011/05/2011-05-03_1550.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2011-05-03_1550" border="0" alt="2011-05-03_1550" src="http://www.emadibrahim.com/wp-content/uploads/2011/05/2011-05-03_1550_thumb.png" width="402" height="298" /></a></p>
<p>5 – Open up a command prompt (I use <a href="http://sourceforge.net/projects/console/" target="_blank">Console2</a>)</p>
<p>6 – Change to the path of your new website e.g. cd c:\websites\mywebsite</p>
<p>7 – run the following commands</p>
<ul>
<li>git init</li>
<li>git add .</li>
<li>git commit –m “initial commit”</li>
<li>git remote add appharbor <a href="https://eibrahim@appharbor.com/MyWebsite.git">https://eibrahim@appharbor.com/MyWebsite.git</a> (the URL will be unique to your app)</li>
<li>git push appharbor master (enter your AppHarbor password)</li>
</ul>
<p>8 – Visit your new site on appharbor, in this example the site is located at <a href="http://mywebsite.apphb.com/">http://mywebsite.apphb.com/</a>&#160;</p>
<p>9 – DONE!!!&#160; Just follow the prompts to setup Orchard</p>
<p>&#160;</p>
<p>You have just deployed a web app and have it hosted for free.&#160; You can easily scale it using AppHarbor’s cloud infrastructure.&#160; It is simply awesome.&#160; </p>
<p>Another cool feature is that every time you want to deploy a new version, you simply commit your changes and run the git push command above.&#160; AppHarbor maintains different versions of your app and you can easily switch between versions.&#160; So if you deployed a bad version, you simply click a link and deploy the last working version.</p>
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2011/05/2011-05-03_19411.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="2011-05-03_1941" border="0" alt="2011-05-03_1941" src="http://www.emadibrahim.com/wp-content/uploads/2011/05/2011-05-03_1941_thumb1.png" width="500" height="134" /></a></p>
<p>I personally haven’t deployed a scalable app on AppHarbor, so I would love to hear your feedback on how well the scaling works and if it is cost-effective or not.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/0iKxtEa0D8tW5EIytjg9gky3hGU/0/da"><img src="http://feedads.g.doubleclick.net/~a/0iKxtEa0D8tW5EIytjg9gky3hGU/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/0iKxtEa0D8tW5EIytjg9gky3hGU/1/da"><img src="http://feedads.g.doubleclick.net/~a/0iKxtEa0D8tW5EIytjg9gky3hGU/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EmadIbrahim/~4/FYJMHhSbcQA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2011/05/03/appharbor-asp-net-mvc-orchard-awesome/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		<feedburner:origLink>http://www.emadibrahim.com/2011/05/03/appharbor-asp-net-mvc-orchard-awesome/</feedburner:origLink></item>
		<item>
		<title>Windows Phone in Numbers</title>
		<link>http://feedproxy.google.com/~r/EmadIbrahim/~3/9RsbCW88ugY/</link>
		<comments>http://www.emadibrahim.com/2011/04/09/windows-phone-in-numbers/#comments</comments>
		<pubDate>Sat, 09 Apr 2011 13:50:22 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[Interesting]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[wp7]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/2011/04/09/windows-phone-in-numbers/</guid>
		<description>A new version of “Dude, Where Is My Update?” (marketplace link) was published last night and it now includes some interesting stats.&amp;#160; Here are some of the more interesting stats: The most popular phone so far is Samsung Focus standing at about 42%.&amp;#160; Interestingly, 38% of users have the latest version of Windows Phone 7 [...]</description>
			<content:encoded><![CDATA[<p>A new version of “Dude, Where Is My Update?” (<a href="http://bit.ly/gamGev" target="_blank">marketplace link</a>) was published last night and it now includes some interesting stats.&#160; Here are some of the more interesting stats:</p>
<p>The most popular phone so far is Samsung Focus standing at <strong>about 42%</strong>.&#160; </p>
<p>Interestingly, <strong>38% of users</strong> have the latest version of Windows Phone 7 i.e. version 7.0.7390.&#160; This leaves me wondering why they downloaded my app in the first place.&#160; I am assuming they did it for the stats.&#160; </p>
<p>Another interesting tidbit is that <strong>62% of users </strong>are in the US.</p>
<h1>Surprises</h1>
<p><strong>Dell Venue</strong>: One surprise was that the Dell Venue is not as popular as I thought – standing at <strong>a mere 1.5%</strong>.&#160; This surprised me because I have seen the Dell phone and it rocks.</p>
<p><strong>Samsung Focus</strong>: 20% of Samsung Focus phones have the NoDo update – I am assuming they used the Chevron workaround or they have an unlocked phone somehow</p>
<h1>Screenshot</h1>
<p>Here is a screenshot at 9:50 AM EST of the global stats (numbers are going exponentially)</p>
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2011/04/image.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.emadibrahim.com/wp-content/uploads/2011/04/image_thumb.png" width="292" height="484" /></a></p>
<p><strong>IMPORTAN</strong>T: Please keep in mind that this is based on the number of users using my app and is not indicative of the total number of actual windows phone users.&#160; Although, it does give an idea on what phones are popular and the available versions in the market.&#160; </p>

<p><a href="http://feedads.g.doubleclick.net/~a/tNmVx20PP93vymK6XHhI9kyaDIU/0/da"><img src="http://feedads.g.doubleclick.net/~a/tNmVx20PP93vymK6XHhI9kyaDIU/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/tNmVx20PP93vymK6XHhI9kyaDIU/1/da"><img src="http://feedads.g.doubleclick.net/~a/tNmVx20PP93vymK6XHhI9kyaDIU/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EmadIbrahim/~4/9RsbCW88ugY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2011/04/09/windows-phone-in-numbers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.emadibrahim.com/2011/04/09/windows-phone-in-numbers/</feedburner:origLink></item>
		<item>
		<title>Promote Your Windows Phone 7 App – Limited Time</title>
		<link>http://feedproxy.google.com/~r/EmadIbrahim/~3/2k_7FNaB3BY/</link>
		<comments>http://www.emadibrahim.com/2011/04/05/promote-your-windows-phone-7-app-limited-time/#comments</comments>
		<pubDate>Tue, 05 Apr 2011 21:12:51 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[Random]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[wp7]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/2011/04/05/promote-your-windows-phone-7-app-limited-time/</guid>
		<description>I am running a limited time trial to test my in-app advertising system and its effectiveness.&amp;#160; If you are interested and want to promote your Windows Phone 7 app for free, then email me at wp7ads at dotnetfactory.com.&amp;#160; Your ad will show up in my app “Dude, Where Is My Update?”.&amp;#160; You could potentially receive [...]</description>
			<content:encoded><![CDATA[<p>I am running a limited time trial to test my in-app advertising system and its effectiveness.&#160; If you are interested and want to promote your Windows Phone 7 app for free, then email me at wp7ads at dotnetfactory.com.&#160; Your ad will show up in my app “<a href="http://www.emadibrahim.com/2011/03/30/dude-where-is-my-update/">Dude, Where Is My Update?</a>”.&#160; You could potentially receive thousands of impressions – no promises though :)</p>
<p>This is a limited time offer and only a few slots are available.&#160; Your ad can be an image or text and will show up as shown below.&#160; </p>
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2011/04/4-5-2011-5-09-32-PM.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="4-5-2011 5-09-32 PM" border="0" alt="4-5-2011 5-09-32 PM" src="http://www.emadibrahim.com/wp-content/uploads/2011/04/4-5-2011-5-09-32-PM_thumb.png" width="292" height="484" /></a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/GR4KO_M-rNTQbJgOCmnoXF0KIQc/0/da"><img src="http://feedads.g.doubleclick.net/~a/GR4KO_M-rNTQbJgOCmnoXF0KIQc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/GR4KO_M-rNTQbJgOCmnoXF0KIQc/1/da"><img src="http://feedads.g.doubleclick.net/~a/GR4KO_M-rNTQbJgOCmnoXF0KIQc/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EmadIbrahim/~4/2k_7FNaB3BY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2011/04/05/promote-your-windows-phone-7-app-limited-time/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.emadibrahim.com/2011/04/05/promote-your-windows-phone-7-app-limited-time/</feedburner:origLink></item>
		<item>
		<title>Dude, Where Is My Update? Plus Stats.</title>
		<link>http://feedproxy.google.com/~r/EmadIbrahim/~3/FFRGJY6ShJ4/</link>
		<comments>http://www.emadibrahim.com/2011/04/05/dude-where-is-my-update-plus-stats/#comments</comments>
		<pubDate>Tue, 05 Apr 2011 14:40:19 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[Interesting]]></category>
		<category><![CDATA[Random]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[wp7]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/?p=752</guid>
		<description>UPDATE: App is now live in the marketplace – download link UPDATE 2: See some interesting windows phone 7 stats over here. I was really shocked with the success of &amp;#34;Dude, Where Is My Update?&amp;#34; (DWIMU) windows phone 7 app; but I guess that shows how desperate people are for the NoDo update.&amp;#160; On a [...]</description>
			<content:encoded><![CDATA[<p><strong><font style="background-color: #ffff00">UPDATE: App is now live in the marketplace – <a href="http://bit.ly/gamGev" target="_blank">download link</a></font></strong></p>
<p><strong><font style="background-color: #ffff00">UPDATE 2: See some interesting windows phone 7 stats <a href="http://www.emadibrahim.com/2011/04/09/windows-phone-in-numbers/" target="_blank">over here</a>.</font></strong></p>
<p>I was really shocked with the success of &quot;Dude, Where Is My Update?&quot; (DWIMU) windows phone 7 app; but I guess that shows how desperate people are for the NoDo update.&#160; On a side note: personally I just got the update on one of my development devices and WOW it is awesome.&#160; I can&#8217;t wait to get it on my primary phone (Samsung Focus).</p>
<p>I decided to update DWIMU with some really cool features.&#160; You can now get all kind of cool stats about the number of people using different phones in different locations and a version breakdown.</p>
<h2>Phone Stats</h2>
<p>This shows your phone and version as well as the number of users with the same phone and then a version breakdown specific to this phone.&#160; </p>
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2011/04/screen62.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="screen6" border="0" alt="screen6" src="http://www.emadibrahim.com/wp-content/uploads/2011/04/screen6_thumb1.png" width="292" height="484" /></a></p>
<h2>Local Stats</h2>
<p>This shows your location (country) and version as well as the number of users in your country as well as version and phone breakdowns in your country.</p>
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2011/04/screen71.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="screen7" border="0" alt="screen7" src="http://www.emadibrahim.com/wp-content/uploads/2011/04/screen7_thumb1.png" width="292" height="484" /></a></p>
<h2>Global Stats</h2>
<p>This will show you the global/worldwide number of users and version and phone breakdowns across the world.</p>
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2011/04/screen81.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="screen8" border="0" alt="screen8" src="http://www.emadibrahim.com/wp-content/uploads/2011/04/screen8_thumb1.png" width="292" height="484" /></a></p>
<h2>It’s Up To You</h2>
<p>Obviously, it goes without saying that for these stats to work a lot of people have to download it, so you need to do your part and <a href="http://bit.ly/gwP2BN" target="_blank">spread the word</a>.&#160; The more people, the more accurate.&#160; We will never get an exact number since that will require every single user to install that app, but at least we will have a good idea and a good measure of the health the windows phone 7 community and platform.&#160; An awesome platform, if I may say so myself.</p>
<h2>Get It Now</h2>
<p>If you have a developer account and can’t wait for version 1.1 to get approved, you can <a href="http://bit.ly/gLQKMP" target="_blank">download the XAP file here</a>.</p>
<p>NOTE: If you don’t know what to do with this file, do NOT download it and wait for the update to show in the Market Place – should be out in a couple of days.&#160; </p>
<p>Thanks and if you have any questions email me at dude at dotnetfactory dot com</p>
<h2>DWIMU Progress &amp; Reviews</h2>
<p>Check out the reviews at <a title="http://bit.ly/gYe43e" href="http://bit.ly/gYe43e">http://bit.ly/gYe43e</a> (200+ in one day).&#160; Thanks for downloading and if you haven’t downloaded it yet, you can get it from <a title="http://bit.ly/gamGev" href="http://bit.ly/gamGev">http://bit.ly/gamGev</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/xH5QXTpu5sIc3skVvudOgwQIxIk/0/da"><img src="http://feedads.g.doubleclick.net/~a/xH5QXTpu5sIc3skVvudOgwQIxIk/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/xH5QXTpu5sIc3skVvudOgwQIxIk/1/da"><img src="http://feedads.g.doubleclick.net/~a/xH5QXTpu5sIc3skVvudOgwQIxIk/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EmadIbrahim/~4/FFRGJY6ShJ4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2011/04/05/dude-where-is-my-update-plus-stats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.emadibrahim.com/2011/04/05/dude-where-is-my-update-plus-stats/</feedburner:origLink></item>
		<item>
		<title>Dude, Where Is My Update?</title>
		<link>http://feedproxy.google.com/~r/EmadIbrahim/~3/byOVkWWDXPg/</link>
		<comments>http://www.emadibrahim.com/2011/03/30/dude-where-is-my-update/#comments</comments>
		<pubDate>Wed, 30 Mar 2011 16:17:57 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[Interesting]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[wp7]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/?p=748</guid>
		<description>Update: Version 1.1 Available – more info here. We are all patiently waiting for the Windows Phone 7 update.&amp;#160; A few lucky ones already got it, but a whole lot of people including myself didn’t get it yet.&amp;#160; I find myself insistently checking blogs, twitter, Facebook and Google to figure out if and when the [...]</description>
			<content:encoded><![CDATA[<p><strong><font style="background-color: #ffff00">Update: Version 1.1 Available – more </font></strong><a href="http://bit.ly/g4Yudn" target="_blank"><strong><font style="background-color: #ffff00">info here</font></strong></a><strong><font style="background-color: #ffff00">.</font></strong></p>
<p>We are all patiently waiting for the Windows Phone 7 update.&#160; A few lucky ones already got it, but a whole lot of people including myself didn’t get it yet.&#160; I find myself insistently checking blogs, twitter, Facebook and Google to figure out if and when the update will be available.&#160; To pass the time and to simplify my life and reduce the stress of figuring out the status of the update, I built a free little WP7 app called “Dude, Where Is My Update?” or DWIMU for short.</p>
<p>You simply select your region and phone or operator and get the bad/good news.&#160; I have a Samsung Focus, so unfortunately, I will be waiting for a long time.</p>
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2011/03/image.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.emadibrahim.com/wp-content/uploads/2011/03/image_thumb.png" width="292" height="484" /></a></p>
<p>But if you are in Sweden with the Hutchison Group then you should be getting the updates a lot sooner.</p>
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2011/03/image1.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.emadibrahim.com/wp-content/uploads/2011/03/image_thumb1.png" width="292" height="484" /></a></p>
<h2>How does it work?</h2>
<p>Right now, the app simply gets the data from Microsoft’s website at <a title="http://bit.ly/eMukfH" href="http://bit.ly/eMukfH">http://bit.ly/eMukfH</a>.&#160; I will write another blog detailing the technical implementation of the app.&#160; I built a web service in Python and hosted it with Google’s AppEngine (because it is free).&#160; DWIMU pulls the data from my web service which I will keep updated and in sync with Microsoft’s website.</p>
<h2>Why you should download the app?</h2>
<p>The future plans is to crowd source the update detection to get a more accurate indication of when you will be getting the update.&#160; By simply running the app you will be able to see how many people already received the update for your selected network/phone/region.&#160; Of course, this will only work if there is enough people using the app.&#160; If I get enough downloads, I will release an update that will enable automatic detection.&#160; So <a href="http://bit.ly/gamGev" target="_blank">download it now</a> and <a href="http://bit.ly/gwP2BN" target="_blank">spread the word</a>, if you want me to add these features.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/IHmSb0p6JyRjeeSORH4Dj0VDInM/0/da"><img src="http://feedads.g.doubleclick.net/~a/IHmSb0p6JyRjeeSORH4Dj0VDInM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/IHmSb0p6JyRjeeSORH4Dj0VDInM/1/da"><img src="http://feedads.g.doubleclick.net/~a/IHmSb0p6JyRjeeSORH4Dj0VDInM/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EmadIbrahim/~4/byOVkWWDXPg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2011/03/30/dude-where-is-my-update/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.emadibrahim.com/2011/03/30/dude-where-is-my-update/</feedburner:origLink></item>
		<item>
		<title>Donating My Apps Revenue to Japan Tsunami Victims</title>
		<link>http://feedproxy.google.com/~r/EmadIbrahim/~3/oTeQvPl3s6Q/</link>
		<comments>http://www.emadibrahim.com/2011/03/14/donating-my-apps-revenue-to-japan-tsunami-victims/#comments</comments>
		<pubDate>Tue, 15 Mar 2011 03:35:49 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[Random]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/?p=713</guid>
		<description>Update 04/13/2011: Revenue for March Total Donation = $121.27 + $47.30 = $168.57 My friend Bill offered to match my donation, so the total to Red Cross will be $337.14 &amp;#160; I will donate all my March revenue (retroactively) from my Windows Phone 7 apps to the Red Cross to help the victims of Japan&amp;#8217;s [...]</description>
			<content:encoded><![CDATA[<p><strong>Update 04/13/2011: Revenue for March </strong></p>
<blockquote><p><a href="http://www.emadibrahim.com/wp-content/uploads/2011/04/revenue.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="revenue" border="0" alt="revenue" src="http://www.emadibrahim.com/wp-content/uploads/2011/04/revenue_thumb.png" width="391" height="207" /></a></p>
<p>Total Donation = $121.27 + $47.30 = $168.57</p>
<p>My friend Bill offered to match my donation, so the total to Red Cross will be $337.14</p>
</blockquote>
<p>&#160;</p>
<p>I will donate <strong>all my March revenue</strong> (retroactively) from my Windows Phone 7 apps to the <strong>Red Cross</strong> to help the victims of Japan&#8217;s Earthquake and Tsunami.</p>
<p>You can help by buying my apps from your windows phone 7:</p>
<p>Notesly+ &#8211; <a href="http://bit.ly/e6BMx9">http://bit.ly/e6BMx9</a></p>
<p>Envision &#8211; <a href="http://bit.ly/hICMsh">http://bit.ly/hICMsh</a></p>
<p>Picasa Viewer &#8211; <a href="http://bit.ly/picasaviewer">http://bit.ly/picasaviewer</a></p>
<p>Or if you prefer, just donate directly to Red Cross at <a href="http://bit.ly/h57F6u">http://bit.ly/h57F6u</a></p>
<p>Thanks for your support and please <a href="http://bit.ly/hw1qkr">spread the word</a>.</p>
<p><strong><span style="color: #ff0000">I will publish all my revenue&#160; and a receipt of my donation at the end of March right here.</span></strong></p>

<p><a href="http://feedads.g.doubleclick.net/~a/8wxPW8qsk5KnlvwJ-yVubsEKJXM/0/da"><img src="http://feedads.g.doubleclick.net/~a/8wxPW8qsk5KnlvwJ-yVubsEKJXM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/8wxPW8qsk5KnlvwJ-yVubsEKJXM/1/da"><img src="http://feedads.g.doubleclick.net/~a/8wxPW8qsk5KnlvwJ-yVubsEKJXM/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EmadIbrahim/~4/oTeQvPl3s6Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2011/03/14/donating-my-apps-revenue-to-japan-tsunami-victims/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.emadibrahim.com/2011/03/14/donating-my-apps-revenue-to-japan-tsunami-victims/</feedburner:origLink></item>
		<item>
		<title>My Feelings on The Egyptian Revolution</title>
		<link>http://feedproxy.google.com/~r/EmadIbrahim/~3/BiZYqHfyHlg/</link>
		<comments>http://www.emadibrahim.com/2011/02/02/my-feelings-on-the-egyptian-revolution/#comments</comments>
		<pubDate>Wed, 02 Feb 2011 19:17:25 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[Random]]></category>
		<category><![CDATA[egypt]]></category>
		<category><![CDATA[politics]]></category>
		<category><![CDATA[revolution]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/?p=710</guid>
		<description>Wow, what a week in Egypt.  I have been watching the news non-stop.  I have several channels running on my monitor: bbc arabic, cnn english, al-jazeera and al-arabiya.  I watched a little bit of Egyptian state TV but I couldn&amp;#8217;t take the lies any more.  It was pathetic. My emotions and feelings have been all [...]</description>
			<content:encoded><![CDATA[<p>Wow, what a week in Egypt.  I have been watching the news non-stop.  I have several channels running on my monitor: bbc arabic, cnn english, al-jazeera and al-arabiya.  I watched a little bit of Egyptian state TV but I couldn&#8217;t take the lies any more.  It was pathetic.</p>
<p>My emotions and feelings have been all over the place.</p>
<p>1 &#8211; Dismissive &#8211; when I first heard of this, I thought this is just a bunch of kids demonstrating for a few hours then it will be over.</p>
<p>2 &#8211; Pride &#8211; As the demonstrations kept going I felt proud of the protesters.  They are brave and determined.  They are not chanting crazy Islamic chants.  They have legitimate demands.  I have always argued that Egyptians, Iraqis and so on, deserved their leaders.  I always that we are a bunch of yes-man afraid to question authority.  I was wrong and I am happy for it.</p>
<p>3 &#8211; Disgust &#8211; When I heard that prisoners broke out and are terrorizing people and the police withdrew and completely disappeared; I was disgusted.  Disgusted at how far and how low people will go to stay in power.  Forgive my political incorrectness, I hope these people are caught and executed.</p>
<p>4 &#8211; Respect &#8211; Whether Mubarak is telling the truth or not; I definitely respect him from not fleeing.  Here is a man that has billions of dollars (stolen from the people) and can easily say &#8220;screw you guys, I am just going to retire somewhere nice and leave this mess&#8221;.  Instead he is sticking around.  He is not a coward like the Tunisian president.  He even said that he &#8220;lived in Egypt, fought for Egypt and will die in Egypt&#8221;.  Don&#8217;t get me wrong, I want him out but I don&#8217;t think he should just get up and leave.  Egypt is not a tribe of a few thousand people.  Egypt has the 10th largest army in the world and one of the best and most stable economies in the middle east and Africa.  He can&#8217;t just get up and leave.  He did concede to the people&#8217;s demands though &#8211; albeit, too late.</p>
<p>5 &#8211; Anger &#8211; I am angry at the protesters for not accepting his concessions and moving on.  They don&#8217;t realize the economic impact these demonstrations have caused.  They have achieved their goals.  Mubarak is leaving, his son will not be president, he is changing the constitution and he is re-running congressional elections.</p>
<p>6 &#8211; Confused &#8211; I am confused now and don&#8217;t know how to feel.  Is Mubarak a veilin or a hero?  Is he a patriot or a traitor?  Are the protesters progressive?  Are they stubborn?  There is so much information and mis-information out there, it is hard to figure out what&#8217;s going on.</p>
<p>Whatever it is I just hope the outcome will be a secular and democratic Egypt.  Turkey is the only democracy in the Muslim world, I am sure Egypt can be too.  Let&#8217;s just hope the Muslim Brotherhood does not take over, which according to my <a href="http://www.facebook.com/pages/No-to-the-Muslim-Brotherhood-in-Egypt/177932142249015" target="_blank">facebook page</a>, they will not.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/waxkw8mlBm2K2FDb7J9cGy7tiJo/0/da"><img src="http://feedads.g.doubleclick.net/~a/waxkw8mlBm2K2FDb7J9cGy7tiJo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/waxkw8mlBm2K2FDb7J9cGy7tiJo/1/da"><img src="http://feedads.g.doubleclick.net/~a/waxkw8mlBm2K2FDb7J9cGy7tiJo/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EmadIbrahim/~4/BiZYqHfyHlg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2011/02/02/my-feelings-on-the-egyptian-revolution/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.emadibrahim.com/2011/02/02/my-feelings-on-the-egyptian-revolution/</feedburner:origLink></item>
		<item>
		<title>Blogging with WordPress on my windows phone 7</title>
		<link>http://feedproxy.google.com/~r/EmadIbrahim/~3/y7rBR6hCduk/</link>
		<comments>http://www.emadibrahim.com/2011/01/20/blogging-with-wordpress-on-my-windows-phone-7/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 18:06:45 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[Random]]></category>
		<category><![CDATA[wp7]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/2011/01/20/blogging-with-wordpress-on-my-windows-phone-7/</guid>
		<description>Very nice piece of software. I added mu blog easily and can view and moderate comments as well as view stats, add and edit pages, posts and so on. Really nice. Posted from WordPress for Windows Phone</description>
			<content:encoded><![CDATA[<p>                Very nice piece of software.  I added mu blog easily and can view and moderate comments as well as view stats, add and edit pages, posts and so on.  Really nice.</p>
<p>Posted from WordPress for Windows Phone</p>

<p><a href="http://feedads.g.doubleclick.net/~a/nDo8U4Fr5l4hXAOzLpIcUVSmATw/0/da"><img src="http://feedads.g.doubleclick.net/~a/nDo8U4Fr5l4hXAOzLpIcUVSmATw/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/nDo8U4Fr5l4hXAOzLpIcUVSmATw/1/da"><img src="http://feedads.g.doubleclick.net/~a/nDo8U4Fr5l4hXAOzLpIcUVSmATw/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EmadIbrahim/~4/y7rBR6hCduk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2011/01/20/blogging-with-wordpress-on-my-windows-phone-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.emadibrahim.com/2011/01/20/blogging-with-wordpress-on-my-windows-phone-7/</feedburner:origLink></item>
		<item>
		<title>It’s been a week since I ditched my iPhone for Windows Phone 7</title>
		<link>http://feedproxy.google.com/~r/EmadIbrahim/~3/xZvyV0kfBUo/</link>
		<comments>http://www.emadibrahim.com/2010/12/16/its-been-a-week-since-i-ditched-my-iphone-for-windows-phone-7/#comments</comments>
		<pubDate>Thu, 16 Dec 2010 17:01:20 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[wp7]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/2010/12/16/its-been-a-week-since-i-ditched-my-iphone-for-windows-phone-7/</guid>
		<description>Its been a week with my new windows phone 7.&amp;#160; I like it a lot and don&amp;#8217;t miss my iPhone that much. I am actually typing this blog post on my Samsung focus in OneNote. Things I like Keyboard is phenomenal UI is awesome.&amp;#160; Its a crazy world we live in when Microsoft does a [...]</description>
			<content:encoded><![CDATA[<p>Its been a week with my new windows phone 7.&#160; I like it a lot and don&#8217;t miss my iPhone that much.</p>
<p>I am actually typing this blog post on my Samsung focus in OneNote.</p>
<h2>Things I like</h2>
<ol>
<li>Keyboard is phenomenal</li>
<li>UI is awesome.&#160; Its a crazy world we live in when Microsoft does a better job with a UI than Apple.</li>
<li>Very responsive OS</li>
<li>Speech and voice commands are incredibly accurate.&#160; I know the iPhone has that but it just never worked well.</li>
<li>Outlook works very well</li>
</ol>
<h2>Things I don&#8217;t like</h2>
<ol>
<li>The app bar at the bottom of the screen is very easy to accidentally hit while typing.&#160; So in the middle of an email, i hit send accidentally while hitting the space bar.</li>
<li>No copy and paste.&#160; Initially I didn&#8217;t care but then when I started getting emails with information that i wanted to copy and paste. I also tried to duplicate a formula in excel and i couldn&#8217;t copy and paste.&#160; I am not retyping that formula for every row.</li>
<li>Keys are not very well placed.&#160; I accidentally keep hitting the camera button or the soft buttons at the bottom (back, start and search)</li>
<li>The previous problem wouldn&#8217;t be too bad if I had multi tasking, but if I am playing a game or doing something else and I accidentally hit search, I lose my work/game.&#160; It sucks.</li>
<li>I can&#8217;t buy audiobooks in the marketplace</li>
<li>I am missing some apps that are making it hard to forget the iPhone</li>
</ol>
<h2>Apps I need</h2>
<ol>
<li>Remember the milk</li>
<li>Evernote &#8211; if I can import my evernote notes into OneNote then i will be ok,&#160; but i can&#8217;t.&#160; Actually, I created a note taking application for free to fill the void.&#160; It is not as powerful as evernote but I am constantly adding more features as I see fit.&#160; See it here (<a href="http://social.zune.net/redirect?type=phoneApp&amp;id=168b518d-39ed-df11-9264-00237de2db9e" target="_blank">marketplace link</a>).</li>
<li>Audible player</li>
</ol>
<h2>Apps I would like to have</h2>
<ol>
<li>Kindle</li>
<li>tweetdeck</li>
</ol>
<h2>Best of All</h2>
<p>It is ridiculously easy to develop for.&#160; I have done iPhone and Android development and they have a very steep learning curve.&#160; Don’t just take my word for it.&#160; I created 4 apps in less than a month:</p>
<ol>
<li>envision – basecamp client for windows phone 7 – see <a href="http://envisionhq.com">http://envisionhq.com</a></li>
<li>Picasa Viewer – see <a href="http://picasaviewer.com">http://picasaviewer.com</a></li>
<li>Notesly Free – <a href="http://social.zune.net/redirect?type=phoneApp&amp;id=168b518d-39ed-df11-9264-00237de2db9e" target="_blank">marketplace link</a></li>
<li>QuoteZen – 170k quotes with search and bookmarking capabilities – <a href="http://social.zune.net/redirect?type=phoneApp&amp;id=7068dc3b-57f4-df11-9264-00237de2db9e" target="_blank">marketplace link</a></li>
</ol>
<p>You might think that the above statement is very subjective because I have been doing .NET since version zero, but trust me WP7 development is easier than iPhone and Android.&#160; Don’t believe me.&#160; Try it out for yourself – <a href="http://msdn.com">http://msdn.com</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/XUW0bbQDm6o2OMTz23FWzMRgZK0/0/da"><img src="http://feedads.g.doubleclick.net/~a/XUW0bbQDm6o2OMTz23FWzMRgZK0/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/XUW0bbQDm6o2OMTz23FWzMRgZK0/1/da"><img src="http://feedads.g.doubleclick.net/~a/XUW0bbQDm6o2OMTz23FWzMRgZK0/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EmadIbrahim/~4/xZvyV0kfBUo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2010/12/16/its-been-a-week-since-i-ditched-my-iphone-for-windows-phone-7/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.emadibrahim.com/2010/12/16/its-been-a-week-since-i-ditched-my-iphone-for-windows-phone-7/</feedburner:origLink></item>
		<item>
		<title>Blackjack Simulator</title>
		<link>http://feedproxy.google.com/~r/EmadIbrahim/~3/O6JDUq5hR0k/</link>
		<comments>http://www.emadibrahim.com/2010/08/12/blackjack-simulator-2/#comments</comments>
		<pubDate>Thu, 12 Aug 2010 16:24:35 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[Interesting]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[blackjack]]></category>
		<category><![CDATA[gambling]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/2010/08/12/blackjack-simulator-2/</guid>
		<description>What’s a better way to get ready for a gambling trip other than write a blackjack simulator?  I am no blackjack expert but one of the strategies I heard off is to double your bet every time you lose.  So, if I start with a $100 bankroll and play $10 hands then I lost the [...]</description>
			<content:encoded><![CDATA[<p>What’s a better way to get ready for a gambling trip other than write a blackjack simulator?  I am no blackjack expert but one of the strategies I heard off is to double your bet every time you lose.  So, if I start with a $100 bankroll and play $10 hands then I lost the first hand, I am down to $90 and now should bet $20.  If I lose then I am down to $70 and should bet $40 and so on.  If I win then I have $110 and should bet $10.  That is the basic premise of my blackjack simulator.</p>
<h2>Results</h2>
<p>Here is an output of the results after 40 hands for:</p>
<p>player 1 &#8211; <a href="http://pastey.net/139513">http://pastey.net/139513</a></p>
<p>player 2 &#8211; <a href="http://pastey.net/139514">http://pastey.net/139514</a></p>
<p>dealer &#8211; <a href="http://pastey.net/139515">http://pastey.net/139515</a></p>
<p>Here is another run:</p>
<p>player 1 &#8211; <a href="http://pastey.net/139516">http://pastey.net/139516</a></p>
<p>player 2 &#8211; <a href="http://pastey.net/139517">http://pastey.net/139517</a></p>
<p>dealer &#8211; <a href="http://pastey.net/139518">http://pastey.net/139518</a></p>
<h2>Screenshot</h2>
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2010/08/image2.png"><img style="display: inline; border: 0px;" title="image" src="http://www.emadibrahim.com/wp-content/uploads/2010/08/image_thumb2.png" border="0" alt="image" width="424" height="326" /></a></p>
<h2>Disclaimer</h2>
<p>you WILL EVENTUALLY LOSE.  I ran the simulator for a long time and I was <strong><span style="color: #ff0000;">down over $90k</span></strong>.</p>
<h2>Source Code</h2>
<p>You can get the source code for the application here &#8211; <a href="http://github.com/eibrahim/BlackJackSimulator">http://github.com/eibrahim/BlackJackSimulator</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/jyppT2Zg63VlxFlCAJbXkHBzDBw/0/da"><img src="http://feedads.g.doubleclick.net/~a/jyppT2Zg63VlxFlCAJbXkHBzDBw/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/jyppT2Zg63VlxFlCAJbXkHBzDBw/1/da"><img src="http://feedads.g.doubleclick.net/~a/jyppT2Zg63VlxFlCAJbXkHBzDBw/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EmadIbrahim/~4/O6JDUq5hR0k" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2010/08/12/blackjack-simulator-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.emadibrahim.com/2010/08/12/blackjack-simulator-2/</feedburner:origLink></item>
		<item>
		<title>Display a Dictionary/KeyValuePair as Grid in WPF</title>
		<link>http://feedproxy.google.com/~r/EmadIbrahim/~3/rNzY-KB7BeM/</link>
		<comments>http://www.emadibrahim.com/2010/07/30/display-a-dictionarykeyvaluepair-as-grid-in-wpf/#comments</comments>
		<pubDate>Fri, 30 Jul 2010 15:38:23 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/2010/07/30/display-a-dictionarykeyvaluepair-as-grid-in-wpf/</guid>
		<description>Every time I work with WPF, I constantly think “I hate this shit” and “why is everything so damn hard”, but once I figure it out, I realize how powerful it really is and what I can really do with it.&amp;#160; I remember starting out with WPF and trying to figure out how to bind [...]</description>
			<content:encoded><![CDATA[<p>Every time I work with WPF, I constantly think “I hate this shit” and “why is everything so damn hard”, but once I figure it out, I realize how powerful it really is and what I can really do with it.&#160; I remember starting out with WPF and trying to figure out how to bind data to a control took me 2 days of reading several articles and a book.</p>
<p>Anyway, I am currently working on a <a href="http://www.mongodb.org" target="_blank">MongoDb</a> GUI &#8211; there are none out there &#8211; and I decided to build it in WPF.&#160; I am using the MongoDb driver by samus (<a href="http://github.com/samus/mongodb-csharp" target="_blank">link</a>).&#160; Displaying the data returned from a query as a table proved to be a lot harder than I thought.</p>
<p>Remember that the application doesn’t know anything about the domain model, so I can’t use strongly-typed objects.&#160; This is the code to retrieve the list of user objects stored in MongoDb:</p>
</p>
<pre class="csharpcode">var collection = db.GetCollection&lt;Document&gt;(User);
var results = collection.FindAll();</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<div id="codeSnippetWrapper">
  </div>
<p>This will return the results as ICursor&lt;Document&gt;.&#160; Think of Document as the base type for all objects stored in MongoDb.&#160; The actual collection of documents/objects/users is in results.Documents.&#160; A Document implements the ICollection&lt;KeyValuePair&lt;string,object&gt;&gt;, this means that each document is basically a key/value list of all the object properties.&#160; So a user object will be stored like this:</p>
<table border="1" cellspacing="0" cellpadding="2" width="391">
<tbody>
<tr>
<td valign="top" width="170"><strong>Key</strong></td>
<td valign="top" width="219"><strong>Value</strong></td>
</tr>
<tr>
<td valign="top" width="170">FirstName</td>
<td valign="top" width="219">John</td>
</tr>
<tr>
<td valign="top" width="170">LastName</td>
<td valign="top" width="219">Smith</td>
</tr>
<tr>
<td valign="top" width="170">CreatedOn</td>
<td valign="top" width="219">2010-07-20T05:39:35.5220000Z</td>
</tr>
<tr>
<td valign="top" width="170">Account</td>
<td valign="top" width="219">{ &quot;SubscriptionType&quot;: &quot;paid&quot;, &quot;CreatedOn&quot;: &quot;2010-07-20T05:39:35.5220000Z&quot;, &quot;ModifiedOn&quot;: &quot;2010-07-20T05:39:35.5220000Z&quot; }</td>
</tr>
</tbody>
</table>
<p>What I want to do is to take this list of documents and display as a grid.&#160; I want it to look something like this:</p>
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2010/07/image1.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.emadibrahim.com/wp-content/uploads/2010/07/image_thumb1.png" width="481" height="167" /></a> </p>
<p>I am no WPF expert but after Googling and reading tons of articles for hours, here is the solution I came up with.&#160; If you know a better one, please let me know.</p>
<p>Here is the XAML for the ListView</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">ListView</span> <span class="attr">Name</span><span class="kwrd">=&quot;lvItems&quot;</span>  <span class="attr">Margin</span><span class="kwrd">=&quot;12,12,9,12&quot;</span>        <span class="attr">IsSynchronizedWithCurrentItem</span><span class="kwrd">=&quot;True&quot;</span> <span class="attr">Grid</span>.<span class="attr">Column</span><span class="kwrd">=&quot;1&quot;</span>        <span class="attr">ItemsSource</span><span class="kwrd">=&quot;{Binding}&quot;</span> <span class="kwrd">&gt;</span></pre>
<p><span class="kwrd">&lt;/</span><span class="html">ListView</span><span class="kwrd">&gt;</span><br />
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<div id="codeSnippetWrapper">
  </div>
<p>The first thing I need to do is define the grid columns:</p>
<pre class="csharpcode"><span class="kwrd">private</span> <span class="kwrd">static</span> GridView CreateGridViewColumns(Document doc)
{
    <span class="rem">// Create the GridView</span>
    GridView gv = <span class="kwrd">new</span> GridView();
    gv.AllowsColumnReorder = <span class="kwrd">true</span>;

    <span class="kwrd">if</span>(doc ==<span class="kwrd">null</span>) <span class="kwrd">return</span> gv; <span class="rem">//return empty grid if null</span>

    <span class="rem">// Create the GridView Columns)</span>
    <span class="kwrd">foreach</span> (var item <span class="kwrd">in</span> doc.Keys)
    {
        var gvc = <span class="kwrd">new</span> GridViewColumn();
        gvc.Header = item;
        gvc.Width = Double.NaN;
        gvc.CellTemplateSelector = <span class="kwrd">new</span> CustomRowDataTemplateSelector();
        gv.Columns.Add(gvc);
    }

    <span class="kwrd">return</span> gv;
}</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<div>
  </div>
<p>I use the returned GridView to set the ListView’s Grid </p>
</p>
<pre class="csharpcode">var gridView = CreateGridViewColumns(results.Documents.FirstOrDefault());
lvItems.View = gridView;</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<div id="codeSnippetWrapper">
  </div>
<p>So that takes care of setting up the grid column header.&#160; Now, I need to bind the data.&#160; I want to treat each document as a “Row”, so I create a custom class called CustomRow.&#160; Some of the stuff in there won’t make sense right now, but bear with me.</p>
<pre class="csharpcode"><span class="kwrd">internal</span> <span class="kwrd">class</span> CustomRow
{
    <span class="kwrd">private</span> <span class="kwrd">int</span> index = 0;
    <span class="kwrd">private</span> ArrayList _list;

    <span class="kwrd">public</span> CustomRow()
    {
        _list = <span class="kwrd">new</span> ArrayList();
    }

    <span class="kwrd">public</span> <span class="kwrd">object</span> Value
    {
        get
        {
            <span class="kwrd">if</span> (index &lt; 0) index = 0;
            <span class="kwrd">if</span> (index &gt;= _list.Count) index = 0; <span class="rem">//wrap around and start from beginning</span>

            <span class="kwrd">return</span> _list[index++];
        }
    }

    <span class="kwrd">public</span> <span class="kwrd">object</span> Current
    {
        get
        {
            <span class="kwrd">if</span> (index &lt; 0) index = 0;
            <span class="kwrd">if</span> (index &gt;= _list.Count) index = 0; <span class="rem">//wrap around and start from beginning</span>
            <span class="kwrd">return</span> _list[index];
        }
    }

    <span class="kwrd">public</span> <span class="kwrd">void</span> Add(<span class="kwrd">object</span> item)
    {
        _list.Add(item);
    }
}</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<div id="codeSnippetWrapper">
  </div>
<p>&#160;</p>
<p>Now, all I have to do is convert each document to CustomRow:</p>
<pre class="csharpcode"><span class="kwrd">private</span> <span class="kwrd">object</span> ConvertToRows(IEnumerable&lt;Document&gt; documents)
{
    var results = <span class="kwrd">new</span> List&lt;CustomRow&gt;();

    <span class="kwrd">foreach</span> (var document <span class="kwrd">in</span> documents)
    {
        var row = <span class="kwrd">new</span> CustomRow();
        <span class="kwrd">foreach</span> (var field <span class="kwrd">in</span> document)
        {
            row.Add(field.Value);
        }
        results.Add(row);
    }
    <span class="kwrd">return</span> results;
}</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<div id="codeSnippetWrapper">
  </div>
<p>This is the full code used to setup the ListView:</p>
<pre class="csharpcode">lvItems.View = CreateGridViewColumns(results.Documents.FirstOrDefault());
lvItems.DataContext = ConvertToRows(results.Documents);</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<div id="codeSnippetWrapper">
  </div>
<p>Did you notice the line with the CellTemplateSelector in the CreateGridViewColumns method above?&#160; Well, I wanted my cells to display differently based on whether they are displaying string, date, an embedded object/document or a list of other documents.&#160; So, I created a custom CellTemplateSelector:</p>
<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> CustomRowDataTemplateSelector : DataTemplateSelector
{
    <span class="kwrd">public</span> <span class="kwrd">override</span> DataTemplate
        SelectTemplate(<span class="kwrd">object</span> item, DependencyObject container)
    {
        FrameworkElement element = container <span class="kwrd">as</span> FrameworkElement;

        <span class="kwrd">if</span> (element != <span class="kwrd">null</span> &amp;&amp; item != <span class="kwrd">null</span>)
        {
            var row = item <span class="kwrd">as</span> CustomRow;
            <span class="kwrd">if</span> (row != <span class="kwrd">null</span>)
            {
                var cell = row.Current;

                <span class="rem">//set template based on cell type</span>
                <span class="kwrd">if</span> (cell <span class="kwrd">is</span> Document)
                {
                    <span class="kwrd">return</span> element.FindResource(<span class="str">&quot;documentCell&quot;</span>) <span class="kwrd">as</span> DataTemplate;
                }
                <span class="kwrd">if</span> (cell <span class="kwrd">is</span> IList)
                {
                    <span class="kwrd">return</span> element.FindResource(<span class="str">&quot;listCell&quot;</span>) <span class="kwrd">as</span> DataTemplate;
                }

                <span class="kwrd">if</span> (cell <span class="kwrd">is</span> DateTime)
                {
                    <span class="kwrd">return</span> element.FindResource(<span class="str">&quot;dateCell&quot;</span>) <span class="kwrd">as</span> DataTemplate;
                }

                <span class="kwrd">if</span> (cell <span class="kwrd">is</span> Oid)
                    <span class="kwrd">return</span> element.FindResource(<span class="str">&quot;idCell&quot;</span>) <span class="kwrd">as</span> DataTemplate;
                <span class="kwrd">return</span> element.FindResource(<span class="str">&quot;stringCell&quot;</span>) <span class="kwrd">as</span> DataTemplate;
            }

        }

        <span class="kwrd">return</span> <span class="kwrd">null</span>;
    }
}</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<div id="codeSnippetWrapper">
  </div>
<p>Basically, I am returning a different DataTemplate based on the object stored in the cell.&#160; As an example, here is dateCell template defined in the App.xaml file.</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">DataTemplate</span> <span class="attr">x:Key</span><span class="kwrd">=&quot;dateCell&quot;</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">StackPanel</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">TextBlock</span> <span class="attr">Style</span><span class="kwrd">=&quot;{StaticResource cellStyle}&quot;</span>
                    <span class="attr">Grid</span>.<span class="attr">Row</span><span class="kwrd">=&quot;0&quot;</span> <span class="attr">Grid</span>.<span class="attr">Column</span><span class="kwrd">=&quot;0&quot;</span>
                    <span class="attr">Text</span><span class="kwrd">=&quot;{Binding Path=Value, Converter={StaticResource cellConverter}}&quot;</span> <span class="kwrd">/&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">StackPanel</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">DataTemplate</span><span class="kwrd">&gt;</span></pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<div id="codeSnippetWrapper">
  </div>
<p>This is simply a TextBlock that is bound to the Value property of the CustomRow class (will explain later).&#160; The cellConverter is custom logic that will convert the value of the cell accordingly.&#160; For example, date is converted to short date, an embedded object is simply converted to an “(object)” string as shown above.&#160; Here is my converter (ConvertBack hasn’t been implemented yet):</p>
<pre class="csharpcode"><span class="kwrd">public</span> <span class="kwrd">class</span> CellConverter : IValueConverter
{
    <span class="kwrd">public</span> <span class="kwrd">object</span> Convert(<span class="kwrd">object</span> <span class="kwrd">value</span>, Type targetType, <span class="kwrd">object</span> parameter, CultureInfo culture)
    {
        <span class="kwrd">if</span> (<span class="kwrd">value</span> == <span class="kwrd">null</span>)
            <span class="kwrd">return</span> <span class="str">&quot;(null)&quot;</span>;
        <span class="kwrd">if</span> (<span class="kwrd">value</span> <span class="kwrd">is</span> Document)
            <span class="kwrd">return</span> <span class="str">&quot;(object)&quot;</span>;
        <span class="kwrd">if</span> (<span class="kwrd">value</span> <span class="kwrd">is</span> DateTime)
            <span class="kwrd">return</span> ((DateTime)<span class="kwrd">value</span>).ToShortDateString();
        <span class="kwrd">if</span> (<span class="kwrd">value</span> <span class="kwrd">is</span> IList)
            <span class="kwrd">return</span> <span class="str">&quot;(list)&quot;</span>;

        <span class="kwrd">return</span> <span class="kwrd">value</span>;
    }

    <span class="kwrd">public</span> <span class="kwrd">object</span> ConvertBack(<span class="kwrd">object</span> <span class="kwrd">value</span>, Type targetType, <span class="kwrd">object</span> parameter, CultureInfo culture)
    {
        <span class="kwrd">throw</span> <span class="kwrd">new</span> NotImplementedException();
    }
}</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<div id="codeSnippetWrapper">
  </div>
<h2>Explanations</h2>
<p>At first, I tried to just bind directly to the list of values in each document.&#160; The problem with that the DataTempalte only display the first item in the collection.&#160; So my grid looks exactly like above but all the cells were set to the value of Id.&#160; That is why I created the CustomRow class and that is why the Value property increments the indexer.&#160; This way everytime I pull out the value for a cell, I increment the indexer so that the next bound cell will get the next value and so on.&#160; </p>
<p>Again, I don’t know if this is the best solution, so if you do know of a better one then please let me know in the comments.&#160; It will help all my readers.&#160; Thanks in advance.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/7L6N2mbUmDC63gU3FapMbEkxnVI/0/da"><img src="http://feedads.g.doubleclick.net/~a/7L6N2mbUmDC63gU3FapMbEkxnVI/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/7L6N2mbUmDC63gU3FapMbEkxnVI/1/da"><img src="http://feedads.g.doubleclick.net/~a/7L6N2mbUmDC63gU3FapMbEkxnVI/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EmadIbrahim/~4/rNzY-KB7BeM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2010/07/30/display-a-dictionarykeyvaluepair-as-grid-in-wpf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.emadibrahim.com/2010/07/30/display-a-dictionarykeyvaluepair-as-grid-in-wpf/</feedburner:origLink></item>
		<item>
		<title>Subversion (SVN) to Mercurial and TeamCity</title>
		<link>http://feedproxy.google.com/~r/EmadIbrahim/~3/2MzLGkE1smw/</link>
		<comments>http://www.emadibrahim.com/2010/05/03/subversion-svn-to-mercurial-and-teamcity/#comments</comments>
		<pubDate>Mon, 03 May 2010 12:27:00 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[mercurial]]></category>
		<category><![CDATA[scm]]></category>
		<category><![CDATA[source control]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[teamcity]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/2010/05/03/subversion-svn-to-mercurial-and-teamcity/</guid>
		<description>Every time I think I got all the tools I need and I have a killer setup, something comes along that makes me question it all.&amp;#160; I am referring to mercurial.&amp;#160; For some reason, I have just heard of mercurial from TekPub.&amp;#160; I don&amp;#8217;t know why I never heard of it before.&amp;#160; Probably because I [...]</description>
			<content:encoded><![CDATA[<p>Every time I think I got all the tools I need and I have a killer setup, something comes along that makes me question it all.&#160; I am referring to mercurial.&#160; For some reason, I have just heard of mercurial from <a href="http://www.tekpub.com" target="_blank">TekPub</a>.&#160; I don&#8217;t know why I never heard of it before.&#160; Probably because I wasn&#8217;t looking to replace subversion as my trusted source control.</p>
<p>I like the subversion and it does the job for me, but after watching tekpub&#8217;s videos, I instantly realized the power of mercurial and why I must have it.&#160; So I went ahead and converted my source control for <a href="http://dartfiles.com" target="_blank">dartfiles</a> to Hg (hg is the chemical symbol for mercury in the periodic table). I was actually surprised by how easy the move went.</p>
<p>Here is what I did:     </p>
<ol>
<li>Downloaded and installed <a href="http://tortoisehg.bitbucket.org/" target="_blank">TortoiseHg</a> </li>
<li>Exported my subversion project to a new folder&#160;
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.emadibrahim.com/wp-content/uploads/2010/05/image.png" width="478" height="311" />       </li>
<li>Created a Mercurial repository at the new folder where I exported the code in step 2
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2010/05/image1.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.emadibrahim.com/wp-content/uploads/2010/05/image_thumb.png" width="497" height="224" /></a>       <br /><a href="http://www.emadibrahim.com/wp-content/uploads/2010/05/image2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.emadibrahim.com/wp-content/uploads/2010/05/image_thumb1.png" width="452" height="174" /></a>       </li>
<li>Edited the ignore file (.hgignore) in notepad and added the following (which I found somewhere on stackoverflow)      </li>
<pre class="csharpcode"><span class="rem"># Ignore file for Visual Studio 2008</span>

<span class="rem"># use glob syntax</span>
syntax: glob

<span class="rem"># Ignore Visual Studio 2008 files</span>
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
*.lib
*.sbr
*.scc
[Bb]<span class="kwrd">in</span>
[Db]ebug*/
obj/
[Rr]elease*/
_ReSharper*/
[Tt]est[Rr]esult*
[Bb]uild[Ll]og.*
*.[Pp]ublish.xml</pre>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
<li>Committed the repository
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2010/05/image3.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.emadibrahim.com/wp-content/uploads/2010/05/image_thumb2.png" width="244" height="156" /></a> </p>
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2010/05/image4.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.emadibrahim.com/wp-content/uploads/2010/05/image_thumb3.png" width="398" height="288" /></a> </li>
</ol>
<p>That’s all I had to do to setup mercurial.&#160; </p>
<p>You are probably wondering – where is the source control server and where are you committing too.&#160; This is the part that is different than what I have been used to with subversion.&#160; Obviously if you are using git or similar distributed SCM then you are familiar with this concept.&#160; Mercurial stores all your source code changes and tracking locally right in your folder inside a .hg subfolder (similar to .svn folders but not exactly).&#160; When you commit you are just committing to your local repository.&#160; This is pretty cool because it lets you commit locally, roll back to a different time, branch and do all kind of cool things without having to deal with a server.&#160; </p>
<p>Imagine you are working on feature 1 then you get an email for an urgent bug (lets’ call it bug 2).&#160; You can’t really work on it because feature 1 is not complete and the code won’t compile and things could get messy.&#160; You want to fix the bug but you don’t want to lose all the work you put into feature 1 and you are note ready to deploy.&#160; With mercurial, it’s pretty easy to handle this situation.&#160; Simply go back to a point in your history before you started working on feature 1, create a new branch for bug 2, fix it then commit and push it, you can then deploy this version and then come back and merge the bug 2 branch with your feature 1 branch and continue working on feature 1.&#160; </p>
<p>I probably didn’t do a good job explaining this scenario but hopefully you will at least get an idea of what I am talking about.&#160; If not then head over to <a href="http://mercurial.selenic.com/">http://mercurial.selenic.com/</a> and take a look at their great documentation.</p>
<h2>Remote Repository</h2>
<p>In most cases, you will want to setup a remote repository so you can “push” code to it.&#160; “Pushing” is another concept that was new to me.&#160; Basically, you commit locally and you push remotely (or centrally).&#160; This gives you the flexibility to commit all day long every time you make a change and only when the code is ready and stable you “push” it to the remote repository where other developers can get to it.&#160; I setup my remote repository at bitbucket &#8211; <a href="http://bitbucket.org/">http://bitbucket.org/</a> – they have a free account and some very reasonable pricing.&#160; If you are working on open source/public code, you can always use Google code or codeplex; they both support mercurial.</p>
<p>Here are the steps</p>
<ol>
<li>Created an account at bitbucket.</li>
<li>Setup TortoiseHg to talk with the remote repository (right-click &gt; TortoiseHg &gt; Repository Settings)
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2010/05/image5.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.emadibrahim.com/wp-content/uploads/2010/05/image_thumb4.png" width="477" height="416" /></a></p>
<p> </li>
<li>Pushed my code to the remote server</li>
</ol>
<h2><strong>TeamCity Integration</strong></h2>
<p>I use TeamCity as my build server (<a href="http://www.emadibrahim.com/2009/08/05/startup-asp-net-mvc-cloud-scale-deployment/" target="_blank">blog post</a>).&#160; Once everything was working nicely, I had to get TeamCity to work with the new SCM.&#160; This was pretty easy as well.&#160; I basically removed my old SVN root from my TeamCity project and added a new root to point to mercurial</p>
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2010/05/image6.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.emadibrahim.com/wp-content/uploads/2010/05/image_thumb5.png" width="561" height="552" /></a> </p>
<p>To make this work, you have to install mercurial on the server.&#160; Get it from <a title="http://mercurial.selenic.com/downloads/" href="http://mercurial.selenic.com/downloads/">http://mercurial.selenic.com/downloads/</a></p>
<p>Initially, I had a problem with the HG command path and it was giving me some weird error like failed to create process or something like that (I can’t remember).&#160; It turned out the problem was that TeamCity couldn’t deal with spaces in the path.&#160; The install location was “c:\Program Files (x86)\hg” so I just moved it to c:\hg and everything worked.</p>
<p>Once everything was working well and after working for a few hours, doing a few commits and one deployment, I realized the power of mercurial.&#160; Just take a look at my repository history and you might grasp the awesomeness that is mercurial.</p>
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2010/05/image7.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.emadibrahim.com/wp-content/uploads/2010/05/image_thumb6.png" width="655" height="486" /></a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/-31xkmmf-Ca4rXUX9DtQdnJiuSU/0/da"><img src="http://feedads.g.doubleclick.net/~a/-31xkmmf-Ca4rXUX9DtQdnJiuSU/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/-31xkmmf-Ca4rXUX9DtQdnJiuSU/1/da"><img src="http://feedads.g.doubleclick.net/~a/-31xkmmf-Ca4rXUX9DtQdnJiuSU/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EmadIbrahim/~4/2MzLGkE1smw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2010/05/03/subversion-svn-to-mercurial-and-teamcity/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.emadibrahim.com/2010/05/03/subversion-svn-to-mercurial-and-teamcity/</feedburner:origLink></item>
		<item>
		<title>Serialize Object To Clean XML</title>
		<link>http://feedproxy.google.com/~r/EmadIbrahim/~3/6_m4sF59tp0/</link>
		<comments>http://www.emadibrahim.com/2010/02/23/serialize-object-to-clean-xml/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 00:08:12 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/2010/02/23/serialize-object-to-clean-xml/</guid>
		<description>I hate all the junk that gets added when serializing object to XML, so here is a quick way to do it cleanly. Here is the dirty way: public static string Serialize(this object obj) { string XmlString = String.Empty; using (var memStream = new MemoryStream()) { var serializer = new XmlSerializer(obj.GetType(), string.Empty); using (var xmlText [...]</description>
			<content:encoded><![CDATA[<p>I hate all the junk that gets added when serializing object to XML, so here is a quick way to do it cleanly.</p>
<p>Here is the dirty way:</p>
<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">string</span> Serialize(<span style="color: #0000ff">this</span> <span style="color: #0000ff">object</span> obj)
{
    <span style="color: #0000ff">string</span> XmlString = String.Empty;
    <span style="color: #0000ff">using</span> (var memStream = <span style="color: #0000ff">new</span> MemoryStream())
    {
        var serializer = <span style="color: #0000ff">new</span> XmlSerializer(obj.GetType(), <span style="color: #0000ff">string</span>.Empty);
        <span style="color: #0000ff">using</span> (var xmlText = <span style="color: #0000ff">new</span> XmlTextWriter(memStream, Encoding.Default))
        {
            serializer.Serialize(xmlText, obj);
        }
        XmlString = Encoding.Default.GetString(memStream.ToArray());
        memStream.Close();
    }
    <span style="color: #0000ff">return</span> XmlString;
}</pre>
</div>
<p>The resulting XML looks like this:</p>
<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&lt;?xml version=<span style="color: #006080">&quot;1.0&quot;</span> encoding=<span style="color: #006080">&quot;Windows-1252&quot;</span>?&gt;
&lt;ZipContentInfo xmlns:xsi=<span style="color: #006080">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span> xmlns:xsd=<span style="color: #006080">&quot;http://www.w3.org/2001/XMLSchema&quot;</span>&gt;
    &lt;FileName&gt;00107_tokyoatnight_1680x1050.jpg&lt;/FileName&gt;
    &lt;FileSize&gt;281268&lt;/FileSize&gt;
&lt;/ZipContentInfo&gt;</pre>
</div>
<p>Here is a cleaner way:</p>
<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">string</span> Serialize(<span style="color: #0000ff">this</span> <span style="color: #0000ff">object</span> obj)
{
    var ser = <span style="color: #0000ff">new</span> XmlSerializer(obj.GetType());
    <span style="color: #0000ff">using</span> (var tw = <span style="color: #0000ff">new</span> StringWriter())
    {
        <span style="color: #0000ff">using</span> (var xw = XmlWriter.Create(tw, <span style="color: #0000ff">new</span> XmlWriterSettings() { OmitXmlDeclaration = <span style="color: #0000ff">true</span> }))
        {
            var ns = <span style="color: #0000ff">new</span> XmlSerializerNamespaces();
            <span style="color: #008000">//Add an empty namespace and empty value</span>
            ns.Add(<span style="color: #006080">&quot;&quot;</span>, <span style="color: #006080">&quot;&quot;</span>);
            ser.Serialize(xw, obj, ns);
            <span style="color: #0000ff">return</span> tw.ToString();
        }
    }
}</pre>
</div>
<p>And the resulting XML looks like this:</p>
<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">&lt;ZipContentInfo&gt;
    &lt;FileName&gt;00107_tokyoatnight_1680x1050.jpg&lt;/FileName&gt;
    &lt;FileSize&gt;281268&lt;/FileSize&gt;
&lt;/ZipContentInfo&gt;</pre>
</div>

<p><a href="http://feedads.g.doubleclick.net/~a/o9Q0wlj8ELyINwTgYNIuu8gVypQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/o9Q0wlj8ELyINwTgYNIuu8gVypQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/o9Q0wlj8ELyINwTgYNIuu8gVypQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/o9Q0wlj8ELyINwTgYNIuu8gVypQ/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EmadIbrahim/~4/6_m4sF59tp0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2010/02/23/serialize-object-to-clean-xml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.emadibrahim.com/2010/02/23/serialize-object-to-clean-xml/</feedburner:origLink></item>
		<item>
		<title>Select Random Records Using Nhibernate</title>
		<link>http://feedproxy.google.com/~r/EmadIbrahim/~3/WdLU2Ga4nLQ/</link>
		<comments>http://www.emadibrahim.com/2009/12/16/select-random-records-using-nhibernate/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 03:54:15 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[nhibernate]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/2009/12/16/select-random-records-using-nhibernate/</guid>
		<description>Selecting 5 random rows in SQL is easy select top 5 * from users order by newid() .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode [...]</description>
			<content:encoded><![CDATA[<p>Selecting 5 random rows in SQL is easy</p>
</p>
<pre class="csharpcode"><span class="kwrd">select</span> <span class="kwrd">top</span> 5 * <span class="kwrd">from</span> users <span class="kwrd">order</span> <span class="kwrd">by</span> newid()</pre>
<p>
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
</p>
<p>Nhibernate is a different story.&#160; I am new to NHibernate and I both love and hate it.&#160; I hate the steep learning curve and the unobvious ways of doing things.&#160; Anyway, here is how to select 5 random records using nhibernate.</p>
<p>First class a new order class to perform random ordering:</p>
<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> RandomOrder : Order
{
    <span style="color: #0000ff">public</span> RandomOrder() : <span style="color: #0000ff">base</span>(<span style="color: #006080">&quot;&quot;</span>, <span style="color: #0000ff">true</span>) { }
    <span style="color: #0000ff">public</span> <span style="color: #0000ff">override</span> SqlString ToSqlString(ICriteria criteria, ICriteriaQuery criteriaQuery)
    {
        <span style="color: #0000ff">return</span> <span style="color: #0000ff">new</span> SqlString(<span style="color: #006080">&quot;newid()&quot;</span>);
    }
}</pre>
</div>
<p>Then use the new class in your query:</p>
<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">IList&lt;User&gt; users = session
    .CreateCriteria(<span style="color: #0000ff">typeof</span>(User))
    .AddOrder(<span style="color: #0000ff">new</span> RandomOrder())
    .SetMaxResults(5)
    .List&lt;User&gt;();</pre>
</div>
<p>Done…</p>

<p><a href="http://feedads.g.doubleclick.net/~a/FpteTid-k54Oe4WQGK7al9TjVUQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/FpteTid-k54Oe4WQGK7al9TjVUQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/FpteTid-k54Oe4WQGK7al9TjVUQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/FpteTid-k54Oe4WQGK7al9TjVUQ/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EmadIbrahim/~4/WdLU2Ga4nLQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2009/12/16/select-random-records-using-nhibernate/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		<feedburner:origLink>http://www.emadibrahim.com/2009/12/16/select-random-records-using-nhibernate/</feedburner:origLink></item>
		<item>
		<title>ASP.NET MVC &amp; TDD Free Book Chapter</title>
		<link>http://feedproxy.google.com/~r/EmadIbrahim/~3/VyuBxWMtA8I/</link>
		<comments>http://www.emadibrahim.com/2009/08/18/asp-net-mvc-tdd-free-book-chapter/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 03:47:08 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[Random]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/?p=650</guid>
		<description>I can’t believe that I actually finished my book &amp;#8211; ASP.NET MVC 1.0 Test Driven Development Problem &amp;#8211; Design &amp;#8211; Solution.&amp;#160; Whew!!!&amp;#160; It’s a lot of freaking work writing a book and I don’t know how others can crank out a book or more a year…&amp;#160; Nonetheless, I am very excited about the book and [...]</description>
			<content:encoded><![CDATA[<p>I can’t believe that I actually finished my book &#8211; <a href="http://bit.ly/1i5ede" target="_blank">ASP.NET MVC 1.0 Test Driven Development Problem &#8211; Design &#8211; Solution</a>.&#160; Whew!!!&#160; It’s a lot of freaking work writing a book and I don’t know how others can crank out a book or more a year…&#160; </p>
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2009/08/51y43nUfxkL._SS500_.jpg"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="51y43nUfxkL._SS500_" border="0" alt="51y43nUfxkL._SS500_" src="http://www.emadibrahim.com/wp-content/uploads/2009/08/51y43nUfxkL._SS500__thumb.jpg" width="244" height="244" /></a> </p>
<p>Nonetheless, I am very excited about the book and I hope you guys like it too and learn something from it.&#160; Of course, reviews on <a href="http://bit.ly/1i5ede">amazon.com</a> would be appreciated &#8211; specially positive ones :-)</p>
<p>Thanks to <a href="http://bit.ly/XOwGg" target="_blank">Wrox</a>, here is a free chapter – <a href="http://bit.ly/1aInOp">download it here</a>.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/FQpWqSBztB8UnA2e98cCsFeT8mY/0/da"><img src="http://feedads.g.doubleclick.net/~a/FQpWqSBztB8UnA2e98cCsFeT8mY/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/FQpWqSBztB8UnA2e98cCsFeT8mY/1/da"><img src="http://feedads.g.doubleclick.net/~a/FQpWqSBztB8UnA2e98cCsFeT8mY/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EmadIbrahim/~4/VyuBxWMtA8I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2009/08/18/asp-net-mvc-tdd-free-book-chapter/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		<feedburner:origLink>http://www.emadibrahim.com/2009/08/18/asp-net-mvc-tdd-free-book-chapter/</feedburner:origLink></item>
		<item>
		<title>Startup – ASP.NET MVC, Cloud Scale &amp; Deployment</title>
		<link>http://feedproxy.google.com/~r/EmadIbrahim/~3/FJdtoT5Yby8/</link>
		<comments>http://www.emadibrahim.com/2009/08/05/startup-asp-net-mvc-cloud-scale-deployment/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 14:47:00 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[Startup]]></category>
		<category><![CDATA[aws]]></category>
		<category><![CDATA[cloud computing]]></category>
		<category><![CDATA[deployment]]></category>
		<category><![CDATA[gogrid]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[nant]]></category>
		<category><![CDATA[Yonkly]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/2009/08/05/startup-asp-net-mvc-cloud-scale-deployment/</guid>
		<description>This is a second post in my startup series (first one).&amp;#160; Warning, this one is a lot more technical than my first one. If you have been following my blog, my company or my twitter page then you probably know that my startup – yonkly – was built with ASP.NET MVC.&amp;#160; In this post, I [...]</description>
			<content:encoded><![CDATA[<p>This is a second post in my startup series (<a href="http://www.emadibrahim.com/?p=617">first one</a>).&#160; Warning, this one is a lot more technical than my first one.</p>
<p>If you have been following my blog, my company or my <a href="http://twitter.com/eibrahim" target="_blank">twitter</a> page then you probably know that my startup – <a href="http://yonkly.com" target="_blank">yonkly</a> – was built with <a href="http://asp.net/mvc">ASP.NET MVC</a>.&#160; In this post, I will talk about how I scale deploy Yonkly very easily.</p>
<h2>Hosting</h2>
<p>Initially, I had it hosted on <a href="http://aws.amazon.com/" target="_blank">Amazon Web Services</a> inside EC2 instance.&#160; That didn’t work too well for a few reasons:</p>
<ul>
<li>EC2 only supports windows 2003</li>
<li>A separate instance is needed for load balancing (extra cost)</li>
<li>The database instance is very costly</li>
<li>Databases tend to run slow on virtual machines</li>
</ul>
<p>While looking for alternatives to AWS, I joined Microsoft <a href="http://www.microsoft.com/bizspark/" target="_blank">BizSpark</a> (a program that provides software,&#160; support and visibility for software startups).&#160; The greatest benefit of the program is the use of pretty much all Microsoft products for 3 years for free.&#160; Imagine all the SQL and Windows licenses that you need to scale your website – all for free.&#160; Another great benefit is that Microsoft partnered with hosting companies for even more discounts.</p>
<p>The next step is to find a hosting company.&#160; I went with <a href="http://www.servepath.com/" target="_blank">ServePath</a>/<a href="http://www.gogrid.com" target="_blank">GoGrid</a>.&#160; They offer the best combination in price, scalability and flexibility.&#160; I got a dedicated server for SQL Server and created virtual machines for the front end in GoGrid.&#160; Since both services are by the same company, the virtual machine has a super fast connection to the dedicated server.&#160; The cool thing about GoGrid is that it includes a free load balancer.&#160; So my setup looks something like this:</p>
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2009/08/image.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.emadibrahim.com/wp-content/uploads/2009/08/image_thumb.png" width="503" height="536" /></a> </p>
<p>The blue machines are virtual/cloud machines running in GoGrid and the database server is a dedicated/physical server. </p>
<p><strong>Web Servers</strong>: Windows 2008, IIS, ASP.NET MVC</p>
<p><strong>Build Server</strong>: Windows 2008, <a href="http://www.jetbrains.com/teamcity/" target="_blank">TeamCity</a></p>
<p><strong>Database Server</strong>: Windows 2008, SQL Server 2008</p>
<p>The beauty of all this is that I can add X more servers and scale within minutes.&#160; Eventually, the db server will be the bottleneck and I would have to cluster it, but let’s not get ahead of ourselves here.</p>
<h2>Management &amp; Deployment</h2>
<p>You are probably wondering.&#160; How do you manage all these machines?&#160; How long does it take you to deploy a new version?&#160; The answers are “easy” and “less than a minute”</p>
<p>I started off using <a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET" target="_blank">CruiseControl.NET</a> (CCNET) to manage my build and deployment but eventually changed to TeamCity.&#160;&#160; I like CCNET and the fact that is written in .NET and runs in IIS is very comforting to me.&#160; On the other hand TeamCity is way more capable, has a better interface and was way too easy to setup.&#160; On the flip side, TeamCity is written in Java and runs in Tomcat.&#160; This is a very simplified list of benefits, for more info check their homepage and look at the <a href="http://www.jetbrains.com/teamcity/features/screenshots.html" target="_blank">screen tour</a>.&#160; The best part, both products are free and CCNET is open source.</p>
<p>Once I got TeamCity up and running, I created 2 projects one called “Yonkly Build” and the other “Yonkly Deploy”.</p>
<p>The Yonkly Build project:</p>
<ul>
<li>monitors the source control repository (SVN)</li>
<li>checks out changes</li>
<li>builds the code</li>
</ul>
<p>The Yonkly Deploy project copies the changed files using Robocopy to every web server using a <a href="http://nant.sourceforge.net/" target="_blank">NANT</a> script.&#160; The NANT build file looks like this:</p>
<div style="border-bottom: gray 1px solid; border-left: gray 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">&lt;?</span><span style="color: #800000">xml</span> <span style="color: #ff0000">version</span><span style="color: #0000ff">=&quot;1.0&quot;</span>?<span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">&lt;</span><span style="color: #800000">project</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;yonkly&quot;</span> <span style="color: #ff0000">default</span><span style="color: #0000ff">=&quot;deploy files&quot;</span><span style="color: #0000ff">&gt;</span>
    <span style="color: #0000ff">&lt;</span><span style="color: #800000">target</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;deploy files&quot;</span><span style="color: #0000ff">&gt;</span>
       <span style="color: #0000ff">&lt;</span><span style="color: #800000">exec</span>
         <span style="color: #ff0000">program</span><span style="color: #0000ff">=&quot;robocopy.exe&quot;</span>
         <span style="color: #ff0000">commandline</span><span style="color: #0000ff">=&quot;c:\dev\yonkly20\yonkly20\ c:\websites\yonkly20 *.* /E /XA:H /COPY:DT /XO /XD .svn logs obj aspnet_client app_data properties controllers helpers models /NDL /NC /NS /NP /XF *.cs *.csproj *.config  *.pdb&quot;</span>
         <span style="color: #ff0000">timeout</span><span style="color: #0000ff">=&quot;120000&quot;</span>
         <span style="color: #ff0000">failonerror</span><span style="color: #0000ff">=&quot;false&quot;</span>
         <span style="color: #ff0000">resultproperty</span><span style="color: #0000ff">=&quot;nunitReturnCode&quot;</span><span style="color: #0000ff">&gt;</span>
       <span style="color: #0000ff">&lt;/</span><span style="color: #800000">exec</span><span style="color: #0000ff">&gt;</span>
       <span style="color: #0000ff">&lt;</span><span style="color: #800000">fail</span> <span style="color: #ff0000">if</span>=&quot;${<span style="color: #ff0000">nunitReturnCode</span> <span style="color: #0000ff">&gt;</span> '7'}&quot;<span style="color: #0000ff">&gt;</span>Robocopy failed with yonkly20 (return code ${nunitReturnCode})<span style="color: #0000ff">&lt;/</span><span style="color: #800000">fail</span><span style="color: #0000ff">&gt;</span>  

       <span style="color: #0000ff">&lt;</span><span style="color: #800000">exec</span>
         <span style="color: #ff0000">program</span><span style="color: #0000ff">=&quot;robocopy.exe&quot;</span>
         <span style="color: #ff0000">commandline</span><span style="color: #0000ff">=&quot;c:\dev\yonkly20\yonkly20\ \\10.109.69.2\c\websites\yonkly20 *.* /E /XA:H /COPY:DT /XO /XD .svn logs obj aspnet_client app_data properties controllers helpers models /NDL /NC /NS /NP /XF *.cs *.csproj *.config  *.pdb&quot;</span>
         <span style="color: #ff0000">timeout</span><span style="color: #0000ff">=&quot;120000&quot;</span>
         <span style="color: #ff0000">failonerror</span><span style="color: #0000ff">=&quot;false&quot;</span>
         <span style="color: #ff0000">resultproperty</span><span style="color: #0000ff">=&quot;nunitReturnCode&quot;</span><span style="color: #0000ff">&gt;</span>
       <span style="color: #0000ff">&lt;/</span><span style="color: #800000">exec</span><span style="color: #0000ff">&gt;</span>
       <span style="color: #0000ff">&lt;</span><span style="color: #800000">fail</span> <span style="color: #ff0000">if</span>=&quot;${<span style="color: #ff0000">nunitReturnCode</span> <span style="color: #0000ff">&gt;</span> '7'}&quot;<span style="color: #0000ff">&gt;</span>Robocopy failed with yonkly20 on remote (return code ${nunitReturnCode})<span style="color: #0000ff">&lt;/</span><span style="color: #800000">fail</span><span style="color: #0000ff">&gt;</span>  

    <span style="color: #0000ff">&lt;/</span><span style="color: #800000">target</span><span style="color: #0000ff">&gt;</span>
<span style="color: #0000ff">&lt;/</span><span style="color: #800000">project</span><span style="color: #0000ff">&gt;</span></pre>
</div>
<p>You can repeat the Robocopy command for every web server.&#160; You can learn more about Robocopy <a href="http://ss64.com/nt/robocopy.html" target="_blank">here</a>, NANT tasks <a href="http://nant.sourceforge.net/release/latest/help/tasks/" target="_blank">here</a> and the exec task <a href="http://nant.sourceforge.net/release/latest/help/tasks/exec.html" target="_blank">here</a>.&#160; The fail element in the above XML file tells TeamCity to only fail the build if the return value from Robocopy is greater than 7.&#160; Get more info about Robcopy return code which is a bit map over <a href="http://blogs.technet.com/deploymentguys/archive/2008/06/16/robocopy-exit-codes.aspx" target="_blank">here</a>.</p>
<p>It’s important to note that I have a dependency setup between my build and deploy projects.&#160; This is to ensure that I don’t deploy a failed build.&#160; The deploy project will only work if the build succeeds.</p>
<h2>Tools &amp; Helpers</h2>
<p>There are a couple of helpful tools/plugins that make TeamCity even more powerful.&#160; The first plugin is a system tray notifier that will display popups to notify of build status.</p>
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2009/08/image1.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.emadibrahim.com/wp-content/uploads/2009/08/image_thumb1.png" width="482" height="247" /></a> </p>
<p>The other plugin is for Visual Studio and is a “killer feature” for TeamCity.&#160; It allows me to verify that my code will build on the server before I check it in.&#160; it’s probably better if you read the description on <a href="http://www.jetbrains.com/teamcity/delayed_commit.html" target="_blank">their site</a>.</p>
<p><a href="http://www.emadibrahim.com/wp-content/uploads/2009/08/image2.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.emadibrahim.com/wp-content/uploads/2009/08/image_thumb2.png" width="244" height="206" /></a> </p>
<h2>Ready. Set. Go</h2>
<p>Now, all I have to do is check in my code.&#160; TeamCity will detect the new files, check them out, build the application and if it succeeds, it will deploy it.</p>
<h2>What’s Next?</h2>
</p>
<p>Many of these things are relatively new to me, so if you know of a better way to do things, please share.&#160; I am also looking for a way to automate my database migration (probably with a NANT task).</p>

<p><a href="http://feedads.g.doubleclick.net/~a/QZvL4Ub4YnRkZhopfWqoydTQENo/0/da"><img src="http://feedads.g.doubleclick.net/~a/QZvL4Ub4YnRkZhopfWqoydTQENo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/QZvL4Ub4YnRkZhopfWqoydTQENo/1/da"><img src="http://feedads.g.doubleclick.net/~a/QZvL4Ub4YnRkZhopfWqoydTQENo/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EmadIbrahim/~4/FJdtoT5Yby8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2009/08/05/startup-asp-net-mvc-cloud-scale-deployment/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		<feedburner:origLink>http://www.emadibrahim.com/2009/08/05/startup-asp-net-mvc-cloud-scale-deployment/</feedburner:origLink></item>
		<item>
		<title>Product Ideas – Help Me Decide</title>
		<link>http://feedproxy.google.com/~r/EmadIbrahim/~3/mQNZTJknBs0/</link>
		<comments>http://www.emadibrahim.com/2009/07/28/product-ideas-help-me-decide/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 18:18:00 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[Interesting]]></category>
		<category><![CDATA[Random]]></category>
		<category><![CDATA[Startup]]></category>
		<category><![CDATA[feedback]]></category>
		<category><![CDATA[poll]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/2009/07/28/product-ideas-help-me-decide/</guid>
		<description>I founded www.yonkly.com about 8 months ago and it is at a point now that doesn&amp;#8217;t require my full time attention. So, I need to start/create a new product or service and need your opinion on what to do next. I created a very short questionnaire (only 1 required question and no email address is [...]</description>
			<content:encoded><![CDATA[<p>I founded www.yonkly.com about 8 months ago and it is at a point now that doesn&#8217;t require my full time attention. </p>
<p>So, I need to start/create a new product or service and need your opinion on what to do next.</p>
<p>I created a very short questionnaire (only 1 required question and no email address is required).&#160; Can you please take 5 seconds and guide me in the right direction?</p>
<p>It is located at <a href="http://bit.ly/hIk1p">http://bit.ly/hIk1p</a> </p>
<p>If you decide to fill out your email (optional), I will use it to send you a free copy/subscription of whatever I (we) decide to create. </p>
<p>I will announce the results of your votes on <a href="http://twitter.com/eibrahim" target="_blank">twitter</a> after I close voting.&#160; </p>
<p>Thanks for your help in advance. </p>
<p>PS: You can also help by re-tweeting &#8211; <a href="http://bit.ly/1uIuvI">http://bit.ly/1uIuvI</a> my request for feedback.</p>
<p>PSS: I will make the results public once voting is closed.&#160; I just don’t want the current results to influence your vote.&#160; I will also make public the ideas suggested by you – some are really fantastic (thanks).</p>
<p>PSSS: Some related discussions <a href="http://discuss.joelonsoftware.com/default.asp?biz.5.769024.7" target="_blank">here</a></p>

<p><a href="http://feedads.g.doubleclick.net/~a/2zrIFX768i4_I7czH_90j_Ax9_I/0/da"><img src="http://feedads.g.doubleclick.net/~a/2zrIFX768i4_I7czH_90j_Ax9_I/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/2zrIFX768i4_I7czH_90j_Ax9_I/1/da"><img src="http://feedads.g.doubleclick.net/~a/2zrIFX768i4_I7czH_90j_Ax9_I/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EmadIbrahim/~4/mQNZTJknBs0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2009/07/28/product-ideas-help-me-decide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.emadibrahim.com/2009/07/28/product-ideas-help-me-decide/</feedburner:origLink></item>
		<item>
		<title>jQuery Wildcard Selector</title>
		<link>http://feedproxy.google.com/~r/EmadIbrahim/~3/IhURByfEFyg/</link>
		<comments>http://www.emadibrahim.com/2009/07/25/jquery-wildcard-selector/#comments</comments>
		<pubDate>Sat, 25 Jul 2009 13:27:49 +0000</pubDate>
		<dc:creator>Emad Ibrahim</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://www.emadibrahim.com/2009/07/25/jquery-wildcard-selector/</guid>
		<description>This post is a reminder for me on how to do wildcard selection in jQuery.&amp;#160; It comes up more than you think and for some reason, I can never remember it. &amp;#60;div id='pnlUsers'&amp;#62;&amp;#60;/div&amp;#62; &amp;#60;div id='pnlMessages'&amp;#62;&amp;#60;/div&amp;#62; &amp;#60;div id='pnlStatus'&amp;#62;&amp;#60;/div&amp;#62; .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ [...]</description>
			<content:encoded><![CDATA[<p>This post is a reminder for me on how to do wildcard selection in jQuery.&#160; It comes up more than you think and for some reason, I can never remember it.</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">id</span><span class="kwrd">='pnlUsers'</span><span class="kwrd">&gt;&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">id</span><span class="kwrd">='pnlMessages'</span><span class="kwrd">&gt;&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">div</span> <span class="attr">id</span><span class="kwrd">='pnlStatus'</span><span class="kwrd">&gt;&lt;/</span><span class="html">div</span><span class="kwrd">&gt;</span></pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
</p>
<p>I can easily hide all the divs up by doing a wildcard selection on elements with an id starting with “pnl”, like this:</p>
<pre class="csharpcode">$(<span class="str">&quot;[id^=pnl]&quot;</span>).hide();</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
</p>
<p>You can even narrow it to only divs like this:</p>
<pre class="csharpcode">$(<span class="str">&quot;div[id^=pnl]&quot;</span>).hide();</pre>
<style type="text/css">
<p>.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }</style>
</p>
<p>There is another example with even more explanations <a href="http://www.insideria.com/2009/04/jquery-wild-card-example.html" target="_blank">over here</a>.</p>

<p><a href="http://feedads.g.doubleclick.net/~a/aXaaikC_JQuqYgYtcL4vbbY7uhc/0/da"><img src="http://feedads.g.doubleclick.net/~a/aXaaikC_JQuqYgYtcL4vbbY7uhc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/aXaaikC_JQuqYgYtcL4vbbY7uhc/1/da"><img src="http://feedads.g.doubleclick.net/~a/aXaaikC_JQuqYgYtcL4vbbY7uhc/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/EmadIbrahim/~4/IhURByfEFyg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.emadibrahim.com/2009/07/25/jquery-wildcard-selector/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.emadibrahim.com/2009/07/25/jquery-wildcard-selector/</feedburner:origLink></item>
	</channel>
</rss><!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->

