Its very useful to record the site visitor information like ip address, search keywords, visit url...
Today I will write a simple php script to achieve that. First we need a database table to store the information. Here is the table:
In this example, the code list all the files in a directory and zoom the images into fixed width.
You need these jars:
The syntax <? extends T> is "any type that is subtype of T".
The list might might be any list that contains subtype of Number. So next code would be wrong.
The Java Generics is much like the C++ template. But they are also very different from each other.
A simple exampe:
How to zoom image in php? Here is a quick recipe.
<?php list($image_width, $image_height) = @getimagesize('xx.jpg'); $imgsrc = imagecreatefromjpeg('xx.jpg'); $towidth = 565; $newwidth = $towidth ; $newheight = ($image_height * $towidth )/$image_width; $imgdst = imagecreatetruecolor($newwidth , $newheight ); $copy = @imagecopyresized($imgdst, $imgsrc, 0, 0, 0,0, $newwidth , $newheight , $image_width, $image_height ); imagejpeg($imgdst, 'yy.jpg'); imagedestroy($imgsrc); imagedestroy($imgdst); ?>
Dictionary is unordered collection. Python using hash to location element location in dictionary, its very fast to add or remove from dictionary .
Declare a dictionary, there are a lot of different to create dictionary:
The common way to do this is detect Content-Encoding Http header field, if it exist and value is "gzip", using GZIPInputStream to wrap the InputStream.
But the Content-Encoding is not always reliable, some pages output gzip compressed data without Content-Encoding field set.
MySQL is an Open Source database system, its fast and light weight. MySQL is a very good choice for small to medium size project. It can work with all kinds of platform and languages. This tutorial shows how to work with MySQL in Java.
To use MySQL in Java, we have to get the JDBC driver for MySQL. JDBC is a specification of how to generally access a database. Different database vendor should provide a bridge that connect the specific database implementation and JDBC API. Such a bridge is also called driver or connector.To use MySQL in Java, we have to get the JDBC driver for MySQL. JDBC is .
When multiple thread access the same object concurrently , there are two methods to do it: access the original object every time or keep a local private copy of the object. The second way surely faster because access shared memory need some extra works.
But there is a problem: what if the original object changed? In other words, the second method may cause shared variable inconsistent. But for some shared variables , we only read it, never change it or occasionally change it, under this circumstance , its safe to use private local copy and gain the performance.But there is a problem: what if the original object changed? In other words, the second method .
Suppose you want to monitor 100 websites and check whether there are updates. You don't have to check them one by one, you can do it simultaneously with multi-thread. Thus, for A website your thread my open connection and wait for the network to return data, at the same time the thread deal with B website may start to .