Wednesday, December 16, 2009

How-To: Export an iWeb project file - MacUser

Find the project file of iWeb so that you can design your web page everywhere.

How-To: Export an iWeb project file - MacUser

Tuesday, December 8, 2009

Go to sleep for a while in Java Program using Thread

// import the library
import java.lang.Thread;
try{
	// sleep for 1 second (1000 milliseconds)
	Thread.sleep(1 * 1000);
}
catch(InterruptedException e){
	e.printStackTrace();
}
finally{
}

Friday, December 4, 2009

MySQL :: Connector/J 5.1 -> Database driver you need to connect to MySQL Database Server using Java (JDBC)

MySQL :: Connector/J 5.1

  1. Download “Source and Binaries (zip)” or “Source and Binaries (tar.gz)”.
  2. Decompress (unzip) the archive file.
  3. Include the .jar file in your library path. (Maybe you have IDE like netbeans or eclipse)
  4. Write you code.
  5. (Some Sample Code : http://aventurineyao.blogspot.com/2009/12/check-if-there-are-some-records-in.html )

Check if there are some records in ResultSet return from MySQL Database using Java

import java.sql.*;
import java.util.*;
import java.sql.DriverManager;
// return true if some records satisfy the condition, otherwase, false.
public Boolean IsExifPhotoIdTimeLongitudeLatitude( String photoId, String time, String longitude, String latitude ){
	Connection con = null;
	String url = "";
	String driver = "";
	Statement stmt = null;
	String query = "";
	// your database table name
	String targetSheet = "db_table_name";
	ResultSet result = null;
	Boolean hasRecord = false;
	// your query
	query = "SELECT * FROM `"+ targetSheet +"` WHERE photoId='" + photoId + "' AND time='" + time + "' AND longitude='" + longitude + "' AND latitude='" + latitude + "'";
	try{
		// connect to mysql database
		
		url = "jdbc:mysql://127.0.0.1:3306/database_name";
		driver = "com.mysql.jdbc.Driver";
		p = new Properties();
		Class.forName(driver).newInstance();
		con = DriverManager.getConnection(url, "user_name", "pass_word");
		
		// create statement
		stmt = con.createStatement();
		
		// execute your query
		result = stmt.executeQuery(query);
			
		// result.first() will return false if there is no record
		// Important: executeQuery never return null
		
		if( result.first() ){
			hasRecord = true;
		}
	}
	catch( Exception e ) {
		e.printStackTrace();
	}
	finally {
	}
	return hasRecord;
}

Monday, November 30, 2009

Fusr - Flickr user nsid lookup

Fusr - Flickr user nsid lookup

Reporting TOEFL iBT Scores - College Confidential

From
Reporting TOEFL iBT Scores - College Confidential: "10-08-2007, 11:20 AM #3
b@r!um
Senior Member

Join Date: Aug 2006
Posts: 4,239

I have been under the impression that the 'additional paper candidate score report' is intended for the personal use of the test taker whereas the 'additional score report' is meant for colleges.
Anyways, I selected the 'additional score reports' and it worked just fine"
-----------------------------------------
So, I think I can just select the 'additional score reports' for the university.

Thursday, November 26, 2009

DIYMacServer » Adding the mcrypt module to PHP on Snow Leopard

DIYMacServer » Adding the mcrypt module to PHP on Snow Leopard