Jumbling words

This has got to be one of best   E-mails I’ve received in a while. Someone out there either has too much spare time or is deadly at Scrabble.

ASTRONOMER:
When you rearrange the letters:

MOON STARER

DESPERATION:
When you rearrange the letters:

A ROPE ENDS IT
    DORMITORY:
When you rearrange the letters:

DIRTY ROOM

THE EYES:
When you rearrange the letters:

THEY SEE

GEORGE BUSH:
When you rearrange the letters:

HE BUGS GORE

THE MORSE CODE:
When you rearrange the letters:

HERE COME DOTS

SLOT MACHINES:
When you rearrange the letters:

CASH LOST IN ME

ANIMOSITY:
When you rearrange the letters:

IS NO AMITY

ELECTION RESULTS:
When you rearrange the letters:

LIES – LET’S RECOUNT

MOTHER-IN-LAW:
When you rearrange the letters:

WOMAN HITLER

SNOOZE ALARMS:
When you rearrange the letters:

ALAS! NO MORE Z ‘S

A DECIMAL POINT:
When you rearrange the letters:

I
M A DOT IN PLACE

THE EARTHQUAKES:
When you rearrange the letters:

THAT QUEER SHAKE

ELEVEN PLUS TWO:
When you rearrange the letters:

TWELVE PLUS ONE

Perfect depiction of a Software Engineer

This is the Software life ……………

You cry as much as you can, but nobody to hear you.There are 2 persons always next to you :

  1. The PM(Project Manager), giving a pleasant smile everytime we see him/HER.
  2. The TL(Team Leader), busy in scheduling work for us ….. and busy in his world

@ the centre its we (Software engineers), who struggle with all the Buggs/ PR’s/CR’s/Issues.

The perfect picture is Given Below ……{ Team leader — Developer — PM. }

Adding Custom Tab into Toolbox of VS 2003 or 2005

Souce Code
///
<summary>
/// Adding Custom ToolTab into ToolBox of Visual Studio 2003 or 2005
/// </summary>
/// <param name=”sAssemblyPath”>Path of Assembly</param>
/// <param name=”sTabName”>Tab Name</param>
/// <param name=”sControlName”>Control Name</param>
/// <param name=”isWhidbey”>Check whether VS2k3 or VS2k5</param>
/// <returns></returns>
public static bool RegisterControl(string sAssemblyPath,string sTabName,
string sControlName,bool isWhidbey) {
try {
EnvDTE.DTE dte;

if(isWhidbey)
dte = (EnvDTE.DTE)System.Runtime.InteropServices.Marshal.GetActiveObject(“VisualStudio.DTE.8.0″);
else
dte = (EnvDTE.DTE)System.Runtime.InteropServices.Marshal.GetActiveObject(“VisualStudio.DTE.7.1″);

ToolBox objToolBox;
ToolBoxTabs colTbxTabs;
ToolBoxTab objTab;
ToolBoxItem objTbxItem ;
// Create an object reference to the IDE’s ToolBox object.
objToolBox = (EnvDTE.ToolBox)dte.Windows.Item(Constants.vsWindowKindToolbox).Object;
//.Object;
colTbxTabs = objToolBox.ToolBoxTabs;

/*
* In some cases if the propeties window is hidded or closed, this line will activate the properties window.And the second line you have cited will add the controls to the active tab.In some case if the tab is not made active, the controls will be added either to the active tab or to the general tab section.It might work in your case, but does not in certain cases, better to do it sequentially giving no room for errors.
*/

//ToolBoxWnd.Visible = true;
//objToolBox.DTE.ExecuteCommand(“View.PropertiesWindow”,”");

for(int i=1; i < colTbxTabs.Count ; i++) {
if(colTbxTabs.Item(i).Name.ToString().Trim() == sTabName) {
Console.WriteLine(colTbxTabs.Item(i).Name.ToString());
objTab = colTbxTabs.Item(i);
foreach(ToolBoxItem tbxi in objTab.ToolBoxItems) {
Console.WriteLine(tbxi.ToString());
//Print ToolboxItem.
}
objTab.Delete();
//Delete if it is already exist.
break;
}
}
// Add a new tab to the ToolBox.
objTab = colTbxTabs.Add(sTabName);
objTab.Activate();

///Adding the .Net control to the Toolbox
if(isWhidbey){
objTbxItem=objTab.ToolBoxItems.Add(sControlName,
sAssemblyPath , vsToolBoxItemFormat.vsToolBoxItemFormatDotNETComponent);
}
else{
//Must be null if the control is many child controls. (VS2003)
objTbxItem=objTab.ToolBoxItems.Add(
null,
sAssemblyPath , vsToolBoxItemFormat.vsToolBoxItemFormatDotNETComponent);
}

Console.WriteLine(objTab.ToolBoxItems.Item(objTab.ToolBoxItems.Count).Collection.Count);
return true;
}
catch(Exception ex) {
Console.WriteLine(“RegisterControl(string) : ” + ex.Message) ;
return false;
}

}


UsageRegisterControl(txtAsmPath.Text, txtTabName.Text,txtControlName.Name,chkIsWhidbey.Checked);

Note:

  1. The Custom ToolBar will be created in the first instance of VS IDE. (It’s better if you open only one VS IDE.)
  2. Form Designer should be shown. (If TextEditor is shown then, this code wont’ execute properly because VS IDE automatically prevent the usage of Toolbox if Text Editor is shown.)

Download SouceCode : http://www.geocities.com/mchlsync/VSTbxMgr.zip

Let me know if you have any problem with this soucecode. Thanks.

Microsoft Interview Questions

Microsoft Interview Questions

The following are actual questions from actual interviews conducted by Microsoft employees on the main campus. Microsoft Consultants are sometimes allowed to have a life, so questions asked of them during interviews don't really count and aren't listed.The questions tend to follow some basic themes:


Riddles

  • Why is a manhole cover round?
  • How many cars are there in the USA? (A popular variant is "How many gas stations are there in the USA?")
  • How many manhole covers are there in the USA?
  • You've got someone working for you for seven days and a gold bar to pay them. The gold bar is segmented into seven connected pieces. You must give them a piece of gold at the end of every day. If you are only allowed to make two breaks in the gold bar, how do you pay your worker?
  • One train leaves Los Angeles at 15mph heading for New York. Another train leaves from New York at 20mph heading for Los Angeles on the same track. If a bird, flying at 25mph, leaves from Los Angeles at the same time as the train and flies back and forth between the two trains until they collide, how far will the bird have traveled?
  • Imagine a disk spinning like a record player turn table. Half of the disk is black and the other is white. Assume you have an unlimited number of color sensors. How many sensors would you have to place around the disk to determine the direction the disk is spinning? Where would they be placed?
  • Imagine an analog clock set to 12 o'clock. Note that the hour and minute hands overlap. How many times each day do both the hour and minute hands overlap? How would you determine the exact times of the day that this occurs?
  • You have two jars, 50 red marbles and 50 blue marbles. A jar will be picked at random, and then a marble will be picked from the jar. Placing all of the marbles in the jars, how can you maximize the chances of a red marble being picked? What are the exact odds of getting a red marble using your scheme?
  • Pairs of primes separated by a single number are called prime pairs. Examples are 17 and 19. Prove that the number between a prime pair is always divisible by 6 (assuming both numbers in the pair are greater than 6). Now prove that there are no 'prime triples.'
  • There is a room with a door (closed) and three light bulbs. Outside the room there are three switches, connected to the bulbs. You may manipulate the switches as you wish, but once you open the door you can't change them. Identify each switch with its bulb.
  • Suppose you had 8 billiard balls, and one of them was slightly heavier, but the only way to tell was by putting it on a scale against another. What's the fewest number of times you'd have to use the scale to find the heavier ball?
  • Imagine you are standing in front of a mirror, facing it. Raise your left hand. Raise your right hand. Look at your reflection. When you raise your left hand your reflection raises what appears to be his right hand. But when you tilt your head up, your reflection does too, and does not appear to tilt his/her head down. Why is it that the mirror appears to reverse left and right, but not up and down?
  • You have 4 jars of pills. Each pill is a certain weight, except for contaminated pills contained in one jar, where each pill is weight + 1. How could you tell which jar had the contaminated pills in just one measurement?
  • The SF Chronicle has a word game where all the letters are scrambled up and you have to figure out what the word is. Imagine that a scrambled word is 5 characters long:
    1. How many possible solutions are there?
    2. What if we know which 5 letters are being used?
    3. Develop an algorithm to solve the word.
  • There are 4 women who want to cross a bridge. They all begin on the same side. You have 17 minutes to get all of them across to the other side. It is night. There is one flashlight. A maximum of two people can cross at one time. Any party who crosses, either 1 or 2 people, must have the flashlight with them. The flashlight must be walked back and forth, it cannot be thrown, etc. Each woman walks at a different speed. A pair must walk together at the rate of the slower woman's pace.Woman 1: 1 minute to cross
    Woman 2: 2 minutes to cross
    Woman 3: 5 minutes to cross
    Woman 4: 10 minutes to cross
    For example if Woman 1 and Woman 4 walk across first, 10 minutes have elapsed when they get to the other side of the bridge. If Woman 4 then returns with the flashlight, a total of 20 minutes have passed and you have failed the mission. What is the order required to get all women across in 17 minutes? Now, what's the other way?
  • If you had an infinite supply of water and a 5 quart and 3 quart pail, how would you measure exactly 4 quarts?
  • You have a bucket of jelly beans. Some are red, some are blue, and some green. With your eyes closed, pick out 2 of a like color. How many do you have to grab to be sure you have 2 of the same?
  • If you have two buckets, one with red paint and the other with blue paint, and you take one cup from the blue bucket and poor it into the red bucket. Then you take one cup from the red bucket and poor it into the blue bucket. Which bucket has the highest ratio between red and blue? Prove it mathematically.

Algorithms

  • What's the difference between a linked list and an array?
  • Implement a linked list. Why did you pick the method you did?
  • Implement an algorithm to sort a linked list. Why did you pick the method you did? Now do it in O(n) time.
  • Describe advantages and disadvantages of the various stock sorting algorithms.
  • Implement an algorithm to reverse a linked list. Now do it without recursion.
  • Implement an algorithm to insert a node into a circular linked list without traversing it.
  • Implement an algorithm to sort an array. Why did you pick the method you did?
  • Implement an algorithm to do wild card string matching.
  • Implement strstr() (or some other string library function).
  • Reverse a string. Optimize for speed. Optimize for space.
  • Reverse the words in a sentence, i.e. "My name is Chris" becomes "Chris is name My." Optimize for speed. Optimize for space.
  • Find a substring. Optimize for speed. Optimize for space.
  • Compare two strings using O(n) time with constant space.
  • Suppose you have an array of 1001 integers. The integers are in random order, but you know each of the integers is between 1 and 1000 (inclusive). In addition, each number appears only once in the array, except for one number, which occurs twice. Assume that you can access each element of the array only once. Describe an algorithm to find the repeated number. If you used auxiliary storage in your algorithm, can you find an algorithm that does not require it?
  • Count the number of set bits in a number. Now optimize for speed. Now optimize for size.
  • Multiple by 8 without using multiplication or addition. Now do the same with 7.
  • Add numbers in base n (not any of the popular ones like 10, 16, 8 or 2 — I hear that Charles Simonyi, the inventor of Hungarian Notation, favors -2 when asking this question).
  • Write routines to read and write a bounded buffer.
  • Write routines to manage a heap using an existing array.
  • Implement an algorithm to take an array and return one with only unique elements in it.
  • Implement an algorithm that takes two strings as input, and returns the intersection of the two, with each letter represented at most once. Now speed it up. Now test it.
  • Implement an algorithm to print out all files below a given root node.
  • Given that you are receiving samples from an instrument at a constant rate, and you have constant storage space, how would you design a storage algorithm that would allow me to get a representative readout of data, no matter when I looked at it? In other words, representative of the behavior of the system to date.
  • How would you find a cycle in a linked list?
  • Give me an algorithm to shuffle a deck of cards, given that the cards are stored in an array of ints.
  • The following asm block performs a common math function, what is it?
    cwd xor ax, dx
    sub ax, dx
  • Imagine this scenario:
    I/O completion ports are communictaions ports which take handles to files, sockets, or any other I/O. When a Read or Write is submitted to them, they cache the data (if necessary), and attempt to take the request to completion. Upon error or completion, they call a user-supplied function to let the users application know that that particular request has completed. They work asynchronously, and can process an unlimited number of simultaneous requests.
    Design the implementation and thread models for I/O completion ports. Remember to take into account multi-processor machines.
  • Write a function that takes in a string parameter and checks to see whether or not it is an integer, and if it is then return the integer value.
  • Write a function to print all of the permutations of a string.
  • Implement malloc.
  • Write a function to print the Fibonacci numbers.
  • Write a function to copy two strings, A and B. The last few bytes of string A overlap the first few bytes of string B.
  • How would you write qsort?
  • How would you print out the data in a binary tree, level by level, starting at the top?

Applications

  • How can computer technology be integrated in an elevator system for a hundred story office building? How do you optimize for availability? How would variation of traffic over a typical work week or floor or time of day affect this?
  • How would you implement copy-protection on a control which can be embedded in a document and duplicated readily via the Internet?
  • Define a user interface for indenting selected text in a Word document. Consider selections ranging from a single sentence up through selections of several pages. Consider selections not currently visible or only partially visible. What are the states of the new UI controls? How will the user know what the controls are for and when to use them?
  • How would you redesign an ATM?
  • Suppose we wanted to run a microwave oven from the computer. What kind of software would you write to do this?
  • What is the difference between an Ethernet Address and an IP address?
  • How would you design a coffee-machine for an automobile.
  • If you could add any feature to Microsoft Word, what would it be?
  • How would you go about building a keyboard for 1-handed users?
  • How would you build an alarm clock for deaf people?

Thinkers

  • How are M&Ms made?
  • If you had a clock with lots of moving mechanical parts, you took it apart piece by piece without keeping track of the method of how it was disassembled, then you put it back together and discovered that 3 important parts were not included; how would you go about reassembling the clock?
  • If you had to learn a new computer language, how would you go about doing it?
  • You have been assigned to design Bill Gates bathroom. Naturally, cost is not a consideration. You may not speak to Bill.
  • What was the hardest question asked of you so far today?
  • If MS told you we were willing to invest $5 million in a start up of your choice, what business would you start? Why?
  • If you could gather all of the computer manufacturers in the world together into one room and then tell them one thing that they would be compelled to do, what would it be?
  • Explain a scenario for testing a salt shaker.
  • If you are going to receive an award in 5 years, what is it for and who is the audience?
  • How would you explain how to use Microsoft Excel to your grandma?
  • Why is it that when you turn on the hot water in any hotel, for example, the hot water comes pouring out almost instantaneously?
  • Why do you want to work at Microsoft?
  • Suppose you go home, enter your house/apartment, hit the light switch, and nothing happens – no light floods the room. What exactly, in order, are the steps you would take in determining what the problem was?
  • Interviewer hands you a black pen and says nothing but "This pen is red."

Honestly Speaking!

This is the copy of http://www.sellsbrothers.com/fun/msiview/default.aspx?content=question.htm

Thanks.

JavaScript – Working with Database

After reading this coding, you will know the following facts.

  1. How to connect the database in JavaScript
  2. How to use the ADODB.Recordset in JavaScript

As I already put the details comments in coding, I hope you will find it useful.

You can download the sourcecode and MSAccess database from this link.

http://michaelsync.net/demo/JavaScriptDatabaseSrc.zip

****

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=
"http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script type
="text/javascript">
<!–
var adOpenDynamic = 2;
var adLockOptimistic = 3;

/* Path of database.
If you put the database "Inventory.mdb" in different location,
you need to specify the correct path to this variable.
But When you are running the webpage from Browsers only,
you should use this keyword "window.location.pathname" for getting
the current location. But If you are using FrontPage,
you hav to specity the static path.
*/
var strDbPath = "C:\\JavaScript Database\\Inventory.mdb";

/*
Here is the ConnectionString for Microsoft Access.
If you wanna use SQL or other databases, you hav
to change the connection string..
eg: SQL => var conn_str = "Provider=sqloledb; Data Source=itdev;" +
"Initial Catalog=pubs; User ID=sa;Password=yourpassword";
*/
var conn_str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strDbPath;

function getAdoDb(strAdoType){
if (window.ActiveXObject){
return new ActiveXObject(strAdoType);
}
else{
return new ActiveXObject(strAdoType);
}
}

function showReports(){
try{
var strHtml ="";
strHtml += "<table cellpadding=0 cellspacing=0 border=1 width=500px align=center>";
strHtml += "<tr ><td align=center colspan=4><b>Stock List</b></td></tr>";

//Database Connection
var conn = getAdoDb("ADODB.Connection");
conn.open(conn_str, "", "");

//Recordset
var rs =
getAdoDb("ADODB.Recordset");
strQuery = "SELECT StockID,StockName,ReOrderLevel,IsActive FROM Stocks";
rs.open(strQuery, conn, adOpenDynamic, adLockOptimistic);

if(!rs.bof){
rs.MoveFirst();
while(!rs.eof) {
strHtml += "<tr>";
strHtml += " <td width=\"10px\">" + rs.fields(0).value + "</td>";
strHtml += " <td width=\"50px\">" + rs.fields(1).value + "</td>";
strHtml += " <td width=\"10px\">" + rs.fields(2).value + "</td>";
strHtml += " <td width=\"5px\">" + rs.fields(3).value + "</td>";
strHtml += "</tr>";

rs.MoveNext();
}
}
else{
//No Records.
strHtml += "<tr colspan=4><td align=center><font color=red>No Records.</font></td></tr>";
}
conn.close();
strHtml += "</table>";
document.write(strHtml);
}catch(ex){
alert(ex.message);
}
}

//–>
</script>
<title>
Stock List</title>
</head>
<!–<body onload="show_menu()">
<div id="main" />–>
<body>
<script language="JavaScript">
showReports();
</script>
</body>
</html>

That’s mother

When you were 1 year old, she fed you and bathed you.
You thanked her by crying all night long.
———————————————————————-

When you were 2 years old, she taught you to walk.
You thanked her by running away when she called.
———————————————————————-

When you were 3 years old, she made all your meals with Love.
You thanked her by tossing the plate on the floor.
———————————————————————–

When you were 4 years old, she gave you some crayons.
You thanked her by coloring the dining room table.
———————————————————————–

When you were 5, she dressed you for the holidays.
You thanked her by plopping into the nearest.
———————————————————————–

When you were 6, she walked you to school.
You thanked her by screaming, IM NOT GOING!
———————————————————————–

When you were 7, she bought you a x-udball.
You thanked her by throwing it through the next-door-neighbors window.
———————————————————————–

When you were 8, she handed you an ice-cream.
You thanked her by dripping it all over her lap.
———————————————————————-

When you were 9, she paid for piano lessons.
You thanked her by never even bothering it to practice.
———————————————————————–

When you were 10 years old, she drove you all day, from soccer to Gymnastics to one birthday party to another.
You thanked her by jumping out of the car and never looking back.
———————————————————————–

When you were 11, she took you and your friends to the movies.
You thanked her by asking her to sit in a different row.
———————————————————————–

When you were 12, she warned you not to watch certain TV shows.
You thanked her by waiting until she left the house.
———————————————————————–

When you were 13, she suggested a haircut.
You thanked her by telling her she had no taste.
———————————————————————–

When you were 14, she paid a month away at the summer camp.
You thanked her by forgetting to write a single letter.
———————————————————————–

When you were 15, she came from work, looking fora hug.
You thanked her by having your bedroom doorlocked.
———————————————————————–

When you were 16, she taught you how to drive a car.
You thanked her by taking every chance you could.
———————————————————————–

When you were 17, she was expecting an important call.
You thanked her by being on the phone all the night.
———————————————————————–

When you were 18, she cried at your high school graduation.
You thanked her by staying out partying until dawn.
———————————————————————–

When you were 19, she paid for your college tuition, drove you to campus carried your bags.
You thanked her by saying outside the dorm so you wouldnt be embarrassed in front of your friends.
———————————————————————–

When you were 20, she asked you whether you are seeing anyone.
You thanked her by saying, Its none of yourbusiness.
———————————————————————–

When you were 21, she suggested you certain careers.
You thanked her by saying, I dont want to be like you.
———————————————————————–

When you were 22, she hugged you at your college graduation.
You thanked her by asking whether she could pay for a trip to Europe.
———————————————————————–

When you were 23, she gave you furniture for your first apartment.
You thanked her by telling your friends it was ugly.
———————————————————————–

When you were 24, she met your fiance and asked about plans for the future.
You thanked her by glaring and growling,Muuhh-ther, please!
———————————————————————-

When you were 25, she helped you to pay for your wedding.
You thanked her by moving half way across the country.
———————————————————————-

When you were 30, she called with some advice on the baby.
You thanked her by telling her, Things are different now.
———————————————————————–

When you were 40, she called to remind you of a relative's birthday.
You thanked her by saying you were really busy right now.
————————————————————————

When you were 50, she fell ill and needed you to take care of her.
You thanked her by reading about the burden parents become to their children.
———————————————————————–

And then, one day, she quietly died. And everything you never did Came crashing down like thunder on YOUR HEART.

”IF SHE'S STILL AROUND, NEVER FORGET TO LOVE HER MORE THAN EVER.AND IF SHES NOT, REMEMBER HER UNCONDITIONAL LOVE AND PASS IT ON ALWAYS REMEMBER TO LOVE YOUR MOTHER, BECAUSE YOU ONLY HAVE ONE MOTHER IN YOUR LIFETIME”