Q:

Use of glBindAttribLocation function in OpenGL ES

I dont get the use of glBindAttribLocation function in OpenGL ES 2.0 
Can some one give me the full context ?  Is it something like 
g_pLightDir = g_pEffect10->GetVariableByName( "g_LightDir" )->AsVector();

in DirectX 10 ?  Read online in various sites, but couldn't get the use of this function.  Help needed.. 

A:

This function let's you specify an attribute index for a user defined shader attribute (not for a uniform, as your code sample suggests), which you later use when refering to the attribute. 
Say you have a vertex shader:
...
attribute vec4 vertex;     //or 'in vec4 vertex' in modern syntax
attribute vec3 normal;
...

You then can bind indices to those variables, with
glBindAttribLocation(program, 0, "vertex");
glBindAttribLocation(program, 1, "normal");

You can use whatever non-negative numbers you like (in a small range).  Then when refering to these attributes you use their indices, e.g. in glVertexAttribPointer or glEnableVertexAttribArray functions. 
But keep in mind that glBindAttribLocation has to be called before linking the program.  You can also omit it.  Then OpenGL automatically binds indices to all used attributes during linking, which can later be queried by glGetAttribLocation.  But with glBindAttribLocation you can establish your own attribute index semantics and keep them consistent. 
The newer GLSL versions even allow you to specify the attribute indices within the shader (using the layout syntax), removing the need for either glBindAttribLocation or glGetAttribLocation, but I'm not sure if this is supported in ES. 
But my answer doesn't tell you more than those "various" sites you looked at or any good OpenGL/GLSL book, so if you still don't get it, delve a little deeper into the basics of GLSL.