<?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:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Nick Berardi's Coder Journal</title>
	
	<link>http://coderjournal.com</link>
	<description>My journal.</description>
	<lastBuildDate>Tue, 27 Jul 2010 12:30:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<cloud domain="coderjournal.com" port="80" path="/?rsscloud=notify" registerProcedure="" protocol="http-post" />
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/coderjournal" /><feedburner:info uri="coderjournal" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license><image><link>http://creativecommons.org/licenses/by-sa/3.0/</link><url>http://creativecommons.org/images/public/somerights20.gif</url><title>Some Rights Reserved</title></image><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2Fcoderjournal" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fcoderjournal" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2Fcoderjournal" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/coderjournal" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fcoderjournal" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fcoderjournal" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fcoderjournal" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><feedburner:feedFlare href="http://www.plusmo.com/add?url=http%3A%2F%2Ffeeds.feedburner.com%2Fcoderjournal" src="http://plusmo.com/res/graphics/fbplusmo.gif">Subscribe with Plusmo</feedburner:feedFlare><feedburner:feedFlare href="http://www.thefreedictionary.com/_/hp/AddRSS.aspx?http%3A%2F%2Ffeeds.feedburner.com%2Fcoderjournal" src="http://img.tfd.com/hp/addToTheFreeDictionary.gif">Subscribe with The Free Dictionary</feedburner:feedFlare><feedburner:feedFlare href="http://www.bitty.com/manual/?contenttype=rssfeed&amp;contentvalue=http%3A%2F%2Ffeeds.feedburner.com%2Fcoderjournal" src="http://www.bitty.com/img/bittychicklet_91x17.gif">Subscribe with Bitty Browser</feedburner:feedFlare><feedburner:feedFlare href="http://www.live.com/?add=http%3A%2F%2Ffeeds.feedburner.com%2Fcoderjournal" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><feedburner:feedFlare href="http://mix.excite.eu/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fcoderjournal" src="http://image.excite.co.uk/mix/addtomix.gif">Subscribe with Excite MIX</feedburner:feedFlare><feedburner:feedFlare href="http://www.webwag.com/wwgthis.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fcoderjournal" src="http://www.webwag.com/images/wwgthis.gif">Subscribe with Webwag</feedburner:feedFlare><feedburner:feedFlare href="http://www.podcastready.com/oneclick_bookmark.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fcoderjournal" src="http://www.podcastready.com/images/podcastready_button.gif">Subscribe with Podcast Ready</feedburner:feedFlare><feedburner:feedFlare href="http://www.wikio.com/subscribe?url=http%3A%2F%2Ffeeds.feedburner.com%2Fcoderjournal" src="http://www.wikio.com/shared/img/add2wikio.gif">Subscribe with Wikio</feedburner:feedFlare><feedburner:feedFlare href="http://www.dailyrotation.com/index.php?feed=http%3A%2F%2Ffeeds.feedburner.com%2Fcoderjournal" src="http://www.dailyrotation.com/rss-dr2.gif">Subscribe with Daily Rotation</feedburner:feedFlare><item>
		<title>ASP.NET MVC 3 Preview 1 Released</title>
		<link>http://feedproxy.google.com/~r/coderjournal/~3/5ttF2ZuuBcE/</link>
		<comments>http://coderjournal.com/2010/07/asp-net-mvc-3-preview-1-released/#comments</comments>
		<pubDate>Tue, 27 Jul 2010 12:25:07 +0000</pubDate>
		<dc:creator>Nick Berardi</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[asp.net mvc]]></category>
		<category><![CDATA[ASP.NET MVC 3]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://coderjournal.com/2010/07/asp-net-mvc-3-preview-1-released/</guid>
		<description><![CDATA[The title says it all, so go get your copy today and check out all the new features.  You can download it here. New features include: Razor View Engine Dynamic View and ViewModel Properties &#8220;Add View&#8221; Dialog Box Supports Multiple View Engines Service Location and Dependency Injection Support Global Filters New JsonValueProviderFactory Class Support for [...]]]></description>
			<content:encoded><![CDATA[<p>The title says it all, so go get your copy today and check out all the new features.  You can <a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=cb42f741-8fb1-4f43-a5fa-812096f8d1e8">download it here</a>.</p>
<p>New features include:</p>
<ul>
<li>Razor View Engine</li>
<li>Dynamic View and ViewModel Properties</li>
<li>&#8220;Add View&#8221; Dialog Box Supports Multiple View Engines</li>
<li>Service Location and Dependency Injection Support</li>
<li>Global Filters</li>
<li>New JsonValueProviderFactory Class</li>
<li>Support for .NET Framework 4 Validation Attributes and IValidatableObject</li>
<li>New IClientValidatable Interface</li>
<li>Support for &gt;NET Framework 4 Metadata Attributes</li>
<li>New IMetadataAware Interface</li>
<li>New Action Result Types (HttpNotFoundResultAction and HttpStatusCodeResultAction)</li>
<li>Permanent Redirect Support in the controller (RedirectPermanent, RedirectToRoutePermanent, and RedirectToActionPermanent)</li>
</ul>
<p>Looks like this is going to be a very worth while upgrade, and a special thanks should be given to Phil and team for making ASP.NET MVC everything that ASP.NET WebForms isn&#8217;t.</p>
<img src="http://feeds.feedburner.com/~r/coderjournal/~4/5ttF2ZuuBcE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://coderjournal.com/2010/07/asp-net-mvc-3-preview-1-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://coderjournal.com/2010/07/asp-net-mvc-3-preview-1-released/</feedburner:origLink></item>
		<item>
		<title>Turning JSON into a ExpandoObject</title>
		<link>http://feedproxy.google.com/~r/coderjournal/~3/6HRcC-J72VA/</link>
		<comments>http://coderjournal.com/2010/07/turning-json-into-a-expandoobject/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 19:06:21 +0000</pubDate>
		<dc:creator>Nick Berardi</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.NET 4.0]]></category>
		<category><![CDATA[DLR]]></category>
		<category><![CDATA[Dynamic]]></category>

		<guid isPermaLink="false">http://coderjournal.com/2010/07/turning-json-into-a-expandoobject/</guid>
		<description><![CDATA[Recently I had the need for a web service of mine to take a JSON blob as an input.  This isn’t really exciting or all that interesting a problem, but I really didn’t enjoy the code smell that came from drilling in to the resulting Dictionary object that comes from desterilizing the JSON object into [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had the need for a web service of mine to take a JSON blob as an input.  This isn’t really exciting or all that interesting a problem, but I really didn’t enjoy the code smell that came from drilling in to the resulting Dictionary object that comes from desterilizing the JSON object into something that .NET understands.</p>
<pre class="brush: csharp;">public ActionResult Create()
{
    IDictionary&lt;string, object&gt; request;

    using (var bodyStream = new StreamReader(Request.InputStream))
    {
        var json = bodyStream.ReadToEnd();

        JavaScriptSerializer ser = new JavaScriptSerializer();
        request = ser.Deserialize&lt;IDictionary&lt;string, object&gt;&gt;(json);
    }

    var accountRequest = request["account"] as IDictionary&lt;string, object&gt;;
    var billingRequest = request["billing"] as IDictionary&lt;string, object&gt;;
    var billingInfoRequest = billingRequest["info"] as IDictionary&lt;string, object&gt;;
    var billingInvoiceRequest = billingRequest["invoice"] as IDictionary&lt;string, object&gt;;
    var billingItemsRequest = billingRequest["items"] as IDictionary&lt;string, object&gt;;

    // create account
    var account = new Account {
        CreatedOn = DateTime.UtcNow,
        Email = accountRequest["email"] as string,
        Name = accountRequest["company"] as string,
        UserName = request["user_name"] as string
    };

    // ... more code using the dictionary object
}</pre>
<p>After remembering that the <strong><a href="http://msdn.microsoft.com/en-us/library/system.dynamic.expandoobject.aspx">ExpandoObject</a></strong> was also based on <strong>IDictionary&lt;string, object&gt;</strong> I thought it might be a marriage met in heaven.</p>
<blockquote><p>The ExpandoObject class enables you to add and delete members of its instances at run time and also to set and get values of these members. This class supports dynamic binding, which enables you to use standard syntax likesampleObject.sampleMember instead of more complex syntax like sampleObject["sampleMember"].</p></blockquote>
<p>Since I won’t know what the JSON will actually look like until it is passed in to the web service, and I really don’t want to create different objects just for the sake of making a temp pass through object from JSON to my app code, the use of the <em>ExpandoObject</em> is great because it helps keep my code clean looking and more readable.  Because as a developer I don’t really care that the data is coming in as JSON, all that I really care about is the data it self.  So my aim is to simplify my life and the readability of my code.</p>
<p>The first thing I usually do when creating an API is write a reference application, or in other words use a test driven approach when starting to write a new API.  I started with the following reference code:</p>
<pre class="brush: csharp;">public ActionResult Create()
{
    dynamic request;    

    using (var bodyStream = new StreamReader(Request.InputStream))
    {
        var json = bodyStream.ReadToEnd();
        request = json.FromJson().Expando();
    }

    var account = new Account {
        CreatedOn = DateTime.UtcNow,
        Email = request.account.email,
        Name = request.account.company,
        UserName = request.account.user_name
    };

    // ... more code using the expando object
}</pre>
<p>This seems much cleaner doesn’t it?  Now let me so you the <strong>Expando</strong> extension method that I created to accomplish this.  It is relatively straight forward I take an <em>IDictionary&lt;string, object&gt;</em> object and copy it into an <em>ExpandoObject</em> object, which is also implements <em>IDictionary&lt;string, object&gt;</em>.  So the copying from one to the other is pretty straight forward for the most part.</p>
<pre class="brush: csharp;">public static ExpandoObject Expando(this IDictionary&lt;string, object&gt; dictionary)
{
    var expando = new ExpandoObject();
    var expandoDic = (IDictionary&lt;string, object&gt;)expando;

    foreach (var item in dictionary)
    {
        bool alreadyProcessed = false;

        if (item.Value is IDictionary&lt;string, object&gt;)
        {
            expandoDic.Add(item.Key, Expando((IDictionary&lt;string, object&gt;)item.Value));
            alreadyProcessed = true;
        }
        else if (item.Value is ICollection)
        {
            var itemList = new List&lt;object&gt;();
            foreach (var item2 in (ICollection)item.Value)
                if (item2 is IDictionary&lt;string, object&gt;)
                    itemList.Add(Expando((IDictionary&lt;string, object&gt;)item2));
                else
                    itemList.Add(Expando(new Dictionary&lt;string, object&gt; { { "Unknown", item2 } }));

            if (itemList.Count &gt; 0)
            {
                expandoDic.Add(item.Key, itemList);
                alreadyProcessed = true;
            }
        }

        if (!alreadyProcessed)
            expandoDic.Add(item);
    }

    return expando;
}</pre>
<p>Not as straight forward as a <em>foreach</em> loop, but not totally out of the question for something that you couldn’t read and understand in about 10 minutes.</p>
<p>This may add a slight bit of overhead between the coping of one dictionary into another, and the use of the dynamic runtime, but I think the over all ease in readability is more of a productivity gain than the slight bit of overhead that was gained.</p>
<img src="http://feeds.feedburner.com/~r/coderjournal/~4/6HRcC-J72VA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://coderjournal.com/2010/07/turning-json-into-a-expandoobject/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://coderjournal.com/2010/07/turning-json-into-a-expandoobject/</feedburner:origLink></item>
		<item>
		<title>Uninstalling Windows Phone Developer Tools CTP</title>
		<link>http://feedproxy.google.com/~r/coderjournal/~3/D_ZCQF5rZr0/</link>
		<comments>http://coderjournal.com/2010/07/uninstalling-windows-phone-developer-tools-ctp/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 20:05:20 +0000</pubDate>
		<dc:creator>Nick Berardi</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Beta]]></category>
		<category><![CDATA[Windows Phone 7]]></category>

		<guid isPermaLink="false">http://coderjournal.com/2010/07/uninstalling-windows-phone-developer-tools-ctp/</guid>
		<description><![CDATA[Today I decided to upgrade to the Beta of the Windows Phone Developer Toolkit, however the uninstall process wasn’t working.&#160; It kept asking me what I wanted to install every time I choose the uninstall radio button. So after a couple failed attempts at uninstalling in different ways, I decided to go to the source, [...]]]></description>
			<content:encoded><![CDATA[<p>Today I decided to upgrade to the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=c8496c2a-54d9-4b11-9491-a1bfaf32f2e3&amp;displaylang=en#filelist">Beta of the Windows Phone Developer Toolkit</a>, however the uninstall process wasn’t working.&#160; It kept asking me what I wanted to install every time I choose the uninstall radio button.</p>
<p>So after a couple failed attempts at uninstalling in different ways, I decided to go to the source, in my case that was:</p>
<blockquote><p>C:\Program Files (x86)\Microsoft Visual Studio 10.0\Microsoft Visual Studio 2010 Express for Windows Phone&#160; CTP – ENU</p>
</blockquote>
<p>After in the folder, I just had to right click on the <em>vs_setup.msi</em> file and select <strong>Uninstall</strong>, after that the process worked like a charm and I could then install the beta.&#160; Hope this helps someone besides me.</p>
<img src="http://feeds.feedburner.com/~r/coderjournal/~4/D_ZCQF5rZr0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://coderjournal.com/2010/07/uninstalling-windows-phone-developer-tools-ctp/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://coderjournal.com/2010/07/uninstalling-windows-phone-developer-tools-ctp/</feedburner:origLink></item>
		<item>
		<title>Welcome To Last.io</title>
		<link>http://feedproxy.google.com/~r/coderjournal/~3/a7ZH3tzcFak/</link>
		<comments>http://coderjournal.com/2010/06/welcome-to-last-io/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 01:31:30 +0000</pubDate>
		<dc:creator>Nick Berardi</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[last.io]]></category>

		<guid isPermaLink="false">http://coderjournal.com/2010/06/welcome-to-last-io/</guid>
		<description><![CDATA[I wanted to save this historic post for my blog, post number 250, for a special occasion.  And I can’t think of a more special occasion than what I am about to announce.  Over the past month or so I have been working on a new web application, in my spare time.  The goal of [...]]]></description>
			<content:encoded><![CDATA[<p>I wanted to save this historic post for my blog, post number 250, for a special occasion.  And I can’t think of a more special occasion than what I am about to announce.  Over the past month or so I have been working on a new web application, in my spare time.  The goal of the web app was to provide a more usable and accessible interface to a product that I believe has great potential beyond what the publisher originally imagined.</p>
<p>The product that I am talking about is <a href="http://tag.microsoft.com">Microsoft Tag</a>, it is probably not very well known to most of you.  But here is the basic concept.  You are given a image representation of a hyperlink so that it can be easily shared in a visual and usually physical medium such as a poster, banner ad, magazine, or something in print.  Or at least it is marketed that way.  The idea behind it is that you can get information that is relevant to a customer by having them just focus their camera phone on an image that looks like this in any of the mediums I listed a few sentences ago:</p>
<p><a href="http://coderjournal.com/uploads/2010/06/microsofttag.gif"><img style="display: inline; border: 0px;" title="microsoft-tag" src="http://coderjournal.com/uploads/2010/06/microsofttag_thumb.gif" border="0" alt="microsoft-tag" width="387" height="358" /></a></p>
<p>If you would like to try Microsoft Tag out please follow the directions on the tag on your mobile phone.</p>
<h3>Where last.io Fits In</h3>
<p>The concept behind <strong><a href="http://last.io">last.io</a></strong> is that there are many circumstances that don’t fit into the marketing of Microsoft Tag, where a tag would be the perfect way to share a link.  <strong>last.io</strong> is bring together the short URL services that provide a tiny URL for consumption on services like twitter and Microsoft Tag for consumption in a more visual medium.</p>
<p>The idea for <strong>last.io</strong> came to me while watching the audience members at a monthly Philly.NET meeting take a picture, with their smart phone, of a slide with a link to more information about the presentation, that the presenter thought was important for the audience to jot down and keep for future use.  However this process seemed flawed and inefficient to me.  First of all the audience members need to then take that picture and transcribe the slide in to the URL bar, which is pretty painful to impossible to do on your phone.  The process of this gets exponentially more complex the longer the URL is, so it can be very frustrating.  Second the presenter has no idea now many people actually made it from his presentation to the link, and the drop off factor of interested people goes down, when people forget they took the picture to transcribe later, the longer the URL is, and the less sense of immediacy the audience has to get the information.</p>
<h3>Who is last.io For</h3>
<p>last.io is:</p>
<ul>
<li><strong>For Apps</strong><br />
Create a tag and put it on posters, billboards, or advertisements for your iPhone apps, so that your customers can download your app with ease.</li>
<li><strong>For Presentations</strong><br />
Want to provide downloadable content or links in your presentations, and even short URL&#8217;s are too complicated to have your audience copy down. Try a tag and let them visit the link with ease.</li>
<li><strong>For Developers</strong><br />
Use our API to create short URL&#8217;s and tags and embed them in your applications and websites to provide easy transfer from the computer screen to your customers mobile phones with ease.</li>
<li><strong>For Anything</strong><br />
Create a tag or short URL for anything you can imagine to help make your content more accessible to anybody and anywhere.</li>
</ul>
<h3>How Does last.io Work</h3>
<p>The first thing you must do when you go to <strong><a href="http://last.io">last.io</a></strong> is to enter in a URL that you want shortened:</p>
<p><a href="http://coderjournal.com/uploads/2010/06/image11.png"><img style="display: inline; border: 0px;" title="image" src="http://coderjournal.com/uploads/2010/06/image_thumb10.png" border="0" alt="image" width="972" height="255" /></a></p>
<p>After you do this you will be presented with your short url:</p>
<p><a href="http://coderjournal.com/uploads/2010/06/image12.png"><img style="display: inline; border: 0px;" title="image" src="http://coderjournal.com/uploads/2010/06/image_thumb11.png" border="0" alt="image" width="970" height="259" /></a></p>
<p>You are provided a short URL that will work just the same as any other short URL, by doing a 301 redirect to the location that you entered in.  In the above case the short URL is:</p>
<p><span style="font-size: x-large;"><a href="http://last.io/1">http://last.io/1</a></span></p>
<p>From here if you want a tag you will just need to click on the self explanatory “Click Here To Create A Tag” text on the right hand side of the box.  By do this it will remove the text, un-dim the image, and provide you your fresh new tag.  Which can then be clicked on to see the full size version:</p>
<p><a href="http://coderjournal.com/uploads/2010/06/image13.png"><img style="display: inline; border: 0px;" title="image" src="http://coderjournal.com/uploads/2010/06/image_thumb12.png" border="0" alt="image" width="1011" height="539" /></a></p>
<p>Easy as that.</p>
<h3>But What If I Want To Embed The Image</h3>
<p>Well that is actually pretty easy to do.  Because the raw image is provided by taking the short URL, in the example case above, <a href="http://last.io/1">http://last.io/1</a>, and adding an exclamation point to the end of the URL like so.</p>
<p><a href="http://last.io/1!"><span style="font-size: x-large;">http://last.io/1!</span></a></p>
<p>You can do this with any of the last.io URL’s because if the URL doesn’t already have a tag when the exclamation point is added, a tag is created, and then returned for your convenience.</p>
<h3>Conclusion</h3>
<p>So do you think this is something you can find a use for?  Currently there is <a href="http://last.io/pages/api">a very limited API</a> for creating the URL’s, but it will soon be expanding, beyond the concept phase.</p>
<img src="http://feeds.feedburner.com/~r/coderjournal/~4/a7ZH3tzcFak" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://coderjournal.com/2010/06/welcome-to-last-io/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://coderjournal.com/2010/06/welcome-to-last-io/</feedburner:origLink></item>
		<item>
		<title>Run Cassandra As A Windows Service</title>
		<link>http://feedproxy.google.com/~r/coderjournal/~3/_PVj6sx-UgI/</link>
		<comments>http://coderjournal.com/2010/06/run-cassandra-as-a-windows-service/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 19:16:42 +0000</pubDate>
		<dc:creator>Nick Berardi</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Cassandra]]></category>
		<category><![CDATA[Windows Service]]></category>

		<guid isPermaLink="false">http://coderjournal.com/2010/06/run-cassandra-as-a-windows-service/</guid>
		<description><![CDATA[One of the main issues that comes up over and over again for Cassandra is: How do I run Cassandra as a Windows Service? In this post I am going to answer that question and in the process demonstrate how to do it in less than 10 minutes. Background Cassandra is mainly developed by Linux [...]]]></description>
			<content:encoded><![CDATA[<p>One of the main issues that comes up over and over again for Cassandra is: </p>
<blockquote><p>How do I run Cassandra as a Windows Service?</p>
</blockquote>
<p>In this post I am going to answer that question and in the process demonstrate how to do it in less than 10 minutes.</p>
<h3>Background</h3>
<p>Cassandra is mainly developed by Linux developers so very little attention has been paid to the Windows developer or administrator as far as Cassandra goes.&#160; So as Windows developers we have to hop through a couple more hoops than just clicking on an <em>install.exe</em> file and and letting it do all the work.&#160; However lucky for us, those hoops are easy and quickly hopped through.</p>
<h3>Step 1</h3>
<p>If you haven’t done so already please read my <a href="http://coderjournal.com/2010/03/cassandra-jump-start-for-the-windows-developer/">jump start for Windows users on install Cassandra</a>, this guide will get you ready for the next steps.</p>
<h3>Step 2</h3>
<p>The second step is also an easy one, you need to download a package called <em>RunAsService</em>, which provides the ability to run any program as a Windows Service.</p>
<ul>
<li><strong>&#160;</strong><a href="http://coderjournal.com/uploads/2010/06/RunAsService.zip"><strong>Download RunAsService.zip</strong></a> </li>
</ul>
<p>After you have downloaded the file extract the contents to a directory of your choosing.&#160; (I extracted it to <strong>c:\RunAsService</strong>)</p>
<p><em>Note: RunAsService was originally developed <a href="http://runasservice.sourceforge.net/">here</a>, however I recompiled it to run on .NET 2.0.</em></p>
<h3>Step 3</h3>
<p>To install RunAsService open up a command prompt with Administrative privileges and run this command.</p>
<pre class="brush: ps;">cd c:\RunAsService
install networkservice</pre>
<p>This registers RunAsService with your Windows Service.&#160; Make sure to keep your command prompt open because you will need it for the 5th step.</p>
<h3>Step 4</h3>
<p>To configure RunAsService for Cassandra open up the <em>RunAsService.exe.config</em> file in your favorite text editor and replace <font face="Courier New">&lt;service.settings&gt;</font> section with the following so that it looks like this:</p>
<pre class="brush: xml;">&lt;!-- Services configuration --&gt;
&lt;service.settings&gt;
    &lt;!-- Run Cassandra as a service --&gt;
    &lt;!-- My Cassandra install path is C:\apache-cassandra\ --&gt;
    &lt;service&gt;
        &lt;name&gt;Cassandra Database&lt;/name&gt;
        &lt;executable&gt;C:\apache-cassandra\bin\cassandra.bat&lt;/executable&gt;
        &lt;parameters&gt;&lt;/parameters&gt;
    &lt;/service&gt;
&lt;/service.settings&gt;</pre>
<p>After you have finished, save the config file and exit your text editor.</p>
<p><em>Note: My Cassandra install is in <strong>c:\apache-cassandra\</strong> you will have to correct the config above for where you installed it if different than mine.</em></p>
<h3>Step 5</h3>
<p>The last and final step of this process is to start the RunAsService service.&#160; You can either do it through the Services control panel or just type the following in to your command prompt.</p>
<pre class="brush: ps;">net start runasservice</pre>
<p>You should see a response in the command line saying that the service has been successfully started.&#160; To verify that Cassandra has been started you can use the <strong>cassandra-cli.bat</strong> file:</p>
<pre class="brush: ps;">cd c:\apache-cassandra\bin\
cassandra-cli.bat
connect localhost/9160</pre>
<p>It should report that it is connected to the server if the service is running.&#160; And with that we are done, and I told you it would only take about 10 minutes.</p>
<img src="http://feeds.feedburner.com/~r/coderjournal/~4/_PVj6sx-UgI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://coderjournal.com/2010/06/run-cassandra-as-a-windows-service/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://coderjournal.com/2010/06/run-cassandra-as-a-windows-service/</feedburner:origLink></item>
	</channel>
</rss>
