單純我想記錄而已。
只點了漢堡蛋餅和奶茶而已,
奶茶很普通竟然要30塊!
漢堡好吃但也普普,
唯一心動的就是蛋餅,
加了點它們的辣椒更好吃。
好想再吃可是桃園怎麼沒有!
var coordinates:Array = new Array();
var started:Number = getTimer();
for (var i:int = 0; i< 300000; i++)
{
coordinates[i] = Math.random()*1024;
}
trace(getTimer() - started);
// output: 107
var coordinates:Vector.<Number> = new Vector.<Number>();
var started:Number = getTimer();
for (var i:int = 0; i< 300000; i++)
{
coordinates[i] = Math.random()*1024;
}
trace(getTimer() - started);
// output: 72
// Specify a fixed length and initialize its length
var coordinates:Vector.<Number> = new Vector.<Number>(300000, true);
var started:Number = getTimer();
for (var i:int = 0; i< 300000; i++)
{
coordinates[i] = Math.random()*1024;
}
trace(getTimer() - started);
// output: 48
// Store the reused value to maintain code easily
const MAX_NUM:int = 300000;
var coordinates:Vector.<Number> = new Vector.<Number>(MAX_NUM, true);
var started:Number = getTimer();
for (var i:int = 0; i< MAX_NUM; i++)
{
coordinates[i] = Math.random()*1024;
}
trace(getTimer() - started);
// output: 47
圖一 Application_without_ConnectionPool
|
圖二 Application_with_ConnectionPool
|
var mysql = require('mysql');
var DATABASE = 'xpec';
var TABLE ='member';
var connection = mysql.createConnection({
host : 'localhost',
user : 'aaa',
password : 'xpec',
database : 'xpec'
});
基本查詢表格印出表格內容
//connection.query()已經建立連建,不用再寫connection.connect()
connection.query('SELECT * FROM ' + TABLE, function(err, results){
if(err) throw err;
console.log(results);
});
connection.end(); //結束連線
table插入資料
connection.query('INSERT INTO ' + TABLE +' SET ? ',{User: 'jjjj', Psd:'123'},function(err, result){
console.log(result.insertId);
});
connection.end();
修改update table資料
connection.query('UPDATE ' + TABLE + ' SET ' +
'Psd=? WHERE id=?',['45645646',1],function (err,result){
if(err){
console.log(err);
}else{
console.log(result.affectedRows);
}
});
刪除table資料
connection.query('DELETE FROM ' + TABLE +
' WHERE id = ? ',[3] ,function(err, result){
if(err){
console.log(err);
}else{
console.log(result.affectedRows);
}
});