After remove Server.app, my apache2 on Mac OS X 10.9.2 Mavericks couldn’t start normally while everything looks OK. After carefully studied the log file through Console.app and looked into the content of /usr/sbin/apachectl, I realized that the starting process of apache in OS X is quite different than that in Linux: it uses launchctl!
So, I searched the apache launchctl config file:/System/Library/LaunchDaemons/org.apache.httpd.plist. Aha! it said:
The key SERVER_INSTALL_PATH_PREFIX and ProgramArguments were modified by Server.app aparently. Just recover them to /usr and /etc/apache2/http.conf, there, it works again!
以前一直傻傻的 用 \begin{verbatim} 或者 listing 的方式在文章中加 R 代码 然后再手工 include 结果的方式,现在知道了 Sweave,终于可以结束这段傻 不楞登的过程直接自动化了。
\documentclass[a4paper, 12pt]{article}
\begin{document}
\title{emacs \& Sweave}
\author{Wang Jun}
\maketitle
\section{Now begins R Sweave test}
First Save this file as example.Rnw
Then run Sweave("example") in R
Compile the generated tex file example.tex with pdflatex or xelatex (I prefer XeLeTeX)
Here you got the Sweaved R script
%%%%%%%%%%%%% Here begins the Main Content
This is just a simple example
<<>>=
library(maps)
library(mapdata)
###map("china")
x=rnorm(100)
y=rnorm(100)
lm(y~x)
@
Now that you have tried Sweave, how does it perform?
\end{document}
set mouse=a "启用鼠标
"双引号开始的行为注释行,下同
"去掉讨厌的有关vi一致性模式,避免以前版本的一些bug和局限
set nocompatible
set backspace=indent,eol,start
set showcmd
"显示行号
set number
"检测文件的类型
filetype on
"记录历史的行数
set history=1000
"背景使用黑色
"set background=dark
"语法高亮度显示
syntax on
"下面两行在进行编写代码时,在格式对起上很有用;
"第一行,vim使用自动对齐,也就是把当前行的对起格式应用到下一行;
"第二行,依据上面的对起格式,智能的选择对齐方式,对于类似C语言编
"写上很有用
set autoindent
set smartindent
"第一行设置tab键为4个空格,第二行设置当行之间交错时使用2个空格
set expandtab ""# 使用space代替tab.
set tabstop=4 ""# 四个空格。
set shiftwidth=2 ""# 自动缩进的宽度。
"设置匹配模式,类似当输入一个左括号时会匹配相应的那个右括号
set showmatch
"去除vim的GUI版本中的toolbar
"set guioptions-=T
"当vim进行编辑时,如果命令错误,会发出一个响声,该设置去掉响声
set vb t_vb=
"在编辑过程中,在右下角显示光标位置的状态行
set ruler
"默认情况下,寻找匹配是高亮度显示的,该设置关闭高亮显示
set nohls
"查询时非常方便,如要查找book单词,当输入到/b时,会自动找到第一
"个b开头的单词,当输入到/bo时,会自动找到第一个bo开头的单词,依
"次类推,进行查找时,使用此设置会快速找到答案,当你找要匹配的单词
"时,别忘记回车
set incsearch
"修改一个文件后,自动进行备份,备份的文件名为原文件名加“~“后缀
"NCL的语法高亮等
au BufRead,BufNewFile *.ncl set filetype=ncl
au! Syntax newlang source $VIM/ncl.vim
"Show autocomplete menus.
set complete-=k complete+=k " Add dictionary search (as per dictionary option)
set wildmode=list:full
set wildmenu
au BufRead,BufNewFile *.ncl set dictionary=~/.vim/dictionary/ncl.dic
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
" 记住上次的编辑位置
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
" 打开文件时,按照 viminfo 保存的上次关闭时的光标位置重新设置光标
au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif
"中文的猜测顺序
set fileencodings=utf-8,gb2312,gbk,gb18030
set termencoding=utf-8
"set encoding=prc
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
begin
;;date is a variable from command line args
print("The current date is "+sdate)
;; Following is other code
end
其中,sdate 这个变量在 NCL 中并没有赋值,而是要在运行时指定。
上面的 NCL 脚本应配合以下的 shell 脚本 [runnclargs.sh] 运行:
#!/bin/bash
basedate="20000101"
for idate in `seq -w 1 3653`
do
thedate=`date +%Y%m%d -d "$basedate + $idate"`
ncl runwithargs.ncl "sdate=$thedate" |grep date
done