<?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>Cranky Bit &#187; How To</title>
	<atom:link href="http://blog.crankybit.com/tags/how-to/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.crankybit.com</link>
	<description>Take a byte out of tech!</description>
	<lastBuildDate>Wed, 09 Mar 2011 17:23:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Line Debugging Causes CF to Not Start</title>
		<link>http://blog.crankybit.com/line-debugging-causes-cf-to-not-start/</link>
		<comments>http://blog.crankybit.com/line-debugging-causes-cf-to-not-start/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 18:01:24 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Adobe]]></category>
		<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[ColdFusion cf9 troubleshooting]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/?p=335</guid>
		<description><![CDATA[So you go to turn on line debugging in ColdFusion, and when you save your changes, it warns you that the ColdFusion service will fail to start if the debugging port is already in use. Great, but what do you do if this actually happens? I was at a loss for a few minutes on [...]]]></description>
			<content:encoded><![CDATA[<p>So you go to turn on line debugging in ColdFusion, and when you save your changes, it warns you that the ColdFusion service will fail to start if the debugging port is already in use. Great, but what do you do if this actually happens?</p>
<p>I was at a loss for a few minutes on how to get ColdFusion started again so that I could fix the issue. Well, the configuration change is in your ColdFusion installation under ~/runtime/bin/jvm.config. So on a typical Windows installation, it may be c:\coldfusion9\runtime\bin\jvm.config. </p>
<p><strong><em>Note: Before proceeding, it is always good practice to make a copy of the config file before editing it.</em></strong></p>
<p>In jvm.config, there is an &#8220;Arguments to VM&#8221; section that has a java.args setting that may start with something like this:</p>
<p><font face="courier new, courier, mono">java.args=-Xdebug -Xrunjdwp:transport=dt_socket, server=y, suspend=n, address=5095 -server -Xmx512m</font></p>
<p><em>(There will likely be many more arguments as well.)</em></p>
<p>The first two arguments contain the debugging settings that are probably preventing ColdFusion from starting. Remove the <font face="courier new, courier, mono">-Xdebug</font> and<br />
<font face="courier new, courier, mono">-Xrunjdwp:transport</font> arguments, so that the beginning of the line will now look like this:</p>
<p><font face="courier new, courier, mono">java.args=-server -Xmx512m</font> <em>(and additional arguments&#8230;)</em></p>
<p>This will be enough to get ColdFusion to start up. You can then go into ColdFusion Administrator to either change the debugging port or turn off the line debugging.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/line-debugging-causes-cf-to-not-start/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Reset Access Datasources Without Resetting ColdFusion</title>
		<link>http://blog.crankybit.com/reset-access-ds-not-cf/</link>
		<comments>http://blog.crankybit.com/reset-access-ds-not-cf/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 16:30:44 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[How To]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/?p=323</guid>
		<description><![CDATA[I am &#8220;stuck&#8221; with a few web applications that provide web front-ends to Access databases. I am not the owner of these databases, and for various reasons, the database owner will not upgrade it to SQL Server. Alas, this sometimes causes headaches like the following. The Access databases are on a network fileserver. Occasionally, this [...]]]></description>
			<content:encoded><![CDATA[<p>I am &#8220;stuck&#8221; with a few web applications that provide web front-ends to Access databases. I am not the owner of these databases, and for various reasons, the database owner will not upgrade it to SQL Server.  Alas, this sometimes causes headaches like the following.</p>
<p>The Access databases are on a network fileserver. Occasionally, this server goes down or resets, and ColdFusion&#8217;s datasource connection to the database gets stuck in a disrupted state. I&#8217;ve come to learn two things you can try to get ColdFusion&#8217;s connection to the Access datasource working again without resetting the entire ColdFusion Application Server service, which is obviously disruptive to your entire site and all of its applications.</p>
<ol>
<li><strong>Reset the ODBC services.</strong> The ColdFusion ODBC services (such as &#8220;ColdFusion 8 ODBC Agent&#8221; and &#8220;ColdFusion 8 ODBC Server&#8221;) actually handle the ODBC connections to DataDirect driver databases such as Microsoft Access databases. This is handy. Just reset these services and often connectivity is restored.</li>
<li><strong>Use the &#8220;Disable Connections&#8221; option in the datasource configuration.</strong> If you are using JDBC drivers (for instance, perhaps to <a href="/msaccess2007-and-cf8/">connect to Microsoft Access 2007 databases</a>), resetting the ColdFusion 8 ODBC Server service won&#8217;t help. Darn. However, if you go into the datasource&#8217;s configuration in ColdFusion Administrator, you can check the &#8220;Disable Connections&#8221; checkbox and submit the change. This will force ColdFusion to disconnect from the database. Immediately go back in and uncheck the checkbox and submit again. Your datasource will now have connectivity reestablished without a ColdFusion restart!</li>
</ol>
<p>Happy days! The second option won&#8217;t be helpful to you if you have many, many datasources. However, this is better than a ColdFusion reset that would disrupt all of your apps.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/reset-access-ds-not-cf/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Generating a Decrypted Memento for a Transfer Decorator</title>
		<link>http://blog.crankybit.com/generating-a-decrypted-memento-for-a-transfer-decorator/</link>
		<comments>http://blog.crankybit.com/generating-a-decrypted-memento-for-a-transfer-decorator/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 12:57:27 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[General Web Dev.]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[Transfer]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/?p=319</guid>
		<description><![CDATA[In my last blog post, I discussed how to efficiently handle multiple encrypted fields while using Transfer. The key was using onMissingMethod in the Transfer decorator. However, what about when we use the memento with Transfer's getMemento() method? This approach can be especially handy to quickly transfer an object's properties when using web services to [...]]]></description>
			<content:encoded><![CDATA[<p>In my last blog post, I discussed how to efficiently handle multiple encrypted fields while using Transfer. The key was using onMissingMethod in the Transfer decorator. However, what about when we use the memento with Transfer's getMemento() method? This approach can be especially handy to quickly transfer an object's properties when using web services to Flex or AJAX front ends.</p>
<p>For reference, here was the object definition we were using in our sample Transfer configuration.</p>
<div class="igBar"><span id="lxml-3"><a href="#" onclick="javascript:showCodeTxt('xml-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-3">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;object</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"Reg"</span> <span style="color: #000066;">table</span>=<span style="color: #ff0000;">"Regs"</span> <span style="color: #000066;">decorator</span>=<span style="color: #ff0000;">"MyProj.com.Reg"</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;id</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"ID"</span> <span style="color: #000066;">column</span>=<span style="color: #ff0000;">"RegID"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"numeric"</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"FName"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"string"</span> <span style="color: #000066;">column</span>=<span style="color: #ff0000;">"RegFName"</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"LName"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"string"</span> <span style="color: #000066;">column</span>=<span style="color: #ff0000;">"RegLName"</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"LastMod"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"date"</span> <span style="color: #000066;">column</span>=<span style="color: #ff0000;">"RegLastMod"</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"Expires"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"date"</span> <span style="color: #000066;">column</span>=<span style="color: #ff0000;">"RegExpires"</span> <span style="color: #000066;">nullable</span>=<span style="color: #ff0000;">"true"</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"EncHome"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"string"</span> <span style="color: #000066;">column</span>=<span style="color: #ff0000;">"regHome"</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"EncWork"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"string"</span> <span style="color: #000066;">column</span>=<span style="color: #ff0000;">"regWork"</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"EncMobile"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"string"</span> <span style="color: #000066;">column</span>=<span style="color: #ff0000;">"regMobile"</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"EncSMS"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"string"</span> <span style="color: #000066;">column</span>=<span style="color: #ff0000;">"regSMS"</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/object<span style="font-weight: bold; color: black;">&gt;</span></span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The process is very simple. Recall that we prefixed our Transfer properties with "Enc" to know which fields are encrypted. Let's create a getDecryptedMemento() method. It will loop through all of the keys in the memento, which is just a struct, and decrypt any of the encrypted fields, saving them as new keys in the struct (i.e. "EncHome" is decrypted as "Home" in the struct). </p>
<p>Something like this will do the trick:</p>
<div class="igBar"><span id="lcfm-4"><a href="#" onclick="javascript:showCodeTxt('cfm-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CFM:</span>
<div id="cfm-4">
<div class="cfm">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #333333;"><span style="color: #990000;">&lt;cffunction</span> <span style="color: #0000FF;">name</span>=<span style="color: #009900;">"getDecryptedMemento"</span> <span style="color: #0000FF">access</span>=<span style="color: #009900;">"public"</span> returntype=<span style="color: #009900;">"struct"</span> output=<span style="color: #009900;">"false"</span><span style="color: #990000;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #333333;"><span style="color: #990000;">&lt;cfset</span> <span style="color: #000000; font-weight: bold;">var</span> memento=getMemento<span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">&#41;</span><span style="color: #990000;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #333333;"><span style="color: #990000;">&lt;cfset</span> <span style="color: #000000; font-weight: bold;">var</span> key=<span style="color: #009900;">""</span><span style="color: #990000;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #333333;"><span style="color: #990000;">&lt;cfset</span> <span style="color: #000000; font-weight: bold;">var</span> newkey=<span style="color: #009900;">""</span><span style="color: #990000;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #333333;"><span style="color: #990000;">&lt;cfloop</span> <span style="color: #0000FF">index</span>=<span style="color: #009900;">"key"</span> <span style="color: #0000FF">list</span>=<span style="color: #009900;">"#StructKeyList(memento)#"</span><span style="color: #990000;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #333333;"><span style="color: #990000;">&lt;cfif</span> <span style="color: #0000FF;">Left</span><span style="color: #0000FF;">&#40;</span>key,<span style="color: #FF0000;color:#800000;">3</span><span style="color: #0000FF;">&#41;</span> is <span style="color: #009900;">"Enc"</span><span style="color: #990000;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #333333;"><span style="color: #990000;">&lt;cfset</span> newkey=<span style="color: #0000FF;">RemoveChars</span><span style="color: #0000FF;">&#40;</span>key,<span style="color: #FF0000;color:#800000;">1</span>,<span style="color: #FF0000;color:#800000;">3</span><span style="color: #0000FF;">&#41;</span><span style="color: #990000;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #333333;"><span style="color: #990000;">&lt;cfset</span> memento<span style="color: #0000FF;">&#91;</span>newkey<span style="color: #0000FF;">&#93;</span>=decryptValue<span style="color: #0000FF;">&#40;</span>memento<span style="color: #0000FF;">&#91;</span>key<span style="color: #0000FF;">&#93;</span><span style="color: #0000FF;">&#41;</span><span style="color: #990000;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #333333;"><span style="color: #990000;">&lt;/cfif&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #333333;"><span style="color: #990000;">&lt;/cfloop&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #333333;"><span style="color: #990000;">&lt;cfreturn</span> memento&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #333333;"><span style="color: #990000;">&lt;/cffunction&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Not much to it. Note that we would use the same decryption function as we are using in onMissingMethod for the dynamic accessors. I'm calling it decryptValue() for this sample.</p>
<p>In the end, our getDecryptedMemento() method returns a memento that looks just like the Transfer-generated getMemento() output, with decrypted versions of the encrypted fields!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/generating-a-decrypted-memento-for-a-transfer-decorator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handling Multiple Encrypted Fields in a Transfer Decorator</title>
		<link>http://blog.crankybit.com/multiple-encrypted-fields-in-a-transfer-decorator/</link>
		<comments>http://blog.crankybit.com/multiple-encrypted-fields-in-a-transfer-decorator/#comments</comments>
		<pubDate>Mon, 29 Dec 2008 12:55:55 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[General Web Dev.]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[Transfer]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/?p=318</guid>
		<description><![CDATA[I had a recent project that had multiple fields in a particular table that needed to be encrypted for privacy and security considerations. I was using Transfer for the project. The typical way to handle the encryption is to create custom accessor methods in a decorator component. The Transfer wiki has a decent explanation of [...]]]></description>
			<content:encoded><![CDATA[<p>I had a recent project that had multiple fields in a particular table that needed to be encrypted for privacy and security considerations. I was using <a href="http://docs.transfer-orm.com/" target="_blank">Transfer</a> for the project. The typical way to handle the encryption is to create custom accessor methods in a <a href="http://en.wikipedia.org/wiki/Decorator_pattern" target="_blank">decorator</a> component. The Transfer wiki has a decent explanation of this concept on a page entitled <a href="http://docs.transfer-orm.com/wiki/How_to_Encrypt_User_Passwords_Using_a_Decorator.cfm" target="_blank">How to Encrypt User Passwords Using a Decorator</a>. However, it is intentionally simple, demonstrating a single property. Multiply your getter/setter methods by how many properties you will be working with, and the lines of code can add up. This framework stuff is supposed to prevent that kind of repetition! Well, utilizing onMissingMethod() and the core concept on the Transfer decorator example, we can handle this scenario efficiently.</p>
<p>First, let's consider the object definition in our sample Transfer configuration file.</p>
<div class="igBar"><span id="lxml-7"><a href="#" onclick="javascript:showCodeTxt('xml-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-7">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;object</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"Reg"</span> <span style="color: #000066;">table</span>=<span style="color: #ff0000;">"Regs"</span> <span style="color: #000066;">decorator</span>=<span style="color: #ff0000;">"MyProj.com.Reg"</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;id</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"ID"</span> <span style="color: #000066;">column</span>=<span style="color: #ff0000;">"RegID"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"numeric"</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"FName"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"string"</span> <span style="color: #000066;">column</span>=<span style="color: #ff0000;">"RegFName"</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"LName"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"string"</span> <span style="color: #000066;">column</span>=<span style="color: #ff0000;">"RegLName"</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"LastMod"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"date"</span> <span style="color: #000066;">column</span>=<span style="color: #ff0000;">"RegLastMod"</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"Expires"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"date"</span> <span style="color: #000066;">column</span>=<span style="color: #ff0000;">"RegExpires"</span> <span style="color: #000066;">nullable</span>=<span style="color: #ff0000;">"true"</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"EncHome"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"string"</span> <span style="color: #000066;">column</span>=<span style="color: #ff0000;">"regHome"</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"EncWork"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"string"</span> <span style="color: #000066;">column</span>=<span style="color: #ff0000;">"regWork"</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"EncMobile"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"string"</span> <span style="color: #000066;">column</span>=<span style="color: #ff0000;">"regMobile"</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"EncSMS"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"string"</span> <span style="color: #000066;">column</span>=<span style="color: #ff0000;">"regSMS"</span> <span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/object<span style="font-weight: bold; color: black;">&gt;</span></span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Note that I have prefixed the Transfer properties with "Enc". This isn't required, but will simplify our processing later on. So in this sample, we have 4 properties: Home, Work, Mobile, and SMS. The concept is that these are client phone numbers that we want to protect with encryption. So, Transfer will generate getEncHome(), getEncWork(), getEncMobile(), getEncSMS(), and corresponding setters. However, we want to provide getHome(), getWork(), getMobile(), getSMS(), and corresponding setters, that get and set the properties <em>after</em> encryption/decryption.</p>
<p><strong>Use onMissingMethod()</strong></p>
<p>To accomplish this, we might have an onMissingMethod() function in the decorator like this:</p>
<div class="igBar"><span id="lcfm-8"><a href="#" onclick="javascript:showCodeTxt('cfm-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CFM:</span>
<div id="cfm-8">
<div class="cfm">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #333333;"><span style="color: #990000;">&lt;cffunction</span> <span style="color: #0000FF;">name</span>=<span style="color: #009900;">"onMissingMethod"</span> <span style="color: #0000FF">access</span>=<span style="color: #009900;">"public"</span> returntype=<span style="color: #009900;">"any"</span> output=<span style="color: #009900;">"false"</span><span style="color: #990000;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #333333;"><span style="color: #990000;">&lt;cfargument</span> <span style="color: #0000FF;">name</span>=<span style="color: #009900;">"missingMethodName"</span> <span style="color: #0000FF;">type</span>=<span style="color: #009900;">"string"</span> <span style="color: #0000FF">required</span>=<span style="color: #009900;">"true"</span><span style="color: #990000;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #333333;"><span style="color: #990000;">&lt;cfargument</span> <span style="color: #0000FF;">name</span>=<span style="color: #009900;">"missingMethodArguments"</span> <span style="color: #0000FF;">type</span>=<span style="color: #009900;">"struct"</span> <span style="color: #0000FF">required</span>=<span style="color: #009900;">"true"</span><span style="color: #990000;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000099;"><span style="color: #990000;">&lt;cfscript&gt;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> func=<span style="color: #009900;">""</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> encList=<span style="color: #009900;">"Home,Mobile,SMS,Work"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0000FF;">method</span>=Arguments.missingMethodName;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> args=Arguments.missingMethodArguments;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> firstArg=args<span style="color: #0000FF;">&#91;</span><span style="color: #0000FF;">ListFirst</span><span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">StructKeyList</span><span style="color: #0000FF;">&#40;</span>args<span style="color: #0000FF;">&#41;</span><span style="color: #0000FF;">&#41;</span><span style="color: #0000FF;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> prop=<span style="color: #0000FF;">RemoveChars</span><span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">method</span>,<span style="color: #FF0000;color:#800000;">1</span>,<span style="color: #FF0000;color:#800000;">3</span><span style="color: #0000FF;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">// Handle encryption/decryption of encrypted values:</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span><span style="color: #0000FF;">&#40;</span> <span style="color: #0000FF;">ListFindNoCase</span><span style="color: #0000FF;">&#40;</span><span style="color: #009900;">"get,set"</span>,<span style="color: #0000FF;">Left</span><span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">method</span>,<span style="color: #FF0000;color:#800000;">3</span><span style="color: #0000FF;">&#41;</span><span style="color: #0000FF;">&#41;</span> and </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000FF;">ListFindNoCase</span><span style="color: #0000FF;">&#40;</span>encList,prop<span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000FF;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; func=variables<span style="color: #0000FF;">&#91;</span><span style="color: #0000FF;">Insert</span><span style="color: #0000FF;">&#40;</span><span style="color: #009900;">"Enc"</span>,<span style="color: #0000FF;">method</span>,<span style="color: #FF0000;color:#800000;">3</span><span style="color: #0000FF;">&#41;</span><span style="color: #0000FF;">&#93;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span><span style="color: #0000FF;">&#40;</span> <span style="color: #0000FF;">Left</span><span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">method</span>,<span style="color: #FF0000;color:#800000;">3</span><span style="color: #0000FF;">&#41;</span> is <span style="color: #009900;">"get"</span><span style="color: #0000FF;">&#41;</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; return decryptValue<span style="color: #0000FF;">&#40;</span>func<span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">&#41;</span><span style="color: #0000FF;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">else</span> </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; func<span style="color: #0000FF;">&#40;</span>encryptValue<span style="color: #0000FF;">&#40;</span>firstArg<span style="color: #0000FF;">&#41;</span><span style="color: #0000FF;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #0000FF;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #990000;">&lt;/cfscript&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990000;">&lt;/cffunction&gt;</span> </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>As a good security measure, we use an "encList" string to check that only proper methods can be called. Then we examine the method name. If it starts with "get" or "set" and ends with one of the list items, we proceed. Thus, we'll process a method like getHome(), but not a method like getFoo(). We then call getEncHome() and decrypt it for getters, encrypt and call setEncHome() for setters. </p>
<p><strong>Dynamic Method Calling</strong></p>
<p>But alas, how do we do this dynamically without a long if-then-else chain? We call the proper method by referencing it from the component's variables scope. Terrence Ryan describes this in his blog post <a href="http://www.terrenceryan.com/blog/post.cfm/cheap-and-easy-dynamic-method-calling-in-cfscript" target="_blank">Cheap and Easy Dynamic Method Calling in CFScript</a>. We construct the method name, in our case, by inserting "Enc" after the "get" or "set" prefix of the method name passed into onMissingMethod (thus "getHome" becomes the Transfer method "getEncHome"). Assign the function to the local "func" variable, then call it as if "func" was the function. Finally, handle any encryption or decryption that you will be doing. For this sample, I have encryptValue() and decryptValue() methods handling the details of that work.</p>
<p><strong>Summary</strong></p>
<p>We've used two solutions to handle multiple encrypted fields in the decorator. First, we used onMissingMethod() to handle processing of all of the properties in a single method. Then, we used dynamic method calling to call the Transfer-generated accessors within onMissingMethod().</p>
<p>The end result is being able to use setHome(), getHome(), etc. with the encryption and decryption being handled automatically. Great!</p>
<p>In addition to accessors, we may sometimes want to use the object's memento with the Transfer method getMemento(). In my next blog post, I'll demonstrate how that process can also be done very efficiently.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/multiple-encrypted-fields-in-a-transfer-decorator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Separating a Large Repository</title>
		<link>http://blog.crankybit.com/separating-large-repo/</link>
		<comments>http://blog.crankybit.com/separating-large-repo/#comments</comments>
		<pubDate>Tue, 04 Nov 2008 12:52:45 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Batch Scripting]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/?p=312</guid>
		<description><![CDATA[A few months ago, I posted an article about combining multiple Subversion repositories into one large repository. Some folks have expressed an interest in doing the opposite--separating one large repository into multiple smaller repositories. The process is not without its quirks, but it can be done. At first glance, you'd conclude the process would work [...]]]></description>
			<content:encoded><![CDATA[<p>A few months ago, I posted an article about <a href="http://blog.crankybit.com/combining-repos/">combining multiple Subversion repositories into one large repository</a>. Some folks have expressed an interest in doing the opposite--separating one large repository into multiple smaller repositories. The process is not without its quirks, but it can be done.</p>
<p>At first glance, you'd conclude the process would work much the same way: Loop through the individual directories in the large repository, create smaller repositories for each one, then dump and import the contents of each directory into its small repository.</p>
<p>The tricky part is that the Subversion dump command dumps everything in the repository, by revision. In order to pull just a single directory, you must filter a complete dump with the "svndumpfilter" command. <a href="http://allmybrain.com/2007/10/15/using-piped-svndumpfilter-commands-to-separate-an-svn-repository/" target="_blank">This blog post</a> by <a href="http://allmybrain.com/" target="_blank">AllMyBrain.com</a> basically explains how to accomplish this in Linux. I usually have to work on a Windows box on the job, so I wrote up a script to accomplish this in a Windows batch script.</p>
<p>The strategy is the same as the Linux script, though. We're going to use "svnadmin dump" the large repository, then use "svndumpfilter" to filter by just the directory we want, then "svnadmin load" the results into the newly created repository. All of this can be combined into a single statement via piping:</p>
<div class="igBar"><span id="ldos-11"><a href="#" onclick="javascript:showCodeTxt('dos-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">DOS:</span>
<div id="dos-11">
<div class="dos">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">svnadmin dump c:\my\large\repo\ |</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">svndumpfilter include MyDirectory |</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">svnadmin load MySmallRepo\MyDirectory </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This will make a little more sense when we look at the full script. Let's just put it out there and then go through it.</p>
<div class="igBar"><span id="ldos-12"><a href="#" onclick="javascript:showCodeTxt('dos-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">DOS:</span>
<div id="dos-12">
<div class="dos">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.ss64.com/nt/set.html"><span style="color: #b1b100; font-weight: bold;">SET</span></a> <span style="color: #448844;">SmallRepoPath</span>=c:\SmallRepos</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.ss64.com/nt/set.html"><span style="color: #b1b100; font-weight: bold;">SET</span></a> <span style="color: #448844;">PathToRepo</span>=c:\BigRepo</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.ss64.com/nt/set.html"><span style="color: #b1b100; font-weight: bold;">SET</span></a> <span style="color: #448844;">UNCToRepo</span>=file:///c:/BigRepo</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.ss64.com/nt/set.html"><span style="color: #b1b100; font-weight: bold;">SET</span></a> <span style="color: #448844;">PathToChkout</span>=c:\BigRepoChkout</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mkdir %<span style="color: #448888;">PathToChkout</span>%</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">svn co %<span style="color: #448888;">uncToRepo</span>% %<span style="color: #448888;">PathToChkout</span>% --ignore-externals</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.ss64.com/nt/dir.html"><span style="color: #b1b100; font-weight: bold;">dir</span></a> /A:D /B %<span style="color: #448888;">PathToChkout</span>%&gt; %<span style="color: #448888;">PathToChkout</span>%\dirs.tmp</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.ss64.com/nt/for.html"><span style="color: #00b100; font-weight: bold;">for</span></a> /F %%i <a href="http://www.ss64.com/nt/in.html"><span style="color: #00b100; font-weight: bold;">in</span></a> <span style="color: #66cc66;">&#40;</span>%<span style="color: #448888;">PathToChkout</span>%\dirs.tmp<span style="color: #66cc66;">&#41;</span> <a href="http://www.ss64.com/nt/do.html"><span style="color: #00b100; font-weight: bold;">do</span></a> <span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.ss64.com/nt/if.html"><span style="color: #00b100; font-weight: bold;">if</span></a> <a href="http://www.ss64.com/nt/not.html"><span style="color: #000000; font-weight: bold;">not</span></a> %%i==.svn <span style="color: #66cc66;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.ss64.com/nt/echo.html"><span style="color: #b1b100; font-weight: bold;">echo</span></a> Processing &quot;%%i&quot;...</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; mkdir %<span style="color: #448888;">SmallRepoPath</span>%\%%i</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; svnadmin create %<span style="color: #448888;">SmallRepoPath</span>%\%%i</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; svnadmin dump %<span style="color: #448888;">PathToRepo</span>% | svndumpfilter include %%i | svnadmin load %<span style="color: #448888;">SmallRepoPath</span>%\%%i</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">del %<span style="color: #448888;">PathToChkout</span>%\dirs.tmp</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rmdir /S /Q %<span style="color: #448888;">PathToChkout</span>% </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>First, we're setting our paths. "SmallRepoPath" will be the directory holding all of the small repositories we'll be creating. "PathToRepo" and "UNCToRepo" point to the big repository as DOS and UNC paths, respectively. "PathToChkout" points to a Subversion checkout of the large repository.</p>
<p>First, we check out the large repository with the "svn co" command. We do this just so that we can call the "dir /A:D /B" command, which says, "List just the directories in the checkout directory." We use that output to loop through each directory in the large repository.</p>
<p>Then, for each directory in the large repository, we create a corresponding small repository, then do our dump/filter/load combo. Again, we're dumping the contents of the large repository, using "svndumpfilter" to filter by directory, then loading that filtered dump into the new small repository.</p>
<p>Finally, we just do some cleanup by removing our temp files and the checkout directory.</p>
<p><strong>There <u>are</u> a few caveats with this code.</strong> </p>
<p>First, it will import <em>all</em> of the large repository's revisions into the smaller repository. There are svndumpfilter arguments to prevent this, such as --drop-empty-revs and --renumber-revs, but I found the Windows Subversion binaries to be problematic with these arguments. The end result is that you have more revision numbers than needed, but only the relevant data is actually imported into the repository, and viewing logs on just the imported directory will still obviously show revision logs related to that directory, so there's really little harm done.</p>
<p>Second, the dump/filter/load action doesn't always work on a directory that has been moved (copied/deleted) from another location within the large repository. What's worse, it won't <em>fail,</em> it just won't load any data into the small repository. To address this, use the --revision argument on the "svnadmin dump" command to do a dump starting at a revision after the move took place. Doing so will give the "svndumpfilter" command something it can work with.</p>
<p>This process is certainly more complicated to <em>explain</em>, but ultimately there's not that much more going on. Hopefully this explanation is helpful to you.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/separating-large-repo/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Avoiding the Password Prompt for SSH</title>
		<link>http://blog.crankybit.com/avoiding-the-password-prompt-for-ssh/</link>
		<comments>http://blog.crankybit.com/avoiding-the-password-prompt-for-ssh/#comments</comments>
		<pubDate>Wed, 15 Oct 2008 16:22:11 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[howto]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/?p=311</guid>
		<description><![CDATA[It's handy to establish an SSH key between machines so that SSH-related commands don't prompt you for a password. This is handy to quickly SSH into another machine, and it's even more handy when setting up SSH commands in automated scripts. For instance, you may want to execute some rsync statements in a script that [...]]]></description>
			<content:encoded><![CDATA[<p>It's handy to establish an SSH key between machines so that SSH-related commands don't prompt you for a password. This is handy to quickly SSH into another machine, and it's even more handy when setting up SSH commands in automated scripts. For instance, you may want to execute some rsync statements in a script that runs on a regular basis. It's better to have an established SSH key between the two machines than to have a password embedded in the script.</p>
<p>I recently reinstalled the OS on one of my Macs, and I've got backup scripts on my CentOS Linux box that use rsync to back up some pertinent data, so I had to reestablish the SSH key between the machines and had a hard time remembering how to do it. So this time I'm documenting what I had to re-learn.</p>
<p>First of all, there's a <a href="http://nixcraft.com/1196-post2.html" target="_blank">great post over at nixCraft</a> that basically explains how to do it. But allow me to explain more thoroughly, ahem, dumbed down to my level. </p>
<p>The key is remembering which machine is filling which role when you're reading the instructions. I'll call them the "Acting" machine--the one who is taking action and performing a command, let's say an rsync command--and the "Target" machine--the one who is being acted upon. In my case, the Linux server is the acting machine performing the rsync command, and my Mac is the target.</p>
<p>The process is simple. On the "Target" machine, generate a key, and then give that key to the "Acting" machine, which effectively gives it "permission" to login without the need to supply username/password credentials.</p>
<p>So, from the "Target" machine, in this case, my Mac, type the following command:</p>
<p>ssh-keygen -t rsa</p>
<p>This will generate a couple files that serve as a key for accessing the Mac. The ssh-keygen command may ask you where to store the key and what password to use. Just hit enter to use the default path and a blank password.</p>
<p>Next, still from the "Target" machine (my Mac), type:</p>
<p>ssh <em>MyUsername@ActingServer</em> "mkdir .ssh"<br />
scp .ssh/id_rsa.pub <em>MyUsername@ActingServer</em>:.ssh/authorized_keys2</p>
<p>In the code above, <em>MyUsername@ActingServer</em> would be the username and address (for instance, perhaps the IP address) of the "Acting" machine, in my case, the Linux server. In the first line, you're just creating the .ssh directory if it doesn't exist. In the second line, you're copying the key you generated from the "Target" machine to the "Acting" machine, or from the Mac to the Linux server.  Note that the scp command will ask for the password to the <em>MyUsername</em> account because it is connecting to that server to send it the key.</p>
<p>Voile. As if by magic, the "Acting" machine should now be able to SSH into the "Target" machine without a password prompt. Correspondingly, you should be able to perform rsync and other SSH commands without a password prompt. Please note, however, that <em>this is only a one-way key.</em><em> </em>We only gave my Linux server permission to access my Mac.</p>
<p><strong>What if I want my Mac to similarly login to the server without a password prompt?</strong> In that case, the Mac and the server have effectively switched roles; the Mac is now the "Acting" machine and the server is the "Target" machine, so we just have to repeat the process from the other direction. Generate a key from the server and send it to the Mac. At that point, both machines will be able to access each other without a password prompt. </p>
<p><strong>What if I have multiple "Targets" that the "Acting" machine will connect to?</strong> For instance, perhaps I have multiple Macs, and the Linux server is running scripts on all of them. When you're sending the key to the "Acting" server with the scp command, use a different name for each key file, don't overwrite the same file each time! So in the example code above, we're sending the key as "authorized_keys2". When repeating this process for multiple targets, send the keys as "authorized_keys3", and so forth.</p>
<p>Hopefully this will clear up some confusion regarding this process.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/avoiding-the-password-prompt-for-ssh/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Shrink the Unshrinkable SQL Transaction Log</title>
		<link>http://blog.crankybit.com/shrink-the-unshrinkable-sql-transaction-log/</link>
		<comments>http://blog.crankybit.com/shrink-the-unshrinkable-sql-transaction-log/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 19:20:00 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[howto]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/?p=309</guid>
		<description><![CDATA[Various reasons may cause SQL Server to get in a rut and not empty the transaction log of a database. In my case, our database backups were failing without our knowledge for several weeks, so the backups were never successful, and the transaction logs of a few databases grew so large that the backup process [...]]]></description>
			<content:encoded><![CDATA[<p>Various reasons may cause SQL Server to get in a rut and not empty the transaction log of a database. In my case, our database backups were failing without our knowledge for several weeks, so the backups were never successful, and the transaction logs of a few databases grew so large that the backup process would still not clear out the transaction log. In one case, we had a 187MB database with a <span style="text-decoration: underline;">37GB</span> transaction log!</p>
<p>The insanity had to stop! A handful of databases like this would put us over the top on that particular server's hard drive storage.</p>
<p>The SQL Server GUI for shrinking the database rendered no effect, and even using the DBCC SHRINKFILE command was not working.</p>
<p>The key, as explained by <a href="http://blog.sqlauthority.com/2006/12/30/sql-server-shrinking-truncate-log-file-log-full/" target="_blank">Pinal Dave</a>, is to run the SHRINKFILE command <em>twice, </em>with an explicit backup log truncation in between both runs. This code here will get you up and running:</p>
<div class="igBar"><span id="lsql-14"><a href="#" onclick="javascript:showCodeTxt('sql-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-14">
<div class="sql">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">DBCC SHRINKFILE<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"MyDatabase_Log"</span>, <span style="color: #cc66cc;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">BACKUP LOG MyDatabase <span style="color: #993333; font-weight: bold;">WITH</span> TRUNCATE_ONLY</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">DBCC SHRINKFILE<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">"MyDatabase_Log"</span>, <span style="color: #cc66cc;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This freed up dozens of gigabytes on our server.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/shrink-the-unshrinkable-sql-transaction-log/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>How to Fix 301 Error for Subversion Checkouts</title>
		<link>http://blog.crankybit.com/how-to-fix-301-error-for-subversion-checkouts/</link>
		<comments>http://blog.crankybit.com/how-to-fix-301-error-for-subversion-checkouts/#comments</comments>
		<pubDate>Mon, 23 Jun 2008 11:41:59 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[howto]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/?p=306</guid>
		<description><![CDATA[My Linux box was hosting Subversion with no problem. I added a new repository to the several that were already present, and when I checked it out, it said, "301 Moved Permanently". Excuse me? As it turns out, there is a 301 error section in the Subversion FAQs. It says that this typically means your [...]]]></description>
			<content:encoded><![CDATA[<p>My Linux box was hosting Subversion with no problem. I added a new repository to the several that were already present, and when I checked it out, it said, "301 Moved Permanently". Excuse me?</p>
<p>As it turns out, there is a <a href="http://subversion.tigris.org/faq.html#301-error" target="_blank">301 error</a> section in the Subversion FAQs. It says that this typically means your Apache configuration is invalid (nope, the rest of my repositories worked just fine) or your repository has the same path as a literal directory on your web root. <em>Ahhh! </em></p>
<p>Sure enough, my subversion path was http://myserver.com/xyz/, and I had a literal directory named "xyz" in the web root. I changed that directory name, and Subversion would then allow me to checkout the repository with no problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/how-to-fix-301-error-for-subversion-checkouts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using SQL to Retrieve SQL</title>
		<link>http://blog.crankybit.com/sql-to-retrieve-sql/</link>
		<comments>http://blog.crankybit.com/sql-to-retrieve-sql/#comments</comments>
		<pubDate>Mon, 28 Apr 2008 12:03:39 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[howto]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/?p=296</guid>
		<description><![CDATA[At work, someone made a request that required me to look through potentially hundreds of views in dozens of databases on our SQL Server. I certainly didn't want to examine each one at a time. How could I speed up this process with code? Well, you can find all of your views by querying the sysobjects [...]]]></description>
			<content:encoded><![CDATA[<p>At work, someone made a request that required me to look through potentially hundreds of views in dozens of databases on our SQL Server. I certainly didn't want to examine each one at a time. How could I speed up this process with code?</p>
<p>Well, you can find all of your views by querying the <em>sysobjects </em>table, and you can retrieve the SQL behind the views by querying the <em>syscomments </em>table. Something like this works well:</p>
<div class="igBar"><span id="lsql-19"><a href="#" onclick="javascript:showCodeTxt('sql-19'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-19">
<div class="sql">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">SELECT</span> RTrim<span style="color:#006600; font-weight:bold;">&#40;</span>sysobjects.name<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> ViewName,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">       RTrim<span style="color:#006600; font-weight:bold;">&#40;</span>syscomments.text<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> ViewSQL</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">FROM</span>   sysobjects <span style="color: #993333; font-weight: bold;">JOIN</span> syscomments</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">ON</span>     syscomments.id=sysobjects.id</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">WHERE</span>  sysobjects.xtype=<span style="color: #ff0000;">'V'</span> <span style="color: #993333; font-weight: bold;">AND</span> sysobjects.category=<span style="color: #cc66cc;color:#800000;">0</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This will retrieve the SQL code and names of all the views in the current database. This simple query is the heart of the solution. But I would like to retrieve this information for <em>all </em>of the databases.</p>
<p>Well, it's easy enough to get a list of all the databases. The <em>sysdatabases</em> table in the <em>master</em> database has that list. You can query that table, perhaps filtering out some of the system or sample databases included with SQL Server:</p>
<div class="igBar"><span id="lsql-20"><a href="#" onclick="javascript:showCodeTxt('sql-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-20">
<div class="sql">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">SELECT</span> name <span style="color: #993333; font-weight: bold;">FROM</span> master.dbo.sysdatabases</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">WHERE</span> name <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">IN</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">'tempdb'</span>,<span style="color: #ff0000;">'master'</span>,<span style="color: #ff0000;">'msdb'</span>,<span style="color: #ff0000;">'pubs'</span>,<span style="color: #ff0000;">'model'</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> name </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Now just combine this information. To accomplish this, we'll build a stored procedure that will create a temporary table, loop through the databases and query each one for its views, insert the view information into the temporary table, and return the temporary table.</p>
<p>Something like this will do the trick:</p>
<div class="igBar"><span id="lsql-21"><a href="#" onclick="javascript:showCodeTxt('sql-21'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-21">
<div class="sql">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">CREATE</span> PROC dbo.selectViews   <span style="color: #993333; font-weight: bold;">AS</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">BEGIN</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">-- Vars</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">DECLARE @dbname sysname</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">-- Temp Table</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #808080; font-style: italic;">#Results</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#40;</span>  </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  DatabaseName varchar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">200</span><span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  ViewName varchar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">200</span><span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  ViewText nvarchar<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #cc66cc;color:#800000;">4000</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">-- Loop Thru the Databases.</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">DECLARE dbnames_cursor CURSOR</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">FOR</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  <span style="color: #993333; font-weight: bold;">SELECT</span> name <span style="color: #993333; font-weight: bold;">FROM</span> master.dbo.sysdatabases</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  <span style="color: #993333; font-weight: bold;">WHERE</span> name <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">IN</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color: #ff0000;">'tempdb'</span>,<span style="color: #ff0000;">'master'</span>,<span style="color: #ff0000;">'msdb'</span>,<span style="color: #ff0000;">'pubs'</span>,<span style="color: #ff0000;">'model'</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  <span style="color: #993333; font-weight: bold;">ORDER</span> <span style="color: #993333; font-weight: bold;">BY</span> name</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">OPEN dbnames_cursor</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">FETCH NEXT <span style="color: #993333; font-weight: bold;">FROM</span> dbnames_cursor <span style="color: #993333; font-weight: bold;">INTO</span> @dbname</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">WHILE <span style="color:#006600; font-weight:bold;">&#40;</span>@@FETCH_STATUS &amp;lt;&amp;gt; -<span style="color: #cc66cc;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">BEGIN</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  <span style="color: #993333; font-weight: bold;">IF</span> <span style="color:#006600; font-weight:bold;">&#40;</span>@@FETCH_STATUS &amp;lt;&amp;gt; -<span style="color: #cc66cc;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  BEGIN   </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color: #808080; font-style: italic;">-- Grab the Views of this Database and Put them in the Temp Table.</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color: #993333; font-weight: bold;">SET</span> @dbname = RTRIM<span style="color:#006600; font-weight:bold;">&#40;</span>@dbname<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #808080; font-style: italic;">#Results</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    EXECUTE</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">      <span style="color: #ff0000;">'SELECT '</span><span style="color: #ff0000;">''</span>+@dbName+<span style="color: #ff0000;">''</span><span style="color: #ff0000;">' as DatabaseName, '</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">      <span style="color: #ff0000;">'RTrim('</span> + @dbname + <span style="color: #ff0000;">'.dbo.sysobjects.name) as ViewName, '</span> +</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">      <span style="color: #ff0000;">'RTrim('</span> + @dbname + <span style="color: #ff0000;">'.dbo.syscomments.text) as ViewText '</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">      <span style="color: #ff0000;">'FROM '</span> + @dbName + <span style="color: #ff0000;">'.dbo.sysobjects join '</span> + @dbName + <span style="color: #ff0000;">'.dbo.syscomments '</span> +</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">      <span style="color: #ff0000;">'ON '</span> + @dbName + <span style="color: #ff0000;">'.dbo.syscomments.id='</span> + @dbName + <span style="color: #ff0000;">'.dbo.sysobjects.id '</span> +</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">      <span style="color: #ff0000;">'WHERE '</span> + @dbname + <span style="color: #ff0000;">'.dbo.sysobjects.xtype='</span><span style="color: #ff0000;">'V'</span><span style="color: #ff0000;">' and '</span> + @dbname + <span style="color: #ff0000;">'.dbo.sysobjects.category=0 '</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">    <span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  END</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">  FETCH NEXT <span style="color: #993333; font-weight: bold;">FROM</span> dbnames_cursor <span style="color: #993333; font-weight: bold;">INTO</span> @dbname</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">END</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">CLOSE dbnames_cursor</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">DEALLOCATE dbnames_cursor</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">SELECT</span> * <span style="color: #993333; font-weight: bold;">FROM</span> <span style="color: #808080; font-style: italic;">#Results order by DatabaseName, ViewName</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">DROP</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #808080; font-style: italic;">#Results</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">END</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;">-- </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Now just execute the stored procedure and review its output.</p>
<div class="igBar"><span id="lsql-22"><a href="#" onclick="javascript:showCodeTxt('sql-22'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-22">
<div class="sql">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">exec selectViews </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This portion of the solution just retrieves the data. After writing this, I developed a really short and simple ColdFusion application that would output the database name, view name, and SQL to a table, and used some simple JavaScript to make it easier to search and filter the views. The client-side methods used to view and work with the data are obviously up to you.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/sql-to-retrieve-sql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Solution to Flex Remoting Over SSL</title>
		<link>http://blog.crankybit.com/flex-remoting-over-ssl/</link>
		<comments>http://blog.crankybit.com/flex-remoting-over-ssl/#comments</comments>
		<pubDate>Tue, 25 Mar 2008 12:21:52 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[General Web Dev.]]></category>
		<category><![CDATA[How To]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/flex-remoting-over-ssl/</guid>
		<description><![CDATA[If you've tried calling ColdFusion CFCs with RemoteObject over SSL in your Flex apps, you probably feel my pain already, because you have either tried to get it working and gave up, or had a heck of a time getting it working. Adobe's documentation for this specific need wasn't helpful to me, and discussion about [...]]]></description>
			<content:encoded><![CDATA[<p>If you've tried calling ColdFusion CFCs with RemoteObject over SSL in your Flex apps, you probably feel my pain already, because you have either tried to get it working and gave up, or had a heck of a time getting it working. Adobe's documentation for this specific need wasn't helpful to me, and discussion about it online is relatively sparse and unsure as well, from what I've seen. My intranet environment at work demanded that I get remote communication with CFCs working over SSL, so as I neared completion of my first couple Flex apps, I needed to get an understanding of this issue. Hopefully it will be useful to others.</p>
<p><strong>So, what's the problem? </strong>In a nutshell, when you try to use the RemoteObject component in a Flex app to communicate with CFCs, the default installation of ColdFusion 8 and Flex Builder 3 will compile your app to communicate with the ColdFusion server over HTTP (http://yourserver.com/flex2gateway/), <em>not</em> over HTTPS (https://yourserver.com/flex2gateway/cfamfsecure), regardless of whether the SWF was loaded over HTTPS or not.</p>
<p>If your site exists in both HTTP and HTTPS, you may not even be aware this is happening. I wasn't aware of it while I was developing on my local machine. But our production server hosts its site <em>only </em>in HTTPS and the site on port 80 is a nearly empty site that redirects all requests to the SSL-protected version of the site. So this behavior broke my Flex app.</p>
<p>If your site exists only in SSL or sensitive data is being transmitted to and from the Flex app and the CFCs, you probably are trying to get RemoteObject to communicate over SSL.</p>
<p><strong>Quick workarounds.</strong> If you have time and leniency to skirt the issue, you can avoid the RemoteObject/SSL issue. You can always use the HTTPService and WebService components instead of RemoteObject. But like most workarounds, this has its disadvantages and limits you from the benefit of using RemoteObject.</p>
<p>I imagine you also could set up a ColdFusion mapping to make the CFCs available on the HTTP site, but this solution is viable only if you really don't care about security, in which case you probably wouldn't have your site wrapped in SSL anyway.</p>
<p><strong>The solution.</strong> What makes the solution tricky is that there are a few things that have to be configured properly, and there are some pitfalls along the way that can be misleading.  The primary solution lies in some changes to the ColdFusion server's config files <em>services-config.xml</em> and <em>remoting-config.xml</em>. These both reside in <em>{ColdFusion installation}</em>\wwwroot\WEB-INF\flex\. For instance, on my Windows workstation, this is located at c:\ColdFusion8\wwwroot\WEB-INF\flex\.</p>
<p><strong>1. Add the secure channel to remoting-config.xml.</strong> ColdFusion 8 already has a channel in its configuration for RemoteObject over SSL--it is called "my-cfamf-secure"--it just isn't configured to be used. So you have to add the "my-cfamf-secure" channel to remoting-config.xml. To do this, add &lt;channel ref="my-cfamf-secure" /&gt; to the &lt;default-channels&gt; node and the &lt;channels&gt; node for the "ColdFusion" destination.</p>
<p>In other words, your new remoting-config.xml file should look like this:</p>
<div class="igBar"><span id="lxml-26"><a href="#" onclick="javascript:showCodeTxt('xml-26'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-26">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;</span>?xml <span style="color: #000066;">version</span>=<span style="color: #ff0000;">"1.0"</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">"UTF-8"</span>?<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;service</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"remoting-service"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"flex.messaging.services.RemotingService"</span> <span style="color: #000066;">messageTypes</span>=<span style="color: #ff0000;">"flex.messaging.messages.RemotingMessage"</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;adapters<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;adapter</span>-definition <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"cf-object"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"coldfusion.flash.messaging.ColdFusionAdapter"</span> <span style="color: #000066;">default</span>=<span style="color: #ff0000;">"true"</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;adapter</span>-definition <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"java-object"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"flex.messaging.services.remoting.adapters.JavaAdapter"</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/adapters<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;default</span>-channels<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;channel</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">"my-cfamf-secure"</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;channel</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">"my-cfamf"</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/default</span>-channels<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;destination</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"ColdFusion"</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;channels<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;channel</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">"my-cfamf-secure"</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;channel</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">"my-cfamf"</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/channels<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;properties<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;source<span style="font-weight: bold; color: black;">&gt;</span></span></span>*<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/source<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- define the resolution rules and access level of the cfc being invoked --&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;access<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- Use the ColdFusion mappings to find CFCs, by default only CFC files under your webroot can be found. --&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;use</span>-mappings<span style="font-weight: bold; color: black;">&gt;</span></span>false<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/use</span>-mappings<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- allow &quot;public and remote&quot; or just &quot;remote&quot; methods to be invoked --&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;method</span>-access-level<span style="font-weight: bold; color: black;">&gt;</span></span>remote<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/method</span>-access-level<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/access<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;property</span>-case<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- cfc property names --&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;force</span>-cfc-lowercase<span style="font-weight: bold; color: black;">&gt;</span></span>false<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/force</span>-cfc-lowercase<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- Query column names --&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;force</span>-query-lowercase<span style="font-weight: bold; color: black;">&gt;</span></span>false<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/force</span>-query-lowercase<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="color: #808080; font-style: italic;">&lt;!-- struct keys --&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;force</span>-struct-lowercase<span style="font-weight: bold; color: black;">&gt;</span></span>false<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/force</span>-struct-lowercase<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/property</span>-case<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/properties<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/destination<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/service<span style="font-weight: bold; color: black;">&gt;</span></span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This brings me to the first pitfall to watch out for. Be sure to list &lt;channel ref="my-cfamf-secure" /&gt; <em>ahead of</em> &lt;channel ref="my-cfamf" /&gt; so that ColdFusion will try the secure channel <em>first</em>. </p>
<p><strong>2. Add a property to make IE happy.</strong> At this point, your configuration will be adequate for Firefox. However, IE still seems to get tripped up and tries to access the insecure channel. To fix this, just add &lt;add-no-cache-headers&gt;false&lt;/add-no-cache-headers&gt; to the &lt;properties&gt; node of the &lt;channel-definition&gt; nodes for "my-cfamf" and "my-cfamf-secure" in services-config.xml. </p>
<p>I won't display the entire services-config.xml file here, but your "my-cfamf" channel definition will now look like this:</p>
<div class="igBar"><span id="lxml-27"><a href="#" onclick="javascript:showCodeTxt('xml-27'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-27">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;channel</span>-definition <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"my-cfamf"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"mx.messaging.channels.AMFChannel"</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;endpoint</span> <span style="color: #000066;">uri</span>=<span style="color: #ff0000;">"http://{server.name}:{server.port}{context.root}/flex2gateway/"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"flex.messaging.endpoints.AMFEndpoint"</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;properties<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;polling</span>-enabled<span style="font-weight: bold; color: black;">&gt;</span></span>false<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/polling</span>-enabled<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;serialization<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;instantiate</span>-types<span style="font-weight: bold; color: black;">&gt;</span></span>false<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/instantiate</span>-types<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/serialization<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;add</span>-no-cache-headers<span style="font-weight: bold; color: black;">&gt;</span></span>false<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/add</span>-no-cache-headers<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/properties<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/channel</span>-definition<span style="font-weight: bold; color: black;">&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>And the "my-cfamf-secure" channel definition:</p>
<div class="igBar"><span id="lxml-28"><a href="#" onclick="javascript:showCodeTxt('xml-28'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">XML:</span>
<div id="xml-28">
<div class="xml">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;channel</span>-definition <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"my-cfamf-secure"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"mx.messaging.channels.SecureAMFChannel"</span><span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;endpoint</span> <span style="color: #000066;">uri</span>=<span style="color: #ff0000;">"https://{server.name}:{server.port}{context.root}/flex2gateway/cfamfsecure"</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">"flex.messaging.endpoints.SecureAMFEndpoint"</span><span style="font-weight: bold; color: black;">/&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;properties<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;polling</span>-enabled<span style="font-weight: bold; color: black;">&gt;</span></span>false<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/polling</span>-enabled<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;serialization<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;instantiate</span>-types<span style="font-weight: bold; color: black;">&gt;</span></span>false<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/instantiate</span>-types<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/serialization<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;add</span>-no-cache-headers<span style="font-weight: bold; color: black;">&gt;</span></span>false<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/add</span>-no-cache-headers<span style="font-weight: bold; color: black;">&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/properties<span style="font-weight: bold; color: black;">&gt;</span></span></span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/channel</span>-definition<span style="font-weight: bold; color: black;">&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>Some more pitfalls to consider.</strong> These can be really misleading, making you think your changes aren't working.</p>
<p><strong>A.</strong> Flex Builder incorporates these settings into your app when it compiles the SWF. Go to your Flex project's properties, under "Flex Compiler", and you'll see a reference to your services-config.xml file. <em>If your SWF is compiled on a workstation that hasn't had these changes, it will not work on your server, even if you did change your server's config files.</em> So be sure that your local installation of ColdFusion has its services-config.xml and remoting-config.xml files updated just like your production server. </p>
<p><strong>B.</strong> On a related note, be sure to <em>recompile</em> an app if you've compiled it before making these config changes. You can recompile in Flex Builder by going to Project &gt; Clean. That option will ensure that you have a clean, recompiled SWF. </p>
<p><strong>C.</strong> If your SWF file is actually served on port 80, it will not be allowed to communicate over the secure channel unless you tell it that it is permissible to do so by setting up a crossdomain.xml file. Check out Shannon Whitley's post <a href="http://www.voiceoftech.com/swhitley/?p=117">SSL, crossing domains, and Flex</a> to read a bit on that.</p>
<p><strong>Tools for the job.</strong> With the right tools, you can test all of these things out on your own. For instance, <a href="http://www.getfirebug.com/">Firebug</a> and <a href="http://www.fiddlertool.com/">Fiddler</a> are great tools for Firefox and IE respectively that clearly show your Flex app's behavior, and whether it is attempting to access the secure or insecure channel. They also show the app attempting to access a crossdomain.xml file when the SWF file was loading over HTTP, because it's first attempt is to make a cross-domain connection to the secure HTTPS channel.</p>
<p>The great thing about this configuration is that your SWFs will use the secure channel when they can, but silently fail over to the insecure channel. So your development workstation doesn't have to use SSL, but your compiled apps will utilize it when you move them to your production server. This is cleaner than setting up a separate "Destination" in remoting-config.xml, or other solutions that require changes to your app's code. Alas, I am still green in the Flex universe and don't claim anything different. Nevertheless, this solution is working perfectly for me and I hope it proves useful for you.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/flex-remoting-over-ssl/feed/</wfw:commentRss>
		<slash:comments>63</slash:comments>
		</item>
		<item>
		<title>Free Command-Line Zip on Windows</title>
		<link>http://blog.crankybit.com/free-command-line-zip-on-windows/</link>
		<comments>http://blog.crankybit.com/free-command-line-zip-on-windows/#comments</comments>
		<pubDate>Fri, 15 Jun 2007 12:30:53 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Batch Scripting]]></category>
		<category><![CDATA[How To]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/free-command-line-zip-on-windows/</guid>
		<description><![CDATA[Both Linux and Mac OS X have zip, gzip, and bzip2 command-line tools. What about Windows? If you're trying to do some scripting to automate some archiving or backup, and you want it to be a classic, WinZip-compatible .zip file, how can you do it? WinZip offers a WinZip Command Line Add-on free of charge--if [...]]]></description>
			<content:encoded><![CDATA[<p>Both Linux and Mac OS X have zip, gzip, and bzip2 command-line tools. What about Windows? If you're trying to do some scripting to automate some archiving or backup, and you want it to be a classic, WinZip-compatible .zip file, how can you do it? </p>
<p>WinZip offers a <a href="http://www.winzip.com/prodpagecl.htm">WinZip Command Line Add-on</a> free of charge--if you already own a copy of <a href="http://www.winzip.com/prodpagewz.htm">WinZip Pro</a>!</p>
<p>You shouldn't have to pay for command-line zip. And you don't have to. Enter <a href="http://www.info-zip.org/">Info-ZIP</a>. This workgroup has been maintaining free, portable, high-quality versions of zip and unzip. They have plenty of command-line arguments like you would expect from an open source project. </p>
<p>So, with this project's executables in your system path, you can write up a batch file that is executed as a Windows scheduled task. Maybe something like this:</p>
<div class="igBar"><span id="ldos-31"><a href="#" onclick="javascript:showCodeTxt('dos-31'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">DOS:</span>
<div id="dos-31">
<div class="dos">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">zip -q -S -r c:pathMyBackup.zip c:data -i@include.lst </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This will zip the c:data directory. Arguments: <strong>-q</strong> to do it quietly, <strong>-S</strong> to include system files, <strong>-r</strong> to recurse into subdirectories. Finally, use <strong>-i</strong> to point to a file that indicates the exact files to <strong>i</strong>nclude, by means of a carriage return delimited list. </p>
<p>You can alternatively use <strong>-x</strong> to specify only which files should be e<strong>x</strong>cluded. Perhaps something like this:</p>
<div class="igBar"><span id="ldos-32"><a href="#" onclick="javascript:showCodeTxt('dos-32'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">DOS:</span>
<div id="dos-32">
<div class="dos">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">zip -q -S -r c:pathMyBackup.zip c:data -x@exclude.lst </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The command-line flags are all optional, of course. This tool is certainly a must-have for the Windows scripter.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/free-command-line-zip-on-windows/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Site-Wide Error Handler Config Files</title>
		<link>http://blog.crankybit.com/site-wide-error-handler-config-files/</link>
		<comments>http://blog.crankybit.com/site-wide-error-handler-config-files/#comments</comments>
		<pubDate>Tue, 22 May 2007 17:36:36 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[General Web Dev.]]></category>
		<category><![CDATA[How To]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/site-wide-error-handler-config-files/</guid>
		<description><![CDATA[Ray Camden recently gave another friendly reminder to use a site-wide error handler for your ColdFusion site if you're not using &#60;cferror&#62; or onError in your Application.cfc. I've been doing a lot of fine-tuning on my intranet apps at work lately, and realized I never implemented any across-the-board error protection like this. So, using TechNote [...]]]></description>
			<content:encoded><![CDATA[<p>Ray Camden recently gave another <a href="http://ray.camdenfamily.com/index.cfm/2007/5/18/ColdFusion-Security-Reminder--Read-me-now">friendly reminder</a> to use a site-wide error handler for your ColdFusion site if you're not using &lt;cferror&gt; or onError in your Application.cfc.  I've been doing a lot of fine-tuning on my intranet apps at work lately, and realized I never implemented any across-the-board error protection like this. </p>
<p>So, using <a href="http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_19198">TechNote 19198</a> as a starting point, I began writing my error handler.</p>
<p>Being that all my apps go into Subversion now, I am obsessive about putting specific settings of an app into config files, so that my light <a href="http://en.wikipedia.org/wiki/Obsessive-compulsive_disorder">OCD</a> doesn't flare up when those settings need to change (heaven forbid I bump a revision number just for a configuration change!). </p>
<p>This presents a light challenge for a couple reasons. First, the error handler is executed within the application scope of the application that threw the error. It does not automatically run the application.cfm or application.cfc in its own directory. Second, the working path is also the path of the template that threw the error.</p>
<p>These facts threw a wrench in standard operation for me. I store my config file settings in the application scope; that wasn't going to work for the error handler. And I'd like my config file to be in the same directory as my error handler, so I need to be able to FIND the config file.</p>
<p><em>Finding</em> the config file is easy. Although ExpandPath() will operate from the working path of the erring template, GetCurrentTemplatePath() will still return the error handler's path. Use the GetDirectoryFromPath() function and append the filename of your config file.</p>
<div class="igBar"><span id="lcfm-36"><a href="#" onclick="javascript:showCodeTxt('cfm-36'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CFM:</span>
<div id="cfm-36">
<div class="cfm">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #333333;"><span style="color: #990000;">&lt;cfset</span> ConfigPath=<span style="color: #0000FF;">GetDirectoryFromPath</span><span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">GetCurrentTemplatePath</span><span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">&#41;</span><span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF">&amp;</span> <span style="color: #009900;">"Config.xml"</span><span style="color: #990000;">&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Great, now we have a path to look at.</p>
<p>I use a custom tag (hey, it was written before CFMX) named &lt;cf_AppConfig&gt; that receives a config file path, retrieves the application settings from the file, and stores them in the Application scope. In my case, I needed to modify this custom tag to allow me to specify the scope the settings would be written in. Then, I simply write the settings in the Variables scope instead of the Application scope, to avoid accidentally overwriting any values of the existing application (or throwing an error if the Application scope isn't available!).</p>
<p>I can now cleanly retrieve settings from a config file for my error handler.</p>
<p>What kind of settings am I placing in this error handler's config file? Well, the error handler accomplishes three tasks: (a) Display a friendly error page, instead of the ugly ColdFusion default error handling. (b) Log the error with &lt;cflog&gt;. (c) Send details of the error via email.</p>
<p>That said, I put the email sender, recipient, and subject line in the config file. I also could put the name of the log file that &lt;cflog&gt; should write to. </p>
<p>I also have a config setting for the "Mode" of the server. In my case, I have a &lt;cf_SiteConfig&gt; custom tag that retrieves various site-wide settings from a global config file stored outside the web root. The "Mode" is one of those settings; it is set to "Production" for our live server and "Development" for my local PC and my QA server.</p>
<p>By looking at the "Mode" of your server, you can have your site-wide error handler "disable" itself on your development boxes. After all, I don't want to be getting email notifications all day long from my development server as I'm debugging my apps, and I don't want to hide the error information. To do that is simple. Manually throwing an error in your error handler will cause ColdFusion to abort the error handler and resort back to its default error management.</p>
<div class="igBar"><span id="lcfm-37"><a href="#" onclick="javascript:showCodeTxt('cfm-37'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CFM:</span>
<div id="cfm-37">
<div class="cfm">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #333333;"><span style="color: #990000;">&lt;cfif</span> Mode is <span style="color: #009900;">"Development"</span><span style="color: #990000;">&gt;</span></span><span style="color: #333333;">&lt;cfthrow&gt;</span><span style="color: #333333;"><span style="color: #990000;">&lt;/cfif&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>You could accomplish something similar by just looking to see if you're on localhost, or 127.0.0.1.</p>
<div class="igBar"><span id="lcfm-38"><a href="#" onclick="javascript:showCodeTxt('cfm-38'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CFM:</span>
<div id="cfm-38">
<div class="cfm">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #333333;"><span style="color: #990000;">&lt;cfif</span> CGI.REMOTE_ADDR is <span style="color: #009900;">"127.0.0.1"</span><span style="color: #990000;">&gt;</span></span><span style="color: #333333;">&lt;cfthrow&gt;</span><span style="color: #333333;"><span style="color: #990000;">&lt;/cfif&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>That way, if the browser is on the same machine as the server (i.e. while you are developing locally), the error handler would abort. The CGI.REMOTE_ADDR approach would work for you while developing and browsing on a local machine, but would not work for a QA server. For that, store the "Mode" in a config file.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/site-wide-error-handler-config-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remotely Start a VMware Server</title>
		<link>http://blog.crankybit.com/remotely-start-a-vmware-server/</link>
		<comments>http://blog.crankybit.com/remotely-start-a-vmware-server/#comments</comments>
		<pubDate>Mon, 07 May 2007 02:07:52 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Virtualization]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/remotely-start-a-vmware-server/</guid>
		<description><![CDATA[There have been a few times now that I needed to start a VMware virtual machine on my server but I wasn't on a PC that had the VMware console installed. Besides, unless I'm on my own network, starting up a server with the VMware console can be a pain due to slower upstream speeds. [...]]]></description>
			<content:encoded><![CDATA[<p>There have been a few times now that I needed to start a VMware virtual machine on my server but I wasn't on a PC that had the VMware console installed. Besides, unless I'm on my own network, starting up a server with the VMware console can be a pain due to slower upstream speeds.</p>
<p>Well, I finally took the time to find out how to do this from the command line. It's simple. </p>
<p>Get the current state of the virtual machine. Is it running or not?</p>
<div class="igBar"><span id="lcode-41"><a href="#" onclick="javascript:showCodeTxt('code-41'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-41">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$ vmware-cmd /path/to/vm/machine.<span style="">vmx</span> getstate </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>And start it.</p>
<div class="igBar"><span id="lcode-42"><a href="#" onclick="javascript:showCodeTxt('code-42'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-42">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$ vmware-cmd /path/to/vm/machine.<span style="">vmx</span> start </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>There are many other things you can do as well. Just <span class="mono">man vmware-cmd</span>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/remotely-start-a-vmware-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Make ColdFusion Sleep</title>
		<link>http://blog.crankybit.com/how-to-make-coldfusion-sleep/</link>
		<comments>http://blog.crankybit.com/how-to-make-coldfusion-sleep/#comments</comments>
		<pubDate>Sat, 27 Jan 2007 11:13:59 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[General Web Dev.]]></category>
		<category><![CDATA[How To]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/how-to-make-coldfusion-sleep/</guid>
		<description><![CDATA[From time to time, you need to make your web app pause for a number of milliseconds or seconds. The need isn't often, but it does come up. There is no ColdFusion function or tag that accomplishes this currently, but you can do it with the following code snippet: PLAIN TEXT CFM: &#60;cfscript&#62; &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>From time to time, you need to make your web app pause for a number of milliseconds or seconds. The need isn't often, but it does come up. There is no ColdFusion function or tag that accomplishes this currently, but you can do it with the following code snippet:</p>
<div class="igBar"><span id="lcfm-44"><a href="#" onclick="javascript:showCodeTxt('cfm-44'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CFM:</span>
<div id="cfm-44">
<div class="cfm">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000099;"><span style="color: #990000;">&lt;cfscript&gt;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; thread <span style="color: #0000FF">=</span> <span style="color: #0000FF;">CreateObject</span><span style="color: #0000FF;">&#40;</span><span style="color: #009900;">"java"</span>, <span style="color: #009900;">"java.lang.Thread"</span><span style="color: #0000FF;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; thread.sleep<span style="color: #0000FF;">&#40;</span><span style="color: #FF0000;color:#800000;">4000</span><span style="color: #0000FF;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #990000;">&lt;cfscript&gt;</span> </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This example will sleep for 4000 milliseconds, or 4 seconds.</p>
<p>This isn't news. There are many blogs out there that mention this extremely useful tidbit. Again, I don't mean to add to the echo chamber; I just use my blog as my initial reference point for little technical tidbits, so I had to throw it in there.</p>
<p>This is useful when ColdFusion needs to wait for a task to complete. For instance, I'm working with Active Directory today, and if I change an account in the directory with a DSMod command and then immediately make an LDAP call to load that account's updated information, the directory doesn't have time to react to the change and sends the old information in the LDAP query. If ColdFusion pauses about 2 seconds before querying LDAP, however, the updated information will come through, because the directory has time to catch up with the DSMod command. This is just one example of the usefulness of "putting ColdFusion to sleep".</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/how-to-make-coldfusion-sleep/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Configuring Subversion for HTTP Access Behind Proxy</title>
		<link>http://blog.crankybit.com/configuring-subversion-for-http-access-behind-proxy/</link>
		<comments>http://blog.crankybit.com/configuring-subversion-for-http-access-behind-proxy/#comments</comments>
		<pubDate>Fri, 19 Jan 2007 22:23:41 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Subversion]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/configuring-subversion-for-http-access-behind-proxy/</guid>
		<description><![CDATA[For the life of me, I couldn't figure out why I was unable to checkout from my Subversion repository while I was at work. It worked while I was at home (where my Subversion server is) just a few days ago, and I can view the repository using Subversion's built-in web page functionality, but if [...]]]></description>
			<content:encoded><![CDATA[<p>For the life of me, I couldn't figure out why I was unable to checkout from my Subversion repository while I was at work. It worked while I was at home (where my Subversion server is) just a few days ago, and I can view the repository using Subversion's built-in web page functionality, but if I tried to access the repository from the command-line client or TortoiseSVN, I would get an error message.</p>
<blockquote><p>C:>svn  co  <a href="http://myserver/Path/To/Proj/">http://MyServer/Path/To/Proj/</a>  MyProj<br />
svn: REPORT request failed on '/Proj/!svn/vcc/default'<br />
svn: REPORT of '/Proj/!svn/vcc/default': 400 Bad Request (<a href="http://myserver/">http://MyServer</a>)</p></blockquote>
<p>Yeah, <em>that's</em> not cryptic. Fortunately, the solution is simple. Sander Striker explained in a thread <a href="http://svn.haxx.se/users/archive-2004-02/0982.shtml" target="_blank">REPORT request failed ... 400 Bad Request</a> that if you're behind a proxy at work, and the proxy isn't configured to support the necessary Subversion calls REPORT, your request will fail.</p>
<p>Like he says in his message, you could request that the proxy be configured to allow the necessary requests, but you could just as well configure your server to work on a different port. Now, I <u>like</u> the fact that my Subversion calls can work on port 80, and I don't want to change that. So, I configured Apache to have my Subversion sites work on an <em>additional </em>port.</p>
<p>In the following example, let's use port 81 as the additional port. So my example URL <a href="http://myserver/Path/To/Proj/">http://MyServer/Path/To/Proj/</a> would become <a href="http://MyServer:81/Path/To/Proj/">http://MyServer:81/Path/To/Proj/</a>.</p>
<p>At the following spots in your httpd.conf file, make the one-time additions as marked in bold italics:</p>
<blockquote><p>Listen 80<br />
<strong><em>Listen 81</em></strong></p></blockquote>
<p>And... </p>
<blockquote><p>NameVirtualHost *:80<br />
<strong><em>NameVirtualHost *:81</em></strong></p></blockquote>
<p>And for every virtual host entry you have for a Subversion site (I host a couple different Subversion sites), add <strong>*:81</strong> in the VirtualHost header:</p>
<blockquote><p>< VirtualHost *:80 <strong><em>*:81 </em></strong>></p></blockquote>
<p>After restarting Apache, you will now be able to continue to use the URLs you normally use, but anytime you need to checkout from the repository while at work behind a proxy, you can use port 81 to do so successfully.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/configuring-subversion-for-http-access-behind-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Resetting Terminal Services Connections</title>
		<link>http://blog.crankybit.com/resetting-terminal-services-connections/</link>
		<comments>http://blog.crankybit.com/resetting-terminal-services-connections/#comments</comments>
		<pubDate>Sat, 23 Dec 2006 11:37:34 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/resetting-terminal-services-connections/</guid>
		<description><![CDATA[A few days ago at work, I went to connect to a headless server at work, and it indicated that I couldn't connect because all the Terminal Services connections were in use. What now? There are graceful ways around the issue. You can (a) Reset one of the connections remotely, freeing up room for you, [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago at work, I went to connect to a headless server at work, and it indicated that I couldn't connect because all the Terminal Services connections were in use. What now?</p>
<p>There are graceful ways around the issue. You can <strong>(a) </strong>Reset one of the connections remotely, freeing up room for you, or <strong>(b) </strong>Connect to the computer's console session and then reset the sessions  from a GUI interface.</p>
<p><strong>Resetting connections remotely. </strong>This method is more graceful, but requires a bit more work. As Scott Forsyth described in <a target="_blank" href="http://weblogs.asp.net/owscott/archive/2003/12/30/Managing-Terminal-Services-Sessions-Remotely.aspx">Managing Terminal Services Sessions Remotely</a>, the qwinsta (<strong>q</strong>uery <strong>win</strong>dows <strong>sta</strong>tion) and rwinsta (<strong>r</strong>eset <strong>win</strong>dows <strong>sta</strong>tion) commands can help you accomplish this.</p>
<p>Use qwinsta to find a session to clear, or reset:</p>
<p><code>C:>qwinsta /server:MyServerName<br />
SESSIONNAME       USERNAME                  ID  STATE   TYPE        DEVICE<br />
0  Disc    rdpwd<br />
rdp-tcp                                 65536  Listen   rdpwd<br />
console                                     5  Conn     wdcon<br />
rdp-tcp#59 MyUserName                  2  Active  rdpwd</code></p>
<p>In this example, "MyUserName" has a session, and I could clear that session to take it's place. To do that, I would use rwinsta to clear the session, which has an ID of 2:</p>
<p><code>C:>rwinsta 2 /server:MyServerName /V<br />
Resetting session ID 2<br />
Session ID 2  has been reset</code></p>
<p>With the session being reset, I could now successfully login with Remote Desktop.</p>
<p><strong>Connecting to a console session.</strong> Windows will always have a console session, which is the session that represents the session outputting to the physical monitor, if one were plugged in. If a user were logged into the machine and physically using the mouse, keyboard, and monitor that are plugged into the machine, and you then connected remotely to the console session, their session would be disconnected and you would connect to that console session.  Obviously, this is not the typical approach you would want to take, but it <u>is</u> an option when you need to force yourself onto the computer.</p>
<p>Basically, this is accomplished by running Remote Desktop from the command line (<a target="_blank" href="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/ts_cmd_mstsc.mspx?mfr=true">mstsc</a>) and invoking the command line argument to connect to the console session.</p>
<p><code>mstsc -v:MyServerName -console</code></p>
<p>That's all there is to it! At that point, you can either proceed with your work or use the console session to clear any other Terminal Services sessions in the Terminal Services control panel.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/resetting-terminal-services-connections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding a Drive to Your Linux System</title>
		<link>http://blog.crankybit.com/adding-a-drive-to-your-linux-system/</link>
		<comments>http://blog.crankybit.com/adding-a-drive-to-your-linux-system/#comments</comments>
		<pubDate>Sat, 18 Nov 2006 04:00:35 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/adding-a-drive-to-your-linux-system/</guid>
		<description><![CDATA[I have a server that has 2 IDE channels, no spare IDE cards, and 4 hard drives that I want to be running. This will obviously take up all 4 drive spaces in my 2 IDE channels. But to install the OS, I will need to use one of those spaces for the CD-ROM drive, [...]]]></description>
			<content:encoded><![CDATA[<p>I have a server that has 2 IDE channels, no spare IDE cards, and 4 hard drives that I want to be running. This will obviously take up all 4 drive spaces in my 2 IDE channels. But to install the OS, I will need to use one of those spaces for the CD-ROM drive, meaning I can only install the OS with 3 of the drives.</p>
<p>To put the fourth drive in there, I would remove the CD-ROM drive after installation of the OS and put in the fourth hard drive. So how do I configure Linux to recognize the fourth and final drive? On my Fedora Core system, it's easy. These steps will assume the drive is already partitioned and formatted. </p>
<p><strong>The mount point. </strong>First, make the directory for the mount point. For instance, I'll create a directory in the /mnt directory:</p>
<blockquote><p>mkdir /mnt/mynewdrive</p></blockquote>
<p><strong>The fstab entry. </strong>You'll have to know which letter your drive has been assigned, and the partition number of your volume. Likely, it will be hdd, since hda, hdb, and hdc will be assigned to the first three. And if the drive is just one large partition, it will obviously be partition 1. So, the desired volume in this instance would be hdd1. Thus, you can map /dev/hdd1 to the /mnt/mynewdrive directory by editing /etc/fstab with the following line:</p>
<blockquote><p>/dev/hdd1   /mnt/mynewdrive   ext3   defaults   1 1</p></blockquote>
<p>Naturally, substitute <em>ext3</em> with whatever filesystem you're using, if different.</p>
<p>You could avoid using an editor to make this change by doing a command like this:</p>
<blockquote><p>echo /dev/hdd1   /mnt/mynewdrive   ext3   defaults   1 1 >> /etc/fstab</p></blockquote>
<p><strong>First-time mount. </strong>Then, simply call a mount command:</p>
<blockquote><p>mount /mnt/mynewdrive</p></blockquote>
<p>You'll only have to do this the first time. If you have automounting set up, the drive will automount in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/adding-a-drive-to-your-linux-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backup and Restore Your SQL Database</title>
		<link>http://blog.crankybit.com/backup-and-restore-your-sql-database/</link>
		<comments>http://blog.crankybit.com/backup-and-restore-your-sql-database/#comments</comments>
		<pubDate>Thu, 16 Nov 2006 18:54:00 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[How To]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/backup-and-restore-your-sql-database/</guid>
		<description><![CDATA[It's easy to backup or restore your database directly with SQL. backup database MyDatabase TO DISK='c:pathtoMyDatabase.bak' with INIT The syntax is pretty self-explanatory once you see it. Backup the database "TO DISK", or to a file at the designated path. The "WITH INIT" specifies that any existing backup file will be overwritten. The restore syntax [...]]]></description>
			<content:encoded><![CDATA[<p>It's easy to backup or restore your database directly with SQL.</p>
<blockquote><p>backup database <em>MyDatabase</em> TO DISK=<em>'c:pathtoMyDatabase.bak'</em> with INIT</p></blockquote>
<p>The syntax is pretty self-explanatory once you see it. Backup the database "TO DISK", or to a file at the designated path. The "WITH INIT" specifies that any existing backup file will be overwritten.</p>
<p>The restore syntax is nearly identical. If the database you are restoring currently exists, be sure to <em>drop the database</em> before doing the restore.</p>
<blockquote><p>restore database <em>MyDatabase</em> FROM DISK=<em>'c:pathtoMyDatabase.bak'</em></p></blockquote>
<p>Simple as that.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/backup-and-restore-your-sql-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

