« March 2005 | Main | May 2005 »
April 30, 2005
Foolproof?
Naeser's Law:
You can make it foolproof, but you can't make it damnfoolproof.
Ozguru's Addition:
If you try to make it damnfoolproof, all you get is Windows XP.
Posted by Peskie at 12:00 PM
April 29, 2005
Rome
Marilyn, the teacher, asked her 5th grade history class, "When was Rome built?" and called on Timothy to answer first.
"Rome was built at night." was his answer.
"At night?" asked Mrs. Taylor, holding her ruler firmly in her boney-knuckled hands. "How ever did you get such an idea?"
"Well," gulped the student, hoping his answer would satisfy her, "everyone knows Rome wasn't built in a day."
Posted by Peskie at 12:00 PM
April 28, 2005
What is Tiger?
Tiger - MacOS X 10.4 ...
... everything Longhorn would like to be ...
... when it ships in 2008 ...
... if it ships at all ...
Posted by Peskie at 12:00 PM | Comments (1)
April 27, 2005
Shortest Fairy Tale ever
Once upon a time a guy asked a girl "Will you marry me?"
She said "No"
And the guy lived happily ever after.
Posted by Peskie at 12:00 PM
April 26, 2005
Retired
A retired man who volunteers to entertain patients in nursing homes and hospitals went to the local hospital in town and took his portable keyboard along. He told some jokes and sang some funny songs at patients' bedsides.
When he finished he said, in farewell, "I hope you get better."
One elderly gentleman replied, "I hope you get better, too."
Posted by Peskie at 12:00 PM
April 25, 2005
Deer Hunter
While a Texan was busily preparing for the first day of deer hunting season, his wife started nagging that he never asked her to go along. After several hours of argument the wife won.
.
That next morning they drove out to the country, and he placed his wife in a tree about 100 yards from his blind. Just as the hunter reached the blind, he heard a loud bang coming from the wife's position.
.
As he ran up to her, he saw that she was holding her gun on a man nearby and shouting, "It's my deer! Get away from It!! The sheepish-looking stranger just nodded slowly and said, "OK, lady.. It's your deer. Just let me get my saddle off of it!"
Posted by Peskie at 12:00 PM
April 24, 2005
Public Domain Software
Most public domain software is free, at least at first glance.
Posted by Peskie at 12:00 PM
April 23, 2005
Strawberry Shortcake
Just a few of the perfect excuses for having some strawberry shortcake.
Pick one.
1: It's less calories than two pieces of strawberry shortcake.
2: It's cheaper than going to France.
3: It neutralizes the brownies I had yesterday.
4: Life is short.
5: It's somebody's birthday. I don't want them to celebrate alone.
6: It matches my eyes.
7: Whoever said, "Let them eat cake." must have been talking to me.
8: To punish myself for eating dessert yesterday.
9: Compensation for all the time I spend in the shower not eating.
10: Strawberry shortcake is evil. I must help rid the world of it.
11: I'm getting weak from eating all that healthy stuff.
12: It's the second anniversary of the night I ate plain broccoli.
Posted by Peskie at 12:00 PM
April 22, 2005
Army Training
Sargeant: When you are scared, what do you do?
Recruit: Keep on fightin'
Sargeant: Good for you. And now they shoot off your right ear . .What then?
Recruit: Keep on fightin'
Sargeant: Excellent. But now they also shoot off your left ear, what then??
Recruit: Then I can't see.
Sargeant: Can't see? what school did you come from?
Recruit: Well sargeant, when both my ears are gone my helmet falls down over my eyes.
Posted by Peskie at 12:00 PM | Comments (1)
Vi is missing
Help me, I deleted vi....
Don't laugh - it can happen. In this case, it is not a serious problem because there are usually multiple links to vi.
Find the directory where vi used to be (probably /usr/bin
):
bash# ls -li vedit 245 -r-xr-xr-x 5 root bin 227956 Nov 26 2003 vedit
The inode (leftmost number is 245). For interest, you can check which other files also have this inode in this directory:
bash# ls -i | grep " 245 " 245 edit 245 ex 245 vedit 245 view
Now link any one of these to vi: ln ex vi
. Done.
Note that you may not be so lucky if you are using BSD/Linux because they are more likely to use softlinks:
user$ ls -li | grep vim1080938 lrwxr-xr-x 1 root wheel 3 Mar 30 22:51 ex -> vim
1080939 lrwxr-xr-x 1 root wheel 3 Mar 30 22:51 rview -> vim
1080940 lrwxr-xr-x 1 root wheel 3 Mar 30 22:51 rvim -> vim
1080942 lrwxr-xr-x 1 root wheel 3 Mar 30 22:51 view -> vim
1080943 -rwxr-xr-x 1 root wheel 1040376 Mar 21 21:12 vim
1080944 lrwxr-xr-x 1 root wheel 3 Mar 30 22:51 vimdiff -> vim
1080945 -rwxr-xr-x 1 root wheel 1068 Mar 21 21:12 vimtutor
In this case the fix would be: ln -s vim vi
...
Posted by Ozguru at 06:00 AM
April 21, 2005
Engineers Sexy?
I don't think so and neither does Column 8:
But how sexy are engineers? "I hate to disappoint Miki Adderly," writes Mandi Brooker, "but I am married to an engineer and I should know! The following old joke circulates around the periphery of the engineering profession, and doesn't even cause a glimmer of a smile on the faces of the wives. 'Why does an engineer need a mistress? So that his wife thinks he's with his mistress, his mistress thinks he's with his wife, and he can go into the workshop and do cool stuff.' "
And here was me thinking that had something to do with mathematicians...
Posted by Peskie at 12:00 PM
April 20, 2005
Exercise for Seniors
Begin by standing on a comfortable surface, where you have plenty of room at each side.
With a 5-lb. potato sack in each hand, extend your arms straight out from your sides, and hold them there as long as you can. Try to reach a full minute, then relax.
Each day, you'll find that you can hold this position for just a bit longer.
After a couple of weeks, move up to 10-lb. potato sacks.
Then 50-lb. potato sacks, and eventually try to get to where you can lift a 100-lb. potato sack in each hand and hold your arms straight for more than a full minute.
After you feel confident at that level, put a potato in each of the sacks; but be careful.
Posted by Peskie at 12:00 PM
April 19, 2005
Translater
A judge is ready to go through the day's business and he is very rushed. The first case up involves an elderly Jewish gentleman with a long beard, payes, the works.
The judge, without asking a question, says to the clerk, "Get me a translator."
Translator shows up and the judge says, "Ask him what his name is, how old is he and where does he come from?"
The translator says, "Die judge vilt vissen, vos is dein namen, vie alt bist du, and fun vie kumst du?"
The old man smiles, looks at the judge and says in perfect English with a British accent, "Sir. My name is Chiam Ginsburg. I shall be 82 next Thursday and I've come from England where I hold the chair of Hebrew Philosophy at Oxford University."
The translator turns to the judge and says,
"Ehr zukt, ehr is Chiam Ginsburg, ehr is tzwei und achtzig yur alt, und ehr is, mit sach Yiddish philisoph, areingekummen fun Oxford."
Posted by Peskie at 12:00 PM
April 18, 2005
Project Manager vs God
One day a man was having a conversation with God when his whole life flashed before his eyes as a series of footsteps on the sands of time. He saw that there were two pairs of footprints, but during the most difficult periods of his life there were only one set of footprints. He asked God "You said you will be with me throughout this journey, but why have you deserted me during the most critical times of my life??" to which God answered "Son, I did not desert you, I was always with you... you see only one set of footprints because during those difficult times in your life, I was carrying you"
Another day a Programmer was having a similar conversation with his Project Manager when his whole project flashed before his eyes as a series of footsteps on the sands of time. He saw that there were two pairs of footprints, but during the most difficult times in the project there were only one set of footprints. He asked his PM "You said you will be with me throughout the project, but why have you deserted me during the most critical times of the project??" to which the PM answered "Son, I did not desert you, I was always with you... you see only one set of footprints because during those difficult times, I was sitting on your head!!"
Posted by Peskie at 12:00 PM
April 17, 2005
The end is nigh
A priest and pastor from the local parishes are standing by the side of the road holding up a sign that reads, "The End is Near! Turn yourself around now before it's too late!" They planned to hold up the sign to each passing car.
"Leave us alone you religious nuts!" yelled the first driver as he sped by. From around the curve they heard screeching tires and a big splash.
"Do you think," said one clergy to the other, "we should just put up a sign that says 'Bridge Out' instead?"
Posted by Peskie at 12:00 PM
April 16, 2005
Living Wealthy
It is better to live rich than to die rich.
-- Samuel Johnson
Posted by Peskie at 12:00 PM | Comments (1)
April 15, 2005
How to annoy co-workers
1) Page yourself over the intercom. Don't disguise your voice.
2) Find out where your boss shops and buy exactly the same outfits. Wear them one day after your boss does. This is especially effective if your boss is a different gender than you.
3) Make up nicknames for all your co-workers and refer to them only by these names. "That's a good point, Sparky." "No, I'm sorry, but I'm going to have to disagree with you there, Chachie."
4) Send e-mail to the rest of the company telling them exactly what you're doing. For example: "If anyone needs me, I'll be in the bathroom."
5) Hi-Lite your shoes. Tell people you haven't lost them as often since you did this.
6) While sitting at your desk, soak your fingers in Palmolive. Call everyone Madge.
7) Hang mosquito netting around your cubicle. When you emerge to get coffee, a printout, or whatever, slap yourself at random the whole way.
8) Put a chair facing a printer. Sit there all day and tell people you're waiting for your document.
9) Every time someone asks you to do something, anything, ask him or her if they want fries with that.
10) Send e-mail back and forth to yourself, engaging yourself in an intellectual debate. Forward the mail to a co-worker and ask her to settle the disagreement.
11) Encourage your colleagues to join you in a little synchronized chair-dancing.
12) Put your trash can on your desk. Label it "IN".
13) Feign an unnatural and hysterical fear of staplers.
14) Send e-mail messages saying there's free pizza, donuts, or cake in the lunchroom. When people drift back to work complaining that they found none, lean back, pat your stomach, and say, "Oh you've got to be faster than that."
15) Put decaf in the coffeemaker for three weeks. Once everyone has withdrawn from caffeine addiction, switch to espresso.
Posted by Peskie at 12:00 PM
Hard Links vs Soft Links
Someone pointed out that I had neglected the Tech Tips for the last two Fridays so I figured you were due an extra this week...
In Unix there are hard links and soft (symbolic) links. They are quite different:
- A hard link is actually another directory entry that points to the same disk blocks
- A soft link is a file which contains the path to another file
You never actually remove files on Unix, you decrement their hard link count. When it reaches zero, the file is effectively removed because there is no longer any way to reference it.
Consider the following:
user$ date > file1
user$ ln file1 file2
user$ ln -s file1 file3
user$ ls -li file*
1405281 -rw-r--r-- 2 user staff 29 Apr 21 09:38 file1
1405281 -rw-r--r-- 2 user staff 29 Apr 21 09:38 file2
1405284 lrwxr-xr-x 1 user staff 5 Apr 21 09:38 file3 -> file1
user$ cat file1
Thu Apr 21 09:38:14 EST 2005
user$ cat file2
Thu Apr 21 09:38:14 EST 2005
user$ cat file3
Thu Apr 21 09:38:14 EST 2005
user$ rm file1
user$ ls -li file*
1405281 -rw-r--r-- 1 user staff 29 Apr 21 09:38 file2
1405284 lrwxr-xr-x 1 user staff 5 Apr 21 09:38 file3 -> file1
user$ cat file2
Thu Apr 21 09:38:14 EST 2005
user$ cat file3
cat: file3: No such file or directory
The first command creates a file - this involves allocating some disk space (to hold the data). Then we create a hard link and a soft link. Note that the -i
option to ls
actually shows the real inode (i.e. the first block on the filesystem) and that this is identical for file1 and file2 - in otherwords, they are both references to the same thing.
When we cat
the files, they are all the same. This is because Unix automatically dereferences the soft link (to find out where it goes) and then repeats the operation with the real file. This adds overhead to the call (because we have to look up two files - the soft link and then the file that the soft link points to) and should be kept in mind when looking at performance issues.
When we remove file1, the data still sits unchanged in the filesystem. It can be referenced via file2 but file3 is now useless because it no longer points to anything. Unix has no way of telling that file2 would be a reasonable replacement for file1.
Note that inodes are only unique within a filesystem and hence hard links do not work across filesystems. There is no way to create a hard link in say /var
which connects to a file in /usr
if the two are different filesystems.
Soft links cannot cope with the removal or relocation of the target file. Changing the target's name or directory will result in a "File not found" message.
Note that some operating systems (e.g. MacOS X) and some filesystems (AFS, HFS, HFS+) support another type of link called an alias. An alias is midway between a soft and a hard link. Effectively it is like a soft link to an inode. This is useful because, unlike a hard link, it can cross filesystem boundaries and it can cope, unlike a soft link, with the file path changing.
Posted by Ozguru at 06:00 AM
April 14, 2005
Farming in the nude?
One day a city dweller decided to take a ride in the country. He hopped into his sportscar, wandered along the highway for a while and then exited to some very rural dirt roads in the middle of farm country. After awhile, he came across a farmer who clearly working his fields. The funny thing was, the farmer didn't seem to be wearing any pants. The man got out of his car and approached the farmer.
"Hey, buddy," he asked, "how come you're not wearing any clothes?"
Replied the farmer, "Well, boy, th' other day I was out a-workin' in the fields, an' I plum fergot t' wear mah shirt. Got back to th' house that night, and mah neck was stiffer than a oak-wood board. This here's mah wife's idea."
Posted by Peskie at 12:00 PM
April 13, 2005
Memo
TO: Boss
FROM: Blondie
RE: Changing Calendars from Y2K
I hope that I haven't misunderstood your instructions because, to be honest, none of this Y to K problem made much sense to me. At any rate, I have finished the conversion of all of the months on all of the company calendars for next year. The calendars have returned from the printer and are ready to be distributed with the following new months:
Januark
Februark
Mak
Julk
I also changed all the days of each week to:
Sundak
Mondak
Tuesdak
Wednesdak
Thursdak
Fridak
Saturdak
We are now Y to K compliant. Have a nice dak!!!
Posted by Peskie at 12:00 PM | Comments (1)
April 12, 2005
Return Values
He's like a function -- he returns a value, in the form of his opinion. It's up to you to cast it into a void or not.
-- Phil Lapsley
Posted by Peskie at 12:00 PM
April 11, 2005
Truth in 13 words
Inside every older person is a younger person wondering what the hell happened.
Posted by Peskie at 12:00 PM
April 10, 2005
Decisions
A girl says to a salesman, “I'm not sure if I should buy a sweatshirt or a windbreaker.”
He says, “Well, that depends. Are you gonna sweat, or are you gonna ..."
Posted by Peskie at 12:00 PM
April 09, 2005
Quick Reply
“You seem to have more than the average share of intelligence for a man of your background,” sneered the lawyer at a witness on the stand.
“If I wasn't under oath, I'd return the compliment,” replied the witness.
Posted by Peskie at 12:00 PM
April 08, 2005
Two types of people...
Somebody has said there are only two kinds of people in the world.
There are those who wake up in the morning and say, "Good morning, Lord,"
And there are those who wake up in the morning and say, "Good Lord, it's morning."
Posted by Peskie at 12:00 PM | Comments (2)
April 07, 2005
Hymn 365
A southern Baptist minister was completing a temperance sermon. With great emphasis he said, "If I had all the beer in the world, I'd take it and pour it into the river."
With even greater emphasis he said, "and if I had all the wine in the world, I'd take it and pour it into the river."
And then finally, shaking his fist in the air, he said, "and if I had all the whiskey in the world, I'd take it and pour it into the river."
Sermon complete, he sat down.
The song leader stood very cautiously and announced with a smile, nearly laughing, "for our closing song, let us sing Hymn #365,
"Shall We Gather at the River."
Posted by Peskie at 12:00 PM | Comments (1)
April 06, 2005
Quiet Please
My sister had been ill, so I called to see how she was doing.
My ten-year-old niece answered the phone.
"Hello," she whispered.
"Hi, Honey. How's your mother doing?" I asked.
"She's sleeping," she answered, again in a whisper.
"Did she go to the doctor?" I asked.
"Yes. She got some medicine," my niece said softly.
"Well, don't wake her. Just tell her I called. What are you doing, by the way?"
Again in a soft whisper, she answered, "Practicing my trumpet."
Posted by Peskie at 12:00 PM | Comments (1)
April 05, 2005
Fame...
Fame may be fleeting but obscurity is forever.
Posted by Peskie at 12:00 PM
April 04, 2005
Deep Thought
Men who have pierced ears are better prepared for marriage.
They've experienced pain and bought jewelry.
Posted by Peskie at 12:00 PM
April 03, 2005
When is a "Y" silent?
Before marriage, a man yearns for the woman he loves.
After marriage, the 'Y' becomes silent.
Posted by Peskie at 12:00 PM
April 02, 2005
Can You Tell the Difference?
"Carefully study these two enlarged photographs on display, Mr. Rafferty," the attorney for a politician suing a newspaper for libel instructed his client on the witness stand, "and indicate which is your ass and which is a hole in the ground."
Posted by Peskie at 12:00 PM
April 01, 2005
Elbows on the table...
Dear Miss Manners:
My home economics teacher says that one must never place one's elbows on the table. However, I have read that one elbow, in between courses, is all right. Which is correct?
Gentle Reader:
For the purpose of answering examinations in your home economics class, your teacher is correct. Catching on to this principle of education may be of even greater importance to you now than learning correct current table manners, vital as Miss Manners believes that is.
Posted by Peskie at 12:00 PM | Comments (1)
Vi (or ViM)
I promised that today would be about vi (or vim) even though a better tip came along yesterday...
Vi is the grandfather of Unix editors - it was originally written by Bill Joy at UCB (yes the same Bill Joy who worked for Sun). Given the origins and the long history of the editor, you can bet that there must some hidden secrets.
Firstly, I need to explain to newcomers why vi is like it is and then I will move onto to showing how a pipe works in vi.
People who meet vi for the first time usually recoil in horror - where are the menus and mouse actions? Well vi was written at a time when those accessories did not exist - in fact you could run vi on terminals that did not even have arrow keys. To cater for such a limited hardware environment, the original design was for a pure modal editor - vi is either accepting instructions from you or it is adding text to the file. That mens if you are not getting the desired effect, you are probably in the wrong mode :-)
Command mode (where you tell vi to do things) is the default mode, you switch to text entry mode by using one of the commands that (a)dds or (i)nserts text (there are others as well such as (o)pen and (c)hange but the most common commands are 'a' and 'i'). To get back to command mode, you need to press the ESC key.
OK, you need to create a file on your nearest Unix box. If you want to play along, pick a directory with some files in it (like /tmp or you home directory). Let's call out file 'foo' (a time-honoured name for a scratch file):
vi foo
We are in command mode so type 'a' to add some text to the file. You will not see this 'a' on the screen. Type a few blank lines and then a line that contains the words:
ls -als
followed by a few more blank lines. Now hit ESC to get back command mode.
You can move around the file using the arrow keys (or if you don't have them, use 'h', 'j', 'k' and 'l'). Move the cursor to somewhere on the line with text on it. Exactly where on the line does not matter. Now we are going to trade this line for the results of a Unix command. Carefully type the following (including the colon):
:.!sh
(That was a ':', '.', '!' and the letters 's' and 'h'). The colon tells vi that we want to talk to the line editor underneath vi (ex), this is important because the way ex counts lines is a little different. The full stop says to use this line only. The exclamation mark says to pipe the left hand side (the line in the file) to the right hand side (the default Unix shell). When this returns, the results will replace the input line. You should have a long listing of all the files in your current directory inside your foo file.
Note that the command can be considerably more complicated and you can even chain commands together over multiple lines. Note that to send multiple lines to a pipe, you need to select them using the ':' and '.' operators. For example to pick the two lines before this one and one afterwards, we can say:
:.-2,.+1!sh
Note the use of a ',' to separate the left hand and right hand end of the range. If you want to know more about vi (or vim), drop me a line...
Posted by Ozguru at 06:00 AM