<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">

<channel>
	<title>Alteridem Consulting</title>
	
	<link>http://www.alteridem.net</link>
	<description>Software by Design</description>
	<lastBuildDate>Fri, 02 Sep 2011 14:21:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/AlteridemConsulting" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="alteridemconsulting" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>.NET Application Settings</title>
		<link>http://www.alteridem.net/2011/09/02/net-application-settings/</link>
		<comments>http://www.alteridem.net/2011/09/02/net-application-settings/#comments</comments>
		<pubDate>Fri, 02 Sep 2011 14:11:58 +0000</pubDate>
		<dc:creator>Robert Prouse</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Tips'n'Tricks]]></category>

		<guid isPermaLink="false">http://www.alteridem.net/2011/09/02/net-application-settings/</guid>
		<description><![CDATA[Application Settings are the recommended way to save state between runs of your program. Long gone are the days of using the registry or INI files to save information. The only problem with Application Settings though is that they tend to disappear whenever you release a new version of your application. Fortunately, it is easy [...]]]></description>
			<content:encoded><![CDATA[<p>Application Settings are the recommended way to save state between runs of your program. Long gone are the days of using the registry or INI files to save information. The only problem with Application Settings though is that they tend to disappear whenever you release a new version of your application. Fortunately, it is easy to fix this with some boiler plate code.</p>
<p>First, we need to make sure that our project has a settings file. It is usually under the Properties node of the project. If it is not, right click on the solution and <strong>Add | New Item… | Visual C# Items | General | Settings File</strong> and name it <em>Settings.settings.</em> Next, drag it and drop it in your project’s Properties folder.</p>
<p>Next, you need to add a bool User setting called <strong>UpgradeRequired</strong> and default it to true. Next, at the very beginning of your Main, you check if <strong>UpgradeRequired</strong> is true, and if it is, upgrade the settings, set <strong>UpgradeRequired</strong> to false and save out the settings. This will pull in the settings from previous versions of your application.</p>
<p>Your settings should look like this,</p>
<p><img style="display: inline" title="settings" alt="settings" src="http://www.alteridem.net/wp-content/uploads/2011/09/settings.png" width="416" height="106"></p>
<p>The code should look like this,</p>
<pre name="code" class="c#:nogutter">static void Main( string[] args )
{
   // Upgrade settings if required
   if ( Properties.Settings.Default.UpgradeRequired )
   {
      Properties.Settings.Default.Upgrade();
      Properties.Settings.Default.UpgradeRequired = false;
      Properties.Settings.Default.Save();
   }

   // Do work...

   // At the end of main, save out any changes to settings
   Properties.Settings.Default.Save();
}</pre>
<p>Now you just need to create new settings and use them in your application. Any setting with <strong>Application</strong> scope will be set in your <em>app.config</em> and will be read-only. This is often used for connection strings and other information that is unlikely to change. <strong>User</strong> scoped settings also have their default values in <em>app.config</em>, but any changes are written out to an XML file in the user’s <em>AppData</em> folder.</p>
<p>Also, notice that code gets generated for any setting that you create and you access it through a property on <em>Properties.Settings.Default</em>. You can use any complex type for a setting, including classes in your application, as long as they are <strong>Serializable</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alteridem.net/2011/09/02/net-application-settings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debugging Ruby on Windows using RubyMine</title>
		<link>http://www.alteridem.net/2011/01/05/debugging-ruby-on-windows-using-rubymine/</link>
		<comments>http://www.alteridem.net/2011/01/05/debugging-ruby-on-windows-using-rubymine/#comments</comments>
		<pubDate>Wed, 05 Jan 2011 19:43:07 +0000</pubDate>
		<dc:creator>Robert Prouse</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[RubyMine]]></category>

		<guid isPermaLink="false">http://www.alteridem.net/2011/01/05/debugging-ruby-on-windows-using-rubymine/</guid>
		<description><![CDATA[Most of the installation instructions for the ruby debugger that I found were out of date for Windows, so I thought it would be useful to document how I got it working. First, you should start with Ruby installed from the RubyInstaller. If you have any problems with getting debugging working, I would suggest installing [...]]]></description>
			<content:encoded><![CDATA[<p>Most of the installation instructions for the ruby debugger that I found were out of date for Windows, so I thought it would be useful to document how I got it working. </p>
<ol>
<li>First, you should start with Ruby installed from the <a href="http://rubyinstaller.org/downloads/">RubyInstaller</a>. If you have any problems with getting debugging working, I would suggest installing Ruby fresh from here and trying again. </li>
<li>Second, you need to install DevKit. Download DevKit from the <a href="http://rubyinstaller.org/downloads/">RubyInstaller</a> page, then follow the installation instructions on the <a href="https://github.com/oneclick/rubyinstaller/wiki/development-kit">Development Kit</a> page. Their instructions are thorough, so I won’t reproduce them here. The DevKit install has changed recently and this was part of my problem getting the debugging gem installed. </li>
<li>Install the <strong>ruby-debug-ide19</strong> gem with the following command line.
<pre class="code">gem install ruby-debug-ide19 –platform=ruby</pre>
</li>
<li>You should now be able to debug in <a href="http://www.jetbrains.com/ruby/">RubyMine</a>. When I started debugging in <a href="http://www.jetbrains.com/ruby/">RubyMine</a>, it prompted to install additional debugging gems. I allowed it and they installed fine and debugging started.
<p></li>
<ol type="a">
<li>Set a breakpoint by clicking in the gutter where you want the breakpoint
<p><img style="background-image: none; border-right-width: 0px; margin: 0px 0px 10px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="breakpoint" border="0" alt="breakpoint" src="http://www.alteridem.net/wp-content/uploads/2011/01/breakpoint.png" width="186" height="60" /> </li>
<li>Select your run/debug configuration in the toolbar and click on the <strong>Debug</strong> button
<p><img style="background-image: none; border-right-width: 0px; margin: 0px 0px 10px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="debug" border="0" alt="debug" src="http://www.alteridem.net/wp-content/uploads/2011/01/debug.png" width="240" height="67" /> </li>
<li>Visit the page you want to debug in your browser. You should hit the breakpoint and see the callstack and the values of all the variables in scope.
<p><a href="http://www.alteridem.net/wp-content/uploads/2011/01/watch.png"><img style="background-image: none; border-right-width: 0px; margin: 0px 0px 10px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="watch" border="0" alt="watch" src="http://www.alteridem.net/wp-content/uploads/2011/01/watch_thumb.png" width="644" height="204" /></a> </li>
<li>You should now be able to step through the code. See the <a href="http://www.jetbrains.com/ruby/webhelp/debugging.html">RubyMine debugging documentation</a> for more help. </li>
</ol>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.alteridem.net/2011/01/05/debugging-ruby-on-windows-using-rubymine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debugging PHP on Windows with NetBeans</title>
		<link>http://www.alteridem.net/2010/11/10/debugging-php-on-windows-with-netbeans/</link>
		<comments>http://www.alteridem.net/2010/11/10/debugging-php-on-windows-with-netbeans/#comments</comments>
		<pubDate>Wed, 10 Nov 2010 17:52:08 +0000</pubDate>
		<dc:creator>Robert Prouse</dc:creator>
				<category><![CDATA[NetBeans]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.alteridem.net/2010/11/10/debugging-php-on-windows-with-netbeans/</guid>
		<description><![CDATA[It seems that whenever I set up a new computer to debug PHP, I need to Google around to remind myself of the steps, so I thought I would document them here for reference. The following is for an XAMPP Apache/PHP install, but the basic steps are the same for any PHP install. Install and [...]]]></description>
			<content:encoded><![CDATA[<p>It seems that whenever I set up a new computer to debug PHP, I need to Google around to remind myself of the steps, so I thought I would document them here for reference. The following is for an <a href="http://www.apachefriends.org/en/xampp.html">XAMPP</a> Apache/PHP install, but the basic steps are the same for any PHP install. </p>
<h3>Install and Configure Xdebug for PHP</h3>
<p>The first thing you need to do is get the <a href="http://xdebug.org/">Xdebug extension</a> for PHP installed and configured. Luckily, <a href="http://www.apachefriends.org/en/xampp.html">XAMPP</a> ships with <a href="http://xdebug.org/">Xdebug </a>and has the configuration already in php.ini, so you just need to make some minor changes and restart Apache. </p>
<ol>
<li>If you are also using <a href="http://www.apachefriends.org/en/xampp.html">XAMPP</a>, skip this step. If you are using an install of PHP without the Xdebug extension, go to the <a href="http://xdebug.org/find-binary.php">Xdebug Find Binary</a> page, paste in the output of phpinfo() or php –i and they will provide a link to the extension and custom installation instructions. </li>
<li>Open php.ini in your favourite editor. For <a href="http://www.apachefriends.org/en/xampp.html">XAMPP</a>, it is likely in C:\xampp\php. </li>
<li>Find and uncomment the extension.
<pre class="code">zend_extension = &quot;C:\xampp\php\ext\php_xdebug.dll&quot;</pre>
</li>
<li>Find the [XDebug] section and uncomment and/or edit the following values. Many of these are defaults, but I am listing them just in case you have different values.
<pre class="code">xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 1
xdebug.remote_enable = 1
xdebug.remote_host = &quot;localhost&quot;
xdebug.remote_handler = &quot;dbgp&quot;
xdebug.remote_mode = &quot;req&quot;
xdebug.remote_port = 9000
xdebug.trace_output_dir = &quot;C:\xampp\tmp&quot;</pre>
</li>
<li>Restart Apache with the XAMPP control panel. </li>
<li>Bring up <a title="http://localhost/xampp/" href="http://localhost/xampp/">http://localhost/xampp/</a> and view phpinfo(). You should see Xdebug mentioned twice, once under the Zend engine and then as a PHP module.
<p><img style="background-image: none; border-right-width: 0px; margin: 10px auto 5px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="zend" border="0" alt="zend" src="http://www.alteridem.net/wp-content/uploads/2010/11/zend.png" width="608" height="88" /> </p>
<p><img style="background-image: none; border-right-width: 0px; margin: 5px auto 10px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="module" border="0" alt="module" src="http://www.alteridem.net/wp-content/uploads/2010/11/module.png" width="607" height="167" /> </li>
<li>You are done and ready to debug. </li>
</ol>
<h3>Debug with NetBeans</h3>
<p>What is not to love about <a href="http://netbeans.org">NetBeans</a>? You can use it for Java, PHP, Ruby, Html and C/C++. It integrates well with many bug tracking and source control systems. It provides IntelliSense, database management, works great with <a href="http://www.smarty.net/">Smarty templates</a> and allows you to debug your code. If you haven’t tried <a href="http://netbeans.org">NetBeans</a> yet, I highly recommend it.</p>
<ol>
<li>Start the IDE and load your PHP project. In the Project window, right click on your project and select <strong>Properties</strong>. Go to the <strong>Run Configuration</strong> node. You should be running as a Local Web Site. The Project URL should point to the root of your project directory and the Index File should be the file you want to launch into.<img style="background-image: none; border-right-width: 0px; margin: 5px auto 10px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="properties" border="0" alt="properties" src="http://www.alteridem.net/wp-content/uploads/2010/11/properties.png" width="623" height="348" /> </li>
<li>Right click again on your project. You can select <strong>Debug</strong> from here and get going right away, but if you first select <strong>Set as Main Project</strong>, you can just launch into the debugger with the <strong>Debug Main Project</strong> button on the toolbar or <strong>Ctrl+F5</strong>. (If <strong>Debug</strong> is not enabled, you probably need to enable the PHP plugin in NetBeans. Go to <strong>Tools | Plugins</strong>, click the <strong>Installed</strong> tab and make sure PHP is enabled.
<p><img style="background-image: none; border-right-width: 0px; margin: 5px auto 10px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="project" border="0" alt="project" src="http://www.alteridem.net/wp-content/uploads/2010/11/project.png" width="275" height="246" /> </li>
<li>When you start debugging, NetBeans will launch the browser to your start page. Notice how it appended the variable XDEBUG_SESSION_START=netbeans-xdebug to the end of the URL to start Apache debugging. If you see any Windows Firewall prompts at this point, accept them. </li>
<li>As the page loads, NetBeans will break on the first line of PHP code. The line will be highlighted and there will be a little green arrow in the margin to indicate the current line of execution.<br />
    <br /><img style="background-image: none; border-right-width: 0px; margin: 5px auto 10px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="debug1" border="0" alt="debug1" src="http://www.alteridem.net/wp-content/uploads/2010/11/debug1.png" width="381" height="104" /> </li>
<li>Congratulations, you are debugging. From here, you can set breakpoints by right clicking on the margin of your code and selecting <strong>Breakpoint | Toggle Line Breakpoint</strong>. You can step through code (<strong>F8</strong>) using the debug toolbar (if you don’t see it, right click on the toolbars and enable it.) You can inspect or even change variables and view the call stack.
<p><img style="background-image: none; border-right-width: 0px; margin: 5px auto 10px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="debug2" border="0" alt="debug2" src="http://www.alteridem.net/wp-content/uploads/2010/11/debug2.png" width="260" height="60" /> </li>
<li>If you are new to debugging code, read more about what you can do in the article on the NetBeans site,
<p><a href="http://netbeans.org/kb/docs/php/debugging.html">Debugging PHP Source Code in the NetBeans IDE</a>.</p>
</li>
</ol>
<p>If I missed anything or you have any other suggestions, I would love to hear about it in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alteridem.net/2010/11/10/debugging-php-on-windows-with-netbeans/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why I Switched from log4net to NLog</title>
		<link>http://www.alteridem.net/2010/11/04/why-i-switched-from-log4net-to-nlog/</link>
		<comments>http://www.alteridem.net/2010/11/04/why-i-switched-from-log4net-to-nlog/#comments</comments>
		<pubDate>Thu, 04 Nov 2010 20:23:06 +0000</pubDate>
		<dc:creator>Robert Prouse</dc:creator>
				<category><![CDATA[NLog]]></category>
		<category><![CDATA[log4net]]></category>

		<guid isPermaLink="false">http://www.alteridem.net/2010/11/04/why-i-switched-from-log4net-to-nlog/</guid>
		<description><![CDATA[As the people who know me know, I have been a big proponent of log4net over the years. I tried very hard to stick with log4net despite years of inactivity of the project. Over the years, I found, reported and fixed issues, but the patches have never been applied. I have reached out to the [...]]]></description>
			<content:encoded><![CDATA[<p>As the people who know me know, I have been a big <a href="http://www.alteridem.net/2008/01/28/speaking-at-toronto-code-camp/">proponent of log4net</a> over the <a href="http://www.alteridem.net/category/net/log4net/">years</a>. I tried very hard to stick with <a href="http://logging.apache.org/log4net/index.html">log4net</a> despite years of inactivity of the project. Over the years, I found, reported and fixed issues, but the patches have never been applied. I have reached out to the remaining members of the team to get involved and help revive the project, but received few responses. I even applied patches and released an <a href="http://www.alteridem.net/2010/07/09/log4net-udpappender-with-ipv6-on-windows-vista-and-7/">updated version myself</a>.</p>
<p>As I started to use that <a href="http://www.alteridem.net/2010/07/09/log4net-udpappender-with-ipv6-on-windows-vista-and-7/">updated version</a>, I soon discovered that the current source has many bugs and actually fails many of its own test suites. I tried to get the test suites running and submitted more patches for those, but still the project remains dormant. Without the support of at least one member of the team, it is difficult to revive a project without forking it, which I don’t want to do.</p>
<p>I ended up talking with a member of the <a href="http://nhforge.org/">NHibernate</a> team, I learned that they were also moving away from <a href="http://logging.apache.org/log4net/index.html">log4net</a> and were looking at <a href="http://nlog-project.org/">NLog</a>, the new player in .NET logging. I read through the website, followed the forums and liked what I saw, so I decided to move over to <a href="http://nlog-project.org/">NLog</a>.</p>
<p>Switching over actually turned out to be fairly straight-forward once I managed a few regular expressions for search and replace. Roughly, I performed the following steps,</p>
<ol>
<li>I did a search and replace using <a href="http://notepad-plus-plus.org/">Notepad++</a> in all of my project files to switch the references over.</li>
<li>I then replaced all of my using statements.</li>
<li>Next came the log instantiation. log4net uses <strong>ILog</strong> where NLog uses <strong>Logger</strong>. In log4net you also tend to use <strong>GetLogger( typeof( MyClass ) )</strong> where in NLog you just use <strong>GetCurrentClassLogger()</strong>. This required a bit of RegEx magic.</li>
<li>The hardest step was finding every instance of <strong>log.Warn( msg, exception)</strong> and converting them to <strong>log.WarnException( msg, Exception )</strong>. I did this nearly manually for each of the log levels, inspecting to see where I was passing in exceptions.</li>
<li>Then for each of the log levels, I converted instances of <strong>log.WarnFormat( &quot;Substitute this {0}&quot;, val )</strong> to <strong>log.Warn( &quot;Substitute this {0}&quot;, val )</strong>. This was another easy file replacement.</li>
<li>Lastly, I removed my <strong>XmlConfigurator</strong> attributes and changed my log configurations. A quick recompile, a few minor fixes and I was up and running. Painless!</li>
</ol>
<p>So far, I don’t regret my choice at all. I find the configuration of NLog to be much more intuitive and the Intellisense for the config file in Visual Studio sure helps. The documentation is still a bit sparse in places, but it is getting better. I do worry because it is currently a one man show, but it <a href="http://jkowalski.com/">Jaroslaw Kowalski</a> does seem fairly active and committed. Time will tell…</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alteridem.net/2010/11/04/why-i-switched-from-log4net-to-nlog/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Visual Studio 2010 Command Prompt Here</title>
		<link>http://www.alteridem.net/2010/09/02/visual-studio-2010-command-prompt-here/</link>
		<comments>http://www.alteridem.net/2010/09/02/visual-studio-2010-command-prompt-here/#comments</comments>
		<pubDate>Thu, 02 Sep 2010 17:52:37 +0000</pubDate>
		<dc:creator>Robert Prouse</dc:creator>
				<category><![CDATA[Tips'n'Tricks]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.alteridem.net/2010/09/02/visual-studio-2010-command-prompt-here/</guid>
		<description><![CDATA[Real developers live on the command line. Way back in 1996, Microsoft released the Command Prompt Here Power Toy to ease their pain. Industrious developers who preferred the Visual Studio command prompt took it and adopted it to run a Visual Studio command prompt with all of the paths to Visual Studio and .NET tools [...]]]></description>
			<content:encoded><![CDATA[<p><img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 6px 6px; display: inline; border-top: 0px; border-right: 0px" title="CmdPrompt" border="0" alt="CmdPrompt" align="right" src="http://www.alteridem.net/wp-content/uploads/2010/09/CmdPrompt.png" width="310" height="296" /> Real developers live on the command line. Way back in 1996, Microsoft released the <a href="http://www.microsoft.com/windowsxp/downloads/powertoys/xppowertoys.mspx">Command Prompt Here Power Toy</a> to ease their pain. Industrious developers who preferred the Visual Studio command prompt took it and adopted it to run a Visual Studio command prompt with all of the paths to Visual Studio and .NET tools in the path.</p>
<p>In the fine, time honored tradition, I have continued to update with each new Visual Studio release and have finally done so for Visual Studio 2010.</p>
<p>To install, download, unzip and right click and install the INF file, it will add a “VS 2010 Cmd Prompt Here” menu item when you right click on a folder in Explorer. Clicking on the menu item will launch a DOS prompt in that directory with all of the Visual Studio and .NET paths set correctly.</p>
<ul>
<li><a href="http://www.alteridem.net/wp-content/uploads/2010/09/vsnet2010cmdhere_x86.zip">Visual Studio 2010 Command Prompt Here (x86)</a></li>
<li><a href="http://www.alteridem.net/wp-content/uploads/2010/09/vsnet2010cmdhere_x64.zip">Visual Studio 2010 Command Prompt Here (x64)</a></li>
</ul>
<p>This assumes that you have installed Visual Studio to the default directory on the C drive. If that is not the case, edit the INF file and change line 38 to the correct path for your installation.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alteridem.net/2010/09/02/visual-studio-2010-command-prompt-here/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

