Archive for the ‘Technical Sciences’ Category

I wanted to share with my readers about somethings I believe are ideas that can earn any one big revenue. They are not all mine but I have from people who just happened to think about them but may not be in a process to implement them. Nonetheless, I don’t want the ideas to be left unadopted just coz the guy who though was not ready enough to implement it.

The idea is to build a website like stackoverflow.com for people for people who would be preparing for technical interviews. I know there already are websites like career cup who have great questions categorized by companies and topics. I still feel there needs to a place where a person would be able to real genuine content for answers to interview questions, be able to read about interview experiences, tips for the preparation and also be able to rate answers based on their may be algorithmic complexity, approach, simplicity and other parameters. Candidates would also want to know the salaries offered to people, training programs and other important information about the company. One may say that all of this stuff is already there, but my take is its unorganized, unreliable and there is no motivation for any1 to actually share answers to the interview questions.

If you would build a website having company profile with tabs for interview experiences, salaries, questions -filtered by category and tags, ratings for difficulty level on positions, etc. And if you would keep a motivation elements for readers to post questions, share approaches, rate answers, mark answers final by keeping a point mechanism and badges/caps… it would certainly grow big.

I also believe that you should have moderators to close any ambiguous questions, wrong answers and marking any particular answer the most correct.

I am 100% convinced for if the website is really developed properly, it would earn a lot of traffic and users.

Most importantly, it would help a lot of people to prepare for their interviews and settle in good companies. This would really be the best service one can offer and I likely that people would like to donate some amount once they land up in their dream companies.

I say that it would have a lot of traffic is because every student will

Given the following C declarations, what does each one mean?
1.) int (*p)[ 5 ];

2.) char *x[ 3 ][ 4 ];

3.) int *(*a[ 10 ])();

4.) int (*t[])();

C declarations can sometimes be quite complex – and interviewers love to test out the ability of candidates to break down and understand those declarations. The way to approach this problem is to use a general method that will help you read any C declaration – otherwise, you can easily find yourself very confused. Here’s a good rule to follow when trying to make sense of a C declaration:

Start at the variable name, also known as the identifier. Without skipping a right parenthesis, look right and say what you see – even if you see nothing continue. Without skipping a left parenthesis look left again and say what you see. If you are currently inside a pair of parentheses, jump outside this level. Look right and say what you see. Look left and say what you see. Keep doing this until you say the variable type or return type.

An important note: you should always remember that functions and arrays are read left-to-right and have precedence over pointers, which are read right-to-left.

Before reading the answers, it is best to use the rule given, and try it out for yourself. For the first example, we start at p. We look right and there is a parenthesis, which we don’t want to skip until we look left. So we look left and get that p is a pointer. Now, we can jump outside the parentheses, and we look right and find an array of size of 5, so now we can add to our statement that p is a pointer to an array of size 5. Now, we look left and find the ‘int’, so we can finish our declaration by saying that p is “a pointer to an array of 5 ints”.

For the second example, we start with x. We look right and find an array composed of 3 arrays of size 4. You may have been tempted to jump back left to the pointer after reading out “array of size 3”, but you must note that arrays take precedence over pointers, so continuing on with the second array is important. So now we see that x is an array composed of 3 arrays of size 4, and the next step is to move left. We see a pointer, so now we can say that “x is an array composed of 3 arrays of 4 pointers to char”.

For the last two examples, we’ll just be giving the answers, since you should be able to figure them out on your own now. In the third example, a is “an array of 10 pointers to functions returning an int pointer”. For the fourth example, t is “an array of pointers to functions returning an int”.

What’s the difference between const char *p, char * const p and const char *
const p?
const char *p –
This is a pointer to a constant char. One cannot change the value
pointed at by p, but can change the pointer p itse
lf.
*p = ‘A’ is illegal.
p = “Hello” is legal.
Note that even char const *p is the same!
const * char p – This is a constant pointer to (nonconst)
char. One cannot change
the pointer p, but can change the value pointed at
by p.
*p = ‘A’ is legal.
p = “Hello” is illegal.
const char * const p –
This is a constant pointer to constant char! One cannot
change the value pointed to by p nor the poin
ter.
153
*p = ‘A’ is illegal.
p = “Hello” is also illegal.
To interpret these declarations, let us first consider the general form of declaration:
[qualifier] [storage-class] type [*[*]..] [qualifier] ident ;
or
[storage-class] [qualifier] type [*[*]..] [qualifier] ident ;
where,
qualifier:
volatile
const
storage-class:
auto extern
static register
type:
void char short
int long float
double signed unsigned
enum-specifier
typedef-name
struct-or-union-specifier
Both the forms are equivalent. Keywords in the brackets are optional. The simplest tip
here is to notice the relative position of the `const’ keyword with respect to the asterisk
(*).
Note the following points:
• If the `const’ keyword is to the left of the asterisk, and is the only such keyword in
the declaration, then object pointed by the pointer is constant, however, the
pointer itself is variable. For example:
const char * pcc;
char const * pcc;
• If the `const’ keyword is to the right of the asterisk, and is the only such keyword
in the declaration, then the object pointed by the pointer is variable, but the
154
pointer is constant; i.e., the pointer, once initialized, will always point to the same
object through out it’s scope. For example:
char * const cpc;
• If the `const’ keyword is on both sides of the asterisk, the both the pointer and the
pointed object are constant. For example:
const char * const cpcc;
char const * const cpcc2;
One can also follow the “nearness” principle; i.e.,
• If the `const’ keyword is nearest to the `type’, then the object is constant. For
example:
char const * pcc;
• If the `const’ keyword is nearest to the identifier, then the pointer is constant. For
example:
char * const cpc;
• If the `const’ keyword is nearest, both to the identifier and the type, then both the
pointer and the object are constant. For example:
const char * const cpcc;
char const * const cpcc2;
However, the first method seems more reliable…

In order to setup virtual directory on my machine and letting IIS server serve my pages(with extensions .asp, .aspx), I came across certain issues that I will address in the following document.

Running IIS

Windows XP, Vista or Windows 7 do not have IIS installed by default. Inorder to install it, go to Control Panel à Programs and Features -> Turn windows features on or off. In the dialog box find Internet Information Services and check on the checkboxes under it as shown below.

Solution: Firstly make sure that while installing your IIS you had clicked on Static Content option under Common HTTP Features Section.

Sometimes even after that, the browser doesn’t render any css or javascript files.

Problem is with IIS 7 that it needs to be told explicitly for mapping the .css, .image files and javascript files to be run by IIS 7.

To do so, follow the steps:

1. In your IIS Manger, click on your virtual directory and switch to features view (from down bottom button).2. Double click on Handler Mappings. It opens a dialog page showing all the existing mappings. On right it gives certain links to add managed handler3. Click on Add Managed Handler. In the dialog, add a mapping for .css files as shown1. Hit OK to save2. Similarly, do a Add Managed Handler for other extensions like .js,.png,.jpg and gif.3. Now when you browse your pages from your IIS, they should render css, display images and javascript should work.