##APK Signe
签名是为了什么

为了保证每个应用程序开发商合法ID,防止部分开放商可能通过使用相同的Package Name来混淆替换已经安装的程序,我们需要对我们发布的APK文件进行唯一签名,保证我们每次发布的版本的一致性(如自动更新不会因为版本不一致而无法安装)。

阅读全文 »

精油价格并不亲民,而且还极易挥发,所以需要妥善保管。

选择深色玻璃瓶

可以避免阳光照射,避免塑胶瓶的化学成分影响精油的品质。

阅读全文 »

bootstrap modal form submit

<div>
<button type="button" id="btn_add" class="btn btn-success save-btn" data-toggle="modal" data-target="#addModal">添加</button>
</div>
<div class="modal" id="addModal" data-backdrop="static" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">添加用户</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form id="id_form_account_create">
<div class="form-group">
<label for="input_name">账号</label>
<input type="text" class="form-control" id="input_name" name="input_name" placeholder="输入账号">
</div>
<div class="form-group">
<label for="input_password">密码</label>
<input type="password" class="form-control" id="input_password" name="input_password" placeholder="输入密码">
</div>
<div class="form-group">
<label for="input_password2">确认密码</label>
<input type="password" class="form-control" id="input_password2" name="input_repassword" placeholder="输入确认密码">
</div>
<div class="form-group">
<label for="input_auth">权限</label>
<select class="form-control" id="input_auth" name="input_auth">
<option>管理</option>
<option>查看</option>
</select>
</div>
<div class="form-group">
<label for="input_comment">备注</label>
<textarea class="form-control" id="input_comment" rows="3" name="input_comment"></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">关 闭</button>
<button type="button" class="btn btn-primary" id="btn_form_save">保 存</button>
</div>
</div>
</div>
</div>

表单数据序列化

(function ($) {
$.fn.form2Json = function () {
var o = {};
var a = this.serializeArray();
$.each(a, function () {
if (o[this.name]) {
if (!o[this.name].push) {
o[this.name] = [o[this.name]];
}
o[this.name].push(this.value || '');
} else {
o[this.name] = this.value || '';
}
});
return JSON.stringify(o);
};
})(jQuery);

Get请求

下面是.ajax的简写方式,一般应用场景都满足了,不行就可以用.ajax来实现

$.getJSON('/api/v1.0/trace', {startTime:'',endTime:'',devId:''})
.done(function (data) {
if (data['code'] == 0) {
// has logged in
toggleNavbarProfile(true);
} else {
// need login
toggleNavbarProfile(false);
}
console.log("second success");
})
.fail(function () {
console.log("error");
})
.always(function () {
console.log("complete");
});
阅读全文 »

以下为网上看到的内容,记录一下备查。

一个页面的展示,从外到内的容器为:屏幕、浏览器以及页面本身。HTML元素展现在页面内,页面展现在浏览器内,而浏览器展现在屏幕内。
通过Js的一些对象可以获取这些容器的高度、宽度。

容器的尺寸是指当前分辨率下的高度、宽度,而不是物理高度、宽度。

阅读全文 »

原文

Go 语言的错误处理

Go 语言的错误处理是基于明确的目的而设计的。你应该从函数中返回所有可能的错误,并且检查/处理这些返回值。和其他语言相比,这一点可能看起来有些繁琐和不人性化,其实并不是这样的。让我们看一些简单的样例以及一些并不琐碎的方面。

阅读全文 »

新装服务器的设置

安装 nano

yum install nano

创建新用户

adduser userName
passwd userName
根据提示输入密码

添加到 “wheel” 用户组,可以使用 sudo 来使用管理员权限。

gpasswd -a userName wheel

添加公钥认证

使用 private SSH key 登录。

在本机生成密钥对 ssh-keygen

切换用户
su - demo

/home/userName 目录下创建
sudo mkdir .ssh
sudo chmod 700 .ssh

这里放入公钥内容,或者把本机生成的公钥上传到这个路径,并且名字是 authorized_keys
sudo nano .ssh/authorized_keys
sudo chmod 600 .ssh/authorized_keys
返回 root 用户
exit

设置 SSH,打开密钥登录功能
编辑 /etc/ssh/sshd_config 文件,进行如下设置:

RSAAuthentication yes
PubkeyAuthentication yes

另外,请留意 root 用户能否通过 SSH 登录,默认为yes:
PermitRootLogin yes

当我们完成全部设置并以密钥方式登录成功后,可以禁用密码登录。这里我们先不禁用,先允许密码登陆
PasswordAuthentication yes

最后,重启 SSH 服务:
service sshd restart

选择认证方式为PublicKey公钥认证,选择刚刚的id_rsa私钥文件即可

安装 nano

yum install nano

更新 python

安装 anaconda

cd /tmp
curl -O https://repo.anaconda.com/archive/Anaconda3-2019.03-Linux-x86_64.sh
sha256sum Anaconda3-2019.03-Linux-x86_64.sh
到下面验证 hash 是否正确
https://docs.anaconda.com/anaconda/install/hashes/

sudo yum install bzip2
bash Anaconda3-2019.03-Linux-x86_64.sh
source ~/.bashrc
conda info

conda create –name py37 python=3.7
conda activate py36
conda deactivate

删除环境:

conda remove –name py36 –all

列出环境:

conda info -e

更新

conda update conda
conda update anaconda

卸载 anaconda

rm -rf ~/anaconda3
rm -rf ~/.condarc ~/.conda ~/.continuum
编辑文件,去掉 anaconda 添加的内容
~/.bashrc

源码更新

python -V

  1. 确保已经将内置的应用升级到最新的可用版本
    yum -y update

  2. 安装所需的 development tools
    yum groupinstall -y development

阅读全文 »

安装过程

查看是否已安装mysql

使用命令rpm -qa|grep mysql查看是否centos下安装了mysql5.1

卸载rpm -e mysql-libs --nodeps

阅读全文 »

字符集

查看当前字符集

show variables like 'character%'; 

快速设置与客户端相关的编码集

set names gbk;

utf8mb4 and utf8

utf8 是 Mysql 中的一种字符集,只支持最长三个字节的 UTF-8字符
utf8mb4 字符集(4字节 UTF-8 Unicode 编码)
要使用 utf8mb4 节省空间,使用 VARCHAR 替换 CHAR

Incorrect string value

将所有能设置的全设置成了utf8,但是使用insert如果使用中文就是不行。
最后也是用set names gbk;就好了。
感觉是因为windows中用的是gbk,我们插入数据的时候打出来的字是gbk,也就是在dos上显示的字就是gbk,而mysql客户端(也就是dos)接收的却是utf8,两个就冲突了。
改为gbk后,mysql会自动把前台(dos界面)的gbk转换为utf8。

ERROR 1064 (42000): You have an error in your SQL syntax … near …

列名称使用的反引号来标识,
c00e2a75.png

Row xx was cut by GROUP_CONCAT()

原来GROUP_CONCAT有个最大长度的限制,超过最大长度就会被截断掉.
进入到mysql命令行下:
可以查询默认长度

SELECT @@global.group_concat_max_len;

设置一下就可以了

SET GLOBAL group_concat_max_len=409600;

Specified key was too long; max key length is 767 bytes

mysql 5.7 默认打开 innodb_large_prefix 选项,没有这个问题.

数据库表采用utf8编码,其中varchar(255)的column进行了唯一键索引
而mysql默认情况下单个列的索引不能超过767位(不同版本可能存在差异)
于是utf8字符编码下,255*3 byte 超过限制

在MySQL5.6里面,设置了innodb_large_prefix=ON、innodb_file_format=barracuda、innodb_file_per_table=ON ,且Innodb表的存储格式为 DYNAMIC 或 COMPRESSED,则前缀索引最多可包含3072个字节,前缀索引也同样适用。

  1. 使用 innodb 引擎;
  2. 启用 innodb_large_prefix 选项,将约束项扩展至3072byte;
  3. 重新创建数据库;
查看设置
show variables like 'innodb_large_prefix';
set global innodb_large_prefix=1;
set global innodb_file_format=BARRACUDA;