<?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>Logan Buesching &#187; Howto</title>
	<atom:link href="http://agoln.net/archives/category/howto/feed" rel="self" type="application/rss+xml" />
	<link>http://agoln.net</link>
	<description>Development and personal site</description>
	<lastBuildDate>Thu, 09 Sep 2010 21:01:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Zune Error C00d2767, DRM &amp; Debuggers</title>
		<link>http://agoln.net/archives/225</link>
		<comments>http://agoln.net/archives/225#comments</comments>
		<pubDate>Tue, 27 Oct 2009 20:00:10 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://agoln.net/archives/225</guid>
		<description><![CDATA[After installing an unsigned kernel driver, I noticed that I got an error with playing DRM content on my Zune.&#160; After some digging, I found: http://blogs.technet.com/askperf/archive/2009/02/24/windows-7-zune-and-the-case-of-the-mysterious-debugger.aspx It took awhile as when I was searching for Zune C00d2767, nothing came up, but hopefully somebody somewhere will find this useful.]]></description>
			<content:encoded><![CDATA[<p>After installing an unsigned kernel driver, I noticed that I got an error with playing DRM content on my Zune.&#160; After some digging, I found:</p>
<p><a title="http://blogs.technet.com/askperf/archive/2009/02/24/windows-7-zune-and-the-case-of-the-mysterious-debugger.aspx" href="http://blogs.technet.com/askperf/archive/2009/02/24/windows-7-zune-and-the-case-of-the-mysterious-debugger.aspx">http://blogs.technet.com/askperf/archive/2009/02/24/windows-7-zune-and-the-case-of-the-mysterious-debugger.aspx</a></p>
<p>It took awhile as when I was searching for Zune C00d2767, nothing came up, but hopefully somebody somewhere will find this useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://agoln.net/archives/225/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable Hyper-V in HP xw4600</title>
		<link>http://agoln.net/archives/212</link>
		<comments>http://agoln.net/archives/212#comments</comments>
		<pubDate>Mon, 03 Aug 2009 20:26:55 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Howto]]></category>

		<guid isPermaLink="false">http://agoln.net/?p=212</guid>
		<description><![CDATA[When attempting to run a virtual machine using Hyper-V on an HP xw4600, if you get the following message &#8220;Hypervisor is not running&#8221;, then hardware-assisted virtualization is probably not enabled. The way to enable it is to go to: BIOS Menu (f10 on boot) Security->System Security Data Execution Prevention (Enabled) Virtualization Technology (VTx) (Enabled)]]></description>
			<content:encoded><![CDATA[<p>When attempting to run a virtual machine using Hyper-V on an HP xw4600, if you get the following message &#8220;Hypervisor is not running&#8221;, then hardware-assisted virtualization is probably not enabled.  </p>
<p>The way to enable it is to go to:<br />
BIOS Menu (f10 on boot)<br />
Security->System Security<br />
Data Execution Prevention (Enabled)<br />
Virtualization Technology (VTx) (Enabled)</p>
]]></content:encoded>
			<wfw:commentRss>http://agoln.net/archives/212/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>IHTMLDocument2 hyperlinks open in new window</title>
		<link>http://agoln.net/archives/193</link>
		<comments>http://agoln.net/archives/193#comments</comments>
		<pubDate>Thu, 30 Apr 2009 03:06:04 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://agoln.net/archives/193</guid>
		<description><![CDATA[I spent (most) of the day at work today trying to figure out why my IHTMLDocument2&#8242;s hyperlinks were opening in new windows, instead of the current window it was in. Finally, I stumbled upon this: Resolving Hyperlinks. By the time anyone reads this, MSDN will probably have changed the link structure, so I&#8217;ll also explain [...]]]></description>
			<content:encoded><![CDATA[<p>I spent (most) of the day at work today trying to figure out why my IHTMLDocument2&#8242;s hyperlinks were opening in new windows, instead of the current window it was in.  Finally, I stumbled upon this:<br />
<a href="http://msdn.microsoft.com/en-us/library/bb508516(VS.85).aspx#Resolving_Hyperlinks">Resolving Hyperlinks</a>.</p>
<p>By the time anyone reads this, MSDN will probably have changed the link structure, so I&#8217;ll also explain it here:<br />
<quote>If a user clicks a link within an HTML page viewed in MSHTML, MSHTML calls the HlinkNavigate function (after implementing an IHlink interface). If the host does not implement IHlinkFrame, this function launches a separate application to follow the hyperlink.</quote></p>
<p>Wow, that was frustrating!</p>
]]></content:encoded>
			<wfw:commentRss>http://agoln.net/archives/193/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cannot Remove Groups Background Picture</title>
		<link>http://agoln.net/archives/190</link>
		<comments>http://agoln.net/archives/190#comments</comments>
		<pubDate>Thu, 29 Jan 2009 00:41:40 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://agoln.net/archives/190</guid>
		<description><![CDATA[A work-around to a bug in Windows Live Messenger 2009 was recently brought to my attention.&#160; If somehow the background picture in your Groups conversation window has changed, and you want it to be removed, here’s how. 1. Open the Background picker in the 1:1 conversation window 2. Click &#34;Show all&#8230;&#34; &#160; 3. Select the [...]]]></description>
			<content:encoded><![CDATA[<p>A work-around to a bug in Windows Live Messenger 2009 was recently brought to my attention.&#160; If somehow the background picture in your Groups conversation window has changed, and you want it to be removed, here’s how.</p>
<p>1. Open the Background picker in the 1:1 conversation window    <br />2. Click &quot;Show all&#8230;&quot;    <br /><a href="http://agoln.net/wp-content/uploads/2009/01/image.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://agoln.net/wp-content/uploads/2009/01/image-thumb.png" width="369" height="229" /></a>&#160; <br />3. Select the blank background    <br />4. Click the &quot;Set default&quot; button</p>
<p><a href="http://agoln.net/wp-content/uploads/2009/01/image1.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://agoln.net/wp-content/uploads/2009/01/image-thumb1.png" width="378" height="154" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://agoln.net/archives/190/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Chrome Isn&#8217;t Launched With Some Apps</title>
		<link>http://agoln.net/archives/149</link>
		<comments>http://agoln.net/archives/149#comments</comments>
		<pubDate>Thu, 04 Sep 2008 03:06:07 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Howto]]></category>

		<guid isPermaLink="false">http://agoln.net/archives/149</guid>
		<description><![CDATA[Please note, although I work for a large corporation, these views are entirely my own and do not reflect the views of my employer.&#160; Some of this information may be incorrect, but I have tried to be as thorough as possible with my investigation.&#160; If you find any errors that need correcting, please leave a [...]]]></description>
			<content:encoded><![CDATA[<p><em><strong>Please note</strong>, although </em><a href="http://agoln.net/archives/111"><em>I work for a large corporation</em></a><em>, these views are entirely my own and do not reflect the views of my employer.&#160; Some of this information may be incorrect, but I have tried to be as thorough as possible with my investigation.&#160; If you find any errors that need correcting, please leave a comment!</em></p>
<p>While investigating why Adobe Air doesn’t launch my default browser, I noticed that Google Chrome isn’t as aggressive as IE is when it sets the default browser settings.</p>
<h2>Make Google Chrome My Default Browser</h2>
<p>What happens when you say “Make Google Chrome my default browser”?&#160; Well, from the looks of it, all it does is registers itself as the default program for only the Windows Explorer shell.&#160; In theory, every application that needs launched should go through Windows Explorer (via <a href="http://msdn.microsoft.com/en-us/library/bb762153.aspx">shellexecute</a>), which will check for the user set defaults and launch the appropriate program.&#160; What Google Chrome does not do though, is set itself up as the default handler in the HKLM\Software\Classes\htmlfile registry key.&#160; This makes it so applications that only check this key completely bypasses Google Chrome as the default browser.</p>
<h2>Make Internet Explorer My Default Browser</h2>
<p>When you set IE as your default browser, not only does it set itself up as the default browser for the Windows Explorer, but it also makes sure that it is the default handler for HKLM\Software\Classes\htmlfile.&#160; Therefore, for the applications that only look at this key they will see that IE is the default browser and launch it.</p>
<h2>Why Do Some Apps Behave Differently</h2>
<p>There has been a standard way to launch the default browser in Windows for a long time, and that has always been by passing the URL into <a href="http://msdn.microsoft.com/en-us/library/bb762153.aspx">ShellExecute</a>.&#160; For .Net applications there is <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process_methods.aspx">Process.Start</a> which will do the same thing, and just introduced in Java is <a href="http://java.sun.com/javase/6/docs/api/java/awt/Desktop.html#browse(java.net.URI)">Desktop.Action.browse</a>.&#160; All of these will go through Windows Explorer, find the default program, and launch it.</p>
<h2>Why Adobe Air Not Honor The Default Browser</h2>
<p>From looking at where Adobe Air looks to launch a browser, it appears that it uses none of the methods above.&#160; When <a href="http://livedocs.adobe.com/flex/201/langref/flash/net/package.html#navigateToURL()">navigateToUrl</a> looks for the default browser, it just checks the HKCU\Software\Classes\htmlfile* registry key, and loads the default handle that is in this key.&#160; Since Google Chrome does not set this and IE does, IE is launched.</p>
<h2>Why Does Firefox Launch if IE is My Default Browser</h2>
<p>Firefox goes even one step further! If you see above, I mentioned that IE sets HKLM, but not HKCU!&#160; So when Firefox sets HKCU, and Adobe Air looks there, it says Firefox is the default browser, then launches it.&#160; To set IE as the default browser, you can either <a href="http://windowshelp.microsoft.com/Windows/en-US/help/72b76107-08c3-47a7-92f4-f2085403e26b1033.mspx">set it from the defaults</a>**, or <a href="http://agoln.net/archives/148">delete the registry key</a>.</p>
<p><em>* As someone may note, it actually looks for HKCU\Software\Classes\.htm, which by default is htmlfile.&#160; What Firefox does is changes this to FirefoxHTML.</em></p>
<p><em>**When you set the default programs for web browsers, what it does is sets the HK*\Software\Classes\[extensions] keys to point to htmlfile.&#160; The reason why if you use set Google Chrome or Firefox as the default browser there and it is not honored is because neither Google Chrome nor Firefox set the htmlfile class.&#160; For Firefox, just go through it’s menu system to make it the default browser and this will be fixed.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://agoln.net/archives/149/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Adobe Air Does Not Honor Default Browser</title>
		<link>http://agoln.net/archives/148</link>
		<comments>http://agoln.net/archives/148#comments</comments>
		<pubDate>Wed, 03 Sep 2008 22:40:50 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Howto]]></category>

		<guid isPermaLink="false">http://agoln.net/archives/148</guid>
		<description><![CDATA[I have recently found out that Adobe Air does not honor the default browser.&#160; I am using IE8 as my default browser right now, and AIR products open up Firefox.&#160; Mike Chambers mentions the issue and links to a fix, but I have a simpler one.&#160; I assume Adobe Air checks the HKCU registry entry [...]]]></description>
			<content:encoded><![CDATA[<p>I have recently found out that Adobe Air does not honor the default browser.&#160; <a href="http://agoln.net/archives/145">I am using IE8 as my default browser</a> right now, and AIR products open up Firefox.&#160; <a href="http://www.mikechambers.com/blog/2008/07/09/adobe-air-firefox-issue-on-vista/">Mike Chambers mentions the issue</a> and <a href="http://blog.dotsmart.net/2008/09/03/setting-google-chrome-as-the-default-browser-for-adobe-air-apps/">links to a fix</a>, but I have a simpler one.&#160; </p>
<p>I assume Adobe Air checks the HKCU registry entry first, which may not be set by other programs (which may set only HKLM).&#160; So just delete the entry in: HKCU/Software/Classes/.htm (I also deleted the one in .html).&#160; Bam! Fixes the issue.</p>
<p><strong>Update! (9/3/08)</strong>: If you are curious why this is, please check out <a href="http://agoln.net/archives/149">my explanation</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://agoln.net/archives/148/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Running AIR applications w/o installing AIR on Linux</title>
		<link>http://agoln.net/archives/106</link>
		<comments>http://agoln.net/archives/106#comments</comments>
		<pubDate>Fri, 02 May 2008 08:13:29 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Howto]]></category>

		<guid isPermaLink="false">http://agoln.net/?p=106</guid>
		<description><![CDATA[Recently, Adobe released an AIR client for Linux. Some people complained about the need for root privileges for not only installing AIR itself, but also for installing AIR applications. If you are worried about providing your root password to a binary, here is a work around. Download the AIR SDK Unzip the AIR SDK Download [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, Adobe released an <a href="http://labs.adobe.com/downloads/air_linux.html">AIR client for Linux</a>.  Some people <a href="http://www.splitbrain.org/blog/2008-04/18-adobe_air_on_linux-a_security_nightmare">complained about the need for root privileges</a> for not only installing AIR itself, but also for installing AIR applications.  If you are worried about providing your root password to a binary, here is a work around.</p>
<ol>
<li>Download the <a href="http://download.macromedia.com/pub/labs/air/linux/adobeair_linux_sdk_a1_033108.tbz2">AIR SDK</a></li>
<li>Unzip the AIR SDK</li>
<li>Download your <a href="http://funkatron.com/spaz">favorite AIR application</a></li>
<li>Unzip the .AIR file (yes, unzip it)</li>
<li>/path/to/air_sdk/bin/adl -nodebug /path/to/air_application/META-INF/AIR/application.xml /path/to/air_application</li>
</ol>
<p>For example, if you were to unzip the AIR sdk to ~/AIR-SDK and unzip Spaz to ~/spaz, the command for #5 would be </p>
<p>~/AIR-SDK/bin/adl -nodebug ~/spaz/META-INF/AIR/application.xml ~/spaz/</p>
<p>Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://agoln.net/archives/106/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Zend Studio for Eclipse on Windows Debugger Issues</title>
		<link>http://agoln.net/archives/102</link>
		<comments>http://agoln.net/archives/102#comments</comments>
		<pubDate>Wed, 26 Mar 2008 10:08:44 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://agoln.net/archives/102</guid>
		<description><![CDATA[When attempting to debug my program, zend studio for eclipse wasn&#8217;t recognizing that I had my mysql extension installed. I found a small work around. Go to [install_path]\plugins\org.zend.php.debug.debugger.win32.x86_5.2.12.v20071210\resources\php5 In there, you will see your php.exe&#8217;s and your php.ini that the debugger uses. I just copied my php.ini there for it to work.]]></description>
			<content:encoded><![CDATA[<p>When attempting to debug my program, zend studio for eclipse wasn&#8217;t recognizing that I had my mysql extension installed.  I found a small work around.</p>
<p>Go to<br />
<code>[install_path]\plugins\org.zend.php.debug.debugger.win32.x86_5.2.12.v20071210\resources\php5</code></p>
<p>In there, you will see your php.exe&#8217;s and your php.ini that the debugger uses.  I just copied my php.ini there for it to work.</p>
]]></content:encoded>
			<wfw:commentRss>http://agoln.net/archives/102/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing An Active Record Class</title>
		<link>http://agoln.net/archives/98</link>
		<comments>http://agoln.net/archives/98#comments</comments>
		<pubDate>Wed, 19 Mar 2008 14:45:27 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[EPICS]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[Ideas]]></category>
		<category><![CDATA[Opinion]]></category>

		<guid isPermaLink="false">http://agoln.net/archives/98</guid>
		<description><![CDATA[As the Active Record class has become increasingly popular due to it&#8217;s wild success in Ruby on Rails, it seems as though every framework has an implementation of it. It is no surprise that inside the covers of the MyEPICS framework lives an active record class that I had created. This class has evolved and [...]]]></description>
			<content:encoded><![CDATA[<p>As the <a href="http://en.wikipedia.org/wiki/Active_record_pattern" title="Wikipedia Active Record Article">Active Record</a> class has become increasingly popular due to it&#8217;s wild success in Ruby on Rails, it seems as though every framework has an implementation of it.  It is no surprise that inside the covers of the <a href="http://ims.ecn.purdue.edu/">MyEPICS framework</a> lives an active record class that I had created.  This class has evolved and changed over time, which I am going to share my experiences writing it.  It is far from finished, but it has been quite a great learning experience along the way.</p>
<h2>2.0 Implementation</h2>
<p>The MyEPICS 2.0 implementation contained one master database class (<acronym title="MyEPICS Database">ME_DB</acronym>) which contained generic <acronym title="Create Read Update Delete">CRUD</acronym> functions, and each table contained its own class which would implement the specific <acronym title="Create Read Update Delete">CRUD</acronym> functions for each table (<acronym title="MyEPICS Database Object">ME_DBO</acronym>).  A sample way to read users with the name &#8216;bob&#8217; would be the following:<br />
<code><br />
$user=new ME_DBO_User();<br />
$user->read(array('name'=>'bob'));<br />
</code><br />
And to update a person&#8217;s last name to &#8220;foobar&#8221;, you would do the following:<br />
<code><br />
$user->lastname="foobar";<br />
$user->update();<br />
</code><br />
About 90% of each of the ME_DBO classes were the same code, and there was even a script to create a DBO class given a SQL create statement.  A major problem with this approach is that for every new table created, you needed to make sure you created a new ME_DBO file, and that the file really only contained such things as which columns were in the table and their default values.  We would have about 2k lines of code between 30 files, of which only about 50 lines were different&#8230; YUCK!  Over Christmas break, I decided that this was a major, major issue that needed to be worked out before MyEPICS 2.1.</p>
<h2>MyEPICS 2.1 Implementation</h2>
<p>With the 2.1 implementation, I took a step back and attempted to create two classes which would fix the pitfalls of the 2.0 implementation.  What I ended up doing was using <a href="http://pear.php.net/package/MDB2/docs/latest/MDB2/MDB2_Driver_Reverse_Common.html">MBD2&#8242;s reverse engineering module</a> in order to find out which fields were available and what their default values were.  This reduced the need for a separate file for each table and removed about 1500 lines of code from the Active Record implementation.  Now, instead of<br />
<code><br />
$user=new ME_DBO_User();<br />
</code><br />
You would do this instead<br />
<code><br />
$user=ME_Db::factory('User');<br />
</code><br />
This has the main database create a Dbo object with just the right properties that you need.</p>
<p>The only major gripe I have with the current implementation is that I don&#8217;t implement anything for relationships.  If you need information from a relationship, then you have three options.</p>
<ol>
<li>Cry</li>
<li>Write Manual SQL</li>
<li>Write many lines of code which does a lot of extra sql queries and is inefficient and crappy</li>
</ol>
<p>I mainly want to create something so that the relationship table is transparent.  A lot of the time, your relationship table doesn&#8217;t have anything of value in it, and it only exists for a many to many relationship.</p>
<h2>SQL Command Functions</h2>
<h3>About</h3>
<p>One such feature that I see in a lot of Active Record implementations is the ability to use functions named after SQL commands, such as:<br />
<code><br />
$db=new Some_Active_Record_Class();<br />
$db->select('firstname')->from('User')->where('id=5');<br />
</code><br />
Mostly, I had disregarded this need in my Active Record implementation because it seemed like it was a lot of work for very little gain.  Why would you need to allow such functionality when creating a simple sql statement would do?</p>
<p>Well, I think I had just stumbled upon the reason for its need.</p>
<h3>The Problem</h3>
<p>I have a class for a user and contains information pertaining to the user such as first name, last name, e-mail address etc&#8230; It has some very useful functions such as getUserWithRole($role) and getPriviliges($user).  What I need to be able to do, is extend this information through one of the MyEPICS modules.  Such an example is in my Roommate Finder application, which extends the user to give them traits.  The user module does not know about the Roommate Finder application, nor should it have to.  Now, here&#8217;s the problem.  What I need to be able to do, is return a result set of all the users&#8217; traits, where the user has a certain role.  I already have the code to return all users with a certain role in the Users module, now I just need to attach the trait information to the output of it.</p>
<p>I have come up with a few different solutions that would plug this hole, but not fix the problem, with most of them being some variation of typing up a single sql statement to get me the information.  What I don&#8217;t want to do, is getUsersWithRole(), then iterate through all of theses picking out the traits for each individual user.  This would result in at least one sql statement per user, which is <strong>highly</strong> innefficient.  </p>
<p>I want to be able to execute this functionality in one sql query, without having to tightly couple the User module with the Roommate Finder module, and without duplicating functionality already existing in the User module.</p>
<h3>A Solution?</h3>
<p>What I have been thinking about that would solve this problem would end up having me creating something like the database command functions.  Then, what the getUserWithRoel() function would do, is instead of returning the results, it would return a Dbo object with the sql already added.  So that if getUsersWithRole() would normally result in some query like &#8220;select role from roles where role=?&#8221;, then it would now return an object that represents this statement.  What this would allow me to do is chain these functions together, then only execute the query at the end.  For example:<br />
<code><br />
//fetch results in an array<br />
$dbo=$userModule->withRole('Tenant')->join('Traits')->fetchArray();<br />
</code><br />
This has several features which I haven&#8217;t implemented.  Easy relationships, chaining of functions, and the sql commands.</p>
<p>Is it bad that I am never satisfied with what I already have, and always want to refactor to make it better?</p>
]]></content:encoded>
			<wfw:commentRss>http://agoln.net/archives/98/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Mercurial To Manage Subversion</title>
		<link>http://agoln.net/archives/95</link>
		<comments>http://agoln.net/archives/95#comments</comments>
		<pubDate>Sun, 02 Mar 2008 20:25:12 +0000</pubDate>
		<dc:creator>Logan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Howto]]></category>

		<guid isPermaLink="false">http://agoln.net/archives/95</guid>
		<description><![CDATA[I have been a big supporter of Subversion for a long time. I have used it off and on for about 3 years now and have never really had very many troubles while using it. It has always suited my needs and actually allowed me to really learn what version control is, why it&#8217;s useful [...]]]></description>
			<content:encoded><![CDATA[<p>I have been a big supporter of <a href="http://subversion.tigris.org/">Subversion</a> for a long time.  I have used it off and on for about 3 years now and have never really had very many troubles while using it.  It has always suited my needs and actually allowed me to really learn what version control is, why it&#8217;s useful and how to use it.  Until recently, I have been very satisfied with its capabilities.</p>
<h2>A Distributed Problem</h2>
<p>When I created the <a href="https://ims.ecn.purdue.edu/myepics_proj.html">MyEPICS 2.0 application</a>, I had a vision to make a general framework which can be used outside the context of a service learning management program.  Well, fast forward about two years later and I feel I have a stellar framework.  I have one tiny problem though, which is that I need to make modifications inside the framework&#8217;s directory structure, without changing the main subversion repository.  In other words, I have a project that I want to base upon the MyEPICS Framework, but I don&#8217;t want to use the main Subversion repository for its version control because not everything I do is going to back into the framework.</p>
<p>An example directory structure is below:</p>
<pre>
/
-/ME
--Core.php
--...
-/Modules
--/<--- Here is where I want to change things
</pre>
<h2>Purely Subversion Option</h2>
<p>If I were to want to do something like this, I would have to check out each Module directory individually from my own repository, and manually do each svn command in each module directory to get up to speed.  Not to mention, if I want to update it server side, I must update each directory individually.</p>
<p>On the other hand, I could just set up a new repository for my own work, and any changes outside of the Modules directory I could manually generate a diff, and apply it to the main repository and commit, and vice versa for getting changes from the main repository.  It's tedious, but can work.</p>
<h2>Mercurial managed</h2>
<p>With using a mercurial managed repository, I can check out the repository to some directory, and make a mercurial repository on top of that.  From there, I can <code>hg clone</code> the repository to do any of my own work.  I can play around with the modules directory, do all of my own changes, without effecting the main Subversion repository.  Any time I have a change to add to the main Subversion repository, I just svn commit them.  If I have a change to pull from the main Subversion repository, I just<br />
<code>svn update<br />
hg commit<br />
</code><br />
And I have an updated repository!  The only downside is that for some reason, any clone of my main mercurial repository doesn't allow me to do my Subversion commands, such as updating and committing.  There are a few directories that Mercurial doesn't see in the .svn directory, which I will have to find out why at a later date.</p>
<h2>Making the Switch</h2>
<h4>No Central Repository</h4>
<p>Probably the biggest difference is that there is no "central" repository to work with.  This means, that any changes you create can be isolated to your environment.  You can totally fork an entire project and set up your own version control, and sync up with it whenever you want w/o them really knowing.  In fact, that's the entire problem that I've had working with Subversion... I couldn't find a way to do this.  Now, trying to argue that there isn't a "main" repository and you'll just be wasting energy.  In every project, there has to be some "official" repository which contains the "official" code.  In the Linux kernel, that's Linus' repository.  For other projects, they may have an "official" repository which is delegated by a select group of people.</p>
<h4>Ignoring Files</h4>
<p>Mercurial uses a file named .hgignore to tell it to ignore files, as opposed to Subversion using a property on the file, namely svn:ignore.  In this file, you can either add single files, or regular expressions.  <a href="http://www.selenic.com/mercurial/hgignore.5.html" title="Man Page for hgignore(5)">The man page on hgignore is helpful in this case.</a></p>
<h4>Meta Repositories, Tagging, and Branching OH MY!</h4>
<p>In the case of Subversion, it is recommended that each repository contain all the tags and branches in it's <a href="http://svnbook.red-bean.com/en/1.4/svn.reposadmin.planning.html#svn.reposadmin.projects.chooselayout" title="Planning your repository">repository layout</a>, and even allows for multiple repositories contained within one large repository, thus making a meta-repository.</p>
<p>In Mercurial, there is no repository layout.  Your repository is just your project itself, so there is no trunk, branches or tag directory.  In subversion, if you wanted to branch or tag, you just copy a directory in the repository to the branches or tags and work from there.  In Mercurial if you wish to make a branch, you simply <strike><code>hg clone</code></strike> <code>hg branch</code> (thanks luke!) it.  When you want your changes to be seen, you push it back or wait for someone to pull from you.  If you want to tag something, it's accomplished via <code>hg tag</code>.</p>
<h4>Helpful Hint</h4>
<p>While I was reading the <a href="http://hgbook.red-bean.com/" title="Distributed revision control with Mercurial">mercurial red-bean book</a>, I came across such an excellent note, I'm going to repeat it verbatim:</p>
<blockquote><p>
Note: If you’re new to Mercurial, you should keep in mind a common “error”, which is to use the “hg pull” command without any options. By default, the “hg pull” command does not update the working directory, so you’ll bring new changesets into your repository, but the working directory will stay synced at the same changeset as before the pull. If you make some changes and commit afterwards, you’ll thus create a new head, because your working directory isn’t synced to whatever the current tip is.</p>
<p>I put the word “error” in quotes because all that you need to do to rectify this situation is “hg merge”, then “hg commit”. In other words, this almost never has negative consequences; it just surprises people. I’ll discuss other ways to avoid this behaviour, and why Mercurial behaves in this initially surprising way, later on.
</p></blockquote>
<h2>Conclusion</h2>
<p>After working with Mercurial for a few weeks, I have a little bit better of an understanding of how it works, and enjoy using much better than I did when working on the Rubix Cube project.  For now, this will allow me to have my own version control while keeping in sync with the main Subversion repository.</p>
]]></content:encoded>
			<wfw:commentRss>http://agoln.net/archives/95/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

