Wednesday, June 29, 2005

About last day in college

Today had been a very special day, it was the last day in college (the job fair in which I had attended just to be with my friends and colleagues), nearly I wont meet all this people again, may be sometimes but it wont be as we used to do, I know that I hadn't got the feeling of being so sad yet (may be because the distance between my mind and my heart is too long and the conductors are too bad LOL :P ).

Any way, whatever the reason, I think I'd really miss all this people too much, but I'll do my best to come here to Egypt 2-4 times per year to meet my family and my friends and colleagues.

Hope to see you all again, it was my pleasure to know people like you :)

Thursday, June 16, 2005

Is it a bug in the C# compiler or what?

I don't know whether the up-coming expression evaluation in the C# had revealed a bug inside the C# compiler or not, any way let's discuss it:

Imagine we've a function like this in C#:

void Func(ref int a, ref int b)
a ^= b ^= a ^= b;

Usually if we used the right to left compiler expression evaluation, we'll walk in this way, at first we know our variables' values are changing in each step, so we can easily determine that the expression must be renamed to be:

a2 ^= b1 ^= a1 ^= b0;

And when we make it as successive steps, it'll be:

a1 = a0 ^ b0;
b1 = b0 ^ a1;
a2 = a1 ^ b1;

In this case:
a-final = a1^b1 = (a0 ^ b0) ^ (b0 ^ a1) = (a0 ^ b0) ^ (b0 ^ (a0 ^ b0))
And after replacing all a0 with a and b0 with b, it'll be:

a-final = (a ^ b) ^ (b ^ (a ^ b)) = (a ^ b) ^ a = b.
The same steps done in b-final:

b-final = b0 ^ a1 = b0 ^ (a0 ^ b0) = b ^ a ^ b = a.
So we can easily determine that this function will do a simple swapping between the two variables, then where's the bug?!!

The bug will be raised when we try to evaluate the expression from right to left without renaming the variables, in this case:

a ^= b ^= a ^= b;

Will be evaluated as Three steps in order: a = a ^ b;
b = b ^ a;
a = a ^ b;

so, a-final = a ^ (b ^ (a ^ b)), and here's the bug, they hadn't put in mind that the left most a in the a-final equation is not equal to the original a, it's equal to a ^ b, so they had omit extra b which will lead the expression of a-final to be evaluated as: a-final = a ^ a = zero, so instead of being a swapping function, this function will just copy the value of a in b and make a = zero.

I don't know if this is a real bug, or they intended to evaluate the expression in C# in this way (knowing that C++ compiler is evaluating it in the true order), really I don't have a clue, but I'll try to know the truth any way :)

Saturday, June 11, 2005

My Experience with Microsoft Interview (Part 3)

After that, I had a very nice time waiting for the results, they told us that they will respond to us within a time frame of two weeks, so I had waited all that time with no answer, after that I had went to Sharm El Shekh with my friends, in the second day, we got a phone call on Mohamed Samir's cell phone, it was our friend Ahmed Ismael, he was asking him about his results, and we knew that the results had been released and we supposed to have it now on our email box, we were very mad at this moment, and we searched the whole place for a cyber or any place which has any access to the web, till I remember that I had seen a cyber on the door of the resort, so we went there, I asked Samir to see his results at first, he had seen it and unfortunately he hadn't been selected, so I had jumped into mine, I had found nothing, no yes or no, so I had spent about 3 hours waiting (because I thought it's on its way to be sent), but also in vain, so I paid the money, and go out, I had spent the rest of the journey in the cyber :D

And after all that I had sent an email to Caroline asked about my results, she told me that the team had some sudden family problems and they won't be able to answer me now!!

I had returned back home and hadn't got any thing also, a week after that (or 10 days I don't remember exactly), it was for the MDC 2005, so I went there just to meet Patrick Hynds (an instructor in MDC and the regional director of Microsoft Boston), because it was a very long time talking with him and I was looking to meet him (and I think it was the same for him), he asked me about the results and I told him that Iam the only one who hadn't got it till now, he wished me best luck and wished me to receive it before the end of the MDC to be able to make some kind of party :)

But the same bad luck is here, the MDC 2005 had wrapped up, and another week had passed since the MDC had finished with no answer yet, the funniest thing that I had contacted Caroline many times during this period, but with no result also :D:D

After that, I had got an email from Caroline, at first I was hesitated and having some fear from opening it, but I had opened it, and had made a quick scan with my eyes, Congratulation Mohamed, this was the first thing I had seen in the email, after reading it, Oh my god I had been accepted, and not only accepted, but accepted in the SQL Server Engine Core as Software Design Engineer, this was more than I can bear :)

And finally I had got my first dream came true, after that with only one more week, I had received a tons of papers to be signed, which contains every thing, starting from my basic salary there, to my health insurance and every thing about Microsoft it self as a company, my direct manager and every thing (they were so organized as much as you can imagine).

That's all for my journey with the interview itself, soon (as I hope) I'll write about my first day in Microsoft Redmond HQ (and about the visiting for the great Microsoft Museum in the first day as they told me :P )

But this will be another story.

By the way, here you can share the fun looking at the Corporation view and my building (you'll find a map in which I had marked my building on it, it's building number 35):

To be continued........

Wednesday, June 08, 2005

My Experience with Microsoft Interview (Part 2)

Now I'll write the second part with my journey through Microsoft Interview :)

Third interview:

My third interview was somehow more complex than the first two, I had it with a product manager in XML team (I think she was the manager of the XML as a whole), she asked me if I know any thing about SQL Server of course I answered no (Even I knew it well :P ), just to give myself the chance if she asked in any thing in SQL Server in which is don't know, any way, I don't remember the exact interview, but it was about how could I implement the SELECT statement between two tables if I was supposed to implement the SQL Server myself, all what I've is just a pointers to the two tables, she gave me the tables internal data structure, so I gave here an O(n ^ 2) (as usual), she told me she want it to be less than this, I gave here another solution of O(n log n), after that she asked about the O(n) solution and I gave it to her, then she asked me what if I found a duplicated rows, and she needs me to specify a way in which (if needed) will remove the duplications, I gave her the solution, she told me Iam so fine till now, and she still needs one more step, she asked me, if we've the two tables of huge size (lets say more than 1000,000,000 record each), it wont be wise to return the final result of the SELECT statement immediately, so we want a way to give the user the chance to get n results at first and then if he want more he'll get more (to implement the next function if you used SQL Server you'll know it), she asked me to do it in two ways, one way using hashtable and the other without it, I did that of the hash table, then I had given her a solution which is O(n) too without the use of hashtable, she smiled and told me that I had implemented the same technique used inside the last version of the SQL Server itself (it was an algorithm implemented by Microsoft itself and known by X merge sort, where X is some word I don't remember).

After that she told me that she finished interviewing me, and she had left with me to the main room again.

Forth interview:

After that they left us for about 10 minutes, and then came back and told us that 3 of us will leave and the other 2 will stay to some extra interviews and they will tell them the result of the interview after 2 weeks (the clue here, if you left in the middle of the interview, then you had lost your chance to be accepted), after that I had my forth interview, with some giant developer, who was interviewing me about my SDET abilities (SDET means Software Design Engineer in Test), so the question was very simple, Imagine you've 2D system which is just testing whether 2 rectangles are in collision state or not, and you supposed to make a program which takes the code of this system from its developers and test it automatically to see if it's working good or not, and output the percentage of the error in the code, what you'll do?

After making it, he then told me it's ok, fine, but you'll need some test cases to test the code on it, so you must have 2 group of test cases which must be generated automatically too, the first group is that group you know for sure that they collide, and the second one which you know for sure that they are not collide, so how you'll do this?

After telling him the rules for generating the test cases, he asked me what'll I do in the system if I've the time only for making 3 checks, what will be these checks?

I answered him, then he told me right, you got an answer, let's head now again for the main room to see what's next.

Fifth (and final) interview:

After that, it comes for the final interview, in which they had divided them-selves into 2 groups (3 each) and had taken us into an interview which was mainly about why you want to join Microsoft, and how you could imagine the way of working there, do you imagine if you joined you'll assigned a task in your first day or what?, and what if your manager assigned you a task you see it's soo trivial and easy, would you complain and say it's too easy and direct or you'll make it with internal un-satisfied or what?, and what you think the first thing you'll do when you put you feet there, would it be looking for food, or asking about where every thing is located or asking about your colleagues or what?
Many of questions like this, the most two questions I've enjoyed were:

Him: How many lines you could imagine the Visual Studio 2002 is?
Me: you mean the framework or the IDE or what?
Him: No, just the empty IDE, without any compilers, framework, debugger, any thing, just an empty IDE?
Me: how much?
Half a million?
Him (smiling): No, it's about 8,000,000 lines, Iam just telling you this to know how much the word Consistency means in our code, you may write a good and powerful code, but when included in main system will destroy it, and to clear this point for you, how much time could you imagine the line of code is surviving in our systems?

Me: How much?
4 years?

Him: No, it may reach more than 12 years, so it must be written in very good way, consistent, and good commented, and by saying the word comment, how could you think that your comments are good?

Me: mmm, I don't know, I think I should write them in a good way.

Him: and who will tell you that your way is good?

Me: It's easy, I've 2 ways, either to write them in a standardized way, or I should make a dummy function and they write a comment on it using my way, and send it to many developers with me and see if my way is good or not, and by the way, I knew that there must exist a standardized way in Microsoft for its code comments.

Then I left and they told me that I'll receive the results within a period of 2 weeks, and then it comes for the last stage:

The waiting for the results.

After that, I had a very nice time waiting for the ......

To be continued...........

Friday, June 03, 2005

My Experience with Microsoft Interview (Part 1)

Hii again, now I've some time to write my own experience with Microsoft during their interviews in Cairo, Egypt 2005 for SDE/SDET positions.

The whole game had started when I knew (I think I knew about these interviews on July 2004) that Microsoft will come to Egypt to make some interviews for some positions in Redmond campus, so I sent my CV to them along with my teammates CVs, after a short period they had answered me and had asked me about the expected graduation date for us, I told them it'll be after one year, nearly on July 2005, she replied by fine and then I hadn't heard any thing from them for about 4 months.

After this long period they had contacted me, and I knew after that, that the process is done through 4 main steps:

  1. They watch your CV, if it's good with good list, they will jump to the second step, if not they may reply you saying sorry and may not reply at all.
  2. They call you and make an initial phone interview asking you about some very simple things just to know about your way in thinking and try to deduce whether you had just written alot of things in your CV without real knowledge about them or not, usually it takes from 45-60 min, after passing this test, if you passed, you'll jump to the third step, if not, they will call you, and tell you sorry your qualifications don't meet our needs.
  3. HR test, some IQ questions, and some questions to test you way of thinking, and your ability to think for any solutions for some really weird questions and so on, this also takes between 45-60 min, and if you passed you'll jump to the final and main interview (all the above tests were just pre-tests to see whether you can go for the interview or not), also as the same 2 steps, if you passed you'll go to the interview and if not they will tell you sorry, usually no one will pass the second step and fails in the third step unless he was too sleepy or too stupid or no afraid (too afraid mean really toooooo afraid for the extend of not being able to even speak well).
  4. The main interview, it consists of 5-6 interviewers from Microsoft, every one of them will make an interview with you alone for 45-60 min, so it may take up to 6-7 hours (we were soooo tired after this interview), they will ask you alot of questions about many things, testing your ability in programming, writing an efficient algorithms, write programs free of bugs, making program to test others code to see whether it's free of bugs or not, and finally if you passed all these, you'll be setting with them in a good friendly interview and then they will ask you alot of questions about why you want to join Microsoft and what you think you'll do there and such questions.

Now I'll take you through these steps and my results during them.

1- CV: no need for talking about it, it's just CV no more no less, I think it was written in a good way, that's all, and they asked me about my military status and I told them I dont know about it yet, that's all.

2- Technical phone interview: After the 4 months I had told you about, I had got an email asking me for the best time to hold a phone interview with me, after I had replied, and in the day of the interview, I had got an international phone call (with un-able to get the caller ID msg) from a member in the Office team, his name was Mike, he had talked with me in a very friendly way, had talked about himself and his position in the company, then he asked me to open a kind of web whiteboard to begin the small test, it was mainly about sorting algorithms, and in which cases X algorithm will be better than Y, and how could we remove or add a line of code to make X works like Y and so on.

3- HR test, Caroline hadn't asked me to do this test, and I don't know why, and as I know, Iam the only one from those people whom I knew they had made their interview with Microsoft (in this year or in the past) who hadn't taken an IQ test till the end!!!

4- The main interview, the whole game began at 8:00 AM at Conrad Hotel in Cairo, I had went there with my teammates, we had found another two members there whom will have their interview with us(we discovered later that they had chosen only 20 developers for the final interviews, they had grouped them into 4 groups, 5 each, 2 groups per day), so after 10 min, we had seen someone heading to us, ohhh, it's Caroline, Hi Caroline, Hii guys, how are you, we hope you enjoyed your time in Egypt, so we had entered the elevator all, and had gone into their main room, we meet their another 5 members from Microsoft (I don't remember the names) one of them way a program manager in SQL Server, another one was program manager in XML team, the third one was working as SDET(SDET means Software Design Engineer in Test) in SQL Server team, the forth (I don't remember his position too), and the final one was HR(her name is Holly), and Caroline, so they were six members.

The interview had started in this way: we're 5, and the team (excluding Caroline) was 5, so everyone from the team will take one from us to his own room for 1 hour interview, my interview gone in this way:

First Interview:

My first interview gone with the first interviewer with Soner Terek, SQL Server Development Manager, he told me that he used to be a manager in his own company before he joined Microsoft, and that he had been in Microsoft since 11 years ago, had worked in many places like Windows and finally had reached SQL Server, and had asked me why I want to join Microsoft, and so on, after that he had asked me one question, Imagine you have a array of integer, and you want to get any two numbers whose sum is 51, what you'll do?

I asked him, do you want only 2 numbers or all 2 numbers whose combination is 51?

He told me only two in both O(n^2) and O(n) and try to parallize the both solution if we've up to n processors.

After making the whole solution set he told me that I did fine and to go back to the main room.

Second interview:

The second interview was fine, and more easy, I had made it with these one who's working as SDET(SDET means Software Design Engineer in Test) in SQL Server, it was simply about how could I make a code without any known or unknown bug, so he asked me to do 2 simple programs, the first one was a simple dynamic string array class, and had looked much into how could I handle every known and unknown bug (even the buffer over-run error) try to think about cases which can't be happened even you intended to do it, and then asked me to make another program which is handling a problem which I forgot its name (modified Josephus problem), afterthat he told me fine, nice work, let's head back to the main room.

Now I'll write the.......

To Be Continued......

Thursday, June 02, 2005

About Me (Who Am I)

Mmm, of course every blog should contain a page like this, because simply it's talking about its writer.

Any way, My name is Mohamed Meshref (of course you'll know this info if you're from those whom are seeing this page now :P lol ), Iam 21 years old now(my birth date is: 6/16/1984, because I wont edit my age every year :) ), single, currently Iam in Cairo, Egypt (but not for a long time), I was graduated from Computer Science Ain Shams on July/2005, I was working in Ractors (now it's Macrocell) in the past as security oriented software developer, currently Iam working as Game Developer in a company named by N.E.T which is providing ITV solutions, but soon I'll be relocating to Redmond, WA-USA in few months, as I had passed my interviews with Microsoft, SQL Server team and had accepted their offer for SDE(SDET means Software Design Engineer which was actually my first choice when I sent to Microsoft) in SQL Server Engine team (soon I'll post the whole story).

I've a lot of hobbies and interests, I like reading too much, especially in Meta-Physics, Space Exploring, Para-Psychology, like programming too much especially game programming of course, and the most thing I like ever is to drive planes, yes planes, I had read most ground school's lessons, and had got some in-official certificates and some in-official flight hours on Boeing 777 and Air-Bus 340 (of course on training simulators not real one, but on the simulators used to train pilots and give licenses to them :) ).

About the music I love, I like listening to Metal music (Black, death, trash, heavy, psycho, all) and slow, and Symphonic Orchestra, I know they are soo far from each others, but this is the case here :D.

Also, I like watching action movies, movies with scientifical background, fantasy, and romantic, Horror, and adventure.

Mmm, what else?
I love people, love being here in this life too much, and...... mmm
Don't know, this is enough: D
I'll left now to sleeepppppppp, it's 6:45 AM

Wednesday, June 01, 2005

1,2,3 mmm, it's ok

Just try to post any thing till I find some time, soon I'll write about who Am I, and my interview with Microsoft team and every thing :).