
Archive for the ‘general musings’ Category
Of course this would never happen in the real world
Friday, February 23rd, 2007Of Goats and Porsches: A Monty Hall Paradox Simulator
Wednesday, January 17th, 2007The Monty Hall Paradox can’t be right, or so I thought.
Suppose you’re on a game show, and you’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’s behind the doors, opens another door, say No. 3, which has a goat. He then says to you, “Do you want to pick door No. 2?” Is it to your advantage to switch your choice?
So I wrote the below simulator to find out. It uses the Monte Carlo Technique, which is a nice way of solving math problems numerically.
The results from my run are pretty conclusive:
Twitchy winners : 653
Twitchy losers : 347
Stubborn winners : 318
Stubborn losers : 682
So it really does pay to switch doors when the host gives you the choice. Which is not what I had expected – and means it’s time for me to go eat some humble pie
.
Code listing below:
Death March
Monday, January 15th, 2007
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 consultant Richard Sargent commented to me, “Corporate insanity is doing the same thing again and again, and each time expecting different results.” And why do we participate in such projects? Because, as consultant Dave Kleist observed in an e-mail note, “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.”
Mind-boggling projects— 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.
useful simple vi commands for DBAs
Friday, January 12th, 2007These 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 10 lines from current line on down |
| d Shift-G | delete all lines from current line and below |
| d 1 shift-G | delete all lines from current line and above |
| . | repeat previous command |
| Shift-Y | yank (copy) current line |
| p | paste that copy into line below |
| /data | search forward for occurencies of string "data" |
| / | search forward for next occurrence of remembered search string |
| ? | search backward for next occurrence of remembered search string |
| :set ic | make searches case insensitive |
| :%s/data/index/g | replace all occurrencies of "data" with "index" |
| :%s/"//g | remove all " characters |
| :%s/$/ ;/ | append ";" to the end of every line |
| :%s/^/rem / | insert "rem " to the start of every line |
| :w | write (save) file |
| :q | quit out of vi |
| :q! | quit out of vi without saving changes |
| :wq | write (save) file and quit out of vi |
| shift-Z shift-Z | same as above ":wq" except does not write (change file modification times) if you have not made any changes. |
| :n | next file (when vi'ing a series of files, e.g. with using "vi *" at the command prompt) |
| u | undo last command |
| Shift-J | Join next line onto end of current line |