Friday, 26 February 2016

Thread vs Timers

One of the most basic uses of threads is to perform some periodic task at set intervals. In fact, this is so basic that there is a specialized class for performing this task—and you’ve already worked with it. The Timer class, in package javax.swing, can generate a sequence of ActionEvents separated by a specified time interval. Behind the scenes, a Timer uses a thread. The thread sleeps most of the time, but it wakes up periodically to generate the events associated with the timer. Before timers were introduced, threads had to be used directly to implement a similar functionality. In a typical use of a timer for animation, each event from the timer causes a new frame of the animation to be computed and displayed. In the response to the event, it is only necessary to update some state variables and to repaint the display to reflect the changes. A Timer to do that every fifty milliseconds might be created like this:

Timer timer = new Timer( 30, new ActionListener() {
public void actionPerformed(ActionEvent evt) {
updateForNextFrame();
display.repaint();
}
} );
timer.start();

Suppose that we wanted to do the same thing with a thread. The run() method of the thread would have to execute a loop in which the thread sleeps for 50 milliseconds, then wakes up to do the updating and repainting. This could be implemented in a nested class as follows using the method Thread.sleep().

 private class Amar extends Thread {
 public void run() {
while (true) {
try {
Thread.sleep(50);
}
catch (InterruptedException e) { 
}
updateForNextFrame();
display.repaint();
                                                                                }
                                                                           }
                                                                    }

To run the animation, you would create an object belonging to this class and call its start() method. As it stands, there would be no way to stop the animation once it is started. One way to make it possible to stop the animation would be to end the loop when a volatile boolean variable, terminate, becomes true.
              There is a subtle difference between using threads and using timers for animation. The thread that is used by a Swing Timer does nothing but generate events. The event-handling code that is executed in response to those events is actually executed in the Swing event-handling GUI thread, which also handles repainting of components and responses to user actions. This is important because the Swing GUI is not thread-safe. That is, it does not use synchronization to avoid race conditions among threads trying to access GUI components and their state variables. As long as everything is done in the Swing event thread, there is no problem. A problem can arise when another thread manipulates components or the variables that are also used in the GUI thread. In the Animator example given above, this could happen when the thread calls the updateForNextFrame() method. The variables that are modified in updateForNextFrame() would also be used by the paintComponent() method that draws the frame. There is a race condition here: If these two methods are being executed simultaneously, there is a possibility that paintComponent() will use inconsistent variable values—some appropriate for the new frame, some for the previous frame.
             One solution to this problem would be to declare both paintComponent() and
updateForNextFrame() to be synchronized methods. A better solution in this case is to
use a timer rather than a thread.
This is a simple article which showed you that how thread and timers differs in their processing. 
Thank you guys.
 

Thursday, 25 February 2016

How to play videos in JAVA

In previous articles i showed you that JAVA having broad working areas. Today i will show you how to play videos in JAVA using javafx api.
For playing videos in JAVA we need following things :
  • JAVA 7 JDK or greater
  • JAVAFX SDK
  • Eclipse or Netbeans IDE 
Install all of these in your system. After that start eclipse IDE and make a JAVA project. After it add a class file named as you want.  Now make the following program. Here i am showing you a simple MP4 video play without any other controls on media player window.

import javafx.application.*;
import javafx.stage.*;
import javafx.scene.*;

import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javafx.scene.media.MediaView;

import java.io.*;

public class video extends Application{

    private Media media;
    private MediaPlayer player;
    private MediaView view;
    private Scene scene;
    private Group root;
    public void start(Stage stage) throws Exception {
      
        root = new Group();
        root.setAutoSizeChildren(true);
        scene = new Scene(root,800,600);
   
        media = new Media(new File("/media/amar/Disk 3/my softwares/dhoom3.mp4")     
       
.toURI().toString());

        player = new MediaPlayer(media);
        player.play();


        view = new MediaView(player);
        view.fitHeightProperty().bind(scene.heightProperty());
        view.fitWidthProperty().bind(scene.widthProperty());


        root.getChildren().add(view);

        root.getChildren().add(vol);
        stage = new Stage();
        stage.setScene(scene);
        stage.show();
      
    }
   
 


After it save the program and run as JAVA application. You will see the video is playing normally. The drawback of media player in JAVA that it is unable to support all video formats. 
Good Luck guys.

Wednesday, 24 February 2016

Image Slideshow in Java

Image slide show in java  can made by several methods. There are many ways to implement these methods. But here i am going to show you how we can make a simple image slide show from images which are present in our computer. First rename the images which will be used in the slide show as a1, a2, a3, a4, a5 and so on. We will also use a jframe as window, timer for introducing delay in slide show and jlabel for showing image. Now see the simple slide show program created by me.

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.*;
import javax.swing.*;

public class slide extends JFrame {

    JPanel panel;
    JLabel label;
    ImageIcon img;
    Timer timer;
    int i=0;
    public slide() {
        setLayout(new FlowLayout());

        panel = new JPanel();
        add(panel);
        label = new JLabel();
        timer = new Timer(0, null);
        timer.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if(i>4) {
                    i=0;
                    label.setIcon(new ImageIcon("/home/amar/Desktop/a"+i+".jpg"));
                    i++;
                    panel.add(label);
                }else {

                    label.setIcon(new ImageIcon("/home/amar/Desktop/a"+i+".jpg"));
                    i++;
                    panel.add(label);
                }
            }
        });
        timer.setDelay(1000);
        timer.start();
    }
    public static void main(String[] args) {
   
        slide amar = new slide();
        amar.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        amar.setSize(500,500);
        amar.setVisible(true);
    }

   
}


Run the program and you will see the slide show. Here delay is 1000ms, you can make it as you want.
Good Luck guys. Follow my blog.

Tuesday, 23 February 2016

How to read data from URL in java

Java is a best programming language i known. It is complete and easy. Java networking can used for making chat programs, browsers, email sender and many more applications. Here i am going to show you how we can read website data using URL. Java uses URL class for this purpose.
                                                            The URL class is used to represent resources on the World-Wide Web. Every resource has an address, which identifies it uniquely and contains enough information for a Web browser to find the resource on the network and retrieve it. The address is called a “url” or “universal resource locator”.  (URLs can actually refer to resources from other sources besides the web; after all, they are “universal”.)
                                                             An object belonging to the URL class represents such an address. Once you have a URL object, you can use it to open a URLConnection to the resource at that address. A URL is ordinarily specified as a string, such as “http://math.hws.edu/eck/index.html”. There are also relative URL’s. A relative URL specifies the location of a resource relative to the location of another URL, which is called the base or context for the relative URL. 
                                                              Once you have a valid URL object, you can call its openConnection() method to set up a connection. This method returns a URLConnection. The URLConnection object can, in turn, be used to create an InputStream for reading data from the resource represented by the URL. This is done by calling its getInputStream() method. The openConnection() and getInputStream() methods can both throw exceptions of type IOException. Once the InputStream has been created, you can read from it in the usual way, including wrapping it in another input stream type, such as BufferedReader, or using a Scanner. Reading from the stream can, of course, generate exceptions.
                                                               Let’s look at a short example that uses all this to read the data from a URL. This subroutine opens a connection to a specified URL, checks that the type of data at the URL is text, and then copies the text onto the screen. 

import java.net.*;
import java.util.Scanner;
import java.io.*;


public class amar {

    public static void main(String[] args) {
        String url;   
        String urlLC; 
        if (args.length == 0) {
            Scanner stdin = new Scanner(System.in);
            System.out.print("Enter a url: ");
            url = stdin.nextLine();
        }
        else {
            url = args[0];
        }
        urlLC = url.toLowerCase();
        if ( ! (urlLC.startsWith("http://") || urlLC.startsWith("ftp://") ||
                urlLC.startsWith("file://"))) {
            url = "http://" + url;
            System.out.println("Using: " + url);
        }
        System.out.println();
        try {
            readTextFromURL(url);
        }
        catch (IOException e) {
            System.out.println("\n*** Sorry, an error has occurred ***\n");
            System.out.println(e);
            System.out.println();
        } 
    }
 

    static void readTextFromURL( String urlString ) throws IOException {



        URL url = new URL(urlString);
        URLConnection connection = url.openConnection();
        InputStream urlData = connection.getInputStream();
  

        String contentType = connection.getContentType();
        System.out.println("Stream opened with content type: " + contentType);
        System.out.println();
        if (contentType == null || contentType.startsWith("text") == false) throw new               IOException("URL does not seem to refer to a text file.");
        System.out.println("Fetching context from " + urlString + " ...");
        System.out.println(); 

        BufferedReader in; 
        in = new BufferedReader( new InputStreamReader(urlData) );

        while (true) {
            String line = in.readLine();
            if (line == null)
                break;
            System.out.println(line);
        }
        in.close();

       }
      }  

In this program a prompt will come and ask to enter the URL starting with "http://", "ftp://", or "file://". If it does not start with one of these protocols, "http://" is added to the beginning of the input line. 
                                                  If everything will we fine then the text from the URL is copied to the console window of eclipse.
Good Luck guys.

Monday, 22 February 2016

How to install PHP and MySQL in LINUX

PHP, MySQL and Apache are most important for web developers. Here i am going to show you how to install all of these in your LINUX machine. So let's start and follow my steps carefully.

Step 1 : First of all we need to install apache or any other web server. here we will install apache. Apache is a free open source software which runs over 50% of the world’s web servers. For installing apache on your machine open the terminal in your LINUX machine and type following commands one by one.

sudo apt-get update
sudo apt-get install apache2

Now open your browser and type "localhost" or "127.0.0.1". It will show you the following page.



Step 2 : Now install MySQL on your machine. To install MySQL, open terminal and type in these commands.

sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

In the middle of your installation it will ask you set the root password, If you missed then set the password later within the MySQL shell.
Once you have installed MySQL, we should activate it with this command: 

sudo mysql_install_db

Now type the following command:

sudo /usr/bin/mysql_secure_installation

After this a prompt will ask you for entering the current root password. Type the password. Now prompt will ask you to change the password, So type N.
After that type 'Y' in all upcoming prompts. At last MySQL will reload and implement the new changes. 
Now MySQL installed successfully. For checking it open the terminal and type the following command :

sudo mysql root your_password

Step 3 : Now we are going to install PHP. To install PHP, open terminal and type in this command.

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

Type 'Y' in two prompts after it. It will install PHP automatically.
Now add php to the directory index by the following command:

sudo nano /etc/apache2/mods-enabled/dir.conf

Now add the index.php in beginning of the index files. It should be see like this :

<IfModule mod_dir.c>

          DirectoryIndex index.php index.html index.cgi index.pl index.php index.xhtml index.htm

</IfModule>

Now type the command for adding the libraries and modules:


apt-cache search php5-

The terminal will show you the all modules. Select one of them and type the command:

sudo apt-get install name of the module

Now setup is almost complete. create a new file named "phpinfo.php" in '/var/www' folder and type the following lines.

<?php
phpinfo();
?>

Save it and open the browser and type "localhost/phpinfo.php"  the following address in address bar. It will show you the following screen.


Good luck guys. 

Sunday, 21 February 2016

Cryptographic Techniques and Protocols

There are many cryptographic techniques and protocols, they mostly
fall into one of three categories:


Bulk Encryption : This is the modern equivalent of secret writing . A bulk encryption algorithm uses a key to scramble (or encrypt ) data for transmission or storage. It can
then only be unscrambled (or decrypted ) using the same key. Bulk encryption is so called because it is effective for securing large chunks of data. Some common algorithms are Data Encryption Standard (DES), Data Encryption Algorithm (DEA) and RC4. This is also called the symmetric encryption.


Public Key Encryption :This is also a technique for securing data but instead of using a single key for encryption and decryption, it uses two related keys, called public key and private key , which together form what is known as a key pair . As the word suggests, public keys are made available to everyone, but each entity that holds a key pair should keep the private key as secret. If data is encrypted using one of the keys, it can only be decrypted using the other, and vice-versa.
                                                Public key encryption is a form of asymmetric encryption, because the key that is used to encrypt is different from the key used to decrypt. With this technology, the sender in a secure communication can use the receiver’s public key to encrypt the data, because at that point in time only the receiver can decrypt the data, by using its own private key.
                                                 Compared to bulk encryption, public key encryption is more secure, because it does not require the transmission of a shared key that both the parties must hold. However, public key encryption is computationally expensive and is therefore not suited to large amounts of data.
                                                 The most commonly-used algorithm for public key encryption is the Rivest,Shamir and Adleman (RSA) system.

Hashing : A secure hash is an algorithm that takes a stream of data and creates a
fixed-length digest of it. This digest is a fingerprint for the data. A digest has two main properties:
1. If even one single bit of data is changed, then the message digest changes as well. Notice, however, there is a very remote probability that two different arbitrary messages can have the same fingerprint.
2. Even if someone was able to intercept transmitted data and its fingerprint, that person would not be practically able to modify the original data so that the resulting data has the same digest as the original one.

                                                 
                                                 Hashing functions are often found in the context of digital signatures. This is a method for authenticating the source of a message, formed by encrypting a hash of the source data. Public key encryption is used to create the signature, so it effectively ties the signed data to the owner of the key pair that created
the signature.

                                                  This all about Cryptographic Techniques and Protocols. We will discuss further in future articles in my blog. Thanks for reading friends.
                                           

Saturday, 20 February 2016

What is Cryptography?

Cryptography is the science of secret writing. It's a branch of mathematics, part of cryptology . Cryptology has one other child, cryptanalysis , which is the science of breaking (analyzing)cryptography. 

The main security concerns of applications are addressed by cryptography. First, applications need assurance that users are who they say they are. Proving identity is called authentication . In the physical world, a driver's license is a kind of authentication. When you use a computer, you usually use a name and password to authenticate yourself. Cryptography provides stronger methods of authentication, called signatures and certificates.

Computer applications need to protect their data from unauthorized access. You don't want people snooping on your data (you want confidentiality), and you don't want someone changing data without your knowledge (you want to be assured of your data's integrity). Data stored on a disk, for example, may be vulnerable to being viewed or stolen. Data transmitted across a network is subject to all sorts of nefarious attacks. Again, cryptography provides solutions.

So what can you do with cryptography? Plenty. Here are just a few examples:

Secure network communications : Cryptography can protect your data from thieves and impostors. Most web browsers now support SSL , a cryptographic protocol that encrypts information before it is transmitted over the Internet. SSL allows you to buy things, using your credit card number, without worrying too much that the number will be stolen.

Secure hard disk : You can encrypt the files on your hard disk so that even if your enemies gain physical access to your computer, they won't be able to access its data.

Secure email : Email is notoriously easy to steal and easy to forge. Cryptography can make it hard to forge email and hard to read other people's messages.

Although cryptography is heavily mathematical. One of the really nice things about the Java Security API is that, like any good software library, it hides a lot of complexity. The Security API exposes concepts, like Signature and Cipher , and quietly deals with the underlying details. You can use cryptography effectively in a Java application without knowing too much about what's going on underneath the hood.
 

Friday, 19 February 2016

Networking in JAVA

Networking in JAVA is best thing i used in JAVA. Those who are new with networking in JAVA should use only three basic things first. These things are Socket, Host name, and I/O streams. Socket is used for making connection, Host name is address and I/O streams for sending and receiving information. So here is our first and simplest example in JAVA networking.

package socket;
import java.io.*;
import java.net.*;
import java.util.*;


/**

* This program makes a socket connection to the atomic
   clock in Boulder, Colorado, and prints

* the time that the server sends.

**/ 

public class SocketTest {

public static void main(String[] args) throws IOException {

try (Socket s = new Socket("time-A.timefreq.bldrdoc.gov", 13)) {

InputStream inStream = s.getInputStream();

Scanner in = new Scanner(inStream);

while (in.hasNextLine())

{

String line = in.nextLine();

System.out.println(line);

}

}
}


The first line opens a socket, which is a network software abstraction that enables communication out of and into this program. We pass the remote address and the port number to the socket constructor. If the connection fails, an UnknownHostException is thrown. If there is another problem, an IOException occurs. Since UnknownHostException is a subclass of IOException and this is a sample program, we just catch the superclass.
Once the socket is open, the getInputStream method in java.net.Socket returns an
InputStream object that you can use just like any other stream. Once you have grabbed the stream, this program simply prints each input line to standard output. This process continues until the stream is finished and the server disconnects.


Note: The Java platform also supports the User Datagram Protocol (UDP), which can be used to send packets (also called datagrams) with much less overhead than that of TCP. The drawback is that packets need not be delivered in sequential order to the receiving application and can even be dropped altogether. It is up to the recipient to put the packets in order and to request retransmission of missing packets. UDP is well suited for applications in which missing packets can be tolerated —for example, for audio or video streams or continuous measurements.

Monday, 23 November 2015

Europa - The Jupitar's moon

Europa is the sixth-closest moon of Jupiter, and the smallest of its four Galilean satellites, but still the sixth-largest moon in the Solar System. Europa was discovered in 1610 by Galileo Galilei.

Slightly smaller than the Moon, Europa is primarily made of silicate rock and has a water-ice crust and probably an iron–nickel core. It has a tenuous atmosphere composed primarily of oxygen. Its surface is striated by cracks and streaks, whereas craters are relatively rare. It has the smoothest surface of any known solid object in the Solar System. The apparent youth and smoothness of the surface have led to the hypothesis that a water ocean exists beneath it, which could conceivably serve as an abode for extraterrestrial life. This hypothesis proposes that heat from tidal flexing causes the ocean to remain liquid and drives geological activity similar to plate tectonics. On 8 September 2014, NASA reported finding evidence supporting earlier suggestions of plate tectonics in Europa's thick ice shell—the first sign of such geological activity on a world other than Earth. On 12 May 2015, scientists announced that sea salt from a subsurface ocean may be coating some geological features on Europa, suggesting that the ocean is interacting with the seafloor. This may be important in determining if Europa could be habitable for life.




Europa orbits Jupiter in just over three and a half days, with an orbital radius of about 670,900 km. With an eccentricity of only 0.009, the orbit itself is nearly circular, and the orbital inclination relative to Jupiter's equatorial plane is small, at 0.470°. Like its fellow Galilean satellites, Europa is tidally locked to Jupiter, with one hemisphere of Europa constantly facing Jupiter. Because of this, there is a sub-Jovian point on Europa's surface, from which Jupiter would appear to hang directly overhead. Europa's prime meridian is the line intersecting this point. Research suggests the tidal locking may not be full, as a non-synchronous rotation has been proposed: Europa spins faster than it orbits, or at least did so in the past. This suggests an asymmetry in internal mass distribution and that a layer of subsurface liquid separates the icy crust from the rocky interior. As Europa comes slightly nearer to Jupiter, Jupiter's gravitational attraction increases, causing Europa to elongate towards and away from it. As Europa moves slightly away from Jupiter, Jupiter's gravitational force decreases, causing Europa to relax back into a more spherical shape, and creating tides in its ocean.



Europa is one of the smoothest objects in the Solar System when considering the lack of large scale features such as mountains or craters, however on a smaller scale Europa's equator has been theorised to be covered in 10 metre tall icy spikes called penitentes caused by the effect of direct overhead sunlight on the equator melting vertical cracks. There are few craters on Europa because its surface is tectonically active and young.

In July 2013 an updated concept for a flyby Europa mission called Europa Clipper was presented by the Jet Propulsion Laboratory (JPL) and the Applied Physics Laboratory (APL).In May 2015, NASA officially announced that it had accepted the Europa Clipper mission, and revealed the instruments it will use. The aim of Europa Clipper is to explore Europa in order to investigate its habitability, and to aid selecting sites for a future lander. The Europa Clipper would not orbit Europa, but instead orbit Jupiter and conduct 45 low-altitude flybys of Europa during its envisioned mission. The probe would carry an ice-penetrating radar, short-wave infrared spectrometer, topographical imager, and an ion- and neutral-mass spectrometer.


Monday, 13 April 2015

Restrict Filesystem Access to a Specific Directory

If your application must operate on the filesystem, you can set the open_basedir
option to further secure the application by restricting access to a specific directory.If
open_basedir is set in php.ini, PHP limits filesystem and I/O functions so that they
can operate only within that directory or any of its subdirectories. For example:


open_basedir = /some/path

With this configuration in effect, the following function calls succeed:

unlink("/some/path/unwanted.exe");
include("/some/path/less/travelled.inc");


But these generate runtime errors:

$fp = fopen ("/some/other/file.exe", "r");
$dp = opendir("/some/path/../other/file.exe");


Of course, one web server can run many applications, and each application typically
stores files in its own directory.You can configure open_basedir on a per-virtual host
basis in your httpd.conf file like this:


<VirtualHost 1.2.3.4>
ServerName domainA.com
DocumentRoot /web/sites/domainA
php_admin_value open_basedir /web/sites/domainA
</VirtualHost>


Similarly, you can configure it per directory or per URL in httpd.conf:

# by directory
<Directory /home/httpd/html/app1>
php_admin_value open_basedir /home/httpd/html/app1
</Directory>
# by URL
<Location /app2>
php_admin_value open_basedir /home/httpd/html/app2
</Location>


The open_basedir directory can be set only in the httpd.conf file, not in .htaccess files, and you must use php_admin_value to set it.

Saturday, 11 April 2015

Image Slide Show in HTML

In HTML image addition we discussed already. Now we will make a image slideshow in HTML page. This is really very important article for those who wanna make a dynamic web page.
Let's start making a slideshow. 

1) First we will write our HTML page as usual.
    <html>
    <head><title>slideshow</title>
    </head>
    <body><?body>
    </html>

2) For image slideshow first we introduce our images. This will do by introducing script inside head tag.

<script type="text/javascript">
var a1 = new Image()
a1.src ="a.jpg"
var a2 = new Image()
a2.src = "b.jpg"
var a3 = new Image()
a3.src = "c.jpg"
var a4 = new Image()
a4.src = "d.jpg"
</script>


3) Now images are added. Let's start implements them into body of web page. For this we will add a first display image on web page using HTML image addition tag.

<img src = "a.jpg" name ="slide" height="400" width ="400">

4) Now we again introduce a script inside body of web page. This script will make slideshow operations.

<script type="text/javascript">
var number = 1
function slideit() {

document.images.slide.src = eval("a"+number+".src")
if(number<4)
number++
else
number=1
setTimeout("slideit()",1500)
}
slideit()
</script>


In above script we make a variable "number" (you can make any word you wants). This variable initialize as 1. After that we made a function "slideit", In this function we used a javascript command which evaluate images one by one. A loop introduced after that with will run till last image. The variable number will change in every count of the loop as 1,2,3,4. This will change image source as a1,a2,a3,a4. After that a timeout command introduced for slideit function with time difference 1500 ms.

Now run the program, I am sure it will work fine.

Thursday, 9 April 2015

How to use PHP to access a Database

Databases are backbone of today's websites. PHP has support for over 20 databases. MySQL, PostgreSQL and Oracle are widely used databases. Databases are used for storing users registration data, credit card numbers, purchase history, product reviews and many other things.
PHP and phpmyadmin both are used to access databases. Relational database management system is a server which is used to manage data. Data is structured into tables where each table have some no. of columns, each of which has a name and a type. PHP communicates with relational databases such as MySQL and Oracle using structured query language (SQL). The syntax for SQL is divided into two parts. The first, Data Manipulation Language, or DML, is used to retrieve and modify data in an existing database. DML is remarkably compact, consisting of only four verbs: select, insert, update, and delete. The set of SQL commands, used to create and modify the database structures that hold the data, is known as Data Definition Language, or DDL. The syntax for DDL is not as standardized as that for DML, but as PHP just sends any SQL commands you give it to the database, you can use any SQL commands your database supports.

Assuming you have a table called movies, this SQL statement would insert a new row:
INSERT INTO movies VALUES(0, 'fast and furious 7', 2015, 2)
This SQL statement inserts a new row but lists the columns for which there are values:
INSERT INTO movies (title, year, actor) VALUES ('hercules', 2015, 2)
To delete all movies from 2015, we could use this SQL statement:
DELETE FROM movies WHERE year=2015
To change the year for hercules to 2014, use this SQL statement:
UPDATE movies SET year=2014 WHERE title='hercules'
To fetch only the movies made in the 2010s, use:
SELECT * FROM movies WHERE year >= 2010 AND year < 2015 .

 Example :  

This example will show you how to insert form data into database using PHP.

1) First create a html form.

2) Now create a connect.php file.


Top ten fastest cars in the world 2014-15

Best cars having two catageories, oe is most expensive and another catageory is most expensive cars. First we will take fastest cars i the world till 2015 march.

1) Hennessey Venom GT : Speed up-to 270.49 mph




Hennessey came in 2012 with Recardo 6-speed manual transmission. It gains 100 km/h speed in 2.4 sec. The cost of this car is $6-10 million.

2) Bugatti Veyron Super Sport : Speed up-to 269.86 mph


 


Veyron Super sport came in 2010 with 7-speed DSG sequential transmission. It gains 100 km/h speed in 2.4 sec. The cost of this car is $3.4 million.
 
3) Bugatti Veyron EB 16.4 : Speed up-to 254.04 mph


Veyron EB 16.4 came in 2011 with 7-speed DSG sequential transmission. It gains 100 km/h speed in 2.8 sec. The cost of this car is $2.7 million.

4) Saleen S7 TT : Speed up-to 248 mph


Saleen S7 came in 2005-2009 with 6-speed manual transmission. It gains 100 km/h speed in 2.8 sec. The cost of this car is $580000.

5) Koenigsegg CCX : Speed up-to 245 mph





Koenigsegg CCX came in 2006-10 with 6-speed manual and automated maual transmission. It gains 100 km/h speed in 3.2 sec. The cost of this car is $5.5 million.


6)
McLaren F1: Speed up-to 243 mph


McLaren came in 1992-98 with 6-speed manual transmission. It gains 100 km/h speed in 3.2 sec. The cost of this car is $5.58 million.

7) Zenvo ST1 : Speed up-to 233 mph





Zenvo came in 2009 with 6-speed manual transmission. It gains 100 km/h speed in 3 sec. The cost of this car is $1.25 million.

8) Lamborghini Veneno : Speed up-to 221 mph





Veneno came in 2013 with 7-speed semi-automatic transmission. It gains 100 km/h speed in 2.8 sec. The cost of this car is $4 million.

9) Ferrari LaFerrari : Speed up-to 220 mph




LaFerrari came in 2013-14 with 7-speed dual clutch manual transmission. It gains 100 km/h speed in 2.9 sec. The cost of this car is $1.3 million.


10) 
McLaren P1 : Speed up-to 217 mph


P1 came in 2014 with 7-speed dual clutch transmission. It gain 62mph(100 km/h) speed in 2.8 sec. The cost of this car is $1.2 million.













Google Chromebit

Google chromebit is basically a dongle. It is a PC in face of usb. Google going to launch it soon. It is world's first usb pc. It will cost upto 100$ approx and in indian market will be 6000 approx. When we will join it to normal TV it will convert it in to a PC. A mouse and keyboard can also join it through bluetooth. It is very useful for businessman and students also.Chromebit works when it will connect to any display.

There are some other companies like intel and some other chinese companies have been selling Android HDMI dongle-computers since over a year based on the Rockchip RK3288 processor. Intel computer stick is also announced in 150$ but chromebit is not similar with these. Intel computer stick is a HDMI dongle having powerful features, it having 1.33 GHz quad core intel atom processor, 2 GB RAM and 32 GB solid state storage. It also have wifi, bluetooth, and maybe microSD slot.

Whereas chromebit is made up by google ans asus. It is similar to google chromecast. Google announced to release it in summer approximately. Chromecast is used for streaming videos over internet on TV whereas chromebit will also work for some other things.is part of a new wave of machines that use Chrome OS, an operating system built for the internet age. Based on the Google Chrome web browser, the OS is designed for use with internet-based applications such as Google’s Gmail email service and its Google Docs word processor, reducing our dependence on the bulky local software that traditionally runs on PCs, moving tasks onto a cheaper breed of hardware as a result, and, ostensibly, improving security. With a Chromebit, you don’t even need a notebook or netbook—you just slip the stick into the HDMI port of a display at home, work, or an Internet cafe.The Chromebit doesn’t appear to be a truly novel idea, but rather a nice effort on the part of Google to market an existing concept.

      

How to reset root password of MYSQL on windows

Use the following procedure to reset the password for all MySQL root accounts:

1) Log on to your system as Administrator.

2) Stop the MySQL server if it is running. For a server that is running as a Windows service, go to the Services manager: From the Start menu, select Control Panel, then Administrative Tools, then Services. Find the MySQL service in the list and stop it.


3) Create a text file containing the following statements. Replace the password with the password that you want to use.
UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';
FLUSH PRIVILEGES;

The UPDATE statement resets the password for all root accounts, and the FLUSH statement tells the server to reload the grant tables into memory so that it notices the password change.

4) Save the file. For this example, the file will be named C:\mysql-init.txt.

5) Open a console window to get to the command prompt: From the Start menu, select Run, then enter cmd as the command to be run.


6) Start the MySQL server with the special --init-file option (notice that the backslash in the option value is doubled): 

C:\> C:\mysql\bin\mysqld --init-file=C:\\mysql-init.txt

NOTE : If you installed MySQL to a location other than C:\mysql, adjust the command accordingly.
  • If you installed MySQL using the MySQL Installation Wizard, you may need to specify a --defaults-file option:
  C:\> "C:\Program Files\MySQL\MySQL Server 5.6\bin\mysqld.exe"
       --defaults-file="C:\\Program Files\\MySQL\\MySQL Server 5.6\\my.ini"
        --init-file=C:\\mysql-init.txt

  • The appropriate --defaults-file setting can be found using the Services Manager: From the Start menu, select Control Panel, then Administrative Tools, then Services. Find the MySQL service in the list, right-click it, and choose the Properties option. The Path to executable field contains the --defaults-file setting.
7) After the server has started successfully, delete C:\mysql-init.txt.

Congratulations, you should now be able to connect to the MySQL server as root using the new password. Stop the MySQL server, then restart it in normal mode again. If you run the server as a service, start it from the Windows Services window. If you start the server manually, use whatever command you normally use.

Submitting and Retrieving Forms data using PHP

Web forms are GUI element wherein the data to be processed is submitted to the web server. The whole process is called client/server data processing model. It is applicable in web sites and web applications. Web form contains text boxes, buttons, check boxes, which allows the user to enter the required information. Web form contains a submit button, when you clicked the submit button, the contents of the form is submitted to the server for processing.
Form is formed using <form> tag which having attributes like action, method, enctype and name. All attributes having their own functions, for example enctype is used for making encryption for form contents.

Submitting the form data

The data of the form cab be sent to the server using either the post() or get() method. The get() method having  attribute method equal to get() and post method having attribute method equal to post().
For example : <form name ="amar" method ="get" action="amar.php">.
Note : In post method information submitted by the user don't show whereas in get information entered by the user Shows in url.

Retrieving Form data

The form data retrieve using php file(amar.php. You must have a web server like apache or wampserver and the both HTML and PHP files should be in same directory(root directory) of the server. The server is used for transmitting data and retrieving data. Lei's see how we can do it.
First make a form in HTML file.
<html>
<head>
<title>Data transmission</title>
</head>
<body>
<form name="amar" method="get" action="amar.php">
First name:
<input type="text" name="first" />
</br>
Last name:
<input type="text" name="last" />
</br>
<input type="submit" value="submit" name="button">
</body>
</html>

 

Now retrieve data using these lines.

<html>
<head>
<title>retrieving data</title>
</head>
<body>
first name is :
<?php
echo $_GET["first"];
?>
</br>
last name is :
<?php
echo $_GET["last"];
?>
</body>
</html>


It's all about HTML and PHP form data transmission.In next article we will focus on Database connection using PHP.

 

Javascript with HTML

Script is a small program that can add interactivity to your website. A script could generate a pop-up alert message or drop down menu. These scripts can write in javascript or VBScript.
In javascript we can write small functions called event handlers, then we can trigger those functions using HTML attributes. Now days Javascript is widely used web scripting language.
We can add javascript using external .js file or internally in HTML document. Let's start both cases one by one.

Externally use of javascript : If we wanna add functionality in various HTML documents then we should add external javascript file. In HTML document we will make a syntax inside <head> tag as - 
<html>
<head>
<title>javascript</title>
<script type = "text/javascript" src = "amar.js"></script>
</head>
<body>
<input type="button" value="click me" onclick="amar();">
</body>
</html>

and "amar.js"  is :
function amar() {
alert("hello amar");
}

when we will click the button then output will be-



Similarly we can add javascript inside the HTML document without using external .js file. Let's see the syntax for making it.
<html>
<head>
<title>Javascript</title>
<script type="text/javascript">
function amar(){
alert("hello amar");
}
</script>
</head>
<body>
<input type="button" onclick="amar();" name="ok" value="Click Me" />
</body>
</html>


Output will be the same as above. Now we should know about Event Handlers. Event handlers are small function which responds on mouse or keyboard actions. Let's see how.

<html>
<head>
<title>Javascript</title>
<script type="text/javascript">
function amar(){
alert("hello amar");
}
</script>
</head>
<body>
<p onmouseover="amar();">Bring your mouse here to see an alert</p>
</body>
</html>


When we will bring our mouse over text the we will see the same alert as above. Now we will focus on <noscript> tag. This tag is used when browser of user doesn't supports javascript or they disabled javascript. At that time this tag shows them a alert.
<script type="text/javascript">
<!--
document.write("Hello Javascript!");
//-->
</script>
<noscript>Your browser does not support Javascript!</noscript>


NOTE : When we will use multiple script files or multiple <script> tags  then we should make default scripting language for all tags by following syntax.
<meta http-equiv="Content-Script-Type" content="text/JavaScript" /> 

Thanx everyone, we will continue HTML in next article.