<?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; Microsoft</title>
	<atom:link href="http://blog.crankybit.com/tags/microsoft/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>Redirecting Errors to a File in Windows Batch Scripts</title>
		<link>http://blog.crankybit.com/redirecting-errors-to-a-file-in-windows-batch-scripts/</link>
		<comments>http://blog.crankybit.com/redirecting-errors-to-a-file-in-windows-batch-scripts/#comments</comments>
		<pubDate>Wed, 09 Mar 2011 17:18:31 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Batch Scripting]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[howto]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/?p=344</guid>
		<description><![CDATA[In my post on Redirecting Output to a File in Windows Batch Scripts, I discussed the basics of output redirection into a text file and how this can be used for logging, including error logging by using the &#62;&#38; operator to combine the stderr and stdout streams. But Mark asked, &#8220;How do you just pipe [...]]]></description>
			<content:encoded><![CDATA[<p>In my post on <a target="_blank" href="/redirecting-output-to-a-file-in-windows-batch-scripts/">Redirecting Output to a File in Windows Batch Scripts</a>, I discussed the basics of output redirection into a text file and how this can be used for logging, including error logging by using the <strong>&gt;&amp;</strong> operator to combine the stderr and stdout streams. But Mark asked, &#8220;How do you <em>just</em> pipe stderr without joining it to stdout?&#8221; Good question!</p>
<p>So normal output redirection is handled with just the &gt; or &gt;&gt; operators (depending on whether you want to <em>overwrite</em> or <em>append</em> the target file), like so:</p>
<p><code>dir >> myfile.txt</code></p>
<p>The operator outputs the stdout stream by default. But it can be modified to output the stderr stream by just specifying that stream with the operator. Remember, stderr is stream 2. So, you would do like so:</p>
<p><code>dir 2>> myfile.txt</code></p>
<p>This would write <strong><em>only</em></strong> the error output to the file.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/redirecting-errors-to-a-file-in-windows-batch-scripts/feed/</wfw:commentRss>
		<slash:comments>11</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-3"><a href="#" onclick="javascript:showCodeTxt('dos-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">DOS:</span>
<div id="dos-3">
<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-4"><a href="#" onclick="javascript:showCodeTxt('dos-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">DOS:</span>
<div id="dos-4">
<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>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-6"><a href="#" onclick="javascript:showCodeTxt('sql-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-6">
<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>Combining Repositories Into One Large Repository</title>
		<link>http://blog.crankybit.com/combining-repos/</link>
		<comments>http://blog.crankybit.com/combining-repos/#comments</comments>
		<pubDate>Wed, 16 Jul 2008 05:44:58 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Batch Scripting]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/?p=299</guid>
		<description><![CDATA[I keep all my projects in separate Subversion repositories. I did this because it feels a lot cleaner this way, there is less risk in the event of repository corruption, and I use corresponding Trac projects that I also wanted to keep separate from one project to the next. That said, there are advantages to [...]]]></description>
			<content:encoded><![CDATA[<p>I keep all my projects in separate Subversion repositories. I did this because it feels a lot cleaner this way, there is less risk in the event of repository corruption, and I use corresponding Trac projects that I also wanted to keep separate from one project to the next.</p>
<p>That said, there are advantages to having one single repository. No big deal, that can be done after the fact with code.</p>
<p>Here is some Windows code to combine all the repositories in a directory into a single big repository:</p>
<div class="igBar"><span id="ldos-8"><a href="#" onclick="javascript:showCodeTxt('dos-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">DOS:</span>
<div id="dos-8">
<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;">svndir</span>=c:\Test\svn</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;">bigrepo</span>=c:\Test\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;">bigrepoUNC</span>=file:///c:/Test/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;">rev</span>=<span style="color:#800000;">0</span>:HEAD</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;"><a href="http://www.ss64.com/nt/echo.html"><span style="color: #b1b100; font-weight: bold;">echo</span></a> Setting up the big repository.</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;">rmdir /S /Q %<span style="color: #448888;">bigrepo</span>%</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;">bigrepo</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;">svnadmin create %<span style="color: #448888;">bigrepo</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;"><a href="http://www.ss64.com/nt/cd.html"><span style="color: #b1b100; font-weight: bold;">cd</span></a> %<span style="color: #448888;">svndir</span>%</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&gt; 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>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;"><a href="http://www.ss64.com/nt/echo.html"><span style="color: #b1b100; font-weight: bold;">echo</span></a> Adding %<span style="color: #448888;">svnDir</span>%\%%i to the big repository:</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 dump -r %<span style="color: #448888;">rev</span>% %%i &gt;&nbsp; %%i.dmp</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">svn mkdir -m &quot;Making project directory %%i.&quot; --non-interactive %<span style="color: #448888;">bigrepoUNC</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;">svnadmin load %<span style="color: #448888;">bigrepo</span>% --parent-<a href="http://www.ss64.com/nt/dir.html"><span style="color: #b1b100; font-weight: bold;">dir</span></a> %%i&nbsp; &lt; %%i.dmp</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">del /F /Q %%i.dmp</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: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">del dirs.tmp </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>There's really not much happening here; the process is simple. First, we create the new "big" repository with the <strong>svnadmin create</strong> statement. Second, we loop through the directory, processing each Subversion repository in the directory with a three-step process: <strong>(a)</strong> Dump the repository with the <strong>svnadmin dump</strong> statement into a temporary *.dmp file. <strong>(b)</strong> Explicitly add a new directory in the "big" repository for the current repository we're processing, with the <strong>svn mkdir</strong> statement. <strong>(c)</strong> Import the dump into the "big" repository with the <strong>svnadmin load</strong> statement. Really, the rest of the code is just looping, commenting, or cleanup code.</p>
<p><em><strong>What have we produced?</strong></em> As you might expect, we now have one big repository that has all of the files and commits that were in all of the smaller repositories. The big repository will maintain its own revision numbering, so the revision numbers in your smaller repositories will not match the big repository's revision numbering, although the original <em>commit dates</em> will be preserved. This can be really handy for searching or similar actions that you might do from a more global perspective.</p>
<p>However, this approach is not without its caveats. During the import process, one entire repository is imported at a time. All of a particular repository's revisions will be "grouped" together in the big repository. As a result, revision numbers in the big repository will change every time you recreate it, if there was any new activity in the repositories it contains. For instance, revision #1050 in the big repository may parallel revision #500 in Repository X, but if a commit was added to a repository that is imported before it and the big repository is recreated, that revision would now be #1051. Additionally, although all history and dates are preserved in the revisions, the big repository has commits that are not in chronological order since the import was processed by repository. This inconsistent date/commit ordering can be confusing to some repository reporting tools and may actually render those tools useless to you when they are reporting by date.</p>
<p><em><strong>Filtering by revision. </strong></em>Note that my svnadmin dump statement includes the -r argument, which specifies the beginning and ending revisions to dump. By default, I'm using "0:HEAD", which basically means "dump every revision", or "dump from the first revision to the HEAD, or latest, revision". Changing the beginning and ending revisions can be useful, especially when used with <em>dates</em> instead of actual revision numbers. For instance, you could change the value to <strong>{2007-01-01}:{2007-12-31}</strong> to only dump revisions that were committed in 2007.</p>
<p>Combining all of your smaller repositories into one big repository after the fact isn't a perfect solution, but it can be handy, and it's really easy to do when you have a script like this ready to run.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/combining-repos/feed/</wfw:commentRss>
		<slash:comments>11</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-13"><a href="#" onclick="javascript:showCodeTxt('sql-13'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-13">
<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-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;"><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-15"><a href="#" onclick="javascript:showCodeTxt('sql-15'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-15">
<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-16"><a href="#" onclick="javascript:showCodeTxt('sql-16'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-16">
<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>Microsoft Access 2007 and ColdFusion 8</title>
		<link>http://blog.crankybit.com/msaccess2007-and-cf8/</link>
		<comments>http://blog.crankybit.com/msaccess2007-and-cf8/#comments</comments>
		<pubDate>Tue, 04 Mar 2008 19:45:33 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[General Web Dev.]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/msaccess2007-and-cf8/</guid>
		<description><![CDATA[With Microsoft Office 2007, Microsoft strikes again and implements a new format for their Access database standard. I do not recommend using Microsoft Access databases for production applications. In fact, I believe you will pay, sooner or later, for adopting such a practice. Nevertheless, it is useful for testing or development at times, and more [...]]]></description>
			<content:encoded><![CDATA[<p>With Microsoft Office 2007, Microsoft strikes again and implements a new format for their Access database standard. I do <u>not</u> recommend using Microsoft Access databases for production applications. In fact, I believe you will pay, sooner or later, for adopting such a practice. Nevertheless, it is useful for testing or development at times, and more importantly, you may be in a situation like me, where there are databases that you do not "own" or control but your ColdFusion apps must use them.</p>
<p>That said, please note that the drivers that come with CF8 do not support Access 2007. This is mentioned in the <a href="http://www.adobe.com/support/documentation/en/coldfusion/8/releasenotes.pdf" target="_blank">ColdFusion 8 Release Notes</a> under #69495. The solution is nicely described right in the release notes. Download and install the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=7554F536-8C28-4598-9B72-EF94E038C891" target="_blank">Data Connectivity Components for Office 2007</a>, set up a Windows ODBC connection, and use ColdFusion's ODBC socket driver to connect to the Windows ODBC connection. A bit irritating that all of this has to be done, but like I said at the outset, these irritants are the price you pay, among other things, when using Access databases.</p>
<p>Another point to note! You thought you were done, but no, Microsoft has more joy in store for some of us.  The Office 2007 drivers do not support Windows 2000. So if your server is still sitting on a Windows 2000 installation, the final word is either (a) No Access 2007 for you, or (b) Time to upgrade to Windows 2003 SP1 or later.</p>
<p><strong>UPDATE:</strong> Definitely take note of the comment by Oğuz below that describes using JDBC along with the connectivity engine from Microsoft to create the datasource without having to use an ODBC socket.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/msaccess2007-and-cf8/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Why That Batch For Loop Isn&#8217;t Working</title>
		<link>http://blog.crankybit.com/why-that-batch-for-loop-isnt-working/</link>
		<comments>http://blog.crankybit.com/why-that-batch-for-loop-isnt-working/#comments</comments>
		<pubDate>Mon, 17 Dec 2007 10:07:50 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Batch Scripting]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/why-that-batch-for-loop-isnt-working/</guid>
		<description><![CDATA[Time for another fun foray into Windows batch scripts. Perhaps you've used the FOR /F command to loop through the contents of a file (for instance, perhaps some data that was redirected to a text file from a command). Grab a line, act on its values, and output some text and commands. Let's set this [...]]]></description>
			<content:encoded><![CDATA[<p>Time for another fun foray into Windows batch scripts. Perhaps you've used the <a href="http://www.ss64.com/nt/for_f.html" target="_blank">FOR /F</a> command to loop through the contents of a file (for instance, perhaps some data that was <a href="/redirecting-output-to-a-file-in-windows-batch-scripts/">redirected to a text file</a> from a command). Grab a line, act on its values, and output some text and commands.</p>
<p>Let's set this up. First, we have a data file named SomeAccounts.txt:</p>
<blockquote><p>Josh<br />
Mary<br />
Suzy<br />
Amanda<br />
Trisha<br />
Ben</p></blockquote>
<p>Then, we have ProcessAccounts.bat, which we want to just loop through the accounts in the text file, tell us what they are, and tell us the first letter of the account name (just to have something to do):</p>
<div class="igBar"><span id="ldos-19"><a href="#" onclick="javascript:showCodeTxt('dos-19'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">DOS:</span>
<div id="dos-19">
<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;">file</span>=SomeAccounts.txt</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/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;">file</span>%<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-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;">username</span>=%%i</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/echo.html"><span style="color: #b1b100; font-weight: bold;">echo</span></a> My account, %<span style="color: #448888;">username</span>%, starts with %<span style="color: #448888;">username:~<span style="color:#800000;">0</span>,<span style="color:#800000;">1</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: #66cc66;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Except when you do this, you encounter a problem: All of the values from the FOR loop are the same! It's as if the for loop ran the proper number of times, but it just ran on the last record over and over again! See below:</p>
<blockquote><p>My account, Ben, starts with B.<br />
My account, Ben, starts with B.<br />
My account, Ben, starts with B.<br />
My account, Ben, starts with B.<br />
My account, Ben, starts with B.<br />
My account, Ben, starts with B.</p></blockquote>
<p>What's <em>actually</em> happening is the FOR loop is indeed running over every line, and setting the variables as instructed, but the results of those variables being altered isn't echoed until the FOR loop is complete, so the last value of the variable is what displays. This wouldn't be a problem if you were just using your FOR parameter, in this case <em>%%i</em>, but any variables you set while in the FOR loop, like <em>username</em>, experience this "wait until you're out of the loop" phenomenon.</p>
<p>The fix is simple enough, <u>if</u> you know about it! But I've found the solution to be a bit elusive, which is the whole point of sharing it now.</p>
<p>The key is the <a href="http://www.ss64.com/nt/setlocal.html" target="_blank">setlocal EnableDelayedExpansion</a> command. As explained at ss64.com, making this statement before your FOR loop will enable you to display variables as their value at the moment you're referencing them, or their "intermediate values" while in the middle of the FOR loop. In addition to calling the setlocal command, you then have to reference your variables with the exclamation point (!) rather than percent (%) to indicate that you want to use the intermediate value.</p>
<p>Your script will then look like this:</p>
<div class="igBar"><span id="ldos-20"><a href="#" onclick="javascript:showCodeTxt('dos-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">DOS:</span>
<div id="dos-20">
<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/setlocal.html"><span style="color: #b1b100; font-weight: bold;">setlocal</span></a> EnableDelayedExpansion</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;">file</span>=SomeAccounts.txt</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;">file</span>%<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;"><a href="http://www.ss64.com/nt/set.html"><span style="color: #b1b100; font-weight: bold;">set</span></a> <span style="color: #448844;">username</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;"><a href="http://www.ss64.com/nt/echo.html"><span style="color: #b1b100; font-weight: bold;">echo</span></a> My account, !username!, starts with !username:~<span style="color:#800000;">0</span>,<span style="color:#800000;">1</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>
</ol>
</div>
</div>
</div>
<p></p>
<p>It will now happily act as desired, outputting these results:</p>
<blockquote><p>My account, Josh, starts with J.<br />
My account, Mary, starts with M.<br />
My account, Suzy, starts with S.<br />
My account, Amanda, starts with A.<br />
My account, Trisha, starts with T.<br />
My account, Ben, starts with B.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/why-that-batch-for-loop-isnt-working/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Upgrading Subversion Requires a Bindings Update for Trac!</title>
		<link>http://blog.crankybit.com/upgrading-subversion-requires-a-bindings-update-for-trac/</link>
		<comments>http://blog.crankybit.com/upgrading-subversion-requires-a-bindings-update-for-trac/#comments</comments>
		<pubDate>Fri, 30 Nov 2007 20:49:24 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Subversion]]></category>
		<category><![CDATA[Trac]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/upgrading-subversion-requires-a-bindings-update-for-trac/</guid>
		<description><![CDATA[My Subversion/Trac server was at Trac v0.9.6 and Subversion v1.3.x because those were the latest stable releases when I set up the server. I decided it would be relatively quick and painless to at least get the latest version of Subversion (v1.4.5) installed since I didn't see anything on the web about Trac v0.9.6 being [...]]]></description>
			<content:encoded><![CDATA[<p>My Subversion/Trac server was at Trac v0.9.6 and Subversion v1.3.x because those were the latest stable releases when I set up the server.  I decided it would be relatively quick and painless to at least get the latest version of Subversion (v1.4.5) installed since I didn't see anything on the web about Trac v0.9.6 being incompatible with newer Subversion builds.</p>
<p>Using the Windows binary installer, I had no problem installing Subversion v1.4.5 on the server. I tested everything and Subversion still worked, it showed the new version when accessing via web access, and Trac still worked fine.</p>
<p>Alas: Don't forget that an upgraded version of Subversion will not upgrade your repository. It <u>will</u> upgrade a working copy of a checked-out repository, but it will not upgrade the repository itself.</p>
<p>That said, I was unaware of one more step that you must take to upgrade Subversion on a Subversion/Trac setup: You must also upgrade the Python bindings to Subversion.</p>
<p>This became apparent the next time I created a <u>new</u> repository, which was not a v1.4.x repository, and when I tried to build a Trac environment to point to it, Trac got upset because of the classic "<a href="http://trac.edgewall.org/ticket/3943" target="_blank">Expected version '3' of repository; found version '5'</a>" error. To fix this, you must set up new bindings to the new version of Subversion, as explained in the <a href="http://trac.edgewall.org/wiki/TracSubversion" target="_blank">TracSubversion</a> page.</p>
<p>Now, I obviously love Subversion and I love Trac, but honestly, straight-forward documentation that is easy to understand for someone who doesn't want to get in the thick of it isn't really the strong suit for these communities, at least when it comes to installation and deployment on the server. What exactly it means--and how to do it--when they say, "Update the Subversion bindings" is not easy to understand. However, the solution <u>is</u> simple.  All that is needed is to <a href="http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91&amp;expandFolder=91&amp;folderID=74" target="_blank">download</a> the appropriate "svn-python" Windows installer that matches your version of Subversion and Python (in my case, 1.4.5 and py2.3) and run it on the server.</p>
<p>In my case, I had to stop Apache for the installation to succeed. Upon restarting Apache, everything worked great.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/upgrading-subversion-requires-a-bindings-update-for-trac/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Backward Use of CASE in SQL</title>
		<link>http://blog.crankybit.com/backward-use-of-case-in-sql/</link>
		<comments>http://blog.crankybit.com/backward-use-of-case-in-sql/#comments</comments>
		<pubDate>Fri, 09 Nov 2007 11:15:57 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[General Web Dev.]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/backward-use-of-case-in-sql/</guid>
		<description><![CDATA[I was updating an old app to use SQL on a new SQL Server database rather than an older Access database. As any database programmer is aware, there are irritating inconsistencies between Access SQL and SQL Server's T-SQL, such as absence of the IIF() and Trim() functions in T-SQL. So I was going through the [...]]]></description>
			<content:encoded><![CDATA[<p>I was updating an old app to use SQL on a new SQL Server database rather than an older Access database. As any database programmer is aware, there are irritating inconsistencies between Access SQL and SQL Server's T-SQL, such as absence of the IIF() and Trim() functions in T-SQL.</p>
<p>So I was going through the SQL and making these changes. I came across a very ugly IIF() function similar to this:</p>
<div class="igBar"><span id="lsql-24"><a href="#" onclick="javascript:showCodeTxt('sql-24'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-24">
<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;">IIF<span style="color:#006600; font-weight:bold;">&#40;</span>phLead=True,<span style="color: #ff0000;">'LEAD'</span>, </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">IIF<span style="color:#006600; font-weight:bold;">&#40;</span>phFax=True,<span style="color: #ff0000;">'FAX'</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;">IIF<span style="color:#006600; font-weight:bold;">&#40;</span>phVVM=True,<span style="color: #ff0000;">'VVM'</span>, <span style="color: #ff0000;">'DEPT'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Take that statement and add even more boolean fields. Clearly, the intent was to have a calculated field that had a friendly name based on which boolean field was true.</p>
<p>So, how can this be easily converted into a CASE statement? As it stands, CASE statements are actually more verbose than the IIF() function, and the IIF() function above is already hard to read and verbose as it is.</p>
<p>A direct code conversion would be something like this:</p>
<div class="igBar"><span id="lsql-25"><a href="#" onclick="javascript:showCodeTxt('sql-25'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-25">
<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;">CASE phLead WHEN <span style="color: #cc66cc;color:#800000;">1</span> THEN <span style="color: #ff0000;">'LEAD'</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ELSE CASE phFax WHEN <span style="color: #cc66cc;color:#800000;">1</span> THEN <span style="color: #ff0000;">'FAX'</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;">ELSE CASE phVVM WHEN <span style="color: #cc66cc;color:#800000;">1</span> THEN <span style="color: #ff0000;">'VVM'</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ELSE <span style="color: #ff0000;">'DEPT'</span> END END END </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Ugly, ugly, ugly. The cool thing about CASE that differs from IIF() is that you can attack it from the other direction. Instead of saying, "Is phLead true? Is phFax true? Is phVVM true?", you can instead say, "Okay, who's true? phLead? phFax? phVVM?" It sounds negligible, but the code is shorter and easier to read:</p>
<div class="igBar"><span id="lsql-26"><a href="#" onclick="javascript:showCodeTxt('sql-26'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-26">
<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;">CASE <span style="color: #cc66cc;color:#800000;">1</span> WHEN phLead THEN <span style="color: #ff0000;">'LEAD'</span> </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">WHEN phFax THEN <span style="color: #ff0000;">'FAX'</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;">WHEN phVVM then <span style="color: #ff0000;">'VVM'</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ELSE <span style="color: #ff0000;">'DEPT'</span> END </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Ahh, much better.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/backward-use-of-case-in-sql/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Windows Vista and Samba Not Getting Along: NTLMv2 is the Culprit</title>
		<link>http://blog.crankybit.com/vista-samba-ntlmv2/</link>
		<comments>http://blog.crankybit.com/vista-samba-ntlmv2/#comments</comments>
		<pubDate>Sat, 03 Nov 2007 05:04:33 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/vista-samba-ntlmv2/</guid>
		<description><![CDATA[After installing Windows Vista, I could not connect to my Samba fileshares. I'm running Samba v3.0.10 on CentOS v4.4. It turns out that NTLMv2, the authentication protocol, is required by default on Windows Vista. According to the Samba Features by Release wiki page, support for NTLMv2 in Samba wasn't fully developed until Samba v3.0.21. Running yum [...]]]></description>
			<content:encoded><![CDATA[<p>After installing Windows Vista, I could not connect to my Samba fileshares. I'm running Samba v3.0.10 on CentOS v4.4.</p>
<p>It turns out that <a target="_blank" href="http://en.wikipedia.org/wiki/NTLM#NTLMv2">NTLMv2</a>, the authentication protocol, is <em>required</em> by default on Windows Vista. According to the <a target="_blank" href="http://wiki.samba.org/index.php?title=Samba_Features_added/changed_%28by_release%29&amp;redirect=no#3.0.21.7Ba.2Cb.2Cc.7D">Samba Features by Release</a> wiki page, support for NTLMv2 in Samba wasn't fully developed until Samba v3.0.21.</p>
<p>Running yum would be a quick way to upgrade Samba to a more recent release. For some reason, though, the repositories I'm pointing to only have v3.0.10 as the latest available update. Rather than hassling with it, I found an article that attacks the issue from the Vista end.</p>
<p>The article <a target="_blank" href="http://www.builderau.com.au/blogs/codemonkeybusiness/viewblogpost.htm?p=339270746">Get Vista and Samba to Work</a> explains how to get Vista to use the older authentication protocols, like the original NTLM. After making this change, I was able to login to my shares immediately.</p>
<p>Basically, all you need to do is run the Local Security Policies console snapin (secpol.msc), open Local Policies --&gt; Security Options --&gt; Network Security: LAN Manager authentication level, and change the setting from "NTLMv2 responses only" to one of the more lenient settings, like "LM and NTLM – use NTLMV2 session security if negotiated".</p>
<p>This works for me because I have one, sometimes two, machines with Windows Vista connecting to my server. If you had lots of machines connecting to the server, it'd obviously be worth your time to just upgrade Samba to a version that supports NTLMv2.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/vista-samba-ntlmv2/feed/</wfw:commentRss>
		<slash:comments>2</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-29"><a href="#" onclick="javascript:showCodeTxt('dos-29'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">DOS:</span>
<div id="dos-29">
<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-30"><a href="#" onclick="javascript:showCodeTxt('dos-30'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">DOS:</span>
<div id="dos-30">
<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>A Better Way to Handle CSS Issues in IE</title>
		<link>http://blog.crankybit.com/a-better-way-to-handle-css-issues-in-ie/</link>
		<comments>http://blog.crankybit.com/a-better-way-to-handle-css-issues-in-ie/#comments</comments>
		<pubDate>Sun, 04 Mar 2007 20:05:33 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[General Web Dev.]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/a-better-way-to-handle-css-issues-in-ie/</guid>
		<description><![CDATA[All web developers are familiar with the need to tweak their CSS so that it will look presentable in both IE and other more standards-compliant browsers. Many people have declared, some more infamously than others, that people should boycott IE, and have proceeded to develop designs that are standards-compliant but IE-unfriendly. I feel that this [...]]]></description>
			<content:encoded><![CDATA[<p>All web developers are familiar with the need to tweak their CSS so that it will look presentable in both IE and other more standards-compliant browsers. Many people have declared, some more infamously than others, that people should <a href="http://www.windowsitpro.com/Article/ArticleID/47208/47208.html?Ad=1">boycott IE</a>, and have proceeded to develop designs that are standards-compliant but IE-unfriendly. I feel that this is foolish; IE is still the browser of choice by most non-geek web surfers, and unless you're developing in a controlled environment where you can declare the browser to be used, you really should code for any popular browser, and even then, it's just good practice to write clean code that works everywhere.</p>
<p>Alas, I digress. The point is that IE isn't going anywhere for now, and it is a pain sometimes to figure out how to write CSS that renders as close to identical as possible between IE and other browsers like Firefox. There are <a href="http://www.webcredible.co.uk/user-friendly-resources/css/internet-explorer.shtml">several</a> <a href="http://www.positioniseverything.net/explorer.html">sites</a> <a href="http://css.nu/pointers/bugs-ie.html">out</a> <a href="http://www.webmasterworld.com/forum83/4161.htm">there</a> that endeavor to explain the IE bugs and, when possible, provide workarounds. </p>
<p>Sure, I could just alter the CSS to look right in IE, but if I'm not careful, that "fix" then breaks the code in Firefox! So we've come up with hacks to have CSS that other browsers will see but IE ignores. I don't know about you, but I'm tired of trying to understand and remember these tricks for satiating IE.</p>
<p>Welcome to <a href="http://www.quirksmode.org/css/condcom.html">conditional comments</a> in IE. This is yet another IE-specific feature that we can actually use to our advantage to level the playing field.</p>
<p>Conditional comments are just what they sound like: HTML comments. But these comments are coded in such a way that effectively have a conditional statement in them, and any HTML output within the comments will only be included (by IE) if the condition is true. Here is an example.</p>
<div class="igBar"><span id="lhtml-33"><a href="#" onclick="javascript:showCodeTxt('html-33'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-33">
<div class="html">
<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="color: #808080; font-style: italic;">&lt;!--[if IE 6]&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;"><a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></a></span>I'm running IE 6.<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&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="color: #000000; font-weight: bold;">&lt;</span></a>!<span style="color: #66cc66;">&#91;</span>endif<span style="color: #66cc66;">&#93;</span>--<span style="color: #000000; font-weight: bold;">&gt;</span></a></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>As you can see, any non-IE browser will just ignore all the content, since it's really one large comment. But IE recognizes the conditional logic inside the comment and renders the content accordingly.</p>
<p>Here's an example. This box will have a message if you're on IE, and it will be blank if you're in any other browser:</p>
<blockquote><p><!--[if IE]>You're running IE! Go get Firefox right now!<![endif]--></p></blockquote>
<p>If you wanted, you could use this technique to inject HTML elements specifically for IE.</p>
<p>Yeah. If you want a maintenance nightmare. <em><strong>Do not</strong></em> sprinkle conditional comments in your code.</p>
<p>Rather than having a CSS file littered with IE fixes (or just accepting the variances between IE and Firefox), I would much rather have a single "clean" stylesheet file that is then <em>augmented</em> by an IE-only stylesheet, loaded by IE and ignored by all other browsers via the conditional comments feature.</p>
<p>So, perhaps you might have some code like this in your header:</p>
<div class="igBar"><span id="lhtml-34"><a href="#" onclick="javascript:showCodeTxt('html-34'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-34">
<div class="html">
<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;"><a href="http://december.com/html/4/element/link.html"><span style="color: #000000; font-weight: bold;">&lt;link</span></a> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">"stylesheet"</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"site.css"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></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="color: #808080; font-style: italic;">&lt;!--[if IE]&gt;</span></span><span style="color: #009900;"><a href="http://december.com/html/4/element/link.html"><span style="color: #000000; font-weight: bold;">&lt;link</span></a> <span style="color: #000066;">rel</span>=<span style="color: #ff0000;">"stylesheet"</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">"ie.css"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;</span></a>!<span style="color: #66cc66;">&#91;</span>endif<span style="color: #66cc66;">&#93;</span>--<span style="color: #000000; font-weight: bold;">&gt;</span></a></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>There is still a very real danger here. You don't want to fall into the tendency to write intolerant CSS that needs a lot of "cleanup" to look good in both browsers. Work hard to make your CSS as  compatible as possible, and leave the <span class="mono">ie.css</span> file exclusively for the rare cases where you could not resolve an inconsistency in IE. When you're done, your <span class="mono">ie.css</span> file should be <em>really</em> small, if you require it at all.</p>
<p>Having said that, however, I think this is a graceful solution. You don't sacrifice the consistency of your HTML nor your CSS, and your only extra work is the tweaking done in your IE stylesheet.  Other solutions like <a href="http://www.positioniseverything.net/articles/cc-plus.html">Targeting IE Using Conditional Comments and Just One Stylesheet</a> over at <a href="http://www.positioniseverything.net/">PositionIsEverything.net</a> recommend adding an IE-specific div tag around your content, which would enable you to have a single stylesheet and to not just include IE-specific styles but also <em>exclude</em> certain styles from IE. Unless you have some CSS that you just can't tweak for IE and you <em>have</em> to exclude it, I definitely prefer the simpler approach of just including a secondary, corrective stylesheet and leaving the HTML alone. But that's just the purist in me.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/a-better-way-to-handle-css-issues-in-ie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keep Your cid: in Lowercase for Outlook!</title>
		<link>http://blog.crankybit.com/keep-your-cid-in-lowercase-for-outlook/</link>
		<comments>http://blog.crankybit.com/keep-your-cid-in-lowercase-for-outlook/#comments</comments>
		<pubDate>Fri, 02 Feb 2007 13:01:16 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[General Web Dev.]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/keep-your-cid-in-lowercase-for-outlook/</guid>
		<description><![CDATA[I was pulling my hair out on Wednesday trying to figure out why certain inline images in an email I was generating would not display in Outlook, whereas others would. What's more irritating is that all of the images worked in Outlook Web Access; only the desktop client of Outlook wouldn't display some of the [...]]]></description>
			<content:encoded><![CDATA[<p>I was pulling my hair out on Wednesday trying to figure out why certain inline images in an email I was generating would not display in Outlook, whereas others would.</p>
<p>What's more irritating is that <em>all</em> of the images worked in Outlook Web Access; only the desktop client of Outlook wouldn't display some of the images.</p>
<p>The problem is that something like this is really hard to troubleshoot. After going down many different paths--such as assuming that I was attaching the image incorrectly, or perhaps that Outlook didn't like spaces in its inline attachments, and so on--I finally found the solution.</p>
<p>Outlook was recently patched to flag image references that have a src   attribute with a capitalized CID. Thus, changing < img src = "CID:myimage" > to < img src = "cid:myimage" > fixed the matter.</p>
<p>Oh man. That’s frustrating. So I’m blogging about it in hopes that I might save someone who googled the issue like I did from wasting a couple hours of time.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/keep-your-cid-in-lowercase-for-outlook/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Uninspiring Vista</title>
		<link>http://blog.crankybit.com/uninspiring-vista/</link>
		<comments>http://blog.crankybit.com/uninspiring-vista/#comments</comments>
		<pubDate>Mon, 22 Jan 2007 21:00:01 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/uninspiring-vista/</guid>
		<description><![CDATA[Steve Jobs has revealed that nearly 50% of all Mac sales are from "Switchers", individuals who did not previously own a Mac. So it isn't news to hear about someone getting fed up with Windows and having that epiphany that opens their heart to Apple and OS X. Nevertheless, in her review entitled Uninspiring Vista, [...]]]></description>
			<content:encoded><![CDATA[<p>Steve Jobs has revealed that nearly 50% of all Mac sales are from "Switchers", individuals who did not previously own a Mac. So it isn't news to hear about someone getting fed up with Windows and having that epiphany that opens their heart to Apple and OS X.</p>
<p>Nevertheless, in her review entitled <a target="_blank" href="http://www.technologyreview.com/Infotech/17992/page1/">Uninspiring Vista</a>, Erika Jonietz explains how Windows Vista, as nifty as it is in many ways, was the straw that broke the camel's back and caused her to appreciate how awesome OS X is and the entire Macintosh experience can be.</p>
<p>A great read for any Mac fan!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/uninspiring-vista/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing WriteRoom</title>
		<link>http://blog.crankybit.com/introducing-writeroom/</link>
		<comments>http://blog.crankybit.com/introducing-writeroom/#comments</comments>
		<pubDate>Sun, 31 Dec 2006 11:53:00 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/introducing-writeroom/</guid>
		<description><![CDATA[We've worked so hard at enabling our computers to multitask effectively--and increasingly faster--that we have far surpassed the human ability to multitask. Don't get me wrong; being able to continue browsing the web or working on a document while I'm downloading a large file or processing some video is obviously invaluable. It's hard to imagine [...]]]></description>
			<content:encoded><![CDATA[<p>We've worked so hard at enabling our computers to multitask effectively--and increasingly faster--that we have far surpassed the <em>human </em>ability to multitask. Don't get me wrong; being able to continue browsing the web or working on a document while I'm downloading a large file or processing some video is obviously invaluable. It's hard to imagine a time when we actually had to sit and wait helplessly while our computer chugged away at some data.</p>
<p>Unfortunately, some of us humans might try so hard to leverage our computer's multitasking abilities that the ultimate bottleneck becomes the limit of our own mental concentration. You're working on a document, but you also have your email client open and perhaps a few tabs on your web browser. Before you know it, you've wasted a significant period of time replying to email or going off on a tangent through the web, when the most important task at hand was just to finish typing up that document.</p>
<p>Enter <a target="_blank" href="http://www.hogbaysoftware.com/product/writeroom">WriteRoom</a>. It may seem archaic by today's standards to boot up your computer into a word processor program and to only be able to use your computer for that purpose until you finish and boot into another program, but it sure didn't test human self-control and concentration like the systems we have today. WriteRoom duplicates that simple, distraction-free experience, and while you're at it, gives you a bit of nostalgic joy in the process. <img src='http://blog.crankybit.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  Sure, you could get a similar affect by opening TextEdit (on the Mac) or Notepad (on Windows), but where's the joy in that experience?</p>
<p>Did you grow up on an Apple ][ using AppleWorks with a green-on-black monochrome monitor? WriteRoom's default scheme duplicates just that environment. Did you have the DOS PC's common white-on-blue? Or can you just not stand anything but black-on-white? Fine, the color scheme is customizable. So is the font, so you don't <em>have</em> to stick with a monospaced font, although it sure adds to the nostalgia. <img src='http://blog.crankybit.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>And the best part is that you don't <em>have</em> to give up the multitasking bit to use WriteRoom. You can run iTunes and download that huge file in the background, but experience a visually simple and uncluttered experience while working on your text document.</p>
<p><a target="_blank" href="http://www.hogbaysoftware.com/product/writeroom">WriteRoom</a> is for the Mac only, and the original version is free.  A clone called <a target="_blank" href="http://they.misled.us/dark-room">Dark Room</a> was written to respectfully "capture the essence of WriteRoom" for Windows machines, and is also free.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/introducing-writeroom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows 2003 Upgrade Caused &#8220;500 NULL&#8221; Error in CFMX 7</title>
		<link>http://blog.crankybit.com/windows-2003-upgrade-caused-500-null-error-in-cfmx-7/</link>
		<comments>http://blog.crankybit.com/windows-2003-upgrade-caused-500-null-error-in-cfmx-7/#comments</comments>
		<pubDate>Thu, 28 Dec 2006 13:14:50 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/windows-2003-upgrade-caused-500-null-error-in-cfmx-7/</guid>
		<description><![CDATA[I was testing an OS upgrade from Windows 2000 to Windows 2003 on a ColdFusion webserver earlier this week, and I experienced only one hiccup, although it was a momentary show stopper. The ODBC services would not start, and although the "ColdFusion MX 7 Application Server" service was started, browsing ColdFusion pages received an odd [...]]]></description>
			<content:encoded><![CDATA[<p>I was testing an OS upgrade from Windows 2000 to Windows 2003 on a ColdFusion webserver earlier this week, and I experienced only one hiccup, although it was a momentary show stopper.</p>
<p>The ODBC services would not start, and although the "ColdFusion MX 7 Application Server" service was started, browsing ColdFusion pages received an odd error page:</p>
<p style="margin-left: 40px">500 NULL</p>
<p>There was a <a target="_blank" href="http://www.adobe.com/go/f9e312a2">Macromedia TechNote</a> about this matter, although it was unresolved as of the TechNote's last update.</p>
<p>Whereas a <a target="_blank" href="http://www.google.com/search?q=500+null">Google search</a> will uncover many other times this error may pop up, my circumstances applied after the OS upgrade and on every single page view in its entirety.</p>
<p>The TechNote gives a good hint when it says the error can be caused by an empty or missing license.properties file. My answer was similar: The user that the ColdFusion service was running as didn't have permission, after the upgrade, to read from the CFusionMX7 directory.</p>
<p>I gave the user read rights and everything began working wonderfully.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/windows-2003-upgrade-caused-500-null-error-in-cfmx-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pogue on Windows Vista Copying OS X</title>
		<link>http://blog.crankybit.com/pogue-on-windows-vista-copying-os-x/</link>
		<comments>http://blog.crankybit.com/pogue-on-windows-vista-copying-os-x/#comments</comments>
		<pubDate>Tue, 26 Dec 2006 12:17:27 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Funny]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/pogue-on-windows-vista-copying-os-x/</guid>
		<description><![CDATA[If you haven't seen it yet, David Pogue's video discussing whether Windows Vista copies Mac OS X is pretty entertaining material...for Mac enthusiasts, anyway. Even though I think it is pretty blatant, for those of you who do not realize: David is using a common linguistic tool known as sarcasm.]]></description>
			<content:encoded><![CDATA[<p>If you haven't seen it yet, David Pogue's video discussing whether <a target="_blank" href="http://video.on.nytimes.com/?fr_story=d14603c1e23e6ce37920a8134a2e27b1405a4991&#038;rf=bm">Windows Vista copies Mac OS X</a> is pretty entertaining material...for Mac enthusiasts, anyway.</p>
<p>Even though I think it is pretty blatant, for those of you who do not realize: David is using a common linguistic tool known as <em>sarcasm. </em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/pogue-on-windows-vista-copying-os-x/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>640k is Enough For Anyone</title>
		<link>http://blog.crankybit.com/640k-is-enough-for-anyone/</link>
		<comments>http://blog.crankybit.com/640k-is-enough-for-anyone/#comments</comments>
		<pubDate>Thu, 14 Dec 2006 12:01:49 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[History]]></category>
		<category><![CDATA[IT Industry]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://blog.crankybit.com/640k-is-enough-for-anyone/</guid>
		<description><![CDATA[Back in the day, I used to always love mentioning the supposed quote from Bill Gates, which would have marked him as significantly short-sighted: "640k is more memory than anyone will ever need", or some close variant thereof. We love to quote it, because we love to hate Bill Gates and yet we can relate [...]]]></description>
			<content:encoded><![CDATA[<p>Back in the day, I used to always love mentioning the supposed quote from Bill Gates, which would have marked him as significantly short-sighted: "640k is more memory than anyone will ever need", or some close variant thereof.</p>
<p>We love to quote it, because we love to hate Bill Gates and yet we can relate with the amazement of ever greater RAM requirements. For instance, I never thought when my powerhouse Mac came with 128MB of RAM that one day I would have a Mac with a <em>video card</em> holding more RAM than that! Insert similar nostalgic reflection here, ad nauseam.</p>
<p>Well, now I can just feel stupid and short-sighted <em>without</em> pointing the finger at Bill Gates. I never even thought to verify the quote until today for some unknown reason I decided to. Sure enough, you'll be hard-pressed to find an official citation, and Bill Gates <a href="http://www.wired.com/news/politics/0,1283,1484,00.html" target="_blank">denied ever saying that</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.crankybit.com/640k-is-enough-for-anyone/feed/</wfw:commentRss>
		<slash:comments>3</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>

