CTRL+F12
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;
如果不在Activity里:
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = wm.getDefaultDisplay();
import android.provider.Settings.Secure;
private String android_id = Secure.getString(getContext().getContentResolver(), Secure.ANDROID_ID);
- px: 像素
- sp: 缩放无关(scale-independent)的像素,用户可以在系统设置中修改(比如有人眼睛不好,把字体设大一些)
- dip(即): 密度无关(Density-independent)像素
字体用sp;其它所有内容用dip。
通常,MySQL导出导入数据通过mysqldump完成就够了,--where参数也能够选择导出部分数据。但有些情况下,我们需要对数据做些加工,比如增加一个ID字段再导入(把多个站点的数据汇总统计),那么原生的SQL语句就不好处理。CSV格式会是不错的选择。
导出语句:
SELECT *
FROM mytable
WHERE 1
INTO OUTFILE '/tmp/t.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
导入语句:
LOAD DATA INFILE '/tmp/t.csv'
INTO TABLE mytable
CHARACTER SET 'utf8'
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY ‘\n’;
然而,这个方法需要需要赋予数据库用户文件的权限(GRANT FILE ON *.* TO 'user'@'localhost';),这个权限通常不是默认有的。
var json_text = JSON.stringify(your_object);
var your_object = JSON.parse(json_text);
参考:http://stackoverflow.com/questions/191881/serializing-to-json-in-jquery
热门内容
最新内容
- 1 week 2 days ago
- 1 week 4 days ago
- 2 weeks 6 days ago
- 3 weeks ago
- 3 weeks 1 day ago
- 4 weeks ago
- 4 weeks ago
- 4 weeks ago
- 1 month 1 week ago
- 1 month 1 week ago
最新评论