Shuva's blog
Flirting with CD 
Friday, March 28, 2008, 01:23 PM - Tips and Tricks
Powered By ReadTheWords.com
This week I have been trying to automate my Windows build. I have never done any automation on Window ever before. It was always on Unix with batch files and Perl. For a while I had mixed feelings about installing Perl on Windows and moving forward, but nevertheless I took the path of writing it all in BATCH script. If Perl is easier then Bash, then Batch scripting is way too difficult and slow – may be its just me.

While doing so, there was a time when I wanted to know my current directory and I was stuck trying to find out what is the windows command to get the current directory. I was a bit ashamed to ask Google about this. I tried PWD and CWD but na. I asked a few guys around me. Unfortunately they could not guess beyond PWD and CWD - which made me feel less ashamed of myself.

At last, I had to Google it and guess what I found. Its was the first DOS command I ever learned in my computer class way back in 1994. The great command is

CD

And if you are scripting you will find it in the environmental variable called CD, i.e. %CD%. How could I ever forget this? In Unix CD would always mean going back to your home directory, but that’s the different story and not an excuse for forgetting.

While reading the doc. for the CD command, I found a few not-so-well-known features of the CD command and thought I will list them here for the entertainment of my readers.

1. If you are in C drive and you want to go to D:\mydir then we generally do
D: 
cd mydir.

Well, you can directly say
CD /D D:\mydir. 

The /D flag causes a drive change. I wonder why did they every keep this flag in the first place. Even if it has historic reasons, they should get rid of it now.

2. While mentioning an absolute path reference you don’t need to give the drive letter. Just start with “\”.
CD C:\mydir\somedir
is same as
CD \mydir\somedir


3. CD does not treat spaces as delimiters, so it is possible to CD into a sub folder name that contains a space without surrounding the name with quotes. If you have two sub dirs, one called Shuva and the other called Shuva Brata, then the command CD Shuva Brata would take you to Shuva Brata.

But the command MKDIR Shuva Brata would create two directories, one called Shuva and the other called Brata. The command rmdir Shuva Brata would delete both Shuva and Brata. Its just CD which is inconsistent(or call it special or call it confusing)

In Linux if you type cd – you go to the previous(not parent) directory. Example:
SHUVA:build 30] pwd
/home/build
SHUVA:build 31] cd /var/lib/
SHUVA:lib 32] pwd
/var/lib
SHUVA:lib 33] cd -
/home/build
SHUVA:build 34] pwd
/home/build
SHUVA:build 35]


The way to do this in Windows is:

c:\Program Files> PUSHD c:\utils
c:\utils>
c:\utils> POPD
c:\Program Files>


If somebody tell you that the command CD displays information about your CD drive, what would you say?

Happy CDing.//
1 comment ( 125 views )   |  0 trackbacks   |  permalink   |   ( 3 / 43 )
Why was I away from my blog? 
Thursday, March 27, 2008, 12:12 PM - Photography
Powered By ReadTheWords.com
It been quite some time(last post was on 12-Feb-08) since I wrote anything here. I haven't been getting any free time for my blog the last few weeks and the main reason is the onset of father hood. Yeah, me and my wife Lipika, was blessed with a lovely baby girl on Feb-16-08. In addition to that I had my project release dates also falling around the same week. Its been around 6 weeks now and I have a bit relaxed and I think I now have time to get back to making this blog active again.

For today, I am just posting a picture of my beautiful daughter, Tisha here when she was just 2 days old.



You can visit my photo blog for more pictures of Tisha.

Happy Reblogging.//
1 comment ( 86 views )   |  0 trackbacks   |  permalink   |   ( 2.9 / 45 )
Key strokes for finding the block ends(those curly braces) in your program 
Tuesday, February 12, 2008, 03:07 PM - Tips and Tricks
7:22 PM me: ????
14 minutes
7:36 PM Kishore: hey man
how'sit going
7:37 PM me: abbey
7:38 PM in Linux when you want to find out the corresponding pair for "{"
in a c program?
7:39 PM Kishore: hmm... does Cntrl +} wrk or shift
7:40 PM me: hold on
7:41 PM neither si working for me....I dont know whay
thats why I am asking you!
7:42 PM Kishore: can't recall...
but there's one more combination tht definitely wrks...
me: ok no probs, I will bank on my insticts to come back some day!
Kishore: ya...
me: kam kaisa chal raha hai?
--Stuff deleted --
7:47 PM did you try % while standing at the opened {
i tried tht and it works for me
7:48 PM me: Yahoooooooooooooooooooo!
7:49 PM Kishore: cool :)
me: Ctrl + } is for Windows and % for Linux...
Kishore: so that's a compatible solution to vi, vim and other unix eds
me: yes
Kishore: one more is there... it used to wrk for Solaris vi
not sure abt linux
me: what?
Kishore: ]}
7:50 PM me: thats a complicate keystroke ]}
Kishore: hmm... but for now even i'll remember the frnd "%"
;)
me: tahnsk!
7:51 PM Kishore: happy %-ing --Stuff deleted --


And just for my notes: In Emacs, its [Alt] + [Right Arrow] or [Left Arrow]

Happy Bracing.//
1 comment ( 158 views )   |  0 trackbacks   |  permalink   |   ( 2.8 / 69 )
The quick brown fox jumps over the lazy dog 
Friday, February 8, 2008, 04:34 AM - Tips and Tricks
You you are like minded person like me, you must have received some email or the other talking of the mystery of this phrase "The quick brown fox jumps over the lazy dog" which suddenly appears when you type the words =rand(6,6) in Microsoft word and press [Enter]. Some emails claimed that everybody in Microsoft including Billu is puzzled about this. Some claimed its a naughty trick left over by a smart developer and some even claimed that its a permanent virus in MS word.

Yesterday I received a newsletter from MS, which seem to give a very reasonable explanation to its existence. It says :

On a blank line in a Microsoft Office Word document, type =rand followed by (PC,SC)—where PC stands for paragraph count and SC stands for sentence count—and then press ENTER. For example, =rand(2,3) will create two paragraphs of three sentences each.

Word inserts some random text based on your specification. You can use this new text for testing form controls such as text boxes or paragraph alignments.


This does make a lot of sense. In Microsoft Word 2007, if you type "=rand(1,100)" and press enter you will get the text "On the Insert tab, the galleries include items that are designed to coordinate with the overall look of your document. You can use these galleries to insert tables, headers, footers, lists, cover pages, and other document building blocks.". Localized version of Windows uses other phrases to test the local version.

But why this phrase?
If you observe this phrase carefully you will see that it is a phrase that uses all the letters of the alphabet.

Happy reading.//
1 comment ( 102 views )   |  0 trackbacks   |  permalink   |   ( 3 / 69 )
Microsoft comic series 
Thursday, February 7, 2008, 04:10 AM - News
The first thing I did today morning was add another RSS feed into my Google Reader. This one is unique as its not about "serious" technology or photography, but comics. Comics from Microsoft? Yes Microsoft launched the HHH comic series today.

Here is one that I like:



Go visit the HHH comic series now or get their RSS feed.

Happy reading.//
1 comment ( 111 views )   |  0 trackbacks   |  permalink   |   ( 3 / 70 )

<<First <Back | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | Next> Last>>