Wednesday, October 12, 2016

What is the difference between MySQL, MySQLi and PDO?


MySQL The mysql functions are procedural and use manual escaping.

// mysql
$mysql = mysql_connect('localhost','username','password','database');

MySQLi is a replacement for the mysql functions, with object-oriented and procedural versions. It has support for prepared statements.

// mysqli, procedural way
$mysqli = mysqli_connect('localhost','username','password','database');
// mysqli, object oriented way
$mysqli = new mysqli('localhost','username','password','database');

PDO (PHP Data Objects) is a general database abstraction layer with support for MySQL among many other databases. It provides prepared statements, and significant flexibility in how data is returned.

// PDO
$pdo = new PDO("mysql:host=localhost;dbname=database", 'username', 'password');

Create Modal from HTML and CSS

HTML

<a href="#openModal">Open Modal</a>
<div id="openModal" class="modalDialog">
    <div>
<a href="#close" title="Close" class="close">X</a>
        <h2>Modal Box</h2>
        <p>This is a sample modal box that can be created using the powers of CSS3.</p>
        <p>You could do a lot of things here like have a pop-up ad that shows when your website loads, or create a login/register form for users.</p>
    </div>
</div>

CSS

.modalDialog {
    position: fixed;
    font-family: Arial, Helvetica, sans-serif;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 99999;
    opacity:0;
    -webkit-transition: opacity 400ms ease-in;
    -moz-transition: opacity 400ms ease-in;
    transition: opacity 400ms ease-in;
    pointer-events: none;
}
.modalDialog:target {
    opacity:1;
    pointer-events: auto;
}
.modalDialog > div {
    width: 400px;
    position: relative;
    margin: 10% auto;
    padding: 5px 20px 13px 20px;
    border-radius: 10px;
    background: #fff;
    background: -moz-linear-gradient(#fff, #999);
    background: -webkit-linear-gradient(#fff, #999);
    background: -o-linear-gradient(#fff, #999);
}
.close {
    background: #606061;
    color: #FFFFFF;
    line-height: 25px;
    position: absolute;
    right: -12px;
    text-align: center;
    top: -10px;
    width: 24px;
    text-decoration: none;
    font-weight: bold;
    -webkit-border-radius: 12px;
    -moz-border-radius: 12px;
    border-radius: 12px;
    -moz-box-shadow: 1px 1px 3px #000;
    -webkit-box-shadow: 1px 1px 3px #000;
    box-shadow: 1px 1px 3px #000;
}
.close:hover {
    background: #00d9ff;
}


RESULT


Saturday, October 8, 2016

15 Highest Paying Programming Languages In 2016


As the ever-expanding world of technology continues to grow in its reach, so too do the various jobs, skills, and programming languages. Since the dot-com bubble of the 1990s and early 2000s, we’ve seen a great proliferation of various programming languages, and that growth shows no signs of slowing. Indeed, some lists suggest there are close to 300 different languages one can learn. It’s no secret that coding skills are highly sought after and often very well compensated in the workforce, but no one can learn every language, and some skills are more valuable than others. As the tech industry continues to evolve and progress, it’s important to know how to choose a programming language to learn, what the best way to learn that language is, and how your choice might affect your employment future.
One key consideration, as with any job, is the salary you can expect after you’ve picked up your new skill. With that in mind, here are the fifteen highest paying programming languages for 2016:
  1. Java
With the motto “Write once, run anywhere,” Java has become a nearly ubiquitous concurrent language that can run on just about any platform imaginable, meaning developers who have mastered the language are always in high demand. Senior level Java developers can often expect salaries as high as $115,000.
  1. Python
A highly versatile and very readable language, Python is used heavily by major players in the tech industry, such as Google and NASA, and senior-level Python developers can easily fetch a $100,000+ salary.
  1. R
Otherwise known as GNU S, the R programming language is specialized for statistical computing and graphics development. Widely used by data miners and statisticians for data analysis, R can fetch some very high salaries exceeding $100,000, because the language is so specialized.
  1. Objective-C
A modernized upgrade to its predecessor C, Objective-C is the main language used by Apple to develop its OS X and iOS platforms. It is used heavily by Apple for their APIs, Cocoa and Cocoa Touch. Because of Apple’s reliance on the language, Objective-C can fetch top-notch developers a salary that is close to six figures.
  1. Swift
A relatively new language on the market as a streamlined companion to Objective-C, Swift has exploded in popularity recently as the main programming language for Cocoa and Cocoa Touch, Apple’s frameworks supporting iOS, OS X, watchOS, and tvOS. Demand and salaries are still on the rise for this young language, and Swift’s affiliation with Apple means a skillset that includes this language could easily earn six figures in the near future.
  1. C#
Developed by Microsoft and part of the foundational family of C programming languages, C# (pronounced “see sharp”) is known for its simplicity and wide general usage. C# developers can easily earn a solid $90,000+ in salary.
  1. JavaScript
As one of the three main technologies for World Wide Web content production, it should be no surprise that JavaScript developers are among the most in-demand on the market. Whether it’s running a website on any browser without the need for plugins, implementing site-specific browsers or developing desktop widgets, there’s always work for a JavaScript developer. A senior JavaScript developer can typically expect a salary of at least $90,000.
  1. Perl
Technically a family of related languages, Perl is generally known best as a popular CGI scripting language and is also used for graphics programming, system administration, and even some financial applications. Salaries vary based on the specific use, but Perl’s versatility means its programmers are always in high demand and can often expect a salary of no less than $80,000.
  1. C++
Another member of the famous C family, C++ is best known for being an efficient and flexible language that is used to develop large systems such as desktop applications and server platforms. A very well-known and reliable language, C++ can often fetch its developers a salary of at least $80,000.
Recommended for You
  1. SQL
Short for Structured Query Language, SQL is a special-purpose language whose main function in development is managing the data in databases and data streams. It has grown widely in popularity recently and can demand salaries well into the $80,000 range.
  1. Ruby on Rails
Also known simply as “Rails,” Ruby on Rails has earned a very respectable reputation in recent years for its popular default structures for databases, web services and web pages. A Ruby on Rails job can consistently haul in a healthy salary of $75,000+.
  1. C
Famous for the original “Hello, World!” program, C is one of the bedrock languages of modern computing and remains an incredibly useful language for efficiently mapping machine instructions for applications and operating systems. As it’s one of the most widely-known languages of all time, C developers are always in high demand, with salaries typically ranging anywhere from $60,000-$80,000.
  1. PHP
Most often used specifically for server-side functions like web development, PHP has grown tremendously in popularity in recent years. Its web-facing features make it a highly-demanded skill, and PHP developers can easily claim salaries of over $75,000.
  1. T-SQL
Short for Transact-Structured Query Language, T-SQL is closely related to its predecessor, SQL, serving as the main line of communication with the SQL server for any application’s user interface. T-SQL is a very specific language that requires a certain skillset, so while it may not be in as high demand as some other language, specialists still get compensated well for mastery of the language and can pull in an average salary of over $70,000.
  1. Ruby
Not to be confused with Ruby on Rails, Ruby is a sophisticated, modernized take on classic languages like C and PERL that emphasizes simplicity through natural syntax and easy-to-read code. Its broad appeal means even entry level developers can fetch salaries pushing $60,000, and senior level developers can earn salaries close to six figures.
It’s well documented that there is a shortage of top tech talent in the market, so no matter which of these highly lucrative languages you choose to tackle, you can’t go wrong. Start mastering one of these languages now and rest assured that your skillset will be in high demand.

Read more at business2community.com

Friday, October 7, 2016

How to Install WordPress Using Xampp Server

What is XAMPP?

XAMPP stands for cross-platform, Apache, MySQL, PHP and Perl. It’s a simple and lightweight solution that allows you to create a local web server for testing purposes.
Since XAMPP is cross-platform, it also works on Mac and Linux, but today we’re going to focus on how to set up XAMPP on Windows 10.
WordPress isn’t a stand-alone application and requires server software in order to run. XAMPP provides the necessary environment needed to run WordPress on a local machine.

Installing XAMPP

Go to the Apache Friends website and download XAMPP.

The Apache Friends website.
The Apache Friends website.
The XAMPP file is 109MB. Once downloaded, launch the installer.
During the install process, you may receive warnings such as Windows asking you if you’re sure you want to install the software and the installer prompting you about antivirus software. As you would when installing any software on Windows, use your best judgment, but you probably want to click “Yes” to continue with the install.
The XAMPP setup wizard will guide you through the installation. Click Next.

The XAMPP setup wizard.
The XAMPP setup wizard.

In the next window you will be asked to select which components of the software you would like to install and which ones you don’t want. Some options, such as Apache and PHP are essential to running the software and will at automatically installed, so they are greyed out so you can’t select them.
It’s up to you which components you want to install. Since we want to run WordPress in our localhost environment, leave MySQL and phpMyAdmin checked and uncheck the remaining options.

Choose the options you want to install.
Choose the options you want to install.

Next, select the folder where you would like to install XAMPP on your machine. I’m going to create a new folder in C:\Program Files\XAMPP.

Enter the path where you would like to install XAMPP.
Enter the path where you would like to install XAMPP.

In the next window, you’ll be asked whether you would like to install Bitnami for XAMPP, which offers free tools for installing WordPress, Drupal and Joomla! on top of XAMPP.
Since we’re going to install WordPress manually later in this turorial and don’t need free installers, untick “Learn more about Bitnami for XAMPP” and click Next.

We don't want to install any free installers.
We don’t want to install any free installers.

After going through all those initial installation steps, XAMPP is now finally ready to install. Click Next.

Installing XAMPP.
Almost there…

Once installed, you’ll be asked whether you would like to start the XAMPP Control Panel, which provides an interface for running your localhost environment. Leave this option ticked and click Finish.

The installation process is quick and painless, though it's not uncommon for Windows to throw up warnings every now and then.
The installation process is quick and painless, though it’s not uncommon for Windows to throw up warnings every now and then.
The Control Panel will automatically open, but if you unchecked the option in the prevous window, you can go to the XAMPP folder on you computer and open XAMPP Control Panel instead.
If the installation process went well and everything is running smoothly, the control panel will open with black and blue text updates at the bottom. But if there are issues…

Gah! Errors :/
Gah! Errors!
… Well, look at that – red text! It looks like I’ve run into some errors already. Not to fear, it looks like a port conflict.

Source: https://premium.wpmudev.org/blog/setting-up-xampp/?rad=b&utm_expid=3606929-86.PHoDXYJeQYmWFQIujGOFZg.1&utm_referrer=https%3A%2F%2Fwww.google.com.ph%2F

Wednesday, October 5, 2016

Simple palindrome program in PHP

What is Palindrome?

It is a word or phrase that is the same spelled forwards and backwards. Example: madam, level, Malayalam etc.

Find string palindrome or not in PHP using strrev() function

<?php
$word = "level";  // declare a varibale
echo "String: " . $word . "<br>";
$reverse = strrev($word); // reverse the word
// compare if  the original word is same as the reverse of the same word
if ($word == $reverse) 
echo 'Output: This string is a palindrome'; else echo 'Output: This is not a palindrome'; ?>

Find string palindrome or not in PHP  without using strrev() function



<?php
$mystring = "level"; // set the string
echo "String: " . $mystring;
$myArray = array(); // php array
$myArray = str_split($mystring); //split the array
$len = sizeof($myArray); // get the size of array
$newString = "";

for ($i = $len; $i >= 0; $i--) {
    $newString.=$myArray[$i];
}
echo "<br>";
if ($mystring == $newString) {
    echo "Output: " . $mystring . " is a palindrome";
} else {
    echo "Output: " . $mystring . " is not a palindrome";
}
?>

C++ Program To Display inverted half pyramid using * and numbers

* * * * *
* * * *
* * * 
* *
*
#include <iostream>
using namespace std;
int main() 
{
    int i,j,rows;
    cout << "Enter the number of rows: ";
    cin >> rows;
    for(i=rows;i>=1;--i)
    {
        for(j=1;j<=i;++j)
        {
           cout << "* ";
        }
        cout << endl;
    }
    return 0;
}

Write a C++ Program to print half pyramid as using * as shown in figure below.

*
* *
* * *
* * * *
* * * * *
#include <iostream>
using namespace std;
int main()
{
    int i,j,rows;
    cout << "Enter the number of rows: ";
    cin >> rows;
    for(i=1;i<=rows;++i)
    {
        for(j=1;j<=i;++j)
        {
           cout << "* ";
        }
        cout << endl;
    }
    return 0;
}