基于simple_form
是因为simple_form对表单错误信息展示提供了很好的方案,当然如果只用 form_for
通过列表展示错误信息也可以。
弹窗口提交表单,但不希望刷新页面,即可把Rails model的validation的错误信息展示出来。
function byteToHexString(uint8arr) { | |
if (!uint8arr) { | |
return ''; | |
} | |
var hexStr = ''; | |
for (var i = 0; i < uint8arr.length; i++) { | |
var hex = (uint8arr[i] & 0xff).toString(16); | |
hex = (hex.length === 1) ? '0' + hex : hex; | |
hexStr += hex; |
https://apple.stackexchange.com/questions/171530/how-do-i-downgrade-node-or-install-a-specific-previous-version-using-homebrew | |
1xx Informational | |
100 Continue :continue | |
101 Switching Protocols :switching_protocols | |
102 Processing :processing | |
2xx Success | |
200 OK :ok |
作为选择,我们多数用三位八进制数字的形式来表示权限,第一位指定属主的权限,第二位指定组权限,第三位指定其他用户的权限,每位通过4(读)、2(写)、1(执行)三种数值的和来确定权限。如6(4+2)代表有读写权,7(4+2+1)有读、写和执行的权限。 | |
还可设置第四位,它位于三位权限序列的前面,第四位数字取值是4,2,1,代表意思如下: | |
4,执行时设置用户ID,用于授权给基于文件属主的进程,而不是给创建此进程的用户。 | |
2,执行时设置用户组ID,用于授权给基于文件所在组的进程,而不是基于创建此进程的用户。 | |
1,设置粘着位。 |
http://www.jb51.net/article/43190.htm | |
[...] 位于括号之内的任意字符 | |
[^...] 不在括号之中的任意字符 | |
. 除了换行符之外的任意字符,等价于[^\n] | |
\w 任何单字字符, 等价于[a-zA-Z0-9] | |
\W 任何非单字字符,等价于[^a-zA-Z0-9] | |
\s 任何空白符,等价于[\ t \ n \ r \ f \ v] | |
\S 任何非空白符,等价于[^\ t \ n \ r \ f \ v] | |
\d 任何数字,等价于[0-9] |
### Install OpenJDK | |
cd ~ | |
sudo apt-get update | |
sudo apt-get install openjdk-7-jre-headless -y | |
### Download and Install ElasticSearch | |
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below | |
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.3.1.deb | |
sudo dpkg -i elasticsearch-1.3.1.deb |
% su - | |
% dd if=/dev/zero of=/swap bs=1M count=2048 | |
% mkswap /swap | |
% swapon /swap | |
% vi /etc/fstab | |
.... | |
/swap swap swap defaults 0 0 |
1. MySQL的Scalability问题可以解决: | |
1. 不要使用JOIN等跨库跨表操作 | |
2. MySQL分库分表,APP根据hash( primary key )来访问对应的库表;将MySQL库表部署在不同机器的不同MySQL实例上,实现分布式。可以在create table的时候,默认规划好千库百表 | |
2. 分布式NoSQL,比如MongoDB或CouchDB,不够稳定;除非深入理解,出问题不好解决。不希望重要的在线数据,依赖于有风险的新技术 | |
3. MySQL有一套完整的工具链,和成熟的提升性能的方法论。MySQL DBA可以帮你做这些事情: | |
1. 升级硬件,使用64GB RAM和SSD | |
2. 建MySQL master-salve:master只写,slave只读 |