DisplayMetrics metric = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metric); double diagonalPixels = Math.sqrt(Math.pow(metric.widthPixels, 2) + Math.pow(metric.heightPixels, 2)); double screenSize = diagonalPixels / (160 * metric.density);
计算X和Y的英寸:
x = metric.widthPixels / metric.xdpi;
y = metric.heightPixels / metric.ydpi;
ssh 连接时加-v参数,可以看到详细的连接过程
仔细看连接慢的地方
一般情况是GSSAPIAuthentication导致的
修改/etc/ssh/ssh_config文件,取消GSSAPIAuthentication:
GSSAPIAuthentication no
修改/etc/ssh/sshd_config文件,取消GSSAPIAuthentication:
GSSAPIAuthentication no
并且关闭DNS
UseDNS no
然后重启sshd
strcut_var = cast(c_return_struct_point,POINTER(PYTHON_STRUCT)).contents
strcut_var.x = 100
#include <sys/stat.h> unsigned long get_file_size(const char *path) { unsigned long filesize = -1; struct stat statbuff; if(stat(path, &statbuff) < 0){ return filesize; }else{ filesize = statbuff.st_size; } return filesize; }
LayoutInflater是找layout文件夹下的某个xml布局文件
findViewById是找某一个xml下的具体 widget控件。
[root@srv-data-2 ~]# ethtool em1 Settings for em1: Supported ports: [ TP ] Supported link modes: 100baseT/Half 100baseT/Full 1000baseT/Full 10000baseT/Full Supports auto-negotiation: Yes Advertised link modes: 100baseT/Half 100baseT/Full 1000baseT/Full 10000baseT/Full Advertised pause frame use: Symmetric Receive-only Advertised auto-negotiation: Yes Speed: 10000Mb/s Duplex: Full Port: Twisted Pair PHYAD: 17 Transceiver: internal Auto-negotiation: on MDI-X: Unknown Supports Wake-on: g Wake-on: d Current message level: 0x00000000 (0) Link detected: yes
private List<File> collectFiles(File dir, String ext, List<File> files) { if(dir.exists() && dir.canRead()) { File[] lf = dir.listFiles(); if(lf == null) { lf = new File[0]; } for (File f : lf) { if (f.getName().endsWith(ext)) { files.add(f); } } } return files; }
List<LocalIndexInfo> category = new ArrayList<LocalIndexInfo>(); for(LocalIndexInfo i : category){ if(i.isBackupedData() == backuped && val.getType() == i.getType() ){ return i; } }
函数 描述
int(x [,base ]) 将x转换为一个整数
long(x [,base ]) 将x转换为一个长整数
float(x ) 将x转换到一个浮点数
complex(real [,imag ]) 创建一个复数
str(x ) 将对象 x 转换为字符串
repr(x ) 将对象 x 转换为表达式字符串
eval(str ) 用来计算在字符串中的有效Python表达式,并返回一个对象
tuple(s ) 将序列 s 转换为一个元组
list(s ) 将序列 s 转换为一个列表
chr(x ) 将一个整数转换为一个字符
unichr(x ) 将一个整数转换为Unicode字符
ord(x ) 将一个字符转换为它的整数值
hex(x ) 将一个整数转换为一个十六进制字符串
oct(x ) 将一个整数转换为一个八进制字符串