Monday, 30 September 2013

Tuesday, 2 July 2013

Connect MySql with Java and eclipse

Download and install the eclipse, java and Mysql

Open eclipse

File-->New-->Class

give the class name as JDBCExample

then copy the follwing code


package testPkg;

import java.sql.*;
//import com.mysql.jdbc.Driver;
public class JDBCExample {
public static void main(String[] args) throws ClassNotFoundException,
SQLException {
String username = "root";
String password = "root";
String tablename = "login";
String fieldname = "uname";
String query = "SELECT " + fieldname + " FROM " + tablename + ";";
/* this chunk of code can appear more or less verbatim */
String url = "jdbc:mysql://localhost:3306/database";
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection(url, username, password);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
System.out.println("The contents of field " + fieldname + ":");
while (rs.next())
System.out.print(rs.getString(1) + ", ");
// note that getString anomalously starts counting at 1, not 0
System.out.println();
rs.close();
stmt.close();
con.close();
}
}

It will show the error that com.mysql.jdbc.Driver not found.

To resolve this issue use the following step.

right Click on project-->Build Path-->Use external Archives-->then path that mysql-connector-java-5.1.25-bin File

Then Execute the code.

Tuesday, 2 April 2013

mysql - call stored procedure using php - Stack Overflow

mysql - call stored procedure using php - Stack Overflow

How to Create Thumbnail Images using PHP

How to Create Thumbnail Images using PHP

<?php
function createThumbs( $pathToImages, $pathToThumbs, $thumbWidth )
{
  // open the directory
  $dir = opendir( $pathToImages );

  // loop through it, looking for any/all JPG files:
  while (false !== ($fname = readdir( $dir ))) {
    // parse path for the extension
    $info = pathinfo($pathToImages . $fname);
    // continue only if this is a JPEG image
    if ( strtolower($info['extension']) == 'jpg' )
    {
      echo "Creating thumbnail for {$fname} <br />";

      // load image and get image size
      $img = imagecreatefromjpeg( "{$pathToImages}{$fname}" );
      $width = imagesx( $img );
      $height = imagesy( $img );

      // calculate thumbnail size
      $new_width = $thumbWidth;
      $new_height = floor( $height * ( $thumbWidth / $width ) );

      // create a new temporary image
      $tmp_img = imagecreatetruecolor( $new_width, $new_height );

      // copy and resize old image into new image
      imagecopyresized( $tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height );

      // save thumbnail into a file
      imagejpeg( $tmp_img, "{$pathToThumbs}{$fname}" );
    }
  }
  // close the directory
  closedir( $dir );
}
// call createThumb function and pass to it as parameters the path
// to the directory that contains images, the path to the directory
// in which thumbnails will be placed and the thumbnail's width.
// We are assuming that the path will be a relative path working
// both in the filesystem, and through the web for links

createThumbs("upload/","upload/thumbs/",100);
?>

Thumboo! Free Website Thumbnails and PHP Script to Generate Web Screenshots

Thumboo! Free Website Thumbnails and PHP Script to Generate Web Screenshots
thumb logo

Friday, 8 February 2013

50 Free Web-Based Apps and Tools for Web Developers

50 Free Web-Based Apps and Tools for Web Developers

LESS CSS

LESS CSS

user SCC to Less to convert teh CSS to LESS

Css2Less

The dynamic stylesheet language.

LESS extends CSS with dynamic behavior such asvariablesmixinsoperations and functions.

LESS runs on both the server-side (with Node.jsand Rhino) or client-side (modern browsers only).

Monday, 7 January 2013

Example syntax for Secure Copy (scp)

Example syntax for Secure Copy (scp)

Copy the file "foobar.txt" from a remote host to the local host

    $ scp your_username@remotehost.edu:foobar.txt /some/local/directory