This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void testUpdateCouchBaseWithoutView() { | |
print("Testing Update CouchBase without View..."); | |
CouchClient _dbclient; | |
CouchClient.connect([Uri.parse("http://10.1.4.112:8091/pools")], "default", "").then((CouchClient c) { | |
_dbclient = c; | |
}).then((_) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void prepareCouchBase() { | |
print("Testing Insert CouchBase"); | |
CouchClient _dbclient; | |
CouchClient.connect([Uri.parse("http://10.1.4.112:8091/pools")], "default", "").then((CouchClient c) { | |
_dbclient = c; | |
}).then((_) { | |
int startTime = new DateTime.now().millisecondsSinceEpoch; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void testQueryCouchBaseWithoutView() { | |
print("Testing Query CouchBase without View..."); | |
CouchClient _dbclient; | |
CouchClient.connect([Uri.parse("http://10.1.4.112:8091/pools")], "default", "").then((CouchClient c) { | |
_dbclient = c; | |
}).then((_) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void testQueryCouchBaseWithViewAndStaleFalse() { | |
print("Testing Query CouchBase with View..."); | |
CouchClient _dbclient; | |
CouchClient.connect([Uri.parse("http://10.1.4.112:8091/pools")], "default", "").then((CouchClient c) { | |
_dbclient = c; | |
}).then((_) { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void preparePostgreSQL() { | |
print("Testing Insert into postgresql..."); | |
var uri = 'postgres://name:[email protected]:5432/mydb'; | |
connect(uri).then((conn) { | |
//conn.execute("create table data (id int, name text, description text, PRIMARY KEY(id)); ").whenComplete(() { | |
// conn.close(); | |
//}); | |
int startTime = new DateTime.now().millisecondsSinceEpoch; | |
List<Future> futures = new List(); | |
String sql = ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ArticleSerializer(serializers.ModelSerializer): | |
tags = serializers.RelatedField(many=True) | |
class Meta: | |
model = Article | |
fields = ('title','content','tags') | |
owner = serializers.Field(source='owner.username') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## find out mount/partition a directory or file is on? | |
df -P file/goes/here | tail -1 | cut -d' ' -f 1 | |
# delete line 135 in file, and save origin file into file.bak | |
sed -i.bak -e '135d' file | |
# Recursive find string from files | |
grep -R -i -n '<string>' <directory> | |
# nohup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 相框效果 | |
img { | |
box-shadow: 1px 1px 2px rgba(0,0,0,0.3); | |
padding: 12px; | |
background: rgba(255,255,255,0.9); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 更新時間 | |
UPDATE table SET end_dt = DATE_ADD(end_dt, INTERVAL 15 second) | |
# Command Line Run SQL | |
mysql -u root dbname < "path.sql" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MySQL 連線 | |
String driver = "com.mysql.jdbc.Driver"; | |
Class.forName(driver); | |
String conUrl = "jdbc:mysql://localhost/smft?user=root&password=&charset=utf8&characterEncoding=UTF-8r"; | |
Connection con = null; | |
PreparedStatement ps = conn.prepareStatement(SQL); | |
ResultSet rs = pstmt.executeQuery(); | |
while (rs.next()) { | |
rs.getString("UserName"); | |
} |
OlderNewer