life ideas

December 6, 2009

Connecting to the internet through recovery mode

Filed under: ubuntu — manoftoday @ 7:31 am

Never mind, I logged on to an Ubuntu chat room and the people there did a great job helping me out. Just in case anyone else needs this done and has no clue how to do it, here is a step-by-step. (Some steps might not be needed or there might be a much easier or better way to to this. This worked for me though)
Step 1: EDIT /etc/network/interfaces
type "sudo nano /etc/network/interfaces" and enter password
There should be two line that say "auto lo" and beneath it "iface lo inet loopback". Now beneath these lines write:
auto <interface>
iface <interface> inet dhcp
wireless-essid <network name>
wireless-key <network key>
When I say <interface> it is the interface for your wireless connection, something like eth0 (mine was eth1). <network name> is the name of the network you’re connecting to and <network key> is the password for that network.
Now I’m not sure which of the next two steps are necessary or not, but I used both (in this order) and it worked for me.
Step 2:
type "sudo ifup <interface>"
Step 3:
type "iwconfig <interface>"
Then my internet was working.

November 11, 2009

Android knowledge

Filed under: android — manoftoday @ 5:58 am







February 20, 2008

my trip

Filed under: Uncategorized — manoftoday @ 4:51 am

SAN JOSE, CA 95129
TEL 408-248-1088
FAX 408-248-1338

ohter travel agent’s number#415.362.4280, her name is Virginia.

Recommend more agents
++ I bought several tickets from Jeniffer at 510-657-3836, ?????, before. Most of the time she can offer good-priced tickets.
++ Try Pamela at Grandview Travel, (415) 434-9290.
++ (Faith Zhang got two recommendations) Faith Zhang Intellife Travel Inc. 4800 Great America Pkwy Suite 222 Santa Clara, CA 95054 tel: 408-980-5188 fax: 408-980-0688

November 20, 2007

behavior questions

Filed under: Uncategorized — manoftoday @ 7:12 pm

General Questions

1. Tell me about yourself.

The most often asked question in interviews. You need to have a short statement prepared in your mind. Be careful that it does not sound rehearsed. Limit it to work-related items unless instructed otherwise. Talk about things you have done and jobs you have held that relate to the position you are interviewing for. Start with the item farthest back and work up to the present.

Start with the present and tell why you are well qualified for the position. Remember that the key to all successful interviewing is to match your qualifications to what the interviewer is looking for. In other words you must sell what the buyer is buying. This is the single most important strategy in job hunting.

So, before you answer this or any question it’s imperative that you try to uncover your interviewer’s greatest need, want, problem or goal.

To do so, make you take these two steps:

1. Do all the homework you can before the interview to uncover this person’s wants and needs (not the generalized needs of the industry or company)

2. As early as you can in the interview, ask for a more complete description of what the position entails. You might say: “I have a number of accomplishments I’d like to tell you about, but I want to make best use of our time together and talk directly to your needs. To help me do, that, could you tell me more about the most important priorities of this position? All I know is what I (heard from the recruiter, read in the classified ad, etc.)”

Then, ALWAYS follow-up with a second and possibly, third question, to draw out his needs even more. Surprisingly, it’s usually this second or third question that unearths what the interviewer is most looking for.

You might ask simply, “And in addition to that?…” or, “Is there anything else you see as essential to success in this position?

This process will not feel easy or natural at first, because it is easier simply to answer questions, but only if you uncover the employer’s wants and needs will your answers make the most sense. Practice asking these key questions before giving your answers, the process will feel more natural and you will be light years ahead of the other job candidates you’re competing with.

After uncovering what the employer is looking for, describe why the needs of this job bear striking parallels to tasks you’ve succeeded at before. Be sure to illustrate with specific examples of your responsibilities and especially your achievements, all of which are geared to present yourself as a perfect match for the needs he has just described.

My background to date has been centered on preparing myself to become the very best financial consultant I can become. Let me tell you specifically how I’ve prepared myself. I am an undergraduate student in finance and accounting at _________ University. My past experiences have been in retail and higher education. Both aspects have prepared me well for this career。

3. Did you bring your resume?

Yes. Be prepared with two or three extra copies. Do not offer them unless you’re asked for one.

4. What is your long-range objective?

The key is to focus on your achievable objectives and what you are doing to reach those objectives.

Then go on to show by your examples what you are doing to reach your goals and objectives.

Although it’s certainly difficult to predict things far into the future, I know what direction I want to develop toward. Within five years, I would like to become the very best develper your company has. I would like to become the expert that others rely upon. And in doing so, I feel I will be fully prepared to take on any greater responsibilities that might be presented in the long term.

5. Are you a team player? (Describe what would be an ideal working environment?)

Team work is the key.

Yes, I’m very much a team player. In fact, I’ve had opportunities in my work, school to develop my skills as a team player. For example, on a recent project, I workded with my classmates. We often discussed the issues together, solved the problemes together. I love the way of learning new staff with classmates, because I found I can know more by changing opion with other classmates. That is a really good way to learn new knowledge. And also I love the feeling to work together, happy and easy. I found it is more efficient to finish the project before deadline and also can do more than what can be done by a single person. . .”

Emphasize teamwork behavioral examples and focus on your openness to diversity of backgrounds. Talk about the strength of the team above the individual. And note that this question may be used as a lead in to questions around how you handle conflict within a team, so be prepared.

You are, of course, a team player. Be sure to have examples ready. Specifics that show you often perform for the good of the team rather than for yourself is good evidence of your team attitude. Do not brag; just say it in a matter-of-fact tone? This is a key point.

6. What is your greatest weakness?

Talk about a true weakness and show what you are doing to overcome it.

I would say my greatest weakness has been my lack of proper planning in the past. I would overcommit myself with too many variant tasks, then not be able to fully accomplish each as I would like. However, since I’ve come to recognize that weakness, I’ve taken steps to correct it. For example, I now carry a planning calendar in my pocket so that I can plan all of my appointments and “to do” items. Here, let me show you how I have this week planned out…

I have had trouble in the past with planning and prioritization. However, I’m now taking steps to correct this. I just started using a pocket planner . . .” then show them your planner and how you are using it.

To make sure this question doesn’t trip you up, here are possible strategies that you — as an interviewee — can use to frame an effective response. Remember that context is as important as content. Whenever you cite a weakness, be sure to remind employers of your strengths. Be honest about your shortcomings, but never cite anything that might genuinely interfere with your ability to do the available job — and do it well. The key is to present your weaknesses in a way that demonstrates your real strengths and character.

Strategy 1: Cite a weakness that, under the right circumstances, can prove to be an asset.

Conventional wisdom suggests that you respond by stating a weakness that really could be perceived as a positive, such as: “I’m a workaholic. I spend a lot of time at work making sure that I do my job right.”

As you can probably guess, employers usually see right through this type of response because it’s both dishonest and self-serving. A better answer is to mention something that may be perceived as a weakness but, in the proper context, constitutes a genuine strength. For example, empathy — the ability to identify with and understand another person’s feelings — is a good quality when trying to understand an enemy. But an empathic manager may be viewed erroneously as “weak” or “soft.” A candidate who offers empathy as a perceived weakness (but knows its strength) can then cite a time when he or she used empathy to gain competitive intelligence.

The “strength as weakness” strategy works well if you: show the value of using the particular trait in a given context; demonstrate that you know how and when to use it most effectively; and explain how you might be able to use it to help your future employer.

Saying, for instance, that you’re a perfectionist would work if you can cite times when this trait is strength instead of a weakness. An example might be when proofreading or editing, since perfectionism can guarantee error-proof copy. On the other hand, a perfectionist chief executive officer might micromanage his top managers and paralyze the organization. Knowing the requirements of the job and the organizational culture can help you decide whether a potential employer will view your perceived weakness as a potential strength.

Although there’s a performance element to interviewing, you aren’t an actor who needs to perform for an audience. You’re engaged in a conversation designed to determine whether you can work together effectively. Towards that end, you can do your part to make the interviewer more of an active participant than a passive observer and critic of your performance.

In the end, it isn’t your mistakes and weaknesses that matter most, it’s whether you’re aware of your weakness, understand its potential impact on others and are willing to work to improve yourself. Your ability to handle this question confidently and effectively can send a powerful message to potential employers about your real strengths.

7. What is your greatest strength?

Numerous answers are good, just stay positive. A few good examples: Your ability to prioritize, Your problem-solving skills, Your ability to work under pressure, Your ability to focus on projects, Your professional expertise, Your leadership skills, Your positive attitude.

You know that your key strategy is to first uncover your interviewer’s greatest wants and needs before you answer questions. And from Question 1, you know how to do this.

Prior to any interview, you should have a list mentally prepared of your greatest strengths. You should also have, a specific example or two, which illustrates each strength, an example chosen from your most recent and most impressive achievements.

You should, have this list of your greatest strengths and corresponding examples from your achievements so well committed to memory that you can recite them cold after being shaken awake at 2:30AM.

Then, once you uncover your interviewer’s greatest wants and needs, you can choose those achievements from your list that best match up.

As a general guideline, the 10 most desirable traits that all employers love to see in their employees are:

1. A proven track record as an achiever…especially if your achievements match up with the employer’s greatest wants and needs. (handmap project)

2. Intelligence…management “savvy”.

3. Honesty…integrity…a decent human being.

4. Good fit with corporate culture…someone to feel comfortable with…a team player who meshes well with interviewer’s team.

5. Likeability…positive attitude…sense of humor.

6. Good communication skills.

7. Dedication…willingness to walk the extra mile to achieve excellence.

8. Definiteness of purpose…clear goals.

9. Enthusiasm…high level of motivation.

10. Confident…healthy…a leader.

8. If you had to live your life over again, what one thing would you change?

Focus on a key turning point in your life or missed opportunity. Yet also tie it forward to what you are doing to still seek to make that change.

For example: “Although I’m overall very happy with where I’m at in my life, the one aspect I likely would have changed would be focusing earlier on my chosen career. I had a great internship this past year and look forward to more experience in the field. I simply wish I would have focused here earlier. For example, I learned on my recent internship…” …then provide examples.

Stay focused on positive direction in your life and back it up with examples.

9. How did you prepare for this interview?

When I found this position posted on the internet ( I was  immediately interested. I checked out the company website and mission statement, looked at the bios of company founders and executives, and was impressed. Once I had the interview appointment, I talked with friends and acquaintances in the industry. And, I’m sure I’ll find out a lot more in today’s meetings.”

10. What kinds of people do you have difficulties working with?

In my last three jobs I have worked with men and women from very diverse backgrounds and cultures. The only time I had difficulty was with people who were dishonest about work issues. I worked with one woman who was taking credit for work that her team accomplished.  I had an opportunity to talk with her one day and explained how she was affecting the morale. She became very upset that others saw her that way, and said she was unaware of her behavior or the reactions of others. Her behavior changed after our talk. What I learned from that experience is that sometimes what we perceive about others is not always the case if we check it out.

11. How do you handle conflict?

How would you evaluate your ability to deal with conflict?

On the job, there are many possible sources of conflict. Conflicts with: fellow employees management rules, procedures clients, customers demands of work vs. personal life, family The best way to approach a good answer is to look at if from the employers point of view—they want to be your first priority and they want you to solve problems (not bring them any). “I know everything cannot run smoothly at work all the time. When there is a conflict I usually try to determine the source of the problem and see if it can be solved. This might involve other members of the work team discussing the problem and offering possible solutions. I would then try to pick the solution which appears to have the best outcome and put it into action.” A natural follow-up to this would be: Tell me when you solved a conflict at work. So, have a brief example… a short story… to illustrate your approach. Even if not asked, you can offer your story! If it proves your point and accentuates a skill needed for the position, go with it.

I believe I am quite good at handling conflict. Working in retail and in the residence halls required that I make many unpopular decisions at times, whether it was terminating an associate or taking judicial action on a resident. Often the person in conflict with me would be upset and sometimes physically outraged. I would always make sure that I fully explained the situation, the policies behind my decision, and why those policies exist. Usually by the end of the conversation, the person could see the other side of the situation.

12. How do you handle rejection?

Rejection is part of business. People don’t always buy what you sell. The tick here is to separate rejection of your product from rejection of yourself: “I see rejection as an opportunity. I learn from it. When a customer takes a pass, I ask him what we could do to the product, price or service to make it possible for him to say yes. Don’t get me wrong: You’ve got to makes sales. But rejection is valuable, too. It’s a good teacher.”

13. Tell me about a time when you tried and failed?

Has this ever happened to you? No one expects perfection actually; employers are more interested in your ability to cope, to learn from mistakes, and to deal with others who are less than perfect. If you have an example, certainly pick one that happened a while back, was not earth shattering in the results, and one which you learned and applied this knowledge recently. This is a version of ‘damning with faint praise’ by picking an incident that was minor in scope but, since you are so wise and are always willing to learn, has taught you a valuable lesson.

14. What are some of the things you find difficult to do?

The interviewer is looking to determine how well you know yourself, how you react to difficult situations/tasks and credibility. Look back over your work experience for examples of challenges… speaking in public at a meeting, disagreeing with a manager over an important issue, being asked to use a software program you have not had an opportunity to learn… These ’stories’ should illustrate a lesson learned, a problem overcome or a weakness being dealt with. “I always seem to need a day or two to prepare myself to give a presentation to department heads. When I know I have to give a report on my projects, I plan out all the details in advance and rehearse. One time, there was a problem with a supplier and I was asked to update senior management… immediately. The supply chain was crucial to the completion of an important project we had been working on for 5 months and decisions had to be made based on the information I had to prepare and present on a moment’s notice. I gathered the information and presented it simply and in detail. It was much easier than I thought without the hours of concern and practice. The facts spoke for themselves. Since I understood the situation, I was able to make it clear to management and get a rapid decision. I still prefer advance notice but I know I can deliver when asked to.”

15. What are your short and long term goals?

No one can make goals for you. It comes down to where you are in your professional life and what you want to do. Most people have 5-6 careers in their working lifetime—some with 2 careers going at the same time (like us). The best advice is to be certain to relate your answers to the organization that interviews you. Do not make a point of having goals that cannot be realized there (”I want to work in Paris.” Organization is strictly domestic.) If you do your research into the organization, and into what you truly want to do in the future, you will be able to come up with reasonable responses. No one is going to come back to you in five years and chastise you for not meeting these goals! You will not be held to them… it is only an interview and they are interested in how you see yourself (and they want to see you in the job.)

My primary objectives are to learn as much as possible about your company’s product offering, organizational structure, and professional sales techniques so that I may become the most productive member of your sales team.

What are your short-term goals?

Many executives in a position to hire you are strong believers in goal-setting. (It’s one of the reasons they’ve achieved so much.) They like to hire in kind.

If you’re vague about your career and personal goals, it could be a big turnoff to many people you will encounter in your job search.

Be ready to discuss your goals for each major area of your life: career, personal development and learning, family, physical (health), community service, and (if your interviewer is clearly a religious person) you could very briefly and generally allude to your spiritual goals (showing you are a well-balanced individual with your values in the right order).

Be prepared to describe each goal in terms of specific milestones you wish to accomplish along the way, time periods you’re allotting.

My short-term objectives are to graduate from the Professional Development Program before the standard two years and begin developing a clientele. As an intern, I prepared ahead of time by studying for the Series 7 and Series 64 exams that constitute a majority of a beginning financial consultant’s time. I’d like to make the company that hires me wonder what it ever did without me.

16. Where do you see yourself in five years?

This is the interviewer trying to see how you are in making long range plans and if you have goals that mesh with the organizations. One way to answer this question is to look back on your accomplishments to date: “I started out in my profession as a junior clerk while I completed my college studies during the evenings. Once I had my degree, I applied for a transfer to a more advanced position, citing my on-the-job training. This has been my pattern for my career with my past 2 employers. I learn quickly on the job and am willing to take classes and workshops to augment my experience. I have been able to assume greater responsibilities and add more value to the organization. I do not think in terms of titles… I think more in terms of “How can I solve this problem? Since this has been my career style to date, I do not imagine it to change. In five years, I feel I will have continued to learn, to grow into a position of more responsibility and will have made a significant contribution to the organization.”

Although it is hard to predict the future, I sincerely believe that I will become a very good financial consultant. I believe that my abilities will allow me to excel to the point that I can seek other opportunities as a portfolio manager (the next step) and possibly even higher. My ultimate goal continues to be — and will always be — to be the best at whatever level I am working at within Merrill Lynch’s corporate structure.

17. Where do you want to become ten years from now?

Ten years from now I see myself as a successful consultant for a world-class firm like yours. I want to have developed a wonderful bond with my employer I will have proven myself a highly competent systems analyst and will represent my company in helping others find solutions to their information-systems needs in a professional and timely manner.

18. Would you rather work with information or with people?

I like the validity of information and also like the energy that comes with working with people. The best thing about working in a group is combining the great minds from different perspectives and coming up with something extremely great, compared with when you’re working alone. At the same time, information can generate vitality in the project you’re working on. No matter how many heads you’ve got together, without information, you can’t go very far. The perfect situation would be a combination of working with information and people, and I’m confident of my abilities in both areas.

19. Do you have the qualifications and personal characteristics necessary for success in your chosen career?

I believe I have a combination of qualities to be successful in this career. First, I have a strong interest, backed by a solid, well-rounded, state-of-the-art education, especially in a career that is technically oriented. This basic ingredient, backed by love of learning, problem-solving skills, well-rounded interests, determination to succeed and excel, strong communication skills, and the ability to work hard, are the most important qualities that will help me succeed in this career. To succeed, you also need a natural curiosity about how systems work — the kind of curiosity I demonstrated when I upgraded my two computers recently. Technology is constantly changing, so you must a fast learner just to keep up or you will be overwhelmed. All of these traits combine to create a solid team member in the ever-changing field of information systems. I am convinced that I possess these characteristics and am ready to be a successful team member for your firm.

20. What are your weak points?

Don’t say you have one, but give one that is really a “positive in disguise.” I am sometimes impatient and do to much work myself when we are working against tight deadlines.” Or “I compliment and praise my staff, but feel I can improve.”

Education Questions

21. What personal weakness has caused you the greatest difficulty in school or on the job?

My greatest weakness had been delegation. I would take it upon myself to do many small projects throughout my shift as a manager that could have been done by others in an attempt to improve my workers’ efficiency. Once I realized that I was doing more work than the other assistant managers, and they were achieving better results, I reevaluated what I was doing. I quickly realized that if I assigned each person just one small project at the beginning of their shift, clearly state expectations for the project, and then follow up that everything would get done, and I could manage much more efficiently and actually accomplish much more.

22. How has your education prepared you for your career?

This is a broad question and you need to focus on the behavioral examples in your educational background which specifically align to the required competencies for the career.

An example: “My education has focused on not only the learning the fundamentals, but also on the practical application of the information learned within those classes. For example, I played a lead role in a class project where we gathered and analyzed best practice data from this industry. Let me tell you more about the results . . .”

Focus on behavioral examples supporting the key competencies for the career. Then ask if they would like to hear more examples.

As you will note on my resume, I’ve taken not only the required core classes in the _____ field, I’ve also gone above and beyond. I’ve taken every class the college has to offer in the field and also completed an independent study project specifically in this area. But it’s not just taking the classes to gain academic knowledge I’ve taken each class, both inside and outside of my major, with this profession in mind. So when we’re studying _____ in  _____, I’ve viewed it from the perspective of _____. In addition, I’ve always tried to keep a practical view of how the information would apply to my job. Not just theory, but how it would actually apply. My capstone course project in my final semester involved developing a real-world model of _____, which is very similar to what might be used within your company…

23. Have you ever had a conflict with a boss or professor? How was it resolved?

Note that if you say no, most interviewers will keep drilling deeper to find a conflict. The key is how you behaviorally reacted to conflict and what you did to resolve it.

For example: “Yes, I have had conflicts in the past. Never major ones, but there have been disagreements that needed to be resolved. I’ve found that when conflict occurs, it helps to fully understand the other person’s perspective, so I take time to listen to their point of view, and then I seek to work out a collaborative solution. For example . . .”

Focus your answer on the behavioral process for resolving the conflict and working collaboratively.

24. If I were to ask your professors to describe you, what would they say?

This is a threat of reference check question. Do not wait for the interview to know the answer. Ask any prior bosses or professors in advance. And if they’re willing to provide a positive reference, ask them for a letter of recommendation.

Then you can answer the question like this:

“I believe she would say I’m a very energetic person, that I’m results oriented and one of the best people she has ever worked with. Actually, I know she would say that, because those are her very words. May I show you her letter of recommendation?”

So be prepared in advance with your letters of recommendation.

25. Tell me about a time when you had to plan and coordinate a project from start to finish.

I headed up a project which involved customer service personnel and technicians. I organized a meeting to get everyone together to brainstorm and get his or her input. From this meeting I drew up a plan, taking the best of the ideas. I organized teams, balancing the mixture of technical and non-technical people. We had a deadline to meet, so I did periodic checks with the teams. After three weeks, we were exceeding expectations, and were able to begin implementation of the plan. It was a great team effort, and a big success. I was commended by management for my leadership, but I was most proud of the team spirit and cooperation which it took to pull it off.

26. Describe a situation where others you were working with on a project disagreed with your ideas. What did you do?

I was on a project team in a business class in my freshman year in college, the group brainstormed ideas for the video we were assigned to produce, and everyone but me was leaning toward an idea that would be easy. I suggested instead an idea that would be more difficult but would be something different that no other group would be doing. I used my communications skills to persuade the rest of the group to use my idea. During the project, we really learned what teamwork was all about, became a close team, and ended up putting a lot of hard work into the project. All the team members ended up feeling very proud of the video, and they thanked me for the idea — for which we earned an A.

27. Why did you choose to attend your college?

My college has always had a reputation as having an excellent accounting department, so I knew that if I enrolled there, I would achieve first-class preparation for my chosen career field. It is also a highly accredited school known for satisfying employers with the preparation of its graduates — that’s why companies like yours recruit at my school — the school produces top graduates. The school offers an excellent liberal-arts background, which research shows equips graduates with numerous qualities, such as versatility and strong critical-thinking skills. Finally, having visited the campus before enrolling, I knew that the business school emphasized group projects. During my four years in the school, I participated in more than 35 group projects, which taught me invaluable teamwork, communication, and interpersonal skills.

28. What changes would you make at your college?

My major department had a wonderful internship program, and I was able to complete three valuable internships with my department’s guidance. Some other departments in the business school don’t have internship programs that are as strong as my department’s. I’d like to see all the departments have strong internship programs so all my school’s business grads would have the same opportunities that I had.

29. How will the academic program and coursework you’ve taken benefit your career?

As you will note on my resume, I’ve taken not only the required core classes for the finance field, I’ve also gone above and beyond by double majoring in accounting. I doubled majored since I knew that the financial consulting field requires much knowledge of portfolio analysis and understanding of the tax laws. I believe that my success in both areas of study have specifically prepared me for this area. But it’s not just taking the classes in these two areas that allow me to offer Merrill Lynch clients more. I minored in Spanish to understand the growing Hispanic clientele in the Central Florida area, which as you are well aware, is a growing source of revenue for the industry. If you like, I can elaborate on other aspects of my education further.

30. What were your favorite classes? Why?

My favorite classes have been the ones pertaining to my major, which is marketing. These classes have laid the groundwork for my career in marketing. They have also taught me skills that I can bring to my employer, ranging from communication skills to interacting with others.

31. Do you enjoy doing independent research? (Are you the type of student for whom conducting independent research has been a positive experience?)

Yes, I love it. I thoroughly enjoyed my senior research in college while many others in my class were miserable. I was never tired of learning more about my topic and found it exhilarating to be researching something that had not been studied before.

32. Who were your favorite professors? Why? (Describe the type of professor that has created the most beneficial learning experience for you.)

My favorite professors were the ones who gave me hands-on learning experiences that I can apply to my career. Any person can make you memorize the quadratic equation, but someone who can show you how to use it, and why, were the professors I liked. I liked teachers who realized that sometimes there is more then one answer and everyone thinks differently.

33. Why is your GPA not higher? (Do you think that your grades are an indication of your academic achievement?)

I have focused much of my energy on work and obtaining real-world experience. I commend my classmates who have earned high GPAs, but I also feel it’s important to be well-rounded. In addition to work experience, I participated in sports and extracurricular activities in school. These activities taught me leadership, communication, and teamwork skills. Sometimes my heavy load has not allowed me to keep up with some of my studies, but I have learned an enormous amount that I can apply in my future industry. As you will discover if you talk to my supervisors, my ability to work effectively is much more reflective of my future potential than is my GPA.

34. Do you have any plans for further education? (What plans do you have for continued study? An advanced degree? )

I plan to continue my education for the rest of my life. In any technology-related field, keeping up to date through continuing education is of the utmost importance. Continuing education can include on-the-job training, courses sponsored by the employer, and courses taken in new technologies as they emerge. I plan to be not only a career employee but a career student so that I can be the best information systems analyst I can be. I will ensure, however, that any education I pursue not only doesn’t interfere with my job or the company’s policies, but will enhance my value as an employee.

35. Give an example of how you applied knowledge from previous coursework to a project in another class.

Last semester I was taking a microeconomics and a statistics course. One of the microeconomics projects dealt with showing the relationship between the probabilities that customers would stop buying a product if the price was raised a certain amount. Through what I learned in statistics I could find the median where the price was the highest and still kept most of the customers happy.

34. Describe a situation in which you found that your results were not up to your professor’s or supervisor’s expectations. What happened? What action did you take?

Recently I was asked to put together a proposal for a migration of network systems. Misunderstanding my boss, I thought it was just an informal paper. When I presented it to him days later, he was upset with the quality since it had to be presented to our VP. I explained my misunderstanding, apologized, reworked the paper, and had it back to him with enough time for him to review it before he presented it successfully at the meeting.

Job Related Questions

36. What do you know about our organization?

Research the target company before the interview. Basic research is the only way to prepare for this question. Do your homework, and you’ll score big on this question. Talk about products, services, history and people, especially any friends that work there. “But I would love to know more, particularly from your point of view. Do we have time to cover that now?

This question is one reason to do some research on the organization before the interview. Find out where they have been and where they are going. What are the current issues and who are the major players?

37. What experience do you have?

Try to cite experience relevant to the company’s concerns. Also, try answering these questions with a question: “Are you looking for overall experience or experience in some specific area of special interest to you?” Let the interviewer’s response guide your answer.

What experience do you have in this field? Speak about specifics that relate to the position you are applying for. If you do not have specific experience, get as close as you can.

I think I have my current job because of my experiences abroad. Those experiences gave me greater self-confidence and a greater understanding of myself, which led to my willingness to uproot myself and try new work in a new location.”

38. According to your definition of success, how successful have you been so far?

Be prepared to define success, and then respond (consistent record of responsibility)

You should always answer yes and briefly explain why. A good explanation is that you have set goals, and you have met some and are on track to achieve the others.

39. How has your college experience prepared you for a business career?

Emphasize your best and favorite subjects. If grades were average, talk about leadership or jobs you took to finance your education. Talk about extra-curricular activities (clubs, sports, volunteer work)

I have prepared myself to transition into the the work force through real-world experience involving travel abroad, internship, and entrepreneurial opportunities. While interning with a private organization in Ecuador, I developed a 15-page marketing plan composed in Spanish that recommended more effective ways the company could promote its services. I also traveled abroad on two other occasions in which I researched the indigenous culture of the Mayan Indians in Todos Santos, Guatemala, and participate din a total language immersion program in Costa Rica. As you can see from my academic, extracurricular, and experiential background, I have unconditionally committed myself to success as a marketing professional

40. What do you look for in a job?

Flip this one over. Despite the question, the employer isn’t really interested in what you are looking for. He’s interested in what he is looking for. Address his interests, rather than yours. Use words like “contribute,” “enhance,” “improve,” and “team environment.” Fit your answer to their needs Relate your preferences and satisfiers/dissatisfiers to the job opening.

41. How long would you stay with us?

“As long as I feel that I’m contributing, and that my contribution is recognized. I’m looking to make a long term commitment.”

Specifics here are not good. Something like this should work: I’d like it to be a long time. Or As long as we both feel I’m doing a good job.

42. What kinds of people do you find difficult to work with?

Use this question as a chance to show that you are a team player: “The only people I have trouble with are those who aren’t team players, who just don’t perform, who complain constantly, and who fail to respond to any efforts to motivate them.” The interviewer is expecting a response focused on personality and personal dislikes. Surprise her by delivering an answer that reflects company values.

43. Why do you want to work for us?

You feel you can help achieve the companies’ objectives, especially in the short run. You like what you’ve learned about the company, its policies, goals and management: “I’ve researched the company and people tell me it’s a good place to work.”

This may take some thought and certainly, should be based on the research you have done on the organization. Sincerity is extremely important here and will easily be sensed. Relate it to your long-term career goals.

44. Describe some situations in which you have worked under pressure or met deadlines?

Refer to accomplishments. Everyone has had a few of these pressure situations in a career. Behavior-related questions aim at assessing a candidate’s character, attitude, and personality traits by asking for an account of how the candidate handled certain challenging situations. Plan for such questions by making a list of the desirable traits relevant to the needs of the industry or prospective employer and by preparing some job-related stories about your experience that demonstrate a range of those traits and habits of conduct. Before answering the questions, listen carefully and ask any clarifying questions you think necessary. Tell your story and conclude by explaining what you intended your story to illustrate. Finally, ask for feedback: “Does this tell you what you need to know?”

You may say that you thrive under certain types of pressure. Give an example that relates to the type of position applied for.

45. Why haven’t you found a new position before now?

“Finding the right job takes time. I’m not looking for just any job.”

46. How much do you expect if we offer this position to you?

Be careful. If you don’t know the market value, return the question by saying that you would expect a fair salary based on the job responsibilities, your experience and skills and the market value of the job. Express your interest in the job because it fits your career goals – Receptive to a reasonable and competitive offer – don’t talk $’s. It’s always best to put off discussing salary and let PPR Career handle that. ANSWER: I’m open to a competitive offer. I’d prefer to discuss the opportunity and allow my recruiter to handle any salary questions.

47. Tell me about your dream job

Stay away from a specific job. You cannot win. If you say the job you are contending for is it, you strain credibility. If you say another job is it, you plant the suspicion that you will be dissatisfied with this position if hired. The best is to stay genetic and say something like: A job where I love the work, like the people, can contribute and can’t wait to get to work.

48. How do you propose to compensate for your lack of experience?

First, if you have experience that the interviewer does not know about, bring that up: Then, point out (if true) that you are a hard working quick learner.

49. Why should I hire you?

The easy answer is that you are the best person for the job. And don’t be afraid to say so. But then back it up with what specifically differentiates you.

For example: “You should hire me because I’m the best person for the job. I realize that there are likely other candidates who also have the ability to do this job. Yet I bring an additional quality that makes me the best person for the job–my passion for excellence. I am passionately committed to producing truly world class results. For example . . .”

Are you the best person for the job? Show it by your passionate examples.

This may sound suspicious, negative, or just plain harsh. Actually, it’s a call for help. The employer wants you to help him/her hire you. Keep your response brief. Recap any job requirements the interviewer may have mentioned earlier in the interview, then, point by point, match your skills, abilities and qualifications to those items. Relate a past experience which represents success in achieving objectives which may be similar to those of the prospective employer.

I sincerely believe that I’m the best person for the job. I realize that there are many other college students who have the ability to do this job. I also have that ability. But I also bring an additional quality that makes me the very best person for the job — my attitude for excellence. Not just giving lip service to excellence, but putting every part of myself into achieving it. In college and at my previous jobs, I have consistently reached for becoming the very best I can become. I think my leadership awards from my college, and my management positions are the result of possessing the qualities you’re looking for in an employee.

50. What qualities do you feel a successful manager should have?

Focus on two words: leadership and vision.

Here is a sample of how to respond: “The key quality in a successful manager should be leadership–the ability to be the visionary for the people who are working under them. The person who can set the course and direction for subordinates. The highest calling of a true leader is inspiring others to reach the highest of their abilities. I’d like to tell you about a person whom I consider to be a true leader . . .”

Then give an example of someone who has touched your life and how their impact has helped in your personal development.

A successful manager should have the vision and capabilities to formulate strategies to reach his or her objectives and communicate these ideas to his or her team members. In addition to serving as a positive role model for co-workers, successful managers must also be capable of inspiring others to recognize, develop, and apply their talents to their utmost potential to reach a common goal. These are the traits I hope to demonstrate when I’m a manager.

51. What is your most important accomplishment to date?

It is important when answering this question to focus on an accomplishmentthat highlights the skills needed to be successful in the specific position youare applying for. For instance, when interviewing for an investment researchassociate or assistant position it is important to mention an accomplishment that required keen quantitative skills, problem solving ability and success asa team member. Be sure when answering this question that you providetangible and measurable results to your accomplishment.

52. Why did you choose this career?

I chose medicine because I loved science. Even when I was very young, I was completely enamored with doctors–how they cared about other people, especially people who were sick and hurting. Anesthesiology has allowed me to combine my interests and continues to keep me challenged.

My past experiences have shown me that I enjoy facing and overcoming the challenge of making a sale. Without a doubt, once I have practiced my presentation and prepared myself for objections, I feel very confident approaching people I don’t know and convincing them that they need my product. Lastly, I like sales because my potential for success is limited only by how much of myself I dedicate toward my goal. If any profession is founded on self-determinism, it surely must be sales.

53. What is your salary expectation for this job?

I’ll need more information about the job and the responsibilities involved before we can begin to discuss salary. Can you give me an idea of the range budgeted for this position?”

54. How do you keep current and informed about your job and the industries that you have worked in?

Pride myself on my ability to stay on top of what is happening in my industry. I do a lot of reading – the business section of the newspapers and magazines. I belong to a couple of professional organizations and network with colleagues at the meetings. I take classes and seminars whenever they are of interest, or offer new information or technology.

Try to include improvement activities that relate to the job. A wide variety of activities can be mentioned as positive self-improvement. Have some good ones handy to mention.

55. When have you been most satisfied in your career?

The job before the one I am currently at was my most rewarding experience for me. I worked in a wonderful team environment. There was a lot of camaraderie. I worked with a team of four people and we did some really original thinking. It is that kind of environment I want to be involved in again.

56. Why do you want this job?

I’ve been very careful about the companies where I have applied. When I saw the ad for this position, I knew I found what I was looking for. What I can bring to this job is my seven years of experience, and knowledge of the industry, plus my ability to communicate and build customer relationships. That, along with my flexibility and organizational skills, makes me a perfect match for this position. I see some challenges ahead of me here, and that’s what I thrive on. I have what you need, and you have what I want.

I am convinced that there would be no better place to work than Accenture. You are the top consulting firm in the United States. You provide your employees with the tools they need to stay competitive and sharpen their skills while working in an open, team-based environment. I am also aware that you provide a mentor for all new employees, and I would embrace any opportunity to work with a mentor and eventually become one myself.

57. Describe a challenging work issue you had to face, and how you dealt with it?

Consider what would be the requirements of the ‘new’ job/organization and find something in your past that highlights a skill, experience or situation that might occur or be needed going forward. It is always a good idea to make lists in preparation for interviews: New job will need I can provide Proof/example For your proofs, list (for yourself) examples of when you used the skill, exhibited the characteristic or handled the problem. This will not only give you ’short stories’ to relate in an interview, it will also bolster your confidence and target your job search.

58. In what way do you think you can contribute to our company?

Preparing to answer this question requires a 2-step preparation: assessing your skills and researching the needs of the company. An integral part of skill assessment (looking at your own experience, education and talents) is to ’skill-match’. Considering the job opening, what are the skills needed? Make a list of the requisite skills (in priority order) and then list concrete examples of your possession of the skill. For example: a sales representative would need good interpersonal skills, the ability to deal with difficult people. For ‘proof’ of this skill, you could list experiences and examples of how you were successful in a difficult situation. These matched skills are your key selling points. Next, what appears to be the current problems at the organization, based upon your research? What are their needs that you can meet? In other words, given the specifics of the company, what value can you add? After these two steps, you are in a great position to come up with concrete examples of what you can offer the company. This question, by the way, is just another version of “Why should we hire you?”. In the interview, when asked this question, you could respond with: “In my experience in sales, I know having the ability to deal effectively with all types of people is not merely a positive element — it is an essential one. With your plans to expand into ____ market, a sales representative with a proven ability to meet with all types of people and to be able to assess and meet their immediate needs would be a great asset. In the past __ years, I have increased sales __… ..”

59. Tell me a story.

Many interviewers like to hear ’stories’ or examples from your work life. So pick something that is more usual than not (not the day of a plant explosion and you saved 10 lives!) but a story that shows how you handle yourself, handle difficult people or situations. Can you think on your feet? Do you adhere to the rules? Consider the type of organization you are aiming at… each has its own culture. The World Wrestling Federation entertainment culture is different than the American Bible Society and also different from Gear your stories to give the listener a feeling that you could fit in… you could do the job here.

60. Tell us about your analytical skills.

This should be easy if you have done a realistic skill inventory for yourself, listing what skills you do have and how you can offer proof of this skill (where you learned it, last used it). Working off your inventory, focus on various analytical skills and match them to the skills you feel are most important for the job you are considering. You can now give specific examples of skills you can offer. (Do not neglect skills obtained in extracurricular activities, such as volunteer work.)

61. What can you add to what we have already asked you that should make us want to hire you?

Think grocery shopping… all those brands in the soap aisle begging for your attention. Each one comes with its own key selling points. Remember the comics, Superman? On TV, he sold himself… stronger than a locomotive, faster than a speeding bullet, able to leap tall buildings in a single bound. What are your key selling points? Plan this out ahead of time for the next interview… or include in a thank you letter for this past interview. Think a 1 minute infomercial about yourself. What are your core strengths? Is it communicating with children, being a mentor to other teachers, being able to keep topics current and interesting… . Think of what is needed to be successful in the job and how you specifically meet those needs—provide examples. Increased reading scores by using… Math scores jumped __% due to my … Offer some proof from your past to support your claims. But it is your ability to assess the situation and analyze your potential contributions that will sell your candidacy. Do not think it too late — send a strong thank you and include in your request for the job the key reasons why you are the best candidate.

62. What does “customer service” mean to you?

Think of yourself as a customer — what do you expect from salespeople … regardless of the circumstances and/or the problem. An example may be “Customer service is a two-piece reaction. First—respect; second — problem solving.” See if that makes sense and if you sound convincing when you do practice it. If you can give a brief story or two of what you have witnessed as extraordinary examples of customer service behavior. By using yourself as a focal point you will be able to enunciate clearly your understanding of customer service.

63. What do you know about our company?

If you can relate your knowledge to the area that you would be involved in, it would show that already you have an active interest in the organization. For example, if you were interested in marketing, “I understand that you are one of the top 10 companies in sales to Europe but are currently interested in expanding your market into Asia. Competition is keen in that area but you have an advantage in that you product offers features that others do not, such as… ..” It is not only showing that you have done the research but also that you like/know what you have learned about the company and have applied it to how you can add value in the position.

You’re large and respected worldwide. You’re both a clinical and teaching hospital. Over the last 60 to 70 years you’ve produced award-winning research. In reviewing your Web site, I’ve familiarized myself with many of your corporate goals and objectives.

64. What do you wish to gain from our company?

Excellent question! Research is the answer (know everyone is tired of hearing this but we feel this is one great way for applicants to make a difference in their candidacy). Determine some of the key elements in the corporate structure, product base, employees/management team or recent history. What appeals to you about working at this company? Go with what you know. “In the past, I have had opportunities to work on new products being launched. I am very excited about your plans to start an entire new line of products. With my prior experience I know I can provide insights and make contributions immediately and I will also learn so much from the excellent team you have in place. Having done single products, I would love to be in on the give-and-take meetings planning the new line… there is much I can offer but also much for me to learn.” Finding something specific… the opportunity to use a new technology, a new skill, to work with ‘experts on their team”… are ways for you to find job satisfaction, which is another way of asking this question

65. What do you think the employee’s responsibilities are to the company?

As an employee you have several responsibilities to your employer. They are as follows: to perform a good day’s work to be loyal to act as part of the team to value the relationship to earn the employer’s trust to grow with a passion for the product/service.

66. What motivates you?

Other than looking into your past experiences….Times when you were motivated and times when you were not… no one but you has this answer. Find concrete examples when you had to pull it all together and get motivated to get the job done; what does it for you?

This is a personal trait that only you can say, but good examples are: Challenge, Achievement, and Recognition

You would think that because I am interested in sales, only financial compensation would motivate me to achieve. Although monetary rewards are important to me, I am driven to succeed internally. More than anything, I want to be respected by my friends and coworkers for being the best at what I do. Whether I am considered to be the best car detailer in my hometown or the best columnist for my college newspaper, I want to be recognized as the best.

67. What things make a good team member?

Consider first the situational context of the question. What is the team environment of the organization that you are interviewing—do they have a strong, organized team-based work environment or is it based on informal authority and fluctuating teams? Ideally, you should have had an opportunity to research and ask some questions about the organization to determine how they operate (and if indeed you want to work in that environment.) Model your responses to the organization. Obviously, you are describing yourself = good team member. My ideas of what makes a good team member may be very different from yours—and from the organization. Also depends on where you are in the team—new member, leader, support. How do you see yourself? How do you make yourself fit into a new team? How do you elicit cooperation from other team members? What do you think the organization’s biggest problem is relative to teams and team-building? And, what solution could you provide?

68. Why do you feel we should hire you for this position?

Before you submit a resume or draft a cover letter and certainly before you go to an interview you should do 2 things: Research the job and the organization. What do they need? What are the requirements for the position? What role does this job play in the overall goals of the organization? Research yourself. What skills and experiences and interests can you offer? How will you add value to the organization? How can you prove that you have the required skills and experience needed for the job? Do a skill matching exercise: The organization/job needs… (skill/experience) and I have it because I did ….. The organization needs….. And i can provide….. Be certain to have specific examples of how you have added value in the past and be enthusiastic on how you can add value to this organization. Do not forget… the organization is looking to solve a problem and you are selling yourself as a solution.

69. What do you expect your starting salary to be?

Discussions of salaries and compensation should not be held until an offer is made. With that said, let’s look into the real world when this is not the case most of the time. Employers are shopping, trying to guess your price tag. This is one of those screening questions used to either screen in or screen out… so a response is important. Have you done your homework? What is the price for this job in the marketplace? Have you checked out classified ads or online ads for similar positions? Are you within the range, given your level of experience? Pegging yourself mentally to the right price is the first step. Second step is sharing this information correctly. Do you have enough information about this new job to determine your salary? If not… state it and ask for the information that is needed. “Before I can discuss salary, I would like to know the reporting requirements and how many people I would be supervising. In addition, what are the skill levels and experience of my staff?” You can also ask “What are others in similar positions being paid?” When you can no longer stall or seek additional information… “Based on what you have told me and exclusive of other compensation elements I feel that the position would warrant a salary range of $_______ to $___________” Name a range such as $40,000 to $45,000 to give both sides some wiggle room and allow for some give-and-take when benefits and other compensation is considered. If you know what you are willing to accept as salary and what the market pays, using a salary range should permit you to be negotiable.

70. When did you decide on this career?

I decided to pursue this career while studying art during my freshman and sophomore years in college. The decision to focus on design came naturally as I took as many of the fine arts and graphics course electives that the schedule would allow; I really did not have to think about it, it just happened. I was always interested in art, and found myself much more suited for the “structure” of graphic design versus the fine arts courses I was taking. I always admired magazines and catalogs for their layout even before I knew much about the profession of graphic design. Though I enjoy fine arts very much, I found graphic design to be the perfect fit for my half left brain, half right brain personality!

71. What goals do you have in your career?

Think in terms of short term goals and long term goals. What do you want to accomplish in the short term of 3 to 5 years? What do you want to achieve in that short time span? Same information applies for your long term career goals. Why did you chose the profession you chose – interest, pay, benefits — what do you see yourself doing in the long term goal of 10 to 20 years. Brainstorm your ideas and write them down. Set realistic goals and not far fetched. Not everyone can be a president or CEO of a company. Set high enough standards you think you can achieve. Any goal worth achieving is the sacrifices you made to get there.

72. How do you plan to achieve these goals? (What specific goals have you established for your career?)

Remember, all goal setting must be immediatly followed by massive and consistent action toward its fullfillment. In most cases, setting the goal alone doesn’t make it happen, I learned that from experience.

Good question. I’ll try to offer some of the aspects I consider when setting goals for myself…I mean there are some questions that you should ask yourself in formulating your goals, such as:

– What do I want? (This is usually best stated in the positive. Goals like “I don’t know any more of the same old crap.” tend to not be that useful.

– Where am I now in relation to that?

– What specifically do I want and how will I know when I have it? (Be specific in describing what you want. What will you see, feel, and hear when you have accomplished your goal. Who will you be with? Where will you be? Also make sure that this goal is dis-associated…I’ll explain that in a minute if it’s not clear).

– Is it consistent with my values and other goals? (Sometimes people make goals like, I want to be a coporate executive in a Fortune 500 company AND be home for dinner by 6 o’clock everyday to spend time with my family. Not saying it couldn’t happen, but you might want to outline how specifically you plan to accomplish it).

– Is accomplishing this goal something I can control? (Who else has to be involved? Are you doing this for yourself or because of other people?)

– What resources will you need to accomplish the goal? (Do you need money, time, more friends, and special contacts in foreign governments?)

– For what purpose do I want this? Some corrolaries to the last question are: – How else could I get this same thing? – What will happen if I do get my goal? – What will happen if I don’t get my goal? – What won’t happen if I do get my goal? – What won’t happen if I don’t get my goal?

Okay so there are some questions that are helpful in exploring goals and deciding on what goals are appropriate and how they will integrate together with other goals into your life. The important thing for me is to program these into my future using “Time Lines”. For me I tend to see the future as a line that shoots off to my right at a 45 degree angle and when I look there I see the future, the things that WILL happen. And this is quite a different place than where I seem to keep my hopes…See the things that I keep as hopes are the things I’d like to see happen but have never quite put in the right place to make it all happen.

Do you see why it’s important to distinguish between hopes and your future? Too many people make goals and then say “Gosh I sure hope that happens” and quicker than you can blink all the representations of their goal have been tossed right into that pile of hopes…and maybe with incredible luck it will happen, but only because of luck. So I would recommend taking a little inventory by imagining your future, where are you keeping track of what you know will happen, the things you are absolutely committed to? And where are you keeping your hopes/wish-it-would-happens? When you make pictures of these things where do you seem them? Are there differences in focus, clarity, location? Are there sounds associated with one class and not the other? What are the differences in the feelings you get with each?

Now decide how important your goal is and make sure that when you imagine that goal that you mentally sort it into the right place so it’s just like the things you know will happen. And make sure that you are “dis-associated” from your goal, that means that you can see it in the future but aren’t actually experiencing it right now.

There are people who habitually fail to achieve there goals for one simple reason, and that is this. They imagine a really great goal and then they imagine how great it will feel when they accomplish their goal. Then they step into those great feelings, experience them now, and then think, “Gosh that was great, and since I’ve already had all the pleasure of accomplishing the goal, I guess I should think about something else.” So when I say stay disassociated, I mean keep the feelings out there, make sure your goal is compelling but make sure that you don’t allow yourself to feel the rewards until you’ve actually got the whole thing. It will help propel you into the future that you’ve built.

My goals include becoming a Certified Financial Advisor so I can obtain a better working knowledge of financial research analysis, which would allow me contribute to my client base as a better financial consultant since I would have that extra insight into the companies they are seeking to invest in. Also this is the foundation block to advancing my career to portfolio manager or even branch office manager.

73. How do you personally define success?

Success: In a career, being good at something you love and believing that your expertise helps other people. Being aware that hard works AND luck (or blessings — choose your own words) play a part in any success, being grateful rather than smug.

In life: Doing your best at your work and in dealing with your family and friends (not necessarily in that order), but taking time for a few pet projects or dreams of your own. Devoting all of your time to any one endeavor (be it work, play or raising a family) can never make you successful, just boring and bored.

Last semester I was hired by by university’s Council for Student Activities. The group negotiates contracts of entertainers, sets up sound equipment, markets the entertainers to students, and generally decides what kind of programming should be done. When I got hired, I didn’t know the first thing about how fill any of those responsibilities. I decided, however, that I wasn’t going to fail. Four months later, I have become the Webmaster for the group. I also write our campus newsletter and created Game Night, a student competition of table games. That event yielded the biggest audience ever for a non-concert event.

74. What will it take to attain your goals, and what steps have you taken toward attaining them?

I’ve already done some research on other workers at Merrill Lynch to see how they achieved similar goals. I know that Merrill Lynch encourages the pursuit and will reimburse for tuition of a graduate degree. I plan on pursuing a MBA to give me an even more extensive knowledge of business and financial analysis.

75. Describe a situation in which you were successful.

76. What do you think it takes to be successful in this career?

I believe successful salespeople put forth that extra effort that turns potential clients into first-time customers. Salespeople who attend to the details by doing whatever it takes to win over a prospective customer distinguish themselves from the countless others who don’t go to any extra effort. Second, I think that if you label success as an attainable goal, you will never consistently remain successful. You can only succeed if you learn all there is to learn about your product, your competitors, and personal selling. Since this learning process is continuous, it’s an unattainable goal. With good reason, salespeople should not consider success an attainable ending point but an objective that will always linger slightly beyond their reach.

77. What accomplishments have given you the most satisfaction in your life?

78. How would you describe yourself in terms of your ability to work as a member of a team?

I have had many opportunities in both athletics and academics to develop my skills as a team player. My tenure as a rower with my college’s crew team serves as a good example. I learned a great deal about teamwork while rowing because all the rowers in the boat must act as one, which meant that we incessantly worked to keep each movement in the boat synchronized. On an individual basis, we still worked toward group goals through weightlifting and land-rowing. My experience as a marketing research team leader also helped me to learn the role of “team player.” I viewed my position as that of group leader and of group member. I ensured that everyone in the group had equal opportunity to contribute, maintained excellent communication among group members, and coordinated their energies toward reaching our team’s goal.

79. Are you a goal-oriented person?

80. Tell me about some of your recent goals and what you did to achieve them. (Give me an example of an important goal which you had set in the past and tell me about your success in reaching it.)

As a senior in high school, my goal was to attend college and play college golf. But I was nowhere near the player I needed to be to play or even get on the team. So over that summer I worked on my golf game to the point where I won almost every tournament I entered. I spent every hour I had during the day to make myself a better all-around player. I eventually walked on my freshmen year and was exempted from qualifying because I played so well in my first outing.

81. What major problem have you had to deal with recently?

82. Do you handle pressure well?

83. How much training do you think you’ll need to become a productive employee?

My background has been focused on preparing me for the financial consulting industry, so I can be productive right away. I already have obtained the educational credentials and skills to allow me to become an immediate asset to Merrill Lynch. After interning for a semester, I am well aware of the shared beliefs of the organization and its corporate values. I already have a very good working knowledge of the financial consulting business. I am confident of my ability to get up to speed quickly in any assignment with which I’m not familiar.

84. Why do you want to work in the _____ industry?

85. Are you willing to travel? How much?

I am more than willing to travel. I understand the importance of going above and beyond the call of duty to satisfy customer requests is sometimes required and that Merrill Lynch’s customer focus belief means that travel is expected in some circumstances. I am willing to make this commitment to do whatever it takes to develop that long-term relationship with a small business or client. It is only through this relationship that loyalty can be maintained and financial gains and growth can occur for both the client and Merrill Lynch. It is my understanding from other financial consultants that I have interviewed at Merrill Lynch that this occurs maybe one or two times a month.

86. Is money important to you? (Which is more important to you, the job itself or your salary?)

A salary commensurate with my experience and skills is important, but it’s only one piece of the package. Many other elements go into making up a compensation package, but more importantly, it’s critical to me to enjoy what I’m doing, fit into the corporate culture, and feel I’m making a genuine contribution.

87. How much money do you need to make to be happy? (What level of compensation would it take to make you happy?)

I am not depending on money to make me happy. What makes me happy is having a satisfying job that provides challenge and new situations daily.

88. Tell of a time when you worked with a colleague who was not completing his or her share of the work. Who, if anyone, did you tell or talk to about it? Did the manager take any steps to correct your colleague? Did you agree or disagree with the manager’s actions?

During a group project in college, we had one member who would do no work whatsoever. The project was to compare and contrast four companies in a single industry, so his work was vital. We first discussed the situation and asked for the bare-bones minimum of what we needed from him. We got just below that. As a result we as a group went to the professor and told her our situation — not expecting or requesting action — just informing her the situation we were dealing with. Then we as a group split up the non-contributor’s work, and completed our work collectively on his share. In phase two in which we analyzed the information and reported how each of our companies fared compared to the others, we did not get a paper from the group member. As a result, we told the teacher that we had our work done, and were willing to do the extra paper but that we would rather spend time polishing our own work, and not picking up slack. She agreed and said to focus on the three companies we had compiled the most info on while not entirely neglecting the fourth. The papers came out very well, but were understandably weak when comparing the fourth company. The professor understood, and we received the grades we deserved. I was pleased with our teamwork and the way we handled the situation.

89. Describe a situation in which you had to arrive at a compromise or guide others to a compromise.

My first semester in college, I was a political-science major. My introductory government class professor had a differing political view then I. We disagreed on everything, and many classes were filled with criticizing each others’ view. However, on one test I answered a question with the view I believe in, and she marked it wrong. So I asked her how an opinion can be wrong, and she said because her opinion is the way she taught it in class. I pointed out that my answer showed I understood the concepts of the question. She agreed, and I also agreed not be so combative in answers on tests. Compromise is the key to problem resolution.

90. What steps do you follow to study a problem before making a decision?

Following standard models for problem-solving and decision-making can be very helpful. Here are the steps and how they helped me solve a problem with a group project:

  1. Define the problem to be solved and decision to be made. For a project in an introductory management class the assignment was to report on the corporate structure and financial situation of a couple of companies. The decision to be made was what companies to profile and how to present the information.
  2. Gather the necessary information. Some group members wanted to report on automakers, while others wanted to do electronics firms. We gathered information on both types of company.
  3. List all possible choices. We made lists of companies in both categories.
  4. Consider possible outcomes for each choice. We decided that a report about car companies could have a positive outcome, but one about electronics firms might be more futuristic with high-tech products such as HDTV, video game consoles, and DVD players.
  5. Check out how you feel about each of the choices. Given that this was a group project, we had to consider the feelings of all group members.
  6. Relate the choices to your values and priorities. Again, all group members weighed in on their values and priorities.
  7. From the possible alternatives, choose one. We decided that we’d do electronics companies because we could bring in products from each company and show what lies ahead.
  8. Commit yourself to your chosen decision and disregard the others. Concentrate your energies in one direction. Once we made our decision, we focused all our work on electronics forms.
  9. Take steps to turn your decision into positive action. All group members got interested in how the companies were doing.
  10. Evaluate your progress from time to time. Change your decision if necessary. We were pleased with our progress and didn’t feel a need to change our decision. We got an A on the project.

Sample Questions for You to Ask

What is it you saw in my background that made you want to speak with me?

What qualifications would the ideal person for this job have?

What is the biggest challenge facing the person you hire for this position?

What are the three most important things you would expect me to accomplish in my first 30/60/90 days on the job? -And/or-

What is the first priority of the person who is hired for this position?

What are the reporting relationships for this position?

What are the biggest challenges facing your company in the next few years?

How would you characterize the corporate culture here?

When will the job performance evaluation take place? -And/or-

How are performances reviews handled here?

What do you like best about working for this company? -And/or-

What’s the most frustrating thing about working for this company? -Similarly-

If you could make one constructive suggestion to top management, what would it be? -Or-

What areas does the company need to focus on to become more competitive?

When you look at people who have been successful here, what tend to be their strengths? Conversely, when people don’t work out, are there any common themes as to why?

How would you describe a typical day on the job? -Or-

What are the daily duties and work of an intern?

What are the overlying goals of the program?

How much discretion is I allowed and expected to exercise?

What do you look for in applicants?

What continuing education and supervision is provided?

In what directions do you see your organization going in the near future?

What are some current challenges here?

What do you like most about your work here?

What makes a successful employee in your organization?

How would I be evaluated?

What’s a normal work week like?

Is there other information I can provide you?

When will your hiring decisions and offers be made?

What are the specific duties required?

Please tell me about your experiences with this organization.

November 19, 2007

SIP protocol indepth analysis

Filed under: Uncategorized — manoftoday @ 6:57 pm

Source: Tech Invite — SIP Dialog and Routing of Requests

[call-id, transaction,dialog,call-leg]

one transaction : same branches stack in Via; (INVITE,100,180,200) ACK is out of scope of the INVITE transaction of normal setup.

  • (1)If the request is INVITE
  • the final response is a 2xx response, The ACK is a separate transaction;
  • the final response is a non-2xx, the transaction also includes an ACK to the response;
  • (2) otherwise, Transaction comprises all messages from the first request sent from the client to the server up to a final (non-1xx) response sent from the server to the client;

one call-leg: end-to-end, may contains many transactions; The CSeq spaces in the two directions of a call leg are independent.

one dialog/call: from, to, cal-id, to be exact, it should be the combination of the To tag, From tag, and Call-ID . the tag is a pseudo-random sequence inserted by the SIP application. It works as an identifier of the caller in the dialog. A dialog used to be referred as a ‘call leg’.


The Call-ID is an identifier, carried in the SIP messages, that refers to the call. It is a globally unique identifier of the call generated as the combination of a pseudo-random string and the softphone’s IP address.

A call may contain several dialogs. we can say a cal is a session.

Since a phone call (i.e. an SIP dialog) consists of several transactions, and SER (an open source Proxy) does not keep information about transactions throughout a particular phone call, the consequence is that SER does not know that a call is on-going, nor can SER calculate the length of an ended or active call. Neither can SER terminate a phone call. However, SER can store the times at which an INVITE (or ACK) and a BYE message are received and record this info together with the Call-Id. A billing application can then match the INVITE with the BYE and calculate the lengths of calls

The tags and the Call-Id field are generated by endpoint SIP phones and are maintained by them constantly during the phone conversation. Tag parameters are random strings, while Call-Id is generated by a combination of a random string and the originating phone’s host name or IP address. The combination of the To tag, From tag, and Call-ID completely defines a peer-to-peer SIP relationship between two SIP phones and is referred to as a dialog [rfc3261, p.12].

[via fields]

Within the scope of one transaction SIP requests and all replies follow the same signalling path. It is ensured by a stack of Via fields.

When processing SIP request messages each intermediary proxy adds its own Via field on top of the stack of Via header fields. Each Via field contains the IP address of the proxy and a branch parameter identifying the transaction (i.e. all messages in the transaction have the same branch parameter).

The replies are transmitted by the destination UA with the same stack of Via fields as they received by UA in the request message (recall that the stack of Via fields is summed up on the way from the originating UA to the destination UA). The top most Via field of reply message dictates the next hop where the message should be transmitted (i.e. the last proxy of the request before it arrived to UA). At each hop the proxy server removes its own Via field from the top and forwards the message according to the top most Via field of the reduced stack.



However, the proxies can request to maintain the signalling path during the dialog. Record-Route header is designed for these purposes. A stack of Record-Route headers works similarly as the stack of Via headers but is a little bit more complex. (1)Each proxy server (wishing to stay in the signalling path) adds on top of the Record-Route headers stack its IP address (or its domain name). (2)Record-Route headers are usually added by proxies only in the first request of the first transaction (i.e. in the INVITE message).

When processing the first request of the first transaction, each intermediary proxy adds its own Record-Route field on top of the stack of Record-Route header fields.when the destination UA receives a stack of Record-Route headers which is similar to the stack of Via headers. The destination UA will copy the stack of Record-Route headers from the request to all responses replied within the scope of the transaction. The Record-Route headers will not be removed (unlike the Via header) as the reply traverses back to the originating UA. Recall that replies are delivered back through a path dictated by the stack of Via headers. The Record-Route headers are therefore not required for determining the path of replies. Therefore the originating and destination User Agents will be in possession of the same stack of Record-Route headers at the end of the SIP dialog’s first transaction.

(Although the callee phone 309 learned the direct contact of the originating phone 308 from the Contact field of the INVITE request, and the calling phone 308 learned the direct contact of the callee phone from the Contact field of the 200 OK reply (see the message above), the User Agents give a priority to Record-Route instructions and will not use the available direct contact information.)

The endpoint User Agents form Route header stacks from the received Record-Route header stacks. The Route header stack of the destination UA is the copy of the Record-Route header stack (only the header name is changed from “Record-Route:” to “Route:”). The Route header stack of the originating UA is the copy of the Record-Route header stack but in the reversed order.

The Route header stack added to request messages dictates the path of the message. Each time an intermediary proxy receives a message with its own IP in the top most Route header field, the proxy will remove its Route field from the stack and will forward the request to the next proxy listed in the stack. The routing according to the Route fields with removals of top most Route fields is called loose routing. Using the stack of Route fields (for maintaining the signalling path) during the phone conversation is the obligation of User Agents. They follow that during the entire duration of the phone conversation the request messages will be transmitted by both User Agents with the stacks of Route fields (associated to the current phone conversation). The proxies only provide the Record-Route headers once in the call setup transaction.


All requests sent from A to B within a dialog, independent of the
method, have increasing CSeq, by value of 1, with two exceptions:

  1. ACK for an INVITE has the same cseq as the invite
  2. cancel for a request has the same cseq as request


for register authentication, the server challenges with the header field WWW-Authenticate and the user responses with the header field Authorization. For call setup, the proxy server challenges with a different header field Proxy-Authenticate, and the user responses with the header field Proxy-Authorization


Understanding SIP exchanges by experimentation

other sip docs

November 13, 2007


Filed under: Uncategorized — manoftoday @ 1:34 am

1. TCP/IP 3 ways synchronization

1. the client, sends a SYN segment to the server to synchronize the sequence numbers. It specifies its initial sequence number (ISN) (8221822) . To initialize a connection, the client and server must synchronize each other’s sequence numbers. There is also an option for the Maximum Segment Size (MSS) to be set, which is defined by the length (len: 4). This option communicates the maximum segment size the sender wants to receive. The Acknowledgement field (ack: 0) is set to zero because this is the first part of the three-way handshake.

2. In the second frame, the server, sends an ACK and a SYN on this segment (TCP .A..S.). In this segment the server is acknowledging the request of the client for synchronization.

At the same time, the server is also sending its request SYN to the client for synchronization of its sequence numbers(1109645). The server transmits an acknowledgement number (8221823) to the client. the server increments the client’s sequence number by one and uses it as its acknowledgement number.

3. In the third frame, the client sends an ACK of seq (8221823) on this segment (TCP .A….). In this segment, the client is acknowledging the request from the server for synchronization with ACK (1109646).

for terminaltion, because of duplex, there are 4 frames





IPSec handshake

A HTTP-based SSL connection is always initiated by the client using a URL starting with https:// instead of with http://. At the beginning of an SSL session, an SSL handshake is performed. This handshake produces the cryptographic parameters of the session. A simplified overview of how the SSL handshake is processed is shown in the diagram below.

SSL handshake with server authentication

  1. The client sends a client “hello” message that lists the cryptographic capabilities of the client (sorted in client preference order), such as the version of SSL, the cipher suites supported by the client, and the data compression methods supported by the client. The message also contains a 28-byte random number.
  2. The server responds with a server “hello” message that contains the cryptographic method (cipher suite) and the data compression method selected by the server, the session ID, and another random number.Note:The client and the server must support at least one common cipher suite, or else the handshake fails. The server generally chooses the strongest common cipher suite.
  3. The server sends its digital certificate. (In this example, the server uses X.509 V3 digital certificates with SSL.)If the server uses SSL V3, and if the server application (for example, the Web server) requires a digital certificate for client authentication, the server sends a “digital certificate request” message. In the “digital certificate request” message, the server sends a list of the types of digital certificates supported and the distinguished names of acceptable certificate authorities.
  4. The server sends a server “hello done” message and waits for a client response.
  5. Upon receipt of the server “hello done” message, the client (the Web browser) verifies the validity of the server’s digital certificate and checks that the server’s “hello” parameters are acceptable.If the server requested a client digital certificate, the client sends a digital certificate, or if no suitable digital certificate is available, the client sends a “no digital certificate” alert. This alert is only a warning, but the server application can fail the session if client authentication is mandatory.
  6. The client sends a “client key exchange” message. This message contains the pre-master secret, a 46-byte random number used in the generation of the symmetric encryption keys and the message authentication code (MAC) keys, encrypted with the public key of the server.If the client sent a digital certificate to the server, the client sends a “digital certificate verify” message signed with the client’s private key. By verifying the signature of this message, the server can explicitly verify the ownership of the client digital certificate.Note:

    An additional process to verify the server digital certificate is not necessary. If the server does not have the private key that belongs to the digital certificate, it cannot decrypt the pre-master secret and create the correct keys for the symmetric encryption algorithm, and the handshake fails.

  7. The client uses a series of cryptographic operations to convert the pre-master secret into a master secret, from which all key material required for encryption and message authentication is derived. Then the client sends a “change cipher spec” message to make the server switch to the newly negotiated cipher suite. The next message sent by the client (the “finished” message) is the first message encrypted with this cipher method and keys.
  8. The server responds with a “change cipher spec” and a “finished” message of its own.
  9. The SSL handshake ends, and encrypted application data can be sent.

2. IP address

IP Subnetting: for instance ,Class C has fixed length of the network mark address at 24 bits. To subnet this network, MORE than 24 bits must be set to ‘1’ on the left side of the subnet mask. For instance, the 25-bit mask,1111111,11111111,1000000) of creates a two-subnet networks as there is one extra bit of mask : and (xxxxxxxx,xxxxxxxx,xxxxxxxx,0/1000000)

A two-bit subnet number can support up to four subnets, a three-bit number supports up to eight subnets, and so on.

SUM: extra bits stands power of 2 subnets are divided;

CIDR is an alternative to traditional IP subnetting that organizes IP addresses into subnetworks independent of the value of the addresses themselves.
CIDR is also known as supernetting as it effectively allows multiple subnets to be grouped together for network routing.(subnet mark length is LESS than default subnet mark length) ([xxxxxxxx.xxxxxxxx.0000110]0.0000 where default marsk is 24 bits.)

applies the network mask to the 192.168 network, starting at This notation represents the address range – Compared to traditional class-based networking, represents an aggregation of the two Class C subnets and each having a subnet mask of In other words,

SUM: less bits stands power of 2 subnets are aggredated;

Additionally, CIDR supports Internet address allocation and message routing independent of the traditional class of a given IP address range. For example,

represents the address range – (network mask This allocates the equivalent of four Class C networks within the much larger Class A space.

You will sometimes see CIDR notation used even for non-CIDR networks. In non-CIDR IP subnetting, however, the value of n is restricted to either 8 (Class A), 16 (Class B) or 24 (Class C). Examples:

struct sockaddr

struct sockaddr {
    u_char  sa_len;

u_short sa_family; // address family, AF_xxx

char sa_data[14]; // 14 bytes of protocol address


struct sockaddr_in

struct sockaddr_in {
    u_char  sin_len;

u_short sin_family; //Address family

u_short sin_port; //Port number

struct in_addr sin_addr; //Internet or IP address

char sin_zero[8]; //Same size as struct sockaddr


Data type struct in_addr – this data type is used in certain contexts to contain an Internet host address. It has just one field, named s_addr, which records the host address number as an unsigned long int in network order.

#include <unistd.h>

#include <sys/types.h>

#include <sys/socket.h>

#include <netinet/in.h>

/*the port users will be connecting to*/

#define MYPORT 3440

/* how many pending connections queue will hold */

#define BACKLOG 10

int main()


/* listen on sock_fd, new connection on new_fd */

int sockfd, new_fd;

/* my address information, address where I run this program */

struct sockaddr_in my_addr;

/* remote address information */

struct sockaddr_in their_addr;

int sin_size;

sockfd = socket(AF_INET, SOCK_STREAM, 0);

if(sockfd == -1){

perror(“socket() error lol!”);




printf(“socket() is OK…\n”);

/* host byte order */

my_addr.sin_family = AF_INET;

/* short, network byte order */

my_addr.sin_port = htons(MYPORT);

/* auto-fill with my IP */

my_addr.sin_addr.s_addr = INADDR_ANY;

/* zero the rest of the struct */

memset(&(my_addr.sin_zero), 0, 8);

if(bind(sockfd, (struct sockaddr *)&my_addr, sizeof(struct sockaddr)) == -1)


perror(“bind() error lol!”);




printf(“bind() is OK…\n”);

if(listen(sockfd, BACKLOG) == -1)


perror(“listen() error lol!”);




printf(“listen() is OK…\n”);

sin_size = sizeof(struct sockaddr_in);

new_fd = accept(sockfd, (struct sockaddr *)&their_addr, &sin_size);

if(new_fd == -1)

perror(“accept() error lol!”);


printf(“accept() is OK…\n”);

/*…..other codes…….*/

while(1) {






return 0;


[bodo@bakawali testsocket]$ cat test2.c

#include <unistd.h>

#include <sys/types.h>

#include <sys/socket.h>

#include <netinet/in.h>

#define DEST_IP “”

#define DEST_PORT 80

int main(int argc, char *argv[])


int sockfd;

/* will hold the destination addr */

struct sockaddr_in dest_addr;

sockfd = socket(AF_INET, SOCK_STREAM, 0);

if(sockfd == -1){

perror(“Client-socket() error lol!”);




printf(“Client-socket() sockfd is OK…\n”);

/* host byte order */

dest_addr.sin_family = AF_INET;

/* short, network byte order */

dest_addr.sin_port = htons(DEST_PORT);

dest_addr.sin_addr.s_addr = inet_addr(DEST_IP);

/* or better

inet_aton(“”, &(my_addr.sin_addr));


/* zero the rest of the struct */

memset(&(dest_addr.sin_zero), 0, 8);

if(connect(sockfd, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr)) == -1)


perror(“Client-connect() error lol”);




printf(“Client-connect() is OK…\n”);

/*…other codes…*/

while(1) {





return 0;


write a sample TCP/IP program

TCP congestion control

what is ICMP

leaky bucket

什么是big endian, little endian,写个函数来区分;

Little Endian and big Endian issue regarding the use of the different processors.

– On Intel based machines the hex value 0x01020304 would be stored in 4 successive bytes as: 04, 03, 02, 01. This is little endian. (least-significant byte first.)

– On an Most Significant Bit (MSB)-first (big endian) machine (IBM RS6000), this would be: 01, 02, 03, 04. (most-significant byte first )

– The standard network order is actually big-endian

char * s = malloc(2);



So, K is a pointer to a short, and is now looking at byte location 0 (which has W), byte location s+1 (which has X). What happens when we read the value at K?

I think a short is two bytes, so I’ll read them off: location s is address 0 (W, or 0x12) and locaiton s + 1 is address 1 (X, or 0x34).

  • Big endian machine: Since the first byte is biggest (I’m big-endian!), the number must be 256 * byte[0] + byte[1], or 256*W + X, or 0x1234.
  • Little endian machine: But in my world, the first byte is the littlest! The value of the short is byte[0] + 256 * byte[1], or 256*X + W, or 0x3412.

socket programming中何时用到(htons,htonl,ect)

bind , connect, sendto, data translated.

* choose an unused port at random */

my_addr.sin_port = htons(8080);

my_addr.sin_addr.s_addr = htonl(INADDR_ANY);

TCP/IP hdr checksum : what method is used ?

Header Checksum: A checksum computed over the header to
provide basic protection against corruption in transmission.
This is not the more complex CRC code typically used by data
link layer technologies such as Ethernet; it’s just a 16-bit
checksum. It is calculated by dividing the header bytes into
words (a word is two bytes) and then adding them together.
The data is not checksummed, only the header. At each hop
the device receiving the datagram does the same checksum
calculation and on a mismatch, discards the datagram as damaged.

Code Correctness Verification


SNMPv1 (RFC’s 1155, 1157, and 1212), SNMPv2c (RFC’s 1901 through 1908), and SNMPv3 (RFC’s 3411 though 3418). The co-existence of all three versions are detailed in RFC 3584.

SNMPv1 is the original standard for community based management.

SNMPv2 was derived from the SNMPv1 framework but had no message definition, which was later revamped aa SNMPv2c, a community based version of SNMPv2 with a message format similar to SNMPv1. SNMPv2 added several new datatypes (Counter32, Counter64, Gauge32, UInteger32, NsapAdress, and BIT STRING), as well as enhancements to OID tables and the setting of OID values. Within the MIB-II standard several OID groups are defined

SNMPv3 is an extensable SNMPv2 framework with a new message format, ACL and security abilities, and remote configuration of SNMP parameters.

SNMP Proxy agent requires only when network has SNMP V1 and V2 agents. SNMP V1 supports Get, GetNext, Set and trap.
SNMP V2 supports Get, GetBulk, set, trap and Inform. When SNMP V2 Network management Service wants to get data from
SNMP V1 device, it sends GetBulk message to Proxy agent. Proxy agent will translate the GetBulk request to GetNext
request in order to get data from SNMP V1 agent

OID: . (

Cisco 9, Microsoft 311

Lay2 vs lay3 switch


The difference between the two is that :

SEGV – Tends to mean you have attempted to access a segment of memory that does not exist.
BUS – Tends to mean you have attempted to access a segment of memory that does exist but have accessed it in correctly
sometimes certin cpu’s require address to be aligned on certin boundryies eg 8 / 16 / 32 / 64 bit address

Based on experience from many years ago (and not having access to source code and the time) I learned that SIGSEGV tended to mean that you either dereferenced a NULL pointer which would mean you are trying to access a non-existant segment or that you generated and were trying to use an address which was pointing into the “text” segment.

In contrast SIGBUS basically meant that you were trying to use an address which was illegal (i.e. outside the ability of the manhine to address).

Candidate UNIX qualifying questions.  Candidate

Ø Is your current system more BSD or System IV based
and why?

Ø How do you boot into single user mode?

Ø What are the options for the shutdown command?

Ø What is the su du command used for?

Ø What is a super block? state of the file system, size of file system , where to find space, how many files  

Ø What command do you use to access the Super Block? fsck 

Ø What is the difference between a symbolic and hard
link? When would you use each?

Ø What directory holds file with the sticky bit and
when is it used?
Ø What command do you use to change file ownership and
chown , chgrp

Ø What is another name for the kill command?

Ø What is the default value if you put no options on
the kill command?

Ø What is the letter equivalent of the -9 and -15
options? -9: KILL -15 TERM -1 HUP

Ø What are the nice and renice commands used for?

Ø What are the 7 fields in the /etc/passwd file? (on 1

Ø What command do you use to create a device? What are
the 2 numbers associated with it?

Ø What are the termcap and terminfo commands used for?

Ø What is /etc/remote file used for?

Ø What command or tool do you use to format a disk?
Ø How do you create a mount point for a disk

Ø How do you create a file system on a new disk?

Ø Why wouldn't you use default options on mkfs?

Ø What it the lost+found directory and where does it

Ø Name 3 tape mediums for backup

Ø What is a level 0 backup?  Level 1?  Level 2?

Ø Where is the backup info kept?

Ø Other than dump, name 2 other backup commands.

Ø What is SYSLOG? How does it work?

Ø What is a loadable kernel module?

Ø What is the difference between a classful and
classless IP address?

On the other hand, the use of an IP Address with a subnet mask other than the default results in the standard Host bits (the Bits used to indentify the HOST ID) being divided in to two parts: a Subnet ID and Host ID. These type of IP Addresses are called Classless IP Addresses.

Ø What is the difference between the ARP and Reverse
ARP commands?

Ø What is a subnet mask?
Ø What is a default router? Where is used?

Ø What protocol does ping use?

Ø What is the difference between a hub, a switch, and
a router?

Ø What is the difference between DNS lookup and
reverse DNS lookup?

Ø What is PPP?

Ø Do you use USENET?  What version of Sendmail?

Ø Name 3 deamons on a UNIX system.

Ø What deamon is the system master deamon?

Ø What is the portmap deamon?

Ø What is the difference between x-server and

Network engineer interview questions

Dikumpulin dari beberapa website, mungkin aja pertanyaan2 dibawah ini keluar pada interview network engineer.


  • Describe OSPF in your own words.
  • OSPF areas, the purpose of having each of them
  • Types of OSPF LSA, the purpose of each LSA type
  • What exact LSA type you can see in different areas
  • How OSPF establishes neighboor relation, what the stages are
  • If OSPF router is stucked in each stage what the problem is and how to troubleshoot it
  • OSPF hierarchy in the single or multi areas. Cool OSPF behavior in broadcast and nonbroadcast
  • Draw the diagram of typical OSPF network and explain generally how it works, DR, BDR, election, ASBR, ABR, route redistribution and summarization


  • How it works and the purpose
  • Diff types (SSTP, MSTP, RSTP) Cisco – PVST/PVST+
  • root election
  • Diff. port stages and timing for convergence
  • Draw the typical diagram and explain how diff types of STP work
  • What ports are blocking or forwarding
  • How it works if there are topology changes


  • What are they
  • Diff types
  • Write an example if you want to allow and to deny…
  • Well-known port numbers (DNS – 53 and etc…)


  • What is that
  • What is the diff b/w L2 and L3 QoS
  • How it works


  • Draw the typical network diagram you have to deal with
  • explain how it works
  • What part of it you are responsible
  • firewall, what is that, how it works, how it is diff from ACLs
  • What problems with the network you had had and how you solved it.
  • What are the ways to troubleshoot the network, techniques, commands
  • network security, ways to achieve it


  • VLANs
  • STP
  • How a L2 switch works with broadcast, unicast, multicast, known/unknown traffic
  • port monitoring and mirroring
  • L3 switch, how it works
  • PIM sparse and dense modes
  1. User(s) are complaining of delays when using the network. What would you do?
  2. What are some of the problems associated with operating a switched LAN?
  3. Name some of the ways of combining TCP/IP traffic and SNA traffic over the same link.
  4. What sort of cabling is suitable for Fast Ethernet protocols?
  5. What is a Class D IP address?
  6. Why do I sometimes lose a server’s address when using more than one server?
  7. What is Firewall?
  8. How do I monitor the activity of sockets?
  9. How would I put my socket in non-blocking mode?
  10. What are RAW sockets?
  11. What is the role of TCP protocol and IP protocol.
  12. What is UDP?
  13. How can I make my server a daemon?
  14. How should I choose a port number for my server?
  15. Layers in TCP/IP
  16. How can I be sure that a UDP message is received?
  17. How to get IP header of a UDP message
  18. Writing UDP/SOCK_DGRAM applications
  19. How many bytes in an IPX network address?
  20. What is the difference between MUTEX and Semaphore?
  21. What is priority inversion?
  22. Different Solutions to dining philosophers problem.
  23. What is a message queue?
  24. Questions on Shared Memory.
  25. What is DHCP?
  26. Working of ping, telnet, gopher.
  27. Can I connect two computers to internet using same line ?
  1. Explain how traceroute, ping, and tcpdump work and what they are used for?
  2. Describe a case where you have used these tools to troubleshoot.
  3. What is the last major networking problem you troubleshot and solved on your own in the last year?
  4. What LAN analyzer tools are you familiar with and describe how you use them to troubleshoot and on what media and network types.
  5. Explain the contents of a routing table (default route, next hop, etc.)
  6. What routing protocols have you configured?
  7. Describe the commands to set up a route.
  8. What routing problems have you troubleshot?
  9. How do you display a routing table on a Cisco? On a host?
  10. How do you use a routing table and for what?
  11. What is a route flap?
  12. What is a metric?
  13. When do you use BGP, IGRP, OSPF, Static Routes?
  14. What do you see as current networking security issues (e.g. NFS mounting, spoofing, one time passwords, etc.)?
  15. Describe a routing filter and what it does.
  16. Describe an access list and what it does.
  17. What is a network management system?
  18. Describe how SNMP works.
  19. Describe the working environment you are currently in, e.g. frequent interruptions, frequent priority shifting, team or individual.
  20. What do you use to write documentation? Editor? Mail reader?
  21. What platform (s) do you currently work on at your desk?
  22. How do you manage multiple concurrent high level projects?
  23. Describe a recent short term stressful situation and how you managed it.
  24. How do you manage a long term demanding stressful work environment?
  25. Have you worked in an assignment based environment, e.g. work request/trouble ticket system, and if so, describe that environment.
  26. Describe what network statistics or measurement tools you are familiar with and how you have used them.
  27. Describe what a VPN is and how it works.
  28. Describe how VoIP works.
  29. Describe methods of QoS.
  30. How does ToS bit work?

1. How do you implement a packet filter that distinguishes following cases and selects first case and rejects…

2.What are TP-Lite and TP-Heavy Monitors?

3.List out the benefits obtained by using the Client/Server oriented TP MonitorsClient/Server applications…

4.What are the main components of Transaction-based Systems?

5.What is a TP Monitor?

6.What is the difference between an unspecified passive open and a fully specified passive open?

7.Explain the function of Transmission Control Block?

8.What is a Management Information Base (MIB)?

9.What is anonymous FTP and why would you use it?

10.What is a pseudo tty?

11.What is REX?

12.What does the Mount protocol do?

13.What is the difference between interior and exterior neighbor gateways?

14.What are the advantages and disadvantages of the three types of routing tables?

15.What is a TCP connection table?

16.What is source route?

17.What is Proxy ARP?

18.What is a Multi-homed Host?

19.What is NVT (Network Virtual Terminal)?

20.What is Gateway-to-Gateway protocol?

Latest Questions in Networking Interview Questions

1.what is the difference between packet switched, cell switched and circuit switched technology? can we configure mail-server in win2003ADS

3.What is Frame Relay?

4.difference b/w subnetmask and default gateway

5.I have been called up for the tech interview on next week for the post of Network Engineer. Help me out…

6.What is difference between TCP/IP and UDP?

7.Encryption operation performed at what layer1.presentation layer2.physical layer3.transport layer


8.If you have 3 pc’s with static IP’s and there is one PC workstation that has FTP going through a router…

9.What are the network monitoring tools? Like what tools do you use to monitor network connections?

10.In tcp/ip udp is connection less , why?

	       	Systems Programmer Questionnaire	Rev. 3/30/99

1. What is the difference between .xinitrc and .xsession?

2. What is the difference between a gateway and a router?

3. Describe your experience with Microsoft Windows registry?

4. How many SCSI devices can be connected to a workstation with one single
   channel SCSI-2 controller?

5. Name the basic data types in PERL.

6. What must a text file begin with to be recognized as postscript code?

7. What does the UNIX gutinteg command do?

8.  What files, ownerships and permissions must be set for rsh to work without
    a password?

9.  How do you calculate the total number of blocks or sectors available on
    a disk?

10. If a SCSI hard drive was formatted on a SUN workstation and no data has
    yet been written to it, what needs to be do to use it on a non -SUN Linux

11. Describe an SNMP application you have developed.

12. Describe the procedure for permanently modifying the initialization string
    on a modem connected to a Cisco termianl server.

13. In what subdirectory is the X windows hardware configuration file
    XF86Config found on a system configured with Linux?

14. Describe some of the software project management tools you have used.

15. What is the path to the shutdown command on a DEC Alpha running OS/F?

16. Name the seven most important tools a System Administrator uses?

17. Describe methods you have used to assure completion of projects on

18. How would you set up cron entries for a non-priviledged account?

19. What is the path to the sendmail configuration file?

20. How would you remove all the core files on a filesystem.
i think you can search core**
21. What is the difference between Cnews and INN?

22. Briefly describe the sequence of events when printing a file under BSD..

23. What do the options 2755 mean to chmod? -rwx r-s r-x

24. What is RAID level 5? Level 0?

25. Describe the steps, tools and procedures you have used in project

26. Describe the most complex client/server anomaly you have encountered and
    how you solved it.

27. Describe your experience in forecasting server load and equipment

28. What were your considerations in specifying a PC hardware standard?

             Unix Administrator Technical Interview Questions

Please answer as many questions as correctly as you can within a 1 hour
time-limit.  Answers valid for the Solaris or FreeBSD operating systems are
preferred but not required, be sure to specify on which operating system
your answer is valid.

1) What is the first line of defense in system security?

2) What should be used to maintain the /etc/shadow file?

3) What is the default shell for the "root" logonid?  What other shells
are acceptable for this logonid?

4) What is the function of the kernel?

5) Using the Bourne shell syntax, show the command that sets the PATH
environment variable to look in /usr/bin first, /usr/local/bin second,
and the current directory last.

6) Show the command to search for any files or directories with question
marks in their names.

7) Which of the following commands redirects output to a file?

	rd somefile > test
	cat somefile > test
	cat somefile >> test
	cat somefile | test

8) You are using "vi" to edit a file with multiple pages.  Which command
will take you down one page the fastest?

9) What command do you use to quit "vi" without saving changes? q!

10) Which command do you use to display a directory listing of files,
including the file type?

11) What is the command to display on-line help for a unix command? man

12) To display a list of all manual pages containing the keyword "date", what
command would you type?

man -k keyword apropos   13) What command will display the first 10 lines of a file called "junk"? head

14) What file will tell you where system log files are being written (if any)? /etc/syslog.conf

15) What command diplays a full listing of processes, including headers?

16) How do you terminate a process? kill -9    : KILL kill -15   : TERM kill -3    : quit   

17) Using symbolic mode, add group write permissions to the file "junk".
	Do the same using octal mode.

18) In the following, where does the output for standard error go?

	/usr/lib/sendmail -OQueueSortOrder=host -oQ/var/spool/mqueue-8h \
				-q >> /var/adm/log/mqueue-8h 2>&1

19) What is the command to check the available free disk space on all local
filesystems?  Which operating environment does the syntax used apply to?

20) You have need to configure a new network client and have been given the IP in the subnet.  You configure the machine
with that IP and set the default router as you were told but are not
getting packets or response to pings.  What is probably wrong?

21) Describe the X Window system client/server model.

22) Please list and describe 2 or more authentication mechanisms when displaying
X applications on remote displays.  Which one is "better" in terms of

23) You added a line to /etc/aliases, but it doesn't seem to be working.  Why?

24) You commented out a server in inetd.conf, but it's still active. Why?

25) What's a process? What's an inode? Describe the difference between a
symlink and a hard link.

26) Name as many shells as you can.

27) How do you plan to document changes to this environment?

28) You have a problem and you don't know how to solve it.  Name all the
resources you can think of that you might consult.

29) What have you done recently that you particularly liked, or are proud of?

30) I have a file named 'dash fr' (-fr); how do I get rid of it?

# rm ./-thefile   31) Why did I just ask that question?

32) What's the difference between a library function and system call?

33) The command to see who is on the system is:

  where   who

34) Which commercial UNIX platform dominated the computer industry?

  Microsoft McUnix

35) In which file is the default router address kept?

  /etc/resolv.conf    DNS
  /etc/nsswitch.conf  passwd/group in nis

36) The first field field in an /etc/passwd entry is:

  The uid
  The name
  The gid
  The home directory.   uipd 

37) According to POSIX.2, which of the following tests to see if file foo
exists and is readable?

  test -f foo
  test -r foo
  test -w foo
  test -x foo     -f

38) According to POSIX.2, which option tells sort to compare the keys in a
case-insensitive manner?


39) The renice command may alter the priority of:

  A single process
  All process in a process group
  All processes owned by a user
  All of the above  <---

40) To setup a master/slave NIS system such that the slave takes over lookup
requests when the master crashes:

  run ypserv on the master; ypbind on the slave
  run ypserv,ypbind on the master; ypset on the slave
  run ypserv,ypbind on the master; ypserv,ypbind on the slave
  run ypserv on the master; ypserv -s on the slave

41) You boot a client machine and attempt to mount an NFS drive from the
server.  The NFS mount worked yesterday, and neither the server nor its NFS
export list has been modified since then.  The mount command just hangs.
Where do you look for the problem?

42) Acceptable levels of bad nfs calls fall under what percentages?

  anything under 90%

43) When debugging a core in gdb, what does the command "bt" give?

  the core memory
  heap usage
  the calling stack

44) Please describe the complete boot process for a Unix system (your choice,
but preferably Sun if known).  Start at the moment the power switch is
turned on.

45) What is the main negative aspect of telnet/rshell/rlogin with respect to
security?  Please list 2 or more mechanisms of overcoming that aspect.

46) How many devices can be attached to a SCSI/SCSI-2 bus?  A "wide" SCSI bus?

47) A user performed a "cd;chmod 644 ." before logging out.  What problem
occurs when they log in the next time, and what level of priviledge is
required to correct the problem?

48) Please describe the path and types of programs that handle an e-mail message
starting from when a system receives the first packet of information until
the recipient reads it.

49) A customer has created a web page and complains that attempts to view
it result in "forbidden" messages.  What is the main problem?  Directory
listing is as follows:

# ls -al
total 240
drwxr-xr-x   2 joeuser   other        8192 Apr 19 17:54 .
drwx------  57 joeuser   other        8192 Apr 16 14:13 ..
-rw-------   1 joeuser   other        6311 Apr 19 17:50 back.xbm
-rw-------   1 joeuser   other        9650 Apr 19 17:50 daemon.gif
-rw-------   1 joeuser   other       11230 Apr 19 17:50 ferret.jpg
-rw-------   1 joeuser   other       11925 Apr 19 17:50 giraffe.gif
-rw-------   1 joeuser   other       32760 Apr 19 17:50 help.gif
-rw-r--r--   1 joeuser   other         967 Apr 19 17:46 index.html
-rw-------   1 joeuser   other        3871 Apr 19 17:50 kewl.jpg
-rw-------   1 joeuser   other        9018 Apr 19 17:50 luser.jpg
-rw-------   1 joeuser   other        2143 Apr 19 17:50 news.gif
-rw-------   1 joeuser   other        9055 Apr 19 17:50 noms.gif
-rw-------   1 joeuser   other        3071 Apr 19 17:50 race.gif
-rw-------   1 joeuser   other        3301 Apr 19 17:50 sailbot.jpg
-rw-------   1 joeuser   other       10511 Apr 19 17:50 tamu.gif
-rw-------   1 joeuser   other       19696 Apr 19 17:50 tsip.jpg
-rw-------   1 joeuser   other        6376 Apr 19 17:50 unix.gif
-rw-------   1 joeuser   other        2267 Apr 19 17:50 xray.gif
-rw-------   1 joeuser   other        3858 Apr 19 17:50 zoom.jpg

50) What happens when you issue the following commands (as root):

	# kill -1 1

	# kill -1 -1

	# init 0

	# sync

	# rm /dev/console

webservice, soap, wsdl,uddi

soap tutorial:

soap faq:

ou may be curious about the distinction I make between marshaling and serialization, having seen the terms used interchangeably. I distinguish between them because with Web services different standards define the rules for the two processes. SOAP defines the rules for marshaling and encoding data into XML messages, but doesn’t specify how data is actually serialized across the interface. SOAP can bind to any protocol (usually either HTTP or Simple Mail Transport Protocol [SMTP]) for serialization, which means the specifications for those protocols actually define the serialization rules.

RPC vs Document

Section 5 encoding vs Literal encoding

In reality, the choices are between what combo of Style and Use to implement:

RPC/ENCODING -non conforming.

RPC/LITERAL -conforming


excellent explaining:

DOCUMENT: in WSDL, part tag is <part … element= ../>, SOAP message has no operation name;

RPC: in WSDL, part tag is <part … type= ../>, SOAP message has operation name;

Encoded: SOAP message includes data type;

Literal: SOAP message doesn’t include data type; Under any literal style, the href attribute is not available

The fighters have STYLE:

  • RPC Style
    • The RPC style specifies that the <soap:body> contains an element with the name of the Web method being invoked. This element in turn contains an entry for each parameter and the return value of this method.
  • Document Style
    • The message parts appear directly under the <soap:body> element. There are no SOAP formatting rules for what the <soap:body> contains. The server application is responsible for mapping the server objects (parameters, method calls, and so forth) and the values of the XML documents.
What they are USEing:
  • Encoding
    • Each message part references an abstract type using the type attribute defined in Section 5.0. Applications using SOAP encoding are focused on remote procedure calls and will likely use the RPC message style.
  • Literal

o Each part references a concrete schema definition using either the element or type attribute; in other words, data is serialized according to a given schema.

<wsdl:binding name=“…” type=”tns:…”>

<soap:binding style=“rpc“ …>

<wsdl:operation name=“Add”>

<wsdl:input name=“Add”>

<soap:body namespace=”operationNS” use=”literal“/>




Best practices of SOAP :

November 12, 2007


Filed under: Uncategorized — manoftoday @ 7:05 pm




There’re 2 ways to traverse a tree, “Breadth-First Search (BFS)” and “Depth-First Search (DFS).” The following are their strategies.(Both of them begins from the root.)

  1. Traverse the node.
  2. Expand the node (if it has at least one child) and put its children (in the same level) into a queue respectively (leftest child first).
  3. If the queue is NOT empty, take out the first element from the queue and go to 1. Go to 4 if empty.
  4. End the process.


  1. Traverse the node.
  2. Expand the node (if it has at least one child) and push its children (in the same level) into a stack respectively (leftest child first). <— i think rightest child first is better and clearer
  3. If the stack is NOT empty, pop the top element from the stack and go to 1. Go to 4 if empty.
  4. End the process.

The binary search tree (BST) holds some `nice’ properties (it will be mentioned in your Data Structure course). Now, I just tell you its definition.

  • It’s a binary tree. and its node holds one of these properties.
    1. The node has no children.
    2. The node has either one or two children. The value of all left descendent is smaller than the node, while the value of all right descendent is larger. 




DFS():  non-recursive

Initialize Stack S with root node ROOT;  //if it is graph, it is any beginning node K;

while S.isNotEmpty()


node v = S.pop();

 if   v.isVisitedBefore() == false



            mark v as visited;

            for all children i of node v // if it is graph, all vertices i adjacent to v

                    push i into Stack S;


dfs(v) //recursive
    if v.isVisitedBefore()
    mark v as visited
    for all children i of v   //if it is graph, all vertices i adjacent to v 


Quick sort

First, the sequence to be sorted a is partitioned into two parts, such that all elements of the first part b are less than or equal to all elements of the second part c (divide). Then the two parts are sorted separately by recursive application of the same procedure (conquer).

void quicksort (int[] a, int lo, int hi)
//  lo is the lower index, hi is the upper index
//  of the region of array a that is to be sorted
    int i=lo, j=hi, h;
    int x=a[(lo+hi)/2];

    //  partition
        while (a[i]<x) i++; 
        while (a[j]>x) j--;
        if (i<=j)
            swap(i, j);
            i++; j--;
    } while (i<=j);

    //  recursion
    if (lo<j) quicksort(a, lo, j);
    if (i<hi) quicksort(a, i, hi);
Average: O(nlogn), Best: O(logn), Worst: O(n2)
It requires log n space for recursion.
Merge sort

Similar to Quicksort, the Mergesort algorithm is based on a divide and conquer strategyexplanation. First, the sequence to be sorted is decomposed into two halves (Divide). Each half is sorted independently (Conquer). Then the two sorted halves are merged to a sorted sequence (Combine)


void mergesort(int lo, int hi)
    if (lo<hi)
        int m=(lo+hi)/2;
        mergesort(lo, m);
        mergesort(m+1, hi);
        merge(lo, m, hi);
// Straightforward variant
void merge(int lo, int m, int hi)
    int i, j, k;

    // copy both halves of a to auxiliary array b
    for (i=lo; i<=hi; i++)

    i=lo; j=m+1; k=lo;
    // copy back next-greatest element at each time
    while (i<=m && j<=hi)
        if (b[i]<=b[j])

    // copy back remaining elements of first half (if any)
    while (i<=m)
Similar to QuickSort, but requires  O(n) extra space.

Exchange sort:

[[Bubble sort]]=
public void  bubbleSort (Record[] record) {
  for (int i = record.length; i > 1; i--) {
    for (int j = 1; j < i; j++) {
      if (record[j-1].key > record[j].key) { 
        record.swap(j-1, j);
Average: O(n2), Best: O(1), Worst: O(n2)

Insertion Sort


Let a0, …, an-1 be the sequence to be sorted. At the beginning and after each iteration of the algorithm the sequence consists of two parts: the first part a0, …, ai-1 is already sorted, the second part ai, …, an-1 is still unsorted (i element 0, …, n).

In order to insert element ai into the sorted part, it is compared with ai-1, ai-2 etc. When an element aj with aj<=ai is found, ai is inserted behind it. If no such element is found, then ai is inserted at the beginning of the sequence.

After inserting element ai the length of the sorted part has increased by one. In the next iteration, ai+1 is inserted into the sorted part etc. While at the beginning the sorted part consists of element a0 only, at the end it consists of all elements a0, …, an-1.

nsertion sort is an elementary sorting algorithm. It has a time complexity of Θ(n2), thus being slower than heapsort, merge sort and also shellsort. Insertion sort is well suited for sorting small data sets or for the insertion of new elements into a sorted sequence.


private void insertionsort()
        int i, j, t;
        for (i=1; i<n; i++)
            while (j>0 && A[j]>value)
                A[j+1]=A[j]; //shift right side for one more position

sorting by selection

the smallest (largest) item is found and placed first (last), then the next smallest (largest) is selected, and so on.

Straight selection sort

Find the smallest key and transfer it to output (or the first location in the file). Repeat this step with the next smallest key, and continue. 
Notice after i steps, the records from location 0 to i - 1 will be sorted.
[[Straight selection sort]]=
public void selectionSort(Record[] record) {
  for (int i = 0; i < record.length; i++) {
    int min = i;
    for (int j = i+1; j < record.length; j++) { 
      if (record[j].key < record[min].key)  min = j;   //find the min value's location
    Swap (record[min], record[i]);

Average: O(n2)



That is, a heap is a binary tree which is completely filled at all levels except possibly the last, which is filled from

left to right and the key in each node is larger than (or equal to) the keys of its children.

[Build a heap]=
  buildHeap(Record[] record) {
  for (int k = Math.floor (record.length/2); i > 0; i--) {
    heapify(record, k);
[[Heapify from Node k ]]=
public void  heapify (Record[] records, int k) {
  int j = k;
  int left = 2*k;
  int right = 2*k+1;
  if (left <= records.length-1 && records[left].key > records[k].key) {
    j = left;
  if (right <= records.length-1 && records[right].key > records[largest].key) {
    j = right;
  if (largest != k) {
    records.swap(k, j);
    heapify(records, j);
Building a heap is O(n).
public void  heapSort(Record[] record) {
  int n = record.length;
  for (int k = n-1; k > 1; k--) {
    record.swap(1, k);  //Exchange the root of the tree with the last element of the tree;
    --record.length;    //Decrement the heap size by one;
    heapify(record, 1); //Heapify from the root of the tree;
  record.length = n;
Swapping the root and the last element and decrementing heap size are $ \Omega$(1). Each time we heapify from the root of the tree it will take 
time  O(logK), thus total time is O(nlogK)

Shell Sort

The idea of Shellsort is the following:

  1. arrange the data sequence in a two-dimensional array
  2. sort the columns of the array

The effect is that the data sequence is partially sorted. The process above is repeated, but each time with a narrower array, i.e. with a smaller number of columns. In the last step, the array consists of only one column.


Sorting by Distribution :  counting sort, radix sort, and bucket (or bin) sort

Sorting by Insertion    straight insertion sort, binary insertion, and Shell’s sort

Sorting by selection   straight selection sort, tree sort, and heapsort

Sorting by Exchange bubblesort and  cocktail shaker sort.


A sorting technique that guarantees that records with the same primary key occurs in the same order in the sorted list as in the original unsorted list is said to be stable



You want to check whether a given set of items is sorted or not.Which of the following sorting methods will be the most efficient if it is already in sorted order?
a. Bubble sort b. Selection sort c. Insertion sort d.Merge sort
Ans. c

Dijkstra  Prim Kruskal

The shortest path algorithm gives minimum distance between any two nodes.  Floyd’s algorithm

Dijkstra  : Given a connected graph G=(V,E), a weight d:E->R+ and a fixed vertex s in V, find a shortest path from s to each vertex v in V.  Time complexity:  O(E+VlogV);  Dijkstra  gives Shortest path only between a given source and multiple destinations;

Prim:    Given a connected graph G=(V,E) and a weight d:E->R+, find a minimum spanning tree.   In minimum spanning tree,we get the shortest path between the source and the destination.

Kruskal: Given a connected graph G=(V,E) and a weight d:E->R+, find a minimum spanning tree T.  O(E*logV);


Encoding algorithms

Lossless encoding techniques include
i) Run length encoding
ii) Huffman encoding
iii) Transform coding
The correct option is
a. i
b. i and ii
c. all of the above
d. only ii
Ans. b

Greedy algorithms

Greedy algorithms are simple and straightforward. They are shortsighted in their approach in the sense that they take decisions on the basis of information at hand without worrying about the effect these decisions may have in the future. They are easy to invent, easy to implement and most of the time quite efficient. Many problems cannot be solved correctly by greedy approach. Greedy algorithms are used to solve optimization problems

A greedy strategy usually progresses in a top-down fashion, making one greedy choice after another, reducing each problem to a smaller one.

November 11, 2007


Filed under: Uncategorized — manoftoday @ 9:30 pm





  有很多时候我们需要等待,需要耐得住寂寞,等待属于你的那一刻。周润发等待过,刘德华等待过,周星驰等待过,王菲等待过,张艺谋也等待过…… 看到了他们如今的功成名就的人,你可曾看到当初他们的等待和耐心?你可曾看到金马奖影帝在街边摆地摊?你可曾看到德云社一群人在剧场里给一位观众说相声?你可曾看到周星驰的角色甚至连一句台词都没有?每一个成功者都有一段低沉苦闷的日子,我几乎能想象得出来他们借酒浇愁的样子,我也能想象得出他们为了生存而挣扎的窘迫。在他们一生最中灿烂美好的日子里,他们渴望成功,但却两手空空,一如现在的你。没有人保证他们将来一定会成功,而他们的选择是耐住寂寞。如果当时的他们总念叨着“成功只是属于特权阶级的”,你觉得他们今天会怎样?
  在最绝望的时候,我会去看电影《The Pursuit of Happyness》《Jerry Maguire》,让自己重新鼓起勇气,因为,无论什么时候,我们总还是有希望。当所有的人离开的时候,我不失去希望,我不放弃。每天下班坐在车里,我喜欢哼着《隐形的翅膀》看着窗外,我知道,我在静静等待,等待属于我的那一刻。



  前两天听到有人说一句话觉得很有道理,开始的时候我们想“能做什么?”,等到公司做大了有规模了,我们想“不能做什么。”很多人在工作中觉得为什么领导这么保守,这也不行那也不行,错过很多机会。很多时候是因为,你还年轻,你想的是“能做什么”,而作为公司领导要考虑的方面很多,他比较关心 “不能做什么”。
2.这个人曾经在全球发展最快的国家(中国)工作16年,并担任HP中国区总裁7年,见证及经历过中国改革开放的关键 最新突破阶段,与中国一起成长。
4. 这个人曾经获得管理硕士学位,在领导管理上特别关注中国企业的组织行为及绩效,并且在这个领域上获得中国企业界的认可。
另一方面,我25年的时间都花在运营(operation) 的领域,兢兢业业的做好职业人士的工作,它是一份好工作,特别是在HP,这份工作也帮助我建立财务的基础,支持家庭的发展。
但是我不想终其一生,都陷入在运营的领域,我想象企业家一样,有机会靠一些点子 (ideas)赚钱,虽然风险很高,但是值得一试,即使失败,也不枉走一回,这也是第4个愿望其中的一部份。
Carly Fiorina 曾经对我说过“这个世界上有好想法的人很多,但有能力去实现的人很少”,2007 年5月21日在北大演讲时,有人问起那些书对我影响较大,我想对我人生观有影响的其中一本书叫“Trigger Point”,它的主要观点是:人生最需要的不是规划,而是在适当的时机掌握机会,采取行动。
我要感谢HP的EER提前退休优惠政策,它是其中一个关键的Trigger Points,另一个关键因素是在去年五六月发生的事。
但这个计划因为工作上一件重要的事情(Mark Hurd 访华)不得不取消。这个事件刺激了我必须严肃的去对待那心中的声音,我会不会继续不断的错失很多关键的机会?
做一个没有名片的人士,虽然只有十多天的时间,但我发现我的脑袋里已经空出很多空间及能量,让我可以静心的为我Chapter II的新生活做细致的调研及规划。
到美国后,很多事情需要打800号电话联系,但这些电话很忙,常让你在waiting line上等待很长的时间,当我在等待时,我可以体会以前秘书工作辛苦的地方,但同时也提醒我自己,在这个阶段要改变态度,培养更大的耐性及自己动手做的能力。
第一个快乐的体验就是准备及参加大儿子的订婚礼,那种全心投入,不需担忧工作数字的感觉真好。同时我也租好了公寓,买好了家具及车子,陪家人在周末的时候到Reno 及Lake Tahoe玩了一趟,Lake Tahoe我去了多次,但这次的体验有所不同,我从心里欣赏到它的美丽。

Source: 海归论坛 :: 阅读主题 – 【吐血奉送正经人生道理帖】IT大哥大总结关于工作与人生 【上】

如何在国内购买A股基金, edition III

Filed under: Uncategorized — manoftoday @ 12:01 am


对国内的individual stocks说老实话不太了解。但个人认为国内股市还有的涨。我在去年年底写第一版的时候说1000点到2000点这才刚刚开了一个头,现在到了4600+,不算低了,但也不像有些人说的那样bubbly,很多factors都point to a higher market.不细说了。因为体系制度还不完善,大户相对于散户还是有很大优势,所以基金很容易跑赢大盘,跑赢散户,所以我从来没碰过国内的individual stocks. 今年国内基金截至7/26/2007,大多已经翻番,而散户挣钱的据说不到30%,meaning 30% of people have return > 0%, 而return超过100%的不知道一百个人里面能挑出几个。另外,到7/26/2007,大盘收在5/29的高点,而不少基金已经超过5/29好几个百分点了。另外,和美国不同,国内股票,基金的capital gain是不缴税的。投资中国也是回国发展的一种方式。有可能我今天说完明天股市就大跌,大家别骂我,也别笑我,我写这篇文章的目的不是要预测股市的涨跌。
国内大多数基金可以在基金发行公司的网站上开户购买(叫做直销),申/认购费大多有折扣,一般是四折,0.6%, 最好挑一些赎回费用几年后降至0的。这里是各大基金网站:
搜狐新浪财经版都有很多信息,morningstar的中文网站更系统化一些, 和美国的morningstar一样,有各基金的星级评价,排名,详细信息,fund selector等。
认购是指购买新发行的基金,一般一元每份, 申购是指购买老基金. 网上买基金需要有国内各大银行的银联卡, 建行的最好用,直接从账户里划钱走,很方便,不收手续费。广发的也不错,买易方达的基金只要0.3%的申购费. 但因为money market fund都没有fee, 所以可以先用建行卡买易方达的money market fund, 然后再转成其他基金,只收0.3%的转换费, 和用广发卡一样. 有些基金用兴业的方便,和银联有关系,不用另外申请银联账户,但转账要收费, 5000收2元,5000以上收3元。。。由建行和兴业的卡一般就可以买百分之九十以上的基金了. 易方达的申购费0.3%是最便宜的,嘉实沪深300的管理费最便宜,只要0.5%. 你也可以到各大银行去买或在银行的网站上交易(叫银行代销),比如说招行的银基通. 但要pay full 1.5% 申购费,招商银行的系统做的是最好的。并不一定要迷信新基金或是低净值,高分红的基金,最好把分红方式设成分红再投资,不然分的红再买成基金还要再付一次申购费。
在各大基金网站上开户非常方便, follow instructions就行了. 我开第二个账户只花了五分钟不到. (在公司上网较快,特别是今年年初海底光缆故障的时候,公司有VPN的可以连到亚洲的服务器,奇快无比)。有的基金公司一定要留手机号码或email,会给你发短消息,trade confirmation, 还会定期收到paper statements, 和美国一样. 从来没收到过unsolicited calls or emails.
回国如果没有身份证,可以用护照开户。如果你在美国,让国内的亲朋替你在建行开个账户,办一张一卡通,理论上开户要本人,可以让别人用复印件代办看行不行,我听说有这么办成的。 I’m sure there are ways around it, if you know somebody. 如果信得过的话,用别人的账户也行。跟teller说要开通网上银行for基金直销,他一般会给你一张龙卡,一个密码,你就可以在网上set up account,会让你下载一个证书,follow instructions 就可以了。如果你图方便,不介意1.5%的申购费, 想在一家银行统一操作的话,最好用招商银行。开户之后可以直接从你在美国的银行账户wire美元过去(receiving money 不收费,Citibank wiring money online up to $50000的手续费是$30, fidelity $15, Washington Mutual 不收费,但要show up in person.在WAMU 一般美东时间周一上午汇款,国内周二下午钱就到帐) 再兑换成人民币操作,很快很方便。最好别用Western Union。招行的卡买直销基金不方便,很少有基金用招行的卡,最好的是建行的, 但招行向同城别的银行划款,每笔只要两元手续费。我都是把钱wire到招行,结汇,再汇到建行或兴业银行,都可以在网上操作。好像只有招行可以网上换汇,至少一两年前是这样。顺便说一句, 如果你在国内开户有困难, 可以在美国买MSCI China A Share Fund, 这是一个ETF, symbol是CAF, track MSCI China A Share index. 记住要limit order 因为spread比较大。
上投摩根中国优势:my all time favorite, best among the best, 申购费只打六折, 0.9%,but it’s well worth the extra 0.3%
易方达策略成长,易方达价值精选,great company, great records, 申购费只要0.3%,赎回费用两年后降至0.
嘉实沪深300, 指数基金,track 沪深300指数,管理费只要0.5%/per year, compared with 1.75% for most other funds.
华安中国A股,指数基金,track MSCI China A Share Index, 申购费0.6%,赎回费0% anytime.这个Index在美国有个ETF, traded under symbol CAF.
广发小盘,Best mid-small cap stock fund, good diversification.

Source: 另类回国发展–如何在国内购买A股基金, edition III – 文学城: 热点论坛

November 10, 2007

How to find a good lawyer

Filed under: Uncategorized — manoftoday @ 11:57 pm


1. Evaluate a Lawyer with Exclusive Peer Review Ratings™ System on®


1. General Ethical Standards Rating
The General Ethical Standards Rating denotes adherence to professional standards of conduct and ethics, reliability, diligence and other criteria relevant to the discharge of professional responsibilities.

The General Recommendation Rating is:
V – Very High

A lawyer must receive a General Ethical Standards Rating before his or her review can proceed to the next step.

2. Legal Ability Ratings
Legal Ability Ratings take into consideration the standard of professional ability in the area where the lawyer practices, the lawyer’s expertise, and other professional qualifications. If a lawyer’s practice is limited or specialized, Peer Review Ratings are based on performance in those specific fields of law.

Legal Ability Ratings are:
C – Good to High
B – High to Very High
A – Very High to Preeminent

When both categories of Peer Review Ratings are confirmed, a lawyer receives an CV, BV or AV Rating.

If a lawyer moves to a different state, his or her rating will appear in Martindale-Hubbell with the state abbreviation indicating that it was established in another state or province.

Source: Evaluate a Lawyer with Exclusive Peer Review Ratings™ System on®


2. Check similar cases from PACER

Join the Pacer. It is very important to join the Pacer even if you are filing through an attorney. Go to ,After you get your login id and password from the Pacers, go to this site to find similar cases.



3. Check lawyer ‘s current status on state BAR website

4. Legal Records  or

5. Search on internet for any negative or good recommendation of the lawyer

6. Groups and Forums



7. Top 10 Mistakes Made When Hiring a Lawyer


Filed under: Uncategorized — manoftoday @ 7:08 am


,那你就拿黑石的 -30%吧。第一步的损失没有吓退中国政府,中国政府在美元债券不

November 9, 2007

Java Interview Questions

Filed under: Uncategorized — manoftoday @ 1:50 am

1. Java says “write once, run anywhere”. What are some ways this isn’t quite true? Any time you use system calls specific to one operating system and do not create alternative calls for another operating system, your program will not function correctly. Solaris systems and Intel systems order the bits of an integer differently. (You may have heard of little endian vs. big endian) If your code uses bit shifting, or other binary operators, they will not work on systems that have opposide endianism.

2. What’s the difference between == and equals method? The typical “gotcha” for most people is in using == to compare two strings when they really should be using the String class’s equals() method. From above, you know that the operator will only return “true” when both of the references refer to the same actual object. But, with strings, most uses want to know whether or not the value of the two strings are the same — since two different String objects may both have the same (or different) values.

3. two types of stream

basically there are 2 types of streams.

byte streams that are used to handle stream of bytes and character streams for handling streams of characters.

in byte streams inputStream/outputStream are the abstract classes at the top of hierarchy,while writer/reader are abstract classes at the top of character streams hierarchy.

4.What class allows you to read objects directly from a stream? The ObjectInputStream class supports the reading of objects from input streams.

5. Can you write Java code for declaration of multiple inheritance in Java ? Class C extends A implements B { }

6. Given two tables Student(SID, Name, Course) and Level(SID, level) write the SQL statement to get the name and SID of the student who are taking course = 3 and at freshman level.


FROM Student, Level

WHERE Student.SID = Level.SID AND Level.Level = “freshman” AND Student.Course = 3;

7. advantagesof OOPL The features of OOPL as inheritance, polymorphism, encapsulation makes it powerful.

8. marker interfaces in java except Serializable.



An interface having no methods is called as a Marker Interface.

9. instanceof() vs isInstance()

Point pt = new Point(3, 4);


System.out.println(“Is pt a String? [using instanceof] ” +

((Object)pt instanceof String));



try {


“Is pt a String? [using isInstance()] ” +

(Class.forName(“java.lang.String”).isInstance(pt))); //you need a Class object.


catch(Throwable e) {



10. Are constructors inherited? Can a subclass call the parent’s class constructor? When? You cannot inherit a constructor. By giving the developer the ability to override a superclasses onstructor you would erode the encapsulation abilities of the language. but you can call the parent’s class constructor. 

11. synchronization

When you synchronize on an object your thread gains exclusive use of that object until synchronization ends or wait is called on the object.Language support for synchronization:

1. Use the synchronized block:

In a method you may: synchronized(object) { code here }

synchronized(SomeClass.class) { code here }

 In the first case access to the instance variables/methods of the class are synchronized.

In the second case access to the static methods/fields are synchronized.

2. Declare the method synchronized:

public synchronized foo() { code here }

public static synchronized foo() { code here }

These two act just like synchronized(this) or synchronized(MyClass.class) (depending if the method is static or not).

In addition the Object class defines the wait, notify, notifyAll, and sleep methods. To execute any of these methods the object must be in a synchronized block (this can be in a calling method). The compiler will not check this, a runtime error will be thrown if this is not the case. The wait method temporaly releases the lock on the object. The notify/notifyAll method allows a previously waiting thread to continue to execute.

Also when executing the static block of a class: public class Foo { static { code here } } A special lock is placed on the class, this lock is different from the synchronized lock, as no other thread may access the class until the static block is done.

12. access control

Public : Any other class from any package can instantiate and execute the classes and methods.

Protected : Only classes inside of the package and subclasses can access the classes and methods.

Private : The original class is the only class allowed to execute the methods.

Default : Only classes inside of the package can access the classes and methods.

13. JDBC steps

The standard steps to connecting the database as follows:


      1: Loading the drivers Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);

      2:Getting the connection Connection con=DriverManager.getConnection(“jdbc:odbc:datasourcename”,”scott”,”tiger”);

      3:Create the Statement Statement st=con.createStatement();

      4:Execute the Statement ResultSet rs=st.executeQuery(“select * from emp”);

      5:Accessing the data from the backend


                        System.out.println(rs.getString(1)); System.out.println(rs.getInt(2)); System.out.println(rs.getString(3));

      6:close the connection }catch(SQLException se) { se.printStackTrace(); } finally{ con.close(); rs.close(); st.close(); }

14. java different from c++;

         java : no goto; no destructor;has garbage collection;

         Java has method overloading, but no operator overloading.

        java package;     c++: namespace

15. String abc= “xyz”;

 Important to note that you are NOT calling a java.lang.String constuctor when you type String s = “abc”; For example String x = “abc”; String y = “abc”; refer to the same object. While String x1 = new String(“abc”); String x2 = new String(“abc”); refer to two different objects. 

16. Java Network Programming

 Java supports “low-level” and “high-level” classes.

“Low-level” classes provide support for socket programming: Socket, DatagramSocket, and ServerSocket classes.

“High-level” classes provide “Web programming”: URL, URLEncoder, and URLConnection classes. Networking programming classes ease the programming of network applications, but do not substitute your knowledge of networking. Java networking like anything else in Java is platform-independent.

17.  unreachable object becomes reachable. An unreachable object may become reachable again. This can happen when the object’s finalize() method is invoked and the object performs an operation which causes it to become accessible to reachable objects.

18. modifiers for top class   A top-level class may be public, abstract, or final.

19. default value of boolean The default value of the boolean type is false.

20. Expain the reason for each keyword of public static void main(String args[])?

public- main(..) is the first method called by java environment when a program is executed so it has to accessible from java environment. Hence the access specifier has to be public.

static: Java environment should be able to call this method without creating an instance of the class , so this method must be declared as static.

void: main does not return anything so the return type must be void

The argument String indicates the argument type which is given at the command line and arg is an array for string given during command line.

21. What is the difference between Abstract class and …

1. Abstract Class may contains constructor but interface does not contain constructor.
2.By default, all variables in interfaces are static and final,then we can’t declare method as final.
3.In Interface all methods shuld be public but mot in abstract class.
4.interface supportes multiple inheritance but abstract class does not support.
5.we should initialise variables in interface but not necessory in abstract class.

6.interface has no method implementation.




22. How to track “memory leak” and how to prevent it i…

To reduce possibility of memory leaks, following things should be kept in mind.

Try to avoid long recursive loops in the code. This leads to an OutOfMemoryError.

Avoid collections as static members of a class. If so, carefully manage removals and additions to the Collection. If the collection continues adding members without removing them, it might lead to a leak. Static members persist throughout the life of the program. A static collection will keep references to objects, whether you are using it or not. So the garbage collector might miss collecting the unused contents of the collection.

Avoid populating the HttpSession with too much data. Session persists in the system as long as the user is online, and it might get filled up fast. Additions and removals in the session should be checked.

If you are using AWT/Swing components, call dispose() to kill the windowing component completely.

Check your native code for memory leaks, if you are calling C/C++ code from Java using JNI.

There are other things too, to take care of, but these are the most important ones.

tool: JProbe Memory debugger

Filed under: Uncategorized — manoftoday @ 12:45 am

behavior questions.

1. So, tell me a little about yourself.
You don’t need to explain everything from birth to present day. Relevant facts about education, your career and your current life situation are fine.

2. Why are you looking (or why did you leave you last job)?
This should be a straightforward question to answer, but it can trip you up. Presumably you are looking for a new job (or any job) because you want to advance your career and get a position that allows you to grow as a person and an employee. It’s not a good idea to mention money here, it can make you sound mercenary. And if you are in the unfortunate situation of having been downsized, stay positive and be as brief as possible about it. If you were fired, you’ll need a good explanation. But once again, stay positive.

3. Tell me what you know about this company.
Do your homework before you go to any interview. Whether it’s being the VP of marketing or the mailroom clerk, you should know about the company or business you’re going to work for. Has this company been in the news lately? Who are the people in the company you should know about? Do the background work, it will make you stand out as someone who comes prepared, and is genuinely interested in the company and the job.

4. Why do you want to work at X Company?
This should be directly related to the last question. Any research you’ve done on the company should have led you to the conclusion that you’d want to work there. After all, you’re at the interview, right? Put some thought into this answer before you have your interview, mention your career goals and highlight forward-thinking goals and career plans.

5. What relevant experience do you have?
Hopefully if you’re applying for this position you have bags of related experience, and if that’s the case you should mention it all. But if you’re switching careers or trying something a little different, your experience may initially not look like it’s matching up. That’s when you need a little honest creativity to match the experiences required with the ones you have. People skills are people skills after all, you just need to show how customer service skills can apply to internal management positions, and so on.

6. If your previous co-workers were here, what would they say about you?
Ok, this is not the time for full disclosure. If some people from your past are going to say you’re a boring A-hole, you don’t need to bring that up. Stay positive, always, and maybe have a few specific quotes in mind. “They’d say I was a hard worker” or even better “John Doe has always said I was the most reliable, creative problem-solver he’d ever met.”

7. Have you done anything to further your experience?
This could include anything from night classes to hobbies and sports. If it’s related, it’s worth mentioning. Obviously anything to do with further education is great, but maybe you’re spending time on a home improvement project to work on skills such as self-sufficiency, time management and motivation.

8. Where else have you applied?
This is a good way to hint that you’re in demand, without sounding like you’re whoring yourself all over town. So, be honest and mention a few other companies but don’t go into detail. The fact that you’re seriously looking and keeping your options open is what the interviewer is driving at.

9. How are you when you’re working under pressure?
Once again, there are a few ways to answer this but they should all be positive. You may work well under pressure, you may thrive under pressure, and you may actually PREFER working under pressure. If you say you crumble like aged blue cheese, this is not going to help you get your foot in the door.

10. What motivates you to do a good job?
The answer to this one is not money, even if it is. You should be motivated by life’s noble pursuits. You want recognition for a job well done. You want to become better at your job. You want to help others or be a leader in your field.

11. What’s your greatest strength?
This is your chance to shine. You’re being asked to explain why you are a great employee, so don’t hold back and stay do stay positive. You could be someone who thrives under pressure, a great motivator, an amazing problem solver or someone with extraordinary attention to detail. If your greatest strength, however, is to drink anyone under the table or get a top score on Mario Kart, keep it to yourself. The interviewer is looking for work-related strengths.

12. What’s your biggest weakness?
If you’re completely honest, you may be kicking yourself in the butt. If you say you don’t have one, you’re obviously lying. This is a horrible question and one that politicians have become masters at answering. They say things like “I’m perhaps too committed to my work and don’t spend enough time with my family.” Oh, there’s a fireable offense. I’ve even heard “I think I’m too good at my job, it can often make people jealous.” Please, let’s keep our feet on the ground. If you’re asked this question, give a small, work-related flaw that you’re working hard to improve. Example: “I’ve been told I occasionally focus on details and miss the bigger picture, so I’ve been spending time laying out the complete project every day to see my overall progress.

13. Let’s talk about salary. What are you looking for?
Run for cover! This is one tricky game to play in an interview. Even if you know the salary range for the job, if you answer first you’re already showing all your cards. You want as much as possible, the employer wants you for as little as you’re willing to take. Before you apply, take a look at for a good idea of what someone with your specific experience should be paid. You may want to say, “well, that’s something I’ve thought long and hard about and I think someone with my experience should get between X & Y.” Or, you could be sly and say, “right now, I’m more interested in talking more about what the position can offer my career.” That could at least buy you a little time to scope out the situation. But if you do have a specific figure in mind and you are confident that you can get it, I’d say go for it. I have on many occasions, and every time I got very close to that figure (both below and sometimes above).

14. Are you good at working in a team?
Unless you have the I.Q. of a houseplant, you’ll always answer YES to this one. It’s the only answer. How can anyone function inside an organization if they are a loner? You may want to mention what part you like to play in a team though; it’s a great chance to explain that you’re a natural leader.

15. Tell me a suggestion you have made that was implemented.
It’s important here to focus on the word “implemented.” There’s nothing wrong with having a thousand great ideas, but if the only place they live is on your notepad what’s the point? Better still, you need a good ending. If your previous company took your advice and ended up going bankrupt, that’s not such a great example either. Be prepared with a story about an idea of yours that was taken from idea to implementation, and considered successful.

16. Has anything ever irritated you about people you’ve worked with?
Of course, you have a list as long as your arm. But you can’t say that, it shows you as being negative and difficult to work with. The best way to answer this one is to think for a while and then say something like “I’ve always got on just fine with my co-workers actually.

Use this question as a chance to show that you are a team player: “The only people I have trouble with are those who aren’t team players, who just don’t perform, who complain constantly, and who fail to respond to any efforts to motivate them.” The interviewer is expecting a response focused on personality and personal dislikes. Surprise her by delivering an answer that reflects company values

17. Is there anyone you just could not work with?
No. Well, unless you’re talking about murderers, racists, rapists, thieves or other dastardly characters, you can work with anyone. Otherwise you could be flagged as someone who’s picky and difficult if you say, “I can’t work with anyone who’s a Bronco’s fan. Sorry.”

18. Tell me about any issues you’ve had with a previous boss.
Arrgh! If you fall for this one you shouldn’t be hired anyway. The interviewer is testing you to see if you’ll speak badly about your previous supervisor. Simply answer this question with exteme tact, diplomacy and if necessary, a big fat loss of memory. In short, you’ve never had any issues.

The answer to 18 is completely wrong. I am a director at a major media company’s interactive division. Our company is expanding and I am almost in a constant state of hiring. I ask a variation of this question in every single interview and if a candidate has never had one issue or disagreement with anyone, (I stated a variation: I ask if it has happened with anyone in the workplace) I peg them as a liar and reject them immediately.

I went well with my previous boss. If there is an conflict, I will be open mind and talk about facts. once decision is made, I execute it well.

19. Would you rather work for money or job satisfaction?
It’s not a very fair question is it? We’d all love to get paid a Trump-like salary doing a job we love but that’s rare indeed. It’s fine to say money is important, but remember that NOTHING is more important to you than the job. Otherwise, you’re just someone looking for a bigger paycheck.

20. Would you rather be liked or feared?
I have been asked this a lot, in various incarnations. The first time I just drew a blank and said, “I don’t know.” That went over badly, but it was right at the start of my career when I had little to no experience. Since then I’ve realized that my genuine answer is “Neither, I’d rather be respected.” You don’t want to be feared because fear is no way to motivate a team. You may got the job done but at what cost? Similarly, if you’re everyone’s best friend you’ll find it difficult to make tough decisions or hit deadlines. But when you’re respected, you don’t have to be a complete bastard or a lame duck to get the job done.

21. Are you willing to put the interests of X Company ahead of your own?
Again, another nasty question. If you say yes, you’re a corporate whore who doesn’t care about family. If you say no, you’re disloyal to the company. I’m afraid that you’ll probably have to say yes to this one though, because you’re trying to be the perfect employee at this point, and perfect employees don’t cut out early for Jimmy’s baseball game.

it is situational. if you… ; if you …. Ethics and professionalism


22. So, explain why I should hire you.
As I’m sure you know, “because I’m great” or “I really need a job” are not good answers here. This is a time to give the employer a laundry list of your greatest talents that just so happen to match the job description. It’s also good to avoid taking potshots at other potential candidates here. Focus on yourself and your talents, not other people’s flaws.

23. Finally, do you have any questions to ask me?
I’ll finish the way I started, with one of the most common questions asked in interviews. This directly relates to the research you’ve done on the company and also gives you a chance to show how eager and prepared you are. You’ll probably want to ask about benefits if they haven’t been covered already. A good generic one is “how soon could I start, if I were offered the job of course.” You may also ask what you’d be working on. Specifically, in the role you’re applying for and how that affects the rest of the company. Always have questions ready, greeting this one with a blank stare is a rotten way to finish your interview. Good luck and happy job hunting.

ponder for a moment, and then ask your interviewer “what aspect of your job do you find most challenging”.

I would ask the interviewer, “Why do you like to work here?”

24. Where do you want to be in 5 to years?

They dont want to hear in the same job you are interviewing for. Ultimately, the HR people are searching for someone who can handle the job now, and has the potential to grow into a high level management job in the future. Do you have those goals too?

24. Would you rather work for a big company or a small one?

Favorite answer: I’d treat any company like it was my own regardless. Total ownership of the situation can get you a long way.

General , the worst answer was “I don’t know.” I’ve since learned that “it depends,” with a couple of examples, is perfectly appropriate.

November 8, 2007


Filed under: Uncategorized — manoftoday @ 12:40 am


今年以来,美元持续走弱,但是包括欧元、澳币、加币等多个国家外币却持续走强,许多投资人开始考虑买进强势货币的区域股票,例如欧元股票,来增加获利率; 也有些投资人想直接投资外汇市场。美股阔网表示,对於大多数人而言,投资外汇市场仍然是一种相对新颖的概念,加上风险高,其实并不适於一般投资大众,反倒 是手续费低廉,又以外汇货币为投资标地的ETF,不但能够帮助投资人赚取汇率升值的优惠,又省却了一堆不必要的管理和手续费用。

很多投资人都已经知道投资ETF(指数型基金)的好处,包括资讯透明、交易较共同基金简便、手续费与股票相同等优点,但是很多投资人可能不知道,利用投资 货币型ETF 也可以达成投资外汇的管道。目前在美股市场中,与外汇货币相关的基金有:十大工业国货币套息交易基金 (DBV)、美元贬值基金 (UDN)、美元升值基金 (UUP)、瑞典克郎基金 (FXS)、墨西哥披索基金 (FXM)、日圆基金(FXY)、瑞士法郎基金 (FXF)、欧元基金 (FXE)、加币基金 (FXC)、英镑基金(FXB)、澳元基金 (FXA)等。

举例来说,加币相对美元的汇率近期上涨至三十年来的最高水准, CurrencyShares Canadian Dollar Trust加币基金(FXC)也在短短三个月当中,从$95上涨至$103美元,涨幅惊人。除此之外,瑞典克郎基金 (FXS)、澳元基金 (FXA)也都是表现亮眼的货币型ETF。很多投资人都认为哪里涨,就该直接去哪开户投资。事实上,如果全部以该国货币做为投资标的,风险是很大的,而分 散风险是投资的第一堂课,加上投资人也无法到各个国家开户,所以当面对美元持续看贬,不妨投资货币型ETF,或是直接投资美元贬值基金 (UDN),换言之,美元贬值UDN就涨,实际上观察UDN近期三个月走势,也上涨了近一成左右,算是已充分反映美元走势。

另一个享受货币升值的方法,则是投资该国家的ETF。如以投资中国A股市场为主的Morgan Stanley China摩根史坦利中国指数型基金(代号CAF),一年内从$25涨到最高$72元,除了代表中国股市的成长之外,也有人民币升值的因素。另外如 iShares MSCI Taiwan 台湾指数基金 (代号EWT),近期除受惠台湾股票大涨外,台币升值也不定期反映其中,股价从今年的$13上涨到$17.25。其它区域ETF包括代表亚洲50股的 (ADRA)、代表拉丁美洲40股(ILF)、投资欧亚澳三洲的(FA)等,都是可以享受到该区域成长和货币升值,但又不用大老远转换投资跑道的优良投资 标的。

相较美股逐渐走高,美元跌幅却愈来愈深,来到近18个月新低位置,可能许多投资人担心投资美股汇差会造成损失。不过多数金融专家表示,美元已大跌一阵,短 中期反扑可以预料。除此,投资人不妨考虑投资货币型ETF,或是投资具前景的新兴亚洲、拉丁美洲及澳洲等,藉由投资当地货币与资产,让投资组合有效防御美 元贬值风险、持续获利的效果。

November 7, 2007


Filed under: Uncategorized — manoftoday @ 3:54 am

1. Exchanging values with xor

Here’s some weird code I ran across once. It uses xor to exchange two values (x and y). Never use it; this is just a curiosity from the museum of bizarre code.

x = x ^ y;
y = x ^ y;
x = x ^ y;

2. Multiple a number by 7 without using * and + operator.

NewNum = Num << 3; // mulitplied by 2 ^ 3 = 8

NewNum = NewNum – Num; // 8 – 1 = 7



3. print integer using only putchar


// recursive version


void PrintNum ( int Num )


if ( Num == 0 )


PrintNum ( Num / 10 );

Puthcar ( ‘0’+ Num % 10 );



4. Counting set bits in a number.

First version:

int CoutSetBits(int Num)


for(int count=0; Num; Num >>= 1)


          if (Num & 1)  count++;


return count;


5. notions

Big O notation is used for Asymptotic(an sem ‘totic) upper bound

θ notation is used for tight bound

Ω notation is used for Asymptotic lower  bound


6. Given an array of integers or other numbers (reals, doubles, etc), tell us if any two of the numbers in the array sum up to another given number.


There’s an n2 solution in which you compute all the possible pairs of numbers and then add them together to test the termination condition. Obviously, this is less than ideal. However, it is well known that integers can be sorted in O(n) time, where n is the number of integers to sort. Therefore, I proposed this additional precondition:

Allow the list of integers to be sorted in natural order before calling this method

The algorithm then is quite simple: keep an index at the far left side, and the far right side. If the indices become equal, or cross, we’ve failed to find a pair that works. To try to exhaustively find a matching pair, we try adding the numbers at our indices. If the sum too big, we decrement the right index. If the sum is too small, we increment the left index. If the sum is equal to what we’re looking for, we can return true. Pseudocode resembling Java might look like this:

public boolean inArr(int [] arr, int sought) {
  int left = 0;
  int right = arr.length - 1;

  while(left < right) {
    int test = arr[left] + arr[right] - sought;
    if(test > 0) {
    } else if(test < 0) {
    } else {
      return true;

  return false;
good solution

Let’s take some values as an example:

       array = { 1, 12, 10, 4, 5, 7};
       sumvalue = 16;

The array is my list of numbers, and number is the sum I am trying to find two numbers in the array to add up to.

So, I am going to scan through each element in the array and add the value at array[i] to my dictionary (hashtable). The Key is the number at i itself – array[i], and the Value is the difference, sumvalue – array[i]:

This is because the array[i] where i is 0 is 1, and that is our key, but I do check to make sure that the key doesn’t already exist in our hashtable first. Next, the difference between the value we seek and this number is 16 -1 = 15. This number becomes our value. Finally, I check whether the hashtable contains 15 as its key. It doesn’t, so I continue repeating this process of:

  1. Checking if array[i] key exists in our hashtable.
  2. If the key does not exist in our hashtable:
    1. Add the key to the hashtable
    2. The value mapped with this key is the difference between the sumvalue and array[i].
  3. Check if the difference between sumvalue and array[i] exists as a key in our hashtable.
  4. Continue loop if the difference value does not exist as a key.

Notice that all of this is done in linear time – Ɵ(n).


Give a one-line C expression to test whether a number is a power of 2. [No loops allowed – it’s a simple test.]

if (x && !(x & (x-1)) == 0)

(a-1) xor a == 0 – What does this do?

a is a power of 2.

How many points are there on the globe where by walking one mile south, one mile east and one mile north you reach the place where you started.

The answer is “many points”. The set of such points is given as {North pole, special circle}.


You are given a list of n numbers from 1 to n-1, with one of the numbers repeated. Devise a method to determine which number is repeated.

The sum of the numbers 1 to n-1 is (n)(n-1)/2. Add the numbers on the list, and subtract (n)(n-1)/2. The result is the number that has been repeated.


You have 5 jars of pills. Each pill weighs 10 gram, except for contaminated pills contained in one jar, where each pill weighs 9 gm. Given a scale, how could you tell which jar had the contaminated pills in just one measurement?

Take one pill from first, two from second, three from third and so on. Total pills are n(n+1)/2 and should weigh 10n(n+1)/2. If it weighs x gm less than that then the x’th jar is contaminated, since we took x pills from that jar which weighed 1 gm less.



You have 12 balls. All of them are identical except one, which is either heavier or lighter than the rest – it is either hollow while the rest are solid, or solid while the rest are hollow. You have a simple two-armed scale, and are permitted three weighings. Can you identify the odd ball, and determine whether it is hollow or solid.

Let the balls be numbered 1 to 12. Firstly, put 1-4 on one side and 5-8 on other side. If both are equal then one of 9-12 is odd. Then second try, weigh 9-10 vs 1-2, if equal, one of 11-12 is bad, else 9-10 is bad. Testing which one is bad can be done by (third try) weighing 11 or 9, respectively, with good ball 1. It also gives whether the odd ball is heavy or light.



Write, efficient code for extracting unique elements from a sorted list of array. e.g. (1, 1, 3, 3, 3, 5, 5, 5, 9, 9, 9, 9) -> (1, 3, 5, 9).

int main()
int a[10]={1, 2, 4, 4, 7, 8, 9, 14, 14, 20};
int i;
for (i = 0;i<9;i++)
if (a[i] != a[i+1])
return 0;

Write an algorithm to detect loop in a linked list.

You are presented with a linked list, which may have a “loop” in it. That is, an element of the linked list may incorrectly point to a previously encountered element, which can cause an infinite loop when traversing the list. Devise an algorithm to detect whether a loop exists in a linked list. How does your answer change if you cannot change the structure of the list elements?

One possible answer is to add a flag to each element of the list. You could then traverse the list, starting at the head and tagging each element as you encounter it. If you ever encountered an element that was already tagged, you would know that you had already visited it and that there existed a loop in the linked list. What if you are not allowed to alter the structure of the elements of the linked list? The following algorithm will find the loop:

  1. Start with two pointers ptr1 and ptr2.
  2. Set ptr1 and ptr2 to the head of the linked list.
  3. Traverse the linked list with ptr1 moving twice as fast as ptr2 (for every two elements that ptr1 advances within the list, advance ptr2 by one element).
  4. Stop when ptr1 reaches the end of the list, or when ptr1 = ptr2.
  5. If ptr1 and ptr2 are ever equal, then there must be a loop in the linked list. If the linked list has no loops, ptr1 should reach the end of the linked list ahead of ptr2.


There are 4 men 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 man walks at a different speed. A pair must walk together at the rate of the slower mans pace.

Man 1:1 minute to cross
Man 2: 2 minutes to cross
Man 3: 5 minutes to cross
Man 4: 10 minutes to cross

1 and 2 cross together. 1 comes back. then 3 and 4 cross. 2 comes back. then 1 and 2 cross. Total time is 2+1+10+2+2 = 17.



给一个matrix of int,每个value的右面的值和下面的值都比它大,在里面search.





给一个input string,要求写code匹配(不是伪代码)
bool matchPattern(string pattern, string input);


bool matchPattern(const char* pattern, const char* input)
int match=false;
while(*pattern==’*’ && *pattern!=”)
return true;
const char* patternStart=pattern;
//match from beginning
const char* inputPos=input;
if(!match && *input==*pattern)
// updated on 11/09/2007
int wildcard=false;
while(*pattern==’*’ && *pattern!=”)
while(*input!=” && *input!=*pattern)
}while(*input!=” && *pattern!=” && *input==*pattern);
while(*pattern==’*’ && *pattern!=”)
if(match && *pattern==”)
return true;
return false;
int _tmain(int argc, _TCHAR* argv[])


What new feature would you add to MSWORD if you were hired?

Ability to open .pdf files, Word completion, totally web interface based. To publish MS word docs as blogs on the sites, in one click , support wiki.


solution: reverse a string – word by word

problem: reverse “the house is blue”, the answer should be “blue is house the”. the words are reversed, but the letters are still in order (within the word).

solution: solving the initial problem of just reversing a string can either be a huge help or a frustrating hinderance. most likely the first attempt will be to solve it the same way, by swapping letters at the front of the string with letters at the back, and then adding some logic to keep the words in order. this attempt will lead to confusion pretty quickly.

for example, if we start by figuring out that “the” is 3 letters long and then try to put the “t” from “the” where the “l” from “blue” is, we encounter a problem. where do we put the “l” from “blue”? hmm… well we could have also figured out how long “blue” was and that would tell us where to put the “l” at… but the “e” from “blue” needs to go into the space after “the”. argh. its getting quite confusing. in fact, i would be delighted to even see a solution to this problem using this attack method. i don’t think its impossible, but i think it is so complex that it’s not worth pursuing.

here’s a hint. remember before when we just reversed “the house is blue”? what happened?

initial: the house is blue
reverse: eulb si esuoh eht

look at the result for a minute. notice anything? if you still don’t see it, try this.

initial: the house is blue
reverse: eulb si esuoh eht
wanted : blue is house the

the solution can be attained by first reversing the string normally, and then just reversing each word.


part I: what is the angle between the minute hand and the hour hand at 3:15 on an analog clock? no, its not 0.

part II: how often does the minute hand pass the hour hand on an analog clock?

answer: part I: 12 hours on the clock make 360 deg. so one hour is 30 deg. the hour hand will be directly on the 3 when the minute hand is at 12 (3:00). after 15 minutes or 1/4 of an hour, the hour hand will be 1/4 * 30 deg = 7.5 deg. away from the minute hand.

part II: if you just think about it, intuitively you’ll see the minute hand passes the hour hand 11 times every 12 hours, so it must pass it every 1 1/11 hours. but this doesn’t make sense to me. i need to prove it.

November 6, 2007

C++ Questions

Filed under: Uncategorized — manoftoday @ 9:59 pm

1. type  size

#include <climits>

Base type  Minimum size (bits)  Minimum value (signed) Maximum value (signed)     Maximum value (unsigned)

char          8                                       -127(SCHAR_MIN)         127(SCHAR_MAX)                 255(UCHAR_MAX)

short int  16                                     -32,767(SHRT_MIN)       32,767(SHRT_MAX)              65,535(USHRT_MAX)

int             32                                     -2,147,483,647             2,147,483,647(INT_MAX)    4,294,967,295(UINT_MAX)

long         32                                      -2,147,483,647            2,147,483,647(LONG_MAX) 4,294,967,295(ULON_MAX)

If you might need large values (above 32,767 or below -32,767), use long. Otherwise, if space is very important (i.e. if there are large arrays or many structures), use short. Otherwise,use int.

2. difference between reference and pointer

A reference must always refer to some object and, therefore, must always be initialized; pointers do not have such restrictions.

A pointer can be reassigned to point to different objects while a reference always refers to an object with which it was initialized.

3. const

const function :  A member function can only be declared const if it doesn’t modify any of its fields(ie. this object).

const parameter;

const return value;

4. Micro vs inline function

the ordinary function do a lot of activity store the argument into stack,saving register control goes to the function and return value to the calling function ,but in inline function body replace to the calling the function (like as macro expansion). wherever the compiler finds the call for that function it puts the code for that function dere!! the functions are defined as inline when the function is small and is called many times.

it is reqest  to the compiler not a command,compiler may ignore the request if function is so length

5. name space

namespace NS
  class Foo
    void f();
    void g();
}//close NS

#include "Foo.hpp"
void NS::Foo::f()
{ /*..*/ }

void NS::Foo::g()
{ /*..*/ }

namespace NS //Same Name space
  class Bar
    void a();
#include "Bar.hpp"
void NS::Bar::a()

void NS::Bar::b()
#include "Bar.hpp"
#include "Foo.hpp"
int main()
  using NS::Bar; //a using declaration
  /* using namespace NS; // a using-directive  */
  Bar b;
  NS::Foo f;

6. How the compilers arranges the various sections in the executable image?

the compilers arranges the various sections in the executable image as following :

  • Data Section (uninitialized data variable section, initialized data variable section )
  • Code Section

Remember that all static variables are allocated in the initialized variable section.

7. C++ struct vs C++ class

This is one of the commonly misunderstood aspects of C++. Believe it or not, many programmers think that a C++ struct is just like a C struct, while a C++ class has inheritance, access specifies, member functions, overloaded operators, and so on. Actually, the C++ struct has all the features of the class. The only differences are that a struct defaults to public member access and public base-class inheritance, and a class defaults to the private access specified and private base-class inheritance(it makes all of the public functions of the parent class private in the child class.).

8. malloc/free vs new/delete

Malloc/free do not know about constructors and destructors. New and delete create and destroy objects, while malloc and free allocate and deallocate memory.

9. When is a template a better solution than a base class?

When you are designing a generic class to contain or otherwise manage objects of other types, when the format and behavior of those other types are unimportant to their containment or management, and particularly when those other types are unknown (thus, the generality) to the designer of the container or manager class.

10. default constructor, copy constructor, assignment operator

default constructor is required for Fred x[100]; or Fred abc; or Fred * p = new Fred[100];

class Fred {

Fred(); // Default constructor: can be called with no args
Fred(int i=3, int j=5); // Default constructor: can be called with no args


You can NOT within one constructor of a class call another constructor of the same class to initialize. like :

Foo::Foo(char x)

Foo(x, 0); // this line does NOT help initialize the this object!!


but Java can accomplish this. solution is to have a init() routine that do the common work.

C++ implicitly declares a copy constructor and an assignment operator for every class, struct and union unless the user declared them explicitly.In C++, the implicitly declared assignment operator is a public and inline member function. C++ also guarantees member-wise assignment. The difference between member-wise copying and bitwise copying (such as a memcpy() call) is significant in two cases:

  • copying of subobjects (member-wise copying)

A shallow copy of an object copies all of the member field values. This works well if the fields are values, but may not be what you want for fields that point to dynamically allocated memory. The pointer will be copied. but the memory it points to will not be copied — the field in both the original object and the copy will then point to the same dynamically allocated memory, which is not usually what you want. The default copy constructor and assignment operator make shallow copies.

  • copying of padding bytes (bitwise copying)

A copy constructor will be called only when a new object is being instantiated. The assignment operator is called for an existing object to which a new value is being assigned.

Difference between copy constructor and assignment

  1. There is no need to test to see if it is being initialized from itself.
  2. There is no need to clean up (eg, delete) an existing value (there is none).
  3. A reference to itself is not returned.

When copy constructor is called?

  • A variable is declared which is initialized from another object, eg,
Person q("Mickey"); // constructor is used to build q.
Person r(q);        // copy constructor is used to build r.
Person p = q;       // copy constructor is used to initialize in declaration.
  • A value parameter is initialized from its corresponding argument.
    f(p);               // copy constructor initializes formal value parameter of function f(...)
  • An object is returned by a function.

Don’t write a copy constructor if shallow copies are ok

If the object has no pointers to dynamically allocated memory, a shallow copy is probably sufficient. Therefore the default copy constructor, default assignment operator, and default destructor are ok and you don’t need to write your own.

If you need a copy constructor, you also need a destructor and operator=

If you need a copy constructor, it’s because you need something like a deep copy, or some other management of resources. Thus is is almost certain that you will need a destructor and override the assignment operator.

A a;
A a2=a; //copy constructor call
A a3(a); //copy constructor call
a2=a3; //assignment operator for a2

As you can see, the fact that operator= is used doesn’t necessarily mean that the assignment operator is being called. The difference ere is semantic not syntactic — if the program is instantiating a new object, t’s the copy constructor call. If the object isn’t new, the ssignment expression translates into an assignment operator call.

Sample copy ctor and assignment operator

class Point {
. . .
Point(const Point& p);   // copy constructor
. . .
//=== file Point.cpp ==========================================
. . .
Point::Point(const Point& p) {
x = p.x;
y = p.y;

class Person : public Parent
        char* _name;
        int   _id;
        Person& Person::operator=(const Person& p);
    . . .
//--- file Person.cpp
. . .
//=================================================== operator=
Person& Person::operator=(const Person& p) {
    if (this != &p) {  // (1)make sure not same object
        this->Parent::operator=(p);          // call base class's assignment 
        delete [] _name;                     // (2)Delete old name's memory.
        _name = new char[strlen(p._name)+1]; // (3)Get new space
        strcpy(_name, p._name);              // (4)Copy new name
        _id = p._id;                         // (4)Copy id
    return *this;    // (5)Return ref for multiple assignment
}//end operator=

How to prevent object copying operation?

Declare the copy constructor and the assignment operator as private members, without defining them. Any statement that involves direct or indirect  copying of that class will cause a compilation error.

Can a copy constructor accept an object of the same class as parameter, instead of reference of the object?

No. It is specified in the definition of the copy constructor itself. It should generate an error if a programmer specifies a copy constructor with a first argument that is an object and not a reference.

11.  operator overloading

Prefix and Postfix

class Number {
Number& operator++ ();
// prefix ++
Number operator++ (int);
// postfix ++ you must *not* make the postfix version return the ‘this’ object by reference;

Number& Number::operator++ ()    //Number abc(4); ++abc;

return *this;
Number Number::operator++ (int)

// Number abc(4); Number xyz = abc++; Number xyz2=abc.operator++(2); NOTE: xyz and xyz2 are the old value of abc
Number ans = *this;
// or just call operator++()
return ans;

The other option for the postfix version is to return nothing:

void Number::operator++ (int)
// or just call operator++()


When you have multiple subscripts, the cleanest way to do it is with operator() rather than with operator[]. The reason is that operator[] always takes exactly one parameter, but operator() can take any number of parameters (in the case of a rectangular matrix, two parameters are needed).

class Matrix {
Matrix(unsigned rows, unsigned cols);
double& operator() (unsigned row, unsigned col);
subscript operators often come in pairs, m(5,8) = 106.15;
double operator() (unsigned row, unsigned col) const;
subscript operators often come in pairs,std::cout << m(5,8);

// Destructor
Matrix(const Matrix& m);
// Copy constructor
Matrix& operator= (const Matrix& m);
// Assignment operator

unsigned rows_, cols_;
double* data_;
Matrix::Matrix(unsigned rows, unsigned cols)
: rows_ (rows)
, cols_ (cols)
//data_ <–initialized below (after the ‘if/throw’ statement)
if (rows == 0 || cols == 0)
throw BadIndex("Matrix constructor has 0 size");
data_ = new double[rows * cols];
delete[] data_;
double& Matrix::operator() (unsigned row, unsigned col)
if (row >= rows_ || col >= cols_)
throw BadIndex("Matrix subscript out of bounds");
return data_[cols_*row + col];
double Matrix::operator() (unsigned row, unsigned col) const
if (row >= rows_ || col >= cols_)
throw BadIndex("const Matrix subscript out of bounds");
return data_[cols_*row + col];

stream overloading

Declare friend functions outside the public and private sections of the header file. Often they are placed first as in the example below.

//=== Point.h file =============================
class Point {
    friend ostream& operator<<(ostream& output, const Point& p);
    friend istream& operator>>(istream& input, Point& p);
        . . .
        . . .

ostream& operator<<(ostream& output, const Point& p) {
    output << "(" <<  p.x << ", " << p.y <<")";
    return output;  // for multiple << operators.

istream& operator>>(istream& input, Point& p){
      input >> p.x;
      input >> p.y
      return input ;
Binary operators
with the operator-assignments (like +=) ,which change the left-hand argument and return a reference
Integer& operator+=(Integer& left,const Integer& right) {
   if(&left == &right) {/* self-assignment */}
   left.i += right.i;
   return left;
Return by value as const(my note, not necessary to be perfect, non-constant is fine)
const Integer  operator+(const Integer& left, const Integer& right) {
  return Integer(left.i + right.i);

12. static key word

You may wonder why a global variable isn’t used instead. The beauty of a static variable is that it is unavailable outside the scope of the function, so it can’t be inadvertently changed. This localizes errors;

13. handle constructor and destructor fail

for constructor fail, throw an exception;

for destructor, The C++ rule is that you must never throw an exception from a destructor that is being called during the “stack unwinding” process of another exception. instead , Write a message to a log-file.

For example, if someone says throw Foo(), the stack will be unwound so all the stack frames between the throw Foo() and the } catch (Foo e) { will get popped. This is called stack unwinding. During stack unwinding, all the local objects in all those stack frames are destructed. If one of those destructors throws an exception (say it throws a Bar object), the C++ runtime system is in a no-win situation: should it ignore the Bar and end up in the } catch (Foo e) { where it was originally headed? Should it ignore the Foo and look for a } catch (Bar e)

So the C++ language guarantees that it will call terminate() at this point, and terminate() kills the process. Bang you’re dead.

14. Exception

Generally, it’s best to throw objects, The most common practice is to throw a temporary:

#include <stdexcept>
class MyException : public std::runtime_error {
MyException() : std::runtime_error(“MyException”) { }
void f()
// …
throw MyException();

Here, a temporary of type MyException is created and thrown. C++ allows you a variety of options for catching.

  • You can catch by value.
  • You can catch by reference.
  • You can catch by pointer.

Given all this flexibility, how do you decide what to catch? Simple: unless there’s a good reason not to, catch by reference. Avoid catching by value, since that causes a copy to be made and the copy can have different behavior from what was thrown. Only under very special circumstances should you catch by pointer.

What does throw; (without an exception object after the throw keyword) mean? means “re-throw the current exception.”

try {

catch (MyException& e) {
e.addInfo(“f() failed”);

the advantage is that we can implement the re-throwing idiom as “exception dispatcher” in common place:

void handleException()
try {
catch (MyException& e) {
…code to handle MyException…
catch (YourException& e) {
…code to handle YourException…
void f()
try {
…something that might throw…
catch (…) {

This idiom allows a single function (handleException()) to be re-used to handle exceptions in a number of other functions.

15. function pointer

Many compilers have several calling can precede __cdecl, __stdcall or __pascal to a function's type to indicate its calling convention (__cdecl is the default). C++ Builder also supports the __fastcall calling convention.

// calling convention,functions and function pointers with different calling convention are incompatible with each other!
void __cdecl DoIt(float a, char b, char c);                             // Borland and Microsoft
void DoIt(float a, char b, char c)  __attribute__((cdecl));     // GNU GCC

define a function pointer and initialize to NULL

(*pt2Function)(float, char, char) = NULL;                        // C
int (TMyClass::*pt2Member)(float, char, char) = NULL;                // C++
int (TMyClass::*pt2ConstMember)(float, char, char) const = NULL;     // C++


  typedef int (*PT2FUNCTION)(float, char, char);
  PT2FUNCTION pt2Function = NULL;
  typedef int (TMyClass::*PT2MEMBER)(float, char, char);
  PT2MEMBER  pt2Member = NULL;

assign an address to the function pointer
//     Note: Although you may ommit the address operator on most compilers
//     you should always use the correct way in order to write portable code.

// C
int DoIt  (float a, char b, char c){ printf("DoIt\n");   return a+b+c; }
int DoMore(float a, char b, char c)const{ printf("DoMore\n"); return a-b+c; }

pt2Function = DoIt;      // short form
pt2Function = &DoMore;   // assignment using address operator looks better

// C++
class TMyClass
   int DoIt(float a, char b, char c){ cout << "TMyClass::DoIt"<< endl; return a+b+c;};
   int DoMore(float a, char b, char c) const
         { cout << "TMyClass::DoMore" << endl; return a-b+c; };

   /* more of TMyClass */

pt2ConstMember = &TMyClass::DoMore; // assignment using address operator
pt2Member = &TMyClass::DoIt; // note: <pt2Member> may also legally point to &DoMore
invoke function pointer

// 2.5 calling a function using a function pointer
int result1 = pt2Function    (12, 'a', 'b');          // C short way
int result2 = (*pt2Function) (12, 'a', 'b');          // C

TMyClass instance1;
int result3 = (instance1.*pt2Member)(12, 'a', 'b');   // C++
int result4 = (*this.*pt2Member)(12, 'a', 'b');       // C++ if this-pointer can be used

TMyClass* instance2 = new TMyClass;
int result4 = (instance2->*pt2Member)(12, 'a', 'b');  // C++, instance2 is a pointer
delete instance2;

16. casting

A static_cast is used for all conversions that are well-defined. 
// Forcing a conversion from void* :
  void* vp = &i;
  // Old way produces a dangerous conversion:
  float* fp = (float*)vp;
  // The new way is equally dangerous:
  fp = static_cast<float*>(vp);
// well type cast
  double d = 0.0;
  int x = d; // Automatic type conversion
  x = static_cast<int>(d); // More explicit
If you want to convert from a const to a nonconst or from a volatile to a nonvolatile, you use const_cast.
A reinterpret_cast pretends that an object is just a bit pattern that can be treated (for some dark purpose)
as if it were an entirely different type of object.
A dynamic_cast is for type-safe downcasting
Shape * bp = new Circle();
Circle * cp = dynamic_cast<Circle*>(bp);

17. Array

Array Initialization

An array can be initialized in the declaration by writing a comma-separated list of values enclosed in braces following  an equal sign.

 int days[12] = {31,28,31,30,31,30,31,31,30,31,30,31};

If the size is omitted, the compiler uses the number of values. For example,

int days[] = {31,28,31,30,31,30,31,31,30,31,30,31};

  • If an array has no initialization, the values are undefined.
   float pressure[10];   // Initial values of pressure undefined.
  • Missing initialization values use zero, If an explicit array size is specified, but an shorter initiliazation list is specified, the unspecified elements are set to zero.
   float pressure[10] = {2.101, 2.32, 1.44};

Array pointer

   int abc[100];
   int *p = NULL;
   p = abc;
   p = &abc[0];
   abc == &abc == p != &p;

18. functor

There are several advantages in using a function object instead of a pointer to function.

  • First, they are more resilient to design changes because the object can be modified internally without changing its external interface.because if it is a pointer to function, the parameter is pre-fixed
  • A function object can also have data members that store the result of a previous call. when using ordinary functions, you need to store the result of a previous call in a global or a local static variable. However, global and local static variables have some undesirable characteristics.
  • Finally, compilers can inline a call made through a function object, thereby enhancing performance even further. In general, function objects do not define constructors and destructors. Therefore, they do not incur any overhead during their creation and destruction.

  class GenericNegate
     template <class T>
     T operator() (T t) const {return -t;}

  int main()
   GenericNegate negate;
   cout<< negate<double>(5.3333); // double
   cout<< negate<__int64>(10000000000i64); // __int64

19. Templates

/--- file generic/CheckedArray.h

#include <stdexcept>

/////////////////////////////////// class CheckedArray<T>
template<class T>
class CheckedArray {
    int size;  // maximum size
    T* a;      // pointer to new space
    CheckedArray<T>(int max);
    T& CheckedArray<T>::operator[](int index);
};//end class CheckedArray<T>

//================================= constructor
template<class T>
CheckedArray<T>::CheckedArray<T>(int max) {
    size = max;
    a = new T[size];
}//end constructor
//================================= destructor
template<class T>
delete [] a;
//================================= operator[]
template<class T>
T& CheckedArray<T>::operator[](int index) {
    if (index < 0 || index >= size)
        throw out_of_range("CheckedArray");

    return a[index];
}//end operator[]

Partial Specializations and Explicit Specializations

template <class T> class Vector //primary template #1
template <class T> class Vector <T*> //partial specialization #2
void push_back(const T *p);
template <class T> class Vector <volatile T*> //partial specialization #3
template <> class Vector <bool> //explicit specialization #4

Partial specialization
template<class T, class U, int I> struct X
  { void f() { cout << "Primary template" << endl; } };

template<class T, int I> struct X<T, T*, I> //note : no class U
  { void f() { cout << "Partial specialization 1" << endl;
  } };

template<class T, class U, int I> struct X<T*, U, I>
  { void f() { cout << "Partial specialization 2" << endl;
  } };

template<class T> struct X<int, T*, 10>
  { void f() { cout << "Partial specialization 3" << endl;
  } };

template<class T, class U, int I> struct X<T, U*, I>
  { void f() { cout << "Partial specialization 4" << endl;
  } };

20. Quick Answers

Polymorphism: C++ provides a simple mechanism for class-based polymorphism. Member  functions can be marked as polymorphic using the virtual keyword

The compiler starts with the Instrument pointer, which points to the starting address of the derived object. All Instrument objects or objects derived from Instrument have their VPTR in the same place (often at the beginning of the object), so the compiler can pick the VPTR out of the object. The VPTR points to the starting address of the VTABLE. All the VTABLEs are laid out in the same order, regardless of the specific type of the object. play( ) is first, what( ) is second, and adjust( ) is third. The compiler knows that regardless of the specific object type, the adjust( ) function is at the location VPTR+2. Thus instead of saying, “Call the function at the absolute location Instrument::adjust” (early binding; the wrong action), it generates code that says, in effect, “Call the function at VPTR+2.” Because the fetching of the VPTR and the determination of the actual function address occur at runtime, you get the desired late binding. You send a message to the object, and the object figures out what to do with it.

why constructor can’t be virtual?2.

A constructor cannot be virtual because at the time when the constructor is invoked the virtual table (vtable) would not be available in the memory. Hence we cannot have a virtual constructor.

The ‘virtual’ mechanism works on a logically complete (completely constructed) object. We know that we use constructors to logically initialize our objects. In other words, the object is not completely constructed until the constructor has finished executing. Thus, we can’t have virtual constructors.

There is a misconception that by then virtual table is incomplete so we can’t have virtual constructors. Just before the constructor starts executing : 1)the virtual table is properly constructed and 2)the ‘this’ pointer passed to the constructors. Moreover, virtual table mechanism is implementation depended, and finds no place in the C++ standard. And hence, to argue over this issue using the virtual table concept is illogical.

Now, as the constructor finishes executing any other function can be virtual. Destructor is no exception to this rule as it is a function. Virtual destructors are required in case we use a base class pointer to refer to a derived class object, use it, and then delete it. If we have virtual destructor, using ‘delete’, a chain of destructors is called starting from the derived to the base. But, had there been no ‘virtual’ in destructor only the base class destructor is called (and not the derived). This (may) generate inconsistencies in the program.

How virtual functions are implemented C++?

Virtual functions are implemented using a table of function pointers, called the vtable.  There is one entry in the table per virtual function in the class.  This table is created by the constructor of the class. When a derived class is constructed, its base class is constructed first which creates the vtable. If the derived class overrides any of the base classes virtual functions, those entries in the vtable are overwritten by the derived class constructor. This is why you should never call virtual functions from a constructor: because the vtable entries for the object may not have been set up by the derived class constructor yet, so you might end up calling base class implementations of those virtual functions

What are all the implicit member functions of the class? Or what are all the functions which compiler implements for us if we don’t define one.??

default ctor

default destructor

copy ctor

assignment operator

address operator

diff of static vs global

there are 3 main uses for the static.
1. If you declare within a function: It retains the value between function calls

2.If it is declared for a function name:
By default function is it will be visible from other files.  if the function declaration is as is invisible for the outer files

3. Static for global variables:

By default we can use the global variables from outside files If it is static global..that variable is limitied to with in the file.

common:  lifetime is the entire program….

What are C++ storage classes?


auto: the default. Variables are automatically created and initialized when they are defined and are destroyed at the end of the block containing their definition. They are not visible outside that block

register: a type of auto variable. a suggestion to the compiler to use a CPU register for performance

static: a variable that is known only in the function that contains its definition but is never destroyed and retains its value between calls to that function. It exists from the time the program begins execution

extern: a variable whose definition and placement is determined when all object and library modules are combined (linked) to form the executable code file. It can be visible outside the file where it is defined.

What are storage qualifiers in C++ ?

They are..


Const keyword indicates that memory once initialized, should not be altered by a program.

volatile keyword indicates that the value in the memory location can be altered even though nothing in the program
code modifies the contents. for example if you have a pointer to hardware location that contains the time, where hardware changes the value of this pointer variable and not the program. The intent of this keyword to improve the optimization ability of the compiler.

mutable keyword indicates that particular member of a structure or class can be altered even if a particular structure variable, class, or class member function is constant.

struct data
char name[80];
mutable double salary;

const data MyStruct = { “Satish Shetty”, 1000 }; //initlized by complier

strcpy (, “Shilpa Shetty”); // compiler error
MyStruct.salaray = 2000 ; // complier is happy allowed

What is Memory alignment??

The term alignment primarily means the tendency of an address pointer value to be a multiple of some power of two. So a pointer with two byte alignment has a zero in the least significant bit. And a pointer with four byte alignment has a zero in both the two least significant bits. And so on. More alignment means a longer sequence of zero bits in the lowest bits of a pointer.

What do you mean by Stack unwinding?

It is a process during exception handling when the destructor is called for all local objects in the stack between the place where the exception was thrown and where it is caught.

What is overloading??

With the C++ language, you can overload functions and operators. Overloading is the practice of supplying more than one definition for a given function name in the same scope.

– Any two functions in a set of overloaded functions must have different argument lists.
– Overloading functions with argument lists of the same types, based on return type alone, is an error.

what is Overriding?

To override a method, a subclass of the class that originally declared the method must declare a method with the same name, return type (or a subclass of that return type), and same parameter list.
The definition of the method overriding is:
· Must have same method name.
· Must have same data type.
· Must have same argument list.
Overriding a method means that replacing a method functionality in child class. To imply overriding functionality we need parent and child classes. In the child class you define the same method signature as one defined in the parent class.

How are prefix and postfix versions of operator++() differentiated?

The postfix version of operator++() has a dummy parameter of type int. The prefix version does not have dummy parameter.

What is the difference between const char *myPointer and char *const myPointer?

Const char *myPointer is a non constant pointer to constant data; while char *const myPointer is a constant pointer to non constant data.

What is name mangling in C++??

The process of encoding the parameter types with the function/method name into a unique name is called name mangling. The inverse process is called demangling.

For example Foo::bar(int, long) const is mangled as `bar__C3Fooil’.
For a constructor, the method name is left out. That is Foo::Foo(int, long) const is mangled as `__C3Fooil’.

What does extern “C” int func(int *, Foo) accomplish?

It will turn off “name mangling” for func in c++ so that one can link to code of func implementation compiled by a C compiler.

What are the access privileges in C++? What is the default access level?

The access privileges in C++ are private, public and protected. The default access level assigned to members of a class is private. Private members of a class are accessible only within the class and by friends of the class. Protected members are accessible by the class itself and it’s sub-classes. Public members of a class can be accessed by anyone.

What is a nested class? Why can it be useful?

A nested class is a class enclosed within the scope of another class. For example:

//  Example 1: Nested class
class OuterClass
class NestedClass
// …
// …
Nested classes are useful for organizing code and controlling access and dependencies. Nested classes obey access rules just like other parts of a class do; so, in Example 1, if NestedClass is public then any code can name it as OuterClass::NestedClass. Often nested classes contain private implementation details, and are therefore made private; in Example 1, if NestedClass is private, then only OuterClass’s members and friends can use NestedClass.

When you instantiate as outer class, it won’t instantiate inside class.

What is a local class? Why can it be useful?

local class is a class defined within the scope of a function — any function, whether a member function or a free function. For example:

//  Example 2: Local class
int f()
class LocalClass
// …
// …
Like nested classes, local classes can be a useful tool for managing code dependencies.

What is the difference between a variable definition and a variable declaration?

A definition tells the compiler to set aside storage for the variable. A declaration makes the variable known to parts of the program that may wish to use it. A variable might be defined and declared in the same statement.

What is the difference between an lvalue and an rvalue?

The lvalue refers to the left-hand side of an assignment expression. It must always evaluate to a memory location. The rvalue represents the right-hand side of an assignment expression; it may have any meaningful combination of variables and constants.

How to make sure all objects created in a function be destroyed (?)(C++)

overload new/delete;

check-memory usage enter/exit func;


Note that our detector detects leaks without doing any monitoring of allocations or frees. It simply takes a snapshot of the heap just before the process terminates and determines if there are any leaks based on that snapshot. A snapshot of the heap only tells us if there are leaks; it does not tell us how they were leaked. Clearly, to determine the “how” we also need to obtain a stack trace. But to obtain a stack trace, we need to be able to monitor every allocation on-the-fly at runtime. This is what will distinguish our leak detector from the built-in one.

How to implement smart pointer

A common pitfall of regular pointers is the dangling pointer: a pointer that points to an object that is already deleted.

Here is part of auto_ptr’s implementation, to illustrate what it does:

template <class T>
class auto_ptr
    T* ptr;
    explicit auto_ptr(T* p = 0) : ptr(p) {}
    ~auto_ptr()                 {delete ptr;ptr=NULL}
    T& operator*()              {return *ptr;}
    T* operator->()             {return ptr;}
    // ...

why initialization list is listed?

(1)According to the rules of C++, const objects and references cannot be assigned; they can only be initialized

(2)The second reason for using the initializer list—efficiency—arises when the member class has a default constructor as well as an assignment operator. MFC’s CString offers a perfect example. Say you have a class CMyClass with a CString member m_str and you want to initialize m_str to “yada yada.” You have two choices

CMyClass::CMyClass() {
    // use assignment operator
    // CString::operator=(LPCTSTR);
    m_str = _T("yada yada");


// use initializer list
// and constructor CString::CString(LPCTSTR)
CMyClass::CMyClass() : m_str(_T("yada yada"))

Is there any difference between these methods? Yes. The compiler always insures that all member objects are initialized before the body of the constructor executes, so in the first example the compiled code will call CString::CString to initialize m_str before control reaches the assignment statement. In the second example, the compiler generates a call to CString:: CString(LPCTSTR), passing “yada yada” as the string. The upshot is that in the first example two CString functions are called (constructor and assignment operator), whereas in the second example only one function is called.

dead lock sample, how to avoid

  public static Object cacheLock = new Object();
  public static Object tableLock = new Object();
  public void oneMethod() {
    synchronized (cacheLock) {
      synchronized (tableLock) {
  public void anotherMethod() {
    synchronized (tableLock) {
      synchronized (cacheLock) {

that thread A acquires the lock on cacheLock, and, at the same time, thread B acquires the lock on tableLock. Now the threads are deadlocked: neither thread will give up its lock until it acquires the other lock, but neither will be able to acquire the other lock until the other thread gives it up.

How to avoid deadlocks

One of the best ways to prevent the potential for deadlock is to avoid acquiring more than one lock at a time, which is often practical. for instance, Shrink synchronized blocks to avoid multiple locking;

otherwise, ensure that you use a consistent locking order. or enforce business logic to avoid deadlock happen.

How would you detect a loop in a linked list? Write a C program to detect a loop in a linked list.

This is also one of the classic interview questions
There are multiple answers to this problem. Here are a few C programs to attack this problem.

Brute force method
Have a double loop, where you check the node pointed to by the outer loop, with every node of the inner loop.

typedef struct node


void *data;

struct node *next;


mynode * find_loop(NODE * head)


mynode *current = head;

while(current->next != NULL)


mynode *temp = head;

while(temp->next != NULL && temp != current)


if(current->next == temp)


printf(“\nFound a loop.”);

return current;


temp = temp->next;


current = current->next;


return NULL;


Visited flag
Have a visited flag in each node of the linked list. Flag it as visited when you reach the node. When you reach a node and the flag is already flagged as visited, then you know there is a loop in the linked list.

Fastest method
Have 2 pointers to start of the linked list. Increment one pointer by 1 node and the other by 2 nodes. If there’s a loop, the 2nd pointer will meet the 1st pointer somewhere. If it does, then you know there’s one.

Here is some code

while(p!=NULL && q!=NULL)


if(p==q) { //Loop detected! exit(0); }



// No loop.

What is the difference between far pointer and nea…

In 16 bit development environment like DOS or WIN 3.0 memory management is done in terms of segment:offset addressing style. so in this environment we have segment registers like CS,DS.SS,ES if we declare a near pointer we will be able to access the pointer within the segment i.e with 64 kb boundary

on the contrary if we declare it as far pointer we can access the pointer across segment boundary i.e pointer declared in one segment can be accessed from other segments also.
In 32 bit environment we have linear addressing scheme no segments and offsets so all pointers are treated as far only, no differentiation as near or far.

Why an empty Structure will occupy 2Bytes in C++

Size of empty structure in C++ is 1 byte, because compiler assign 1 byte for structure name.

Why the size of empty Class is one byte?

Yes, the compiler will generate 1 byte of memory to mark the existence of the class.  This doesn’t answer WHY though.  The reason is the language standard states that all classes must have a memory size of at least 1 byte so that the class doesn’t occupy the same memory space with another class. This is to prevent name mangling.  i.e., if I declare a class A {};, the compiler will still generate an entry in its table to something called “A”.  If behind that I declare another class, say class B, if A takes 0 bytes of memory, and B’s data gets written in the place where A was declared.  In this case, an instantiation of A would take on the properties of B.

What is difference between obeject oriented progra…

Object Oriented Programming :  It means, which follows object oriented concepts that is object oriented programming for example : c++, java and also c++ is not complete objected oriented. But java is pure objected oriented programming.
object oriented programming is bottom up approach.
program works based on object.
object is nothing set of members and methods.
Structure Oriented Programming : it means, which follows and structure ( function ) oriented concepts, a program which follows a procedure ( or a structure ) is called structure oriented programming for example : c lang
Structure Oriented Programming is top down approach.

program works based on functions.

what are proxy objectives

A proxy class is a class that implements a list of interfaces specified at compile time. The proxy object typically holds a reference to an internal object that implements the same interfaces (or parts of them).

Rational Purify, sleaker,valgrind,Electric Fence


October 12, 2007

海归论坛 :: 阅读主题 – [分享]对冲基金精英榜(Elite of the Hedge Fund)

Filed under: Uncategorized — manoftoday @ 8:44 pm


english version:

2007年07月31日 《当代金融家》
  乔治·索罗斯、JulianRobertson、Michael Steinhardt、Stanley Druckenmiller、Louis Bacon、Paul Tudor Jones二世、Bruce Kovner、Arthur Samberg等人都是对冲基金领域的传奇英雄。他们并不会在接下来的文章中露面,因为他们都已功成名就,不需要再证明任何东西了。本文对10位熟悉对冲基金的人士进行匿名调查,基于调查结果,对6个组别的当今最杰出的对冲基金经理进行排名。10位接受调研的人士中有5位本身就是对冲基金经理,2位在著名的投资银行中从事与冲基金相关的业务,1位是投资人,其余两位是财经记者。
  ◎ Steve Cohen /SAC投资顾问(SAC Capital Advisors)
  被议论最多的对冲基金经理。在康涅狄格州的格林威治拥有一所32000平方英尺的大房子,其建筑占地14英亩。房屋本身堪称当代建筑的伟大艺术品。2006年10月,他花了6350万美元从娱乐业巨子、梦工场(DreamWorks)共同创始人大卫o格芬(David Geffen)手里买下当代艺术大师威廉o德o库宁(Willemde Kooning)的名画Police Gazette。他的个人净资产估计高达30亿美元。老手评价:“出身草根,是位了不起的交易者,异常强悍。”
  ◎ Stephen Feinberg /Cerberus资本
  在“垃圾债券大王”米尔肯(MichaelMilken)麾下,供职于DrexelBurnhamLambert。 “秃鹫投资者”中的顶级高手。刚刚从奔驰手上买下克莱斯勒汽车公司。喜欢共和党:美国前副总统丹o奎尔(DanQuayle)就在Cerberus的团队中,前财政部长斯诺(John Snow)任公司董事长。老手评价:“最伟大的积极主义投资者之一。”
  对冲基金投资人评价:“一个安静的家伙,几乎不在任何社交场合露面的。简直是个投资机器。不露声 色地将一家危机投资公司变身为专门从事收购的公司。”
  ◎ David Tepper /Appaloosa 管理公司
  在高盛主管垃圾债券业务。1993年,步众多前高盛同事后尘,创办Appaloosa。和 Cerberus一样,在汽车行业寻找机会。与Cerberus在德尔福(Delphi)汽车配件公司一案中合作。净资产约15亿美元。老手评价:“伟大的危机投资者,同样了不起的积极主义投资者。”
  ◎ Eddie Lampert /ESL投资
  老手评价:“在管理他投资的公司时亲力亲为、兢兢业业。没什么特别的嗜好,但是个了不起的人。”对冲基金投资人评价“:他正在把西尔斯变成下一个伯克夏·哈撒威(Berkshire Hathaway)。不出意外的话,将成为下一个沃伦·巴菲特。”
  ◎ Kenneth Griffin /Citadel投资集团
  过去是最深居简出的神秘家伙。去年在出售债券为自己公司筹钱时成了媒体的红人,彼时恰逢此公从Amaranth彻底垮台中大捞了一票。以8000万美元价格从格芬手上买下现代艺术大师JasperJohns的名作False Start。净资产约17亿美元。
  ◎ Michael Novogratz /Fortress 投资集团
  Fortress投资集团总裁,2007年早些时候公司上市,和同事PeterBriger以及Wesley densortress一道赚了大钱。和本排行榜上许多人一样,事业是从高盛起步的。曾是美国空军直升机飞行员。净资产约23亿美元。
  新手评价:“爱上 Fortress的股价。”
  ◎ James Simons /复兴科技(Renaissance Technologies)
  地址:纽约East Setauket
  曾是数学教授,被誉为“黑匣投资者之王”(king of black box)。黑匣投资基金的特点是运用最为玄妙的数学运算法则,由电脑操作完成大部分投资行为。最近瞄准一项1000亿美元的基金,着实令同行目瞪口呆。收取5%的管理费和 44%的提成,为业内最高,但没人对此说三道四。净资产约40亿美元。
  对冲基金投资人评价:“和 Dalio 并称定量投资之王。”
  ◎ David Shaw /D.E.Shaw
  帮助建立了摩根士丹利的自动交易系统。曾是计算机科学教授。1988年离职后创办自己的基金公司,从事传统统计套利(statisticalarbitrage)交易。2005年退居二线,专注于生物分子科学研究,但仍然能赚到业内最高的薪水,2005年收入约为5亿美元。净资产估计10亿美元左右。老手评价“:不声不响,这家公司已经累积了大笔资产。雇佣了离开哈佛后无所事事的拉里o萨默斯(Larry Summers,曾任美国财政部长、哈佛大学校长)。”
  ◎ Clifford Asness /AQR 资本管理
  ◎ Ray Dalio /Bridgewater Associates
  如果对冲基金界有一位哲学家的话,RayDalio是不二人选。“Bridgewater是一个令我们彼此命运息息相关的社区。”“钱并不会带来幸福,而追求卓越的过程却可以。”老手评价:“真正出色的定量投资者,但投资结果好坏参半。”对冲基金投资人评价:“和 Simons 并称定量投资者之王。”
  ◎ Mark Carhart /高盛资产管理(Goldman Sachs Asset Management)
  ◎ Daniel Loeb /Third Point
  ◎ Thomes Hudson /海盗资本(Pirate Capital)
  因婚外恋被高盛解雇。开创海盗资本的本钱中有150万美元是自己的,其余50万是父母的。高调的行动主义者,最近的目标有汽车配件零售商 Pep Boys 和 Outback牛排餐厅的东主OSI饭店合伙公司。
  ◎ Israel Englander /千年管理(Millennium Management)
  ◎ Warren Lichtenstein /Steel Partners
  行动主义投资者,关注美国和日本。同他的偶像CarlIcahn一道企图收购韩国烟草商 KT&G,掀起韩国历史上最大的敌意收购战事。眼下正盯着日本的札幌控股(SapporoHoldings),这家公司为全世界的寿司老饕们耳熟能详。
  ◎ Barry Rosenstein /JANA Partners
  曾经是美林投资银行家(竟然不是高盛出来的!)。一次风帆冲浪事故造成局部瘫痪,最后通过练瑜伽康复。引人注目的行动主义投资者。追杀那些刚愎自用的公司高管,结果被人们认为已变得像Daniel Loeb一样好勇斗狠。
  ◎ Richard Chilton /Chilton投资公司
  ◎ Larry Robbins /Glenview资本管理公司
  过去曾为Leon Cooperman的欧米加顾问公司(Omega Advisor)工作。一度赌马。
  ◎ Richard Perry /Perry资本
  ◎ Lief Rosenblatt /卫星资产管理公司(Satellite Asset Management)
  曾经是索罗斯的下属。罗兹奖学金获得者(Rhodes scholar)。生活低调。
  ◎ T. Boone Pickens /BP资本管理
  ◎ Timothy Barakett /Atticus资本
  曾经回绝去新泽西魔鬼队(NewJerseyDevils)打职业冰球的机会。长期关注全球股票交易,包括纽约证交所、泛欧交易所(Euronext)和德国证交所(Deutsche Boers)。
  ◎ Stephen Mandel /孤松资本(Lone Pine Capital)
  Julian Robertson老虎基金培养出的“小老虎”之一。最近一次成功是选中了Google。和许多成功的对冲基金经理人一样出身高盛。
  ◎ James Chanos /Kynikos Associates
  少有的几个靠卖空从1990年代的大牛市中全身而退的人之一。很早发现安然(Enron)的问题,并透露给《财富》杂志记者Bethany Mclean,让后者一举成名。当然,在这个过程中自己也发了财。
  ◎ Chase Coleman /老虎全球管理(Tiger Global Management)
  老虎基金培养出来的“小老虎”。荷兰驻新阿姆斯特丹殖民地(今纽约)总督Peter Stuyvesant的后裔,正是此公的这位先人建起了让华尔街因之得名的那道墙。钟情于小公司股票。
  ◎ Peter Thiel /Clarium资本管理公司
  不收固定管理费,只拿25%提成,很少有对冲基金这么做。PayPal共同创始人。信奉自由意志,美国保守派学生报纸《斯坦福评论》创始人。副业包括风险投资,投资过Friendster、Facebook 和 li<x>nkedln等公司。电影《感谢你抽烟》的执行制片人。
  ◎ William von Mueffering /Cantillon资本管理
  曾供职于国际投资银行Lazard,其间,靠投资于科技类和通信类公司一举成名,该银行能够在对冲基金业务中占有一席之地也应归功于此公。2003年从Lazard辞职。喜欢收集黑白照片,国际摄影中心(International Center for Photography)董事会成员。
  ◎ Eric Mindich /Eton Park
  ◎ David Ganek /Level全球投资
  SAC的第一位雇员,之后自己创业。在艺术收藏界的名声与其在投资领域不相上下。崇拜后现代艺术大师杰夫·孔斯(Jeff Koons)。在寸土寸金的纽约公园大道740 号拥有住所。老手评价:“出色的财富管理者,稳健、可靠。”
  新手评价:“与前老板Steve Cohen在艺术收藏上志趣相投。”
  ◎ John Arnold /Centaurus能源公司
  3.Bridgewater Associates

Source: 海归论坛 :: 阅读主题 – [分享]对冲基金精英榜(Elite of the Hedge Fund)

October 11, 2007

Writing and Compiling A Simple Program For OpenWrt

Filed under: Uncategorized — manoftoday @ 5:03 am


Writing and Compiling A Simple Program For OpenWrt

Written by Eric Bishop <>

Part I added 8/23/2007
Part II added 10/10/2007


I’m writing this document because I found the documentation available on the OpenWrt wiki ( difficult to follow. I found myself in the position of wanting to compile a very simple program that I could run on my OpenWrt router. I ended up spending hours wading through the frustratingly incomplete documentation on the wiki, going through dozens of forum posts, and conducting extensive trial-and-error before my code would compile. I especially appreciated the examples on the wiki that contain the warning: “Note this Makefile is provided as an example only; it will not compile.” If something doesn’t work, it isn’t a very good example, is it? Here, then, is a (hopefully) more straightforward guide to building a program for OpenWrt. I found that existing documentation focuses more on porting existing, complicated programs to OpenWrt. My intention is to focus on getting a small, very simple, home-grown application running on OpenWrt. My goal is to explain this in as simple and complete a manner as possible, explaining each and every step necessary to write and compile a program that will run on OpenWrt. The process is actually very simple and straightforward — provided you know what you’re doing. For the purposes of this tutorial I’m going to assume you have a development box running linux and a router running OpenWrt. I will also assume you are at least somewhat familiar with C/C++ and standard Unix Makefiles.

The code for the examples in this tutorial can be downloaded from here. The example from the first part of the tutorial is in the openwrt-programming-examples/c directory and the example from the second part is in the openwrt-programming-examples/c++ directory.

Part I: A Simple Program in C

First, we’re going to need to write the code for the program itself and get it compiling on our local linux machine. Let’s write a simple “hello world” program that we want to run on the router:


* Helloworld.c
* The most simplistic C program ever written.
* An epileptic monkey on crack could write this code.
#include <stdio.h>

int main(void)
	printf("Hell! O' world, why won't my code compile?\n\n");
	return 0;

Alright, we have our code. Note the location of this file. Make a helloworld directory and then a src subdirectory. Place the code in the src subdirectory. Now, let’s write a standard Unix Makefile to compile this code for us:


# build helloworld executable when user executes "make"
helloworld: helloworld.o
	$(CC) $(LDFLAGS) helloworld.o -o helloworld
helloworld.o: helloworld.c
	$(CC) $(CFLAGS) -c helloworld.c

# remove object files and executable when user executes "make clean"
	rm *.o helloworld

Notice that instead of hard-coding “gcc” in the makefile to compile the program, we use a variable that holds the C compiler, $(CC). If you’re compiling a c++ program you would use $(CXX) instead of $(CC) and $(CXXFLAGS) instead of $(CFLAGS). The use of the compiler variable is not necessary to compile the code locally, but in order to compile the code for OpenWRT it is critical because we won’t be using the standard gcc compiler. Place the makefile in the same src directory our code is in. We can now go to the src directory, type “make” and the program should compile. You can run it by typing “./helloworld”

mockingbird@linuxbox:~/helloworld/src$ make
cc -c helloworld.c
cc helloworld.o -o helloworld
mockingbird@linuxbox:~/helloworld/src$ ./helloworld
Hell! O' world, why won't my code compile?

mockingbird@linuxbox:~/helloworld/src$ make clean
rm *.o helloworld

So far this should be a review on how to write simple C programs and how to use Makefiles. Now comes the tricky part, compiling the code so that it will run on our router. The router uses a distinctly different architecture than our linux development box. Because there isn’t enough memory/disk space on the router to install a compiler and compile the code natively, we need to “cross-compile” the code on our development box for use on the router. To do this we need a special compiler and development environment called the OpenWRT SDK. You can download the SDK from The SDK varies depending on the architecture of your development box, the architecture of your router and the version/release of OpenWrt your router is running. I currently have whiterussian v0.9 installed on my Linksys WRT54G router, and my development box is an i686, so the SDK I use is this one. Extract the SDK files from the downloaded archive, and enter the SDK directory, which should have the same name as the tar.bz2 file (in my case OpenWrt-SDK-Linux-i686-1).

mockingbird@linuxbox:~$ tar xfj OpenWrt-SDK-Linux-i686-1.tar.bz2
mockingbird@linuxbox:~$ cd OpenWrt-SDK-Linux-i686-1
mockingbird@linuxbox:~/OpenWrt-SDK-Linux-i686-1$ ls
dl  docs  examples  include  Makefile  package  README.SDK  scripts  staging_dir_mipsel

Our goal is to build a package for OpenWrt using the source we already have. When you execute the “make” command in the SDK directory, the SDK will compile all properly configured packages in the package subdirectory under the SDK directory. The next step (and the trickiest) is to properly configure our code so that the SDK will build it. First, copy the helloworld directory we made earlier into the package subdirectory of the SDK:

mockingbird@linuxbox:~/OpenWrt-SDK-Linux-i686-1$ cp -r ~/helloworld package

In order to tell the OpenWrt SDK how to build our program we need to create a special Makefile in the helloworld directory, above the src directory which contains our conventional makefile. Writing this file is 90% of the work involved in compiling our program for OpenWrt. Below is an OpenWrt makefile for building the helloworld program. Each section is heavily commented so that it should be fairly clear what is going on:


# OpenWrt Makefile for helloworld program
# Most of the variables used here are defined in
# the include directives below. We just need to 
# specify a basic description of the package, 
# where to build our program, where to find 
# the source files, and where to install the 
# compiled program on the router. 
# Be very careful of spacing in this file.
# Indents should be tabs, not spaces, and 
# there should be no trailing whitespace in
# lines that are not commented.

include $(TOPDIR)/

# Name and release number of this package

# This specifies the directory where we're going to build the program.  
# The root build directory, $(BUILD_DIR), is by default the build_mipsel 
# directory in your OpenWrt SDK directory

include $(INCLUDE_DIR)/

# Specify package information for this program. 
# The variables defined here should be self explanatory.
define Package/helloworld
	TITLE:=Helloworld -- prints a snarky message
	If you can't figure out what this program does, \\\
	you're probably brain-dead and need immediate \\\
	medical attention.

# Specify what needs to be done to prepare for building the package.
# In our case, we need to copy the source files to the build directory.
# This is NOT the default.  The default uses the PKG_SOURCE_URL and the
# PKG_SOURCE which is not defined here to download the source from the web.
# In order to just build a simple program that we have just written, it is
# much easier to do it this way.
define Build/Prepare
	mkdir -p $(PKG_BUILD_DIR)
	$(CP) ./src/* $(PKG_BUILD_DIR)/

# We do not need to define Build/Configure or Build/Compile directives
# The defaults are appropriate for compiling a simple program such as this one

# Specify where and how to install the program. Since we only have one file, 
# the helloworld executable, install it by copying it to the /bin directory on
# the router. The $(1) variable represents the root directory on the router running 
# OpenWrt. The $(INSTALL_DIR) variable contains a command to prepare the install 
# directory if it does not already exist.  Likewise $(INSTALL_BIN) contains the 
# command to copy the binary file from its current location (in our case the build
# directory) to the install directory.
define Package/helloworld/install
	$(INSTALL_DIR) $(1)/bin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/helloworld $(1)/bin/

# This line executes the necessary commands to compile our program.
# The above define directives specify all the information needed, but this
# line calls BuildPackage which in turn actually uses this information to
# build a package.
$(eval $(call BuildPackage,helloworld))

As indicated, most OpenWrt make files specify how to download the source of an application from a URL, and most documentation assumes that you want to do this. However, if you’re building your own application from scratch it doesn’t make sense to download from a URL. It’s much simpler to have the source locally and use the Build/Prepare section to copy the source to the build directory, as shown above. Also, be very careful of spacing in the Makefile. The indentation under the define sections should be tabs, not spaces and there should be no whitespace at the end of lines that are not comments. The trailing whitespace can be a problem when variables are being defined, as the compiler may think there is a space at the end of a directory name. If we’re copying something to dir_with_trailing_space/subdir the copy command may be executed as “cp my.file dir_with_trailing_space /subdir”. Not only don’t you want anything in /subdir, you probably dont have permission to create it and write to it.

Now we’re all set to compile the helloworld package. Go to the root SDK directory (if you’re not already there) and type “make V=99” The “V=99” option is optional, but it is useful for debugging as it instructs the compiler to be “verbose” and output all the details of what it is doing.

mockingbird@linuxbox:~/OpenWrt-SDK-Linux-i686-1$ make V=99
make package/compile
make[1]: Entering directory `/home/mockingbird/OpenWrt-SDK-Linux-i686-1'
Collecting package info...
make -C package compile SDK=1
make[2]: Entering directory `/home/mockingbird/OpenWrt-SDK-Linux-i686-1/package'
make[2]: Leaving directory `/home/mockingbird/OpenWrt-SDK-Linux-i686-1/package'
make[2]: Entering directory `/home/mockingbird/OpenWrt-SDK-Linux-i686-1/package'
make -j1 compile-targets
make[3]: Entering directory `/home/mockingbird/OpenWrt-SDK-Linux-i686-1/package'
make -C helloworld compile
make[4]: Entering directory `/home/mockingbird/OpenWrt-SDK-Linux-i686-1/package/helloworld'
CFLAGS="-Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -I/home/mockingbird/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/usr/include -I/home/mockingbird/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/include " LDFLAGS="-L/home/mockingbird/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/usr/lib -L/home/mockingbird/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/lib " make -C /home/mockingbird/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld AR=mipsel-linux-uclibc-ar AS="mipsel-linux-uclibc-gcc -c -Os -pipe -mips32 -mtune=mips32 -funit-at-a-time" LD=mipsel-linux-uclibc-ld NM=mipsel-linux-uclibc-nm CC="mipsel-linux-uclibc-gcc" GCC="mipsel-linux-uclibc-gcc" CXX=mipsel-linux-uclibc-g++ RANLIB=mipsel-linux-uclibc-ranlib STRIP=mipsel-linux-uclibc-strip OBJCOPY=mipsel-linux-uclibc-objcopy CROSS="mipsel-linux-uclibc-" CXXFLAGS="-Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -I/home/mockingbird/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/usr/include -I/home/mockingbird/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/include " ARCH="mipsel" ;
make[5]: Entering directory `/home/mockingbird/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld'
make[5]: `helloworld' is up to date.
make[5]: Leaving directory `/home/mockingbird/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld'
touch /home/mockingbird/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld/.built
install -d -m0755 /home/mockingbird/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld/ipkg/helloworld/bin
install -m0755 /home/mockingbird/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld/helloworld /home/mockingbird/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld/ipkg/helloworld/bin/
mkdir -p /home/mockingbird/OpenWrt-SDK-Linux-i686-1/bin/packages
find /home/mockingbird/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld/ipkg/helloworld -name CVS | xargs rm -rf
find /home/mockingbird/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld/ipkg/helloworld -name .svn | xargs rm -rf
find /home/mockingbird/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld/ipkg/helloworld -name '.#*' | xargs rm -f
STRIP="/home/mockingbird/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/bin/sstrip" STRIP_KMOD="mipsel-linux-uclibc-strip --strip-unneeded --remove-section=.comment" /home/mockingbird/OpenWrt-SDK-Linux-i686-1/scripts/ /home/mockingbird/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld/ipkg/helloworld /home/mockingbird/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld/ipkg/helloworld/bin/helloworld:executable
ipkg-build -c -o 0 -g 0 /home/mockingbird/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld/ipkg/helloworld /home/mockingbird/OpenWrt-SDK-Linux-i686-1/bin/packages
Packaged contents of /home/mockingbird/OpenWrt-SDK-Linux-i686-1/build_mipsel/helloworld/ipkg/helloworld into /home/mockingbird/OpenWrt-SDK-Linux-i686-1/bin/packages/helloworld_1_mipsel.ipk
make[4]: Leaving directory `/home/mockingbird/OpenWrt-SDK-Linux-i686-1/package/helloworld'
make[3]: Leaving directory `/home/mockingbird/OpenWrt-SDK-Linux-i686-1/package'
make[2]: Leaving directory `/home/mockingbird/OpenWrt-SDK-Linux-i686-1/package'
make[1]: Leaving directory `/home/mockingbird/OpenWrt-SDK-Linux-i686-1'
( \
        cd package; \
        find . -maxdepth 2 -name | \
                sed -e 's,/,,g' | \
                xargs -r -n1 make compile -C; \

It compiled! The new package, helloworld_1_mipsel.ipk, is now located in the bin/packages subdirectory of the root SDK directory.

mockingbird@linuxbox:~/OpenWrt-SDK-Linux-i686-1$ cd bin/packages
mockingbird@linuxbox:~/OpenWrt-SDK-Linux-i686-1/bin/packages$ ls

This file is a ipk file which is used by the ipkg (itsy package management) system. Ipkg is a package management system for embedded devices, where space is an issue. Let’s copy this package onto the router, which is located at on my network.

mockingbird@linuxbox:~/OpenWrt-SDK-Linux-i686-1/bin/packages$ scp helloworld_1_mipsel.ipk root@
root@'s password: 
helloworld_1_mipsel.ipk                                                            100% 1875     1.8KB/s   00:00    

Now, ssh into the router. We just copied the package to root’s home directory so we are finally ready to install our program. In root’s home directory, (where we end up immediately after connecting to the router via ssh) type “ipkg install helloworld_1_mipsel.ipk” and the ipkg system will do the rest.

mockingbird@linuxbox:~/OpenWrt-SDK-Linux-i686-1/bin/packages$ ssh root@
root@'s password: 

BusyBox v1.00 (2007.01.30-11:42+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 WHITE RUSSIAN (0.9) -------------------------------
  * 2 oz Vodka   Mix the Vodka and Kahlua together
  * 1 oz Kahlua  over ice, then float the cream or
  * 1/2oz cream  milk on the top.
root@OpenWrt:~# ls
TZ                       ip-up                    resolv.conf              spool
dhcp.leases              log                     usr
helloworld_1_mipsel.ipk  net                      run
root@OpenWrt:~# ipkg install helloworld_1_mipsel.ipk
Installing helloworld (1) to root...
Configuring helloworld
Successfully terminated.

The executable has now been installed into the /bin directory on the router, per our instructions in the OpenWrt Makefile listed above. So, all we have to do to run the program is type “helloworld” at the prompt. Note that because the executable has been installed to the /bin directory you should be able to execute the program no matter what directory you are in on the router.

root@OpenWrt:~# helloworld
Hell! O' world, why won't my code compile?


It works! Great success!


Now that you have a simple program compiling, you can start expanding on it to do whatever you want. If you run into problems I suggest you browse existing package Makefiles to see if someone else has done something similar to what you are trying to do. You can browse the files for these packages here. If you still have problems, browse the posts on the developer forum to see if anyone else has had a similar problem. If not, post your problem to the forum with a detailed explanation of what you’re trying to do, your OpenWrt Makefile and the errors you’re getting. Hopefully, some experienced developer will be kind enough to help out. Please do not email me personally if you have a problem with your code. If, however, you believe there is an error or serious omission in this tutorial, please let me know. I am relatively new to working with OpenWrt and it is certainly possible that I’ve made a mistake somewhere in this document. I have, however, personally tested all code included here on my own setup, and made every effort to be as accurate as possible.

Good luck with your programming!

Part II: C++ and the Standard Template Library (STL)

If you only want to compile C programs, the first part of my tutorial should be enough to get you started. However, if you want to use C++ there is another issue you’re likely to run into. Let’s say we want to compile the following C++ program for OpenWrt:


* Helloworld.cpp
#include <iostream>
#include <string>

using namespace std;

int main()
	string s = "Hell! O' world, why won't my c++ code run?\n\n";
	cout << s;
	return 0;

So, let’s do exactly as we did before and see what happens. We just have to update the compiler flags in the Makefile to indicate that we’re using a C++ compiler instead of a C compiler, right?

NOTE: This code will compile but not run, further modifications are needed which are described below

# build helloworld executable when user executes "make"
helloworld: helloworld.o
	$(CXX) $(LDFLAGS) helloworld.o -o helloworld
helloworld.o: helloworld.cpp
	$(CXX) $(CXXFLAGS) -c helloworld.cpp

# remove object files and executable when user executes "make clean"
	rm *.o helloworld

If you use the exact same OpenWrt Makefile as before, this program will compile just fine. It will even install properly when you copy the helloworld_1_mipsel.ipk file to the router and type “ipkg install helloworld_1_mipsel.ipk” However, watch what happens if you try to run the program:

root@OpenWrt:~# helloworld
helloworld: can't load library ''

So, what went wrong? The problem is that this program uses strings and iostreams which are a feature of the C++ standard template library (STL). However, because memory is so critical in an embedded application like OpenWrt, the standard template library is not available. Instead, we need to link to a special implementation of the standard library for embedded devices called uClibc++. This library implements the same functions and data structures as the standard library but takes up less memory.

Before we adjust our Makefiles to use to this alternate library, let’s first make sure that it’s installed on the router so that it is available to link to. Log into your router. Then, make sure your list of packages is up to date by using the “ipkg update” command:

root@OpenWrt:~# ipkg update
Updated list of available packages in /usr/lib/ipkg/lists/0.9-backports
Updated list of available packages in /usr/lib/ipkg/lists/X-Wrt
Updated list of available packages in /usr/lib/ipkg/lists/whiterussian
Updated list of available packages in /usr/lib/ipkg/lists/non-free
Successfully terminated.

Once you have updated your package list, install uclibc++ by typing “ipkg install uclibc++” If you do not have uclibc++ installed this should install it:

root@OpenWrt:~# ipkg install uclibc++
Installing uclibc++ (0.1.11-2) to root...
Configuring uclibc++
Successfully terminated.

Otherwise, if the library is already installed, you’ll see this confirmation:

root@OpenWrt:~# ipkg install uclibc++
Package uclibc++ (0.1.11-2) installed in root is up to date.
Nothing to be done
Successfully terminated.

Now it’s time to modify the Makefiles. First, the one in the src directory. Only a small change is necessary here, to the line where we link the objects together. We need to be able to tell the linker to link to another library, and the way we do that is by defining a variable called $(LIBS). The variable will be defined in the special OpenWrt Makefile, but will be used here, so we need to add it to the end of the line which specifies how to do the linking:


# build helloworld executable when user executes "make"
helloworld: helloworld.o
	$(CXX) $(LDFLAGS) helloworld.o -o helloworld $(LIBS)
helloworld.o: helloworld.cpp
	$(CXX) $(CXXFLAGS) -c helloworld.cpp

# remove object files and executable when user executes "make clean"
	rm *.o helloworld

The OpenWrt Makefile needs a slightly more complex modification. Recall the comment I placed in the OpenWrt Makefile we used before, “We do not need to define Build/Configure or Build/Compile directives. The defaults are appropriate for compiling a simple program such as this one.” Well, guess what? In order to link to uclibc++ we need to customize how we’re going to compile the program, and we’re going to do this in the Build/Compile directive. Before we re-define this directive to suit our purposes, let’s see what the default looks like:

TAKEN FROM: ~/OpenWrt-SDK-Linux-i686-1/include/

define Build/Compile/Default
		ARCH="$(ARCH)" \

This code specifies the make command (the third line) and a bunch of flags and parameters for compilation. In order to link to uClibc++ we add the definition of the $(LIBS) variable as “-nodefaultlibs -lgcc -lc -luClibc++” Also, we need to specify “-nostdinc++” in the compiler flags to tell the compiler that c++ standard template library functions and data structures will be linked to in specified external libraries and not the standard libraries:


# OpenWrt Makefile for helloworld program
# Most of the variables used here are defined in
# the include directives below. We just need to 
# specify a basic description of the package, 
# where to build our program, where to find 
# the source files, and where to install the 
# compiled program on the router. 
# Be very careful of spacing in this file.
# Indents should be tabs, not spaces, and 
# there should be no trailing whitespace in
# lines that are not commented.

include $(TOPDIR)/

# Name and release number of this package

# This specifies the directory where we're going to build the program.  
# The root build directory, $(BUILD_DIR), is by default the build_mipsel 
# directory in your OpenWrt SDK directory

include $(INCLUDE_DIR)/

# Specify package information for this program. 
# The variables defined here should be self explanatory.
define Package/helloworld
	TITLE:=Helloworld -- prints a snarky message
	If you can't figure out what this program does, \\\
	you're probably brain-dead and need immediate \\\
	medical attention.

# Specify what needs to be done to prepare for building the package.
# In our case, we need to copy the source files to the build directory.
# This is NOT the default.  The default uses the PKG_SOURCE_URL and the
# PKG_SOURCE which is not defined here to download the source from the web.
# In order to just build a simple program that we have just written, it is
# much easier to do it this way.
define Build/Prepare
	mkdir -p $(PKG_BUILD_DIR)
	$(CP) ./src/* $(PKG_BUILD_DIR)/

# The Build/Compile directive needs to be specified in order to customize compilation
# and linking of our program.  We need to link to uClibc++ and to specify that we 
# do NOT want to link to the standard template library.
# To do this we define the LIBS variable.  To prevent linking to the standard libraries we 
# add "-nodefaultlibs" to the $(LIBS) variable and then specify "-lgcc -lc" to ensure that 
# there are no unresolved references to internal GCC library subroutines. Finally 
# "-luClibc++" to link to the  uClibc++ library.  Also, we need to specify "-nostdinc++" 
# in the compiler flags to tell the compiler that c++ standard template library functions
# and data structures will be linked to in specified external libraries and not the 
# standard libraries.
define Build/Compile
		LIBS="-nodefaultlibs -lgcc -lc -luClibc++" \
		ARCH="$(ARCH)" \

# Specify where and how to install the program. Since we only have one file, 
# the helloworld executable, install it by copying it to the /bin directory on
# the router. The $(1) variable represents the root directory on the router running 
# OpenWrt. The $(INSTALL_DIR) variable contains a command to prepare the install 
# directory if it does not already exist.  Likewise $(INSTALL_BIN) contains the 
# command to copy the binary file from its current location (in our case the build
# directory) to the install directory.
define Package/helloworld/install
	$(INSTALL_DIR) $(1)/bin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/helloworld $(1)/bin/

# This line executes the necessary commands to compile our program.
# The above define directives specify all the information needed, but this
# line calls BuildPackage which in turn actually uses this information to
# build a package.
$(eval $(call BuildPackage,helloworld))

That’s it! That modification should be sufficient to enable linking to uClibc++. Compile it as before, copy the .ipk file to the router, install it with ipkg and run it:

mockingbird@linuxbox:~/OpenWrt-SDK-Linux-i686-1$ make clean
rm -rf build_* bin
mockingbird@linuxbox:~/OpenWrt-SDK-Linux-i686-1$ make
make package/compile
make[1]: Entering directory `/home/mockingbird/OpenWrt-SDK-Linux-i686-1'
Collecting package info...
make -C package compile SDK=1
make[2]: Entering directory `/home/mockingbird/OpenWrt-SDK-Linux-i686-1/package'
make[2]: Leaving directory `/home/mockingbird/OpenWrt-SDK-Linux-i686-1/package'
make[2]: Entering directory `/home/mockingbird/OpenWrt-SDK-Linux-i686-1/package'
make[4] -C package compile-targets
make[5] -C package/helloworld compile
make[2]: Leaving directory `/home/mockingbird/OpenWrt-SDK-Linux-i686-1/package'
make[1]: Leaving directory `/home/mockingbird/OpenWrt-SDK-Linux-i686-1'
( \
        cd package; \
        find . -maxdepth 2 -name | \
                sed -e 's,/,,g' | \
                xargs -r -n1 make compile -C; \
mockingbird@linuxbox:~/OpenWrt-SDK-Linux-i686-1$ scp bin/packages/helloworld_1_mipsel.ipk root@
root@'s password: 
helloworld_1_mipsel.ipk                                                100% 2570     2.5KB/s   00:00    
mockingbird@linuxbox:~/OpenWrt-SDK-Linux-i686-1$ ssh root@
root@'s password: 

BusyBox v1.00 (2007.01.30-11:42+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 WHITE RUSSIAN (0.9) -------------------------------
  * 2 oz Vodka   Mix the Vodka and Kahlua together
  * 1 oz Kahlua  over ice, then float the cream or
  * 1/2oz cream  milk on the top.
root@OpenWrt:~# ipkg install helloworld_1_mipsel.ipk
Installing helloworld (1) to root...
Configuring helloworld
Successfully terminated.
root@OpenWrt:~# helloworld
Hell!  Why won't my c++ code run?

It works! Our Jedi programming skills have prevailed!

Once again, please do not contact me about any issues you might have with your own programs. If, however, you think there is an error in one of my examples or that I have omitted a critical detail, please contact me and I will try to resolve the issue as soon as possible.

This tutorial is provided under the Creative Commons License, version 3.0.

Source: Writing and Compiling A Simple Program For OpenWrt

Error 1068 When Starting WZC – Tech Support Forum

Filed under: Uncategorized — manoftoday @ 3:41 am


Today I became aware that my computer also had this problem (HP dv100 with Intel (R) Pro/Wireless Adapter), so I did an extensive search on the internet to get it to work (including this post).
As you mention it, if you try to start the WZCSVC service in the MMC, an error code appears referring to its parent services appears (1068, this parent services are Remote Procedure Call and something called NDIS Protocol [I have no idea what this is… ¬¬]). So, if you check the RPC service, it must be enabled (system essential), but you cannot find the other “service”.
I have also seen answers referring to disabling any 3rd Party Wireless Management Software (but I don’t have one, so it cannot be that).
However, I did find such Protocol Service in the regedit, and I found out it was disabled (it was set to 4). So, in sum, I recommend you to go to
and check that the “Start” Value is set to 1, 2 or 3 (I set it to 1).
And this solved my problem, after a System Restart the Wireless Zero Config Service can be readily started.
Note: today I found a couple of Win32 Trojan and Worms and a fake service called DirectX.exe, located on the System Directory and considered as a Blaxe and LogPole Virus o_O (I already got rid of it). Maybe they had something to do with this problem.
I hope this works for you, and if it does, there are many posts on other forums related to this, maybe you can spread the info.

Source: Error 1068 When Starting WZC – Tech Support Forum

October 10, 2007

Tunneling trafiic over SSH with OpenWRT, DynDNS and Putty

Filed under: Uncategorized — manoftoday @ 12:57 am


1)  Tunneling HTTP over SSH

To connect to the SSH server and tunnel HTTP you will need the Putty SSH client.

To connect to your router enter the hostname or IP address of your router on the Session tab:

Next, to setup the tunnel.  click on Tunnels, enter 3000 (or whatever local port you’d like to use) for the source port, click Dynamic and click Add. This will create a SOCKS proxy on your local machine on port 3000 (or whatever port your chose) that you can use with your web browser.

Now you can click Open to log into your router. The tunnel isn’t created until you log in. Remember that your username is root and your password is your router password (you changed it right?).

Now you’re ready to connect your web browser. Using Firefox, you will have to configure a proxy server. Click Tools->Options->advanced. Then under Network tab, click on Settings… button . On the popup window screen, you can configure the SOCKS proxy that you’ve set up using Putty. Select Manual proxy configuration, enter localhost for the SOCKS host and 3000 for the port (or whatever you used). Click OK. You should now be tunneling through your home router over ssh.  after the setting, you have to close ALL OPENED firefox windows and restart Firefox to make it effect.


You can verify that the connections are being forwarded by looking at the Putty Event Log. You should see something similar to the following after loading in your web browser.

or verify by closing the putty session, then you won’t be able to view any webpage.


Source: Random Bits: HOWTO: Tunneling HTTP over SSH with DD-WRT, DynDNS and Putty

2)  Tunneling VNC over SSH


3)  Tunneling RemoteDesktop over SSH

Configure PuTTY for auto-login (if you choose to use PuTTY):

suppose sshd is on port 22 in your wireless router which has OpenWrt.

open putty

- type in your dyndns ip address of your router
- choose port 22
- connection -> SSH -> Tunnels
- source Port:  <--- NOTE here, mstsc can't connect to, so we have to use
- Destination -> ip_address_of_your_home_PC_Server_behind_OpenWrt:3389   (if remote desktop is used)
- press add
- open the connection to your router
- if you don't have free internet access, you can use also a proxy server to connect.
- if proxy is needed: connection -> proxy
- proxy type: http
then run windows terminal service client: mstsc , and connect to

in the following example, home windows server is running at with both windows terminal service running at port 3389(default) and VNC services at 5900(default)


4)  Configure PuTTY for auto-login

Configure PuTTY for auto-login (if you choose to use PuTTY):

  1. Make a shortcut to putty.exe on your Desktop
  2. Right click the shortcut, Properties > Shortcut tab > Target field
  3. Add the following to the end of the string in the field: -load “[your profile name]” -l [login name] -pw [password]
  4. Example: -load “home” -l Mark -pw mypassword
Older Posts »

The Silver is the New Black Theme. Create a free website or blog at


Get every new post delivered to your Inbox.