https://hourofcode.com/us/learn
processing hour of code
http://hello.processing.org/editor/
2. BezierSQLib
http://bezier.de/processing/libs/sql/
*先將BezierSQLib的檔案(解zip)放到Processing→libraries
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDc03hT-gGY6JmEyPabDof619GCVy7U8kMszHJA1oArPJXdYRYV69JHa3LGefDRMbJpPIHvtAUanNwM4B0WiRloHpHKAhPcJCJOKMgZgtyzFK1tjMllCAHHnGiFMvWh3brSfjweooX-Nk/s1600/2016-12-08_150622.jpg)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhX5V5yWKgx8bX8EJPSDao4qb_Ci-JXMQKDUjX4BkVS8g50LD4W7SUcmUkZX2jQjGWH_qIAazvxmksJx6so3OkMJ3CQLILDOLDMzZniZa05XCaTLWPyfGIJ5bfrUdwEtGNeLQ_wtExcneU/s1600/2016-12-08_150655.jpg)
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidCLuG6IkNrgPtw8JUiTht5umjmD-yQXOfC6W8LHRD3365tvZPXPRDKzljz2FIiRK3RdxCzhQei4Ci3Ok0UwqZBrBZkryWLODDdYcjR5-2-SwnTYaDoXybevF5xBKawl6xwVnFXU-lrCM/s1600/2016-12-08_150708.jpg)
//Library by fjenett
//Example created on 2014-03-12 by Powder
//Tested with Processing 3.0a5
import de.bezier.data.sql.*;
String dbHost="localhost";//if you are using a local database,this should be fine
String dbPort="3306";//replace with database port,MAMP standard is 8889
String dbUser="root";//replace with database username,MAMP standard is "root"
String dbPass="";//replace with database password,MAMP standard is "root"
String dbName="ntnu_ice";//replace with database name
String tableName="name";//replace with table name
String result="";
MySQL msql;
void setup(){
size(600,600);
msql=new MySQL( this,dbHost+":"+dbPort,dbName,dbUser,dbPass);
if(msql.connect()){
//get number of rows
msql.query("SELECT COUNT(*) FROM"+tableName);
msql.next();
println("Number of rows:"+msql.getInt(1));
println();
//access table
msql.query("SELECT*FROM"+tableName);
while(msql.next()){
//replace "first_name" and "last_name" with column names from your table
String s1=msql.getString("ID");
String s2=msql.getString("Tele");
println(s1+""+s2);
result=s1;
result+=""+s2;
}
}else{
println("Yikes,there was an error!");
}
}
void draw(){
textSize(50);
text(result,10,100);
}
沒有留言:
張貼留言