<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Software developer &#38; Web developer in Toronto and GTA</title>
	<atom:link href="http://www.yaplex.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.yaplex.com</link>
	<description>professional .net software developer and .net web developer</description>
	<lastBuildDate>Tue, 14 May 2013 03:02:18 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Git bare repository on shared network drive</title>
		<link>http://www.yaplex.com/git/git-bare-repository-on-shared-network-drive/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=git-bare-repository-on-shared-network-drive</link>
		<comments>http://www.yaplex.com/git/git-bare-repository-on-shared-network-drive/#comments</comments>
		<pubDate>Wed, 08 May 2013 02:13:58 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[git]]></category>
		<category><![CDATA[source control]]></category>

		<guid isPermaLink="false">http://www.yaplex.com/?p=811</guid>
		<description><![CDATA[<p>If you are working on Windows operation system and try to connect to bare git repository located on network drive, you can possible get the following error: ashapovalov@MW100604 /c/tfs/Develop (master) $ git push -u origin master fatal: &#039;\mw100604\resonate.git&#039; does not appear to be a git repository fatal: Could not read from remote repository. Please make [...]</p><p>The post <a href="http://www.yaplex.com/git/git-bare-repository-on-shared-network-drive/">Git bare repository on shared network drive</a> appeared first on <a href="http://www.yaplex.com">Software developer &amp; Web developer in Toronto and GTA</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>If you are working on Windows operation system and try to connect to bare git repository located on network drive, you can possible get the following error:</p>
<pre class="brush: bash;">ashapovalov@MW100604 /c/tfs/Develop (master)
$ git push -u origin master
fatal: &#039;\mw100604\resonate.git&#039; does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
</pre>
<p>So, let&#8217;s start for the beginning. I have a bare git repository located there:</p>
<pre class="brush: bash;">\\mw100604\resonate.git
</pre>
<p>It is a network drive, so in the beginning of path I have <b>\\</b> In my source code folder I initialized git</p>
<pre class="brush: bash;">ashapovalov@MW100604 /c/tfs/Develop (master)
$ git init
Initialized empty Git repository in c:/tfs/Develop/.git/
</pre>
<p>and add network path to git bare repository</p>
<pre class="brush: bash;">ashapovalov@MW100604 /c/tfs/Develop (master)
$ git remote add origin &#039;\\mw100604\resonate.git&#039;
</pre>
<p>But when I try to push I got an error message which I showed in the beginnig of the post. The reason is simple: double slash are replaced to single in git, which probably is easy to spot for unix developer, but not for Windows developer <img src='http://www.yaplex.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  To fix it just change back slash to slash</p>
<pre class="brush: bash;">$ git remote add origin &#039;//mw100604/resonate.git&#039;
</pre>
<p>Now you will be able to successfuly push your changes to git bare repository.</p>
<p>The post <a href="http://www.yaplex.com/git/git-bare-repository-on-shared-network-drive/">Git bare repository on shared network drive</a> appeared first on <a href="http://www.yaplex.com">Software developer &amp; Web developer in Toronto and GTA</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.yaplex.com/git/git-bare-repository-on-shared-network-drive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up Office 365 Exchange account on Google Android for Nexus 4 or Galaxy S4</title>
		<link>http://www.yaplex.com/device/setting-up-office-365-exchange-account-on-google-android-for-nexus-4-or-galaxy-s4/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=setting-up-office-365-exchange-account-on-google-android-for-nexus-4-or-galaxy-s4</link>
		<comments>http://www.yaplex.com/device/setting-up-office-365-exchange-account-on-google-android-for-nexus-4-or-galaxy-s4/#comments</comments>
		<pubDate>Tue, 07 May 2013 05:21:54 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[device]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[nexus 4]]></category>

		<guid isPermaLink="false">http://www.yaplex.com/?p=771</guid>
		<description><![CDATA[<p>My previous post “How to setup Office 365 Exchange account for Google Nexus 7” was quite popular and today I get my brand new Google Nexus 4 phone where I setup exchange account as well. In fact it’s not device but operation system, so the same guide will be helpful to all Android Jelly Beans [...]</p><p>The post <a href="http://www.yaplex.com/device/setting-up-office-365-exchange-account-on-google-android-for-nexus-4-or-galaxy-s4/">Setting up Office 365 Exchange account on Google Android for Nexus 4 or Galaxy S4</a> appeared first on <a href="http://www.yaplex.com">Software developer &amp; Web developer in Toronto and GTA</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>My previous post “<a href="http://www.yaplex.com/device/office-365-and-nexus-7-tablet-how-to-set-up-an-exchange-account-on-google-nexus-7-tablet/">How to setup Office 365 Exchange account for Google Nexus 7</a>” was quite popular and today I get my brand new Google Nexus 4 phone where I setup exchange account as well. In fact it’s not device but operation system, so the same guide will be helpful to all Android Jelly Beans devices, including new Samsung Galaxy S4.</p>
<p>To create an Exchange account you have to go to Settings-&gt;Accounts-&gt;Add Account</p>
<p>&nbsp;</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-Add-new-Account-from-Settings.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="Office 365 Exchange on Google Android - Add new Account from Settings" alt="Office 365 Exchange on Google Android - Add new Account from Settings" src="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-Add-new-Account-from-Settings_thumb.png" width="210" height="348" border="0" /></a></p>
<p>Then you have to choose “Corporate” account from the list of available accounts</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-Choose-Corporate-account.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="Office 365 Exchange on Google Android - Choose Corporate account" alt="Office 365 Exchange on Google Android - Choose Corporate account" src="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-Choose-Corporate-account_thumb.png" width="244" height="194" border="0" /></a></p>
<p>You will be asked to provide your user name and password. Your username is full Microsoft Office 365 (exchange) email address.</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-Provide-your-microsoft-exchange-username-and-password.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="Office 365 Exchange on Google Android - Provide your microsoft exchange username and password" alt="Office 365 Exchange on Google Android - Provide your microsoft exchange username and password" src="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-Provide-your-microsoft-exchange-username-and-password_th.png" width="244" height="187" border="0" /></a></p>
<p>After you press “Next” button Google will try to identify your settings and connect to your account, but it does it incorrect. The following screenshot shows settings which Google guessed for me.</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-Google-incorrectly-identified-your-settings.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="Office 365 Exchange on Google Android - Google incorrectly identified your settings" alt="Office 365 Exchange on Google Android - Google incorrectly identified your settings" src="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-Google-incorrectly-identified-your-settings_thumb.png" width="224" height="370" border="0" /></a></p>
<p>The username and server name are incorrect. Username should be your email address which you use to login to your Exchange mail server and the Server is your mail server which looks like this: <strong>pod12345.outlook.com</strong></p>
<p>The question is where do you get your server name? It’s easy. You have to navigate to <a title="http://portal.microsoftonline.com/" href="http://portal.microsoftonline.com/">http://portal.microsoftonline.com/</a> and login with your Office 365 exchange account credentials and press Outlook button. </p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-login-to-office-365.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="Office 365 Exchange on Google Android - login to office 365" alt="Office 365 Exchange on Google Android - login to office 365" src="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-login-to-office-365_thumb.png" width="360" height="148" border="0" /></a></p>
<p>You will be redirected to outlook web application. Now look at your url in browser, it looks like https://pod12345.outlook.com/owa/?xxxxxxxxxxx</p>
<p>where <strong>pod12345.outlook.com</strong> is your server name.</p>
<p>Now put correct server name and user name and press Next button on your device</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-Providing-correct-settings-for-exchange-account.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="Office 365 Exchange on Google Android - Providing correct settings for exchange account" alt="Office 365 Exchange on Google Android - Providing correct settings for exchange account" src="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-Providing-correct-settings-for-exchange-account_thumb.png" width="215" height="355" border="0" /></a></p>
<p>&nbsp;</p>
<table class="zebra">
<tbody>
<tr>
<td valign="top" width="150">Parameter</td>
<td valign="top" width="230">Value</td>
<td valign="top" width="373">Example</td>
</tr>
<tr>
<td valign="top" width="150">Domain\Username</td>
<td valign="top" width="230">full email address</td>
<td valign="top" width="373"><a href="&#x6d;&#x61;&#105;lt&#x6f;&#x3a;&#x66;&#105;rs&#x74;&#x2e;&#x6c;&#97;st&#x40;&#x63;&#x6f;&#109;pa&#x6e;&#x79;&#x2e;&#99;om">f&#x69;&#x72;s&#x74;&#x2e;l&#x61;&#x73;t&#64;&#x63;o&#109;&#x70;a&#110;&#x79;.&#99;&#x6f;m</a></td>
</tr>
<tr>
<td valign="top" width="150">Password</td>
<td valign="top" width="230">password to access your account</td>
<td valign="top" width="373"> </td>
</tr>
<tr>
<td valign="top" width="150">Server</td>
<td valign="top" width="230">Office 365 Exchange server name</td>
<td valign="top" width="373">pod12345.outlook.com</td>
</tr>
<tr>
<td valign="top" width="150">Use secure connection (SSL)</td>
<td valign="top" width="230">check it to secure your connection using SSL</td>
<td valign="top" width="373">yes</td>
</tr>
<tr>
<td valign="top" width="150">Accept all SSL certificates</td>
<td valign="top" width="230">unchecked by default</td>
<td valign="top" width="373"> </td>
</tr>
<tr>
<td valign="top" width="150">Client certificate</td>
<td valign="top" width="230">You don’t have any certificate for office 365</td>
<td valign="top" width="373">None</td>
</tr>
<tr>
<td valign="top" width="150">Port</td>
<td valign="top" width="230">connection port</td>
<td valign="top" width="373">443</td>
</tr>
</tbody>
</table>
<p>After you press next button, your device will ask you to allow remote control, press Ok button</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-Allow-remote-control.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="Office 365 Exchange on Google Android - Allow remote control" alt="Office 365 Exchange on Google Android - Allow remote control" src="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-Allow-remote-control_thumb.png" width="275" height="228" border="0" /></a></p>
<p>Next step will be to configure settings for your account. I would suggest leave all settings as by default, except first checkbox “Send email from this account by default” – I am going to use my exchange account as my default email account, so I checked it. But anyway it’s up to you, you can change all this settings depending on your needs.</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-your-account-settings.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="Office 365 Exchange on Google Android - your account settings" alt="Office 365 Exchange on Google Android - your account settings" src="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-your-account-settings_thumb.png" width="228" height="378" border="0" /></a></p>
<p>A couple of steps left after you press “Next” button. Now you have to name your account. I am leaving it as default value – my email address.</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-name-your-account.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="Office 365 Exchange on Google Android - name your account" alt="Office 365 Exchange on Google Android - name your account" src="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-name-your-account_thumb.png" width="244" height="169" border="0" /></a></p>
<p>The last step will be activate your device administrator. After your pressed “Activate” button, your account is ready to use.</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-activate.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="Office 365 Exchange on Google Android - activate" alt="Office 365 Exchange on Google Android - activate" src="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-activate_thumb.png" width="148" height="244" border="0" /></a></p>
<p>To use your account open Email application and enjoy!</p>
<p> <a href="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-run-mail-application.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="Office 365 Exchange on Google Android - run mail application" alt="Office 365 Exchange on Google Android - run mail application" src="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-run-mail-application_thumb.png" width="244" height="179" border="0" /></a>     <a href="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-exchange-inbox.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="Office 365 Exchange on Google Android - exchange inbox" alt="Office 365 Exchange on Google Android - exchange inbox" src="http://www.yaplex.com/wp-content/uploads/2013/05/Office-365-Exchange-on-Google-Android-exchange-inbox_thumb.png" width="244" height="159" border="0" /></a></p>
<p>The post <a href="http://www.yaplex.com/device/setting-up-office-365-exchange-account-on-google-android-for-nexus-4-or-galaxy-s4/">Setting up Office 365 Exchange account on Google Android for Nexus 4 or Galaxy S4</a> appeared first on <a href="http://www.yaplex.com">Software developer &amp; Web developer in Toronto and GTA</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.yaplex.com/device/setting-up-office-365-exchange-account-on-google-android-for-nexus-4-or-galaxy-s4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Aspect Oriented Programming (AOP) logging: Castle DynamicProxy vs Microsoft Policy Injection vs Postsharp</title>
		<link>http://www.yaplex.com/aop/aspect-oriented-programming-aop-logging-castle-dynamicproxy-vs-microsoft-policy-injection-vs-postsharp/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=aspect-oriented-programming-aop-logging-castle-dynamicproxy-vs-microsoft-policy-injection-vs-postsharp</link>
		<comments>http://www.yaplex.com/aop/aspect-oriented-programming-aop-logging-castle-dynamicproxy-vs-microsoft-policy-injection-vs-postsharp/#comments</comments>
		<pubDate>Sun, 10 Mar 2013 22:20:18 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[aop]]></category>

		<guid isPermaLink="false">http://www.yaplex.com/?p=473</guid>
		<description><![CDATA[<p>While researching around AOP framework I choose the following to test: Castle DynamicProxy Microsoft Policy Injection Block (part of Enterprise Library) PostSharp I have to say then PostSharp gave me the best AOP experience, I was able to produce clean and simple code to log calls to all methods and parameters, as well as return [...]</p><p>The post <a href="http://www.yaplex.com/aop/aspect-oriented-programming-aop-logging-castle-dynamicproxy-vs-microsoft-policy-injection-vs-postsharp/">Aspect Oriented Programming (AOP) logging: Castle DynamicProxy vs Microsoft Policy Injection vs Postsharp</a> appeared first on <a href="http://www.yaplex.com">Software developer &amp; Web developer in Toronto and GTA</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>While researching around AOP framework I choose the following to test:</p>
<ul>
<li><a href="http://www.yaplex.com/aop/improved-logging-using-castle-dynamicproxy-and-structuremap-with-log4net/">Castle DynamicProxy</a> </li>
<li><a href="http://www.yaplex.com/dot-net/improved-logging-with-microsoft-policy-injection-application-block/">Microsoft Policy Injection Block (part of Enterprise Library)</a> </li>
<li>PostSharp </li>
</ul>
<p>I have to say then PostSharp gave me the best AOP experience, I was able to produce clean and simple code to log calls to all methods and parameters, as well as return objects from my classes. But because that product is not free and licensing policy is too complex I have to eliminate PostSharp from further review. </p>
<p class="box-hint">NOTE: I do not mind to pay for software (in fact usually its company where you work pay for it), if the product is good, there is nothing wrong with making money on the product. The problem with license I have was then I can’t use PostSharp on build server. The build server is either managed by different department and you just don’t have access to install anything there or as it was in my case I use cloud TFS server at tfs.visualstudio.com so I just don’t have control over the server. If some time in the future PostSharp will have different license policy for their free version, probably I will use it.</p>
<h2>AOP logging with Castle DynamicProxy vs Microsoft Policy Injection</h2>
<p>So I have two frameworks left. Initially I tried Microsoft EnterpriceLibrary with Policy Injection. I like Microsoft products, so it was obvious for me to try Microsoft project first. It worked pretty well. You define interceptor class which will intercept calls to methods and create a proxy class by calling single methods. It also works very well in combination with various dependency injection framework. What I did not liked about that framework was the way how to configure it. I have to mark each class which required logging with special attribute and configure how to use that attribute in .config file. In fact from AOP point of view the framework behaves correct, you explicitly tells what classes should have logging and what does not require it, but I prefer the way where it will be less work for me.</p>
<p>On the other hand Castle DynamicProxy did not have such problems (but it still have ability to identify what classes should have logging and what should not have). The configuration was very easy and using StructureMap as a dependency injection framework I was able to wrap in proxy and intercept all classes implicitly. After working with this framework for some period of time I found it very convenient and don’t have any problems using it. </p>
<p class="box-hint">NOTE: also you can try Castle Windsor as a dependency injection framework, it’s pretty good and works very well with DynamicProxy, but I still prefer StructureMap.</p>
<p>What I did not liked in both frameworks is then wrapped class should have interface, so you can’t just take any class and wrap it in proxy. This limitation is not something then stop me from using it, in fact it force you to good practice of using interfaces instead of particular classes, which lead to better design and architecture. But that nice to have feature exists in PostSharp, where you can wrap any class, even if it does not have interface (in fact PostSharp works absolutely different, its doing his work during compile time while DynamicProxy and Policy Injection doing it during runtime, that’s is why it’s more powerful) </p>
<p>In conclusion, if money is not a problem and you have full control over the build server (I hope you are using build server J ) then PostSharp will provide you with best AOP experience. If you are already using Microsoft Enterprise Library in your project then choose Policy Injection block. Otherwise I suggest Castle DynamicProxy.</p>
<p>The post <a href="http://www.yaplex.com/aop/aspect-oriented-programming-aop-logging-castle-dynamicproxy-vs-microsoft-policy-injection-vs-postsharp/">Aspect Oriented Programming (AOP) logging: Castle DynamicProxy vs Microsoft Policy Injection vs Postsharp</a> appeared first on <a href="http://www.yaplex.com">Software developer &amp; Web developer in Toronto and GTA</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.yaplex.com/aop/aspect-oriented-programming-aop-logging-castle-dynamicproxy-vs-microsoft-policy-injection-vs-postsharp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Improved logging using Castle DynamicProxy and StructureMap with log4net</title>
		<link>http://www.yaplex.com/aop/improved-logging-using-castle-dynamicproxy-and-structuremap-with-log4net/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=improved-logging-using-castle-dynamicproxy-and-structuremap-with-log4net</link>
		<comments>http://www.yaplex.com/aop/improved-logging-using-castle-dynamicproxy-and-structuremap-with-log4net/#comments</comments>
		<pubDate>Sun, 10 Mar 2013 16:32:10 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[aop]]></category>

		<guid isPermaLink="false">http://www.yaplex.com/?p=469</guid>
		<description><![CDATA[<p>In the previous post I explained how to improve logging abilities of your application using AOP abilities of Microsoft Policy Injection Application Block, but you can do the same using different frameworks. In this post I will explain how to intercept calls to methods of your class using Castle DynamicProxy for wrapping your class in [...]</p><p>The post <a href="http://www.yaplex.com/aop/improved-logging-using-castle-dynamicproxy-and-structuremap-with-log4net/">Improved logging using Castle DynamicProxy and StructureMap with log4net</a> appeared first on <a href="http://www.yaplex.com">Software developer &amp; Web developer in Toronto and GTA</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>In the <a href="http://www.yaplex.com/dot-net/improved-logging-with-microsoft-policy-injection-application-block/">previous post I explained how to improve logging abilities of your application using AOP abilities of Microsoft Policy Injection Application Block</a>, but you can do the same using different frameworks.</p>
<p>In this post I will explain how to intercept calls to methods of your class using Castle DynamicProxy for wrapping your class in proxy and StructureMap to resolve dependency. All logging will be done using log4net instead of Console.WriteLine()</p>
<h2>Prerequisites for logging using log4net and aspect oriented programming</h2>
<p>Let’s create console application and add required references using Nuget</p>
<p>Install-Package Castle.Core<br />
Install-Package structuremap<br />
Install-Package log4net</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2013/03/image2.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" alt="image" src="http://www.yaplex.com/wp-content/uploads/2013/03/image_thumb2.png" width="420" height="144" border="0" /></a></p>
<p>Now create interface and implementation of Repository which will be our test object and let StructureMap know what class to return for our interface</p>
<pre class="brush: csharp; ruler: true;">public interface IMyRepository
{
    ICollection&lt;T&gt; GetAll&lt;T&gt;();
    T GetById&lt;T&gt;(Func&lt;T,bool&gt; predicate);
}</pre>
<p><a href="http://www.yaplex.com/wp-content/uploads/2013/03/image3.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" alt="image" src="http://www.yaplex.com/wp-content/uploads/2013/03/image_thumb3.png" width="499" height="66" border="0" /></a></p>
<p>Now we have to intercept creating of our class and wrap our class in proxy, we will do it using StructureMap intercepting feature. To create interceptor using StructureMap we have to create a new class and inherit it from TypeInterceptor interface. Then you have to implement MatchType and Process methods.</p>
<p>For now we are not interesting in MatchType method, so we will always return true, but inside of Process method we have to wrap the instance of our class in Proxy class using DynamicProxy object from Castle project.</p>
<p>Creating proxy is pretty simple, you create an instance of the ProxyGenerator class and call CreateInterfaceProxyWithTargetInterface and the last parameter of the method will be our logging interceptor which will intercept calls to methods of the class</p>
<p>So as you see we doing interception two times, first time with StructureMap we intercept creating of the instance of our class and wrapping our class in proxy and second time we are intercepting calls to methods of our class using DyanamicProxy and it’s the place where we will log our input parameters and output result of calling method.</p>
<p>Let’s StructureMap know then it should use our interceptor</p>
<pre class="brush: csharp; ruler: true;">static void Main(string[] args)
{
    ObjectFactory.Initialize(x=&gt;x.For&lt;IMyRepository&gt;().Use&lt;MyRepository&gt;());
    ObjectFactory.Configure(x =&gt; x.RegisterInterceptor(new StructureMapInterceptor()));
}</pre>
<p>The implementation of castle dynamicProxy interceptor is similar to Policy Application block interceptor from previous post</p>
<pre class="brush: csharp; ruler: true;">public void Intercept(IInvocation invocation)
{
    var logger = LogManager.GetLogger(invocation.TargetType);
    try
    {
        StringBuilder sb = null;
        if (logger.IsDebugEnabled)
        {
            sb = new StringBuilder(invocation.TargetType.FullName)
                .Append(&quot;.&quot;)
                .Append(invocation.Method)
                .Append(&quot;(&quot;);
            for (int i = 0; i &lt; invocation.Arguments.Length; i++)
            {
                if (i &gt; 0)
                    sb.Append(&quot;, &quot;);
                sb.Append(invocation.Arguments[i]);
            }
            sb.Append(&quot;)&quot;);
            logger.Debug(sb);
        }

        invocation.Proceed();
        if (logger.IsDebugEnabled)
        {

            logger.Debug(&quot;Result of &quot; + sb + &quot; is: &quot; + invocation.ReturnValue);
        }
    }
    catch (Exception e)
    {
        logger.Error(e);
        throw;
    }
}</pre>
<p>The difference are, in this case we use log4net to log information</p>
<p>As a result we get the following when run our application</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2013/03/image4.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" alt="image" src="http://www.yaplex.com/wp-content/uploads/2013/03/image_thumb4.png" width="568" height="145" border="0" /></a></p>
<p>&nbsp;</p>
<p class="box-download"><a href="https://github.com/yaplex/CodeSamples/tree/master/Dot%20Net/ImprovedLoggingUsingCastle">All source code to this post is available on Github</a></p>
<p>The post <a href="http://www.yaplex.com/aop/improved-logging-using-castle-dynamicproxy-and-structuremap-with-log4net/">Improved logging using Castle DynamicProxy and StructureMap with log4net</a> appeared first on <a href="http://www.yaplex.com">Software developer &amp; Web developer in Toronto and GTA</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.yaplex.com/aop/improved-logging-using-castle-dynamicproxy-and-structuremap-with-log4net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Improved logging with Microsoft Policy Injection Application Block</title>
		<link>http://www.yaplex.com/dot-net/improved-logging-with-microsoft-policy-injection-application-block/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=improved-logging-with-microsoft-policy-injection-application-block</link>
		<comments>http://www.yaplex.com/dot-net/improved-logging-with-microsoft-policy-injection-application-block/#comments</comments>
		<pubDate>Tue, 05 Mar 2013 05:17:50 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[.net]]></category>

		<guid isPermaLink="false">http://www.yaplex.com/?p=455</guid>
		<description><![CDATA[<p>Microsoft Policy Injection Application Block allows developer to intercept calls to methods, wrap that calls to proxy object and return proxy back to calling class. Later when some methods of the class are called, calls are made to proxy object, and inside the proxy, calls can be made to wrapped class. In that case developer [...]</p><p>The post <a href="http://www.yaplex.com/dot-net/improved-logging-with-microsoft-policy-injection-application-block/">Improved logging with Microsoft Policy Injection Application Block</a> appeared first on <a href="http://www.yaplex.com">Software developer &amp; Web developer in Toronto and GTA</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Microsoft Policy Injection Application Block allows developer to intercept calls to methods, wrap that calls to proxy object and return proxy back to calling class.<br />
Later when some methods of the class are called, calls are made to proxy object, and inside the proxy, calls can be made to wrapped class.<br />
In that case developer has full control over the proxy. He can<strong> log any input/output parameters</strong>, he can measure how much time it took to execute method and developer can even replace input/output parameters to something else.</p>
<p>In my case, I am interesting only in logging calls to the methods of wrapped class and logging for input/output results.</p>
<div class="box-info">As usual ,the world is not perfect and some limitation is applied to this approach. You can proxy your class only if it has interface.</div>
<p>I created a simple interface and class</p>
<pre class="brush: csharp; ruler: true; gutter: false;">public interface IMyRepository 
{ 
    IEnumerable&lt;Product&gt; GetAllProducts(); 
}</pre>
<p>The interface just supposed to return me a list of products from database or form external WCF service. To make it simple I created objects with <span style="font-family: Courier New;">new</span> operator when implemented the MyRepository class</p>
<h2>How to install Policy application block</h2>
<p>Next step is add reference to Policy Injection block. The best way to do it is use Nuget:</p>
<p>Run &#8220;Package manager console&#8221; from main menu &#8211; View-&gt;Other Windows-&gt;Package Manager Console</p>
<p>and type <span style="font-family: Courier New;">Install-Package EnterpriseLibrary.PolicyInjection</span></p>
<p>the last version of EnterpriseLibrary will be installed, including EnterpriseLibrary.Common and Unity</p>
<p>To wrap our class in Proxy we have to call</p>
<pre class="brush: csharp; ruler: true; gutter: false;">PolicyInjection.Wrap&lt;T&gt;(instance);</pre>
<p>Where T is our interface and <em>instance</em> is instance of our class</p>
<p>Then we have to mark class which we will wrap with special attribute Tag and parameter for the attribute should be name of the policy rule (it will be more easy to understand on the below sample</p>
<pre class="brush: csharp; ruler: true; gutter: false;">[Tag(&quot;Logging&quot;)] 
public class MyRepository : IMyRepository 
{ 
    public IEnumerable&amp;lt;Product&amp;gt; GetAllProducts() 
    { 
        // get it from database or from wcf service... 
    } 
}</pre>
<p>Parameter name &#8220;<strong>Logging</strong>&#8221; is the name of the rule in our app.config</p>
<pre class="brush: xml; ruler: true; gutter: false;">&lt;policyInjection&gt;
    &lt;policies&gt;
      &lt;add name=&quot;LoggingPolicy&quot;&gt;
        &lt;matchingRules&gt;
          &lt;add match=&quot;Logging&quot; ignoreCase=&quot;false&quot;
               type=&quot;Microsoft.Practices.EnterpriseLibrary.PolicyInjection.MatchingRules.TagAttributeMatchingRule, 
                        Microsoft.Practices.EnterpriseLibrary.PolicyInjection&quot; /&gt;
        &lt;/matchingRules&gt;
        &lt;handlers&gt;
          &lt;add order=&quot;0&quot;
               type=&quot;ImprovedLoggingWithMsPolicyInjection.Business.LoggingInterceptor, 
                        ImprovedLoggingWithMsPolicyInjection.Business&quot;
               name=&quot;My interceptor&quot; /&gt;
        &lt;/handlers&gt;
      &lt;/add&gt;
    &lt;/policies&gt;
&lt;/policyInjection&gt;</pre>
<h2>Implementing interceptor</h2>
<p>When it is done we have to implement our interceptor class, which is the most interesting part because we have to write code there <img src='http://www.yaplex.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Our interceptor has to implement <span style="font-family: Courier New;">ICallHandler</span> which has one property Order and method Invoke In addition your class should contain attribute</p>
<pre class="brush: csharp; ruler: true; gutter: false;">[ConfigurationElementType(typeof(CustomCallHandlerData))]</pre>
<p>and it should contain parameterized constructor</p>
<pre class="brush: csharp; ruler: true; gutter: false;">public LoggingInterceptor(NameValueCollection nameValueCollection)</pre>
<p>That is it, now you can execute your application and you will see the following:</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2013/03/image.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" alt="image" src="http://www.yaplex.com/wp-content/uploads/2013/03/image_thumb.png" width="581" height="127" border="0" /></a></p>
<p>As you can see we have automatic logging just before method call and immediately after call.</p>
<h2>Logging input and output parameters using our Interceptor</h2>
<p>One thing is still missing: we don&#8217;t log all input and output parameters of the method. Let&#8217;s add one more method to our interface</p>
<pre class="brush: csharp; ruler: true; gutter: false;">Product GetProduct(int id);</pre>
<p>which will return production by id</p>
<p>in this case we want to log our input and output parameters</p>
<p>In order to do it we have to</p>
<ol>
<li>Before call to method get all input parameters and print input parameters</li>
<li>Make a call to the method</li>
<li>After the call print output parameter</li>
</ol>
<p><a href="http://www.yaplex.com/wp-content/uploads/2013/03/image1.png"><img style="background-image: none; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-width: 0px;" title="image" alt="image" src="http://www.yaplex.com/wp-content/uploads/2013/03/image_thumb1.png" width="595" height="231" border="0" /></a></p>
<p>I did a small modification to the code: so now it shows calls to method in green and I modified <span style="font-family: Courier New;">ToString</span> method of the Product class to print all information about the product.</p>
<div class="box-download"><a title="download source code from github" href="https://github.com/yaplex/CodeSamples/tree/master/Dot%20Net/ImprovedLoggingWithMsPolicyInjection">All source codes for this post are available in Github</a></div>
<p>The post <a href="http://www.yaplex.com/dot-net/improved-logging-with-microsoft-policy-injection-application-block/">Improved logging with Microsoft Policy Injection Application Block</a> appeared first on <a href="http://www.yaplex.com">Software developer &amp; Web developer in Toronto and GTA</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.yaplex.com/dot-net/improved-logging-with-microsoft-policy-injection-application-block/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Source code for iPhone game Aliens Attack</title>
		<link>http://www.yaplex.com/iphone/source-code-for-iphone-game-aliens-attack/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=source-code-for-iphone-game-aliens-attack</link>
		<comments>http://www.yaplex.com/iphone/source-code-for-iphone-game-aliens-attack/#comments</comments>
		<pubDate>Sun, 06 Jan 2013 00:26:00 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[iphone]]></category>
		<category><![CDATA[ios]]></category>

		<guid isPermaLink="false">http://www.yaplex.com/?p=410</guid>
		<description><![CDATA[<p>Just published source code for my first iPhone game on GitHub. The game was developed and release to iTunes in 2011, but was never updated since the release. You can use the source codes to learn how to develop iPhone games. Also you can read about the game in press release at PRWeb http://www.prweb.com/releases/2011/5/prweb8396807.htm</p><p>The post <a href="http://www.yaplex.com/iphone/source-code-for-iphone-game-aliens-attack/">Source code for iPhone game Aliens Attack</a> appeared first on <a href="http://www.yaplex.com">Software developer &amp; Web developer in Toronto and GTA</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Just published source code for <a href="https://github.com/yaplex/AliensAttack">my first iPhone game on GitHub</a>. The game was developed and release to iTunes in 2011, but was never updated since the release. </p>
<p>You can use the source codes to learn how to develop iPhone games.</p>
<p>Also you can read about the game in press release at PRWeb</p>
<p><a title="http://www.prweb.com/releases/2011/5/prweb8396807.htm" href="http://www.prweb.com/releases/2011/5/prweb8396807.htm">http://www.prweb.com/releases/2011/5/prweb8396807.htm</a></p>
<p>The post <a href="http://www.yaplex.com/iphone/source-code-for-iphone-game-aliens-attack/">Source code for iPhone game Aliens Attack</a> appeared first on <a href="http://www.yaplex.com">Software developer &amp; Web developer in Toronto and GTA</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.yaplex.com/iphone/source-code-for-iphone-game-aliens-attack/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PowerShell: How to get execution folder</title>
		<link>http://www.yaplex.com/powershell/powershell-how-to-get-execution-folder/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=powershell-how-to-get-execution-folder</link>
		<comments>http://www.yaplex.com/powershell/powershell-how-to-get-execution-folder/#comments</comments>
		<pubDate>Thu, 03 Jan 2013 15:36:10 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[powershell]]></category>

		<guid isPermaLink="false">http://www.yaplex.com/?p=399</guid>
		<description><![CDATA[<p>Recently I explained how to install windows service using PowerShell, and path to binary file was hardcode in my sample, which is not very good, because you have to remember to change it if you decide to use different installation folder . There is a solution how to detect execution folder where you run your [...]</p><p>The post <a href="http://www.yaplex.com/powershell/powershell-how-to-get-execution-folder/">PowerShell: How to get execution folder</a> appeared first on <a href="http://www.yaplex.com">Software developer &amp; Web developer in Toronto and GTA</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Recently I explained how to <a href="http://www.yaplex.com/powershell/create-a-windows-service-using-powershell/">install windows service using PowerShell</a>, and path to binary file was hardcode in my sample, which is not very good, because you have to remember to change it if you decide to use different installation folder .  </p>
<p>There is a solution how to detect execution folder where you run your PowerShell script, in that case it does not matter where is your binaries located, you just run your install script and it detect execution folder automatically.
<pre class="brush: ps;toolbar: false;"># detect current execution directory
$directorypath = Split-Path $MyInvocation.MyCommand.Path</pre>
</p>
<p>So you will modify your script and it will look like this</p>
<pre class="brush: ps; ruler: true; highlight: [15,16,20,21];toolbar: false;">$serviceName = &quot;MyService&quot;
if (Get-Service $serviceName -ErrorAction SilentlyContinue)
{
    $serviceToRemove = Get-WmiObject -Class Win32_Service -Filter &quot;name=&#039;$serviceName&#039;&quot;
    $serviceToRemove.delete()
    &quot;service removed&quot;
}
else
{
    &quot;service does not exists&quot;
}

&quot;installing service&quot;

# current directory
$directorypath = Split-Path $MyInvocation.MyCommand.Path

$secpasswd = ConvertTo-SecureString &quot;MyP@$$w0rd&quot; -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential (&quot;.\MyUserName&quot;, $secpasswd)
# you need hardcode application name anyway
$binaryPath = $directorypath + &quot;\ApplicationName.exe&quot;
New-Service -name $serviceName -binaryPathName $binaryPath -displayName $serviceName -startupType Automatic -credential $mycreds

&quot;installation completed&quot;

</pre>
<p>The post <a href="http://www.yaplex.com/powershell/powershell-how-to-get-execution-folder/">PowerShell: How to get execution folder</a> appeared first on <a href="http://www.yaplex.com">Software developer &amp; Web developer in Toronto and GTA</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.yaplex.com/powershell/powershell-how-to-get-execution-folder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a windows service using PowerShell</title>
		<link>http://www.yaplex.com/powershell/create-a-windows-service-using-powershell/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=create-a-windows-service-using-powershell</link>
		<comments>http://www.yaplex.com/powershell/create-a-windows-service-using-powershell/#comments</comments>
		<pubDate>Thu, 01 Nov 2012 01:20:24 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[PowerShell]]></category>

		<guid isPermaLink="false">http://www.yaplex.com/?p=382</guid>
		<description><![CDATA[<p>Window PowerShell provides a number of helpful CmdLets for managing windows services, such as New-Service Get-Service Restart-Service Resume-Service Set-Service Start-Service Stop-Service Suspend-Service And create a new Windows Service using PowerShell “New-Service” CmdLet is very easy. The parameters description of CmdLet can be easily found on MSDN website, so I will not provide it there. I [...]</p><p>The post <a href="http://www.yaplex.com/powershell/create-a-windows-service-using-powershell/">Create a windows service using PowerShell</a> appeared first on <a href="http://www.yaplex.com">Software developer &amp; Web developer in Toronto and GTA</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Window PowerShell provides a number of helpful CmdLets for managing windows services, such as </p>
<p><a href="http://technet.microsoft.com/en-US/library/hh849830.aspx">New-Service</a>     <br /><a href="http://technet.microsoft.com/en-US/library/hh849804.aspx">Get-Service</a>     <br /><a href="http://technet.microsoft.com/en-US/library/hh849823.aspx">Restart-Service</a>     <br /><a href="http://technet.microsoft.com/en-US/library/hh849811.aspx">Resume-Service</a>     <br /><a href="http://technet.microsoft.com/en-US/library/hh849849.aspx">Set-Service</a>     <br /><a href="http://technet.microsoft.com/en-US/library/hh849825.aspx">Start-Service</a>     <br /><a href="http://technet.microsoft.com/en-US/library/hh849790.aspx">Stop-Service</a>     <br /><a href="http://technet.microsoft.com/en-US/library/hh849791.aspx">Suspend-Service</a></p>
<p>And <strong>create a new Windows Service using PowerShell “New-Service” CmdLet is very easy</strong>. The parameters description of CmdLet can be easily found on MSDN website, so I will not provide it there. I will just provide syntax and example of how it’s used in my project.</p>
<h2>The syntax for creating new windows service using PowerShell is following</h2>
<blockquote><p>New-Service [-Name] &lt;String&gt; [-BinaryPathName] &lt;String&gt; [-Credential &lt;PSCredential&gt; ] [-DependsOn &lt;String[]&gt; ] [-Description &lt;String&gt; ] [-DisplayName &lt;String&gt; ] [-StartupType &lt;ServiceStartMode&gt; ] [ &lt;CommonParameters&gt;]</p>
</blockquote>
<p>You can always type the command in your PowerShell window, but if you need to create the same service more than one time it’s better to create script and save it somewhere, for example as part of the project you want to install.</p>
<h3>Below is the example of script I used in my recent project to create windows service using PowerShell</h3>
<pre class="brush: ps; ruler: true; auto-links: false;">$serviceName = &quot;MyService&quot;

if (Get-Service $serviceName -ErrorAction SilentlyContinue)
{
    $serviceToRemove = Get-WmiObject -Class Win32_Service -Filter &quot;name='$serviceName'&quot;
    $serviceToRemove.delete()
    &quot;service removed&quot;
}
else
{
    &quot;service does not exists&quot;
}

&quot;installing service&quot;

$secpasswd = ConvertTo-SecureString &quot;MyPassword&quot; -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential (&quot;.\MYUser&quot;, $secpasswd)
$binaryPath = &quot;c:\servicebinaries\MyService.exe&quot;
New-Service -name $serviceName -binaryPathName $binaryPath -displayName $serviceName -startupType Automatic -credential $mycreds

&quot;installation completed&quot;</pre>
<h3>I will explain the code in details:</h3>
<p>If you already have service installed, you probably want it to be uninstall first (in fact you can just override your binaries and use the same service, but I prefer delete/create service). So at the line #3 I verified if the service already exists and if it exist I get WMI object <strong>Win32_service</strong> and remove the service.</p>
<div class="box-hint">Unfortunately PowerShell does not have CmdLet to removing service, so you have to remove service using WMI</div>
<p>Line #11: If no service with the provided name exists just do nothing.</p>
<p>If your service does not require to be run under some service account you do not need the following code</p>
<pre class="brush: ps; ruler: true; auto-links: false;">$secpasswd = ConvertTo-SecureString &quot;MyPassword&quot; -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential (&quot;.\MYUser&quot;, $secpasswd)</pre>
<p>but in my case service should be running under service account. In the code above I created <strong>PSCredential</strong> object with username and password provided as plain text. But if for some reasons your organization not allow it, you can use the following code to ask credentials from the user who will execute script</p>
<pre class="brush: ps; ruler: true; auto-links: false;">$mycredentials = Get-Credential</pre>
<p>in that case you will get window asking you for username and password</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2012/11/image1.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.yaplex.com/wp-content/uploads/2012/11/image_thumb1.png" width="293" height="246" /></a></p>
<p>&#160;</p>
<p>And finally at the line #19 you <strong>create a new Windows Service using PowerShell</strong> CmdLet <strong>New-Service</strong> providing all parameters you need</p>
<p><a href="https://github.com/yaplex/CodeSamples/blob/master/PowerShell/Install-Windows-Service.ps1">PowerShell script to create a new Windows Service can be downloaded from GitHub</a></p>
<p>More code samples at: <a title="https://github.com/yaplex/CodeSamples" href="https://github.com/yaplex/CodeSamples">https://github.com/yaplex/CodeSamples</a></p>
<p>The post <a href="http://www.yaplex.com/powershell/create-a-windows-service-using-powershell/">Create a windows service using PowerShell</a> appeared first on <a href="http://www.yaplex.com">Software developer &amp; Web developer in Toronto and GTA</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.yaplex.com/powershell/create-a-windows-service-using-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Office 365 and Nexus 7 tablet: How to Set up an Exchange account on Google Nexus 7 tablet</title>
		<link>http://www.yaplex.com/device/office-365-and-nexus-7-tablet-how-to-set-up-an-exchange-account-on-google-nexus-7-tablet/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=office-365-and-nexus-7-tablet-how-to-set-up-an-exchange-account-on-google-nexus-7-tablet</link>
		<comments>http://www.yaplex.com/device/office-365-and-nexus-7-tablet-how-to-set-up-an-exchange-account-on-google-nexus-7-tablet/#comments</comments>
		<pubDate>Wed, 24 Oct 2012 18:00:47 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[device]]></category>
		<category><![CDATA[google nexus 7]]></category>
		<category><![CDATA[microsoft exchange]]></category>
		<category><![CDATA[office 365]]></category>

		<guid isPermaLink="false">http://www.yaplex.com/?p=266</guid>
		<description><![CDATA[<p>Our email hosting in the Cloud within Office 365 from Microsoft. And unfortunately my Nexus 7 tablet can’t detect Microsoft exchange server when I try to setup my email account. I never have any problems with iPhone or Outlook so I was puzzled why it does not work for me. After I provided the email [...]</p><p>The post <a href="http://www.yaplex.com/device/office-365-and-nexus-7-tablet-how-to-set-up-an-exchange-account-on-google-nexus-7-tablet/">Office 365 and Nexus 7 tablet: How to Set up an Exchange account on Google Nexus 7 tablet</a> appeared first on <a href="http://www.yaplex.com">Software developer &amp; Web developer in Toronto and GTA</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Our email hosting in the Cloud within Office 365 from Microsoft. And unfortunately my Nexus 7 tablet can’t detect Microsoft exchange server when I try to setup my email account. I never have any problems with iPhone or Outlook so I was puzzled why it does not work for me.</p>
<p>After I provided the email address and password and press next button I got a message “Couldn’t finish”, “Couldn’t open connection to server.”</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2012/08/nexus-7-exchange-could-not-connect-to-the-server.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="nexus-7-exchange-could-not-connect-to-the-server" src="http://www.yaplex.com/wp-content/uploads/2012/08/nexus-7-exchange-could-not-connect-to-the-server_thumb.jpg" alt="nexus-7-exchange-could-not-connect-to-the-server" width="399" height="146" border="0" /></a></p>
<p>I goggled about the issue, but did not found the solution, although it was a lot of questions how to do it.</p>
<p>After some research I found <strong>how to setup Microsoft exchange account on Google Nexus 7 tablet</strong>.</p>
<h2>Setting up Exchange email account on Google Nexus 7 tablet</h2>
<p>Press “Home” button on your screen to get access to all applications and settings</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2012/08/press-home-button.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="press-home-button" src="http://www.yaplex.com/wp-content/uploads/2012/08/press-home-button_thumb.png" alt="press-home-button" width="173" height="275" border="0" /></a></p>
<p>&nbsp;</p>
<p>Then go to Settings</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2012/08/open-settings.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="open-settings" src="http://www.yaplex.com/wp-content/uploads/2012/08/open-settings_thumb.png" alt="open-settings" width="179" height="284" border="0" /></a></p>
<p>And press “Add Account” button</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2012/08/add-account.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="add-account" src="http://www.yaplex.com/wp-content/uploads/2012/08/add-account_thumb.png" alt="add-account" width="179" height="284" border="0" /></a></p>
<p>&nbsp;</p>
<p>Choose “Email” account from the list. (Probably for you can also choose “Corporate” but I did not verified if it will work and how)</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2012/08/add-email-account.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="add-email-account" src="http://www.yaplex.com/wp-content/uploads/2012/08/add-email-account_thumb.png" alt="add-email-account" width="180" height="285" border="0" /></a></p>
<p>&nbsp;</p>
<p>Type your email address and password</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2012/08/type-email-address-and-password.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="type-email-address-and-password" src="http://www.yaplex.com/wp-content/uploads/2012/08/type-email-address-and-password_thumb.png" alt="type-email-address-and-password" width="298" height="287" border="0" /></a></p>
<p>And press “Exchange” button to select your account type</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2012/08/select-exchange-account-type.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="select-exchange-account-type" src="http://www.yaplex.com/wp-content/uploads/2012/08/select-exchange-account-type_thumb.png" alt="select-exchange-account-type" width="191" height="303" border="0" /></a></p>
<p>&nbsp;</p>
<p>After that you will be navigated to a Server settings window, with default setting for your exchange server. But the default settings are incorrect, so you have to provide correct settings there.</p>
<table class="zebra" width="802" border="0" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td valign="top" width="211">Parameter</td>
<td valign="top" width="327">value</td>
<td valign="top" width="262">example</td>
</tr>
<tr>
<td valign="top" width="211">Domain\Username</td>
<td valign="top" width="327">full email address with name and domain</td>
<td valign="top" width="262"><a href="&#109;&#x61;i&#x6c;t&#x6f;:&#x79;o&#117;&#x72;&#46;&#x6e;a&#x6d;e&#x40;d&#111;&#x6d;&#97;&#x69;n&#x2e;c&#x6f;m">&#121;&#x6f;u&#x72;.&#x6e;a&#109;&#x65;&#64;&#x64;o&#x6d;a&#105;&#x6e;.&#x63;o&#x6d;</a></td>
</tr>
<tr>
<td valign="top" width="211">Password</td>
<td valign="top" width="327">yours account password</td>
<td valign="top" width="262"></td>
</tr>
<tr>
<td valign="top" width="211">Server</td>
<td valign="top" width="327">Outlook server name (read below where you can find it)</td>
<td valign="top" width="262">abcProd00111.outlook.com</td>
</tr>
<tr>
<td valign="top" width="211">Port</td>
<td valign="top" width="327">default value</td>
<td valign="top" width="262">443</td>
</tr>
<tr>
<td valign="top" width="211">Use secure connection (SSL)</td>
<td valign="top" width="327">default value</td>
<td valign="top" width="262">check to use it</td>
</tr>
<tr>
<td valign="top" width="211">Accept all SSL certificates</td>
<td valign="top" width="327">default value</td>
<td valign="top" width="262">unchecked</td>
</tr>
<tr>
<td valign="top" width="211">Client certificate</td>
<td valign="top" width="327">default value</td>
<td valign="top" width="262">none</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>The Exchange server name is the same as you see when you use webmail. For example in case of Microsoft Office 365 you type in your browser address “portal.microsoftonline.com” and after you provide your username and password it redirect you to address similar to “abcprd01234.outlook.com”</p>
<p>In case if your company has it’s own dedicated Exchange server, the address can be similar to “owa.yourdomain.com”, but if you don’t know it, please ask your administrator.</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2012/08/server-settings.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="server-settings" src="http://www.yaplex.com/wp-content/uploads/2012/08/server-settings_thumb.png" alt="server-settings" width="218" height="347" border="0" /></a></p>
<p>&nbsp;</p>
<p>Press Ok to allow remote security administration</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2012/08/allow-remote-administration.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="allow-remote-administration" src="http://www.yaplex.com/wp-content/uploads/2012/08/allow-remote-administration_thumb.png" alt="allow-remote-administration" width="315" height="130" border="0" /></a></p>
<p>&nbsp;</p>
<p>Modify account options or leave default settings and press Next button</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2012/08/account-options.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="account-options" src="http://www.yaplex.com/wp-content/uploads/2012/08/account-options_thumb.png" alt="account-options" width="193" height="307" border="0" /></a></p>
<p>&nbsp;</p>
<p>Give a name to account, or leave as default (your email address)</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2012/08/give-a-name-to-account.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="give-a-name-to-account" src="http://www.yaplex.com/wp-content/uploads/2012/08/give-a-name-to-account_thumb.png" alt="give-a-name-to-account" width="244" height="218" border="0" /></a></p>
<p>The last step is activate device administrator</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2012/08/activate-device-administrator.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="activate-device-administrator" src="http://www.yaplex.com/wp-content/uploads/2012/08/activate-device-administrator_thumb.png" alt="activate-device-administrator" width="310" height="306" border="0" /></a></p>
<p>&nbsp;</p>
<p>That’s it. Now you can open Email from “All programs”</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2012/08/open-email.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="open-email" src="http://www.yaplex.com/wp-content/uploads/2012/08/open-email_thumb.png" alt="open-email" width="185" height="293" border="0" /></a></p>
<p>&nbsp;</p>
<p>And enjoy reading email on your Nexus 7 tablet. Now all your mail are synchronised with Microsoft Exchange.</p>
<p>&nbsp;</p>
<p><a href="http://www.yaplex.com/wp-content/uploads/2012/08/enjoy-email.png"><img style="background-image: none; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px; border-width: 0px;" title="enjoy-email" src="http://www.yaplex.com/wp-content/uploads/2012/08/enjoy-email_thumb.png" alt="enjoy-email" width="235" height="373" border="0" /></a></p>
<p>&nbsp;</p>
<div class="box-note">The article explained <strong>how to setup an Exchange account on Google Nexus 7 tablet</strong>.</div>
<p>The post <a href="http://www.yaplex.com/device/office-365-and-nexus-7-tablet-how-to-set-up-an-exchange-account-on-google-nexus-7-tablet/">Office 365 and Nexus 7 tablet: How to Set up an Exchange account on Google Nexus 7 tablet</a> appeared first on <a href="http://www.yaplex.com">Software developer &amp; Web developer in Toronto and GTA</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.yaplex.com/device/office-365-and-nexus-7-tablet-how-to-set-up-an-exchange-account-on-google-nexus-7-tablet/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Global.asax file events for Application and Session</title>
		<link>http://www.yaplex.com/asp-net/global-asax-file-events-for-application-and-session/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=global-asax-file-events-for-application-and-session</link>
		<comments>http://www.yaplex.com/asp-net/global-asax-file-events-for-application-and-session/#comments</comments>
		<pubDate>Sun, 21 Oct 2012 22:00:50 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[asp.net]]></category>

		<guid isPermaLink="false">http://www.yaplex.com/?p=372</guid>
		<description><![CDATA[<p>Global.asax file comes in ASP.NET from ASP language. This file contains events for Application and Session, and global.asax must be in the root directory of .net web application. Below is the list of events in global.asax file you can call. Application events in global.asax: Application_Start: This event used to set up an application environment and [...]</p><p>The post <a href="http://www.yaplex.com/asp-net/global-asax-file-events-for-application-and-session/">Global.asax file events for Application and Session</a> appeared first on <a href="http://www.yaplex.com">Software developer &amp; Web developer in Toronto and GTA</a>.</p>]]></description>
				<content:encoded><![CDATA[<p>Global.asax file comes in ASP.NET from ASP language. This file contains events for Application and Session, and global.asax must be in the root directory of .net web application.</p>
<p>Below is the list of events in global.asax file you can call.</p>
<h4>Application events in global.asax:</h4>
<p><strong>Application_Start</strong>:<br />
This event used to set up an application environment and called only when the application starts first time.</p>
<p><strong>Application_Init</strong>:<br />
This method occurs after Application_Start and is used for initializing your code.</p>
<p><strong>Application_Disposed</strong>:<br />
This event occurs before destroying an instance of an application.</p>
<p><strong>Application_Error</strong>:<br />
This event is used to handle all unhandled exceptions in the application. It&#8217;s the best place to put your error tracking mechanism.</p>
<p><strong>Application_End</strong>:<br />
Like classic ASP method it used to clean up variables and memory while application ends.</p>
<p><strong>Application_BeginRequest</strong>:<br />
This event occurs when a client makes a request to any pages of the application. It can be useful for example to open connection to database for all request.</p>
<p><strong>Application_EndRequest</strong>:<br />
This is the last request to the page.</p>
<p><strong>Application_PreRequestHandlerExecute</strong>:<br />
This event occurs before ASP.Net begins executing a handler such as a page or a web service. At this point, the session state is available.</p>
<p><strong>Application_PostRequestHandlerExecute</strong>:<br />
This method occurs when the ASP.Net handler finishes execution.</p>
<p><strong>Application_PreSendRequestHeaders</strong>:<br />
This event occurs just before ASP.Net sends HTTP Headers to the client. You can use it if you want to modify a header</p>
<p><strong>Application_PreSendRequestContent</strong>:<br />
This event occurs just before sending content to the client.</p>
<p><strong>Application_AcquireRequestState</strong>:<br />
This event occurs when ASP.Net acquires the current state (eg. Session state) associated with the current request.</p>
<p><strong>Application_ReleaseRequestState</strong>:<br />
This event occurs after ASP.NET finishes executing all request handlers and causes state modules to save the current state data.</p>
<p><strong>Application_AuthenticateRequest</strong>:<br />
This event occurs when the identity of the current user has been established as valid by the security module .</p>
<p><strong>Application_AuthorizeRequest</strong>:<br />
This event occurs when the user has been authorized to access the resources of the security module .</p>
<h4>Session events in global.asax:</h4>
<p><strong>Session_Start</strong>:<br />
As with classic ASP, this event is triggered when any new user accesses the web site.</p>
<p><strong>Session_End</strong>:<br />
As with classic ASP, this event is triggered when a user&#8217;s session times out or ends. The default session timeout is 20 min.</p>
<p>The post <a href="http://www.yaplex.com/asp-net/global-asax-file-events-for-application-and-session/">Global.asax file events for Application and Session</a> appeared first on <a href="http://www.yaplex.com">Software developer &amp; Web developer in Toronto and GTA</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://www.yaplex.com/asp-net/global-asax-file-events-for-application-and-session/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
