My First Post      My Facebook Profile      My MeOnShow Profile      W3LC Facebook Page      Learners Consortium Group      Job Portal      Shopping @Yeyhi.com

Pages










Showing posts with label technique. Show all posts
Showing posts with label technique. Show all posts

Tuesday, August 10, 2010

Two methods for Accepting User Input in Windows Command Line Prompt

Recently there was a task in Adobe that involved automation of entire Code Coverage Automation System. This involved calling one script after other. As the whole task involved some 100 number of scripts and I had to check the status of system say after execution of script number 56. So I had to interrupt in between in such a way that this interruption does not cause any data loss and we can continue from where we paused. For this I employed user input trick.

Method 1:

You can interact with a user and ask for any data to be entered. The traditional DOS O[perating System had a "Choice" command for a limited interaction. It is now superceded in Windows XP/Vista by the more versatile "set /p".

The syntax is:
set /p variable= [some string]

Here "variable" is the name of the variable that will be assigned to the data that you want the user to input. "some string" is the message that the user will see as a prompt. If desired, the string can be omitted.

Here is an example that asks the user to enter his or her id:
set /p u_id= What is your UserId?

This will create a variable %u_id% whose value is whatever the user enters. Note that the user must press the "Enter' key after typing the input.

You can also access this variable using following syntax:
%variable%

For example to print what was entered earlier just pass following command on command prompt: echo %u_id%


Method 2:

You can use "copy con" command to achieve somewhat similar goal. The syntax is:

copy con

This command accepts user input (including commas and enter keys) and dumps it into a file specified by the given file name. The reading continues till it is stopeed by Ctrl+z key combination. From there it can be read thereafter.

For example, if you have to prompt user to enter his user id, you can do the following:

echo Please enter your UserId
copy con abc.txt

I tested both the methods and personally found method 2 to be more satisfying. Though I find both methods to be error free, easy and enjoyable, yet you may have your own taste!!

So Happy Tasting (Not Happy Testing ;)

You can write me at toughjamy@yahoo.com.
To Know me professionally visit ..Linked In..
You can befriend me at ..FaceBook..
Read jokes at ..Jokes Limitless..
You can also know more about me at ToughJamy : An Informal Me!!

Thursday, August 5, 2010

How to remove Thumb.db file

We all know that Thumb.db file is a cache of the current picture in that directory. But sometimes it become necessary to remove it. In order to remove it go for following step:

1--> open "WINDOWS EXPLORER".
2--> go to "TOOLS".
3--> open "FOLDER OPTIONS".
4--> go to "VIEW".
5--> see 1st section "FILES & FOLDERS".
6--> click on the "DO NOT CACHE THUMBNAILS".

Now the thumbnail file will be removed from the computer system. And once you do this the file will be never created.

Some Useful shortcuts tricks and tips in Mac OS X

Today I am writing about several shortcuts and tricks in Mac OSX Platform. Some may be know to few people but some may really amaze you.

a) Select text in your browser and then drag and drop it onto your desktop. There will be a basic text file with your text in it.

b) cmd-click Finder window title: It shows a Pop-up menu showing path to current folder/document

c) Command Key and Tab Key can be used to cycle through your running apps as was done in Win platform using tab key alone.

d) Many do not know that you can change the style of the text/icons of a window by command clicking on the little button in the top right of the window of a program. That small button has more functionality too. Explore!!

e) Have you heard about famous Genie Effect in Mac. It is also regarded as Slow down effect. You can see this by holding down shift when clicking on the window minus button or documents in the dock. I will further explain this in Genie effect blog post separately.

f) Voice over Utility:
You can use apple logo key and F5 to launch Voice over utility App. You may also find this by default at /application/utilities/voiceover. I will write about this utility at some later time but if you explore yourself, you will be more benefitted.

g) Resizing a column divider in a Finder window is simple. But there is yetr another trick. Press Alt-click and drag column divider in Finder column view resizes columns evenly. This would resize width of columns in all finder windows opened.

h) Pressing F11 would engage expose and move all windows to the edge of your screen

i) Negative Vision Trick.
I discovered this a year earlier. Since then I used this many times to stun my younger sis, or for that matter my MBA Wife. Use control+alt (option)+command+8. This would make your screen go like a negative vision of your screen. You can do again the same to revert back.

Write your opinion.

You can know more about me at ..Linked In..
You can befriend me at ..FaceBook..
Read jokes at ..Jokes Linitless..

Emac from Unix to Mac.

The command emac can be used to play some games or some refreshing exercise once you get bored through your usual routine job. I do not know about its history but can be surely searched at Wikipedia. But today I will tell about some tricks with emac.

1) One trick is pressing control+option+command+8.

Another one is going to terminal then typing "emacs", then press "esc" and then "x", then type "doctor" or "tetris" or “life”. The effects are that ‘Tetris’ would pop up the classic ‘tetris’ game, ‘life’ shows the cell division process.

2) If you are a little bit bored, you can try M-x hanoi. If you are considerably bored, give it a numeric argument. If you are extremely bored, then try an argument of 9. Sit back and watch the Hanoi Towers been created.

3) If you want self involvement, try M-x gomoku, which plays the game Go Moku with you.

4) M-x dunnet runs an adventure-style exploration game, which is a bigger sort of puzzle.

5) As told, M-x tetris runs an implementation of the well-known Tetris game. What was not told is that, M-x snake provides an implementation of the famous Snake game.

6) When you are frustrated, try the famous Eliza program. Just do M-x doctor. End each input by typing RET twice.

7) When you are feeling strange, type M-x yow.

8) The command M-x zone plays games with the display when Emacs is idle.
So in this way you can counter react to the boredom at work if it occurs on Unix or Mac platform. One’s who are in luck to always deal with black screen of traditional Unix based system would really know what I mean when I speak of boredom ;)

And yes, do not forget ending with emcs—ctrl+q then ctrl+c .

So, Happy Emac-ing (I prefer calling e-mack-ing)