• 2006-01-23

    idea’s web正式成形了!

    Views: 14458 | 4 Comments

    大家好!

    我的个人网站正式成形了,名字就叫做 idea's web . 我的网站将主要涉及Linux,Java/Jsp,HTML/CSS方面的内容。我将尽自己最大的努力学习这几个方面的知识,然后和大家一起分享我的经验。我和我的网站的目标是创造出独一无二的并且是十分优秀的技术。这当然很困难。所以当前我的主要目的是学习世界上最先进的技术。当从别人身上获得到了足够的知识之后,或者在学习别人的过程中,我们自己就能够创造了。

    我使用GNU/Linux,不仅仅因为它几乎是免费的,更因为它总是给我一种自由和创造的精神。当你想解决一个问题的时候,它就会提示你:使用别人的源代码,或者你自己编写出一套。就好像告诉你自己编写一个画点的函数,然后操纵这个画点的函数画出所有你想要的图形来。一切总是可以从头开始,这样真让人激动。但是,你不是一个人。你有别人奉献的源代码,也就是你不用担心你解决不了问题。

    如果你认为从头编写每一个基本的函数----即使这些函数已经被人写出了,而且比你自己的效率更高----是一种乐趣的话,你就是我的伙伴。当然,我们并不需要拒绝所有别人的东西,我们会在合适的时候选择使用乐于奉献的人给予的代码。这些人来自开源社区。

    当我写出的代码能够解决某些问题的时候,我会尽快地把代码公开。让我的朋友分享我的喜悦。

    对于Linux,我们应该让更多的人知道它。现在问题不是Linux是否易用,对中文支持是否足够好的问题了,而是人们总是习惯于排斥新事物的问题。解决这个问题,一方面我们要尽量发掘Linux的功能,利用Linux创造出更加明显的成就;另一方面我们要将自己使用Linux的经验分享给别人,特别是对于那些十分想接触Linux并且认为使用盗版Windows是一种耻辱的人,我们要帮助他们。使用Linux的人可以分为两类,一类是普通用户,使用Linux就是在使用电脑;另一类是技术的追求者。普通用户是我们的朋友,而追求者是我们的工作伙伴。我们应该为了解决朋友的问题而同伙伴一起创造新技术。

    对于Java,我只是刚刚接触。我所听到的人们对Java抱怨最多的问题是Java的速度问题。但是,因为硬件的发展,Java的速度将不是一个过多考虑的问题。当人们还在上网的,Java的速度就符合要求。

    对于HTML/CSS,你可能奇怪我为什么会将它列为自己网站的重要方面。因为我在使用HTML/CSS的过程中,发现它是一种非常完美的文档格式。它完全可以替代MS的DOC和PPT文档还有Adobe的PDF,也就是我认为它可以成为最主要应用最广泛的文档格式。在后来,我们会随技术的发展一起过渡到XML,或者XML只是我们使用的一部分。我有一个不成熟的想法,就是使用HTML/CSS作为应用程序的前端,负责产生界面和指令,后端使用Apache,Tomcat等服务器加上Mysql等数据库。这样看来在某些商务应用是可行的。现今,Firefox对HTML的支持已经可以轻易的做出菜单等传统程序的控件,加上JavaScript已经能做出简单的Drag and Drop功能。也许我们并不使用一个完整的浏览器,我们只是使用浏览器的内核以及内核的一部分特性。HTML/CSS的编写是简单的。

    事情总是在发展中...... 一直努力!

    Posted by ideawu at 2006-01-23 20:40:46
  • 2006-01-22

    Linux下安装和设置Tomcat,解决JSP中文乱码

    Views: 20220 | No Comments

    我假设你使用Debian3,如果你使用其他的Linux版,可能会有安装方法和设置路径上的区别。

    1,安装J2SDK

    1.1 使用Debian源里的安装包

    以root 身份运行apt-get install sun-j2sdk1.4,这样将安装sun的j2sdk1.4。然后输入java如果你看到的不是command not found,就表示你已经安装正确了。否则搜索是否有java和javac两个文件,我的在/usr/lib/j2sdk1.4-sun/bin下,如果有就创建链接到/usr/bin下,连接名与原文件名一样。

    1.2 使用sun网站上的安装包

    具体方法参考sun网站上的安装说明。也可以参考我的做法(图形界面操作):

    下载正确的压缩包后解压,一般得到类似名为jdk1.x.x的文件夹。将整个文件夹移动到/usr/lib目录下,然后进入jdk.1.x.x/bin下的java, javac, javadoc, jar四个可执行文件创建链接,然后复制到/usr/bin文件夹下,并且改名为与原文件相同。这样做的原因是一般/usr/bin是$PATH环境变量的一部分,以后你想运行javac命令编绎一个.java源文件时,只需要输入javac filename就行了,而不需要输入javac文件所在的完整路径。

    JAVA_HOME环境变量可以不设置,因为据我的使用经验,java,javac等jdk的程序知道在哪里找到自己的家。当某个程序需要JAVA_HOME环境变量,我们再在它的启动脚本中设置。因为使用JAVA_HOME环境变量的程序很少。

    2,安装Tomcat

    从http://tomcat.apache.org/网站上下载tomcat for Linux。网站上有不同版本的源码包和二进制包等,而二进制包又有core,deployer,embedded三种。我使用tomcat5.28二进制包中的core。

    下载jakarta-tomcat-5.0.28.tar.gz解压,将得到jakarta-tomcat-5.0.28文件夹,我把它改名为tomcat5,把它拷贝到你喜欢的地方。我放在/usr/share/下。

    2.1 试运行tomcat

    在终端中输入/usr/share/tomcat5/bin/startup.sh,将启动tomcat。然后你在浏览器中输入http://localhost:8080或者http://127.0.0.1:8080你就看到tomcat产生的页面了。

    运行/usr/share/tomcat5/bin/startup.sh出错?试运行:

    JAVA_HOME=/usr/lib/j2sdk1.4_sun #这里的路径是你的j2sdk的安装路径
    export JAVA_HOME
    /usr/share/tomcat5/bin/startup.sh
    

    2.2 将tomcat设置为开机启动

    有两个方法,1是使用tomcat自带的启动脚本启动,2是使用jsvc将tomcat启动为Linux的一个进程。

    2.2.1 使用Tomcat自带的启动脚本

    建立一个脚本命名为tomcat5.sh,内容为:

    #!/bin/sh
    #file:tomcat5.sh
    #设置环境变量,如果无法启动就将注释去掉
    #JAVA_HOME=/usr/lib/j2sdk1.4-sun
    #CATALINA_HOME=/usr/share/tomcat5
    #CLASSPATH=\
    #$JAVA_HOME/lib/tools.jar:\
    #$CATALINA_HOME/bin/commons-daemon.jar:\
    #$CATALINA_HOME/bin/bootstrap.jar
    case "$1" in
     start)
       echo "Starting tomcat5..."
       /usr/tomcat5/bin/startup.sh
       ;;
     stop)
       echo "Stopping tomcat5..."
       /usr/tomcat5/bin/shutdown.sh
       ;;
     *)
       echo "Usage tomcat.sh start/stop"
       exit 1;;
    esac
    #tomcat5.sh end
    

    将tomcat5.sh 拷贝到/etc/init.d下面。然后运行/usr/bin/ksysv运行图形界面的开机启动设置工具。将Available Services栏里的tomcat5.sh拖到Runlever 2 Start,Runlever 3 Start,Runlever 4 Start,Runlever 5 Start,Runlever 6 Start,Runlever 0 Stop,Runlever 1 Stop,Runlever 6 Stop,你可能需要注意图标的位置,我将图标拖到每一栏的启动项目标号是90的位置。

    或者你在终端里运行:

    ln -s /etc/init.d/tomcat5.sh /etc/rc0.d/K90tomcat5.sh
    ln -s /etc/init.d/tomcat5.sh /etc/rc1.d/K90tomcat5.sh
    ln -s /etc/init.d/tomcat5.sh /etc/rc2.d/S90tomcat5.sh
    ln -s /etc/init.d/tomcat5.sh /etc/rc3.d/S90tomcat5.sh
    ln -s /etc/init.d/tomcat5.sh /etc/rc4.d/S90tomcat5.sh
    ln -s /etc/init.d/tomcat5.sh /etc/rc5.d/S90tomcat5.sh
    ln -s /etc/init.d/tomcat5.sh /etc/rc6.d/K95tomcat5.sh
    

    重启机器看tomcat是否可以自动启动了。

    2.2.2 使用jsvc,增加安全性

    方法2.2.1有一个严重的问题,那就是tomcat具有root权限。我意味着你的任何一个jsp脚本都具有root权限,所以可以轻易地用jsp脚本删除你整个硬盘里的东西!所以我们最好不要使用2.2.1方法。

    我们下载的jakarta-tomcat-5.0.28.tar.gz带有jsvc工具,在压缩包里的jakarta-tomcat-5.0.28/bin/jsvc.tar.gz,如果你按上面的步骤做了,它就在/usr/share/tomcat5/bin/jsvc.tar.gz,将其解压,得到/usr/share/tomcat5/bin/jsvc-src文件夹。在终端运行:

    /usr/share/tomcat5/bin/jsvc-src/configure --with-java=/usr/lib/j2sdk1.4-sun

    make

    得到/usr/share/tomcat5/bin/jsvc-src/jsvc文件。将/usr/share/tomcat5/bin/jsvc-src/native/tomcat5.sh脚本文件拷贝到/etc/init.d下,再使用2.2.1中的的半部分方法将tomcat设置为自启动。

    /etc/init.d/tomcat5.sh还需要修改,使其看起来像:

    JAVA_HOME=/usr/lib/j2sdk1.4-sun
    CATALINA_HOME=/usr/share/tomcat5
    DAEMON_HOME=/usr/share/tomcat5
    TOMCAT_USER=tomcat5 #这里改为一个普通身份的用户名
    TMP_DIR=/var/tmp
    CATALINA_OPTS=
    CLASSPATH=\
    $JAVA_HOME/lib/tools.jar:\
    $CATALINA_HOME/bin/commons-daemon.jar:\
    $CATALINA_HOME/bin/bootstrap.jar
    case "$1" in
     start)
       #
       # Start Tomcat
       #
       $DAEMON_HOME/bin/jsvc-src/jsvc \
    ......
    

    先不要重启试验,请手动运行/etc/init.d/tomcat5.sh start,然后在浏览器中输入http://localhost:8080或者http://127.0.0.1:8080看tomcat是否能够启动,再运行/etc/init.d/tomcat5.sh stop看是否能停止。

    问题:无法用jsvc启动tomcat?

    在http://jakarta.apache.org/commons/daemon/faq.html有说明。如果你使用Debian,运行modconf然后将/kernel/security下的capability模块安装上。如果你使用其它的版本,并且把capability编绎为模块,请在/etc/init.d/tomcat5.sh的合适位置(你想使用第2行?)加上modprobe capability。

    3,设置tomcat的server.xml布署网站

    如果你想让别人在浏览器中输入你的IP而不需要在IP后面加上“:端口号”就能访问你的网站的话,请将

    <Connector port="8080"
    	maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
    	enableLookups="false" redirectPort="8443" acceptCount="100"
    	debug="0" connectionTimeout="20000"
    	disableUploadTimeout="true" />
    

    中的port="8080"改为port="80",因为80是浏览器请求的默认端口。找到

    <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true" autoDeploy="true" 
    	xmlValidation="false" xmlNamespaceAware="false">
    </Host>
    

    修改为使appBase="/home/tomcatweb"。并在其后面加上:

    <Context path="" docBase="/home/tomcatweb" reloadable="true"></Context>
    

    把你自己的index.jsp放在/home/tomcatweb目录下,然后在浏览器中输入http://127.0.0.1,你应该就能看到index.jsp的运行结果了。

    4,中文问题

    tomcat并没有特殊的中文问题。而且大部分情况下的中文问题是因为用户根本就不会写JSP代码,甚至不会写HTML代码。

    4.1 简单HTML文件的乱码问题

    一个HTML文件,里面包含有中文文字,如:

    <html>
    <head>
    	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    </head>
    你好。
    </html>
    
    

    上面的标签告诉浏览器你的HTML文件使用的是UTF-8编码格式。请将UTF-8正确地设置为你的文本编辑器保存时的编码,否则,只有全英文HTML源码文件才能保证不出现乱码。

    4.2 简单的JSP文件的乱码问题

    一个JSP文件,里面包含有中文文字,如:

    <%@ page contentType="text/html; charset=UTF-8" %>
    <html>
    
    <head>
    	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    </head>
    <%
    	out.println("你好。");
    %>
    </html>
    

    <%@ page contentType="text/html; charset=UTF-8" %>标签告诉tomcat和java编绎器你的文件的编码是UTF-8格式的。

    4.3 被包含的文件的内容是乱码

    如果你的parent.jsp文件中使用<jsp:include page="child.jsp" >文件包含了child.jsp,请在parent.jsp和child.jsp文件中都指定了正确的<%@ page contentType="text/html; charset=UTF-8" %>(改UTF-8为正确的编码),两者可以不一样。

    如果你的parent.jsp文件中使用<%@ include file="child.jsp" %>文件包含了child.jsp,请保证parent.jsp和child.jsp是相同的编码,并且在parent.jsp中设置了正确的<%@ page contentType="text/html; charset=UTF-8" %>(改UTF-8为正确的编码)。不要在child.jsp中设置<%@ page contentType="text/html; charset=UTF-8" %>,否则,tomcat会出错(不总是)。

    更新, 在Tomcat5.5中测试, 在child.jsp中必须设置<%@ page contentType="text/html; charset=UTF-8" %>, 两者的编码必须相同.

     

    4.4 POST方法的乱码

    在request.getParameter();之前运行request.setCharacterEncoding("UTF-8");,其中UTF-8是你的提交页面的文件编码。

    4.5 使用javaIO读取的文件是乱码

    请重写你的函数,而不是试图更改tomcat的设置。

    原标题为:建造Linux开发环境----Tomcat,JSP

    Posted by ideawu at 2006-01-22 16:20:16
  • 2006-01-18

    自架设Apache服务器过程中的网页乱码问题

    Views: 19500 | No Comments

    现在,很多人都拥有自己的电脑,并且通过固定的IP连接到互联网。于是,他们开始在自己的电脑上架设服务器。

    在自己的电脑上架设服务器,无论你使用Linux还是Windows,都是非常简单的。这里我只介绍Apache+PHP和Tomcat在使用过程中的问题网页乱码问题。

    对于Windows系统Apache和Tomcat的安装,只需要下载安装程序就能使用了。但是,恼人的中文问题出现了:网页的中文全是乱码。用户上网搜索之后,可能得到“需要更改default_charset”为gb2312的信息。这是非常愚蠢的做法,如果你这样做了,你的网页只能使用gb2312编码或者它的子集。所以这种方法成功率非常低。于是有的人得出结论: Apache和Tomcat等都是外国人做的,所以对中文支持不好。完全的胡说。

    对于Apache,请把配置文件中的AddDefaultCharset ISO-8859-1(如果默认安装后有的话) 改成 AddDefaultCharset off,而Tomcat默认安装。

    然后在你写网页的时候,在<head>与</head>标签之间加上<meta http-equiv="content-type" content="text/html; charset=? />其中问号是你的HTML/PHP/JSP源文件的编码格式。我曾经遇到过一个人,因为别人举例时用gb2312代替了?,所以他也照抄gb2312,而事实上,他的文件是使用UTF-8编码格式存储的!他提出问题的时候,开始说Apache和PHP的问题,后来又说是文本编辑器的问题(为什么不把编码存为gb2312?)。对于这种人,我只能说,问题在于他连基本的 HTML文件都不会写!还有的人,根本就没有在HTML/PHP/JSP文件中加上声明编码的<meta />标签。

    当然,问题还有很多。因为能力和时间关系,我就不多说了。如果你有什么建议,可能留下评论。

    Posted by ideawu at 2006-01-18 11:52:49 Tags:
  • 2005-12-03

    Keep it simple, stupid!

    Views: 8514 | No Comments

    The Dalai Lama once said that simplicity is the key to happiness in
    the modern world. This philosophy can be adapted into the realm of web
    design and digital interface design.
    The expressions "Keep it simple, stupid", "Kill your darlings" and
    "Less is more" all pinpoint the fact that simplicity is important.
    Simplicity lasts. Simplicity is necessary in order to properly convey any idea.

    Content is King, Consistency is Queen

    When performing an oral presentation, it is said that the message is
    composed of 60% body language, 10% speech and 30% tone of voice.
    If this were to be at least partially true for web design, we could
    say that on the web, a message is composed of 60% design, 10% actual
    content and 30% writing style.
    I believe that content is king. It always will be. But?evidently?an
    excellently written text easily disappears if placed in an improperly
    designed environment, and excels when appearing in a well-designed
    context.
    Consistency helps to create simplicity. In an environment where
    nothing is constant, interface consistency is of the essence. I'm all
    for innovative interfaces. But when pressing an arrow that points
    downwards, most people expect an element (e.g. a text block) to move
    down, not up.
    The best designs are simple, because they contain no unnecessary
    elements... and contain the necessary elements in a way that seems
    logical.

    The Three Elements of Design

    The three fundamental elements of graphic design are balance, contrast and invisible lines.
    Balance refers to the overall composition of images, graphical
    elements and typography within a design. Contrast refers to the
    interaction between design elements. Invisible lines are the areas
    created between the different parts of a design (for example, the
    palpable but invisible lines that run vertically and horizontally
    between the crop marks on a printed page).
    Good design, regardless of target medium or audience, takes these
    elements into account. If one element is neglected, the design will be
    unbalanced. For instance, a design could be extremely visually balanced
    and quite graphically sophisticated, but still incomplete because of a
    dull choice of color. All elements are equally important.
    Being aware of the three elements of design is a key to obtaining simplicity.
    When a design doesn't feel quite right, many designers are inclined
    to add elements instead of removing unnecessary ones, resulting in
    overloaded designs. Sometimes, it's better to start over instead of
    trying to fix or change the design. To quote hell.com; "trying to fix
    or change something, only guarantees and perpetuates its existence."
    Learning the skill of asking oneself "does this really need to be
    here?" is the first step towards creating simplicity. The next is
    understanding the motivations of your audience.

    How do People Work?

    If I truly understood how people work, I wouldn't be writing this
    article, but rather sipping a perfectly mixed daquiri underneath the
    palm trees on a beach somewhere quite far away from Sweden.
    However, I do understand a little, just by examining my own
    behavior. Over the years, I've found that in order to design well, it's
    important to take into consideration how people generally work.
    1. People want to be entertained: This explains why games and
    pornography are so popular on the web. It also explains why so many
    people are TV slaves, because television is an excellent way to create
    a constant flow of varied visual and audio stimuli. This suits our
    brains perfectly, since the brain easily loses interest in things that
    don't provide stimulus.
    To entertain means to capture attention. The classic quote, "Tell me
    and I forget, show me and I remember, involve me and I'm yours"
    underscores the fact that emotionally engaging communication is the
    most efficient form of getting a message across.
    For instance, two speakers at a conference could deliver the same
    speech with two very differing results, leaving behind one satisfied
    and one dissatisfied audience. The difference? 60% body language, 30%
    tone of voice. (The 10% message is the same.) It's not until all
    elements of communication fully interact that efficient and emotionally
    engaging communication can be achieved.
    2. People want to feel smart and discover things: That's why the expression "show, don't tell" was invented (and that's also why we all despise toothpaste commercials).
    Form a circle with your thumb and index finger. Let the circle
    symbolize communication. Now open the circle by moving the fingers away
    from each other.
    The gap between the fingers symbolizes a communication gap. If the
    communication gap is too wide, the message is too obscure for people to
    understand. If the circle is too narrow, the message is too obvious
    (toothpaste) and therefore uninteresting.
    3. People don't have time to learn things that are too complicated:
    Thousands of people have never programmed their VCR. WAP (wireless
    application protocol) has not become truly successful because it's
    complicated and the obvious benefits are obscured. Many people are
    hesitant to book flights online, because the actual booking process is
    complicated and it's much easier to just call a travel agent. Hundreds
    of dot-coms have gone bankrupt because they didn't have a business
    concept that people could understand.
    Whether you're designing a website, developing a new product, or
    trying to get your point across in a discussion, it's good to remember
    that most people do have limited patience.
    That's why simplicity is important.

    A Definition of Simplicity

    What is simplicity? It could be defined as "the absence of unnecessary elements," or even shorter "the essence."
    Simplicity doesn't equal boring. Simplicity doesn't equal shallow.
    Simplicity is especially important when designing information- and
    media-rich interfaces.
    Simplicity isn't a design style, it's a perspective on design, an
    approach which often creates the most beautiful and the most usable
    results.
    A common mistake is to think that obtaining simplicity is a matter
    of reduction, of reducing something which is more complete than the
    "simple" end result. On the contrary, simplicity requires serious
    thought and effort.
    As I wrote in my article Fragments of time; "A modern paradox is that it's simpler to create complex interfaces because it's so complex to simplify them."

    How to Obtain Simplicity

    Simplicity isn't easy to obtain. I have, however, roughly devised a formula that lays the foundation for simplicity.
    Albert Einstein said; "If A is to succeed in life, then A = x + y + z. Work is x, y is play and z is to listen."
    A functioning formula for simplicity (where A equals simplicity)
    could be A = x + y + z. x is good research and prototyping, y is play
    and z is the reduction of unnecessary elements.
    By genuinely knowing your audience and your objectives, and building for them, you've won the first battle.


    By creating a design that engages the visitor on a sensory (or perhaps sensual) level, you've won the second battle.
    If you hold onto these gains and let go of the things that are unneeded, you win the war that earns a satisfied visitor.


    Written under the influence of: Flesh Quartet, Cibo Matto, Laika, Weekenders and Beatnuts.


    Bulgarian translation

    By P?r Almqvist

    Copyright ? 1994-2005 Digital Web Magazine. All Rights Reserved.

    Posted by ideawu at 2005-12-03 21:02:57
  • 2005-12-03

    Keep it Simple

    Views: 9035 | No Comments

    The first site I made as a professional web developer used 17 frames.
    My first professional assignment was coding the World Press Photo
    site. In those days sites had to be compatible with Netscape and
    Explorer 3 and 4. That wasn't a problem - that's what I'd been hired
    for.
    The site needed three content areas inside a static design of
    navigation and decoration. Nowadays we might use iframes for the
    content areas, but back then only one of the four popular browsers
    supported them. So I coded the site in frames and found that... I
    needed more than expected.
    The cause was Netscape. It was impossible to be certain that in
    Netscape a frame had the exact width and height you defined, so I
    devised a workaround to make sure all frames fit snugly, whatever their
    actual width and height might be. I ended up with 17 frames.
    Nothing wrong with that, I thought, and proceeded to add
    boatloads of JavaScripts to make sure the frames cooperated properly
    (and without which, incidentally, the site wouldn't work).
    When the site went online, I felt proud. I'd proven to myself and to the world that I was a web developer.

    Complexity

    One year later all of the photos on the site had to be republished.
    I'd gained a lot of experience meanwhile, was promoted to head of
    Client Side Programming at my company and consequently made responsible
    for the cleanliness of our code.
    I looked at the site anew and had a vague feeling of unease.
    Mightn't it contain slightly too many frames and scripts? Unfortunately
    the budget didn't call for a redesign, merely for new content. I
    nonetheless spent an entire day in study and judiciously merged two
    frames, making for a total of 16. I couldn't remove more frames without
    destroying the cross-browser compatibility of the design.
    It took me another six months to realize that the whole thing was
    too complex. Since I was paid to worry about such matters, I thought
    long and hard. What had gone wrong? Could we avoid making the same mistakes again?
    At first I blamed the design. In a literal sense this was correct:
    if the design hadn't called for three content frames and one very
    problematical line, the coding could have been much cleaner. But this
    only meant shifting the blame from myself to the designer, so it wasn't
    a real answer. Why had the design been so complicated? Why didn't we
    keep it simple?
    The answer I found is that for most people simple =
    dull
    . A site made by a creative web development company
    must never be dull, ergo it should be complicated.

    KISS

    People were already protesting against this point of view. "Keep It
    Simple, Stupid!", they said. Of course other people disagreed. One mail
    succinctly stated: "KISS leads to LOVE (Leave Out Virtually
    Everything)".
    This reaction accurately mirrored my fears. If we'd leave out the
    newest technologies, the well-designed Flash movie, the nifty DHTML
    script, what kind of site would remain? Just text and the tiniest bit
    of HTML? Booooring.
    But then I discovered two things.
    First of all sites should be exciting only when their purpose is to
    be exciting. An entertainment site should be exciting, sure. But what
    about an e-commerce site? A corporate site? A government site should be a bit dull, I'd think, to underline the importance of the information it provides.
    Secondly, the whole idea of exciting vs. simple is a beginner's
    mistake, and in 1999 I was very much a beginner. Clients make this
    mistake all the time because they are beginners by definition. They
    (and many developers) are misled by the magic words "interactive
    multimedia". A site should be interactive! It should be multimedial!
    (whatever that may mean) The site should move, dance, prance, and who
    cares whether the subject calls for it? We're creative, right?

    Simplicity

    The old World Press Photo site was a typical example of this school
    of thought. It didn't contain any moving stuff, but to make up for that
    we used a tiny Java applet to mimic a dropdown box navigation - why keep it dull if we can make it complex? I replaced it with JavaScript during the review a year later. It can be argued that the site is still too complicated.
    The good news is that in 2001 I got the chance to completely
    recreate the site, this time on better principles. We stopped using
    frames, and we changed the complex navigation scripts to slightly less
    complex DHTML scripts that enhanced the site but didn't contain vital
    functions. The result is a site that fulfills its purpose: showing the World Press Photos of the Year.
    This made me rethink the whole complex-but-exciting approach and at
    the moment I'm on the move toward simplicity. I keep the purpose of the
    site firmly in mind and don't add unnecessary stuff just because it's
    possible. The newest browsers help a lot: CSS goes a long way towards
    creating appealing but simple sites.
    In the next months I'll share my thoughts on simplicity in this
    column on Digital Web Magazine. Why do people make complex sites? When
    does a site become too complex? How should you judge whether a site
    needs to be complex? What techniques should you use to avoid complexity?
    To make it absolutely clear, at the moment I write this I don't
    have the faintest idea what the answers will be. Let's hope they'll be
    simple...

    By Peter-Paul Koch
    Published on August 26, 2002

    Copyright ? 1994-2005 Digital Web Magazine. All Rights Reserved.

    Posted by ideawu at 20:58:51
  • 2005-11-29

    Apache2的httpd.conf翻译

    Views: 12695 | No Comments

    //来源:www.phpx.com,忘记确切地址。
    # 基于 NCSA 服务的配置文件。
    #
    #这是Apache服务器主要配置文件。
    #它包含服务器的影响服务器运行的配置指令。
    #
    #不要只是简单的阅读这些指令信息而不去理解它。
    #这里只是做了简单的说明,如果你没有参考在线文件,你就会被警告。
    #
    #这些配置指令被分为下面三个部分:
    #1. 控制整个Apache服务器行为的部分(即全局环境变量)
    #2. 定义主要或者默认服务参数的指令,也为所有虚拟主机提供默认的设置参数
    #3. 虚拟主机的设置参数
    #
    #配置和日志文件名:如果你指定的文件名以“/”开始(win32下以“dirver:/? 保??
    #服务器将使用绝对路径,如果文件名不是以“/”开始的,那么它将把ServerRo ot
    #的值附加在文件名的前面,例如,对“logs/foo.log",如果ServerRoot的值
    #为“/usr/local/apache2”,则该文件应为“/usr/local/apache2/logs/foo.l og”
    #
    ##第一区:全局环境参数
    #
    #这里设置的参数将影响整个Apache服务器的行为;
    #例如Apache能够处理的并发请求的数量等。
    #
    #ServerRoot:指出服务器保存其配置、出错和日志文件等的根目录。
    #
    #注意!如果你想要将它指定为NFS或其它网络上的位置,
    #请一定要去阅读与LockFile有关的文档#这将会使你自己也能解决很多问题。
    #
    #路径的结尾不要添加斜线。
    #
    ServerRoot "/usr/loacl/apache2"
    #
    #串行访问的锁文件必须保存在本地磁盘上
    #


    #LockFile logs/accept.lock


    #ScoreBoardFile:用来保存内部服务进程信息的文件。
    #如果未指明(默认),记分板(scoreboard)将被保存在一个匿名的共享内存? 沃校?
    #并且它不能被第三方软件所使用。
    #如果指定了,要确保不能使用两个Apache使用同一个记分板文件,
    #这个记分板文件必须保存在本地磁盘上。
    #


    #ScoreBoardFile logs/apache_runtime_status


    #
    #PidFile:记录服务器启动进程号的文件。
    #

    PidFile logs/httpd.pid

    #
    #Timeout:接收和发送前超时秒数
    #
    Timeout 300
    #
    #KeepAlive:是否允许稳固的连接(每个连接有多个请求),
    #设为"Off"则停用。
    #
    KeepAlive On
    #
    #MaxKeepAliveRequests:在稳固连接期间允许的最大请求数,
    #设为0表示无限制接入。
    #我们推荐你将其设为一个较大的值,以便提高性能
    MaxKeepAliveRequests 100
    #
    #KeepAliveTimeout:在同一个连接上从同一台客户上接收请求的秒数
    #
    KeepAliveTimeout 15
    ##
    ##Server-Pool大小设定(针对MPM的)
    ##
    # prefork MPM
    # StartServers:启动时服务器启动的进程数
    # MinSpareServers:保有的备用进程的最小数目
    # MaxSpareServers:保有的备用进程的最大数目
    # MaxClients:服务器允许启动的最大进程数
    # MaxRequestsPerChild:一个服务进程允许的最大请求数

    StartServers 5
    MinSpareServers 5
    MaxSpareServers 10
    MaxClients 150
    MaxRequestPerChild 0

    # worker MPM
    # StartServers:服务器启动时的服务进程数目
    # MaxClients:允许同时连接的最大用户数目
    # MinSpareThreads:保有的最小工作线程数目
    # MaxSpareThreads:允许保有的最大工作线程数目
    # ThreadsPerChild:每个服务进程中的工作线程常数
    # MaxRequestsPerChild:服务进程中允许的最大请求数目

    StartServers 2
    MaxClients 150
    MinSpareThreads 25
    MaxSpareThreads 75
    ThreadsPerChild 25
    MaxRequestsPerChild 0

    # perchild MPM
    # NumServers:服务进程数量
    # StartThreads:每个服务进程中的起始线程数量
    # MinSpareThreads:保有的最小线程数量
    # MaxSpareThreads:保有的最大线程数量
    # MaxThreadsPerChild:每个服务进程允许的最大线程数
    # MaxRequestsPerChild:每个服务进程允许连接的最大数量

    NumServers 5
    StartThreads 5
    MinSpareThreads 5
    MaxSpareThreads 10
    MaxThreadsPerChild 20
    MaxRequestsPerChild 0

    # WinNT MPM
    # ThreadsPerChild:服务进程中工作线程常数
    # MaxRequestsPerChild:服务进程允许的最大请求数

    ThreadsPerChild 250
    MaxRequestsPerChild 0

    # BeOS MPM
    # StartThreads:服务器启动时启动的线程数
    # MaxClients:可以启动的最大线程数(一个线程等于一个用户)
    # MaxRequestsPerThread:每个线程允许的最大请求数

    StartThreads 10
    MaxClients 50
    MaxRequestsPerThread 10000

    # NetWare MPM
    # ThreadStachSize:为每个工作线程分配的堆栈尺寸
    # StartThreads:服务器启动时启动的线程数
    # MinSpareThreads:用于处理实发请求的空闲线程数
    # MaxSpareThreads:空闲线程的最大数量
    # MaxThreads:在同一时间活动的最大线程数
    # MaxRequestPerChild:一个线程服务请求的最大数量,
    # 推荐将其设置为0,以实现无限制的接入

    ThreadStackSize 65536
    StartThreads 250
    MinSpareThreads 25
    MaxSpareThreads 250
    MaxThreads 1000
    MaxRequestPerChild 0

    # OS/2 MPM
    # StartServers:启动的服务进程数量
    # MinSpareThreads:每个进程允许的最小空闲线程
    # MaxSpareThreads:每个进程允许的最大空闲线程
    # MaxRequestsPerChild:每个服务进程允许的最大连接数

    StartServers 2
    MinSpareThreads 5
    MaxSpareThreads 10
    MaxRequestsPerChild 0

    #
    # Listen:允许你绑定Apache服务到指定的IP地址和端口上,以取代默认值
    # 参见指令
    # 使用如下命令使Apache只在指定的IP地址上监听,
    # 以防止它在IP地址0.0.0.0上监听
    #
    # Listen 12.34.56.78:80
    Listen 80
    #
    # 动态共享支持(DSO)
    #
    # 为了能够使用那些以DSO模式编译的模块中的函数,你必须有相应的“LoadModul e”行,
    # 因此,在这里包含了这些指令,以便能在使用它之前激活。
    # 那些静态编译的模块不需要在这里列出 (即以“httpd -l”列出的模块)
    #
    # 示例:
    # LoadModule foo_module modules/mod_foo.so
    #
    #
    # ExtendedStatus:当调用“server-status”时,控制Apache是产生“全”状态
    # 信息(ExtendedStatus On),还是产生基本信息(ExtendedStatus Off)。
    # 默认为off
    #
    # ExtendedStatus On
    ### 第二区:“主”服务配置
    #
    # 这一区建立被 “主” 服务器用的指令值,以回应那些不被
    # 定义处理的任何请求。
    # 这些数值也提供默认值给后面定义的容器。
    # 如果中有定义,那么这里定义的指令值将被
    # 中的定义所覆盖。
    #


    #
    # 如果你想使httpd以另外的用户或组来运行,你必须在开始时以root方式启动
    # 然后再将它切换为你想要使用的用户或组。
    #
    # User/Group:运行httpd的用户和组
    # 在SCO (ODT3)上使用“User nouser”和“Group nogroup”
    # 在HPUX上,你可能不能以nobody身份使用共享内存,建议创建一个www用户。
    # 注意一些核心(kernel)在组ID大于60000时拒绝setgid(Group)或semctl(IPC_S ET),
    #节在这些系统上不要使用“Group #-1”。
    #
    User nobody
    Group #-1


    #
    # ServerAdmin:你的邮件地址,当发生问题时Apache将向你发出邮件。
    # 作为一个出错文档,这个地址显示在server-generated页上,
    # 例如:admin@your-domain.com
    #
    ServerAdmin kreny@sina.com
    #
    # ServerName指定Apache用于识别自身的名字和端口号。
    # 通常这个值是自动指定的,但是我们推荐你显式的指定它以防止启动时出错
    #
    # 如果你为你的主机指定了一个无效的DNS名,server-generated重定向将不能工? 鳌?
    # 参见UseCanonicalName指令
    #
    # 如果你的主机没有注册DNS名,在这里键入它的IP地址
    # 无论如何,你必须使用它的IP地址来提供服务,
    # 这里使用一种容易理解的方式重定向服务
    ServerName www.domain.com
    #
    # UseCanonicalName:决定Apache如何构造URLS和 SERVER_NAME 和 SERVER_PORT 的指令。
    # 当设置为 “Off”时,Apache会使用用户端提供的主机名和端口号。
    # 当设置为“On”,Apache会使用ServerName指令的值。
    #
    UseCanonicalName Off
    #
    # DocumentRoot:你的文档的根目录。默认情况下,所有的请求从这个目录进行应? 稹?
    # 但是可以使用符号链接和别名来指向到其他的位置。
    #
    DocumentRoot "/home/redhat/public_html"
    #
    # Apache可以存取的每个目录都可以配置存取权限(包括它的子目录)。
    #
    # 首先,我们配置一个高限制的特征。
    # 这将禁止访问文件系统所在的目录,并添加你希望允许访问的目录块。
    # 如下所示

    Order Deny,Allow
    Deny from all

    #
    # 注意从这里开始你一定要明确地允许哪些特别的特征能够被使用。
    # - 所以,如果Apache没有象你所期待的那样工作的话,
    # 请检查你是否在下面明确的指定它可用。
    #
    #
    # 这将改变到你设置的DocumentRoot
    #

    #
    # Options:这个指令的值可以是“None”,“All”,或者下列选项的任意组合:
    # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # 注意,“MultiViews”必须被显式的指定,“Options All”不能为你提供这个特性。
    #
    # 这个指令既复杂又重要,请参见
    #
    Options FollowSymLinks
    #
    # AllowOverride控制那些被放置在.htaccess文件中的指令。
    # 它可以是“All”,“None”,或者下列指令的组合:
    # Options FileInfo AuthConfig Limit
    #
    AllowOverride None
    #
    # 控制谁可以获得服务。
    #
    Order allow,deny
    Allow from all

    #
    # UserDir:指定在得到一个~user请求时将会添加到用户home目录后的目录名。
    #
    UserDir public_html
    # 为防止在UserDir指令上的漏洞,对root用户设置
    # 象“./”这样的UserDir是非常有用的。
    # 如果你使用Apache 1.3或以上版本,我们强烈建议你
    # 在你的服务器配置文件中包含下面的行
    UserDir disabled root
    #
    # 下面是一个使用UserDir指令使一个站点的目录具有只读属性的示例:
    #
    #
    # AllowOverride FileInfo AuthConfig Limit Indexes
    # Options MultiViews Indexes SymLinksIfOwnerMatch IncludeNoExec
    #
    # Order allow,deny
    # Allow from all
    #

    #
    # Order deny,allow
    # Deny from all
    #

    #

    #
    # DirectoryIndex:定义请求是一个目录时,Apache向用户提供服务的文件名
    #
    # index.html.var文件(一个类型映象文件)用于提供一个文档处理列表,
    # 出于同样的目的,也可以使用MultiViews选项,但是它会非常慢。
    #
    DirectoryIndex index.php index.html index.html.var
    #
    # AccessFileName:在每个目录中查询为目录提供附加配置指令的文件的文件名。
    # 参见AllowOverride指令。
    #
    AccessFileName .htaccess
    #
    # 下面的行防止.htaccess和.htpasswd文件被Web客户查看。
    #

    Order allow,deny
    Deny from all

    #
    # Typeconfig:定义在哪里查询mime.types文件。
    #
    TypeConfig conf/mime.types
    #
    # DefaultType:定义当不能确定MIME类型时服务器提供的默认MIME类型。
    # 如果你的服务主要包含text或HTML文档,“text/plain”是一个好的选择;
    # 如果大多是二进制文档,诸如软件或图像,你应使用
    # “application/octer-stream”来防止浏览器象显示文本那样显示二进制文件。
    #
    DefaultType text/plain
    #
    # mod_mime_magic允许服务器从自己定义自己类型的文件中使用不同的线索(hint s),
    # 这个MIMEMagicFile指令定义hints定义所在的文件。
    #

    MIMEMagicFile conf/magic

    #
    # HostnameLookups:指定记录用户端的名字还是IP地址,例如,本指令为on时
    # 记录主机名,如http://www.apache.org;为off时记录IP地址,204.62.129.132。
    # 默认值为off,这要比设为on好得多,因为如果设为on则每个用户端请求都将会
    # 至少造成对 nameserver 进行一次查询。
    #
    HostnameLookups Off
    #
    # EnableMMAP:控制是否进行内存转储(如果操作系统支持的话)。
    # 默认为on,如果你的服务器安装在网络文件系统上(NFS),请关闭它。
    # 在一些系统上,关闭它会提升系统性能(与文件系统类型无关);
    #
    # EnableMMAP off
    #
    # EnableSendfile:控制是否使用sendfile kernel支持发送文件
    # (如果操作系统支持的话)。默认为on,如果你的服务器安装在网络文件系统
    # (NFS)上,请你关闭它。
    #
    # EnableSendfile off
    #
    # ErrorLog:错误日志文件定位。
    # 如果你没有在内定义ErrorLog指令,这个虚拟主机的错误信息
    # 将记录在这里。如果你在那儿定义了ErrorLog,这些错误信息将记录在你所
    # 定义的文件里,而不是这儿定义的文件。
    #
    ErrorLog logs/error_log
    #
    # LogLevel:控制记录在错误日志文件中的日志信息数量。
    # 可能的值包括:debug,info,notice,warn,error,crit,alert,emerg。
    #
    LogLevel warn
    #
    # 下面的指令为CustomLog指令定义格式别名。
    #
    LogFormat "%h %l %u %t "%r" %>s %b "%{ Referer }i" "%{ User-Agent }i"" combined
    LogFormat "%h %l %u %t "%r" %>s %b" common
    LogFormat "%{ Referer }i -> %U" referer
    LogFormat "%{ User-agent }i" agent
    # 你需要安装了mod_logio.c模块才能使用%I和%O。
    # LogFormat "%h %l %u %t "%r" %>s %b "%{ Referer }i" "%{ User-Agent }i" %I %O" combinedio
    #
    # 指定接入日志文件的定位和格式(一般日志格式)。
    # 如果你没有在内定义这个指令,传输信息将记录在这里,
    # 如果你定义了这个指令,则记录在你指定的位置,而不是这儿定义的位置。
    #
    CustomLog logs/access_log common
    #
    # 如果你想要记录agent和referer信息,可以使用下面的指令
    #
    # CustomLog logs/referer_log referer
    # CustomLog logs/agent_log agent
    #
    # 如果你想要使用一个文件记录access,agent和referer信息,
    # 你可以如下定义这个指令:
    #
    # CustomLog logs/access_log combined
    #
    # ServerTokens
    # 这个指令定义包含在HTTP回应头中的信息类型。默认为“Full”,
    # 这表示在回应头中将包含模块中的操作系统类型和编译信息。
    # 可以设为列各值中的一个:
    # Full &line; OS &line; Minor &line; Minimal &line; Major &line; Prod
    # Full传达的信息最多,而Prod最少。
    #
    ServerTokens Full
    #
    # 随意的添加包含服务器版本和虚拟主机名字一行信息到server-generated输出页 中
    # (内部错误文档,FTP目录列表,mod_status和mod_info输出等等,除了CGI错误
    # 或自定义的错误文档以外)。
    # 设为“EMail”将包含一个指向ServerAdmin的mailto:连接。
    # 可以为如下值:On &line; Off &line; EMail
    #
    ServerSignature On
    #
    # Aliases:在这时添加你需要的别名,格式如下:
    # Alias 别名 真实名
    #
    # 注意,如果你在别名的未尾包含了“/”,那么在URL中也需要包含“/”。
    # 因此,“/icons”不是这个示例中的别名。
    # 如果别名中以“/”结尾,那么真实名也必须以“/”结尾,
    # 如果别名中省略了结尾的“/”,那么真实名也必须省略。
    #
    # 我们使用别名“/icons/”来表示FancyIndexed目录列表,如果你不使用、
    # FancyIndexing,你可以注释掉它。
    #
    # Alias /icons/ "/usr/local/apache2/icons/"
    #
    # Options Indexes MultiViews
    # AllowOverride None
    # Order allow,deny
    ## Allow from all
    #

    #
    # 这将改变ServerRoot/manual。这个别名提供了手册页所在的位置,
    # 即使你改变了你的DocumentRoot。如果你对有无手册页并不在意的话,
    # 你可以注释掉它。
    #
    Alias /manual "/usr/loacl/apache2/manual"

    Options Indexes FollowSymLinks MultiViews IncludesNoExec
    AddOutputFilter Includes html
    Order allow,deny
    Allow from all

    #
    # ScriptAlias:指定包含服务脚本的目录。
    # ScriptAliases 本质上与Aliases一样,除了这里的文档在请求时做为程序处理处理以外。
    # 尾部的“/”规则与Alias一样
    #
    ScriptAlias /cgi-bin/ "/usr/loacl/apache2/cgi-bin/"
    # 这里是添加php 4支持的指令
    AddType application/x-httpd-php .php
    LoadModule php4_module modules/libphp4.so

    #
    # 添加mod_cgid.c设置,mod_cgid提供使用cgid进行通讯的UNIX套接字的
    # 脚本接口路径。
    #
    # Scriptsock logs/cgisock

    #
    # 将"/usr/local/apache2/cgi-bin"改为你的ScriptAliased指定的CGI目录,
    # 如果你配置了的话。
    #

    AllowOverride None
    Options None
    Order allow,deny
    Allow from all

    #
    # Redirect允许你告诉客户端使用存在于服务器名字空间中的文档,
    # 而不是现在的,这帮助客户定位那些改变了位置的文档。
    # 例如:
    # Redirect permanent /foo http://www.example.com/bar
    #
    # 控制server-generated目录列表显示的指令
    #
    #
    # IndexOptions:控制server-generated目录列表显示特征。
    #
    IndexOptions FancyIndexing VersionSort
    #
    # AddIcon* 指令告诉服务器不同扩展名的图象文件如何显示,
    # 只适用于FancyIndexed指令
    #
    AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
    AddIconByType (TXT,/icons/text.gif) text

    Posted by ideawu at 2005-11-29 10:40:00 Tags:
|<<<202122232425262728>>>| 27/28 Pages, 163 Results.