Skip to main content

Posts

jQuery Color Picker

This tutorial is to see how to do simple color picker using jQuery. There are various jQuery plugins providing color picker feature. This tutorial gives a simple example code as a guideline to start writing your own jQuery color picker plugin. In this example, we are using CSS selectors to show color palette. On clicking each color in the palette we store the selected color into a pointer to be applied to the target DIV. We are using jQuery CSS function to pick and apply colors to the target DIV. HTML Code for Color Palette: This is the HTML code for showing color palette to pick colors. It shows four colors with separate DIV tags. <div class= "circular-div" id= "blue" onClick= "pickColor(this.id);" ></div> <div class= "circular-div" id= "red" onClick= "pickColor(this.id);" ></div> <div class= "circular-div" id= "yellow" onClick= "pickColor(this.id);...

PHP include() Vs require()

Including files is very useful when you want to include the same PHP, HTML, or text on multiple pages of a website. For example, if we want to create an instance of a class defined in the separate class file, then it has to be included before creating an instance of it. PHP provides various functions to include external files. The following list of functions is used to include external file into a PHP program.n this tutorial, we are going to compare these functions with suitable examples. Also, we are going to see the purpose of the _once usage and the difference between include and include_once/require and require_once. include() require() include_once() require_once() include(): PHP include() function includes external file into a PHP program. It accepts the external file path and checks if the file exists or not. If the file does not exist in the specified path, then the include() will return PHP warning. Warning : failed to open stream : No such file or directory ... W...

How to view and debug PHP arrays

Sometimes when coding or debugging in PHP, it’s helpful to see the entire contents of an array. An easy way to do this is with the print_r command. To make it more readable, wrap it in <pre> tags. For example, to see the contents of associative array $result: <pre> <? = print_r ( $result ) ?> </pre> You’ll see output like this: Array (     [key1] => value1     [key2] => value2     [key3] => value3 ) 1

How to rename a file or directory in ubuntu from terminal

There is no rename function in Ubuntu Linux. Instead, you simply move the file, giving it a new name. If you don’t actually mv it to another directory, then you have effectively renamed it: mv filename_original filename_new If you are trying to rename a directory, you need to use the -r recursive flag: mv -r original_directoryname new_directoryname

How to Check the Ubuntu Version

How to Check the Ubuntu Version.         Command used : more /etc/issue      This will return something like this:      Output  : Ubuntu 14.04.5 LTS \n \l

Send Email via SMTP server using PHPMailer

Email sending is the most useful feature for web application. mail() function in PHP is used to send mail from PHP script.While sending email using mail() ,the mail will be sent from web server. Sometimes it may cause issues on sending an email and fails to deliver. With SMTP you can overcome this issue,when you send an email through SMTP server email will be sent through mail server  rather than web server.       The easiest way to send email in PHP with SMTP is to use PHPMailer library. PHPMailer provides an ability to send email via SMTP server in PHP. In this tutorial, you’ll show how you can send HTML email with SMTP in PHP using PHPMailer. Send Email via SMTP server: PHPMailer library: The script uses PHPMailer to send the email via SMTP server, so PHPMailer library needs to be included first. Include the PHPMailerAutoload.php file and create a new PHPMailer instance. <?php require ( "phpmailer/PHPMailerAutoload.php" ); $mail = new ...