Saturday, June 28, 2014

Top 5 websites for fonts

1.Google Web fonts

Google Fonts directory is contains all free fonts.Google web fonts is contains source code of all free fonts.Google Fonts makes it quick and easy for everyone to use web fonts, including professional designers and developers

To download google fonts click here.



2.Free typography

Freetypography is best blog for free bset web fonts for websites.


To download fonts from http://freetypography.com/ Click Here

3.Openfontlibrary

http://openfontlibrary.org/ is contains open source fonts and it allows users dowload fonts and Upload fonts in website


To download fonts from http://openfontlibrary.org/Click Here

4.Fontspring

http://fontspring.com/ is contains best web fonts and it allows users download fonts.


To download fonts from http://fontspring.com/Click Here

5.Fontsquirrel

http://www.fontsquirrel.com/ is contains bestfree  web fonts and it allows users download fonts.


To download fonts from http://www.fontsquirrel.com/Click Here

Monday, June 23, 2014

Wordpress,Joomla and Drupal Comparsion

Today We will discuss about Most popular CMS tools.If you know about any CMS tools please comment here.

Most popular CMS tools are
  1. Wordpress
  2. Joomla
  3. Drupal


Wordpress:

Wordpress is most popular CMS tool,Is used to create powerful websites and blogs.There are many plugins,themes available in web.

It is open source  tool and we can easily develop websites and blogs.

To develop website in Wordpress Click Here.

Joomla:

Joomla is also Very powerful CMS tool .It is also used to develop web applications and blogs.The latest version of joomla is 3.2.It is have many features like Content Versioning,Rapid framework,Joomla Appstore etc.

Compare to Wordpress, Joomla is little difficult to develop web applications. And Have separate admin section.

To develop website using joomla Click Here

Drupal:

 Drupal is open source CMS tool is used to create web applications.It is diffcult compare to wordpress and Joomla.

Drupal don't have separate admins section.Admin was built in front end.

Wordpress VS Joomla Vs Drupal:

Features Comparison:



Please feel free to comment and don't forget to subscribe my updates via email.

Sunday, June 22, 2014

CSV to Mysql import in PHP

Today i am going to explain how to import values form CSV to Mysql database.It is very useful to import bulk amount data's very easily.

Let's have look.



Step 1: You need a database connection

db.php

     <?php
        define ("DB_HOST", "localhost"); // set database host
        define ("DB_USER", "root"); // set database user
        define ("DB_PASS",""); // set database password
        define ("DB_NAME","db"); // set database name
      
        $link = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die("Couldn't make connection.");
        $db = mysql_select_db(DB_NAME, $link) or die("Couldn't select database");
    ?>
 
Create a database and import the following sql query.

users.sql

CREATE TABLE IF NOT EXISTS `student` (
  `id` int(5) NOT NULL AUTO_INCREMENT,
  `name` varchar(200) NOT NULL,
  `email` varchar(200) NOT NULL,
  `city` varchar(200) NOT NULL,
  `image` blob NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Used functions and Definition:

is_file() — Checks wheather the specified file is a regular file.
fopen - Used to open a file or url.
fgetcsv — Gets line from file pointer and parse for CSV fields

csv.php

      <?php
    if (isset($_POST['csvimport']))
{
  $csv_file = $_FILES['csvfile']['tmp_name'];

  if (!is_file($csv_file))
    exit('File not found.');

  $sql = '';

  if (($handle = fopen( $csv_file, "r")) !== FALSE)
  {
      while (($data = fgetcsv($handle, 1000, ",")) !== FALSE)
      {
          $sql .= mysql_query("INSERT INTO `users` SET
            `id` = '$data[0]',
            `name` = '$data[1]',
            `email` = '$data[2]',
            `city` = '$data[3]',
            `image` = '$data[4]'") or die("could not insert into DB");
      }
      fclose($handle);
  }

  exit( "Complete!");
}
?>

csv.html

<form enctype="multipart/form-data" method="POST" action="">
      <input name="csvfile" type="file">
      <input type="submit" name="csvimport" value="Upload">
    </form>

Please share your comments and feedback.Thanks.Please subscribe my updates via email.

Friday, June 20, 2014

Add facebook recommendations bar in website

In this post am going to show how to add facebook recommendations bar in website.Facebook recommendations bar is used to get more likes and followers in page or post for websites and blogs.We can easily integrate facebook recommendations bar in website.





Let's have look.

 Steps:

Step 1: Please click this Link to go to facebook developers page
Step 2: Please enter Recommended URL in URL box,Domain and Select your customization options.

Step 3: Click Get Code Button.
Step 4: Copy & paste the code in your Web page.
        4.1. Include the JavaScript SDK on your page once, ideally right after the opening <body> tag.

Your Code look Like this

    <div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

Place the code for your plugin wherever you want the plugin to appear on your page.

<div class="fb-recommendations-bar" data-href="https://developers.facebook.com/codeinnovators" data-site="codeinnovators.blogspot.com" data-read-time="30" data-side="right" data-action="recommend"></div>

Please share your comments and feedback.Thanks.Please subscribe my updates via email.

Get Userlocation using ip address in PHP

Get Userlocation using ip address in PHP

Let's have look.


index.php

    <?php
            /*Get user ip address*/
            $ip_address=$_SERVER['REMOTE_ADDR'];
          
            /*Get user ip address details with geoplugin.net*/
            $geopluginURL='http://www.geoplugin.net/php.gp?ip='.$ip_address;
            $addrDetailsArr = unserialize(file_get_contents($geopluginURL));
           
            /*Get City name by return array*/
            $city = $addrDetailsArr['geoplugin_city'];
           
            /*Get Country name by return array*/
            $country = $addrDetailsArr['geoplugin_countryName'];
           
            if(!$city){
               $city='Not Define';
            }if(!$country){
               $country='Not Define';
            }
            echo '<strong>IP Address</strong>: '.$ip_address.'<br/>';
            echo '<strong>City</strong>: '.$city.'<br/>';
            echo '<strong>Country</strong>: '.$country.'<br/>';
    ?>
 
Please share your comments and feedback.Thanks.Please subscribe my updates via email.

Monday, June 16, 2014

jQuery Show Alert Message while leaving from webpage

In this post i want to explain how to jQuery Show Alert Message while leaving from webpage.

beforeunload:
The beforeunload event is fired when the window, the document and its resources are about to be unloaded.



Let's have look.

JQuery Function

<script type="text/javascript">
        $(function() {
            $(window).on('beforeunload', function() {
                return '';
            });
        });
</script>


Please share your comments and feedback.Thanks.Please subscribe my updates via email.

Friday, June 13, 2014

Auto Refresh using PHP & Jquery

In this post i want to explain how to autorefresh data's.We can fetch values without loading whole page using this script.Most popular Social websites are using this script like twitter,facebook etc.

Let's have look.


Live DemoDownload Script

Create table using the following command.

Mysql Table

        CREATE TABLE IF NOT EXISTS `users` (
          `id` int(11) NOT NULL AUTO_INCREMENT,
          `uname` varchar(225) NOT NULL,
          PRIMARY KEY (`id`)
        ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

conn.php

<?php
        $conn=mysql_connect("localhost","root","");
        $db=mysql_select_db("autorefresh",$conn); //replace with your DB name
    ?>

JQuery Function

<script type="text/javascript">
    var autorefresh = setInterval(
    function (){
        $('#items').load('count.php').fadeIn("slow"); //Include PHp file for dynamic update
    }, 1000); //refresh every 1000 milliseconds
  
    </script>

Display dynamic results using PHP.I have stored values in mysak and retrived from table.

PHP function

<?php
    $res=mysql_query("select * from users order by id ASC"); ?>
<table width="500" border="1" cellspacing="0" cellpadding="0" style="border:1px solid #ccc;">
  <tr style="border-bottom:1px solid #ccc">
    <td width="250" style="padding:5px;">SNo</td>
    <td width="250" style="padding:5px;">Username</td>
  </tr>
  <?php
    while($row=mysql_fetch_array($res)){ ?>
  <tr>
    <td width="250" style="padding:5px;"><?php echo $row['id'];?></td>
    <td width="250" style="padding:5px;"><?php echo $row['uname'];?></td>
  </tr>
  <?php } ?>
</table>


Please share your comments and feedback.Thanks.Please subscribe my updates via email.

Saturday, June 7, 2014

Image type validation using Javascript

Image type validation using Javascript




JQuery Function

<script type="text/javascript">
    function Validate() {
        var img = document.getElementById('image');
        var Path = img.value;
      
        if (Path == '') {
            alert("Please upload an image");

        } else {
            var Extension = Path.substring(
                    Path.lastIndexOf('.') + 1).toLowerCase();
                   
if (Extension == "gif" || Extension == "png" || Extension == "bmp"
                    || Extension == "jpeg" || Extension == "jpg") {
                if (img.files && img.files[0]) {
                    var reader = new FileReader();

                    reader.onload = function(e) {
                        $('#blah').attr('src', e.target.result);
                    }

                    reader.readAsDataURL(img.files[0]);
                }

            }
else {
                alert("Upload only GIF, PNG, JPG, JPEG and BMP images.");

            }
        }
    }
</script>

HTML

<input type="file" name="imagename" id="image" onchange="return Validate()" />


Please share your comments and feedback.Thanks.Please subscribe my updates via email.

JavaScript Check Password / Confirm Password

This is very important for registration.I have used onKeyUp() to check password/confirm are same. and get values using document.getElementById('') function.


JQuery Function

      <script>
        function checkPasswords()
        {  
            var password1 = document.getElementById('password1');
            var password2 = document.getElementById('password2');
            var message = document.getElementById('alertMessage');
            var goodColor = "#66cc66";
            var badColor = "#ff6666";
            if(password1.value == password2.value){
                password2.style.backgroundColor = goodColor;
                message.style.color = goodColor;
                message.innerHTML = "Passwords Match!"
            }else{
                password2.style.backgroundColor = badColor;
                message.style.color = badColor;
                message.innerHTML = "Passwords Do Not Match!"
            }
        }
</script>

HTML

 <form>
      <div class="fieldWrapper"> Password:
        <input type="password" name="pass1" id="password1">
        Confirm Password:
        <input type="password" name="pass2" id="password2" onKeyUp="checkPass(); return false;">
        <span id="alertMessage" class="alertMessage"></span> </div>
    </form>

Please share your comments and feedback.Thanks.Please subscribe my updates via email.

Tuesday, June 3, 2014

Twitter Style Compose box

Expand textarea height when click on it.It is like twitter compose box.

jQuery animate() Method is used to expand height here.

The animate() method is used to implement custom CSS properties on click events,onfocus etc.

Syntax:
(selector).animate({styles},speed,easing,callback)

JQuery Function

    <script>
        $('textarea.height').focus(function () {
            $(this).animate({ height: "5em" }, 500);
        });
    </script>

HTML

<textarea class="height" rows="1" cols="40"></textarea>
Please share your comments and feedback.Thanks.Please subscribe my updates via email.

Monday, June 2, 2014

How to Install Drupal

Drupal is powerful CMS tool.It is used to create web applications.



Find the below steps to install new drupal.

Step 1: Download ,extract and upload drupal in your server(in WAMP upload in www folder or XAMPP upload in htdocs folder).
Step 2: Create New database using PHPmyadmin.

Step 3: Go to your browser.Type http://localhost/yourfoldername/ and press enter button.
Step 4: This is the first step of drupal installation.Next Click Save & Continue button.
Step 5: Choose your language.
Step 6: Next Enter your database details.Click Save & Continue button.
Step 7: Final Step enter your website title,admin password and your email.Click Save & Continue button.
Step 8: Installation is completed.Click Visit your new site to see your website.

Please share your comments and feedback.Thanks.Please subscribe my updates via email.





How To Install WordPress Localhost

Wordpress is very powerful blogging tool.It is used to create websites,blog and web applications.

Working in wordpress is very easy and we can easily develop website.

Find the below steps to install new wordpress.

Step 1: Download ,extract and upload wordpress in your server(in WAMP upload in www folder or XAMPP upload in htdocs folder).
Step 2: Create New database using PHPmyadmin.
Step 3: Go to your browser.Type http://localhost/yourfoldername/ and press enter button.
Step 4: You will see the below image in your browser.This is the first step of wordpress installation.Next Click Create configuration button.
Step 5: Next You will see the below image in your browser.It is a information about database.Read and click Let's go button.
Step 6: Next Enter your database details.Click Submit button.
Step 7: Next Click Run install.It will start your WP installation.
Step 8: Final Step enter your website title,admin password and your email.Press install Wordpress button.
Step 9: After that you will see the below screen in your browser.Save admin password.

Step 10: Login in administrator using your username and password.
Step 11: Your dashboard will look like the below image.
Step 12: Start to add Post and Pages.

Please share your comments and feedback.Thanks.Please subscribe my updates via email.