Hethu's Techno Babble

Tuesday, October 18, 2005

Side-effects of "con" Console

Few days back I got an email which read:

An Indian discovered that nobody can create a folder anywhere named as "con"

This is something pretty cool... and unbelievable... At Microsoft the whole Team, including Bill Gates, couldn't answer why this happened!

Try it out yourself...

Anyone who is old enough to have used DOS would know better. What a lame and ignorant thing to say that even Microsoft couldn't answer!

I was even more surprised to hear the same lame story on Yes FM Radio today. The show host has obviously got the same email and thought it was cool enough to share on air and went on saying "can you believe it, even Bill Gates doesn't seem to know why"!!!

Geeeez... talk about being clueless and ignorant!

Let me give you a clue. Almost everyone with a DOS background (I know, I'm one of those few l337s :) knows that "con" is the named IO device for the primary console.

So if you want to copy the output of a file to the console, you can type at a Command Prompt:
copy file.txt con

And if you want to create a new file with the contents you enter at the console, type:
copy con file.txt
key in your text content, type Ctrl-Z (or F6) and hit Enter to save the file.

This is one of my favorite ways to quickly create DOS batch files, and I've been doing this for years!

Now, getting back to the original email about not being able to create a folder named "con"; answer this: if you can create such a folder, what on earth would happen to my favorite copy con file.txt command?

And oh, while we are at it, "prn" is also such an IO device (for local printer) and you can't create such a named folder either, and I am quite sure Microsoft (and Bill Gates) are quite aware of this unbelievable thing too!

This reminds me, another one of my DOS-days favorite is to use copy con prn and use the locally attached printer as a typewriter. ie. type something on the console and hit Enter to print that line on the printer. Amuse yourself with good ol' DOS tricks!

Me @ Microsoft Tech.Ed 2005

I finally went for the much awaited Tech.Ed 2005 show held at Waters Edge, Battaramulla, Sri Lanka.

The event started off with a cool thabla and drums musical show with flashy lighting effects and high tech sounds. For a moment, I was stunned and was wondering whether I came in for the right techie event! :)

After the intro, and after some keynote speakers, it was straight down to techie sessions.

Microsoft Tech.Ed 2005 Sri Lanka

There were four parallel sessions going on at one given time; so you got to choose among them and decide which sessions you are most interested in. As a developer and enthusiast in Microsoft technologies, that became quite a difficult choice for me. For example, I had choices like Visual Studio 2005 Team System, Windows Mobile, SQL Server 2005 and Windows Vista sessions. You go for one, you miss three others!

Microsoft Tech.Ed 2005 Sri Lanka

Microsoft Tech.Ed 2005 Sri Lanka

This was the first time we had such an event in Sri Lanka, and yes, there were some minor glitches especially due to bad coordination and time management in some sessions. At one time, one session went on longer than it was scheduled, and once it was over, the people in that session could not attend the other sessions from the beginning since those were already started on schedule. The organizers should have better coordinated this. Maybe we'd do better next year.

Overall, it was a great event with loads of techie sessions and fun!

Microsoft Tech.Ed 2005 Sri Lanka

Thats me near the XBox gaming zone.
The last day night was a fun night with loads of Microsoft giveaways, hot dancing and booze! :)

Microsoft Tech.Ed 2005 Sri Lanka

Yea, Microsoft style fun!

Friday, October 07, 2005

Random text in Microsoft Word documents

You have obviously heard before that you can type =rand() and hit <enter> in a Word document to auto insert paragraphs with the text: "The quick brown fox jumps over the lazy dog".

What is interesting is that this is not a hidden Easter egg. It is a known documented feature, and is described in a Microsoft Knowledge Base article.

Basically, the idea is to quickly add some sample text to a document. Perhaps to test the print margins, the header/footer behavior or to see how the text looks like when you apply the new Style you just created.

I found this really handy when I wanted to test the Booklet printing features in Word and wanted at least 5 pages of text. :)

Now you don't have to blindly type

asdf<enter>
fdsaa<enter>
ds<enter>
dsfdsfs<enter>

repeatedly to fill in a document.

Use =rand(p, s) and <enter> to insert p number of paragraphs with s number of sentences.

So, =rand(3,5) would insert 3 paragraphs with each having 5 sentences of "The quick brown fox jumps over the lazy dog".

Go ahead, try something like =rand(100,100)

(note that the maximum number you can give for a parameter is 200)