Tag Archives: PHP

Software Engineering Interview with Google

1st Interview


It was 27th April 2011 I was just checking out my linkedin profile,  I noticed someone viewed my profile from Google Engineering Recruiter. I got the person email address and just sent my CV to the person. After that immediately the person replied and ask some questions about skills. We exchanged emails regarding my skills several time.


Then she was pleased with my skills and asked for available time for phone interview. We agreed on 5th May 2011 for the interview. The interview was friendly and I was really amazed from her friendly behavior. It was about 30 minutes interview just to check out if I am ready for a technical interview with a Software Engineer or with the team they are looking for.


Interview topics was related to the pure Computer Science Subjects. It includes Memory Management, Database, Registers of the Processors, Assembly Language, Number Conversions, Algorithms etc. If you are planning for the interview or you are scheduled for one just review those subjects. It’s not an interview to how to code it’s more core subjects of Computer Science. My interview was fare( my point of view). After this interview I received an email on 12th May 2011 stated that “We carefully reviewed your background and experience, and though we do not have a position that is a strong match with your qualifications at this time, we will be keeping your resume active in our system.”… 😛 . But honestly that was a great experience and for the first time I felt that I am giving an interview… 🙂


That was the end of my interview process. I was happy that at least they took a phone interview while I left C/C++ coding almost for more than 4 years ago.


2nd Interview


On 20th June I received an email from another recruiter stating that he saw in their database I chatted with a recruiter on May but my CV is good enough to fit for the post so he want me to give another chance for telephone interview. We exchanged some emails regarding the location I would like to relocate. I choosed Australia. Then he contacted Google office Australia for vacancy and forwarded my email there.


From Australia Google office a Software Engineer contacted me and scheduled a technical telephone interview on 7th July 2011. I was excited that time that they contacted second time and it’s now technical interview with a Software Engineer. There communication and behavior was so friendly that they were helping me whatever they can.


The recruiter sent me the resource for the preparation of the interview that amazed me most. They really want to hire people and they are doing that often. So he sent me the following preparation tools. I think there was no agreement with me about sharing this resources and it’s public. Just sharing with you if you really want to prepare yourself for the interview with Google.


The phone interview is designed to test your CS fundamentals (Big-O notation, coding, algorithms, etc.). I have included some tips and hints about the process below.

* Our interview style may differ from what you’ve experienced elsewhere, and tends to be highly technical. The interviewer will be interested in the specifics of your past projects, implementations and how you arrived at your conclusions. Interview may cover data structures and algorithms (i.e. Big-O Notation). You will be asked to write code.

* Many of the questions asked in Google interviews are open-ended because our engineers are looking to see how you engage the problem. Be sure to talk through your thought process about the questions you are asked, as well as your approach to problems and solutions. Ask specific questions if you need more clarification.

* Think about ways to improve the solution you’ll present. In many cases, the first answer that springs to mind may need some refining. It is worthwhile to talk about your initial thoughts to a question. A brute force explanation will be received less well than taking time to compose a more efficient solution.

Interviewing at Google
Google Products
Google Labs
The Official Google Blog: Baby steps to a new job by Gretta Cook (Google Engineer)
How to Get Hired by Dan Kegel (Google Engineer)
How to get a job at Google, interview questions, hiring process (Google Engineer)
Five Essential Phone Screen Questions by Steve Yegge (Google Engineer)
Types of algorithm questions Google asks (more C++ focused):Top Coder Tutorials
Industry News:Search Engine Land

(#2 was highly recommended by several engineers and quite representative of the types of coding questions asked)

1. Review of Basic Algorithms: Introduction to the Design and Analysis of Algorithms by Anany Levitin
2. Types of coding questions Google asks:  Programming Interviews Exposed; Secrets to Landing Your Next Job (Programmer to Programmer) by John Mongan, Noah Suojanen, and Eric Giguere

Software Engineers:

-construct / traverse data structures
-implement system routines
-distill large data sets to single values
-transform one data set to another

Algorithm Design / Analysis
-big-O analysis
-sorting and hashing, searching
-handling obscenely large amounts of data
-also see topics listed under ‘Coding’

System Design
-feature sets
-class hierarchies
-designing a system under certain constraints
-simplicity and robustness

Open-Ended Discussions
-biggest challenge faced
-best / worst designs seen
-performance analysis and optimization
-ideas for improving existing Google products


As I was lazy I didn’t prepare for the interview.

On the scheduled day Software Engineer called me on my cell and they sent a link of Google Doc online where I can code. He was like a friend. He introduced himself that he is currently working on Google+ project. First he just asked me some basic questions what I do and what I am working on currently. Then he gave me some problems and asked me to solve that problems using any programming language. As I am now programing in PHP so I code it in PHP and he helped me lot for making the code perfect. It was almost 1 hour interview. I didn’t faced any problem on the interview. Solved all the problems perfectly.

After that interview I received an email on 18th July 2011 same email like before that I am not currently fit for the position….:P

I just shared it with you that it’s not a big deal to apply in Google for Software Engineering position. If you are a graduate of CS or CSE then you can apply. Doesn’t matter you have experience or not. Just apply. Even if you are not planning to work with them at least face the interview it’s a good experience. Google interview was the only interview I felt that I am giving an interview… 🙂


How to apply at Google (my experience)

First just look for an Google Engineering recruiter in linkedin or facebook send him/her the CV with a proper cover letter.

And prepare yourself for the interview by covering the topics they mentioned to me. Very simple as like that.

You are failure al ready why you want to miss the chance of success. There is nothing to loose… 😉

Job Sites of Saudi / Gulf / Middle East

Some people posting or asking for jobs. And some or most of us don’t know where to search job in Saudi. So that’s why I tried to share some popular job site links in saudi. If you know more sites please try to write it in comments. I will put it here.

1. http://www.expatriates.com // Good for quick reply and quick job

2. http://www.bayt.com/en/saudi-arabia // One of the most popular job site for Middle East

3. http://mihnati.com

4. http://www.naukrigulf.com/

5. http://www.gulftalent.com/home/index.php

Searching for a job you need patience and confidence. Go to google and search for job in saudi in your field. You might find the company list of your field in Saudi. Take their email address or contact info then post your CV there. If they have a vacancy they will call you. Keep posting your
CV until you got a call. If you got a small offer go for it and gain some experience. If you have good experience and you didn’t changed your track inshallah you will get a good job offer. Best of luck.

N.B. I got all my jobs only by Google search. Without any circular or any job sites. I just posted my CV to the email address.

Flash(AS2) + PHP + MySql

Last couple of month was working on Flash. Became familiar with Flash and started loving it… 🙂 Then a project came they
asked for making CMS for their flash site. You can see the site http://www.zfp.com

And the game started… 🙂

Started learning AS2 and loadvars. Faced lots of difficulties and finally manged to communicate with Flash(AS2) + PHP + Mysql.
In this post I will try to give basic idea to communicate Flash(AS2) and PHP.

1. Flash(AS2)

lv_th = new LoadVars();

lv_th.onData = function(varText:String)


 temp = varText.split('@@');

 photo= temp[0].split('|');

 photo_title = temp[1].split('|');

 photo_description = temp[2].split('|');



1. PHP+MySql

$gal_id = $_GET['gallery_id'];
$sql = "SELECT * FROM gallery WHERE gal_id=$gal_id ORDER BY gal_id";
$result = mysql_query($sql) or die(mysql_error());
$photo = array();
$photo_title = array();
$photo_description = array();

while($rows = mysql_fetch_object($result))
    $photo[]             = $rows->photo;
    $photo_title[]       = $rows->title;
    $photo_description[] = $rows->description;

print implode('|',$photo) . '@@' . implode('|',$photo_title) . '@@' .

First one is flash AS2 Code to get the data from php. It first create a new instance LoadVars();

then onload called the photo_gallery.php?gallery_id=5 and wait for the response to come.

In php we made the query based on the gallery_id and get the data and put it in three separate

array. then we implode each array values with ‘|’ and separate each array with ‘@@’.

In flash after getting the data as a string in varText variable we split it by ‘@@’ to separate the

different array values and after that separte it in ‘|’ to get each value. Now we have all the data

in photo, photo_title and photo_description array. Use the array values as you want…. 🙂

Note: In the data there should not be ‘@@’ or ‘|’. If it contains then you have to choose the separator carefully. Choose a separator which is not come as data.

Have fun with flash + php + MySql….. 😉

Became ZCE

I am very happy to see my name listed under Bangladesh In Zend Yellow page of ZCE. I passed the exam in first chance. Thanks to Allah and to all previous ZCE of my country. I get inspired mostly from them either by talking with them or by reading their blogs. And of course thanks goes to my class mates and friends. One of my friend is also ZCE (Mahmud Ahsan).

I bought the Zend Exam Voucher on 3rd February 2009. But for so many reasons I was unable to attend the exam and the most big reason is my laziness…:) I rescheduled the exam may be for 50 times but as my laziness comes up so I couldn’t give the exam. 3rd February 2010 is the last date of the exam and if I unable to attend the exam it will expire. So I was in a pressure to give the exam and I attend the exam on 2nd February before one day of expiry Alhamdulillah passed the exam. Now let me share with you what I did to prepare myself. But it may work with you or may not. The way of thinking of the entire human is not the same. So follow what you feel better way to prepare yourself.

First of all as all the ZCE’s will suggest you the same thing to read the
Zend Certification Guide and Use the test exam.

1.  Finish one topic from the Zend Certification Guide and search it in php.net
for details. Quote or write the things which you can use as just quick review. Do it
for all the topics of 1 Chapter and pin it. After that go to the Second Chapter follow
the same thing and review the first chapter at the same time so you won’t forget
the thing. After finishing 12th Chapter you will have 12 clips in your hand for quick review.

2.  Now you will see some of the sub topics of the 12 topics listed in Zend Site which is not
there in Zend Certification Guide. So now you have to go for Google search or php.net to learn those
things and write quotes in your note.

3. After finishing all those things now check out if you missed any subtopics. If you saw that everything is done then fix your mind to give a mock test. But 5 mock tests from zend site and give one test. After that you will realize the type of questions and lake of your knowledge in a chapter. Go now study those chapters again if you got grade pass or fail. After finishing give a second mock test. If you got excellent in all the chapter now you are ready to face the real exam. Schedule the real exam and go for it.

Rather than this you can check the following resource which I followed parallelly.

Some sample Questions Link ( I don’t know this is legal or not. If it’s illigal plz let me know so i will remove the link)
Link 1
Link 2

Review of 12 Chapter Other ZCE’s Blog
Read The Web

The Paul Paul Reinheimer Review Guide is also very useful

Download Link

Check out Frank ZCE Preparation. It also helped me lot.

Frank Blog

Download Frank Hand Note

I cant share anything else as I agreed with zend not to share. But believe me if you
are a PHP programmer for 6 month or 1 years it wont take you more then 12 days
for 12 chapter I mean for zend preparation. Thank you. Best of luck….:)

JeddahGeeks First meetup(Nov,09)

Some of my Jeddah friends Arranged a group called JeddahGeeks. Where Web developer, designer and entrepreneurs can share their knowledge, thoughts and experience. So we can learn something and gain some knowledge from some real geeks. In Our first meet up(13th November) I give a small speech on “How to Become a PHP Geek?”. I am inspired by the event of PHPExperts Seminar of Bangladesh. The presentation of Emran Hasan Brother on How Becoming a kick-ass PHP ninja gave me more inspiration to make this presentation. You can see the presentation below. As this is my first presentation any criticize and suggestion will be appreciated.

FirePHP with FireBug

Last Couple of months I was using Firebugs ad-dons of Fire Fox.  It helped me lot to debug my css. It’s simply great help for me. Today I came to know about new ad-dons FirePHP which can be used with FireBug. You can debug your php code in your browser. It sounds cool. You don’t have to use print_r or var_dump to debug your php code and massed up your site by dumping your array.

It’s great to use it like same as firebug. Hope it will be useful for php programmers.

To use FirePHP you need the following thigs

After installing those three you should download the FirePHPCore from http://www.firephp.org/HQ/Install.htm.


Let’s assume your document root is /www/ and it is in your PHP include path.

Step 1 Locate the server library

Locate the /lib/FirePHPCore folder in the FirePHPCore archive and move it into your document root.


You can skip this step if you are using PEAR. Make sure the PEAR repository is in your include path.

Step 2 Include the server library

Create a file at /www/Index.php and open it in your editor.


Step 3 Start output buffering


Now That’s it. It’s now time to play. Your first Log Message

$firephp = FirePHP::getInstance(true);

$var = array('i'=>10, 'j'=>20);

$firephp->log($var, 'Iterators');

FirePHP Official Site:  http://www.firephp.org

The Site I got the information: http://sixrevisions.com/web-development/how-to-debug-php-using-firefox-with-firephp/

get image width and height using PHP

Sometime we have to get the uploaded image name from database. But we don’t know the image width and height. Width and height may be variable. But we want to know the actual width and height of an image. We can use getimagesize() PHP function to get the width and height of an image.

array getimagesize ( string $filename [, array &$imageinfo ] )

This function returns an array of 7 elements. Index 0 and 1 contains respectively the width and the height of the image.



$image_Name = ‘ekram.jpg’;

list($width, $height) = getimagesize($image_Name);

echo “<img src=’$image_Name’ width=’$width’ height=’$height’ />”;


Redirect visitors to new Page

Sometime we need to redirect a visitor to another webpage. There is so many solution to redirect a user. I will show some of them which I know.



<title>Html Redirect Page</title>
<meta http-equiv=”REFRESH” content=”5; url=http://www.mydomain.com”>
</ head >
You will be redirect within 5 seconds..


<meta http-equiv=”REFRESH” content=”5; url=http://www.mydomain.com”>

// This is the part which is redirecting the current page to www.mydomain.com

content=”5; // This means it will wait 5 second and then redirect. you can increase and decrease this number.



header(“Location: index.php“);

// You have to call this line before any output.



<SCRIPT language=”JavaScript1.1″>
Redirect to main Page

In some server non of above work as redirection. I don’t know why. But the following code work well. Does
anyone know why?

header(“Pragma: public”);
header(“Expires: 0”);
header(“Cache-Control: must-revalidate, post-check=0, pre-check=0”);
header (“Location: http://www.mydomain.com/”.time());

Preventing Duplicate Record Insertion on Page Refresh

Most of beginners (including me) face these problems inserting data into database.

When clicking submit button after filluping a form if you refresh the form it will insert the duplicate data. There are two solutions that I know from Google search. May be you can find more by Google search.

And since you cannot avoid a refresh of the screen…

<form action=”insert.php” method=”POST”>
<input type=”text” name=”name”>
<input type=”text” name=”telephone”>
<input type=”text” name=”email”>
<input type=”sumbit” name=”submit”>

1) If you are doing a form post, you might consider sending a location
header AFTER you inserted the record:

// after inserting the data
header(“Location: thanks.php“);
// do not forget the exit, since your script will run on without it.

In that way your script will process the posting, and then redirects the
browser to thanks.php. This page will contain a message (Thank You). A reload of thanks.php will not result in a fresh db insert.

2) If you’re using sessions, generate serial and supply it as hidden field with
every posting form. Increase it at every post and decline to store data if
serial in the _POST isn’t equal to the one stored in _SESSION.

Combining it with redirects (always good to have such protection), you’ll
probably never got the duplicated submits.