Subscribe For Free Updates!

We'll not spam mate! We promise.

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 !!! function cala_day(form) { var nMonth = parseInt(form.month.options[form.month.selectedIndex].value); var nDay = parseInt(form.day.options[form.day.selectedIndex].value); var...

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...

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)...

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() { /* ... */ ...

How do I put the code of methods outside classes?

How do I put the code of methods outside classes? It is possible to put in a class only the prototype of the methods, and to put all the algorithms outside. This is recommended, because it allows the programmer to read a short prototype of the class, and makes re-usability easier: // in a header file (.h file) struct A { int a; A(); virtual...

How do I free the memory allocated to a class?

How do I free the memory allocated to a class? The method called when the memory occupied by a class is freed is called the destruc- tor. With derived classes, destructor should always be virtual. If a class is destroyed through a base class pointer whose destructor isn't virtual, the result is unde ned (only part of the destructors will be called). struct...

How do I call a parent constructor?

How do I call a parent constructor? struct A { A() { /* ... */ } }; struct B { B(): A() { /* ... */ } // call to parent's constructor. ...

How do I initialize a const member?

How do I initialize a const member? Since the value of a const member cannot be assigned with operator =, its value must be initialized as follows: struct A { const int id; A(int i): id(i) {} // attribute id is initialized to the value of parameter i ...

How do I initialize members of a class?

How do I initialize members of a class? There are two ways. struct A { int a; int b; A(): a(0) { b = 0; } // attribute a and b are initialized to 0 ...

How do I create an instance of a class?

How do I create an instance of a class? The methods called when a class is created are called contructors. There are four possible ways of specifying constructors; the fth method is worth mentioning for clarifying reasons:   default constructor  copy constructor  value constructor  conversion constructor  copy assignment (not a constructor) struct...

How do I use private, protected or public?

How do I use private, protected or public? Restricting access to member is important to prevent illicit use. Use them in this order of increasing preference: public, protected, privat...

Who has access to class members?

Who has access to class members? There are three levels of access to members  private : access is granted only to the class' methods and to friend functions and classes (Question 6.17 explains friend).  protected : access is granted only to the methods and to derived classes' meth- ods.  public : access is granted to everyone. Restricting...

How do I use class and struct?

How do I use class and struct? A C++ struct (or class) is almost like a struct in C (i.e. a set of attributes), but has two additional kinds of members: methods and data types. A class' method has to be used with an instance of that class. The important is that methods have always access to their instance's attributes and data types. struct...

C++ Functions

C++ Functions 1 How do I declare, assign and call a pointer to a function? int f(int, char) { // ... } // ... int (*pf)(int, char); // pointer to a function pf = f; // assignment pf = &f; // alternative int r = (*pf)(42, 'a'); 2 How do I declare a type of a pointer to a function? typedef int (*pf)(int, char); 3 How do I declare an array...

How do I use references?

How do I use references? A reference is merely an initialized pointer. This reduces signi cantly zero pointer and un-initialized pointers errors. Prefer references to pointers. Although the two following codes look equivalent, the second implementation prevents invalid compilation. // in C // in C++ int i; int i; int *pi = &i; int &ti...

How do I use namespaces?

 How do I use namespaces? Namespace allow to code di erent entities without bothering about unicity of names. A namespace is a logical entity of code. A namespace can be included into another namespace (and so on). If a namespace is anonymous, its code is only accessible from the compilation unit (.cpp le), thus equivalent to using static...

What is C++

What is C++? C++ is C with classes. It was designed for one person to manage large amounts of code, and so that a line of C++ express more thing than a line of C. The main functionality C++ adds to C are:  control of the accessibility to code within the source les (namespace, struct and class).  mechanisms that make a line of code more...

Quick notes to C programmers

Quick notes to C programmers: instead of macros use           - const or enum to de ne constants           - inline to prevent function call overload           - template to declare families of type and families of functions use new/delete instead of free/malloc...

Apr 7, 2013

Convert php array to javascript array

Convert php array to javascript array Create php array first, <?php $arrPhp=array("1","2","3","4","5'); ?> Create javascript array second <script> var arrJava=new Array(); </script> var arrJava=new Array(); Now assign php array value to javascript array value <script> <?php for($i=0;$i<count($arrPhp);$i++) echo...

Remove special charecter using javascript

remove special charecter using javascript: <input type="text" onkeyup="checkspl(this)";> /*--- this code in script place ---*/ function checkspl(as)                 {                      var dd=as.value;            ...

Trim spaces from starting and ending of string using javascript

Trim spaces from starting and ending of string using javascript function removeSpace ()  { var str=document.getElementById("tex").value; str[t] = str[t].replace(/^\s+/, ''); for (var i = str.length - 1; i >= 0; i--) {      if (/\S/.test(str.charAt(i))) {                    ...

Hide files from Gallery or Music Player in android mobile

Instead of deleting the files or moving them to your computer all of the time, you can hide them in just a few seconds. All you need to do is create a folder called .nomedia wherever you want on your sdcard (you can do this from your phone by selecting Menu button -> Create Folder), then put the particular files on that folder and the files...

Split operators from string in javascript

1. First Method to remove operators:  '123+456-321'.split(/([-+\/*])/) // gives == ["123", "+", "456", "-", "321"]  2. Second Method to remove operators: <script type="text/javascript"> var strIn = '123+456-321'; var tarrN = strIn.split(/\D/); var tarrO = strIn.split(/\+|\-|\*|\//); alert(tarrN.join('\n')+'\n\n'+tarrO.joi...

PHP - To get IP address

The following code is used to get ip address by using PHP get_ip_address() (Custom function by John) get_ip_address -- Retrieves Ip adres from user and checks for proxy server. Description (string) get_ip_address() This simple function checkes whether the uses is behind a (transparent) proxy, and returns the found IP adres. Function function...

PHP simple Memcache implementation

Description: You can use this class to simply cache your data with Memcache in PHP. Requirements - PHP 5.3 or higher (you can change "__construct" to "cache" to make it work in older versions) - Memcache extention installed (how to install the Memcached extention?) - Memcached installed on a server (how to install Memcached?) cache.php Save the...

Data Cards 2G/ 3G GPRS Settings for all network operators

Reliance APN: rcomnet Access Number: *99# Aircel APN: aircelgprs Access Number: *99***1# Idea APN: internet Access Number: *99# Docomo APN: TATA.DOCOMO.INTERNET Access Number: *99# Airtel APN: airtelgprs.com Access Number: *99# BSNL 3G APN: bsnlnet Access Number: *99# BSNL 2G APN: bsnlnet Access Number: *99# MTNL 3G Postpaid: APN: mtnl3g Prepaid...

Connect Samsung galaxy y to PC for Internet

Connect Samsung galaxy y to PC for Internet The following steps are used to connect your Galaxy mobile with your PC / Laptops STEP 1 :- Download Samsung KIES and Install it on your PC. STEP 2 :- Now Open Samsung Kies and Plug the Mobile USB to PC. STEP 3 :- It will start automatically Installing Samsung galaxy Drivers and Check...

Samsung Galaxy Y Secret Codes

Samsung Galaxy Y Secret Codes are given below. *#*#4636#*#* - phone information *2767*3855# - hard reset *#*#7780#*#* - factory reset *#*#7594#*#* - change end call/ power option *#*#197328640#*#* - service mode *#*#273283*255*663282*#*#* - file copy screen (backup media files) *#*#526#*#* - wlan test *#*#232338#*#*...