Archive for 2008年十月月

How To Configure Apache2 VirtualHost in Ubuntu

十月 29, 2008

What is Apache2 VirtualHost?

Apache2 VirtualHost is use for multidomain purpose. We need to configure 2 VirtualHost name to each domain, so we can see a different website from each domain.

First I assume we have installed apache2 webserver and it’s running smootly in Ubuntu Server.

To configure apache webserver VirtualHost in Ubuntu server is different from other linux OS like fedora/redhat/centos. In Ubuntu apache2 have separated the virtual host into sites-available and sited-enabled directory.

Example we have domain inferno.web.id

We need to login into the server and have a root user previleges.
We also need to create a file name inferno.web.id in sites-available directory

sentono@athena:~$sudo su
Password:
root@athena:/home/sentono#

Change directory to /etc/apache2/sites-available/

root@athena:/home/sentono#cd /etc/apache2/sites-available/
root@athena:/etc/apache2/sites-available#

Add NameVirtualHost into Default site

root@athena:/etc/apache2/sites-available#pico default

#change or add this line below

NameVirtualHost 192.168.1.1:80

#save and exit

Create a new virtualhost file

root@athena:/etc/apache2/sites-available#pico inferno.web.id

<VirtualHost 192.168.1.1:80>
ServerName inferno.web.id
DocumentRoot /home/www/inferno.web.id/public_html/
</VirtualHost>

#save this file and exit

We need to enabled our new Website

root@athena:/etc/apache2/sites-available#a2ensite inferno.web.id

Restart Apache2 Webserver

root@athena:/etc/apache2/sites-available#/etc/init.d/apache2 restart

Create testing index.php

root@athena:/etc/apache2/sites-available#nano /home/www/inferno.web.id/public_html/index.php

<? phpinfo() ?>

#save and exit

Testing it with IE

http://inferno.web.id

如何让表格中一个单元格的文字换行(转贴)

十月 28, 2008

问题:如何同时让表格同一行一个单元格的文字能垂直居中?比如说文字超长超出页面范围需要分行显示

答:(来源于smth)

方案一:

\newcommand{\tabincell}[2]{\begin{tabular}{@{}#1@{}}#2\end{tabular}}
%然后使用&\tabincell{c}{}&就可以在表格中自动换行

%比如这么用
\begin{tabular}{|c|c|}
\hline
1 & the first line \\
\hline
2 & \tabincell{c}{haha\\ heihei\\zeze} \\
\hline
\end{tabular}

注:好用,已试过,以下为一例子,可直接存为.tex文件编译运行

\documentclass[a4paper,12pt]{article}
\usepackage{CJK}
\begin{document}
\begin{CJK*}{GBK}{song}

\newcommand{\tabincell}[2]{\begin{tabular}{@{}#1@{}}#2\end{tabular}}
%然后使用&\tabincell{c}{}&就可以在表格中自动换行

%比如这么用
\begin{tabular}{|c|c|}
\hline
1 & the first line \\
\hline
2 & \tabincell{c}{haha\\ heihei\\zeze \\fgf \\asgr} \\
\hline
\end{tabular}

\end{CJK*}
\end{document}

方案二:

\usepackage{longtable}

Ubuntu中eclipse插件安装方法

十月 28, 2008

(转载)

1、首先当然是下载Eclipse的压缩包,这里我下载的是3.1.2版本的
eclipseSDK3.1.2:点击下载eclipse-SDK-3.1.2
由于我主要用Eclipse来进行Java的学习,所以我只是下载了下面几个插件。需要注意的是ve的使用必须配合特定版本的emf和gef才能使用。
EMF2.1.0:点击下载emf-2.1.0
GEF3.1: 点击下载gef-3.1
VE1.1.0: 点击下载ve-1.1.0
当然如果你想用来写C/C++程序则可以下载下面这个插件
CDT3.0.2:点击下载cdt-3.0.2
2、先说一种比较省事的做法:
你只需要将下载好的EclipseSDK压缩包和各插件的压缩包解压在任一个文件夹就可以使用Eclipse了。首先进入放有压缩包的目录中,
$cd /下载的eclipse-SDK-3.1.2-linux-gtk.tar.gz压缩文件所在目录
再执行如下的命令:

$sudo tar xvfz eclipse-SDK-3.1.2-linux-gtk.tar.gz -C /opt
$sudo unzip -d /opt emf-sdo-runtime-2.1.0.zip
$sudo unzip -d /opt GEF-runtime-3.1.zip
$sudo unzip -d /opt VE-SDK-1.1.0.1.zip
$sudo tar xvfz org.eclipse.cdt-3.0.2-linux.x86.tar.gz -C /opt

这个时候,你就可以在 /opt 文件夹中看到出现了一个eclipse的文件夹,双击其中的eclipse文件就可以运行eclipse了。
如果你想在菜单栏里出现Eclipse的选项,可以写下面这个文件
$gedit ~/.local/share/applications/eclipse-user.desktop
[Desktop Entry]
Comment=Java IDE
Name=Eclipse
Exec=/opt/eclipse/eclipse
Encoding=UTF-8
Terminal=false
Type=Application
Categories=Application;Development;
Icon=/opt/eclipse/icon.xpm
这种安装Eclipse的方法快速,方便,缺点就是插件不方便管理。因为他们全部都解压缩到plugins和features文件夹里去了,混在一起。
3、一种方便插件管理,且可以加快eclipse启动加载速度的安装方法(虽然繁琐了点,但是推荐^_^)

$sudo mkdir /opt/eclipse/Links
$sudo mkdir /opt/eclipse/AddOns

其中Links目录中存放指向各个插件的.link文件,AddOns目录中存放各插件

$sudo mkdir /opt/eclipse/AddOns/emf
$sudo mkdir /opt/eclipse/AddOns/gef
$sudo mkdir /opt/eclipse/AddOns/ve
$sudo mkdir /opt/eclipse/AddOns/cdt

上述命令创建存放各个插件的具体目录

$sudo unzip -d /opt/eclipse/AddOns/emf emf-sdo-runtime-2.1.0.zip
$sudo unzip -d /opt/eclipse/AddOns/gef GEF-runtime-3.1.zip
$sudo unzip -d /opt/eclipse/AddOns/ve VE-SDK-1.1.0.1.zip
$sudo tar xvfz org.eclipse.cdt-3.0.2-linux.x86.tar.gz -C /opt/eclipse/AddOns/cdt

上述命令将各插件压缩包解压至对应目录,接下来还需要在各个插件的eclipse目录中生成一个空的.eclipseextension文件

$sudo vi /opt/eclipse/AddOns/emf/eclipse/.eclipseextension
$sudo vi /opt/eclipse/AddOns/gef/eclipse/.eclipseextension
$sudo vi /opt/eclipse/AddOns/ve/eclipse/.eclipseextension
$sudo vi /opt/eclipse/AddOns/cdt/eclipse/.eclipseextension

接下来去Links目录下为每个插件创建.link文件

$sudo gedit /opt/eclipse/Links/emf.link
path=/opt/eclipse/AddOns/emf
$sudo gedit /opt/eclipse/Links/gef.link
path=/opt/eclipse/AddOns/gef
$sudo gedit /opt/eclipse/Links/ve.link
path=/opt/eclipse/AddOns/ve
$sudo gedit /opt/eclipse/Links/cdt.link
path=/opt/eclipse/AddOns/cdt

如果你想在菜单栏里出现Eclipse的选项,可以写下面这个文件
$gedit ~/.local/share/applications/eclipse-user.desktop
[Desktop Entry]
Comment=Java IDE
Name=Eclipse
Exec=/opt/eclipse/eclipse
Encoding=UTF-8
Terminal=false
Type=Application
Categories=Application;Development;
Icon=/opt/eclipse/icon.xpm
通过这种方式启动eclipse以后,如果eclipse没有识别出来这些插件,可以在选择Help->Software Updates->Manage Configuration中设置各个插件的路径即可。

用DOI下载文献方法介绍

十月 16, 2008

用DOI下载文献

http://dx.doi.org/

从另一个地方查到的关于此的介绍
DOI是 “Digital Object Identifier”的简写 用来标识在数字环境中的内容对象。 DOI可以用来揭示有关该数字对象的一些信息 包括从INTERNET哪里可以找到它等。 随着时间推移数字对象的某些有关信息可能会有变化包括从哪里可以找到它 但是DOI不会改变。 DOI是一个永久性的标识号 由International DOI Foundation管理。通过doi查找原始文献的方法很简单 只要将下面的url地址加在已知的doi前面就得到该文献在doi系统中的url. http://dx.doi.org/ 例如已知某文献的doi: 10.1103/PhysRevLett.95.253601 则该文献在doi系统中的url就是 http://dx.doi.org/10.1103/PhysRevLett.95.253601 事实上 如果已知doi, 也可通过以下地址由doi系统自动帮助查找url. http://dx.doi.org/ 在”Resolve A DOI”的提示框内输入已知doi, 点击”Go”按钮 doi系统就会自动链接到该文献的url,并显示相应的页面。 另外 CrossRef网站也提供了通过doi查找url的功能 http://www.crossref.org 在”DOI Resolver”输入提示框中输入已知doi “submit”即可。

另外,一篇文章在期刊网站的网址有可能发生变化 但是 它在doi系统中的网址却永远不会改变 而且 通过doi系统的自动转换后 将永远指向最新有效的期刊网站网址。

个 人感受:我经常到不同的数据库查找文献,每次总是先到指定的数据库,然后再查期刊,再查卷号然后到文章,花了不少时间。因为我经常是知道文献的DOI,也 知道是文献的唯一编码,却不知道具体怎么用(我用一个名叫RSSReader的软件,可以定期收录最新发表的文献文章,其中的简短记录中就有DOI,这个 软件也建议大家用用,也不错)。现在好了,只要在这个网址上一敲,自然就可以下载了,有权限的马上就可以下了,没权限的也不用辛苦等到查到这个文献地址了 才发现不能下。大家经常查文献的话,用用这个网站吧,呵呵

Hello world!

十月 15, 2008

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!