<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">
    <title>WS-Knowledge</title>
    
    
    <link rel="alternate" type="text/html" href="http://waheedsayed.typepad.com/ws-knowledge/" />
    <id>tag:typepad.com,2003:weblog-1887795</id>
    <updated>2011-11-06T20:17:00+03:00</updated>
    <subtitle>Software Development from a humble viewpoint of a knowledge addict.</subtitle>
    <generator uri="http://www.typepad.com/">TypePad</generator>
    <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/WS-Knowledge" /><feedburner:info uri="ws-knowledge" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://hubbub.api.typepad.com/" /><entry>
        <title>Quick account about CoffeeScript &amp; QUnit</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WS-Knowledge/~3/_vMM4tfhFKc/quick-account-about-coffeescript-qunit.html" />
        <link rel="replies" type="text/html" href="http://waheedsayed.typepad.com/ws-knowledge/2011/11/quick-account-about-coffeescript-qunit.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-6a011571303a12970b0162fc2e5c46970d</id>
        <published>2011-11-06T20:17:00+03:00</published>
        <updated>2011-11-06T20:17:00+03:00</updated>
        <summary>This is a quick account about unit testing JavaScript code. Recently, I tried to find a good JavaScript unit testing framework. I found different choices but the simplest and easier to use for test driving was QUnit QUnit is a powerful, easy-to-use, JavaScript test suite. It's used by the jQuery project to test its code and plugins but is capable of testing any generic JavaScript code (and even capable of testing JavaScript code on the server-side). I didn't practice unit testing on JavaScript code before but intending to test my JavaScript code in future. I have created a sample project...</summary>
        <author>
            <name>Waheed Sayed</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Javascript" />
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://waheedsayed.typepad.com/ws-knowledge/"><div xmlns="http://www.w3.org/1999/xhtml"><p>This is a quick account about unit testing JavaScript code. Recently, I tried to find a good JavaScript unit testing framework. I found different choices but the simplest and easier to use for test driving was <a href="http://docs.jquery.com/QUnit" target="_blank" title="QUnit">QUnit</a></p>
<p>
<div style="direction: ltr;">
<blockquote><em>QUnit is a powerful, easy-to-use, JavaScript test suite. It's used by the jQuery project to test its code and plugins but is capable of testing any generic JavaScript code (and even capable of testing JavaScript code on the server-side). </em></blockquote>
</div>
<div style="direction: ltr;">I didn't practice unit testing on JavaScript code before but intending to test my JavaScript code in future. I have created a <a href="https://bitbucket.org/waheedsayed/jscorrell" target="_blank">sample project</a> to show how to integrate different tools together.</div>
<div style="direction: ltr;" />
<div style="direction: ltr;">My intended Javascript development stack contains:</div>
<div style="direction: ltr;">1. <a href="http://jquery.com/" target="_blank">jQuery</a></div>
<div style="direction: ltr;">2. <a href="http://docs.jquery.com/QUnit" target="_blank">QUnit</a></div>
<div style="direction: ltr;">3. <a href="http://jashkenas.github.com/coffee-script/" target="_blank">CoffeeScript</a></div>
<div style="direction: ltr;">4. <a href="http://jslint4vs2010.codeplex.com/" target="_blank">JSLint for Visual Studio</a></div>
<div style="direction: ltr;" />
</p><xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/WS-Knowledge/~4/_vMM4tfhFKc" height="1" width="1" /></div></content>



    <feedburner:origLink>http://waheedsayed.typepad.com/ws-knowledge/2011/11/quick-account-about-coffeescript-qunit.html</feedburner:origLink></entry>
    <entry>
        <title>I love Coffee &amp; I like CoffeeScript :)</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WS-Knowledge/~3/_r7f4Zu8vG0/i-love-coffee-and-i-like-coffeescript.html" />
        <link rel="replies" type="text/html" href="http://waheedsayed.typepad.com/ws-knowledge/2011/10/i-love-coffee-and-i-like-coffeescript.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-6a011571303a12970b015392562823970b</id>
        <published>2011-10-16T23:28:02+03:00</published>
        <updated>2011-10-16T23:28:02+03:00</updated>
        <summary>* CoffeeScript is a little language that compiles into JavaScript. * CoffeeScript is an attempt to expose the good parts of JavaScript in a simple way. * The golden rule of CoffeeScript is: "It's just JavaScript". -- from the official site Just recently I heard fellows on Twitter talking about CoffeeScript. I believe I heard the name before but I was very busy couldn’t even have a look. This time I tried to check what is that. It turns out to be a new way for writing JavaScript that is more compact &amp; dynamic, and resembles Ruby and Python dynamic...</summary>
        <author>
            <name>Waheed Sayed</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Software Development" />
        <category scheme="http://www.sixapart.com/ns/types#category" term="Web/Tech" />
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://waheedsayed.typepad.com/ws-knowledge/"><div xmlns="http://www.w3.org/1999/xhtml"><p> </p>
<table border="0" cellpadding="2" cellspacing="0" width="623">
<tbody>
<tr>
<td width="621"><a href="http://waheedsayed.typepad.com/.a/6a011571303a12970b015392562d1d970b-pi"><img alt="coffeescript" border="0" height="70" src="http://waheedsayed.typepad.com/.a/6a011571303a12970b014e8c4a46ed970d-pi" style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="coffeescript" width="245" /></a></td>
</tr>
<tr>
<td width="621">
<p><span style="color: #a9a56b;"><strong><span style="font-family: 'Book Antiqua';"><em><span style="font-size: small;"><span style="color: #c9ab7e;">* CoffeeScript </span>is a little language that compiles into </span></em></span></strong></span><span style="color: #a9a56b;"><strong><span style="font-family: 'Book Antiqua'; font-size: small;"><em> </em></span><span style="font-family: 'Book Antiqua';"><em><span style="font-size: small;"><span style="color: #68653c;">JavaScript</span>.                       <br /></span></em></span></strong></span><em><span style="font-size: small;"><span style="color: #a9a56b;"><strong><span style="font-family: 'Book Antiqua';"><span style="color: #a9a56b;"><span style="color: #c9ab7e;">* CoffeeScript </span></span>is an attempt to expose the good parts of <span style="color: #a9a56b;"><span style="color: #68653c;">JavaScript</span> </span><span style="text-decoration: underline;">in a simple way</span>.                       <br />* The golden rule of <span style="color: #a9a56b;"><span style="color: #c9ab7e;">CoffeeScript </span></span>is: </span><span style="font-family: 'Book Antiqua';">"It's just </span></strong></span><span style="color: #a9a56b;"><strong><span style="font-family: 'Book Antiqua';"><span style="color: #a9a56b;"><span style="color: #68653c;">JavaScript</span></span>".</span></strong></span></span></em></p>
<p><span style="color: #000000; font-family: 'Arial Narrow'; font-size: x-small;">-- from the official site</span></p>
</td>
</tr>
</tbody>
</table>
<p>Just recently I heard fellows on Twitter talking about <a href="http://CoffeeScript.org/" target="_blank" title="CoffeeScript">CoffeeScript</a>. I believe I heard the name before but I was very busy couldn’t even have a look. This time I tried to check what is that.</p>
<p>It turns out to be a new way for writing JavaScript that is more compact &amp; dynamic, and resembles Ruby and Python dynamic languages. After I gave it few hours &amp; I felt I like it.</p>
<p>The idea behind this new language is to write your code in a dynamic syntax that later can be compiled to generate a 100% equivalent JavaScript that's granted to be always valid if you check it against a tool like <a href="http://www.javascriptlint.com/" target="_blank" title="JavaScript Lint">JavaScript Lint</a>. The gain of this is brevity and readability, typically 1/3 fewer lines with no effect on runtime performance.</p>
<p>First issue I faced was how to get it working on my PC? The installation on Windows is somehow long &amp; complex; no single-filre installer available for Windows on the official site yet. But I found <a href="http://github.com/alisey/CoffeeScript-Compiler-for-Windows" target="_blank" title="CoffeeScript Compiler for Windows">this</a> project that simplifies compiling CoffeeScript into JavaScript on Windows. Hence, my first environment consisted of a good text editor, <a href="http://notepad-plus-plus.org/" target="_blank" title="Notepad++">Notepad++</a>, and a <a href="http://CoffeeScript.org/" target="_blank" title="CoffeeScript">CoffeeScript</a> Compiler for Windows. There's another simple alternative, the online compiler available on official site called "TRY COFFEESCRIPT".</p>
<p>What I liked about this language that I can write complex JavaScript in a more compact &amp; readable form. The major difference for me, since that I’m not a good JavaScript developer, I don’t like the way JavaScript define classes. JavaScript way of defining classes sounds, for me, a method-oriented way than an object-oriented way. But when tried <a href="http://CoffeeScript.org/" target="_blank" title="CoffeeScript">CoffeeScript</a> I was able to express my thoughts in an object-oriented way. Moreover, It has a dynamic syntax similar to Ruby &amp; Python that takes indentation into account instead of braces and parentheses to make your code looks more readable &amp; expressive; though I love static languages in general &amp; specifically C# :)</p>
<p>Using my simple environment, I managed to write my first simple program. I found <a href="http://ayende.com/blog/108545/the-tax-calculation-challenge" target="_blank">Ayende’s latest challenge for Tax Calculation</a> a good start, so I decided to write my answer in <a href="http://CoffeeScript.org/" target="_blank" title="CoffeeScript">CoffeeScript</a>. You can find this simple program in this <a href="https://gist.github.com/1289852" target="_blank">GitHub:Gist</a>. The screenshot below can give u an idea about how does it look like if u didn’t check the official site yet.</p>
<p> </p>
<p><a href="http://waheedsayed.typepad.com/.a/6a011571303a12970b014e8c4a419a970d-pi"><img alt="tax_calc_challenge" height="600" src="http://waheedsayed.typepad.com/.a/6a011571303a12970b014e8c4a41a4970d-pi" style="display: block; float: none; margin-left: auto; margin-right: auto;" title="tax_calc_challenge" width="800" /></a></p>
<p>This is my first account about <a href="http://CoffeeScript.org/" target="_blank" title="CoffeeScript">CoffeeScript</a>, the second will come soon about preparing a better environment for developing on Windows, probably also on Ubuntu.</p>
<p>Enjoy learning... :)</p><xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/WS-Knowledge/~4/_r7f4Zu8vG0" height="1" width="1" /></div></content>



    <feedburner:origLink>http://waheedsayed.typepad.com/ws-knowledge/2011/10/i-love-coffee-and-i-like-coffeescript.html</feedburner:origLink></entry>
    <entry>
        <title>Building a stand-alone Windows service on top of Topshelf</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WS-Knowledge/~3/4YuKYUZKv9c/building-a-stand-alone-windows-service-on-top-of-topshelf-1.html" />
        <link rel="replies" type="text/html" href="http://waheedsayed.typepad.com/ws-knowledge/2011/06/building-a-stand-alone-windows-service-on-top-of-topshelf-1.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-6a011571303a12970b01538f4fe43f970b</id>
        <published>2011-06-20T15:31:00+03:00</published>
        <updated>2011-06-20T20:28:52+03:00</updated>
        <summary>I'd like to share my experience about a valuable OSS project I liked very much &amp; used recently. The latest project I designed &amp; implemented was an integration subsystem that acts as a bridge between two systems, our B2C Portal &amp; e-Government Message-based Services. The solution architecture is based on building multiple multi-threaded windows services that receive, parse, initiate and send different types of requests &amp; transactions between both systems bidirectional. Building this number of windows services required building a good common infrastructure for all services to make them consistent enough, well refactored, and easy to debug. And, Here came...</summary>
        <author>
            <name>Waheed Sayed</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="C#.NET" />
        <category scheme="http://www.sixapart.com/ns/types#category" term="Software Development" />
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://waheedsayed.typepad.com/ws-knowledge/"><div xmlns="http://www.w3.org/1999/xhtml"><p>I'd like to share my experience about a valuable OSS project I liked very much &amp; used recently.    <br />The latest project I designed &amp; implemented was an integration subsystem that acts as a bridge between two systems, our B2C Portal &amp; e-Government  Message-based Services.</p>  <p>The solution architecture is based on building multiple multi-threaded windows services that receive, parse, initiate and send different types of requests &amp; transactions between both systems bidirectional.    <br />Building this number of windows services required building a good common infrastructure for all services to make them consistent enough, well refactored, and easy to debug.     <br />And, Here came the decision to use <a href="http://www.typepad.com/site/blogs/6a011571303a12970b0115703af8ab970c/post/6a011571303a12970b01538f0c103b970b/topshelf-project.com">Topshelf</a> as an infrastructure for my services. Topshelf describes itself as <em>"An easy service hosting framework for building Windows services using .NET"</em></p>  <p>What I liked about Topshelf, as a first reason to search about it &amp; use it, that It enables you to build Windows service as a console application and run &amp; debug it as a console application but you can deploy it as a Windows service. This idea sounds very good for me. So my services shouldn’t inherit from a specific class and shouldn't install them during development time before each debug session &amp; uninstall them again.</p>  <p><strong>Edit: </strong>Installing Topshelf became quite easy because of <a href="http://nuget.org/" target="_blank">NuGet</a> integration with Visual Studio 2010.     <br />Other wise, you can simply download binaries &amp; add references to you project.</p>  <p>So, let's see how it's easy to use Topshelf! All what I need is an empty console application and in the main method let's write the following.</p>  <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">   <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">     <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">const</span> <span style="color: #0000ff">string</span> SERVICE_NAME = <span style="color: #006080">"Do Something Service"</span>;</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; 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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>  </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> <span style="color: #008000">// configure log4net</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; 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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> XmlConfigurator.Configure(PathHelper.GetFileInfo(<span style="color: #006080">"do_something_service.log4net"</span>));</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>  </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; 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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #008000">// configure service runner or host</span></pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> HostFactory.Run(cfg =&gt; {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; 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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     cfg.Service&lt;IDoSomethingService&gt;(svc =&gt; {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>         svc.SetServiceName(SERVICE_NAME);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; 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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>         svc.ConstructUsing(name =&gt; <span style="color: #0000ff">new</span> DoSomethingService());</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>         svc.WhenStarted(service =&gt; service.Start());</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; 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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>         svc.WhenStopped(service =&gt; service.Stop());</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>     }); cfg.RunAsLocalSystem();</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; 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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>     cfg.SetDescription(SERVICE_NAME);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>     cfg.SetDisplayName(SERVICE_NAME);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; 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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span>     cfg.SetServiceName(SERVICE_NAME);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span> });</pre>
<!--CRLF--></div>
</div>

<p>Those few lines will make the console application work both as console application, as expected, and also as a Windows service that can be installed &amp; controlled from Services Manager.</p>

<p>The code shown above is very generic so it doesn’t require implementing specific interfaces or to inherit from specific base classes. You can see method signatures below to make sure it’s all generic.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">void</span> ConstructUsing(Topshelf.Model.DescriptionServiceFactory&lt;TService&gt; serviceFactory);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; 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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> <span style="color: #0000ff">void</span> WhenStarted(System.Action&lt;TService&gt; startAction);</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> <span style="color: #0000ff">void</span> WhenStopped(System.Action&lt;TService&gt; stopAction);</pre>
<!--CRLF--></div>
</div>

<p>To implement my services, first, I created custom interfaces. First interface called IGenericService that will be a base for all service classes. Then, I create a custom interface for each service. For instance, I create DoSomethingService, I use an interface IDoSomethingService that inherits from IGenericService.</p>

<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 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: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
  <div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">interface</span> IGenericService {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; 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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>     <span style="color: #0000ff">void</span> Start();</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #0000ff">void</span> Stop();</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; 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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>  </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; 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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">interface</span> IDoSomethingService : IGenericService {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; 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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>  </pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> DoSomethingService : IDoSomethingService {</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; 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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>     <span style="color: #0000ff">void</span> Start() { <span style="color: #0000ff">return</span>; }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>     <span style="color: #0000ff">void</span> Stop(){ <span style="color: #0000ff">return</span>; }</pre>
<!--CRLF-->

    <pre style="border-bottom-style: none; text-align: left; 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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span> }</pre>
<!--CRLF--></div>
</div>

<p>Now, you can easily install your console application executable as a Windows service through the following command line: <font color="#9e7c7c">{console_exe} install</font>  Or <font color="#9e7c7c">{console_exe} uninstall</font> to uninstall it. 

  <br />Then, using Services Manager you can control the service as needed.</p>

<p>There’s another way to host services built by Topshelf called <a href="http://topshelf-project.com/documentation/shelving/" target="_blank">shelving</a> but I was interested in stand-alone Windows services that I can control through Services Manager.</p>

<p>That was a quick dumb of steps I went through during building my services. I hope it was useful. 
  <br />Questions are welcome :)</p><xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/WS-Knowledge/~4/4YuKYUZKv9c" height="1" width="1" /></div></content>



    <feedburner:origLink>http://waheedsayed.typepad.com/ws-knowledge/2011/06/building-a-stand-alone-windows-service-on-top-of-topshelf-1.html</feedburner:origLink></entry>
    <entry>
        <title />
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WS-Knowledge/~3/Vm3AMxo9ixY/todays-short-discussion-led-me-again-to-the-question-business-analyst-vs-system-analyst-i-feel-now-that-the-discussion-was-t.html" />
        <link rel="replies" type="text/html" href="http://waheedsayed.typepad.com/ws-knowledge/2011/02/todays-short-discussion-led-me-again-to-the-question-business-analyst-vs-system-analyst-i-feel-now-that-the-discussion-was-t.html" thr:count="1" thr:updated="2011-02-22T17:42:57+03:00" />
        <id>tag:typepad.com,2003:post-6a011571303a12970b014e5f63481a970c</id>
        <published>2011-02-22T15:47:28+03:00</published>
        <updated>2011-02-22T15:47:28+03:00</updated>
        <summary>Today's short discussion led me again to the question "Business Analyst vs System Analyst". I feel now that the discussion was talking more about BA than SA. I found this statement "The Systems Analyst role attempts to provide a bridge between the business requirements and the technical definition of the IT solution. The Business Analyst role is primarily about documenting and gathering the business requirements. The important point to note that the two roles are complimentary, you need both to make a successful IT project." Check http://bit.ly/g666lV for full article. I usually see the SA as a clever ex-developer who...</summary>
        <author>
            <name>Waheed Sayed</name>
        </author>
        
        
<content type="xhtml" xml:lang="en-US" xml:base="http://waheedsayed.typepad.com/ws-knowledge/"><div xmlns="http://www.w3.org/1999/xhtml">Today's short discussion led me again to the question "Business Analyst vs System Analyst". I feel now that the discussion was talking more about BA than SA. I found this statement "The Systems Analyst role attempts to provide a bridge between the business requirements and the technical definition of the IT solution. The Business Analyst role is primarily about documenting and gathering the business requirements. The important point to note that the two roles are complimentary, you need both to make a successful IT project." Check <a href="http://bit.ly/g666lV">http://bit.ly/g666lV</a> for full article. I usually see the SA as a clever ex-developer who understands building systems very well to put the first blueprint of the new system. Anyone else think the same? :)<xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/WS-Knowledge/~4/Vm3AMxo9ixY" height="1" width="1" /></div></content>



    <feedburner:origLink>http://waheedsayed.typepad.com/ws-knowledge/2011/02/todays-short-discussion-led-me-again-to-the-question-business-analyst-vs-system-analyst-i-feel-now-that-the-discussion-was-t.html</feedburner:origLink></entry>
    <entry>
        <title>Looking to Clouds!</title>
        <link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WS-Knowledge/~3/eRoIglA4Md0/looking-to-clouds-.html" />
        <link rel="replies" type="text/html" href="http://waheedsayed.typepad.com/ws-knowledge/2010/11/looking-to-clouds-.html" thr:count="0" />
        <id>tag:typepad.com,2003:post-6a011571303a12970b013488ce1963970c</id>
        <published>2010-11-08T18:21:55+03:00</published>
        <updated>2010-11-08T18:21:55+03:00</updated>
        <summary>Few days ago, I started looking to Clouds! Though, they were there for a while now, but I have been very busy looking down to duties I have. Before, I read about about Cloud Computing, Software as a Service, SaaS, Platform as a Service, PaaS, and Infrastructure as a Service, IaaS, but when I saw Window Azure, I felt this is different than what I imagined. I started collecting more data about Window Azure and I found a nice series on Channel 9, called Cloud Cover Show, which covers news, features, and tips about Windows Azure. I decided to dedicate...</summary>
        <author>
            <name>Waheed Sayed</name>
        </author>
        <category scheme="http://www.sixapart.com/ns/types#category" term="Software Development" />
        <category scheme="http://www.sixapart.com/ns/types#category" term="Windows Azure" />
        
        <category scheme="http://sixapart.com/ns/types#tag" term="azure" />
        <category scheme="http://sixapart.com/ns/types#tag" term="cloud_computing" />
        
<content type="xhtml" xml:lang="en-US" xml:base="http://waheedsayed.typepad.com/ws-knowledge/"><div xmlns="http://www.w3.org/1999/xhtml"><p>Few days ago, I started looking to Clouds! Though, they were there for a while now, but I have been very busy looking down to duties I have. Before, I read about about <a href="http://en.wikipedia.org/wiki/Cloud_computing" target="_blank" title="Cloud Computing">Cloud Computing</a>, Software as a Service, SaaS, Platform as a Service, PaaS, and Infrastructure as a Service, IaaS, but when I saw Window Azure, I felt this is different than what I imagined.</p>
<p>I started collecting more data about <a href="http://www.microsoft.com/windowsazure/" target="_blank" title="Windows Azure">Window Azure</a> and I found a nice series on Channel 9, called <a href="http://channel9.msdn.com/shows/Cloud+Cover/" target="_blank" title="Cloud Cover Show">Cloud Cover Show</a>, which covers news, features, and tips about Windows Azure. I decided to dedicate more time to try different aspects of Azure, so I have installed Windows Azure SDK 1.2.</p>
<p>Today, I found <a href="http://heroku.com/" target="_blank" title="Heroku">Heroku</a>, (pronounced her-OH-koo) is a cloud application platform for Ruby, as wrote on their site. I can find a similarity between anatomy of their structure &amp; anatomy of Windows Azure in a way it adds to the whole picture in mind. Also, considering Google's <a href="http://appengine.google.com/" target="_blank" title="AppEngine">AppEngine</a>, I think this will give us a <strong><span style="font-size: medium;"><span style="color: #00ff80;">co</span><span style="color: #00bf00;">lo</span><span style="color: #aa4d4e;">rf</span><span style="color: #bf00bf;">ul</span> </span></strong>sky with variety of clouds to host different kinds of applications :) <br />But, I think this is only conceptually, since that for all applications based on .Net Framework &amp; Microsoft technologies the only option is Windows Azure, which's a great option but still the only one too.</p>
<p style="direction: ltr;">The only sad news for me was that I couldn't open an Introductory Account because because of geographical obstacles. Currently, I live in Saudi Arabia and I couldn't find it on the list of Countries to choose. Also, Egypt, my home country, isn't available on the list too. I hope to find a solution soon.<br />In the mean time, I will study the subject locally on development fabric.</p>
<p>Puzzling Questions:</p>
<ul>
<li>Will future be heavily heading towards Cloud-based development? </li>
<li>Will on-premise hosting come to end in future?</li>
<li>Will few Giant companies, like Microsoft &amp; Google, dominate Cloud-based hosting? Is not this involves considerable risks?</li>
<li>How will competition take place in future on the light of cloud-based applications/hosting?</li>
</ul>
<p>Well, that was all in my mind till now, a newbie point of view :)</p>
<p>More elaboration on Windows Azure is expected as soon as I start a bet project.</p><xhtml:img xmlns:xhtml="http://www.w3.org/1999/xhtml" src="http://feeds.feedburner.com/~r/WS-Knowledge/~4/eRoIglA4Md0" height="1" width="1" /></div></content>



    <feedburner:origLink>http://waheedsayed.typepad.com/ws-knowledge/2010/11/looking-to-clouds-.html</feedburner:origLink></entry>
 
</feed><!-- ph=1 -->

