<?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>Andrew Fraser DBA &#187; general musings</title>
	<atom:link href="http://andrewfraserdba.com/category/general-musings/feed/" rel="self" type="application/rss+xml" />
	<link>http://andrewfraserdba.com</link>
	<description>Oracle DBA (plus SQL Server)</description>
	<lastBuildDate>Fri, 16 Jul 2010 13:26:54 +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>Of course this would never happen in the real world</title>
		<link>http://andrewfraserdba.com/2007/02/23/of-course-this-would-never-happen-in-the-real-world/</link>
		<comments>http://andrewfraserdba.com/2007/02/23/of-course-this-would-never-happen-in-the-real-world/#comments</comments>
		<pubDate>Fri, 23 Feb 2007 17:18:41 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[general musings]]></category>
		<category><![CDATA[old]]></category>

		<guid isPermaLink="false">http://andrewfraser.wordpress.com/2007/02/23/of-course-this-would-never-happen-in-the-real-world/</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.thinkgeek.com/images/products/zoom/consulting-poster.jpg" height="340" width="400" /></p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2007/02/23/of-course-this-would-never-happen-in-the-real-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Of Goats and Porsches: A Monty Hall Paradox Simulator</title>
		<link>http://andrewfraserdba.com/2007/01/17/of-goats-and-porsches-a-monty-hall-paradox-simulator/</link>
		<comments>http://andrewfraserdba.com/2007/01/17/of-goats-and-porsches-a-monty-hall-paradox-simulator/#comments</comments>
		<pubDate>Wed, 17 Jan 2007 17:23:17 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[general musings]]></category>
		<category><![CDATA[old]]></category>

		<guid isPermaLink="false">http://andrewfraser.wordpress.com/2007/01/17/of-goats-and-porsches-a-monty-hall-paradox-simulator/</guid>
		<description><![CDATA[The Monty Hall Paradox can&#8217;t be right, or so I thought.
Suppose you&#8217;re on a game show, and you&#8217;re given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what&#8217;s behind the doors, opens another door, say No. [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://en.wikipedia.org/wiki/Monty_Hall_problem">Monty Hall Paradox</a> can&#8217;t be right, or so I thought.</p>
<blockquote><p>Suppose you&#8217;re on a game show, and you&#8217;re given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what&#8217;s behind the doors, opens another door, say No. 3, which has a goat. He then says to you, &#8220;Do you want to pick door No. 2?&#8221; Is it to your advantage to switch your choice?</p></blockquote>
<p>So I wrote the below simulator to find out. It uses the <a href="http://en.wikipedia.org/wiki/Monte_Carlo_method">Monte Carlo Technique</a>, which is a nice way of solving math problems numerically.<br />
The results from my run are pretty conclusive:</p>
<p><code>Twitchy winners : 653<br />
Twitchy losers : 347<br />
Stubborn winners : 318<br />
Stubborn losers : 682</code></p>
<p>So it really does pay to switch doors when the host gives you the choice. Which is not what I had expected &#8211; and means it&#8217;s time for me to go eat some humble pie <img src='http://andrewfraserdba.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  .</p>
<p>Code listing below:</p>
<p><span id="more-15"></span></p>
<pre>#!/bin/ksh
#######################################################
# monty_hall.sh
# Andrew Fraser ( http://andrewfraserdba.com )
# January 2007
# Simulator for the Monty Hall 'paradox'. See http://en.wikipedia.org/wiki/Monty_Hall_problem for background info
# Usage:
#  monty_hall.sh &lt;no_iterations&gt; &lt;twitchy|stubborn&gt;
#  e.g.: monty_hall.sh 1000 twitchy
# Parameters:
#   1 - NO_ITERATIONS - number of times to run simulation (a few hundred is reasonably fast on most machines)
#   2 - CONTESTANT_TYPE - twitchty = moves doors when given chance to move : stubborn = stays put when given chance to move
# Notes:
#   ksh RANDOM built in function is not the best random function in existence, although there are patches that resolve that.
#   RANDOM returns a number between 0 and 32768. The three doors here are named "0", "1", and "2", achieved by dividing by 10924
#
#   A good idea is to redirect the output for larger runs, and grep out the results. E.g.:
#     monty_hall.sh 1000 twitchy &gt; twitchy.out
#     monty_hall.sh 1000 stubborn &gt; stubborn.out
#     echo Twitchy winners : `grep Congratulations twitchy.out|wc -l`
#     echo Twitchy losers : `grep dear twitchy.out|wc -l`
#     echo Stubborn winners : `grep Congratulations stubborn.out|wc -l`
#     echo Stubborn losers : `grep dear stubborn.out|wc -l`
#######################################################

i=0

NO_ITERATIONS=$1
CONTESTANT_TYPE=$2

while [ $i -lt $NO_ITERATIONS ]
do

CONTESTANT_DOOR1=`echo $(( RANDOM / 10924 ))`
echo CONTESTANT_DOOR1 is $CONTESTANT_DOOR1
PORSCHE_DOOR=`echo $(( RANDOM / 10924 ))`
echo PORSCHE_DOOR is $PORSCHE_DOOR

if [ $CONTESTANT_DOOR1 -eq $PORSCHE_DOOR ]
then
RIGHT_FIRST_TIME=yes
#host now uncovers one (at random) of the two remaining doors to show a goat...
ZERO_OR_ONE=`echo $(( RANDOM / 16384 ))`
if [ $PORSCHE_DOOR = 0 ]
then
let UNCOVERED_GOAT_DOOR=1+ZERO_OR_ONE
elif [ $PORSCHE_DOOR = 1 ]
then
if [ $ZERO_OR_ONE = 0 ]
then
UNCOVERED_GOAT_DOOR=0
else
UNCOVERED_GOAT_DOOR=2
fi
elif [ $PORSCHE_DOOR = 2 ]
then
UNCOVERED_GOAT_DOOR=$ZERO_OR_ONE
fi
echo UNCOVERED_GOAT_DOOR is $UNCOVERED_GOAT_DOOR
else
RIGHT_FIRST_TIME=no
#host now uncovers the only other goat door to show a goat...
let UNCOVERED_GOAT_DOOR=3-CONTESTANT_DOOR1-PORSCHE_DOOR
echo UNCOVERED_GOAT_DOOR is $UNCOVERED_GOAT_DOOR
fi

if [ $CONTESTANT_TYPE = twitchy ]
then
# contestant moves to the other uncovered door, maybe cos she read something about that being good strategy on wikipedia...
if [ $RIGHT_FIRST_TIME = yes ]
then
echo ":( Oh dear, you won a goat, what a shame, you were right first time, if only you had stayed where you were! <img src='http://andrewfraserdba.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> "
else
echo ":) Congratulations! You've won a porsche <img src='http://andrewfraserdba.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> "
fi
else
# contestant stubbornly stays where she is...
if [ $RIGHT_FIRST_TIME = yes ]
then
echo ":) Congratulations! You've won a porsche <img src='http://andrewfraserdba.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> "
else
echo ":( Oh dear, you won a goat, what a shame, you should have moved door. <img src='http://andrewfraserdba.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> "
fi
fi

echo

let i=i+1

done</pre>
<p>For the actual run I did, with results pasted above, I ran:</p>
<p><code>monty_hall.sh 1000 twitchy &gt; twitchy.out<br />
monty_hall.sh 1000 stubborn &gt; stubborn.out<br />
echo Twitchy winners : `grep Congratulations twitchy.out|wc -l`<br />
echo Twitchy losers : `grep dear twitchy.out|wc -l`<br />
echo Stubborn winners : `grep Congratulations stubborn.out|wc -l`<br />
echo Stubborn losers : `grep dear stubborn.out|wc -l`</code></p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2007/01/17/of-goats-and-porsches-a-monty-hall-paradox-simulator/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Death March</title>
		<link>http://andrewfraserdba.com/2007/01/15/death-march/</link>
		<comments>http://andrewfraserdba.com/2007/01/15/death-march/#comments</comments>
		<pubDate>Mon, 15 Jan 2007 19:28:09 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[book review]]></category>
		<category><![CDATA[general musings]]></category>
		<category><![CDATA[old]]></category>

		<guid isPermaLink="false">http://andrewfraser.wordpress.com/2007/01/15/death-march/</guid>
		<description><![CDATA[ What is a death march project? What makes IT organizations create such things? Why would anyone in his right mind agree to participate in such a project?To many grizzled IT veterans, these are rhetorical questions. Everything, in their experience, is a death march project. Why do they happen? Because corporations are insane and, as [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.amazon.com/gp/product/013143635X/002-2800850-6348857?v=glance&amp;n=283155"><img src="http://ec1.images-amazon.com/images/P/013143635X.01._AA240_SCLZZZZZZZ_V38086663_.jpg" alt="blah blah" align="left" height="240" width="240" /></a> What is a death march project? What makes IT organizations create such things? Why would anyone in his right mind agree to participate in such a project?To many grizzled IT veterans, these are rhetorical questions. <em>Everything</em>, in their experience, is a death march project. Why do they happen? Because corporations are insane and, as consultant Richard Sargent commented to me, &#8220;Corporate insanity is doing the same thing again and again, and each time expecting different results.&#8221; And why do we participate in such projects? Because, as consultant Dave Kleist observed in an e-mail note, &#8220;Death march projects are rarely billed as such, and it takes a lot of work when being hired from the outside to discover if your hiring company is prone to creating death march projects.&#8221;</p>
<p><em>Mind-boggling projects</em>— the project has an army of 1,000–2,000 or more (including, in many cases, consultants and subcontractors), and the project is expected to last seven to ten years.</p>
<p><span id="more-10"></span></p>
<p>As for the &#8220;mind-boggling&#8221; death march projects: One wonders why they exist at all. Perhaps the systems development efforts associated with the NASA project that landed a man on the moon in 1969 could be considered a successful example of a death march project; but the vast majority of such projects are doomed from the beginning. Fortunately, most senior managers have figured this out, and most large organizations (which are the only ones that could afford them in the first place!) have banned all such projects. Government organizations, alas, still embark upon them from time to time; along with potentially unlimited budgets with which to tackle truly mind-boggling projects, appeals to patriotic notions (e.g., &#8220;national security&#8221; in the post-9/11 era) may be sufficient to blind senior management to the futility of the task they&#8217;ve been given.</p>
<p>This still leaves unanswered the questions of why a rational organization would embark upon such a project and why a rational project manager or technical person would agree to participate in such a project.</p>
<h3>The &#8220;Marine Corps&#8221; mentality: <em>Real</em> programmers don&#8217;t need sleep</h3>
<p>Startup companies are sometimes vulnerable to the &#8220;Marine Corps&#8221; syndrome, but I&#8217;ve seen it most often in the consulting organizations like EDS and the Big-X accounting firms. It may reflect the personality of the corporate founder(s), and it may reflect the corporate culture in its earlier days—the corporate behavior at Microsoft, for example, has often been attributed to these factors. In essence, you&#8217;ll be told by the appropriate manager, &#8220;<em>Every</em> project is like this, because that&#8217;s how we do things around here. It works, we&#8217;re successful, and we&#8217;re damn proud of it. If you can&#8217;t handle it, then you don&#8217;t belong here.&#8221;</p>
<p>Whether an attitude like this is civilized, humane, or right is a topic for a separate discussion. Indeed, the question of whether it&#8217;s even successful is something to be discussed elsewhere; the important thing is to realize that it&#8217;s <em>deliberate</em>, not accidental. If you&#8217;re a martyr or a revolutionary, you might decide to attack the corporate culture, but the chances are that you won&#8217;t succeed. It&#8217;s quite possible that there will be some negative long-term consequences of the overall death march culture, for example, the best people may slowly drift away and the company may fail. But when it comes to <em>this</em> death march project, there&#8217;s no point questioning why it has been set up with a nearly impossible schedule and budget. As the prototypical manager of such companies says, &#8220;If you can&#8217;t handle it, then you don&#8217;t belong here.&#8221;</p>
<p>Sometimes there&#8217;s an official rationale for such corporate behavior—for example, &#8220;We compete in a tough marketplace, and all of our competitors are just as smart as we are. The only way we succeed is to work twice as hard.&#8221; And sometimes the death march projects are set up to weed out the younger (weaker) junior employees, so that only the survivors of the death march projects will reach the exalted status of &#8220;partner&#8221; or &#8220;vice president.&#8221; Whatever the rationale, it&#8217;s usually fairly consistent; there&#8217;s not much point complaining about it for the sake of a single project.</p>
<p>That doesn&#8217;t necessarily mean that you should accept an assignment on such a project; after all, just because every other project within the organization is a death march doesn&#8217;t necessarily mean that yours will succeed, or that you will survive. It simply means that the decision to create such a project has an understandable origin.</p>
<h3>Why Do People Participate in Death March Projects?</h3>
<p>The theme of the discussion in the previous project is that organizations create and/or tolerate death march projects for a number of reasons. We may agree or disagree with those reasons, and we may sympathize with the ones caused by truly unexpected crises—but ultimately, as individuals, we have to accept them as a fact of life.</p>
<p>But that doesn&#8217;t mean we have to participate in them. Most of this book presumes that you <em>will</em> participate in a death march project, though I will specifically suggest that you resign under certain circumstances. But the best time to do so, in most cases, is at the beginning. When told that you have been assigned to such a project (either as a leader or a technical staff member), you should consider saying, &#8220;No, thanks! I&#8217;ll pass on this one.&#8221; If that&#8217;s not an acceptable response within your corporate culture, you almost always have the option of saying, &#8220;No, thanks! I quit!&#8221;</p>
<p>Obviously, some developers—and probably a larger number of managers—will argue that this is not a practical choice for them. I&#8217;ll discuss this in more detail below, but for now it&#8217;s sufficient to note that it&#8217;s one of several possible &#8220;negative&#8221; reasons for participating in a death march project; it may not be fun, but perhaps it&#8217;s not as bad as the alternatives. On the other hand, some developers (and some managers) <em>gladly</em> sign up for such projects; aside from the issue of naive optimism discussed above, why would any rational person volunteer to participate in a project that&#8217;s likely to require 14-hour days, seven-day weeks, and a year or two of postponed vacations?<br />
And as Paul Neuhardt put it,</p>
<blockquote><p>For me, it was ego, pure and simple. They told me that they just     <em>knew</em> I could help prevent the project from becoming a death march. I was made the &#8220;technical project manager,&#8221; given ego boosts on a regular basis, then hung out to dry along with the rest of the team. Left, right, left, right, left, <em>plop</em>!</p></blockquote>
<h3>The &#8220;Mt. Everest&#8221; syndrome</h3>
<p>Why do people climb dangerous peaks like Mt. Everest, despite the pain and the risk? Because it&#8217;s there. Why do people run a marathon and drive themselves to the point of physical collapse in triathlons? Because of the challenge. It&#8217;s all the more exciting if the challenge is one that has never yet been successfully accomplished; of the six billion people on the planet, for example, only one can stand before us and say, &#8220;I was the first to walk on the moon.&#8221; Some may think it&#8217;s crazy, egotistical, and selfish to even try; but others are willing to brave the odds and deal with horrendous obstacles for the private thrill and the public glory of succeeding. As consultant Al Christians remarked to me in a recent e-mail note,</p>
<blockquote><p>I am somehow prompted to reply &#8220;testosterone,&#8221; which is about the same as &#8220;because it&#8217;s there.&#8221; There are plenty of jobs that raise the &#8216;why?&#8217; question. Underground mining, cowboying, logging, smoke jumping, jet fighting, submarining, even high-rise window washing all have serious drawbacks far beyond what you describe for software projects, and yet all these have practitioners whose sense of self is linked to their profession.</p></blockquote>
<p>And so it is with death march software projects. I had the chance to visit the original Macintosh project in the fall of 1983, a few months before the product was officially unveiled, and was humbled by the intensity of the team&#8217;s commitment to its challenge. In addition to whatever other reasons the members might have had for working long hours and dealing with Steve Jobs&#8217; megalomaniacal ego, the team was utterly convinced (partly as a result of Jobs&#8217; charisma) that the Macintosh would revolutionize personal computing. They were lucky—they turned out to be right.</p>
<p>From this perspective, even the death march projects that fail can be <em>noble</em> failures. Countless projects in Silicon Valley have fallen into this category, often after burning tens of millions of dollars of venture capital; while most of the dot-com startups had no substance at all, some of them really did seem awe-inspiring and revolutionary until they went into bankruptcy. But even though they failed so badly that entire companies went bankrupt, and though they caused divorces, ulcers, and nervous breakdowns—even though they did all of this and more—the people who worked on those projects still speak of their experiences in hushed tones. &#8220;I worked on the Toys.com system,&#8221; a grizzled veteran will tell her awe-struck apprentice. &#8220;Now <em>that</em> was a revolutionary piece of software!&#8221;</p>
<p>Though it may never reach the front pages of <em>Computerworld</em>, there are also numerous death march projects with lofty ambitions buried within large organizations—with application developers signing up gladly because the &#8220;corporate Mt. Everest&#8221; seems such a worthy challenge. Sometimes these projects fail because the marketplace or the corporate end-users don&#8217;t want and don&#8217;t need the glorious, revolutionary systems being developed; and sometimes they fail because the project team bit off more than it could chew and promised more than it could deliver.</p>
<p>There are two things to watch for if you find yourself being swept up in the hysteria of a Mt. Everest-style death march project. First, watch out for the projects that are predetermined failures. Suppose, for example, that someone told you that you could be on the first manned mission to Mars, and that you would even have the honor to be the first person to plant a foot on Martian soil. &#8220;Of course,&#8221; your project manager goes on to say, &#8220;you won&#8217;t have any oxygen tanks, because we won&#8217;t have enough room on the space craft for all that extra weight. So it&#8217;s a guaranteed fact that you&#8217;re going to die—but think of the honor and the glory!&#8221; I&#8217;ll discuss these projects in more detail in Chapter 3, under the heading of &#8220;kamikaze&#8221; projects; for now, the scenario speaks for itself.</p>
<p>The second thing to watch out for is that the challenge being described by your corporate management (or by the entrepreneurial founder of your software company) may not turn out to be such a big deal after all. This is a particularly insidious danger if the challenge is technical in nature, for example, &#8220;We&#8217;ll be the first people on earth to put an operating system with the functionality of Windows <em>XP</em> into 128K of ROM!&#8221; Granted, that would be an amazing technical accomplishment—but so what?</p>
<p>It&#8217;s a good idea to ask the &#8220;So what?&#8221; question two or three times—in other words, <em>continue</em> asking the question in response to each successive answer you get from your corporate management. If the response to the Windows <em>XP</em> scenario posed above is, &#8220;Well, that means we could put <em>all</em> of Windows <em>XP</em> onto your wrist watch!&#8221;, then ask, &#8220;So what?&#8221; again. In some cases, the answers will eventually become silly and you&#8217;ll be jerked back into the real world. For example, suppose your boss answers the second &#8220;So what?&#8221; question above with the explanation, &#8220;Well, if we can also squeeze in a full voice-recognition system, that means you&#8217;ll be able to write Visual C++ programs while you&#8217;re walking down the street, by talking to your wrist-watch!&#8221;</p>
<p>No doubt there are a few dozen programmers who would say, &#8220;<em>Cool!</em>&#8221; and volunteer to spend the next three years of their lives on such a project. The fact that nobody in his right mind would ever use such a project is irrelevant to them; the technical challenge is a sufficient justification. Putting Windows <em>XP</em>, full voice recognition, and Visual C++ into 128K of ROM would give you supreme bragging rights at any convention of hackers and programmers; if that&#8217;s what you live for, then by all means go ahead and sign up for the project.</p>
<p>It&#8217;s also a good idea to explain the project in simplified non-technical terms to your spouse, or your &#8220;significant other,&#8221; or your parents—or, even better, your children. <em>They</em> will ask the &#8220;So what?&#8221; question, without the burden of being tempted by the technical challenge. &#8220;You&#8217;re going to give up your nights and your weekends and your vacations for the next two years in order to put Windows <em>XP</em> on a wrist-watch?&#8221; your spouse will ask incredulously. And your children will ask, &#8220;Yeah, but Mom/Dad, why would anyone <em>do</em> that?&#8221; If you can answer those questions without feeling utterly foolish, then you can sign up for the project with a clear conscience.</p>
<p>A worse form of Mt. Everest project is the one where the challenge matters <em>enormously</em> to corporate management, but not at all to anyone who stops and thinks about the situation for a second. &#8220;Why are we signing up for this death march project, boss?&#8221; the young programmer asks innocently. &#8220;Because,&#8221; the boss thunders righteously, &#8220;it will increase our corporate earnings per share by a full 3.14159 cents!!&#8221; This means that if the programmer was lucky enough to have options on a hundred shares of the company&#8217;s stock, and if every penny of increased earnings was paid out in dividends, the programmer would get a whopping $3.14; and if Wall Street traders got so excited by all of this that they boosted the price of the stock by a dollar, the programmer&#8217;s net worth would increase by another hundred dollars. &#8220;And what else would I have to show for the thousands of hours of overtime you&#8217;re asking me to sign up for, boss?&#8221; the young programmer asks. The boss is silent, for he knows that the honest answer is: <em>nothing</em>. The project is intrinsically boring, involves no interesting technology, and has a 75-percent chance of failing anyway.</p>
<p>But the very worst death march projects, in my opinion, are the ones where the boss deliberately manipulates the innocent project team into believing that a Mt. Everest-style challenge is involved, when the boss knows full well that it&#8217;s not. Imagine the project team member who asks, &#8220;Why are we trying to build this batch, mainframe, COBOL airline reservation system in six months, boss?&#8221; The boss is likely to respond, &#8220;Because <em>nobody</em> in the entire airline industry has ever tried to do it in less than three years before!&#8221; I suppose that one could argue that there <em>is</em> a technical challenge involved in creating a batch-mode airline reservation system, but it&#8217;s not the kind of technology that I would want on my resumé in the 21st century. In any case, what makes this scenario a death march project is not the technical challenge, but the ridiculous schedule imposed on the project. Why is the project manager doing it? Who knows—but it&#8217;s not likely to be the sort of thing you&#8217;ll want to brag about to your friends a year from now.</p>
<hr />Excerpts from <a href="http://www.informit.com/articles/article.asp?p=169512">http://www.informit.com/articles/article.asp?p=169512</a> itself excerpts of <a href="http://www.amazon.com/gp/product/013143635X/002-2800850-6348857?v=glance&amp;n=283155">http://www.amazon.com/gp/product/013143635X/002-2800850-6348857?v=glance&amp;n=283155</a></p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2007/01/15/death-march/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>useful simple vi commands for DBAs</title>
		<link>http://andrewfraserdba.com/2007/01/12/useful-simple-vi-commands-for-dbas/</link>
		<comments>http://andrewfraserdba.com/2007/01/12/useful-simple-vi-commands-for-dbas/#comments</comments>
		<pubDate>Fri, 12 Jan 2007 12:09:51 +0000</pubDate>
		<dc:creator>Andrew Fraser</dc:creator>
				<category><![CDATA[book review]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[general musings]]></category>
		<category><![CDATA[old]]></category>

		<guid isPermaLink="false">http://andrewfraser.wordpress.com/2007/01/12/useful-simple-vi-commands-for-dbas/</guid>
		<description><![CDATA[These 32 are the only commands I ever seem to use in vi:

	
	
		Command
		Effect
	
	
	
		:.=
		find out the current line number
	
	
		:1
		go to line 1
	
	
		Ctrl-d
		page down
	
	
		Ctrl-u
		page up
	
	
		Shift-G
		go to end of file
	
	
		i
		insert text at current position
	
	
		Shift-A
		append text after end of current line
	
	
		Shift-I
		insert text before start of current line
	
	
		Esc
		get out of edit mode, back into normal vi command mode
	
	
		dd
		delete current line
	
	
		10dd
		delete [...]]]></description>
			<content:encoded><![CDATA[<p>These 32 are the <em>only</em> commands I ever seem to use in vi:</p>
<table class="wptable rowstyle-alt" id="wptable-2"  cellspacing="1" cellpadding="1">
	<thead>
	<tr>
		<th class="sortable" style="width:1px" align="center">Command</th>
		<th class="sortable" style="width:195px" align="left">Effect</th>
	</tr>
	</thead>
	<tr>
		<td style="width:1px" align="center">:.=</td>
		<td style="width:195px" align="left">find out the current line number</td>
	</tr>
	<tr class="alt">
		<td style="width:1px" align="center">:1</td>
		<td style="width:195px" align="left">go to line 1</td>
	</tr>
	<tr>
		<td style="width:1px" align="center">Ctrl-d</td>
		<td style="width:195px" align="left">page down</td>
	</tr>
	<tr class="alt">
		<td style="width:1px" align="center">Ctrl-u</td>
		<td style="width:195px" align="left">page up</td>
	</tr>
	<tr>
		<td style="width:1px" align="center">Shift-G</td>
		<td style="width:195px" align="left">go to end of file</td>
	</tr>
	<tr class="alt">
		<td style="width:1px" align="center">i</td>
		<td style="width:195px" align="left">insert text at current position</td>
	</tr>
	<tr>
		<td style="width:1px" align="center">Shift-A</td>
		<td style="width:195px" align="left">append text after end of current line</td>
	</tr>
	<tr class="alt">
		<td style="width:1px" align="center">Shift-I</td>
		<td style="width:195px" align="left">insert text before start of current line</td>
	</tr>
	<tr>
		<td style="width:1px" align="center">Esc</td>
		<td style="width:195px" align="left">get out of edit mode, back into normal vi command mode</td>
	</tr>
	<tr class="alt">
		<td style="width:1px" align="center">dd</td>
		<td style="width:195px" align="left">delete current line</td>
	</tr>
	<tr>
		<td style="width:1px" align="center">10dd</td>
		<td style="width:195px" align="left">delete 10 lines from current line on down</td>
	</tr>
	<tr class="alt">
		<td style="width:1px" align="center">d Shift-G</td>
		<td style="width:195px" align="left">delete all lines from current line and below</td>
	</tr>
	<tr>
		<td style="width:1px" align="center">d 1 shift-G</td>
		<td style="width:195px" align="left">delete all lines from current line and above</td>
	</tr>
	<tr class="alt">
		<td style="width:1px" align="center">.</td>
		<td style="width:195px" align="left">repeat previous command</td>
	</tr>
	<tr>
		<td style="width:1px" align="center">Shift-Y</td>
		<td style="width:195px" align="left">yank (copy) current line</td>
	</tr>
	<tr class="alt">
		<td style="width:1px" align="center">p</td>
		<td style="width:195px" align="left">paste that copy into line below</td>
	</tr>
	<tr>
		<td style="width:1px" align="center">/data</td>
		<td style="width:195px" align="left">search forward for occurencies of string "data"</td>
	</tr>
	<tr class="alt">
		<td style="width:1px" align="center">/</td>
		<td style="width:195px" align="left">search forward for next occurrence of remembered search string</td>
	</tr>
	<tr>
		<td style="width:1px" align="center">?</td>
		<td style="width:195px" align="left">search backward for next occurrence of remembered search string</td>
	</tr>
	<tr class="alt">
		<td style="width:1px" align="center">:set ic</td>
		<td style="width:195px" align="left">make searches case insensitive</td>
	</tr>
	<tr>
		<td style="width:1px" align="center">:%s/data/index/g</td>
		<td style="width:195px" align="left">replace all occurrencies of "data" with "index"</td>
	</tr>
	<tr class="alt">
		<td style="width:1px" align="center">:%s/"//g</td>
		<td style="width:195px" align="left">remove all " characters</td>
	</tr>
	<tr>
		<td style="width:1px" align="center">:%s/$/ ;/</td>
		<td style="width:195px" align="left">append ";" to the end of every line</td>
	</tr>
	<tr class="alt">
		<td style="width:1px" align="center">:%s/^/rem /</td>
		<td style="width:195px" align="left">insert "rem " to the start of every line</td>
	</tr>
	<tr>
		<td style="width:1px" align="center">:w</td>
		<td style="width:195px" align="left">write (save) file</td>
	</tr>
	<tr class="alt">
		<td style="width:1px" align="center">:q</td>
		<td style="width:195px" align="left">quit out of vi</td>
	</tr>
	<tr>
		<td style="width:1px" align="center">:q!</td>
		<td style="width:195px" align="left">quit out of vi without saving changes</td>
	</tr>
	<tr class="alt">
		<td style="width:1px" align="center">:wq</td>
		<td style="width:195px" align="left">write (save) file and quit out of vi</td>
	</tr>
	<tr>
		<td style="width:1px" align="center">shift-Z shift-Z</td>
		<td style="width:195px" align="left">same as above ":wq" except does not write (change file modification times) if you have not made any changes.</td>
	</tr>
	<tr class="alt">
		<td style="width:1px" align="center">:n</td>
		<td style="width:195px" align="left">next file (when vi'ing a series of files, e.g. with using "vi *" at the command prompt)</td>
	</tr>
	<tr>
		<td style="width:1px" align="center">u</td>
		<td style="width:195px" align="left">undo last command</td>
	</tr>
	<tr class="alt">
		<td style="width:1px" align="center">Shift-J</td>
		<td style="width:195px" align="left">Join next line onto end of current line</td>
	</tr>
</table><p>
</p>
]]></content:encoded>
			<wfw:commentRss>http://andrewfraserdba.com/2007/01/12/useful-simple-vi-commands-for-dbas/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
	</channel>
</rss>
