Subscribe For Free Updates!

We'll not spam mate! We promise.

May 2, 2013

JQuery to Find window Height


JQuery to set div in center of screen:

 The following code is used to find the center position of the any size of the screen. here i set the div in center of the screen using jquery.

  "$(window).height()" this function is used to get hight of the window(Screen).


var divCenter= $('#div_id');
divCenter.css("top", ($(window).height() - divCenter.height())/2  + 'px');

You can change this code whatever you find like screen height, width etc.

May 1, 2013

Find Browser and Platform Details Using JavaScript


Find Browser and Platform Details Using JavaScript:

The following code is used to find the Browser and Platform details. This script displays browser code name, browser name, browser version, cookies enabled disabled details, platform details and user agent header details.


<script>
"Browser CodeName: " + navigator.appCodeName + "";
"Browser Name: " + navigator.appName + "";
"Browser Version: " + navigator.appVersion + "";
"Cookies Enabled: " + navigator.cookieEnabled + "";
"Platform: " + navigator.platform + "";
"User-agent header: " + navigator.userAgent + "";
</script>


Apr 27, 2013

Day of Week Finder


Day of Week Finder:

This tool is helps you to find the day for the given date. Just select the date and month from the select box and enter the year in text field and press the "OK" button to get the day of your date. Enjoy !!!

Day of Week Finder
Date:

Month:

Year: e.g. 2013




Your Day is

Display Coding in blogspot Post



Display Coding in blogspot Post :

This tool is used to display your HTML program codes in blogger post. To get the converted code, just copy your HTML code and paste in the text area and click "Get Converted Code" button. Now the converted code is displayed below the text area box. You can copy that converted code and paste it in your blogger post to display the code in HTML format.


Enter Your Code Here.
       
       
       




Apr 14, 2013

How do I declare a method that returns a pointer to a function?



How do I declare a method that returns a pointer to a function?

The following method takes parameter a char and returns a pointer to a function. To
avoid this heavy syntax, you may use a typedef.
struct A
{
void (*m(char))(int) { /* ... */ }
};
// ...
A a;
void (*pf)(int);
pf = a.m('a');

How can I handle easily a pointer to a method?



How can I handle easily a pointer to a method?

If you use templates, you won't have to write the annoying type of a pointer to a method (at the 'cost' of using a template). You can also use typedef to declare the type.

struct A
{
void m() {}
};
template
void f(A &a
8
PMETHOD pm)
{
(a.*pm)()
}
void function()
{
A a;
f(a, &A::m);
}

How do I declare, assign and call a pointer to a method?



How do I declare, assign and call a pointer to a method?

Note that a pointer to a method does not hold a second pointer to an instance of a
class. To use a pointer to a method, you need an instance of the class onto which this
method can be called (possibly a second pointer).

struct A
{
void m(int) {}
};
void function()
{
void (A::*pm)(int) = &A::m; // pointer on method
A a; // instance of a class
(a.*m)(1); // calling the method with parameter value 1.
}

How do I put the code of methods outside classes in a header file?



How do I put the code of methods outside classes in a header file?

The code of a method speci ed in a header le must be declared inline. It means that when compiling, the calls to the method will all be replaced by the code of that method.

struct A
{
int a;
A();
};
inline A::A()
{
/* ... */
};