yjiang's cake

mysql 命令行下快速执行sql语句

mysql -uroot -proot dbname -e "sql command"

ubuntu下运行boinc

使用源安装:

aptitude update
aptitude install boinc

安装新版:

aptitude update
apt-get install libxss1 libstdc++5 ia32-libs freeglut3
wget http://boinc.berkeley.edu/dl/boinc_7.2.33_x86_64-pc-linux-gnu.sh
chmod +x boinc_7.2.33_x86_64-pc-linux-gnu.sh
./boinc_7.2.33_x86_64-pc-linux-gnu.sh
cd BOINC

进行计算:

 boinc --daemon
 boinccmd --project_attach http://www.worldcommunitygrid.org/ 弱帐户密钥
 boinccmd --project http://www.worldcommunitygrid.org/ update
 #或者
./run_client --daemon
./boinc --check_all_logins --redirectio --dir /var/lib/boinc-client
./boinccmd --project_attach http://www.worldcommunitygrid.org/ 弱帐户密钥
./boinccmd --project http://www.worldcommunitygrid.org/ update
  • 弱账户密钥可从WCG官网 的settings->我的概要文件 查看.

  • 更多boinc命令

  • 提示can't connect to local host可能是由于boinc客户端未运行,需要先执行boinc --check_all_logins --redirectio --dir /var/lib/boinc-client

闭包

访问函数内部的函数

function a(){ 
  var test = 1; 
    var b = function(){ 
      alert(test); 
    } 
    return b;
}

var c = a(); //闭包

c();

javascript 语言精粹中解释为

通过函数字面量创建的函数对象包含一个连接到外部上下文的连接.这被成为闭包.

  1. 函数字面量: var b = function(){ /*action*/ } 中, function(){ /*action*/ }被认为是函数字面量,在调用时,函数不会执行,而是被当做数据来传递.

2.上下文: 由context翻译来,叫容器可能更恰当一些.其实整个function a(){ }中出去b的部分,既是上下文.

cubieboard自动挂载SATA硬盘及U盘

使其支持ntfs格式设备可读写

sudo aptitude install ntfs-3g

自动挂载

vi /etc/udev/rules.d/10-usbstorage.rules

写入以下内容

KERNEL!="sd*", GOTO="media_by_label_auto_mount_end"
SUBSYSTEM!="block",GOTO="media_by_label_auto_mount_end"
IMPORT{program}="/sbin/blkid -o udev -p %N"
ENV{ID_FS_TYPE}=="", GOTO="media_by_label_auto_mount_end"
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
ENV{ID_FS_LABEL}=="", ENV{dir_name}="Untitled-%k"
ACTION=="add", ENV{mount_options}="relatime,sync"
ACTION=="add", ENV{ID_FS_TYPE}=="vfat", ENV{mount_options}="iocharset=utf8,umask=000"
ACTION=="add", ENV{ID_FS_TYPE}=="ntfs-3g", ENV{mount_options}="iocharset=utf8,umask=000"
ACTION=="add", RUN+="/bin/mkdir -p /media/%E{dir_name}", RUN+="/bin/mount -o $env{mount_options} /dev/%k /media/%E{dir_name}"
ACTION=="remove", ENV{dir_name}!="", RUN+="/bin/umount -l /media/%E{dir_name}", RUN+="/bin/rmdir /media/%E{dir_name}"
LABEL="media_by_label_auto_mount_end"

保存重启即可

Copyright © 2016 yjiang's cake

返回顶部