Wednesday, November 27, 2013

Convert from pdf to djvu on Linux

One of the main reasons to convert a pdf file into djvu file is to save space. on Linux: 1 sudo apt-get install pdf2djvu 2 pdf2djvu -o output_file input_file If you want to convert djvu to pdf, then you have to install a package from he...
Read more ...

Thursday, September 26, 2013

Latex 对齐方式

LaTeX 对齐方式 一行对齐: \leftline{左对齐} \centerline{居中} \rightline{右对齐} 多行或者段落对齐: 左对齐 \begin{flushleft}...\end{flushleft}, 居中 \begin{center}...\end{center} 右对齐 \begin{flushright}...\end{flushright} LaTeX公式左对齐 LaTeX中公式默认是居中对齐的, 但有时我们希望它能左对齐, 使用的方法如下: 1. \documentclass[a4paper,fleqn]{article} 这个对整篇文章有效. 如果只需要对一行公式进行左对齐的话, 可使用 \begin{flalign} your equation (1) \end{flalign} 2. 对某一个公式: some text here\\ your...
Read more ...

Solution to iPad “Not Charging” When Connected to Computer USB

Download the software > ASUS Ai Char...
Read more ...

Sunday, September 15, 2013

Java 1.6.0_51 breaks MATLAB 2012b

The was an issue in the Java security updates that Apple released for Mac OS X (as mentioned above). These updates install Java 1.6.0_51 and the exact build number looks like this (ending with M4508): Java™ SE Runtime Environment (build 1.6.0_51-b11-456-10M4508) You can check if you have installed the xM4508 versions by running any one of the following commands on the Terminal of your Mac OS X: java -version OR /usr/libexec/java_home...
Read more ...

Wednesday, August 14, 2013

Monday, July 15, 2013

Cut or trim mp3 files with Linux

Link. We are going to see two different options: 1. mpgtx To install this program under Debian $ sudo aptitude install mpgtx Now if you want to trim a mp3 file into 10 pieces just enter this command mpgtx -10 input.mp3 -o output You will get output01.mp3, output02.mp3 .... output10.mp3 files, and now you can easily transport them, use them as ringtones, or anything you need. Now if you want to cut an specific part of...
Read more ...

Tuesday, July 9, 2013

X Forwarding with Putty on Windows

Prerequisites Putty for SSH Xming for the XServer Configuring Putty Add Unix hostname/IP address Switch Protocol to SSH Type name of session in saved sessions Click 'Save' Expand the 'SSH' tab from the 'Category' list Choose 'X11' from 'SSH' list Check 'Enable X11 Forwarding' Put localhost:0 to X display location Choose 'Session' from 'Category' list Click 'Save' Connecting Start Xming Start Putty Double click...
Read more ...

Windows 下配置 Latex

首先安装 MiKTeX 或者 TexLive 然后安装 TeXstudio MiKTeX 的 texmf 路径可以通过 MiKTeX Options (Admin) 程序查看 打开 MiKTeX Options (Admin) 选择 Roots 勾选 Show MiKTeX-mantained root directories 就可以看到了 第三方的 theme 可以直接放到这里面 另外安装 package 可以用 Package Manager (Admin) 程序安装 如果是下载好的宏包安装 可以打开 Package Manager (Admin) 选择 Repository 选择 Change Package Repository 选择 Package shall be installed from a direct...
Read more ...

Thursday, June 27, 2013

Debian change default display manager and session

To change default display manager $  sudo nano /etc/X11/default-display-manager To change default session $ update-alternatives --config x-session-mana...
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...
Read more ...

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...
Read more ...

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...
Read more ...

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    ...
Read more ...

MATLAB中的共轭转置与非共轭转置

对已知矩阵A,MATLAB为我们提供了两种转置运算。A.' 非共轭转置A' 共轭转置 单纯地共轭用:conj() 非共轭可以用:transpose() example:   a =         12.0000                  0 + 2.0000i         5.0000                 0                            ...
Read more ...

决定系数和残差

首先看看几个定义: 总体平方和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...
Read more ...

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}   }   >>...
Read more ...

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...
Read more ...

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...
Read more ...

Linux 下批量去后缀加后缀

1. 删除所有的 .xml 后缀 $ rename 's/\.xml$//' *.xml   2. 给当前目录下所有文件加后缀 .xml for i in *      do mv $i $i".xml"   done &nb...
Read more ...

利用 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...
Read more ...

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...
Read more ...

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 此命令常用于批量下载的情形,把所有需要下载文件的地址放到...
Read more ...

利用 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 重命...
Read more ...

Beamer 中指定 item 前面的符号

\begin{itemize}     \setbeamertemplate{itemize items}{\color{red}$\bullet$}   \item one   \item two   \item three   \end{itemize}   $\bullet$ 可换成任何符号, 比如 \checkmark 或者 \setbeamertemplate{items}[ball]  ...
Read more ...