Get Major Training|Project Training|Live Project|Industrial Training On Android| I-Phone | Java | J2SE | J2EE | C#.Net | ASP.Net| PHP | PHP with Wordpress | Joomla | Majento Contact us

Showing posts with label PHP Basic. Show all posts
Showing posts with label PHP Basic. Show all posts

Thursday

how to take mysql backup using php

Many time we are have to take mysql server database back up since we need it and it can be done by using cpanel for our server but what if when we don't have a cpanel or we don't want to give our client but our client wants to take regular backup of database then we can make a simple script file to take backup

like below 

< ?php
$datestamp = date("Y-m-d");      // Current date to append to filename of backup file in format of YYYY-MM-DD

/* CONFIGURE THE FOLLOWING SEVEN VARIABLES TO MATCH YOUR SETUP */
$dbuser = "";            // Database username
$dbpwd = "";            // Database password
$dbname = "";            // Database name. Use --all-databases if you have more than one
$filename= "backup-$datestamp.sql.gz";   // The name (and optionally path) of the dump file
$to = "you@remotesite.com";      // Email address to send dump file to
$from = "you@yourhost.com";      // Email address message will show as coming from.
$subject = "MySQL backup file";      // Subject of email

$command = "mysqldump -u $dbuser --password=$dbpwd $dbname | gzip > $filename";
$result = passthru($command);

$attachmentname = array_pop(explode("/", $filename));   // If a path was included, strip it out for the attachment name

$message = "Compressed database backup file $attachmentname attached.";
$mime_boundary = "< <<:" . md5(time());
$data = chunk_split(base64_encode(implode("", file($filename))));

$headers = "From: $from\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: multipart/mixed;\r\n";
$headers .= " boundary=\"".$mime_boundary."\"\r\n";

$content = "This is a multi-part message in MIME format.\r\n\r\n";
$content.= "--".$mime_boundary."\r\n";
$content.= "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n";
$content.= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$content.= $message."\r\n";
$content.= "--".$mime_boundary."\r\n";
$content.= "Content-Disposition: attachment;\r\n";
$content.= "Content-Type: Application/Octet-Stream; name=\"$attachmentname\"\r\n";
$content.= "Content-Transfer-Encoding: base64\r\n\r\n";
$content.= $data."\r\n";
$content.= "--" . $mime_boundary . "\r\n";

mail($to, $subject, $content, $headers);

unlink($filename);   //delete the backup file from the server
?>

Enjoy PHP !!
Continue Reading →

How to Disable Browser Back Button website javascript

Hi

Many times we are comes to a situation for which we have to disable our browser default back button and don't allow user to go back

like in a online examination website we cant go backward

we are sharing a simple javascript for disabling Browser Back Button

 Just use a simple javascript that will force the webpage to go forward once the back button is being triggered.

<body onUnload="noBack()">
<script>
function noBack()
{
window.history.forward(1);
}
</script>

These code is compatible to all of the modern browser  
Continue Reading →

Sunday

PHP Basic URL Rewriting expained

PHP Basic URL Rewriting expained

What is Mod URL Rewrite… A basic understanding?
Mod URL Rewrite mean to
a.) A fancy URL.
b.) A URL that is Search Engine Friendly.
C.) A URL that is user friendly too.
So, Mod URL Rewrite means to create a fancy web URL that is User and Search Engine Friendly too.
Example:
Original URL
www.yourwebsite.com/home.php
Fancy URL
www.yourwebsite.com/myhome
Another Example:
Original URL
www.yourwebsite.com/post.php?year=2011&month=3
Fancy URL
www.yourwebsite.com/post/2011/3
Modification from original URL to a Fancy URL is done by Rewrite Engine.
Pros and Cons of Using Mod URL Rewrite:
Pros:
1.) A clean and fancy url gives transparency to human readable.
2.) Clean and fancy urls are easily indexes by Search Engines.
3.)  Simple and elegant way to achieve Search Engine Optimization.
4.)  Hides our page extension and directory structure.
5.)  Safety from Hotlinks, which consumes our band width.
Cons:
1.) Emphasis on Server Load.(read further to know more)
2.) If a user wants to modify a URL to retrieve new data, the rewrite engine may stuck to the construction of custom URL due to the lack of named variables.
For example, it’s difficult to identify the date from the following URL:
http://www.yourdomain.com/post/12/10/2006/
In this case, the original URL was more useful,
Since the query string denotes month and day:
http://www. yourdomain.com/post.php/ year=2006&month=12&day=10
What is Rewrite Engine?
Rewrite Engine is software that modifies the URL appearance, this modification is called as URL Rewriting.
How Rewrite Engine Works?
Before moving towards the URL Rewriting module.
You must ensure that your server is able to handle URL Rewrite request. By default an apache installation comes with Rewrite Module installed on it, but it is disabled by default.
So to enable this you have to contact to your hosting provider.
What the hosting provider will do?
They will open the apache server configuration file httpd .conf
And remove # (comment) from the following line:
# LoadModule rewrite_module modules/mod_rewrite.so

Save the httpd .conf file and restart the apache server.Congrats! Now you are able to use Mod URL Rewrite Engine.
Let’s Start rewriting :
URL writing can be achieved by two popular ways.
1.)  Using . htaccess file, it is not more than a simple text file but having a very strong utility in itself. You must be familiar with this file because this allows you to set all kinds of server options. A simple example (a custom 404 Not Found Page)
Moreover, this file is interpreted each time by apache server when you made any request.
1.)  Using httpd .conf file, this file resides almost all type of server configurations. You can write your mod rewrite rule inside this file.
But you can do so when you have root access.
Which method is to choose???
Depending upon the following factor let we identify which method is best for you…
a.)  Load Issue: A critical question comes in the mind when using new things.
Consider a scenario, you have a very huge site like ebay and you want to use mod URL Rewrite in this.
Obliviously, use of . htaccess file for this purpose emphasis directly on Server Load, because as we know . htaccess file interprets every time by apache server for its each request.
Hence, you should use httpd .conf file for this purpose. As it compile once.
b.) Performance: Performance of a webpage or web portal is another big issue.

Consider another scenario,
You have 1000 of visitors a day, again . htaccess file may reduce the performance of your webportal.
Hence, you should use httpd .conf file for this also.
C.)    Easyness: Most of the time we have small and medium level WebPages that has moderate amount of visitors. And Want to promote your website on Search Engine Indexing as well.
The easiest way to do this is using . htaccess file, because this file is in our control. So we can edit it any time.
Thus, as per your requirement you can choose any of above method.
For the sake of all the users we will use . htaccess file in this tutorial.
Follow the steps:
1.) Connect to server via FTP and download the . htaccess file to you local machine from document root i.e. from public_html folder.
Important: Keep the orginal . htaccess file on some safe place, in case if we did anything wrong it may cause to our site down, so immediately we can replace this by old one.
2.) The best practice to start with Mod URL Rewrite is to download the whole site on our local machine’s WAMP/LAMP server. And edit . htaccess file.
3.) Now Open . htaccess file in your favorite text editor.
It may be possible this file contents some text or content nothing.
4.) Now you have to add following commands in your . htaccess:
a.) +FollowSymLinks is one of security feature of rewrite engine. You can’t use the rewrite module without this line
         Options +FollowSymLinks
b.) Finally most important requirement is to turn the rewrite engine on.
         RewriteEngine On
I strongly suggest you to begin you rewriting code with following two commands:
          Options +FollowSymLinks

          RewriteEngine On
c.) Following command explicitly set the Base URL for our rewrites.
          RewriteBase /
Now Write Rewrite Rule:
Each Rewrite Rule is executed by  a command RewriteRule
Syntax to write a rule is:
RewriteRule FANCY_NAME ORIGINAL_NAME
For Example:
The existing url is :
www.yourdomain.com/xyz.php
And I want this  :
www.yourdomain.com/extras
More redable.
Hence, Rewrite Rule for this would be:
RewriteRule     ^extras$      xyz.php
Where ^ indicates that a pattern must start with extras and $ indicates that a patter must ends with extras. See this is based on Regular expressions. For better understanding of this you must read the Regular Expression basic tutorial.
Now what this Rewrite Rule will do.
When we hit the URL www.yourdomain.com/extras on our web browser. The . htaccess file matches the patter extras and execute its RewriteRule Command to call the contents of xyz.php.
It looks like, www.yourdomain.com/extras is working independently but actually it is fetching the content of xyz.php using the Rewrite Rule pattern matching.
Hence the actual URL is modified but it contents remain the same.
Thus, the final . htaccess file will look like:
Options +FollowSymLinks

RewriteEngine On

RewriteBase /

RewriteRule     ^extras$      xyz.php

RewriteRule     ^about-us$     about.php

RewriteRule     ^home$     index.php
Again fancy URLs are :
http://www.yourdomain.com/homehttp://www.yourdomain.com/extrashttp://www.yourdomain.com/about-us
Last but not the least; Since this is the basic tutorial for Mod URL Rewrite, so we have to stop here.
Continue Reading →

Saturday

How to Stop user from cagetory deletion

CMS Tutorial:How to Stop user from cagetory deletion

WordPress is like a heaven for the programmer and for designer both. With the introduction of wordpress, blogging moves to next level . All of us know that wordpress is highly customizable and in any manner but there are several things which becomes pain for the beginner developer or wordpress programmer.

One of the reason for the pain is, “Categories”. Categories helps us in grouping the posts so it is easy for manage and beneficial for reader and for programmer also. But sometimes it happens that programmer creates a category which is treated as top level category , which we dont want to delete anyhow , so as to maintain the smooth functionality of our blog / site, as we can create custom files for categories on the basis of category slug / ID and so on.
So overcome the fear of category deletion , we can write some piece of code in our theme’s functions.php file , which will helps us to overcome the fear of category deletion .
The piece of code for preventing the category deletion is provided below :


As you can see , you just have to pass the array of category id’s in the first line and then no one is able to delete the defined category from wp-admin .
Continue Reading →

Thursday

How to remove duplicate row form Database PHP Basic

PHP Basic : How to remove duplicate row form Database

To remove the all the duplicate entries from a particular mysql table, use the below mysql query : Step : 1
 What the above query does is, it will create a new table with the filtered data (all duplicate entries were deleted).

 Note : replace the whole [COLUMN TO remove duplicates BY] with your column name

 Step 2: After that delete the old table
 

Step 3 : rename the new table
 
Continue Reading →

PHP BASIC How to get chatting on php website

How to get chatting on php website!!

Arrowchat is one of the powerful tool for chatting between users or friends of website,

 There’s a easy installation options for many CMS like wordpress, joomla and drupal but they provide a file integration.php for core installation also,

 You can find this file in “includes” Folder. You need to change in 3 functions : get_online_list get_link get_avatar get_online_list :

 This function is important because it shows list of online users
 
Above is the original function provided by arrowchat, You’ve to just modify query nothing else Check above example :
 


 get_link : This function is also important, its hyperlink (Profile Link) on name of online users
 Original Function :
 

Modified Example :

 

get_avatar : This function is also important because it shows avatar (Profile Pics) of users while chatting : Original Function :
 
Modified Example :
 
Continue Reading →

Sunday

Basic Interview Questions [YOU-MUST- KNOW]

Vinayak informatics is a leading PHP training in indore
we are discussing Basic Interview Questions Based on C++ since Basically freshers have to face interviews on it.

Please Take a Look
Basic Interview Questions [YOU-MUST- KNOW]

1.    What is C++
     C++ is created by BjarneStroustrup of AT&T Bell Labs as an extension of C, C++ is an object-oriented computer language used in the development of enterprise and commercial applications. Microsoft’s Visual C++ became the premier language of choice among developers and programmers.
2.    What are the basic concepts of object oriented programming?
     It is necessary to understand some of the concepts used extensively in object oriented programming.These include
    Objects
    Classes
    Data abstraction and encapsulation
    Inheritance
    Polymorphism
    Dynamic Binding
    Message passing
3.    Define inheritance?
     The mechanism of deriving a new class (derived) from an old class (base class) is called inheritance. It allows the extension and reuse of existing code without having to rewrite the code from scratch. Inheritance is the process by which objects of one class acquire properties of objects of another class.
4.    Define polymorphism?
     Polymorphism means one name, multiple forms. It allows us to have more than one function with the same name in a program.It allows us to have overloading of operators so that an operation can exhibit different behaviours in different instances.
5.    What is encapsulation?
     The wrapping up of data and functions into a single unit (called class) is known as encapsulation. Encapsulation containing and hiding information about an object, such as internal data structures and code.
6.    What is message passing?
     An object oriented program consists of a set of objects that communicate with each other. Message passing involves specifying the name of the object, the name of the function and the information to be sent.
7.    What are tokens in C++?
     The smallest individual units of a program is known as tokens. c++ has the following tokens :    Keywords
    Identifiers
    Constants
    Strings
    Operators
8.    What is the use of enumerated data type?
     An enumerated data type is another user defined type which provides a way for attaching names to numbers thereby increasing comprehensibility of the code. The enum keyword automatically enumerates a list of words by assigning them values 0,1,2, and so on.
9.    What is the use of default constructor?
     A constructors that accepts no parameters is called the default constructor.If no user-defined constructor exists for a class A and one is needed, the compiler implicitly declares a default parameterless constructor A::A(). This constructor is an inline public member of its class. The compiler will implicitly define A::A() when the compiler uses this constructor to create an object of type A. The constructor will have no constructor initializer and a null body.
10.    Define Constructors?
     A constructor is a member function with the same name as its class. The constructor is invoked whenever an object of its associated class is created.It is called constructor because it constructs the values of data members of the class.
11.    How variable declaration in c++ differs that in c?
     C requires all the variables to be declared at the beginning of a scope but in c++ we can declare variables anywhere in the scope. This makes the programmer easier to understand because the variables are declared in the context of their use.
12.    Define destuctors?
     A destructor is called for a class object when that object passes out of scope or is explicitly deleted.A destructors as the name implies is used to destroy the objects that have been created by a constructors.Like a constructor , the destructor is a member function whose name is the same as the class name but is precided by a tilde.
13.    What is a class?
     A class is a collection of objects.
14.    what is the difference between c &c++?
     c++ia an object oriented programing but c is a procedure oriented programing.c is super set of c++. c can't suportinheritance,function overloading, method overloading etc. but c++ can do this.In c-programe the main function could not return a value but in the c++ the main function shuld return a value.
15.    What is copy constructor?
     Copy constructor is a constructor function with the same name as the class and used to make deep copy of objects.
16.    What is default constructor?
     A default constructor is a constructor that either has no parameters, or if it has parameters, all the parameters have default values.
17.    What is a scope resolution operator?
     The scope resolution operator permits a program to reference an identifier in the global scope that has been hidden by another identifier with the same name in the local scope.
18.    What is the difference between Object and Instance?
     An instance of a user-defined type is called an object. We can instantiate many objects from one class.
An object is an instance of a class.
19.    What is the difference between macro and iniine?
     Inline follows strict parameter type checking, macros do not.
Macros are always expanded by preprocessor, whereas compiler may or may not replace the inline definitions.
20.    How variable declaration in c++ differs that in c?
     C requires all the variables to be declared at the beginning of a scope but in c++ we can declare variables anywhere in the scope. This makes the programmer easier to understand because the variables are declared in the context of their use.
21.    What is multiple inheritance?
     A class can inherit properties from more than one class which is known as multiple inheritance.
22.    what is the use of virtual destructor in c++?
     A destructor is automatically called when the object is destroyed. A virtual destructor in C++ is used primarily to prevent resource leaks by performing a clean-up of the object.
23.    What do you mean by reference variable in c++?
     A reference variable provides an alias to a previously defined variable.
Data -type & reference-name = variable name
24.    What do you mean by implicit conversion?
         Whenever data types are mixed in an expression then c++ performs the conversion automatically.
    Here smaller type is converted to wider type.
    Example : in case of integer and float integer is converted into float type.
25.    What are virtual functions?
         The virtual fuctions must be members of some class.
    They cannot be static members.
    They are accessed by using object pointers.
    A virtual function can be a friend of another class.
26.    What is the difference between class and structure?
         By default, the members ot structures are public while that tor class is private.
    structures doesn’t provide something like data hiding which is provided by the classes.
    structures contains only data while class bind both data and member functions.
27.    What are storage qualifiers in C++ ?
     ConstKeyword 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.
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.
28.    What is virtual class and friend class?
     Friend classes are used when two or more classes and virtual base class aids in multiple inheritance.
Virtual class is used for run time polymorphism when object is linked to procedure call at run time.
29.    what is an abstract base class?
     An abstract class is a class that is designed to be specifically used as a base class. An abstract class contains at least one pure virtual function.
30.    What is dynamic binding?
     Dynamic binding (also known as late binding) means that the code associated with a given procedure call is not known until the time of the call at run time.It is associated with polymorphism and inheritance.
31.    what is difference between function overloading and operator overloading?
     A function is overloaded when same name is given to different function.
While overloading a function, the return type of the functions need to be the same.
32.    What are the advantages of inheritance?
         Code reusability
    Saves time in program development.
33.    What is a dynamic constructor?
     The constructor can also be used to allocate memory while creating objects. Allocation of memory to objects at the time of their construction is known as dynamic construction of objects.The memory is allocated with the help of the new operator.
34.    What is the difference between an Array and a List?
     The main difference between an array and a list is how they internally store the data. whereas Array is collection of homogeneous elements. List is collection of heterogeneous elements.
35.    What is the use of ‘using’ declaration?
     A using declaration makes it possible to use a name from a namespace.
36.    What is the difference between a template class and class template?
     Template classA generic definition or a parameterized class not instantiated until the client provides the needed information. It’s jargon for plain templates.
Class templateA class template specifies how individual classes can be constructed much like the way a class specifies how individual objects can be constructed. It’s jargon for plain classes.
37.    What is friend function?
     The function declaration should be preceded by the keyword friend.The function definitions does not use either the keyword or the scope operator ::. The functions that are declared with the keyword friend as friend function.Thus, a friend function is an ordinary function or a member of another class.
38.    What is a scope resolution operator?
     A scope resolution operator (::), can be used to define the member functions of a class outside the class.
39.    What do you mean by pure virtual functions?
     A pure virtual member function is a member function that the base class forces derived classes to provide. Any class containing any pure virtual function cannot be used to create object of its own type.
40.    What is a conversion constructor?
     A converting constructor is a single-parameter constructor that is declared without the function specifier explicit. The compiler uses converting constructors to convert objects from the type of the first parameter to the type of the converting constructor’s class.
41.    What is a container class? What are the types of container classes?
     A container class is a class that is used to hold objects in memory or external storage. A container class acts as a generic holder. A container class has a predefined behavior and a wellknown interface. A container class is a supporting class whose purpose is to hide the topology used for maintaining the list of objects in memory. When a container class contains a group of mixed objects, the container is called a heterogeneous container; when the container is holding a group of objects that are all the same, the container is called a homogeneous container.
42.    What is Associative container?
     Associative containers are designed to support direct access to elements using keys. They are not sequential. There are four types of associatives containers :
    Set
    Multiset
    Map
    Multimap
43.    What is an iterator?
     Iterators are like pointers. They are used to access the elements of containers thus providing a link between algorithms and containers. Iterators are defined for specific containers and used as arguments to algorithms.
44.    What are the defining traits of an object-oriented language?
     The defining traits of an object-oriented langauge are :
    Encapsulation
    Inheritance
    Polymorphism
45.    Name some pure object oriented languages?
         Smalltalk
    Java
    Eiffel
    Sather
46.    What is this pointer?
     It is a pointer that points to the current object. This can be used to access the members of the current object with the help of the arrow operator.
47.    What is encapsulation?
     Encapsulation (or information hiding) is the process of combining data and functions into a single unit called class.
48.    What is problem with Runtime type identification?
     The run time type identification comes at a cost of performance penalty. Compiler maintains the class.
49.    What are the differences between new and malloc?
         New initializes the allocated memory by calling the constructor. Memory allocated with new should be released with delete.
    Malloc allocates uninitialized memory.
    The allocated memory has to be released with free.new automatically calls the constructor while malloc(dosen’t)
50.    What is conversion operator?
     You can define a member function of a class, called a conversion function, that converts from the type of its class to another specified type.
51.    What is difference between template and macro?
     A template can be used to create a family of classes or function.A template describes a set of related classes or set of related functions in which a list of parameters in the declaration describe how the members of the set vary.
Identifiers that represent statements or expressions are called macros.
52.    What is reference?
     Reference is a name that acts as an alias, or alternative name, for a previously defined variable or an object.
53.    What are the access specifier in c++?
     There are three types of access specifier in c++ . They are
    Public
    protected
    private
54.    What is difference between C++ and Java?
        C++ has pointers Java does not.
   Java is the platform independent as it works on any type of operating systems.
    java has no pointers where c ++ has pointers.
    Java has garbage collection C++ does not.
55.    What is namespace?
     The C++ language provides a single global namespace.Namespaces allow to group entities like classes, objects and functions under a name.
56.    What is an explicit constructor?
     A conversion constructor declared with the explicit keyword. The compiler does not use an explicit constructor to implement an implied conversion of types. It’s purpose is reserved explicitly for construction.Explicit constructors are simply constructors that cannot take part in an implicit conversion.
57.    What is the use of storage class specifiers?
     A storage class specifier is used to refine the declaration of a variable, a function, and parameters. The following are storage class specifiers :
    auto   register  static  extern
58.    what is assignment operator in c++?
     Default assignment operator handles assigning one object to another of the same class. Member to member copy (shallow copy).
59.    Can destructor be private?
     Yes destructors can be private. But according it is not advisable to have destructors to be private.
60.    What is strstream?
     stringstream provides an interface to manipulate strings as if they were input/output streams.
‹ strstream› to define several classes that support iostreams operations on sequences stored in an allocated array of char object.
61.    What are the types of STL containers?
         deque
   hash map
    hash multimap
    hash_multiset
    hashset
    list
    map
    multimap
    multiset
    set
    vector.
62.    What is the difference between method overloading and method overriding?
     Overloading a method (or function) in C++ is the ability for functions of the same name to be defined as long as these methods have different signatures (different set of parameters).
Method overriding is the ability of the inherited class rewriting the virtual method of the base class.
63.    What do you mean by inline function?
     An inline function is a function that is expanded inline when invoked.ie. the compiler replaces the function call with the corresponding function code. An inline function is a function that is expanded in line when it is invoked. That is the compiler replaces the function call with the corresponding function code (similar to macro).
64.    What is a template?
     A template can be used to create a family of classes or function.A template describes a set of related classes or set of related functions in which a list of parameters in the declaration describe how the members of the set vary.
65.    What is a copy constructor and when is it called?
     A copy constructor is a method that accepts an object of the same class and copies it members to the object on the left part of assignement.
66.    What is the difference between a copy constructor and an overloaded assignment operator?
     A copy constructor constructs a new object by using the content of the argument object. An overloaded assignment operator assigns the contents of an existing object to another existing object of the same class.
67.    What is a virtual destructor?
     The simple answer is that a virtual destructor is one that is declared with the virtual attribute.
68.    What do you mean by Stack unwinding?
     It is a process during exception handling when the destructor is called for all local objects between the place where the exception was thrown and where it is caught.
69.    What is STL? and what are the components of stl?
     A collection of generic classes and functions is called as Standard Template Library (STL).The stl components are

    containers
    Algorithm
    Iterators.
70.    What is a modifier?
     A modifier, also called a modifying function is a member function that changes the value of at least one data member. In other words, an operation that modifies the state of an object. Modifiers are also known as mutators.
71.    What is an adaptor class or Wrapper class?
     A class that has no functionality of its own. Its member functions hide the use of a third party software component or an object with the non-compatible interface or a non-objectoriented implementation.
72.    What is a Null object?
     It is an object of some class whose purpose is to indicate that a real object of that class does not exist. One common use for a null object is a return value from a member function that is supposed to return an object with some specified properties but cannot find such an object.
73.    What is class invariant?
     A class invariant is a condition that defines all valid states for an object. It is a logical condition to ensure the correct working of a class. Class invariants must hold when an object is created, and they must be preserved under all operations of the class. In particular all class invariants are both preconditions and post-conditions for all operations or member functions of the class.
74.    What is the difference between the message and method?
     Message : Objects communicate by sending messages to each other.A message is sent to invoke a method.
Method : Provides response to a message and it is an implementation of an operation.
75.    How can we access protected and private members of a class?
     In the case of members protected and private, these could not be accessed from outside the same class at which they are declared. This rule can be transgressed with the use of the friend keyword in a class, so we can allow an external function to gain access to the protected and private members of a class.
76.    What do you mean by late binding?
     Late binding refers to function calls that are not resolved until run time. Virtual functions are used to achieve late binding. When access is via a base pointer or reference, the virtual function actually called is determined by the type of object pointed to by the pointer.
77.    What is virtual function?
     A virtual function is a member function that is declared within a base class and redefined by a derived class .To create a virtual function, the function declaration in the base class is preceded by the keyword virtual.
78.    What do you mean by early binding?
     Early binding refers to the events that occur at compile time. Early binding occurs when all information needed to call a function is known at compile time. Examples of early binding include normal function calls, overloaded function calls, and overloaded operators. The advantage of early binding is efficiency.


Feel free to add your experience in the form of Comments !!

Join Vinayak Informatics at Indore !
Continue Reading →

Saturday

PHP BASIC List of American States

 List of USA States
 
--
-- Table structure for table `states`
--
 
CREATE TABLE `states` (
  `abbreviation` varchar(2) NOT NULL,
  `state` text,
  PRIMARY KEY  (`abbreviation`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
--
-- Dumping data for table `states`
--
 
INSERT INTO `states` (`abbreviation`, `state`) VALUES
('AL', 'Alabama'),
('AK', 'Alaska'),
('AZ', 'Arizona'),
('AR', 'Arkansas'),
('CA', 'California'),
('CO', 'Colorado'),
('CT', 'Connecticut'),
('DE', 'Delaware'),
('FL', 'Florida'),
('GA', 'Georgia'),
('HI', 'Hawaii'),
('ID', 'Idaho'),
('IL', 'Illinois'),
('IN', 'Indiana'),
('IA', 'Iowa'),
('KS', 'Kansas'),
('KY', 'Kentucky'),
('LA', 'Louisiana'),
('ME', 'Maine'),
('MD', 'Maryland'),
('MA', 'Massachusetts'),
('MI', 'Michigan'),
('MN', 'Minnesota'),
('MS', 'Mississippi'),
('MO', 'Missouri'),
('MT', 'Montana'),
('NE', 'Nebraska'),
('NV', 'Nevada'),
('NH', 'New Hampshire'),
('NJ', 'New Jersey'),
('NM', 'New Mexico'),
('NY', 'New York'),
('NC', 'North Carolina'),
('ND', 'North Dakota'),
('OH', 'Ohio'),
('OK', 'Oklahoma'),
('OR', 'Oregon'),
('PA', 'Pennsylvania'),
('RI', 'Rhode Island'),
('SC', 'South Carolina'),
('SD', 'South Dakota'),
('TN', 'Tennessee'),
('TX', 'Texas'),
('UT', 'Utah'),
('VT', 'Vermont'),
('VA', 'Virginia'),
('WA', 'Washington'),
('WV', 'West Virginia'),
('WI', 'Wisconsin'),
('WY', 'Wyoming'),
('DC', 'District of Columbia');
Continue Reading →

Thursday

PHP Basic how to unzip Files online

Unzip Files in Web server .

Continue Reading →

Wednesday

PHP Basic covert seconds into dau time

Convert seconds to days hour and minutes in php .


Call in action:

$timediffer we get it from our previous function.
Continue Reading →

Tuesday

PHP Basic How to get difference of dates

Get date difference PHP.


Call In Action

Continue Reading →

PHP BASIC Random password generation using PHP


Random password generation using PHP.
Option-1

echo substr(md5(uniqid()), 0, 8);


Option-2

function rand_password($length){

$chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
$chars .= '0123456789' ;
$chars .= '!@#%^&*()_,./<>?;:[]{}\|=+';

$str = '';
$max = strlen($chars) - 1;

for ($i=0; $i < $length; $i++)
$str .= $chars[rand(0, $max)];

return $str;

}

echo rand_password(16);

Continue Reading →

PHP Basic Using Cookies

Using Cookies in PHP.

Continue Reading →

PHP Basic Get age from DOB

PHP function to get age for date of birth.

Continue Reading →

Monday

How to chance color of header

Script,to change the color/ opacity of header when page scrolls upward.

Visit Vinayakinformatics.com
Continue Reading →

PHP Basic Youtube Videos

Display thumbnail image from youtube or vimeo video.

Continue Reading →

PHP Basic Showing String limited characters

PHP function to display limited words from a string.

Continue Reading →

PHP Basic 1 Mysql Database Connection

PHP Basic 1

MySQL Database connection using PHP.

<?php

 $host="localhost";
 $uname="database username";
 $pass="database password";
 $database = "database name";
 $connection=mysql_connect($host,$uname,$pass) 
 or die("Database Connection Failed");
 
 $result=mysql_select_db($database)
 or die("database cannot be selected");
 
?>
Continue Reading →