<?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>Keith Bentrup&#8217;s Portforlio</title>
	<atom:link href="http://portfolio.keithbentrup.com/feed" rel="self" type="application/rss+xml" />
	<link>http://portfolio.keithbentrup.com</link>
	<description>A brief sampling of my work</description>
	<lastBuildDate>Tue, 02 Mar 2010 23:04:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Setting the file mode in svn</title>
		<link>http://portfolio.keithbentrup.com/archives/258</link>
		<comments>http://portfolio.keithbentrup.com/archives/258#comments</comments>
		<pubDate>Tue, 02 Mar 2010 23:04:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://portfolio.keithbentrup.com/?p=258</guid>
		<description><![CDATA[I sometimes keep and share development related scripts in the repository, but by default, svn will not remember file modes. To set the script to execute, simply type:

svn propset svn:executable ON myfile.sh

In TortoiseSVN, just set a new property on the file:

]]></description>
			<content:encoded><![CDATA[<p>I sometimes keep and share development related scripts in the repository, but by default, svn will not remember file modes. To set the script to execute, simply type:</p>
<pre class="brush: bash;">
svn propset svn:executable ON myfile.sh
</pre>
<p>In TortoiseSVN, just set a new property on the file:<br />
<img src="/wp-content/uploads/2010/03/tortoise.png" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://portfolio.keithbentrup.com/archives/258/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Experimentation in virtualization</title>
		<link>http://portfolio.keithbentrup.com/archives/245</link>
		<comments>http://portfolio.keithbentrup.com/archives/245#comments</comments>
		<pubDate>Mon, 18 Jan 2010 00:53:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://portfolio.keithbentrup.com/?p=245</guid>
		<description><![CDATA[So I&#8217;ve been using virtual machines much more frequently recently, but only new VM&#8217;s that I&#8217;ve created. This weekend was my first attempt at P2V (physical to virtual). I have a decent XP dual core machine that has served me well for the last 2 years, but after my upgrade to a nice I7 Win7 [...]]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;ve been using virtual machines much more frequently recently, but only new VM&#8217;s that I&#8217;ve created. This weekend was my first attempt at P2V (physical to virtual). I have a decent XP dual core machine that has served me well for the last 2 years, but after my upgrade to a nice I7 Win7 laptop, there&#8217;s no going back.</p>
<p>However, the dual core is still very useful. Beyond a useful test rig for XP, it&#8217;s also my only way to get a true IE6 platform to test my web apps. Yes, I know there are many alternatives (<a href="http://multipleies.en.softonic.com/">Multiple IE&#8217;s</a>, <a href="http://spoon.net/browsers/">Spoon.net</a>, etc.). Still sometimes, you have obscure bugs that you absolutely can not reproduce without a native installation. On top of that, when debugging with tools like MS Visual Web Developer that&#8217;s usually beyond the capabilities of the alternatives.</p>
<p>So why not just use Virtual PC and MS&#8217;s <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=21EABB90-958F-4B64-B5F1-73D0A413C8EF&#038;displaylang=en">Internet Explorer Application Compatibility VPC Images</a>? Because MS purposefully cripples Win7 Home Premium from using Virtual PC.  </p>
<p>Also if I could successfully transfer my physical machine to a virtual one, I&#8217;d have access to all my old apps and a system that I backup easily and perfectly forever.</p>
<p>So which route &#8211; VirtualBox or VMWare? Both are free (if you only need VMWare player), but VMWare still <a href="http://stackoverflow.com/questions/630179/benchmark-vmware-vs-virtualbox">dominates</a> virtually, right? (Of course, there&#8217;s some <a href="http://maketecheasier.com/5-reasons-why-you-should-use-virtualbox-over-vmware-server/2008/07/21">dispute</a>.) Plus, when looking over the instructions for P2V, there was no contest. VMWare provides a nice <a href="http://www.vmware.com/products/converter/">converter</a>, and VirtualBox had so many additional <a href="http://www.virtualbox.org/wiki/Migrate_Windows">requirements/steps</a> (not the least of which was another OS).</p>
<p>Unfortunately, VMWare was not to be. I tried the converter a few times &#8211; making sure all the right services where stopped or started as needed, and it looked promising up to the very end but ultimately &#8211; BSOD.</p>
<p>So take two with VirtualBox, fortunately, I have my Ubuntu CD, so I could use <a href="http://www.linuxweblog.com/blogs/sandip/20050211/image-your-hard-drive-using-dd">dd</a> to copy the entire disk (not just the windows partition), and then apt-get the VBoxManage software. </p>
<p>Time to convert the image. First, I shared the newly cloned image on my USB external drive with my Ubuntu VM (also running on VirtualBox)</p>
<pre class="brush: bash;">
mkdir /mnt/share
sudo mount -t vboxsf shared /mnt/share
cd /mnt/share
VBoxManage convertfromraw ImageFile.dd OutputFile.vdi
</pre>
<p>It was a tedious process taking hours to clone, convert, and complete but required little monitoring. Now ready to boot again and &#8230; Bam &#8211; no further than &#8220;XLDR -ATA error&#8221;. </p>
<p>I thought I was stuck now, and starting to wonder how anyone was doing P2V. Though after some quick googling, I found this <a href="http://forum.parallels.com/showthread.php?t=10566">post</a>. So mounted the XP CD, booted to recovery console, fixmbr, fixboot, and I was on my way again. That is until it was time to reactive my XP installation (argh! I got it to work but was considering using WGA Killer if need be.)</p>
<p>It was a long ordeal, and in retrospect, I probably could have gone further with my VMWare diagnosis. I should have tried the recovery console for those BSOD&#8217;s as well. </p>
<p>Still, I&#8217;m up and running and a little bit wiser. I think.</p>
<p>Now it&#8217;s time to <a href="http://www.attackr.com/resize-an-existing-vdi-virtualbox-image-easily/">resize</a> and play with <a href="http://gparted.sourceforge.net/">gparted</a>. A more thorough guide is <a href="http://www.my-guides.net/en/content/view/122/26/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://portfolio.keithbentrup.com/archives/245/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bookmarklet to modify links on a page</title>
		<link>http://portfolio.keithbentrup.com/archives/233</link>
		<comments>http://portfolio.keithbentrup.com/archives/233#comments</comments>
		<pubDate>Tue, 05 Jan 2010 23:20:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://portfolio.keithbentrup.com/?p=233</guid>
		<description><![CDATA[I recently needed to modify hundreds of links on a wiki page based on a dynamic value, so I created a simple bookmarklet (ModWikiLinks).
I searched for a tool to properly format/shrink it and found: the bookmarklet crunchinator.

var user = prompt('Enter your username');
var links = document.querySelectorAll('a[href*=localhost]');
for (i in links) {
 if (typeof links[i].href !== &#34;undefined&#34;) {
 [...]]]></description>
			<content:encoded><![CDATA[<p>I recently needed to modify hundreds of links on a wiki page based on a dynamic value, so I created a simple bookmarklet (<a href="javascript:(function(){var user=prompt('Enter your username');var links=document.querySelectorAll('a[href*=localhost],a[href*=trus_global]');for(i in links){if(typeof links[i].href!=='undefined'){links[i].href=links[i].href.replace(/http:\/\/[^\/]+/,'http://trus_global.'+user+'.webdev.gspt.net');links[i].target='_blank';}}})();">ModWikiLinks</a>).</p>
<p>I searched for a tool to properly format/shrink it and found: the <a href="http://ted.mielczarek.org/code/mozilla/bookmarklet.html">bookmarklet crunchinator</a>.</p>
<pre class="brush: jscript;">
var user = prompt('Enter your username');
var links = document.querySelectorAll('a[href*=localhost]');
for (i in links) {
 if (typeof links[i].href !== &quot;undefined&quot;) {
  links[i].href = links[i].href.replace(/http:\/\/[^\/]+/,'http://trus_global.'+user+'.webdev.gspt.net');
  links[i].target = '_blank';
 }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://portfolio.keithbentrup.com/archives/233/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>pcregrep</title>
		<link>http://portfolio.keithbentrup.com/archives/226</link>
		<comments>http://portfolio.keithbentrup.com/archives/226#comments</comments>
		<pubDate>Thu, 03 Dec 2009 10:43:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://portfolio.keithbentrup.com/?p=226</guid>
		<description><![CDATA[I recently learned about pcregrep, a enhanced grep that supports perl regex syntax. This is great for searches that span multiple line. For example, the other day I was looking thru old css files that had a border set to 0 to be removed due to the inclusion of a reset.css lib. So &#8230;.

pcregrep --color [...]]]></description>
			<content:encoded><![CDATA[<p>I recently learned about <a href="http://linuxcommand.gds.tuwien.ac.at/man_pages/pcregrep1.html">pcregrep</a>, a enhanced grep that supports perl regex syntax. This is great for searches that span multiple line. For example, the other day I was looking thru old css files that had a border set to 0 to be removed due to the inclusion of a reset.css lib. So &#8230;.</p>
<pre class="brush: bash;">
pcregrep --color --exclude_dir=&quot;.svn&quot; --exclude=&quot;reset.css&quot; -rn -M &quot;\bimg\b[^{]*?{[^}]*?(padding|margin|border)\s*:\s*0\s*;&quot; .
</pre>
<p>Piping its output to a few commands, and I can search for bad code, find it&#8217;s line number, and who to blame:</p>
<pre class="brush: bash;">
$ pcregrep --exclude_dir=&quot;.svn&quot; -rn &quot;id=['\&quot;]\w+ &quot; . | awk -F:  '{str=&quot;svn blame &quot; $1 &quot; 2&gt;/dev/null | head -&quot; $2 &quot; | tail -1&quot;; printf &quot;%s:%d&quot;, $1, $2; system(str)}'
</pre>
<p>In this case, it was me?! :p</p>
]]></content:encoded>
			<wfw:commentRss>http://portfolio.keithbentrup.com/archives/226/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More one liners</title>
		<link>http://portfolio.keithbentrup.com/archives/221</link>
		<comments>http://portfolio.keithbentrup.com/archives/221#comments</comments>
		<pubDate>Sun, 01 Nov 2009 01:19:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://portfolio.keithbentrup.com/?p=221</guid>
		<description><![CDATA[Back with more one liners&#8230;
This one converts all html tags in a file to lowercase.
perl -pi.old -e 's/(&#60;\/?)(address&#124;applet&#124;area&#124;a&#124;base&#124;basefont&#124;big&#124;blockquote&#124;body&#124;br&#124;b&#124;caption&#124;center&#124;cite&#124;code&#124;dd&#124;dfn&#124;dir&#124;div&#124;dl&#124;dt&#124;em&#124;font&#124;form&#124;h1&#124;h2&#124;h3&#124;h4&#124;h5&#124;h6&#124;head&#124;hr&#124;html&#124;img&#124;input&#124;isindex&#124;i&#124;kbd&#124;link&#124;li&#124;map&#124;menu&#124;meta&#124;ol&#124;option&#124;param&#124;pre&#124;p&#124;samp&#124;script&#124;select&#124;small&#124;strike&#124;strong&#124;style&#124;sub&#124;sup&#124;table&#124;td&#124;textarea&#124;th&#124;title&#124;tr&#124;tt&#124;ul&#124;u&#124;var)([\s\/&#62;])/$1.lc($2).$3/gie' file
This concatenates all files of a specified type &#8211; prefixed with its title. Useful for quick code review across many files.

for i in $(find -regex &#34;.*\.jsp$&#34;); do echo '&#60;!--' $i '--&#62;'; cat $i; done &#62; combined.jsp

This one [...]]]></description>
			<content:encoded><![CDATA[<p>Back with more one liners&#8230;</p>
<p>This one converts all html tags in a file to lowercase.</p>
<pre class="brush: plain;">perl -pi.old -e 's/(&lt;\/?)(address|applet|area|a|base|basefont|big|blockquote|body|br|b|caption|center|cite|code|dd|dfn|dir|div|dl|dt|em|font|form|h1|h2|h3|h4|h5|h6|head|hr|html|img|input|isindex|i|kbd|link|li|map|menu|meta|ol|option|param|pre|p|samp|script|select|small|strike|strong|style|sub|sup|table|td|textarea|th|title|tr|tt|ul|u|var)([\s\/&gt;])/$1.lc($2).$3/gie' file</pre>
<p>This concatenates all files of a specified type &#8211; prefixed with its title. Useful for quick code review across many files.</p>
<pre class="brush: plain;">
for i in $(find -regex &quot;.*\.jsp$&quot;); do echo '&lt;!--' $i '--&gt;'; cat $i; done &gt; combined.jsp
</pre>
<p>This one removes all multiline comments from a file. </p>
<pre class="brush: plain;">
perl -pi.old -e 'BEGIN {$/ = undef;} s#\*.*?\*/##sg' test
</pre>
<p>If you understand the -p option, you&#8217;ll understand why the BEGIN block is necessary and why the s flag is not very useful without the BEGIN. To really understand, what&#8217;s going on I recommend reading <a href="http://perldoc.perl.org/perlrun.html">perlrun</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://portfolio.keithbentrup.com/archives/221/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
