To change default display manager
$ sudo nano /etc/X11/default-display-manager
To change default session
$ update-alternatives --config x-session-mana...
Thursday, June 27, 2013
Debian change default display manager and session
Read more ...
Wednesday, June 26, 2013
Linux command for username and group
Change or rename user name and UID (user-id)# usermod -l <new_username> <old_username># usermod -u UID <username>
List username from a group
# getent group <groupname>
Remove username from a group
# gpasswd -d <username> <group>
Remove/Delete a user account
# userdel <username>
The following command will also remove user home directory
# userdel -r <username>
Add...
Control Volume with Keyboard Shortcut in Xfce
Add an Xfce shortcut by going to Applications > Settings > Keyboard.
Code for volume up/down/mute
1 amixer set Master 3%+2 amixer set Master 3%-3 amixer set Master toggl...
Friday, June 21, 2013
Ubuntu/Debian 下安装 VirtualBox 虚拟 Win7
官方网站:http://www.virtualbox.org/
VirtualBox中虚拟Win7
运行Vbox
–》单击左上角New,新建虚拟环境。
–》填写名称和将要虚拟的操作系统版本。
–》然后是内存设置,默认即可,如果host主机内存够大,可以多设。
–》接下来虚拟硬盘,一路默认即可,最后确认,完成。
安装Win7
–》准备好系统镜像。win7.iso。
–》单击左上角Settings,会提示:Failed to access the USB subsystem.VirtualBox is not currently allowed to access USB devices. You can change this by adding...
MATLAB FUNCTION accumarray
A = accumarray(subs,val,sz,fun,fillval)
sub:提供累计信息的指示向量
val:提供累计数值的向量
sz:控制输出向量A的size
fun:用于计算累计后向量的函数,默认为@sum,即累加
fillval:填补A中的空缺项,默认为0
例子:
myfun = @(x) 1./(2*numel(x)) * sum(x);
myfun = @(x)1./(2*numel(x))*sum(x)
subs=[7,2,5,7,2]';
subs = 7 ...
MATLAB中的共轭转置与非共轭转置
对已知矩阵A,MATLAB为我们提供了两种转置运算。A.' 非共轭转置A' 共轭转置
单纯地共轭用:conj()
非共轭可以用:transpose()
example:
a =
12.0000 0 + 2.0000i 5.0000 0 ...
决定系数和残差
首先看看几个定义:
总体平方和TSS( total sum of squares)
回归平方和RSS(regression sum of squares)
残差平方和ESS(Residual sum of squares)
其中,yi表示实验数据,fi 表示模拟值,表示样本平均值。
决定系数(Coefficient of determination)
在一定程度上反应了模型的拟合优度。
其实就是回归平方和在总体平方和中所占的比例。因为TSS=RSS+ESS
The better the linear regression (on the right) fits the data in comparison to the...
Latex(Emacs+Auctex+Jabref)中参考文献处理
>> 文献管理用 Jabref,可以很方便的管理文献,其 BibTeX 文献数据库可供 Latex 或其他软件使用,可与 emacs,vim,kile 等多种软件结合使用。所有文献信息都被记录在bib文件中。格式如下(myref.bib)。
@ARTICLE{Journel1994,
author = {Journel, André and Xu, Wenlong},
title = {Posterior identification of histograms conditional to local data},
journal = {Mathematical Geology},
year = {1994},
volume = {26},
pages = {323-359},
note = {10.1007/BF02089228},
__markedentry = {[mao]},
abstract = {Stochastic simulation techniques which do not depend on a back transform
step to reproduce a prior marginal cumulative distribution function
(cdf) may lead to deviations from that distribution which are deemed
unacceptable. This paper presents an algorithm to post process simulated
realizations or any spatial distribution to reproduce the target
cdf in the case of continuous variables or target proportions in
the case of categorical variables, yet honoring the conditioning
data. Validations conducted for both continuous and categorical cases
show that. by adjusting the value of a correction level parameter
, the target cdf or proportions can be well reproduced without significant
modification of the spatial correlation patterns of the original
simulated realizations .},
affiliation = {Stanford University Geological and Environmental Sciences Department
94305 Stanford California},
issn = {0882-8121},
issue = {3},
keyword = {Earth and Environmental Science},
owner = {mao},
publisher = {Springer Netherlands},
timestamp = {2011.10.13},
url = {http://dx.doi.org/10.1007/BF02089228}
}
>>...
Set another viewer for auctex in emacs
>> Open an tex file;
>> LaTeX -> Customize AUCTeX -> Extend this menu;
>> Then LaTeX -> Customize AUCTeX -> TeX Command -> TeX Output View Style;
>> Find a line somehow like ''Extension: ^pdf";
>> Change Command to viewer you want. e.g. evince %o %(outpage) to okular %o %(outpage);
>> Click “Save for future session...
Linux 下批量解压文件
find -maxdepth 1 -name "*.bz2" | xargs -i tar xvjf {}
这条命令可解压当前目录下的所有bz2文件。maxdepth表示搜索深度,1代表只搜索当前目录。
find -maxdepth 1 -name "*.tar" | xargs -i tar xvf {}
可解压tar文件。
find -maxdepth 1 -name "*.tar.gz" | xargs -i tar zxvf {}
可解压tar.gz...
Linux 下批量去后缀加后缀
1. 删除所有的 .xml 后缀
$ rename 's/\.xml$//' *.xml
2. 给当前目录下所有文件加后缀 .xml
for i in *
do mv $i $i".xml"
done &nb...
利用 ssh -X 登录服务器打开 xterm 等
>> 首先确保 /etc/ssh/sshd_config 中
X11Forwarding yes
>> 然后在 host 上 check DISPLAY
$ echo $DISPLAY
如果显示
:0
继续输入
$ export DISPLAY=urworkstationIP:0.0
urworkstationIP 就是你想要显示 xterm 的客户端的IP。
>> 然后登录是使用
$ ssh -X host...
MATLAB 中用 spline 代替 solve/finvers 数字求解反函数
example:
Cg=sym('exp(-((-log(u))^alpha + (-log(v))^alpha)^(1/alpha))');
cu=diff(Cg,'u');
c=subs(cu,{'u','alpha'},[0.8,2]);
vr=linspace(0,1,1000);
tr=subs(c,'v',vr);
t=rand(100,1);
v=spline(tr,vr,t);
如果直接用solve/finvers求解c。matlab提示无解。
##
cu是Cg对u的偏导,c为偏导函数中带入u=0.8 alpha=2得到的只含变量v的函数。
vr和tr是为了生成一定数量的pairs,以便spline函数求反函数的时候插值。
plot(vr,tr,'--')
可以看到c函数的图。
t为随机生成的100个点,v是这100个点对应的反函数值!
如果是:
v=spline(vr,tr,t);
那么就是简单的插值。
help...
wget 使用技巧
wget 是一个命令行的下载工具。对于我们这些 Linux 用户来说,几乎每天都在使用它。下面为大家介绍几个有用的 wget 小技巧,可以让你更加高效而灵活的使用 wget。
$ wget -r -np -nd http://example.com/packages/
这条命令可以下载 http://example.com 网站上 packages 目录中的所有文件。其中,-np 的作用是不遍历父目录,-nd 表示不在本机重新创建目录结构。
$ wget -r -np -nd --accept=iso http://example.com/centos-5/i386/
与上一条命令相似,但多加了一个 --accept=iso 选项,这指示 wget 仅下载 i386 目录中所有扩展名为 iso 的文件。你也可以指定多个扩展名,只需用逗号分隔即可。
$ wget -i filename.txt
此命令常用于批量下载的情形,把所有需要下载文件的地址放到...
利用 MATLAB 对文件批量重命名
>> matlab 中 strrep 函数可以更改文件扩展名。
>> matlab 中 unix system ! 都可以让你在 matlab 中执行系统命令。
比如:
!mv a.tex b.tex
unix('mv a.tex b.tex')
system('mv a.tex b.tex')
>> 再加上 dir 函数 以及一个 for-loop 就可以对文件进行批量重命名了。
当然,windows 下应该是用 rename 重命...
Beamer 中指定 item 前面的符号
\begin{itemize}
\setbeamertemplate{itemize items}{\color{red}$\bullet$}
\item one
\item two
\item three
\end{itemize}
$\bullet$ 可换成任何符号, 比如 \checkmark
或者
\setbeamertemplate{items}[ball] ...
Latex 如何去掉 subfigure 中标注 a, b, c 等
导言区加上
\makeatletter
\renewcommand{\@thesubfigure}{\hskip\subfiglabelskip}
\makeatother ...
terminal 下 nohup 不产生 nohup.out
$ nohup yourprogram >/dev/null 2>/dev/null &
e.g.
$ nohup dolphin ~/ >/dev/null 2>/dev/null & &nbs...
Linux 中安装 Dropbox
注册点这里:链接1 (你我各额外获得250M容量)
Kubuntu安装看这里:链接1, 链接2
Ubuntu下安装点这里:链接1
Lubuntu安装点这里:链接1 开机启动看这里:链接1
Debian下编译看这里:链接1 有代理的话看这里:链接1
翻墙看这里:链接1
增加容量:链接1
本人安装过程:
debian(64bit)
>> 下载 Dropbox daemon(64bit)
>> 解压到根目录 ~/ (解压后文件夹是隐藏的)
>> shell 中输入
~/.dropbox-dist/dropboxd
>> 输入帐号信息就好了
附 Dropbox daemon(32bit)
Lubuntu(32bit)
>> 同样也是下载...
Subscribe to:
Posts (Atom)