重启系统后,运行jekyll命令显示
jekyll: commmand not found
使用如下命令解决问题:
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bash_profile
参考:http://stackoverflow.com/questions/15409418/after-installing-jekyll-getting-bash-jekyll-command-not-found
2013年9月21日星期六
2013年9月9日星期一
ubuntu 12.40 安装jekyll
先安装rvm
然后替换 RubyGems 的到淘宝镜像:
然后安装jekyll,在安装jekyll前先安装rdoc,否则会失败,
安装完毕
参考:
1.http://ruby-china.org/wiki/install-rails-on-ubuntu-12-04-server
curl -L https://get.rvm.io | bash -s stable --ruby source ~/.rvm/scripts/rvm rvm install 1.9.3 rvm use 1.9.3 rvm rubygems latest
然后替换 RubyGems 的到淘宝镜像:
gem sources --remove https://rubygems.org/ gem sources -a http://ruby.taobao.org/ gem sources -l
然后安装jekyll,在安装jekyll前先安装rdoc,否则会失败,
gem install rdoc gem install jekyll
安装完毕
参考:
1.http://ruby-china.org/wiki/install-rails-on-ubuntu-12-04-server
2013年9月8日星期日
java.lang.IllegalStateException: Cannot forward after response has been committed in servlet 错误
写jsp程序时遇到这个错误,一般错误的原因是sendredirect后没有返回
解决方法是加一个return或加一个else分支:
但是我的代码中sendRedirect是最后一句代码,后面跟着return,居然还有这个运行错误.
原因在于jsp中response具有缓存大小的限制,如果达到这个限制,那么所有HTTP response headers和写入的html代码都会发送回客户端,也就是response is committed.虽然你没有显式指定返回.
检查了一下我的代码,原来我为了测试用如下代码向response写入了很多单词:
注释掉这段代码之后就可以正常运行了.
参考:
1.http://stackoverflow.com/questions/2123514/java-lang-illegalstateexception-cannot-forward-after-response-has-been-committe/2125045#2125045
2.http://stackoverflow.com/questions/12693975/java-lang-illegalstateexception-cannot-call-sendredirect-after-the-response-h
protected void doPost() {
if (someCondition) {
sendRedirect();
}
forward(); // This is STILL invoked when someCondition is true!
}
解决方法是加一个return或加一个else分支:
protected void doPost() {
if (someCondition) {
sendRedirect();
return;
}
forward();
}
或protected void doPost() {
if (someCondition) {
sendRedirect();
}else{
forward();
}
}
但是我的代码中sendRedirect是最后一句代码,后面跟着return,居然还有这个运行错误.
原因在于jsp中response具有缓存大小的限制,如果达到这个限制,那么所有HTTP response headers和写入的html代码都会发送回客户端,也就是response is committed.虽然你没有显式指定返回.
检查了一下我的代码,原来我为了测试用如下代码向response写入了很多单词:
PrintWriter out = response.getWriter(); for( String str: result ) out.print(str + " "); out.println(result.size()); out.close();
注释掉这段代码之后就可以正常运行了.
参考:
1.http://stackoverflow.com/questions/2123514/java-lang-illegalstateexception-cannot-forward-after-response-has-been-committe/2125045#2125045
2.http://stackoverflow.com/questions/12693975/java-lang-illegalstateexception-cannot-call-sendredirect-after-the-response-h
2013年9月2日星期一
ubuntu12.04 安装 texlive和texstudio
二者都是从ppa安装,因为源里面版本可能会旧一些.
安装时间挺长,耐心等待.
安装完后,我还安装了几个包,如下:
最后,安装了苹果下面的"Hiragino Sans GB" 字体
下载之后,如下操作:
ok了.
参考:
1.https://launchpad.net/~blahota/+archive/texstudio/
2.https://launchpad.net/~texlive-backports/+archive/ppa
3.http://lzuzyy.blog.ubuntu.org.cn/content/texlive2012texstudio%EF%BC%88texmaker252%EF%BC%89%E7%9A%84%E4%B8%AD%E6%96%87%E9%85%8D%E7%BD%AE
sudo add-apt-repository ppa:texlive-backports/ppa sudo add-apt-repository ppa:blahota/texstudio sudo apt-get update sudo apt-get install texlive-xetex texstudio
安装时间挺长,耐心等待.
安装完后,我还安装了几个包,如下:
sudo apt-get install texlive-fonts-recommended sudo apt-get install texlive-lang-cjk这两个包是和中文,字体相关的,没装之前编译tex文件会出错,装了之和就没问题了.
最后,安装了苹果下面的"Hiragino Sans GB" 字体
下载之后,如下操作:
sudo mkdir /usr/share/fonts/applefonts sudo chmod 777 /usr/share/fonts/applefonts sudo mkfontscale sudo mkfontdir sudo fc-cache -fsv
ok了.
参考:
1.https://launchpad.net/~blahota/+archive/texstudio/
2.https://launchpad.net/~texlive-backports/+archive/ppa
3.http://lzuzyy.blog.ubuntu.org.cn/content/texlive2012texstudio%EF%BC%88texmaker252%EF%BC%89%E7%9A%84%E4%B8%AD%E6%96%87%E9%85%8D%E7%BD%AE
2013年8月21日星期三
ubuntu12.04 安装grive
grive是google drive的linux客户端,安装过程如下:
然后,创建一个用于存放网盘文件的文件夹,假设为a,
第一次使用grive时需要grive命令中的-a选项获得google drive的权限.
打开终端现实的链接,选择allow,复制验证码到终端中,grive会自动同步网盘中的文件.
以后想同步的话就在终端切换到网盘目录,然后执行
ps:我第一次同步后发现所有文件权限都不够,直接修改如下:
参考:http://www.webupd8.org/2012/05/grive-open-source-google-drive-client.html
sudo add-apt-repository ppa:nilarimogard/webupd8 sudo apt-get update sudo apt-get install grive
然后,创建一个用于存放网盘文件的文件夹,假设为a,
mkdir a cd a sudo grive -a#不加sudo的话,我这里会出现错误.
第一次使用grive时需要grive命令中的-a选项获得google drive的权限.
打开终端现实的链接,选择allow,复制验证码到终端中,grive会自动同步网盘中的文件.
以后想同步的话就在终端切换到网盘目录,然后执行
sudo grive
ps:我第一次同步后发现所有文件权限都不够,直接修改如下:
sudo chmod -R 777 *
参考:http://www.webupd8.org/2012/05/grive-open-source-google-drive-client.html
2013年8月20日星期二
ubuntu12.04 安装stardict
从ubuntu源里安装的版本较早,所以下载安装文件安装,下载地址:https://code.google.com/p/stardict-3/.
安装后下载词典,下载地址:https://code.google.com/p/stardict-3/wiki/DownloadDictionaries.
下载后解压到/usr/share/stardict/dict目录下,重启stardict.
安装后下载词典,下载地址:https://code.google.com/p/stardict-3/wiki/DownloadDictionaries.
下载后解压到/usr/share/stardict/dict目录下,重启stardict.
(转)把mat文件保存为txt格式而不损失精度
Subject:
How can I avoid truncation and loss of precision when saving my data in MATLAB?Problem Description:
I have tried saving my data with SAVE -ASCII (or FPRINTF, DLMWRITE, etc.) and notice that I lose precision when I do this.Solution:
To obtain 16-digit ASCII format using the SAVE function, use the following command:
save -ascii -double
Following is an example of writing "pi" to a TXT-file with double precision using DLMWRITE:
dlmwrite('myfile1.txt', pi, 'delimiter', '\t', 'precision', 16)
For more information on precision specification, refer the respective documentation pages by executing the following MATLAB commands:
doc save
doc dlmwrite
Information on C-style format string allowed in DLMWRITE can be found here:
doc sprintf参考: http://www.mathworks.cn/support/solutions/en/data/1-1CBW5/?product=SL&solution=1-1CBW5
订阅:
博文 (Atom)