2012年11月30日星期五

Ubuntu下安装tomcat 6


Ubuntu下安装tomcat 6  

2011-04-04 09:24:14|  分类: WEB技术|字号 订阅
Tomcat设置JSP开发环境,有两种,或是用源安装,或是自己下载配置 Tomcat,推荐后者。

源方式(不推荐)

安装Tomcat
Tomcat是由Apache Foundation研发用于支持JSP(Java Server Page)的网络服务软件。
sudo apt-get install tomcat6 
稍等片刻,Tomcat6 即会被自动安装在/usr/share/tomcat6的目录中

设置Tomcat运行的JAVA环境

首先请确保Sun的Java Development Toolkit已经安装。如果尚未安装,参照Java

启动和停止Tomcat

要启动Tomcat,运行
qii@ubuntu:~$ sudo /etc/init.d/tomcat6 start
 * Starting Tomcat servlet engine tomcat6                                               [ OK ] 
此时打开浏览器,在地址栏内输入http://localhost:8080

要停止Tomcat,运行
qii@ubuntu:~$ sudo /etc/init.d/tomcat6 stop
 * Stopping Tomcat servlet engine tomcat6                                               [ OK ] 

Tomcat 配置文件路径

Tomcat home directory : /usr/share/tomcat6
Tomcat base directory : /var/lib/tomcat6
要停止Tomcat,运行
qii@ubuntu:~$ sudo /etc/init.d/tomcat6 stop * Stopping Tomcat servlet engine tomcat6 [ OK ]

Tomcat 配置文件路径

Tomcat home directory : /usr/share/tomcat6 Tomcat base directory : /var/lib/tomcat6

设置Tomcat管理员帐号

Tomcat的用户帐号信息都保存在tomcat-users.xml的文件中,运行
sudo nano /var/lib/tomcat6/conf/tomcat-users.xml
在</tomcat-users>的标签前添加一行
<user username="用户名" password="密码" roles="admin,manager"/>
保存并关闭。重新运行tomcat即可输入该用户名和密码,登录Tomcat的管理页面。

弊端

Ubuntu 默认把 Tomcat 分到2个目录,在之后配置 Eclipse Server 时会把人逼疯的,配置哪个路径都不对,Eclipse 无法识别安装的 Tomcat。 解决方案: sudo ln -s /var/lib/tomcat6/conf /usr/share/tomcat6/conf sudo ln -s /etc/tomcat6/policy.d/03catalina.policy /usr/share/tomcat6/conf/catalina.policy sudo ln -s /var/log/tomcat6 /usr/share/tomcat6/log sudo chmod -R 777 /usr/share/tomcat6/conf 

下载安装最新版本的Tomcat

这种方法绕过 Ubuntu 自身的包管理器,直接从Apache Tomcat的主页上下载并使用Tomcat软件,该方法方便快捷的安装旧版或新测试版 Tomcat 而并不影响系统的稳定性,轻松自在。
从tomcat的官方下载页面
http://tomcat.apache.org/download-70.cgi
下载Binary->Core分类中的zip或者tar.gz包后,本地解压缩并将新生成的目录重命名为tomcat,以方便使用。将这个文件夹移动至某路径PATH/。 参考以上设置环境变量和端口设置等步骤,大功告成! 直接运行
PATH/tomcat/bin/./startup.sh
Tomcat 便即刻在后台服务了。 (请将PATH替换成适合您的路径) 

配置开发环境

Eclipse

以下载的 Eclipse for Java EE 为例,右击底部面板分页 Servers - New - Server,选择你要的 Tomcat 版本,添加进路径。 
Ubuntu下安装tomcat 6 - philn - IT基础知识
 
Preferences - Server - Runtime Environments
Ubuntu下安装tomcat 6 - philn - IT基础知识

ubuntu 安装 eclipse




There are two ways of installing eclipse IDE in ubuntu.
1.Using Ubuntu Software Center Or
2.Download  Eclipse IDE package and then install manually


1.If you use Ubuntu Software Center for installing eclipse,new version of eclipse is not available.

 The above version is 3.7.2-1.However newer version 4.2 juno is available here.


NOTE:Before installing eclipse IDE you need to check few things.

First, whether you have Java installed or not.For that you need to run following command in your terminal...
                                    # java -version
If you get the following output that means Java is not installed on your Ubuntu12.04.You need to  install Sun JDK or Open JDK using Ubuntu Software Center.

And if you get the following output that means you have java installed in your OS.


Second, if you are installing Eclipse IDE for C/C++,you need to check whether g++ is installed or not.
To check whether g++ is installed or not you need to run the following command in the terminal...
                                                 # g++ --version

If you get the following output that means g++ is already installed else you need to install it using Ubuntu Software Center.




2.By manually downloading the eclipse IDE package.
         
         a.First download the eclipse tar.gz package from here.

      
         b.Then righ-click the eclipse tar.gz and choose the extract here option to extract the tar.gz package.You can also use the command line to extract the tar.gz package.
       
                               # tar xzf eclipse-cpp-juno-linux-gtk.tar.gz
            
        
          c.Move the extracted eclipse in the  /opt/ folder.Before running the below commmand be sure that you are in the directory which contains extracted eclipse folder.

                               # mv eclipse /opt/
           
            Use sudo if the above command gives permission denied message.
                                 
                              # sudo mv eclipse /opt/


       d.Create a desktop file and place it into /usr/share/applications
              
                            # sudo gedit /usr/share/applications/eclipse.desktop            
       
           and copy the following to the eclipse.desktop file
  1. [Desktop Entry]
    Name=Eclipse 
    Type=Application
    Exec=/opt/eclipse/eclipse
    Terminal=false
    Icon=/opt/eclipse/icon.xpm
    Comment=Integrated Development Environment
    NoDisplay=false
    Categories=Development;IDE
    Name[en]=eclipse.desktop
 
       e. Create a symlink in /usr/local/bin using
  1.  # cd /usr/local/bin
     # sudo ln -s /opt/eclipse/eclipse

   
       f. Now its the time to launch eclipse.
       
             # /opt/eclipse/eclipse  -clean  &    

2012年11月29日星期四

Ubuntu 12.04中文输入法的安装


Ubuntu 12.04中文输入法的安装
 
Ubuntu上的输入法主要有小小输入平台(支持拼音/二笔/五笔等),Fcitx,Ibus,Scim等。其中Scim和Ibus是输入法框架。
在Ubuntu的中文系统中自带了中文输入法,通过Ctrl+Space可切换中英文输入法。这里我们主要说下Ubuntu英文系统中,中文输入法的安装。
安装输入法的第一步,是安装语言包。我们选择System Settings-->Language Support-->Install/Remove Languages,将弹出以下窗口:  www.2cto.com  
 

 
输入密码后,系统会安装简体中文语言包。
第二步,安装IBus框架,在终端输入以下命令:
sudo apt-get install ibus ibus-clutter ibus-gtk ibus-gtk3 ibus-qt4
启动IBus框架,在终端输入:
im-switch -s ibus
安装完IBus框架后注销系统,保证更改立即生效。
第三步:安装拼音引擎
 
有下面几种常用选择:
IBus拼音:sudo apt-get install ibus-pinyin
IBUS五笔:sudo apt-get install ibus-table-wubi
谷歌拼音输入法:sudo apt-get install ibus-googlepinyin
Sun拼音输入法:sudo apt-get install ibus-sunpinyin
第四步:设置IBus框架  www.2cto.com  
ibus-setup
此时,IBus Preference设置被打开。我们在Input Method选项卡中,选择自己喜欢的输入方式,并配置自己喜欢的快捷键即可。如下图所示:
 

 
第五步:通常情况下,IBus图标(一个小键盘)会出现在桌面右上角的任务栏中。有时候这个图标会自行消失,可使用以下命令,找回消失的IBus图标:
ibus-daemon -drx

2012年9月28日星期五

DOS下设置永久环境变量

如果想设置JAVA_HOME,则需执行如下命令即可:setx JAVA_HOME "C:\Program Files\LightenBSM Server\jdk1.6.0_16"
在path中加入JAVA执行如下:setx Path "%Path%;%JAVA_HOME%\bin"
 

2012年9月19日星期三

LaTex 中在插图figure 的\caption 中使用 \cite 报错

LaTex 中在插图figure 的\caption 中使用 \cite 报错时, 在\cite 左边加上\protect 就可以解决 例如:
\begin{figure}[htbp]
\includegraphics[width=0.45\textwidth]{./pic/Hello}
\caption{Hello World!  \protect \cite{Wiki}}
\label{fig:Hello}
\end{figure}

2012年9月11日星期二

常用求导公式

sin(x)   cos(x)
cos(x)  -sin(x)
tan(x)  1/((cos(x))^2)
asin(x) 1/sqrt(1-x^2))            -1 <=x<=1
acos(x)  -1/sqrt(1-x^2)          -1<=x<=1
atan(x)  1/(1+x^2)
sinh(x)  cosh(x)                                            sinh(x)=(exp(x) - exp(-x)) / 2
cosh(x)  sinh(x)                                            cosh(x)=(exp(x) + exp(-x)) /2
tanh(x)   1/(cosh(x))^2                                  tanh(x)=sinh(x) / cosh(x)
asinh(x)  1/sqrt(1+x^2)
acosh(x)   1/sqrt(x^2-1)
atanh(x)   1/(1-x^2)

ln(x)   1/x
log10(x)  ln(10)/x
exp(x)  exp(x)
sqrt(x)   0.5/sqrt(x)
atan2(x, y)    (y*dx - x*dy) / (x^2 + y^2)
hypot(x,y)   (x*dx + y*dy) / sqrt(x^2 + y^2)              hypot(x,y)=sqrt(x^2+y^2)
pow(x,y)  pow(x,y-1) * (y*dx + x*ln(x)*dy)

2012年8月17日星期五

LaTeX技巧421:LaTeX表格tabular背景色添加技巧

LaTeX技巧421:LaTeX表格tabular背景色添加技巧

 

zz:http://blog.sina.com.cn/s/blog_5e16f1770100mvrx.html

(2010-11-15 12:17:54)
TeX/LaTeX社区QQ群:80300084
常见数学排版问题集下载
我们所用的宏包为colortbl,这个宏包可以设置表格中数据、文本、行、列、单元格前景和背景以及边框的颜色,从而得到彩色表格。同时需要 array 和 color 两个宏包的支持。 宏包提供了一组着色命令,经常用到是列着色命令,其格式为:
\columncolor[色系]{色名}[左伸出][右伸出]。
常用色系有三原色 rgb 灰度 gray 
和四色cmyk三种;被预定义的色名有68个,详见 color 宏包介绍中所附的色标;左右伸出的长度单位可用 pt。
colortbl 的主要命令
命令
作用
\columncolor
让整个字段着色
\rowcolor
整个横列着色
\arrayrulecolor{颜色}
指定线条的颜色
\doublerulesepcolor{颜色}
指定双线内间隔的颜色
在这里,\columncolor\rowcolor 的参数是一样的,他们的共同语法是:

                  \columncolor[颜色模型]{颜色}[左伸出长度][右伸出长度]
我们现在就来看个实例,这里头有些例子,包括:灰阶横条、部份字段着色、整个表格在着色背景及单一个表格内方框着色:
LaTeX技巧421:LaTeX表格tabular背景色添加技巧

LaTeX技巧421:LaTeX表格tabular背景色添加技巧

LaTeX技巧421:LaTeX表格tabular背景色添加技巧

LaTeX技巧421:LaTeX表格tabular背景色添加技巧

LaTeX技巧421:LaTeX表格tabular背景色添加技巧

LaTeX技巧421:LaTeX表格tabular背景色添加技巧

示例代码如下:
\documentclass[12pt]{article}
\usepackage{textcomp,booktabs}
\usepackage[usenames,dvipsnames]{color}
\usepackage{colortbl}
\definecolor{mygray}{gray}{.9}
\definecolor{mypink}{rgb}{.99,.91,.95}
\definecolor{mycyan}{cmyk}{.3,0,0,0}
\parindent=0pt
\parskip=3ex
\begin{document}
\centering

\section*{SPECIFIC HEATS (20 \textcelsius\ AND 1 ATM)}
\begin{tabular}{>{\sf }lll}

  %
\toprule

& \multicolumn{2}{c}{\bf Specific Heats} \\
\cmidrule{2-3}

& $c$ (J/kg$\cdot$K) & $C$ (J/mol$\cdot$K) \\
\midrule
Aluminum 
    & 900  & 24.3 \\
\rowcolor{mygray}
Copper 
      & 385  & 24.4 \\
Gold 
        & 130  & 25.6 \\
\rowcolor{mygray}
Steel/Iron 
  & 450  & 25.0 \\
Lead 
        & 130  & 26.8 \\
\rowcolor{mygray}
Mercury 
     & 140  & 28.0 \\
Water 
       & 4190 & 75.4 \\
\rowcolor{mygray}
Ice ($-$10 \textcelsius) & 2100 & 38 \\
\bottomrule
\end{tabular}

\vspace{8ex} %
\section*{SPECIFIC HEATS (20 \textcelsius\ AND 1 ATM)}
\begin{tabular}{>{\columncolor{mypink}\sf }lll@{}}
\toprule
\rowcolor{white}

& \multicolumn{2}{c}{\bf Specific Heats} \\
\cmidrule{2-3}
\rowcolor{white}

& $c$ (J/kg$\cdot$K) & $C$ (J/mol$\cdot$K) \\
\midrule
Aluminum 
    & 900  & 24.3 \\
Copper 
      & 385  & 24.4 \\
Gold 
        & 130  & 25.6 \\
Steel/Iron 
  & 450  & 25.0 \\
Lead 
        & 130  & 26.8 \\
Mercury 
     & 140  & 28.0 \\
Water 
       & 4190 & 75.4 \\
Ice ($-$10 \textcelsius) & 2100 & 38 \\
\bottomrule
\end{tabular}


\section*{SPECIFIC HEATS (20 \textcelsius\ AND 1 ATM)}
\fboxsep=12pt
\colorbox{mypink}{
\begin{tabular}{@{}>{\sf }lll@{}}
\toprule

& \multicolumn{2}{c}{\bf Specific Heats} \\
\cmidrule{2-3}

& $c$ (J/kg$\cdot$K) & $C$ (J/mol$\cdot$K) \\
\midrule
Aluminum 
    & 900  & 24.3 \\
Copper 
      & 385  & 24.4 \\
Gold 
        & 130  & 25.6 \\
Steel/Iron 
  & 450  & 25.0 \\
Lead 
        & 130  & 26.8 \\
Mercury 
     & 140  & 28.0 \\
Water 
       & 4190 & 75.4 \\
Ice ($-$10 \textcelsius) & 2100 & 38 \\
\bottomrule
\end{tabular}}

\vspace{8ex} %
\section*{SPECIFIC HEATS (20 \textcelsius\ AND 1 ATM)}
\begin{tabular}{@{}>{\sf }lll@{}}
\toprule

& \multicolumn{2}{c}{\bf Specific Heats} \\
\cmidrule{2-3}

& $c$ (J/kg$\cdot$K) & $C$ (J/mol$\cdot$K) \\
\midrule
Aluminum 
    & 900  & 24.3 \\
Copper 
      & 385  & 24.4 \\
Gold 
        & 130  & 25.6 \\
Steel/Iron 
  & 450  & 25.0 \\
Lead 
        & 130  & 26.8 \\
Mercury 
     & 140  & 28.0 \\
Water 
       & \multicolumn{1}{>{\columncolor{mycyan}}l}{4190} & 75.4 \\
Ice ($-$10 \textcelsius) & 2100 & 38 \\
\bottomrule
\end{tabular}


\setlength{\extrarowheight}{2mm}
\begin{tabular}{|l|c|c|c|c|c|c|c|}
\hline
Sydney & OG4G &Thu Oct 10 &Mon Oct 21 or 28 &11 or 18 days &999\\
\rowcolor[gray]{0.5}
& &Thu Oct 17 &Mon Oct 21 or 28 & 4 or 11 days &999\\
&OG7A &Sun Oct 13 &Mon Oct 21 or 28 & 8 or 15 days &999\\
\rowcolor[gray]{0.5}
& &Sun Oct 20 &Mon Oct 28 & 8 days &999\\
\hline
\end{tabular}


\setlength{\extrarowheight}{2mm}
\setlength{\tabcolsep}{2mm}
\begin{tabular}{|l|%
>{\columncolor{yellow}}c|c|>{\columncolor{yellow}}c|c|%
>{\columncolor{red}\bfseries}c<{\textsc{GBP}}|}
\hline
\multicolumn{3}{>{\columncolor{red}}l}{\color{white}\textsf{LONDON}}
&\multicolumn{3}{>{\columncolor{red}}r}{\color{white}\textsf{Price}}
\\[1pt]
\hline
Sydney & OG4G &Thu Oct 10 &Mon Oct 21 or 28 &11 or 18 days &999\\
& &Thu Oct 17 &Mon Oct 21 or 28 & 4 or 11 days &999\\
& OG7A &Sun Oct 13 &Mon Oct 21 or 28 & 8 or 15 days &999\\
& &Sun Oct 20 &Mon Oct 28 & 8 days &999\\
\hline
\end{tabular}


\setlength{\arrayrulewidth}{2pt}
\arrayrulecolor{green}
\begin{tabular}{|l|c|r|}
\arrayrulecolor{black}\hline
United Kingdom & London & Thames\\
\arrayrulecolor{blue}\hline
France & Paris & Seine \\
\arrayrulecolor{black}\cline{1-1}
\arrayrulecolor{red}\cline{2-3}
Russia & Moscow & Moskva \\ \hline
\end{tabular}
\end{document}