玲玲 的个人资料玲玲的共享空间照片日志留言簿更多 工具 帮助

日志


2月13日

使用StatSVN统计Subversion库中的代码开发情况入门

StatSVN能够从Subversion版本库中取得信息,然后生成描述项目开发的各种表格和图表。

比如:

代码行数的时间线;

针对每个开发者的代码行数;

开发者的活跃程度;

开发者最近所提交的;

文件数量;

平均文件大小;

最大文件;

哪个文件是修改最多次数的;

目录大小;

带有文件数量和代码行数的Repository tree。

StatSVN当前版本能够生成一组包括表格与图表的静态HTML文档。

StatSVN使用JFreeChart来生成chart。

STATSVN可以从:http://www.statsvn.org/index.html 下载。笔者使用了一段时间STATSVN,感觉其可以作为一个有力的开发统计工具,对开发情况进行统计,虽然在统计中还有一些小问题,但仍然值得使用,下面详述一下使用方法。

一 准备工作
StatSVN是一个Java写的开源统计程序,从STATCVS移值而来。其运行需要Java的运行环境支持,所以大家需要安装Java的运行环境。Java运行环境可以从Sun的网站上下载

StatSvn可以从StatSvn官网下载,目前版本是 0.3.1

Statsvn在使用中需要使用SVN的客户端,因此需要确保机器上可以访问到SVN的客户端命令

二 开始统计工作
1:从仓库中CheckOut一个需要统计的路径,如果在工作目录进行这项工作,那需要首先更新一下,保证取出的是最新版本,保证统计结果准确性,此工作也可用TSVN完成
2:生成工作拷贝的XML Log文件供Statsvn解析使用 在工作拷贝目录 使用 svn log -v --xml > logfile.log
3:调用StatSvn的统计分析工作 java -jar statsvn.jar ...()
参数如下
  <logfile>          path to the svn logfile of the module
  <directory>        path to the directory of the checked out module

Some options:
  -version           print the version information and exit
  -output-dir <dir>  directory where HTML suite will be saved
  -include <pattern> include only files matching pattern, e.g. **/*.c;**/*.h
  -exclude <pattern> exclude matching files, e.g. tests/**;docs/**
  -tags <regexp>     show matching tags in lines of code chart, e.g. version-.*
  -title <title>     Project title to be used in reports
  -viewvc <url>      integrate with ViewVC installation at <url>
  -bugzilla <url>    integrate with Bugzilla installation at <url>
  -username <svnusername> username to pass to svn
  -password <svnpassword> password to pass to svn
  -verbose           print extra progress information
  -xdoc              optional switch output to xdoc
  -threads <int>     how many threads for svn diff (default: 25)
  -concurrencyThreshold <millisec> switch to concurrent svn diff if 1st call>thr
eshold (default: 4000)
  -dump              dump the Repository content on console

下面以一个实例说明

以下任务的目标是每天自动完成更新的仓库的开发统计,把统计数据发布到指定的位置,这样其余人员可以通过Web服务器随时看到最新的统计情况

@ECHO ON
rem 调用格式 runstat 仓库路径 本地名称 发布目录
set repos=%1
set localname=%2
set target=%3
SET LOWER=0
SET UPPER=0
rem 检查一下仓库的最新版本,如果最新版本为0,说明没有内容不需要统计,直接跳出
@FOR /f %%D IN ('%SVN_LOOK% youngest %repos%') DO set UPPER=%%D
if %UPPER%==0 GOTO :N_EXIT
rem 如果子目录已经存在,认为工作拷贝已经存在,则直接更新,不进行检出工作
if exist .\%localname%\nul GOTO :UPDATE
rem 检出指定的仓库路径到本地名称为目录名的目录下
:CHECKOUT
mkdir .\%localname%
%SVN_SVN% co file:///%repos% .\%localname%
rem 取出上次Update的版本号和当前版本号进行比较,如果版本号较旧则进行更新,否则说明不需要更新,直接跳出
:UPDATE
if not exist .\%localname%\%localname%_last_revision.txt GOTO :BEGIN_UPDATE
rem 取出上次备份后的版本号,并做+1处理
@FOR /f %%C IN (.\%localname%\%localname%_last_revision.txt) DO @set LOWER=%%C
@set /a LOWER=%LOWER%+1
rem 不需要更新,则跳转结束
IF %LOWER% gtr %UPPER% GOTO :N_EXIT
rem 更新版本库并记录最新的版本号
:BEGIN_UPDATE
%SVN_SVN% update .\%localname%
@echo %UPPER% > .\%localname%\%localname%_last_revision.txt
rem 生成XMLLog文件,并调用Statsvn进行统计,本例中指定了需要统计的文件类型,并把结果输出到指定的目录,同时开50个线程进行查询,由于我是在本地统计,在网络上不推荐开50个线程。
cd %localname%
%SVN_SVN% log -v --xml > logfile.log
java -jar %STATSVN_JAR% -output-dir %target% -include **/*.cs;**/*.aspx;**/*.Master;**/*.config;**/*.sitemap -threads 50 logfile.log .
cd ..
rem 到这里统计文件已经生成,大家可以发指定的发布目录进行查看了。下面给大家两个截图看看
:N_EXIT
@echo 项目库%localname%处理结束...
@exit /B
大小: 98.26 K
尺寸: 500 x 358
浏览: 26 次
点击打开新窗口浏览全图

大小: 76.3 K
尺寸: 207 x 296
浏览: 67 次
点击打开新窗口浏览全图

下面打包好的脚本文件,可以作为大家的参考
code.rar

转帖请包含作者等版权信息、并注明来自:我用Subversion - 使用StatSVN统计Subversion库中的代码开发情况入门

11月4日

学习英文

Chapter 19: Security

The Internet can be a scary place.

These days, high-profile security gaffes seem to crop up on a daily basis. We’ve seen viruses spread with amazing speed, swarms of compromised computers wielded as weapons, a never-ending arms race against spammers, and many, many reports of identify theft from hacked Web sites.

As Web developers, we have a duty to do what we can to combat these forces of darkness. Every Web developer needs to treat security as a fundamental aspect of Web programming. Unfortunately, it turns out that implementing security is hard — attackers need to find only a single vulnerability, but defenders have to protect every single one.

Django attempts to mitigate this difficulty. It’s designed to automatically protect you from many of the common security mistakes that new (and even experienced) Web developers make. Still, it’s important to understand what these problems are, how Django protects you, and — most important — the steps you can take to make your code even more secure.

First, though, an important disclaimer: We do not intend to present a definitive guide to every known Web security exploit, and so we won’t try to explain each vulnerability in a comprehensive manner. Instead, we’ll give a short synopsis of security problems as they apply to Django.

The Theme of Web Security

If you learn only one thing from this chapter, let it be this:

Never — under any circumstances — trust data from the browser.

You never know who’s on the other side of that HTTP connection. It might be one of your users, but it just as easily could be a nefarious cracker looking for an opening.

Any data of any nature that comes from the browser needs to be treated with a healthy dose of paranoia. This includes data that’s both “in band” (i.e., submitted from Web forms) and “out of band” (i.e., HTTP headers, cookies, and other request information). It’s trivial to spoof the request metadata that browsers usually add automatically.

Every one of the vulnerabilities discussed in this chapter stems directly from trusting data that comes over the wire and then failing to sanitize that data before using it. You should make it a general practice to continuously ask, “Where does this data come from?”

SQL Injection

SQL injection is a common exploit in which an attacker alters Web page parameters (such as GET/POST data or URLs) to insert arbitrary SQL snippets that a naive Web application executes in its database directly. It’s probably the most dangerous — and, unfortunately, one of the most common — vulnerabilities out there.

This vulnerability most commonly crops up when constructing SQL “by hand” from user input. For example, imagine writing a function to gather a list of contact information from a contact search page. To prevent spammers from reading every single email in our system, we’ll force the user to type in someone’s username before providing her email address:

def user_contacts(request):
    user = request.GET['username']
    sql = "SELECT * FROM user_contacts WHERE username = '%s';" % username
    # execute the SQL here...

Note

In this example, and all similar “don’t do this” examples that follow, we’ve deliberately left out most of the code needed to make the functions actually work. We don’t want this code to work if someone accidentally takes it out of context.

Though at first this doesn’t look dangerous, it really is.

First, our attempt at protecting our entire email list will fail with a cleverly constructed query. Think about what happens if an attacker types "' OR 'a'='a" into the query box. In that case, the query that the string interpolation will construct will be:

SELECT * FROM user_contacts WHERE username = '' OR 'a' = 'a';

Because we allowed unsecured SQL into the string, the attacker’s added OR clause ensures that every single row is returned.

However, that’s the least scary attack. Imagine what will happen if the attacker submits "'; DELETE FROM user_contacts WHERE 'a' = 'a'". We’ll end up with this complete query:

SELECT * FROM user_contacts WHERE username = ''; DELETE FROM user_contacts WHERE 'a' = 'a';

Yikes! Where’d our contact list go?

The Solution

Although this problem is insidious and sometimes hard to spot, the solution is simple: never trust user-submitted data, and always escape it when passing it into SQL.

The Django database API does this for you. It automatically escapes all special SQL parameters, according to the quoting conventions of the database server you’re using (e.g., PostgreSQL or MySQL).

For example, in this API call:

foo.get_list(bar__exact="' OR 1=1")

Django will escape the input accordingly, resulting in a statement like this:

SELECT * FROM foos WHERE bar = '\' OR 1=1'

Completely harmless.

This applies to the entire Django database API, with a couple of exceptions:

  • The where argument to the extra() method (see Appendix C). That parameter accepts raw SQL by design.
  • Queries done “by hand” using the lower-level database API.

In each of these cases, it’s easy to keep yourself protected. In each case, avoid string interpolation in favor of passing in bind parameters. That is, the example we started this section with should be written as follows:

from django.db import connection

def user_contacts(request):
    user = request.GET['username']
    sql = "SELECT * FROM user_contacts WHERE username = %s;"
    cursor = connection.cursor()
    cursor.execute(sql, [user])
    # ... do something with the results

The low-level execute method takes a SQL string with %s placeholders and automatically escapes and inserts parameters from the list passed as the second argument. You should always construct custom SQL this way.

Unfortunately, you can’t use bind parameters everywhere in SQL; they’re not allowed as identifiers (i.e., table or column names). Thus, if you need to, say, dynamically construct a list of tables from a POST variable, you’ll need to escape that name in your code. Django provides a function, django.db.backend.quote_name, which will escape the identifier according to the current database’s quoting scheme.

Cross-Site Scripting (XSS)

Cross-site scripting (XSS), is found in Web applications that fail to escape user-submitted content properly before rendering it into HTML. This allows an attacker to insert arbitrary HTML into your Web page, usually in the form of <script> tags.

Attackers often use XSS attacks to steal cookie and session information, or to trick users into giving private information to the wrong person (aka phishing).

This type of attack can take a number of different forms and has almost infinite permutations, so we’ll just look at a typical example. Consider this extremely simple “Hello, World” view:

def say_hello(request):
    name = request.GET.get('name', 'world')
    return render_to_response("hello.html", {"name" : name})

This view simply reads a name from a GET parameter and passes that name to the hello.html template. We might write a template for this view as follows:

<h1>Hello, {{ name }}!</h1>

So if we accessed http://example.com/hello/name=Jacob, the rendered page would contain this:

<h1>Hello, Jacob!</h1>

But wait — what happens if we access http://example.com/hello/name=<i>Jacob</i>? Then we get this:

<h1>Hello, <i>Jacob</i>!</h1>

Of course, an attacker wouldn’t use something as benign as <i> tags; he could include a whole set of HTML that hijacked your page with arbitrary content. This type of attack has been used to trick users into entering data into what looks like their bank’s Web site, but in fact is an XSS-hijacked form that submits their back account information to an attacker.

The problem gets worse if you store this data in the database and later display it it on your site. For example, MySpace was once found to be vulnerable to an XSS attack of this nature. A user inserted JavaScript into his profile that automatically added him as your friend when you visited his profile page. Within a few days, he had millions of friends.

Now, this may sound relatively benign, but keep in mind that this attacker managed to get his code — not MySpace’s — running on your computer. This violates the assumed trust that all the code on MySpace is actually written by MySpace.

MySpace was extremely lucky that this malicious code didn’t automatically delete viewers’ accounts, change their passwords, flood the site with spam, or any of the other nightmare scenarios this vulnerability unleashes.

The Solution

The solution is simple: always escape any content that might have come from a user. If we simply rewrite our template as follows:

<h1>Hello, {{ name|escape }}!</h1>

then we’re no longer vulnerable. You should always use the escape tag (or something equivalent) when displaying user-submitted content on your site.

Why Doesn’t Django Just Do This for You?

Modifying Django to automatically escape all variables displayed in templates is a frequent topic of discussion on the Django developer mailing list.

So far, Django’s templates have avoided this behavior because it subtly changes what should be relatively straightforward behavior (displaying variables). It’s a tricky issue and a difficult tradeoff to evaluate. Adding hidden implicit behavior is against Django’s core ideals (and Python’s, for that matter), but security is equally important.

All this is to say, then, that there’s a fair chance Django will grow some form of auto-escaping (or nearly auto-escaping) behavior in the future. It’s a good idea to check the official Django documentation for the latest in Django features; it will always be more up to date than this book, especially the print edition.

Even if Django does add this feature, however, you should still be in the habit of asking yourself, at all times, “Where does this data come from?” No automatic solution will ever protect your site from XSS attacks 100% of the time.

Cross-Site Request Forgery

Cross-site request forgery (CSRF) happens when a malicious Web site tricks users into unknowingly loading a URL from a site at which they’re already authenticated — hence taking advantage of their authenticated status.

Django has built-in tools to protect from this kind of attack. Both the attack itself and those tools are covered in great detail in Chapter 14.

Session Forging/Hijacking

This isn’t a specific attack, but rather a general class of attacks on a user’s session data. It can take a number of different forms:

  • A man-in-the-middle attack, where an attacker snoops on session data as it travels over the wire (or wireless) network.

  • Session forging, where an attacker uses a session ID (perhaps obtained through a man-in-the-middle attack) to pretend to be another user.

    An example of these first two would be an attacker in a coffee shop using the shop’s wireless network to capture a session cookie. She could then use that cookie to impersonate the original user.

  • A cookie-forging attack, where an attacker overrides the supposedly read-only data stored in a cookie. Chapter 12 explains in detail how cookies work, and one of the salient points is that it’s trivial for browsers and malicious users to change cookies without your knowledge.

    There’s a long history of Web sites that have stored a cookie like IsLoggedIn=1 or even LoggedInAsUser=jacob. It’s dead simple to exploit these types of cookies.

    On a more subtle level, though, it’s never a good idea to trust anything stored in cookies; you never know who’s been poking at them.

  • Session fixation, where an attacker tricks a user into setting or reseting the user’s session ID.

    For example, PHP allows session identifiers to be passed in the URL (e.g., http://example.com/?PHPSESSID=fa90197ca25f6ab40bb1374c510d7a32). An attacker who tricks a user into clicking a link with a hard-coded session ID will cause the user to pick up that session.

    Session fixation has been used in phishing attacks to trick users into entering personal information into an account the attacker owns. He can later log into that account and retrieve the data.

  • Session poisoning, where an attacker injects potentially dangerous data into a user’s session — usually through a Web form that the user submits to set session data.

    A canonical example is a site that stores a simple user preference (like a page’s background color) in a cookie. An attacker could trick a user into clicking a link to submit a “color” that actually contains an XSS attack; if that color isn’t escaped, the user could again inject malicious code into the user’s environment.

The Solution

There are a number of general principles that can protect you from these attacks:

  • Never allow session information to be contained in the URL.

    Django’s session framework (see Chapter 12) simply doesn’t allow sessions to be contained in the URL.

  • Don’t store data in cookies directly; instead, store a session ID that maps to session data stored on the back-end.

    If you use Django’s built-in session framework (i.e., request.session), this is handled automatically for you. The only cookie that the session framework uses is a single session ID; all the session data is stored in the database.

  • Remember to escape session data if you display it in the template. See the earlier XSS section, and remember that it applies to any user-created content as well as any data from the browser. You should treat session information as being user created.

  • Prevent attackers from spoofing session IDs whenever possible.

    Although it’s nearly impossible to detect someone who’s hijacked a session ID, Django does have built-in protection against a brute-force session attack. Session IDs are stored as hashes (instead of sequential numbers), which prevents a brute-force attack, and a user will always get a new session ID if she tries a nonexistent one, which prevents session fixation.

Notice that none of those principles and tools prevents man-in-the-middle attacks. These types of attacks are nearly impossible to detect. If your site allows logged-in users to see any sort of sensitive data, you should always serve that site over HTTPS. Additionally, if you have an SSL-enabled site, you should set the SESSION_COOKIE_SECURE setting to True; this will make Django only send session cookies over HTTPS.

Email Header Injection

SQL injection’s less well-known sibling, email header injection, hijacks Web forms that send email. An attacker can use this technique to send spam via your mail server. Any form that constructs email headers from Web form data is vulnerable to this kind of attack.

Let’s look at the canonical contact form found on many sites. Usually this sends a message to a hard-coded email address and, hence, doesn’t appear vulnerable to spam abuse at first glance.

However, most of these forms also allow the user to type in his own subject for the email (along with a “from” address, body, and sometimes a few other fields). This subject field is used to construct the “subject” header of the email message.

If that header is unescaped when building the email message, an attacker could submit something like "hello\ncc:spamvictim@example.com" (where "\n” is a newline character). That would make the constructed email headers turn into:

To: hardcoded@example.com
Subject: hello
cc: spamvictim@example.com

Like SQL injection, if we trust the subject line given by the user, we’ll allow him to construct a malicious set of headers, and he can use our contact form to send spam.

The Solution

We can prevent this attack in the same way we prevent SQL injection: always escape or validate user-submitted content.

Django’s built-in mail functions (in django.core.mail) simply do not allow newlines in any fields used to construct headers (the from and to addresses, plus the subject). If you try to use django.core.mail.send_mail with a subject that contains newlines, Django will raise a BadHeaderError exception.

If you do not use Django’s built-in mail functions to send email, you’ll need to make sure that newlines in headers either cause an error or are stripped. You may want to examine the SafeMIMEText class in django.core.mail to see how Django does this.

Directory Traversal

Directory traversal is another injection-style attack, wherein a malicious user tricks filesystem code into reading and/or writing files that the Web server shouldn’t have access to.

An example might be a view that reads files from the disk without carefully sanitizing the file name:

def dump_file(request):
    filename = request.GET["filename"]
    filename = os.path.join(BASE_PATH, filename)
    content = open(filename).read()

    # ...

Though it looks like that view restricts file access to files beneath BASE_PATH (by using os.path.join), if the attacker passes in a filename containing .. (that’s two periods, a shorthand for “the parent directory”), she can access files “above” BASE_PATH. It’s only a matter of time before she can discover the correct number of dots to successfully access, say, ../../../../../etc/passwd.

Anything that reads files without proper escaping is vulnerable to this problem. Views that write files are just as vulnerable, but the consequences are doubly dire.

Another permutation of this problem lies in code that dynamically loads modules based on the URL or other request information. A well-publicized example came from the world of Ruby on Rails. Prior to mid-2006, Rails used URLs like http://example.com/person/poke/1 directly to load modules and call methods. The result was that a carefully constructed URL could automatically load arbitrary code, including a database reset script!

The Solution

If your code ever needs to read or write files based on user input, you need to sanitize the requested path very carefully to ensure that an attacker isn’t able to escape from the base directory you’re restricting access to.

Note

Needless to say, you should never write code that can read from any area of the disk!

A good example of how to do this escaping lies in Django’s built-in static content-serving view (in django.views.static). Here’s the relevant code:

import os
import posixpath

# ...

path = posixpath.normpath(urllib.unquote(path))
newpath = ''
for part in path.split('/'):
    if not part:
        # strip empty path components
        continue

    drive, part = os.path.splitdrive(part)
    head, part = os.path.split(part)
    if part in (os.curdir, os.pardir):
        # strip '.' and '..' in path
        continue

    newpath = os.path.join(newpath, part).replace('\\', '/')

Django doesn’t read files (unless you use the static.serve function, but that’s protected with the code just shown), so this vulnerability doesn’t affect the core code much.

In addition, the use of the URLconf abstraction means that Django will never load code you’ve not explicitly told it to load. There’s no way to create a URL that causes Django to load something not mentioned in a URLconf.

Exposed Error Messages

During development, being able to see tracebacks and errors live in your browser is extremely useful. Django has “pretty” and informative debug messages specifically to make debugging easier.

However, if these errors get displayed once the site goes live, they can reveal aspects of your code or configuration that could aid an attacker.

Furthermore, errors and tracebacks aren’t at all useful to end users. Django’s philosophy is that site visitors should never see application-related error messages. If your code raises an unhandled exception, a site visitor should not see the full traceback — or any hint of code snippets or Python (programmer-oriented) error messages. Instead, the visitor should see a friendly “This page is unavailable” message.

Naturally, of course, developers need to see tracebacks to debug problems in their code. So the framework should hide all error messages from the public, but it should display them to the trusted site developers.

The Solution

Django has a simple flag that controls the display of these error messages. If the DEBUG setting is set to True, error messages will be displayed in the browser. If not, Django will render return an HTTP 500 (“Internal server error”) message and render an error template that you provide. This error template is called 500.html and should live in the root of one of your template directories.

Because developers still need to see errors generated on a live site, any errors handled this way will send an email with the full traceback to any addresses given in the ADMINS setting.

Users deploying under Apache and mod_python should also make sure they have PythonDebug Off in their Apache conf files; this will suppress any errors that occur before Django has had a chance to load.

A Final Word on Security

We hope all this talk of security problems isn’t too intimidating. It’s true that the Web can be a wild and wooly world, but with a little bit of foresight, you can have a secure Web site.

Keep in mind that Web security is a constantly changing field; if you’re reading the dead-tree version of this book, be sure to check more up to date security resources for any new vulnerabilities that have been discovered. In fact, it’s always a good idea to spend some time each week or month researching and keeping current on the state of Web application security. It’s a small investment to make, but the protection you’ll get for your site and your users is priceless.

What’s Next

In the `next chapter`_, we’ll finally cover the subtleties of deploying Django: how to launch a production site and how to set it up for scalability.

Docutils System Messages

System Message: ERROR/3 (<string>, line 526); backlinkUnknown target name: “next chapter”.

计算机安全性能测试

软件安全性测试包括程序、数据库安全性测试。根据系统安全指标不同测试策略也不同。

用户认证安全的测试要考虑问题:

1.         明确区分系统中不同用户权限

2.         系统中会不会出现用户冲突

3.         系统会不会因用户的权限的改变造成混乱

4.         用户登陆密码是否是可见、可复制

5.         是否可以通过绝对途径登陆系统(拷贝用户登陆后的链接直接进入系统)

6.         用户推出系统后是否删除了所有鉴权标记,是否可以使用后退键而不通过输入口令进入系统

系统网络安全的测试要考虑问题

1.         测试采取的防护措施是否正确装配好,有关系统的补丁是否打上

2.         模拟非授权攻击,看防护系统是否坚固

3.         采用成熟的网络漏洞检查工具检查系统相关漏洞(即用最专业的黑客攻击工具攻击试一下,现在最常用的是 NBSI 系列和 IPhacker IP

4.         采用各种木马检查工具检查系统木马情况

5.         采用各种防外挂工具检查系统各组程序的客外挂漏洞

数据库安全考虑问题:

1.         系统数据是否机密(比如对银行系统,这一点就特别重要,一般的网站就没有太高要求)

2.         系统数据的完整性(我刚刚结束的企业实名核查服务系统中就曾存在数据的不完整,对于这个系统的功能实现有了障碍)

3.         系统数据可管理性

4.         系统数据的独立性

5.         系统数据可备份和恢复能力(数据备份是否完整,可否恢复,恢复是否可以完整)

untitled

 

7月30日

mysql修改密码

新手在这个上往往容易范错误,导致不能进入MYSQL,整得非常郁闷。
我来做几个例子相信很快就明白了 。
1、原来的密码是123456
C:\>type mysql5.bat
@echo off
mysql -uroot -p123456 -P3306
正确的修改MYSQL用户密码的格式是:
我们这里用
用户:root(可以换成其他的)
密码:woshiduide
来演示新密码。

C:\>mysqladmin -uroot -p password woshiduide
Enter password: ******
于是修改成功。
注意PASSWORD关键字后面的空格

有好多人是这样修改的:
C:\>mysqladmin -uroot -p password 'woshiduide'
Enter password: ******

C:\>mysqladmin -uroot -p password 'woshiduide'
Enter password: *********
Warning: single quotes were not trimmed from the password by your command
line client, as you might have expected.

而这个时候真正的密码是'woshiduide'

C:\>mysql -uroot -p'woshiduide'
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 18
Server version: 5.1.17-beta-community-nt-debug MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

而新手往往这样:
C:\>mysql -uroot -pwoshiduide
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: Y
ES)
所以非常郁闷,BAIDU、GOOGLE的搜了一大堆。

我现在把密码改回去。
C:\>mysqladmin -uroot -p'woshiduide' password 123456

2、还有就是可以直接进入MYSQL,然后修改密码。

mysql> use mysql
Database changed
mysql> update user set PASSWORD = PASSWORD('woshiduide') where USER='root' and H
OST='localhost';
Query OK, 1 row affected (0.05 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;

mysql> exit
Bye

C:\>mysql -uroot -pwoshiduide
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 23
Server version: 5.1.17-beta-community-nt-debug MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>
Query OK, 0 rows affected (0.02 sec)
3、还有一种就是用SET PASSWORD 命令修改:

C:\>mysql5.bat
Enter password: ******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.1.17-beta-community-nt-debug-log MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> set password for root@'localhost' = password('woshiduide');
Query OK, 0 rows affected (0.02 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.09 sec)

mysql> exit
Bye
4、GRANT 也可以,不过这里不介绍。因为涉及到权限的问题。
7月22日

jspwiki搭建

Wiki的概念

Wiki 指一种超文本系统。这种超文本系统支持面向社群的协作式写作,同时也包括一组支持这种写作的辅助工具。我们可以在Web的基础上对Wiki文本进行浏览、创建、更改,而且创建、更改、发布的代价远比HTML文本小;同时Wiki系统还支持面向社群的协作式写作,为协作式写作提供必要帮助;最后,Wiki的作者自然构成了一个社群,Wiki系统为该社群提供简单的交流工具。与其它超文本系统相比,Wiki有使用方便及开放的特点,所以Wiki系统可以帮助我们在一个社群内共享某领域的知识。

JSPWiki 简介

JSPWiki是一个基于文本文件的简易wiki系统包括了身份认证和版本控制功能。完全采用JSP/Sevelet开发,采用UTF-8,能很好的支持中文,可以直接使用中文名作为页面(page)名。是一个简单易用的Wiki引擎。本文将向您展示如何建立一个自己的JSPWiki 应用。包括改变模板,安装插件以及为你的wiki加入身份认证功能。
目录
*       [1] 在Tomcat下建立JSPWiki应用
*       [2] 更换模板
*       [3] 安装插件
*       [4] 使用身份认证功能
Tomcat下建立JSPWiki应用 [#1]
1.  下载JSPWiki,解压缩,把jspwiki.war直接Copy到Tomcat下面webapps目录下,更名为wiki.war。
2.  启动tomcat,wiki.war会自动解压缩到webapps目录下
3.  到%Tomcat%/webapps/wiki/classes/WEB-INFO目录下面修改jspwiki.properties文件,作如下修改

  jspwiki.fileSystemProvider.pageDir = D:\\SOFT\\Tomcat5.5.20_wiki\\webapps\\wiki\\myData
  jspwiki.basicAttachmentProvider.storageDir = D:\\SOFT\\Tomcat5.5.20_wiki\\webapps\\wiki\\myData
  log4j.appender.FileLog.File = D:\\SOFT\\Tomcat5.5.20_wiki\\logs\\jspwiki.log
  jspwiki.baseURL = http://localhost:8080/wiki/
4.  可以运行http://localhost:8080/wiki/Install.jsp帮助完成上述配置 ,为了能够在wiki中使用HTML需要修改 jspwiki.properties,把allowHTML 选项打开

  jspwiki.translatorReader.allowHTML = true
更换模板 [#2]
1.      下载模板redman,并且解包到tomcat_home\webapps\JSPWiki目录下的template的目录下,目录名称应该就是redman
2.      修改jspwiki.propertiest文件,把

  jspwiki.templateDir = default
改成

   jspwiki.templateDir = redman
安装插件 [#3]
安装java2html插件
1.      下载java2html插件
2.      把下载下来的java2html.jar拷贝到 tomcat_home\webapps\JSPWiki\WEB-INF\lib目录下
3.      修改 jspwiki.propertiest文件

jspwiki.plugin.searchPath = de.java2html.plugin.jspwiki
安装PDF插件
1.  首先需要下载其它组件。下载Apache FOP 并解包把avalon-framework.jar (或者其他版本,比如:avalon-framework-cvs-20020806.jar)、batik.jar、fop.jar拷贝到WEB-INF/lib下;下载 jTidy 并解包,拷贝Tidy.jar to WEB-INF/lib目录下;下载 JIMI 并解包,把JimiProClasses.zip拷贝到WEB-INF/lib/目录并改名为JimiProClasses.jar.
2.  在jspwiki 下载pdf插件
3.  把下载下来的wikipdf.jar拷贝到 tomcat_home\webapps\JSPWiki\WEB-INF\lib目录下
4.  修改 tomcat_home\webapps\JSPWiki目录下Web.xml文件,增加下面的内容

 <servlet>
     <servlet-name>Wiki2PDFServlet</servlet-name>
     <servlet-class>se.eminds.jspwiki.Wiki2PDFServlet</servlet-class>
 </servlet>
 
 <servlet-mapping>
     <servlet-name>Wiki2PDFServlet</servlet-name>
     <url-pattern>/wiki.pdf</url-pattern>
 </servlet-mapping>
5.  修改templates/default/ViewTemplate.jsp文件,加入下面的内容

 <a href="wiki.pdf?page=<wiki:Variable var="pagename" />&ext=.pdf">View PDF</a> 
注意: 修改jspwiki.propertiest文件时,"="后面的变量值后面不能有多余的空格或者tab,否则JSPWiki无法正常读取配置文件导致改动没有效果。

使用身份认证功能
[#4]
1.  修改jspwiki.properties文件,加入下面的内容:

jspwiki.authenticator = FileAuthenticator

  jspwiki.fileAuthenticator.fileName = /tmp/passwords.txt

  jspwiki.auth.useOldAuth=true

# Add the following line authorize all users

  jspwiki.policy.strictLogins = true
2.  编辑对应的password.txt文件加入合法用户,例如:

# The format is simply username = password
  # No encryption is used currently.
  # Comments are allowed; prepend with hash.

  ebu = foobar
  ubi = frobozz
3.  设置全部页面的默认访问权限,增加一个DefaultPermissions页面,包含下面的内容
[{SET defaultpermissions='ALLOW view Guest;DENY edit Guest;ALLOW edit KnownPerson'}]
4.      管理员用户组。可以在jspwiki.propertiest文件中指定管理员用户组的名称,如:

jspwiki.auth.administrator = WikiAdmin
5.  那么默认的管理员用户组被命名为WikiAdmin,然后可以创建WikiAdmin页面加入成员,下面指令可以在WikiAdmin中加入JackJones,JillJones两个用户
[{SET members='JackJones, JillJones'}]
6.  如果需要设置单独页面的访问权限,可在页面内容前面加上访问规则,例如:
[{ALLOW view Guest}] [{DENY edit Guest}] [{ALLOW edit ebu, ubi}]
7.  如果需要增加一个用户组Xyz,增加一个Xyz的页面,加入下面的指令
[{SET members='Foo, Bar'}] }]
注意: JSPWiki有几个默认的用户组。
   任何一个访问wiki的用户都属于Guest用户组;
   任何一个使用user prefenrences设置了用户名的用户都属于NamedGuest用户组;
   所有通过了身份认证的用户属于KnownPerson用户组。
注意: 目前的身份认证处理方式是临时的。
   目前的身份认证方式是临时的,到2.4以上的版本会改变。目前权限规则实现有问题, 必须使用管理员用户组。因为加上了禁止guest访问
的权限管理规则后,除了管理员外所有用户都无法编辑wiki。 如果希望一个用户有wiki的编辑权限,别忘了把他加到管理员用户组。

7月18日

时间同步

[时间同步]NTP服务器的配置

本文介绍了时间服务器常用的二种协议:SNTP和TIME,并就局域网环境下各种系统(Linux、Windows98、2000、XP)时间服务的设置分别进行了说明,最终实现整个局域网环境下所有电脑时钟的同步与校准。一、什么是网络时间服务
  网络时间服务Net Time Service与网络文件下载服务FTP、网络浏览服务WWW等一样,是一种网络服务,提供网络时间服务的电脑叫网络时间服务器。当然有些时间服务器是纯硬件结构的,通过GPS卫星信息来获取时间,其外观与一台交换机相似,不在文本介绍之列。本文主要介绍一台电脑如何通过网络获取上级时间服务器提供的标准时间,再服务于本单位的局域网,使一个单位的所有电脑都能与标准时间保持同步,时间误差一般小于0.5秒。
   TCP/IP协议中,用于同步时间的协议为NTP协议,它是由美国德拉瓦大学的David L. Mills教授于1985年提出,除了可以估算封包在网络上的往返延迟外,还可独立地估算计算机时钟偏差,从而实现在网络上的高精准度计算机校时,它是设计用来在Internet上使不同的机器能维持相同时间的一种通讯协议。时间服务器(time server)是利用NTP的一种服务器,通过它可以使网络中的电脑保持时间同步。
  NTP是一个跨越广域网或局域网的复杂的同步时间协议,它通常可获得毫秒级的精度。SNTP(Simple Network Time Protocol)是NTP的一个子集,目的是为了那些不需要NTP实现复杂性网络时间同步的主机。通常用于局域网上的若干台主机通过互联网与其他的 NTP主机同步时钟,接着再向局域网内其他客户端提供时间同步服务。SNTP一般使用UDP的123端号,Linux系统和Windows系统都支持它,是现在架设网络时间服务器的主流协议。
   Time Protocol (RFC-868)协议是一种较简单的协议。此协议提供了一个独立于站点的,机器可读的日期和时间信息。时间服务返回的是从1900年1月1日午夜到现在的秒数。该协议通过TCP或UDP的37端口提供服务。Linux下的TIME服务提供该服务,Windows系统中较少使用。
  现在网上的许多时间校准软件,有些支持SNTP协议、有些支持TIME协议,有些二者都支持,我们在选择时要特别注意。另外在Windows系统的对等网中,还有使用“net time 机器名 /set /yes”命令使用netbios协议进行时间校准,由于这种方法不支持混合网络和跨网段网络,本文也不特别介绍。二、时间服务器有何用
  也许有人认为电脑的时钟有点误差影响不大,其实这是非常错误的。电脑系统中的文件保存、文件传输、电子邮箱中的时间戳都是以电脑时钟为准的。如果今后我们想进行文件查找、日志查询,如果系统时钟不准,或同一网络中的电脑时间不同步,将给后续工作带有许多麻烦。现在许多备份软件、编译软件、FTP工具都是以文件保存时间为依据进行比较的,如果时间不统一,将使这些软件难以正常工作。三、如何使局域网内的所有电脑时钟同步
  首先要在互联网上寻找一台或几台专门提供时间服务的电脑(以下称为主时间服务器)。现在有不少机构免费提供标准时钟服务,在http: //www.ntp.org中专门介绍有不少时间服务器地址。推荐大家在平时使用pool.ntp.org这个地址,因为这个域名在DNS解析时会从一组时钟服务器的IP中随机选取,非常合适一般用户使用。大家也可以在搜索引擎中以“public time server”为关键词搜索一下,找出离你较近的时间服务器。
  其次选择单位中能上网的一台电脑,让它与主时间服务器同步,这台电脑可以是Linux主机,也可以是win98、2000、XP主机。同时把这台电脑设为局域网内部的时间服务器(以下称为时间服务器),供局域网内部的所有电脑校对时间。
  再在单位内部的所有电脑上设置时间服务的客户端,如果客户机为win2000、XP或Linux系统,不需要安装任何软件。如客户机为win98系统时要根据时间服务器类型的不同而区别对待:如果时间服务器选用SNTP协议进行时钟同步,则win98机上需安装一个sntp客户端软件,如时间服务器由 windows电脑通过netbios协议提供,则win98上也不需要安装任何软件。四、设置时间服务器
以下分Linux、Win98、Win2000XP三种情况分别介绍,而且只介绍sntp服务的架设,timeserver服务和netbios对时服务由于应用很少,不做介绍。
1、Linux主机做时间服务器(以RedHat9.0为例)
第一步:检查是否已经安装有ntp软件包。输入“rpm -qa|grep ntp”,如果已经安装应该显示“ntp-4.1.2-0.rc1”。
  第二步:安装ntp软件,从ftp://ftp.redhat.com下载rpm包,输入“rpm -ivh ntp-xxx.rpm”执行安装。
  第三步:配置ntp服务。备份原/etc/ntp.conf文件后,输入以下内容
       server pool.ntp.org
server pool.ntp.org
server pool.ntp.org
driftfile /etc/ntp/drift
三行server都设pool.ntp.org是为了提供连接冗余,当第一个地址连接失败时,后面的地址提供时间服务,注意这里的pool.ntp.org对应一组IP地址,由DNS随机分配。
  第四步:启动ntp服务。输入“service ntp restart”。
  为了保证以后Linux机启动后ntp服务能自动启动,还要输入“chkconfig ntpd on”。Linux下的ntp软件不但能自动与互联网上的时钟保持同步,同时本身已经是一台SNTP服务器了,可以供局域网内的电脑校对时间。建议启动 NTP服务后,先用date命令手工校正一下时间,以后系统会自动与互联网上的主时间服务器保持同步。ntp服务还有一个好处,如果当前系统的时间与标准时间有所误差,它不是马上把时间校正,而是逐步缩小与标准时间的误差,以免系统内部出现时间突变。
2、Windows2000、XP做时间服务器
  第一步:指定主时间服务器。在DOS方式输入“net time /setsntp:pool.ntp.org”,这里我们指定pool.ntp.org是主时间服务器,也可以是其它地址。
  第二步:开始与主时间服务器同步。先关闭windows time服务,再开启该服务。可以在“管理工具”的“服务”界面下完成,也可以以DOS方式输入“net stop w32time”、“net start w32time”。
  第三步:设置电脑的Windows time服务的启动方式为自动。在“管理工具”的“服务”界面下完成。
  注意这台windows主机不能加入任何域,否则无法启动windows time服务。此时,这台windows电脑已经是互联上主时间服务器的客户了,以后每次电脑启动时,都会自动与主时间服务器校对时间。如果网络不通,电脑也会过45分钟后再次自动校对时间。需要注意的是电脑的时钟与标准时间误差不能超过12小时,否则不能自动校对,而要手动校正了。
  第四步:使这台电脑成为时间服务器,供局域网内部的电脑校对时间。用“regedit”打开注册表,把 “HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesW32TimeParameters”中的 LocalNTP改为1即可。
3、Windows98做时间服务器
  一般不推荐Windows98系统做时间服务器,而且win98本身也不含时间服务器功能,需要安装第三方软件。本文后面介绍的nettime软件(http://nettime.sourceforge.net/)是一个非常优秀的时间客户端软件,它可以工作在windows98、2000、XP 系统中,当选中“Allow other computers to sync to this computer”时,可以把这台电脑当做成时间服务器。
五、设置时间服务器的客户端
  客户端的主要任务是连接到局域网内的时间服务器,以保持电脑的时钟与服务器同步。同样分Linux、Windows98、2000、XP几种情况介绍
1、LINUX主机
  其实在上面介绍Linux系统中的ntp服务时,已经提到ntp时间服务时同时也是一个时间服务的客户端,只要把/etc/ntp.conf文件中的 “server pool.ntp.org”改为“server 内部时间服务器IP地址”即可。如不想使用ntp服务,也可使用ntp软件包中带来的ntpdate命令,只要手工执行“ntpdate 时间服务器IP地址”即可。如想每天自动对时,可以把这条命令放在cron中,注意在同一台电脑上ntp服务与ntpdate命令不能同时使用。
2、Windows2000主机
  执行设置时间服务器时的前三步即可
3、WindowsXP主机
  可以按Windows2000主机的方法设置,也可双击任务栏右下角的时钟图标,打开“日期时间属性”对话框,在“Internet时间”卡片上选中“自动与Internet时间服务器同步”,并在服务器上填入内部时间服务器的IP地址即可。
4、Windows98主机
  需要安装第三方软件,自由(free)软件nettime是个不错的软件,它支持SNTP(UDP123)、TIME(TCP37)、TIME- UDP(UDP37)三种方法进行时间同步。软件操作简单,只要在上图的“Hostname or IP Address”中输入局域网内时间服务器的IP地址,“Protocol”中选SNTP即可。
  当然在windows98电脑上执行“net time 机器名或IP地址 /set /yes”也可能与其它windows电脑同步时钟,前提是这些电脑在同一网段,并且安装有netbios协议。把该命令放在autoexec.bat 中,就可以做到开机自动对时了。
7月16日

基于linux的php搭建wiki网站

 

在Web 2.0革命中,维基(Wiki)的起源比博客还要早。博客要由自己一个人编写并维护,每天更新博客会让你思维枯竭,维基技术和支持它的网页却能够让大家群策群力一起交流共同爱好。维基对所有人包括浏览Wiki页面的人都是全面开放的。也就是说,每个人都可以任意创建、修改和删除网站上的页面内容。维基和博客相比更加具有团队精神。

通常我们将Wiki翻译为“维基”。Wiki一词来源于夏威夷语的“wee kee wee kee”,原本是“快点快点”的意思。Wiki是一种在线多人协作的超文本系统写作工具。Wiki站点支持面向社区的协作式写作,每个人都可以发表自己的见解,或者对共同维护的主题进行扩展。Wiki同时也包括一组支持这种写作的辅助工具,可以在Web的基础上对Wiki页面的文本进行创建,更改和发布,比做网页和更新网页简单方便得多。

实现Wiki的方式有两种:一种是到Wiki空间提供网站注册,注册完后就可以开始了。另外一种就是在自己的计算机上架设一个Wiki,其好处是没有储存空间的限制,缺点是整个过程稍微麻烦一点,还必须要有不错的上传带宽,不过造访人数不多时,家用的ADSL也够用了。虽然在自己的计算机上架设Wiki存在缺点,但是自由度相对也比较大,这里,笔者就教你如何在十分钟内在你的计算机上架设好Wiki。

本文将要搭建的LAMP动态Wiki网站是基于Linux的PHP技术的实现方法。LAMP (Linux + Apache + MySQL + PHP) 近几年来发展迅速,已经成为Web 服务器的事实标准。这些组件虽然并不是一开始就设计为一起使用的,但是,这些开源软件都可以很方便地随时获得并免费使用。这就导致了这些组件经常在一起使用。在过去的几年里,这些组件的兼容性不断完善,在一起的应用情形变得非常普便。PHP是一种跨平台的服务器端的嵌入式脚本语言,它大量地借鉴C、Java和Perl语言的语法,并加入了PHP自己的特性,使Web开发者能够快速地写出动态页面。PHP支持所有主流数据库。它是完全免费的,使用时不需要支付任何费用。

另外,如果希望在Unix、BSD、Linux平台使用zlib格式则需要安装动态链接函数库zlib。Zlib官方网站为:http://www.gzip.org/zlib/ ,编译时注意使用如下命令行选项:./configure --with-zlib。

CMS软件的选择

如果从Web 搜索开放源码内容管理,你将发现大量的站点、系统和项目。特别是 Open Source Content Management OSCOM 这个站点,它是专门针对这个主题的。那么什么是内容管理系统呢?来自 X-infoModeL 的定义是笔者见到的最好的定义之一:“在组织、分类和构造信息资源以便以多种方式存储、发布和重用这些信息资源时涉及的过程和工作流。内容管理系统(CMS)用于收集、管理和发布内容,以组件或完整文档的形式存储内容,同时维护组件之间的链接。它还可以提供内容校正控制。”Mambo,中文意思为曼波音乐(源于古巴黑人音乐),是功能最强大的开放源码的内容管理系统之一。在2004年4月20日伦敦举行的Linux用户和开发员大会上,Mambo从众多优秀的开放源码系统中脱颖而出,获得2004年度最佳Linux开放源码系统奖项,和它同场竞技的有KDE、Firebird SQL以及eGroupware等,Mambo的口号是 Power in Simplicity ( 强大源自简易)。Mambo基于php+mysql技术开发,具有易于安装、管理简单、可靠性高等特点。Mambo可在全球范围内构建各种类型的网站,小到简单的个人网站,大到复杂的公司应用网站,Mambo都可轻松搞定。Mambo是一个内容管理系统,用于发布网站。目前已经加入许多模块,提供包括购物车、横幅广告、自定义地图、聊天和论坛等功能。

搭建Wiki网站

1. Mambo CMS软件下载

#cd var/www/html

#wegt http://mamboforge.net/frs/download.php/4211/mambo452-Global.zip

#unzip mambo452-Global.zip “建立一个目录”

2. Mambo建立数据库

# mysql -u root -p

Enter password: xxxxxxxxx

Your Mysql connection id is 3 to server version: 4.11

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

Mysql> create mambo database ; “为建立数据库”

Query OK, 1 row affected (0.01 sec)

Mysql>grant all mambo privileges on mambo.* to mambo@localhost identified by ‘76543981’;?“将建立的Mambo权限给Mambo账号,并且设定密码”

mysql>exit

3. 测试刚建立的数据库与账号是否可以使用

# mysql -u -p

Enter password: xxxxxxxxx

Your Mysql connection id is 3 to server version: 4.11 ……

Mysql> connect mambo;

Connection id: 5

Current database:

mysql>show databases;

+--------------+

| Database |

+--------------+

| mysql |

| mambo |

+--------------+

2 rows in set (0.00 sec)

mysql> quit

4.开始安装Mambo

● 赋予权限

#cd /var/www/html/ #进入到Apache 服务器的确省目录中#

#chmod 777 /var/www/html/mambo

进行网络安装安非常简单,通常需要以下几个步骤:打开Linux的Firefox火狐浏览器在地址栏直接输入:http://主机名/mambo /installation/index.php 后,出现安装前准备工作界面,选择语言选项为绿色后选择同意,然后点击“下一步”按钮,见图1。然后是是否接受软件许可协议,选择同意,点击“下一步”按钮。

图1 安装前的检查

● MySQL数据库设定

需要说明的是:MySQL服务器名称为 localhost ,这个是 MySQL 的服务器名称,不是 Linux服务器名称。通常 MySQL 的服务器名称是:localhost 。MySQL数据库名称为 mambo,MySQL 账号为mambo且密码为上面设定值,数据库表格字首通常是mom_s,见图2。

图2 MySQL数据库设定

● 网站名称设置

这里设置mambo的别名,请根据情况自己设定。

● 其他设定

这里主要设定管理员电子邮件等信息。见图3。

图3 其他设定

以上内容主要包括五个部分:为了读者填写方便笔者把它做成一个列表,如表1所示。 表 参数设置表

● 安全设定

测试成功后系统会提醒出于安全考虑,删除安装文件(防止他人使用这些文件修改系统信息),并且要记录下admin(系统管理员)口令,见图4。

图4 系统信息设定成功

# rm -rf /var/www/html/mambo/iinstallation/

项目管理软件

项目管理(PROGRAM MANAGEMENT)是管理科学领域里发展最快的学科之一,也是一门综合性的应用学科,它的思想、理论、工具和方法在全球投资界、产业界及政府财政预算及支出中得到迅速而日益广泛的应用。项目管理广泛应用于建筑、工程、电子、通讯、计算机、金融、制造、咨询、国防以及政府机关等行业。
在应付全球化的市场变动中,项目管理将起到关键性的作用。它对于项目投资的效绩、降低投资风险、企业竞争力的提高、政府形象的改善及公共事务管理水平的提高,已经发挥和正在发挥着巨大作用。

真正称得上中国项目管理的里程碑工作,是著名科学家华罗庚教授倡导的统筹法。华罗庚教授于1964年倡导并开始应用推广的“统筹法”(Overall Planning Method),1965年华罗庚著的《统筹方法平话及其补充》由中国工业出版社出版,该书的核心是提出了一套较系统的、适合我国国情的项目管理方法,包括调查研究,绘制箭头图,找主要关键路线,以及在设定目标条件下优化资源配置等。1964年华罗庚带领中国科技大学部分老师和学生到西南三线建设工地推广应用统筹法,在修铁路、架桥梁、挖隧道等工程项目管理上取得了成功。

什么是项目

“项目是一项为了创造某一唯一的产品或服务的时限性工作。” 其特征有:
(1)时限性。时限性指每个项目都有明确的开端和结束。当项目的目标都已经达到时,该项目就结束了;项目的目标不可能达到时,该项目就会被中止了。机遇或市场行情通常是暂时的--大多数项目都需要在限定的时间框架内创造产品或服务。由项目所创造的产品或服务通常是不受项目的时限性影响的,大多数项目的实施是为了创造一个具有延续性的成果。
(2)唯一性。项目所涉及的某些内容是以前没有被做过的,也就是说这些内容是唯一的。具有重复的要素并不能够改变其整体根本的唯一性,例如:
一个新开发商业航线的项目可能需要提供大量的模型。
一个推广新药的项目可能需要大量药剂用于临床试验。
一个房地产开发项目包括成百上千的独立单元。   我们修建了成千上万的写字楼,但是每一座独立的建筑都是唯一的:它们分属于不同的业主,作了不同的设计,处于不同的位置,由不同的承包商承建等等。
(3)临时性。很多工作团队不是作为“一以贯之”的组织而存在,而是一种以项目为中心的团队。这样的团队因具体的生产项目而建立,一旦项目完成,这个团体就会被解散,成员也会再被分配到其它的工作当中去。

有人把这种管理方式称为“电影摄制组模式”:一个电影制片人为了生产一部电影,把在他看来最适合这部影片、但属于不同的制片公司的各类专业人员(从导演、主演到化妆师)召集在一起,组成一个“能人班子”。影片摄制完成,这个“能人班子”即告解体。

什么是项目管理

所谓项目管理,实际上是在寻找调和创新的不确定性与资源的确定性(局限性)之间,创造性劳动方式与流水线式作业方式之间的冲突的解决之道。用通俗的说法,项目管理是典型的“带着铁链跳舞”的行为。正是项目管理自身包含的悖论性,使得项目管理常常表现为“艰难的艺术”和“遗憾的艺术”,由于项目管理不善而造成的失败项目比比皆是

项目管理最根本的目的是“如何有效地利用时间、技术和人力”,用专业术语表述,项目管理就是在确保时间、经费和性能指标的限制条件下,尽可能高效率地完成项目任务,达成项目目标,从运作中改善管理人员的效率,让所有项目相关者满意。

项目管理的核心理论和概念

项目管理最重要的理论是PERT( 计划评审技术Program Evaluation and Review Technique)。它是网络技术中另一种应用最广的技术,同关键路线法同时独立地公开发表。PERT技术的成功,是由于该技术系统的基本逻辑很成功,很容易为经理们理解,而又不需要他们去掌握系统的细节。运用该技术可以有效地缩短项目的周期,节省大量投资。 许多事例证明,对于合适的工程,网络技术是非常有效的一种特殊计划方法。网络技术是以网络图为基本工具的一种科学的计划方法,是运筹学的一个重要分支。

在项目管理软件中,甘特图(Gant Chart)则是这些核心理论的表现,如Microsoft Project,其项目周期、人员管理、资源管理、关键路线等都可以通过甘特图这个简单、直观的视图来表达。

(甘特图案例1-紧张进度,点击看大图)

(甘特图案例2-松弛进度,点击看大图)

项目管理软件

工欲善其事,必先利其器!在这里介绍一些开源或免费的项目管理软件,希望对大家的xoops项目以及其他任何类型的项目管理有所帮助。

在项目管理软件上,有了两个不同的风格:一个是大而全,诸如Microsoft Project, Primavera Project Planner (P3),Open Plan, Prolog, PM2, CA AllFusion等等,这些项目管理软件,往往涵盖了项目管理的所有方方面面,细致入微,严格正统,你能想到和你想不到的,都全部囊括。另外一种风格就 是小而强,面向特定应用范围,例如行业的项目管理软件,通用的项目管理软件,小巧的项目管理软件等等,这些以国 内的中小型公司为服务对象,设计的往往更贴近应用,甚至根据企业不同,量身打造,例如雪地、华炎、正信等等的中小型软件系统;

在此之外,还有一股强大 的力量――OpenSource的项目管理软件,其中,考虑应用、汉化、社区支持等等,以dotProject为最,不过目前又有很多新兴的软件出现,请看下文介绍。

 

dotProject官方网站:http://www.dotproject.net/

dotProject 中文开发与推广:

http://rt.openfoundry.org/Foundry/Project/?Queue=238

http://blog.markplace.net/marks_development_blog

《项目管理软件dotProject使用手册》

http://www.cnblogs.com/GeneralXU/articles/882263.html

dotProject是一个在1996年左右,由开源组织自发组织人员开发的一个开源的项目管理软件系统,基于Web,可以部署于局域网"广域网的 办公环境中,客户端不需要安装任何软件,只要有IE,Firefox,Opera等浏览器即可,强大,小巧.被翻译为了大约40多中语言,应用于100多 个国家,可见它的简单易用的程度.
dotProject具有以下的特色:
1. 可运作于多种的作业平台:dotProject 这套软件所使用的开发工具,皆是兼容性很高的工具,MySQL很容易连结多种语言,也可以在很多种作业系统下运作良好,可以在多种平台上面运行。
2. Web Server Base:由于是以JavaScript、PHP 的工具所开发出來的工具,所以可以支持项目成员在不同的地点,都可以更新、掌握项目进度,适合用于群体使用,很符合项目管理的需求。
3. 可制作出多种不同的报表及图表,将项目中繁多的资料作适当的处理。
4. 本软件属于开放原始码(open source code)的软件,提供免费使用。
5. 本软件的功能界面,可以透过不同的步骤操作相同的功能;并且软件设计者,将相关的功能配置在同一个操作画面,让使用者可以不必另外绕道选择功能
安装dotproject的基本环境:只要能够跑AMP的OS,都可以(AMP指Apache,Mysql,PHP)

 

ProjectPier:开源的项目管理软件

ProjectPier 开放源代码的PHP项目管理应用,可帮助你进行团队之间的连接,通过Web界面组织贷款项目和任务等。 它的代码是基于Activecollab ,这是一个热门的免费项目管理中的应用。

ProjectPier: 免费的项目管理软件

ProjectPier: 免费的项目管理软件

Projectpier有一个活跃的社区,其中有关于该软件的翻译、主题等内容。projectpier的一些特点包括 :

  • 多客户的能力,让您管理项目。
  • 3级权限管理。
  • 可以限制客户端用户的项目操作权利
  • 短信和工作清单
  • 可以管理修改上传文件。
  • 标签,可用于分类的讯息,任务,目标及档案
  • 按项目涵盖信息,任务,目标及档案进行全文检索
  • 隐私:短讯,任务信息等可以进行隐么设置

 

用于项目管理的Excel图表模板

这是来自Woork制作的一个Excel图表模板,可用来做一些项目的管理,比如资产负债表之类的,虽然类似的在线项目管理很多,但有时一些人更愿意把项目放在自己的电脑里面更加安全放心。

用于项目管理的Excel图表模板
Download Excel Template

 

Collabtive:免费开源的PHP项目管理软件

Collabtive是一项免费的PHP项目管理软件,其界面设计的非常Web 2.0,且使用了大量的Ajax效果。

Collabtive:免费开源的PHP项目管理软件
该软件还处于测试阶段,但它已经具备一些项目管理软件的优势:

  • Projects, Milestones, Taskslists, Tasks
  • 用户管理
  • 留言系统
  • 集成即时通讯应用
  • 多语言支持
  • 模板系统支持

其它具体应用,你可以到网站里面进行DEMO测试。

 

ProjectOffice:在线项目管理/协作网站

ProjectOffice.net 是一个在线项目管理/协作网站。你可以在创建你的项目,且设置哪些人可以参与进入这个项目里来。

ProjectOffice:在线项目管理/协作网站

什么时候会需要到这样的在线服务呢?比如你要准备一个学习计划,或是工作进程等等,那你可以创造这样一个项目管理,更好的和规划自己的预期事件发 展,并可找邀请更多的人加入你的项目,使其更加完善。而如果正好你要进行的项目是团队性质的,那这样的服务就可以降低原始的等级效果,减少电子邮件交换的 麻烦操作。

ProjectOffice:在线项目管理/协作网站

ProjectOffiece是完全免费的,或许这能成为你一试的理由。

 

Redmine:基于Ruby和Rails框架的项目管理软件

Redmine是一个基于Ruby和Rails框架的项目管理软件,它是跨平台和跨浏览器的。

其使用界面很简单朴素,同时也就使用起来也就更加方便, Redmine具备了一个项目和管软件必须具备的大多数功能,基于入口的访问控制,Wiki和档案管理。

Redmine:基于Ruby和Rails框架的项目管理软件

其主要功能包括:

  • 多个项目支持灵活的
  • 基于入口的访问控制
  • 灵活的问题跟踪系统
  • 图表和日历
  • 新闻文件与档案管理
  • Feed及电子邮件通知
  • Per project wiki
  • Per project forums
  • 简单的时间跟踪功能
  • 定制项目和用户领域的问题
  • 供应链管理一体化( svn ,cvs等 )
  • 多重LDAP验证
  • 支持用户自注册
  • 支持多国语言
  • 支持多个数据库的支持

Redmine目前正处于测试阶段。

DotProject开源项目管理(http://blog.csdn.net/yuandj)

其实很多工作都需要以项目管理的角度来进行.从团队的角度,也需要对成员按照项目管理进行控制.
用的最多的项目管理软件是MS Project,用的还是很不错的,但唯一烦恼的是,当我把做完的甘特图给同事的时候,一般都不会去安装MS project,因为这东西实在太大.
更致命的是,作完的计划通常这是一个时间点上,而无法进行团队服务器的方式,困难.
因此,开源的项目管理系统DotPorject(http://www.dotproject.net)是一个很好的选择!
看看台湾markwu 的经验.
http://blog.markplace.net/index.php?op=ViewArticle&articleId=197&blogId=1
官方站点提供了DEMO:
http://www.dotproject.net/demo/
管理员:admin/admin
普通用户:guest/guest 
 

用过),发现真爽。 下面是安装步骤:

1)下载AppServ2.4.2

http://prdownloads.sourceforge.net/appserv/appserv-win32-2.4.2.exe?download

§
AppServ是套开源组合,包括:Apache Http Server,Mysql,PHP
2)安装AppServ2.4.2.exe,很快的,默认选项就可以了。安装完以后要勾选项,把 Apache和Mysql启动。安装到 d:/AppServ目录。
3)下载 dotproject1.0.2或者2.0.1(是个zip包)
4)解压zip包,到 D:\AppServ\www\dotproject目录(这个就是apache的一个 web项目了)
5)访问  http://localhost/phpmyadmin/,可以看到“新建库”的地方,输入库名称dotproject,
字符编码gb2312,submit ;在新出现的页面,选择“SQL”,然后从 D:\AppServ\www\dotproject\db\目录中,选择dotproject_102.sql ,执行,这样数据库就有数据了。
6)修改配置文件,dotproject/include/下面有个默认的config-dist.php,我们在这个文件基础上改,先cp config-dist.php config.php,然后编辑这个config.php文件,主要修改下面:
数据库配置
$dPconfig['dbtype'] = "mysql";      // ONLY MySQL is supported at present
$dPconfig['dbhost'] = "localhost"; //数据库服务器名称,一般不用修改
$dPconfig['dbname'] = "dotproject";  // 刚才创建的数据库名称
$dPconfig['dbuser'] = "hongsoft";  // 数据库用户名称
$dPconfig['dbpass'] = "hongsoft";  // 上面那个用户的密码
$dPconfig['dbport'] = "";  // 修改为你的mysql的端口,如果你自己没改过的话这里不用动了

站点配置
$dPconfig['root_dir'] = "D:/AppServ/www/dotproject";  //dotproject的绝对路径
$dPconfig['base_url'] = "http://blog.csdn.net/hongbo781202/"; //dotproject的url路径
7)访问 http://localhost/dotproject
用户admin  密码 passwd
需要注意的地方:
1)如果提示Login failed,并不是 密码不正确,而是config.php里面有错。
2)如果是 2.0.1,config.php与这里的不同,但基本配置是一样的,只是要配置的内容少了。
3)网上其他地方给的中文版,均不成功。
4)dotproject官方网站给的 中文 pack,也不成功
**********************************************************************************************************
*******************************dotProject2.0.1安装方法******************************
一个很不错的php开源项目管理工具,有了它,不用project了,也不用自己开发项目管理工具了,足够应付中小型软件企业的日常项目管理工
作。版本:dotProject_2_0_1_20050705_UTF-8_Chinese_by_Markwu (请google下载之)
0.安装前提:已安装好easyphp,测试证明apache/mysql/php已经是可用的。
1.解压dotProject_2_0_1_20050705_UTF-8_Chinese_by_Markwu到www目录下,改目录名为dotproject。注意要用这个utf-8版本,从dotproject
下载的版本中文会乱码。
2.执行安装:
http://yourserverip/dotproject/install/index.php,则可以完成安装过程,包括数据库的建立。
3.到dotproject/index.php登陆,admin-passwd.
4.到system admin->default user confonrce,设置默认语言为简体中文。
5.打开gd支持以显示甘特图:在easyPHP面板,配置->php扩展,把php-gd2选上,再重启apache,则即可显示甘特图。
6.重新登陆dotproject,完成整个安装过程
*****************************1小时构建稳定高速的PHP+MYSQL服务器-EasyPHP*********************
http://www.blogdriver.com/zeroliu/1145187.html
作者:华夏blog 文章来源:ghostfire.77169.com
目前Apache的市场占有率已经远远超过IIS等服务器软件 它的高速稳定,免费开放也是其他同类软件无法比拟的, 加上它的完美搭档MYSQL,不让
它红也难.  但你要是以为本文要写Apache的安装之类的那就错了 因为有个软件可以让Apache+MYSQL麻烦的安装设置,变的相当轻松. 今天的主
角是EasyPHP 虽然现在市面上同类的整合软件包很多,但大多是简单的捆绑了Apache+MYSQL的Pack,而不像EasyPHP是个彻彻底底的Program.
通过简单的整合后的Apache和MySQL明显苗条了许多,运行速度相对单独安装的Apache和MySQL快了7%~15%,而且EasyPHP可以方便的开始/停止
,设置httpd.conf,my.ini,PHP Extensions;扩展Apache功能如添加ASP支持等等;虽然是整合的软件但EasyPHP的功能和单独安装的
Apache+Mysql并不逊色……
更重要的是EasyPHP是免费的.
-------------------------------软件功能--------------------------------------------------
1.整合安装Apache 1.3.27 - php 4.3.3 - MySQL 4.0.15 - phpmyadmin 2.5.3.
2.网页即时添加Alias文件夹(可以是你计算机上任何文件夹,甚至是网上的资源)
3.快速设置httpd.conf,my.ini,PHP Extensions
------------------------------安装,设置攻略--------------------------------------------------
1.在http://www.easyphp.org下载EasyPHP1.7.0版
软件大小:10.8M
软件类型:GPN免费软件但版权保护
应用平台:Win9x/NT/2000/XP/2003
2.在http://www.oyido.com.ru/bak/easyhh.rar下载我做的汉化包
软件大小:65.3K
3.运行下载到的EasyPHP安装文件easyphp1-7_setup.exe,有些界面是法语的
因为这个软件是三个法国人写的.
点是,
然后Next这个界面是法文的大意是备份原来的MYSQL设置文件my.ini,并用新的设置文件代替.
Next,这个是GPL(自由软件条款),选中I accept the agreement,
Next,显示的是EasyPHP的软件功能,
Next,选择安装路径,例如D:servEasyPHP,那么你的网页根目录在D:servEasyPHPwww,当然这个文件夹可以通过Apache的httpd.conf修改为其他路
径.
Next,开始菜单名称,
Next,确认信息,
Install,等待安装完成.
这个是PHP.ini的全局函数设置说明,
注意:EasyPHP的php.ini是在Apache的根目录下而非Widows文件夹中!!
Next,是否察看说明文件(法文的),
Finish.
4.将我做的汉化包easyhh.rar中的文件解压到EasyPHP的主目录
替代原文件既可。
注意:安装汉化包必须在关闭EasyPHP的情况下进行.
5.运行EasyPHP.exe
6.右击系统托盘中的那个黑色的E,设置,Apache,
查找ServerName将localhost修改为你的域名.
(这时的MYSQL的Root用户密码是空的通过下面方法修改密码)
7.在http://127.0.0.1/mysql/index.php中点右边的Privileges在User overview 下面点root旁的Edit
在 Change password选择 Password:输入密码 Re-type:确认密码点Go
(由于EasyPHP默认的设置无法使用Discuz2.X/3.X/4.x请按下列步骤修改Php.ini)
8.在EasyPHP的目录下找到Apache文件夹找到php.ini,用记事本编辑它,查找magic_quotes_gpc设置为On,如果需要安装Zend加速器,然后将下列
代码复制到
;/PHPExt下面
Code:
[Zend]
zend_optimizer.optimization_level=15
zend_extension_ts="Zend的安装路径libZendExtensionManager.dll"
zend_extension_manager.optimizer_ts="Zend的安装路径libOptimizer-2.5.5"
[Ctrl+A Select All]
9.在IE中输入http://127.0.0.1/home/点击ajouter添加别名(也可以直接输入http://127.0.0.1/home/index.php?to=add_alias_1)
saisir un nom pour l’alias (ex.: site1)
在此输入别名如:music
saisir le chemin du répertoire créé (ex.: C:weblocalsitessite1)
别名指向地址,如:D:music
paramètres par défaut du répertoire
设置浏览权限
Options Indexes FollowSymLinks Includes
AllowOverride All
Order allow
Allow from all
OK
不用重启服务器
在浏览器中输入Http://你的地址/music就可以看到你的D盘里的Music文件夹中的内容.
10.在IE中输入http://127.0.0.1/home/phpinfo.php参看PHP属性
7月9日

谈论 忘记mysql密码

 

引用

忘记mysql密码
 

如果忘记了 MySQL 的 root 密码,可以用以下方法重新设置:

    1. KILL掉系统里的MySQL进程;

    2. 用以下命令启动MySQL,以不检查权限的方式启动;

    mysqld_safe -skip-grant-tables &

    3. 然后用空密码方式使用root用户登录 MySQL;

    mysql -u root

    4. 修改root用户的密码

    mysql> update mysql.user set password=PASSWORD('新密码') where User='root';mysql> flush privileges;mysql> quit

    5. 重新启动MySQL,就可以使用新密码登录了。

Windows:
1.用系统管理员登陆系统。
2.停止MySQL的服务。
3.进入命令窗口,然后进入MySQL的安装目录,比如我的安装目录是c:mysql,进入C:mysqlbin
4.跳过权限检查启动MySQL,
c:mysqlbin>mysqld-nt --skip-grant-tables
5.重新打开一个窗口,进入c:mysqlbin目录,设置root的新密码
c:mysqlbin>mysqladmin -u root flush-privileges password "newpassword"
c:mysqlbin>mysqladmin -u root -p shutdown
将newpassword替换为你要用的root的密码,第二个命令会提示你输入新密码,重复第一个命令输入的密码。
6.停止MySQL Server,用正常模式启动Mysql
7.你可以用新的密码链接到Mysql了。

忘记mysql密码

 

如果忘记了 MySQL 的 root 密码,可以用以下方法重新设置:

    1. KILL掉系统里的MySQL进程;

    2. 用以下命令启动MySQL,以不检查权限的方式启动;

    mysqld_safe -skip-grant-tables &

    3. 然后用空密码方式使用root用户登录 MySQL;

    mysql -u root

    4. 修改root用户的密码

    mysql> update mysql.user set password=PASSWORD('新密码') where User='root';mysql> flush privileges;mysql> quit

    5. 重新启动MySQL,就可以使用新密码登录了。

7月7日

wiki做项目管理的好处

直希望写篇知识管理方面的文章,苦于自己的懒一直没有成型。今天乘着刚配好wiki服务器写写自己的感想。

用wiki进行项目管理好处显而易见的:

1 知识共享:可以发布需求分析,用例,构架,设计方面的文档,也可以是大家一时的灵感,通过wiki可以保留项目组曾经的想法,理念,即使换了新组员,知识也被保留下来了。

2 文档管理:首先是文档控制,经过成员的多次讨论,leader可以形成完善的,标准的文档版本。其次,即使组员不在实验室也可以访问到项目组文档,参与到讨论当中。

3 便于文档查找:通过tag和rss,web2.0的思想贯穿始终。组员可以通过tag来查找同一技术方面的文章,也可以通过rss来定制自己想看的板块。

4 每天写wiki也可以增增强个人随时整理表达自己思想的能力。

5 每个项目组成员每天的submit就通过confluence提交,大大提高了效率。

构件库项目组使用confluence作为知识共享平台,很好的实现了项目组的交流,不过一开始肯定需要一个过程,这需要大家的配合以及制度的保障。

7月3日

svn脚本备份二

SVN的备份
2007-10-08 11:24

版本控制最关键的一件事是保证数据的安全性,不能因为磁盘损坏,程序故障造成版本库无可挽回的错误,为此必须制定较完备的备份策略。
在Subversion中,我们有三种备份方式:完全备份,增量备份和同步版本库。

1. 完全备份:

最常见和简单的备份就是直接使用拷贝命令,将版本库目录拷贝到备份目录上,就可以了。但是这样不是很安全的方式,因为如果在拷贝时版本库发生变化,将会造成备份的结果不够准确,失去备份的作用,为此Subversion提供了“svnadmin hotcopy”命令,可以防止这种问题。
比如有如下版本库:

D:\svnroot
├─project1
│     ├─conf
│     ├─dav
│     ├─db
│     │     ├─revprops
│     │     ├─revs
│     │     └─transactions
│     ├─hooks
│     └─locks
└─project2
       ├─conf
       ├─dav
       ├─db
       │     ├─revprops
       │     ├─revs
       │     └─transactions
       ├─hooks
└─locks

如果要把project1备份到D:\svnrootbackup目录下,只需要运行:svnadmin hotcopy d:\svnroot\project1 d:\ svnrootbackup \project1

PS:如果我们目录下有很多版本库,需要为每个版本库写这样一条语句备份,必须想办法优化这个过程。为此,建立以下的2个bat文件,
simplebackup.bat
@echo 正在备份版本库%1......
@%SVN_HOME%\bin\svnadmin hotcopy %1 %BACKUP_DIRECTORY%\%2
@echo 版本库%1成功备份到了%2!

backup.bat
echo off
rem Subversion的安装目录
set SVN_HOME="D:\Subversion"
rem 所有版本库的父目录
set SVN_ROOT=D:\svnroot
rem 备份的目录
set BACKUP_SVN_ROOT=D:\svnrootbak
set BACKUP_DIRECTORY=%BACKUP_SVN_ROOT%\%date:~0,10%
if exist %BACKUP_DIRECTORY% goto checkBack
echo 建立备份目录%BACKUP_DIRECTORY%>>%SVN_ROOT%/backup.log
mkdir %BACKUP_DIRECTORY%
rem 验证目录是否为版本库,如果是则取出名称备份
for /r %SVN_ROOT% %%I in (.) do @if exist "%%I\conf\svnserve.conf" %SVN_ROOT%\simplebackup.bat "%%~fI" %%~nI
goto end
:checkBack
echo 备份目录%BACKUP_DIRECTORY%已经存在,请清空。
goto end
:end

使用的时候,只需要修改backup.bat开头的三个路径,将两个脚本拷贝到"SVN_ROOT"下就可以了。根据以上的配置,你只需要运行backup.bat,就可以把"SVN_ROOT"下的版本库都备份到"BACKUP_SVN_ROOT"里,并且存放在备份所在的目录里。

2. 增量备份:
尽管完全备份非常简单,但是也是有代价的,当版本库非常巨大时,经常进行完全备份是不现实的,也并不必要,但是一旦版本库在备份之间发生问题,该如何呢,这里我们就用到了增量备份。
增量备份通常要与完全备份结合使用,记录着每次Subversion提交的变化,然后在需要恢复时能够回到最新的可用状态。
我们使用的是,svnadmin dump命令进行增量的备份,使用方法是:
svnadmin dump d:\sourcecode\project1 --revision 15 --incremental > d:\sourcecode\dumpfile

上面的命令实现了对修订版本15进行增量的备份,其中的输出文件dumpfile只保存了修订版本15更改的内容

恢复增量备份时,使用方法是:
svnadmin load d:\sourcecode\project1 < d:\sourcecode\dumpfile
上面的命令实现了对增量备份文件恢复到版本库project1中

使用钩子脚本Hooks实现自动增量备份:
1) 建立deltabackup.bat文件,内容为:
@echo 正在备份版本库%2......
%SVN_HOME%\bin\svnadmin dump %SVN_ROOT%\%1 --incremental --revision %2 >> %DELTA_BACKUP_SVN_ROOT%\%1.dump
@echo 版本库%2成功备份到了%3!

2) 建立post-commit.bat文件,内容为:
echo off
set SVN_HOME="C:\Program Files\Subversion"
set SVN_ROOT=D:\svnroot
set UNIX_SVN_ROOT=D:/svnroot
set DELTA_BACKUP_SVN_ROOT=D:\svnrootbak\delta
set LOG_FILE=%1\backup.log
echo backup revision %2 >> %LOG_FILE%
for /r %SVN_ROOT% %%I in (.) do if D:/svnroot/%%~nI == %1 %SVN_ROOT%\%%~nI\hooks\deltaBackup.bat %%~nI %2
goto end
:end

3) 把以上两个脚本可以直接拷贝到版本库的hooks目录下,就可以实现版本库的自动备份。

3. 同步版本库:
同步机制,可以实现一个版本库同另一个版本库的同步(但好像只是单向的),我们可以用来实现版本库的备份或镜像。
例如:同步版本库d:\sourcecode\project1
1) 新建一个空的版本库project2
运行命令:
svnadmin create d:\sourcecode\project2

2) 为新的版本库创建pre-revprop-change钩子脚本(hook script)
在d:\sourcecode\project2\hooks目录下新建一个空的pre-revprop-change.bat文件

3) 初始化版本库
运行命令:
svnsync init
file:///d:/sourcecode/project2 file:///d:/sourcecode/project1

4) 同步版本库
运行命令:
svnsync sync
file:///d:/sourcecode/project2
  
5) 至此,版本库同步已经完成。
在使用新的版本库之前,还需要根据需要对版本库的访问权限等进行配置。

使用钩子脚本Hooks实现自动同步:
1) 建立post-commit.bat文件,内容为:
echo off
set SVN_HOME="D:\Subversion"
%SVN_HOME%\bin\svnsync sync     --non-interactive svn://localhost/project2

2) 把post-commit.bat文件放到版本库project1下的hooks目录下,这样project1每次提交,都会引起project2的同步

svn脚本备份

Windows下的SVN备份,我在这跟大家分享一下完全备份和增量备份。
1、完全备份脚本:

文件名backup.bat:

echo off
rem Subversion的安装目录
set SVN_HOME="C:\Program Files\VisualSVN Server"
rem 所有版本库的父目录
set SVN_ROOT=d:\svn //库目录
rem 备份的目录
set BACKUP_SVN_ROOT=目的地(如:\\192.168.0.1\svnbak)
set BACKUP_DIRECTORY=%BACKUP_SVN_ROOT%\%date:~0,10%
if exist %BACKUP_DIRECTORY% goto checkBack
echo 建立备份目录%BACKUP_DIRECTORY%>>%SVN_ROOT%/backup.log
md %BACKUP_DIRECTORY%
rem 验证目录是否为版本库,如果是则取出名称备份
for /r %SVN_ROOT% %%I in (.) do @if exist "%%I\conf\svnserve.conf" %SVN_ROOT%\simpleBackup.bat "%%~fI" %%~nI
goto end
:checkBack
echo 备份目录%BACKUP_DIRECTORY%已经存在,请清空。
goto end
:end

另一个文件:simpleBackup.bat

@echo 正在备份版本库%1......
@%SVN_HOME%\bin\svnadmin hotcopy %1 %BACKUP_DIRECTORY%\%2
@echo 版本库%1成功备份到了%2!

以上是完全备份的脚本,只要把simpleBackup.bat 拷到库目录底下即可使用。

2、增量备份脚本:
文件名命名为:post-commit.bat,放到hooks下即可,
echo off
set SVN_HOME="C:\Program Files\VisualSVN Server"
set SVN_ROOT=d:\svn
set DELTA_BACKUP_SVN_ROOT=d:\delta  //备份存放目录,一定要存在
set LOG_FILE=%1\backup.log
echo backup revision %2 >> %LOG_FILE%
for /r %SVN_ROOT% %%I in (.) do %SVN_ROOT%\库名\hooks\deltaBackup.bat  库名 %2
goto end
:end

deltaBackup.bat
@echo 正在备份版本库%1......
%SVN_HOME%\bin\svnadmin dump %SVN_ROOT%\%1 --incremental --revision %2 >> %DELTA_BACKUP_SVN_ROOT%\%1.dmp
@echo 版本库%1成功备份到了%2!

将以上两个文件:post-commit.bat和deltaBackup.bat放到hooks下就可以直接使用。
:红色字要根据实际情况来更改。
6月26日

bugzilla安装过程出现数据库错误

在安装Bugzilla的过程中,安装好了必须的perl module后 用checksetup.pl检查了一直pending在connect mysql的连接中。Google Serach后发现这个的错误发生情况还不少,但是没有一个适合我用的解决方案。所以经过摸索,写下帮助,或许能减少后来人,走一些弯路:

环境:

OS: CentOS 5.1

Bugzilla: 3.1.3

MySQL: 5.0.22

Perl: 5.8.8

 

前面的安装步骤如下:

Step 1: Mysql#groupadd mysql
#useradd mysql
# yum install mysql
# yum install mysql-devel
# yum install mysql-server
#mysql_install_db
#chown -R root:mysql /usr/local/mysql
#chown -R mysql:mysql /usr/local/mysql/var
#chgrp -R mysql /usr/local/mysql
#cp support-files/my-medium.cnf /etc/my.cnf
启动服务方法
#mysqld_safe --user=mysql &
停止服务
#mysqladmin shutdown

为mysql添加用户bugs

mysql> GRANT SELECT,INSERT,UPDATE,DELETE,INDEX, ALTER,CREATE,DROP,REFERENCES ON bugs.* TO bugs@localhost IDENTIFIED BY 'bugs_password';

mysql> FLUSH PRIVILEGES;

mysql> create database bugs DEFAULT CHARACTER SET utf8;

 

Step 2: Apache

# yum install httpd

修改apache配置/etc/httpd/conf/httpd.conf添加如下内容:

Alias /bugzilla/ "/var/www/bugzilla/"

<Directory "/var/www/bugzilla">
      AddHandler cgi-script .cgi
      Options +Indexes +ExecCGI
      DirectoryIndex index.cgi
      AllowOverride Limit
      Order allow,deny
      Allow from all
</Directory>

 

Step 3:bugzilla

解压bugzilla的tar包到/var/www/buzilla下

利用bugzilla的脚本#/usr/bin/perl install-module.pl --all 可以自动下载所需的perl module。

修改localconfig
server's host: "localhost"
database name: "bugs"
MySQL username: "bugs"
Password for the "bugs" MySQL account above

[root@localhost bugzilla-3.1.3]# ./checksetup.pl
* This is Bugzilla 3.1.3 on perl 5.8.8
* Running on Linux 2.6.18-53.el5 #1 SMP Mon Nov 12 02:22:48 EST 2007

Checking perl modules...
Checking for                 CGI (v2.93)   ok: found v3.15
Checking for            TimeDate (v2.21)   ok: found v2.22
Checking for           PathTools (v0.84)   ok: found v3.12
Checking for                 DBI (v1.41)   ok: found v1.604
Checking for    Template-Toolkit (v2.15)   ok: found v2.19
Checking for          Email-Send (v2.00)   ok: found v2.192
Checking for Email-MIME-Modifier (any)     ok: found v1.442

Checking available perl DBD modules...
Checking for              DBD-Pg (v1.45)    not found
Checking for           DBD-mysql (v4.00)   ok: found v4.006
Checking for          DBD-Oracle (v1.19)    not found

The following Perl modules are optional:
Checking for                  GD (v1.20)    not found
Checking for               Chart (v1.0)     not found
Checking for         Template-GD (any)      not found
Checking for          GDTextUtil (any)      not found
Checking for             GDGraph (any)      not found
Checking for            XML-Twig (any)      not found
Checking for          MIME-tools (v5.406)  ok: found v5.426
Checking for         libwww-perl (any)     ok: found v2.033
Checking for         PatchReader (v0.9.4)  ok: found v0.9.5
Checking for          PerlMagick (any)      not found
Checking for           perl-ldap (any)     ok: found v0.34
Checking for          RadiusPerl (any)     ok: found v0.13
Checking for           SOAP-Lite (any)     ok: found v0.71
Checking for         HTML-Parser (v3.40)   ok: found v3.55
Checking for       HTML-Scrubber (any)     ok: found v0.08
Checking for Email-MIME-Attachment-Stripper (any)     ok: found v1.314
Checking for         Email-Reply (any)     ok: found v1.202
Checking for            mod_perl (v1.999022)  not found
Checking for                 CGI (v3.11)   ok: found v3.15

* NOTE: You must run any commands listed below as root.

**********************************************************************
* OPTIONAL MODULES                                                   *
**********************************************************************
* Certain Perl modules are not required by Bugzilla, but by          *
* installing the latest version you gain access to additional        *
* features.                                                          *
*                                                                    *
* The optional modules you do not have installed are listed below,   *
* with the name of the feature they enable. If you want to install   *
* one of these modules, just run the appropriate command in the      *
* "COMMANDS TO INSTALL" section.                                     *
**********************************************************************

***********************************************************************
* MODULE NAME * ENABLES FEATURE(S)                                    *
***********************************************************************
*          GD * Graphical Reports, New Charts, Old Charts             *
*       Chart * New Charts, Old Charts                                *
* Template-GD * Graphical Reports                                     *
*  GDTextUtil * Graphical Reports                                     *
*     GDGraph * Graphical Reports                                     *
*    XML-Twig * Move Bugs Between Installations                       *
*  PerlMagick * Optionally Convert BMP Attachments to PNGs            *
*    mod_perl * mod_perl                                              *
***********************************************************************
COMMANDS TO INSTALL:

             GD: /usr/bin/perl install-module.pl GD
          Chart: /usr/bin/perl install-module.pl Chart::Base
    Template-GD: /usr/bin/perl install-module.pl Template::Plugin::GD::Image
     GDTextUtil: /usr/bin/perl install-module.pl GD::Text
        GDGraph: /usr/bin/perl install-module.pl GD::Graph
       XML-Twig: /usr/bin/perl install-module.pl XML::Twig
     PerlMagick: /usr/bin/perl install-module.pl Image::Magick
       mod_perl: /usr/bin/perl install-module.pl mod_perl2

To attempt an automatic install of every required and optional module
with one command, do:

  /usr/bin/perl install-module.pl --all

Reading ./localconfig...

OPTIONAL NOTE: If you want to be able to use the 'difference between two
patches' feature of Bugzilla (which requires the PatchReader Perl module
as well), you should install patchutils from:

    http://cyberelk.net/tim/patchutils/

Checking for           DBD-mysql (v4.00)   ok: found v4.006
Had to create DBD::mysql::dr::imp_data_size unexpectedly at lib/i386-linux-thread-multi/DBI.pm line 1211, <DATA> line 228.
Use of uninitialized value in subroutine entry at lib/i386-linux-thread-multi/DBI.pm line 1211, <DATA> line 228.
Had to create DBD::mysql::db::imp_data_size unexpectedly at lib/i386-linux-thread-multi/DBI.pm line 1241, <DATA> line 228.
Use of uninitialized value in subroutine entry at lib/i386-linux-thread-multi/DBI.pm line 1241, <DATA> line 228.
There was an error connecting to MySQL:

    Undefined subroutine &DBD::mysql::db::_login called at lib/i386-linux-thread-multi/DBD/mysql.pm line 142, <DATA> line 228.

This might have several reasons:

* MySQL is not running.
* MySQL is running, but there is a problem either in the
  server configuration or the database access rights. Read the Bugzilla
  Guide in the doc directory. The section about database configuration
  should help.
* Your password for the 'bugs' user, specified in $db_pass, is
  incorrect, in './localconfig'.
* There is a subtle problem with Perl, DBI, or MySQL. Make
  sure all settings in './localconfig' are correct. If all else fails, set
  '$db_check' to 0.

这个错误是由于DBD::mysql在编译过程中出错导致的,需要重新编译DBD::mysql,另外需要用最新编译生成的mysql.so替换bugzilla目录下的同名文件,再次运行./checksetup.pl就可以看到让你配置管理员账号的部分了。

 

#cp /DBD-mysql-4.006/blib/arch/auto/DBD/mysql/mysql.so /bugzilla-3.1.3/lib/i386-linux-thread-multi/auto/DBD/mysql/mysql.so

6月12日

英语

月球探测器发射 Lunar orbiter set to blast off

探月计划 the moon exploration project

探月计划三阶段

绕月Circling the moon

登月Landing on the moon

返回地球 Return to Earth

“不安全食品召回制度”相应的英文表达为“recall system for unsafe products”,或者,也可写作“Product Recall”。

产品质量不合格,厂家若要收回进行再处理,可用单词“recall”,其相应的英文释义是:“A request by the manufacturer of a product that has been identified as defective to return it”(制造商收回问题产品)。看例句:The car was recalled for possible safety defects.(汽车因可能存在的安全缺陷被召。)

另外,recall除了常用义“回忆、回想”,也可用来形容“取消(命令)”、“召回(大使)”,如:recall a decision(撤销裁定);recall sb. from abroad(把某人从国外召回)。

此外,郑的“玩忽职守”可表达为“dereliction of duty”。

 

抽签为“lottery”;先到先得为 “first-come-first-served”;

三种订票方式如下:通过抽签(订票)可以说“…via lottery/ lottery system”;通过呼叫中心(订票)为 “via hotline”;通过银行门票代售网点为“via bank branches”。

 

consumer price index (CPI) 居民消费价格指数

per capita disposable income 人均可支配收入

price hikes 物价上涨

taxpayer 纳税人

这里的“low-rent housing”指的就是廉租房。“Housing”是各种房子的统称,“low”跟“rent”组成合成词,修饰“housing”。

此外,文中的“affordable housing”指的是经济适用房,从字面意思看,就是能负担得起的房子。

 

由报道可知,“群殴”可用“mass brawl”来表达。在此,mass指“大众的、人多的”,而brawl则特指“混杂的争吵或打群架”。此外,也有外电用“wild braw”来形容这场“群殴”。

由报道可知,“金猪年”相应的英文表达是“golden pig year”,也可写做“the Year of the (golden) Pig”。

顺便提一下,生肖“猪”有时也可用“boar”来形容。此外,可爱的小猪猪一般用“piggy”或“piglet”来表达。

这里的“household registration certificates”就是很多人看重的“户口”,一种居住在某地的凭证。

在北京,没有北京户口的人需要办“暂住证”(temporary residency permits),表示你临时居住在这里。请看下面例句:The ministry also called for simplified procedures for migrants to get their temporary residency permits.(政府呼吁简化外来人口办理暂住证的流程。)

harmonious socialist society 社会主义和谐社会

sound and fast development 又快又好的发展

people's well-being “民生”

to safeguard social fairness and justice 维护社会公平和正义

new socialist countryside 社会主义新农村

basic living /subsistence allowance system for rural residents 农村最低生活保障制度

minimum living/subsistence allowance 最低生活补助

new type of rural cooperative medical care system新型农村合作医疗制度

methane 沼气

corporate/enterprise income tax 企业所得税

property law 物权法

overheated property sector 房地产市场过热

low-rent housing 廉租房

county-level cities 县级市

to save energy, lower energy consumption and reduce pollutants discharge 节能降耗减排

school-age children 适龄儿童

tuition assistance 助学金

vocational education 职业教育

pre-marital medical check-up 婚前医学检查;婚检

doctor-patient relationship 医患关系

substandard food and medicine 不合标准的食品和药品

food and drug safety 食品医药安全

tax on agricultural specialty products 农业特产税

community hospitals 社区医院

community healthcare system 社区医疗保健制度

stay-at-home children 留守儿童

rural migrant workers 农民工

ice-melting/ice-thawing trip “融冰”之旅

diversification of foreign exchange reserve 外汇储备多元化

vulnerable group/disadvantaged group 弱势群体

词汇

1.从善如流 do good naturally and happily; take advice with a receptive mind; readily follow what is right

2.自欺欺人 deceive oneself as well as others

3.顺民意, 合民情 accord with the popular will and sentiments

4.全国人大高票通过《反分裂国家法》(实际上没有反对票) The NPC passed the Anti-Secession Law with no dissenting The NPC passed the Anti-Secession Law with noopposing vote.

5.两国边境地区可以说是阡陌相通, 鸡犬之声相闻 (中缅关系) China and Myanmar are close neighbors, with their border people living within hailing distance.

6.我们不应该厚此薄彼。 We should not favor one to the neglect of the other. /We should not favor one over the other./ We should not play favoritism.

7.走自己的路, 让别人说去吧。 Go one’s own way, whatever others may say.

8.讲公道话, 办公道事 Fair in word and deed./ Act fair and square.

9.黄金发展期 golden/rare/prime period of development

10.矛盾凸显期 (二十一世纪上半叶,我们既面临“黄金发展期”,又面对矛盾凸显期。) a period of increasing problems a period of major challenges

11.赢得主动 to take the initiative; to gain the upper hand to master the situation

12.整体资源 use pooled/all/aggregate resources

13.随着世界制造业大规模向中国大规模转移,也带来一定程度的“能耗转移”。 The massive shift of manufacturing to China has also brought about a transfer of energy consumption(to a certain degree).

14.在经济和社会协调过程中的一系列两难问题 dilemma in the process of coordinating economic and social development

15.高投入,高消耗,高污染的旧式工业化道路 the old-style industrialization characterized by/with/ featuring high input, high consumption and high pollution

16.不合时宜的社会治理模式 outdated governance

17.后发优势 advantages of a late comer

18.中等收入阶层 middle-income group/section

19.中国特色的人力资源优势 China’s advantage in human resources

20.世界经验还要借鉴下去,中国特色还要坚持下去。 We will continue to draw on foreign experience while maintaining Chinese characteristics.

21.(消费结构)基本生活型 consumption pattern of low-income groups;consumption pattern of meeting the basic needs of life

22.现代生活型 modern-life consumption pattern

23.(在爱滋病区)实行免费匿名检测 free and confidential test

24.(政协)反映社情民意 to reflect social conditions and public opinion

25.忧患意识和塑造意识 sense of urgency and willingness to initiate /to shape things

26.两元经济结构 urban-rural dual economy

27.科学发展观 to take a scientific approach to development;

to pursue a scientific strategy of development

28.第十一个五年规划 the 11th five-year development guidelines

29.生活垃圾无害化处理 domestic garbage was harmlessly treated;

innocuous disposal of domestic garbage

30.绿化覆盖率 greenery coverage

31.农村土地确权 verify/establish rural land-use rights

32.多点支撑的增长局面初步形成

economic growth has been brought/driven by multiple props/driving forces /multi-stimuli

33.会展经济 conference economy

34.城乡一体的紧急医疗救援体系 integrated urban-rural emergency medical service system

35.全程办事代理制 full range agent service; through agent service

36.“一站式”办公 one-stop service

37.降低企业准入门槛 lower the threshold for market entry/access

38.工伤保险 work-related injury insurance

39.社会守法意识、公德意识有待增强 to strengthen law-abiding and social ethics awareness

40.城市快速路 city express way

41.城市主干路 city thoroughfare/avenue

42.公共客运系统 mass transit system

43.建设园林景观道路 to landscape roads

44.积极承接国际服务业的外包转移 seek more service jobs outsourced by foreign countries/companies

45.都市型农业 urban agriculture

46.(基本完成)国有大中型企业主辅分离、辅业改制任务 separate supporting operations from core operations in large and medium-sized SOEs and turn the former into independent companies(businesses/entities)

47.社会化服务体系 commercialized/outsourced services

48.经营性社会事业项目 public services; profit-making public services

49.中央在京高等教育资源优势 the concentration of high education resources under the central authorities located in Beijing

50.光机电一体化 optomechatronics(the integration of optics, mechanics and electronics)

51.加大对收受回扣、“红包”和乱收费等问题的治理力度 redouble efforts to prevent kickbacks, “red envelope”bribes and other improper charges in medical service

52.反省侵略历史 reproach itself for its past aggression

53.尊重人才 value competent/professional people

54.思想道德建设 moral/ethical education

55.现在达到的小康还是低水平的、不全面的、发展很不平衡的小康 The kind of “xiaokang”(moderate prosperity)obtained so far is still a low-level, incomplete and unbalanced one.

57.党和国家的集中统一 the centralization and unity of the Party as well as the state

58.加强党性修养 cultivate their Party spirit

59.人文交流 cultural and educational exchanges

bugzilla安装

 

Windows XP下安装基于IISBugzilla

安装准备:

1Windows平台下的perl解释器,推荐使用ActivePerl-5.8.8.822

下载地址:http://www.activestate.com/Products/Download/Download.plex?id=ActivePerl

2MySQL数据库以及MySQL控制台,使用版本为4.1
下载地址为: http://www.mysql.com/downloads/index.html

http://www.mysql.com/downloads/mysql-5.0.html (MySQL 5.0 Alpha)

3Bugzilla,目前最新版本为3.12

下载地址:http://www.bugzilla.org/download.html

相关软件的安装

一、安装mysql

Mysql自定义安装到C:\Mysql,因为在BugzillaChecksetup.pl中默认Mysql安装在C:\mysql,如果安装到了其他目录,那么安装时需要对该文件进行手工修改,指定Mysql的安装路径。对于Mysql的安装,一路点击下一步即可。安装完成后,可以继续配置Mysql,设置新密码。

也可以cmd进入命令行窗口在C:\mysql\bin目录下运行mysql –u root –p 命令,进入到mysql的命令提示界面。其中-u表示使用的用户名,rootlinux 系统中的默认管理员身份,-p后跟密码,默认为空。可进入mysql后使用SQL语句“UPDATE user SET password = password('引号内为想该的密码') WHERE user = 'root';”来更改密码。

安装完成后,手动运行C:\mysql\bin\winmysqladmin.exe文件,它会自动将mysql数据库注册为服务并启动。此操作仅需运行一次,因为Mysql注册的服务为自动类型,所以每次计算机启动时均会自动运行。


然后,我们需要在mysql中创建Bugzilla的用户以及数据库,主要三条命令为:

a、建立数据库bugs
create database bugs;

 

b、建立用户bugs,密码为空,对Bugs数据库具有一定权限
GRANT SELECT,INSERT,UPDATE,DELETE,INDEX,ALTER,CREATE, LOCK TABLES,DROP,REFERENCES ON bugs.* TO bugs@localhost IDENTIFIED BY '';

 

c、从 mysql 数据库授权表中重新装载权限。
FLUSH PRIVILEGES;

执行过程如下图:(这里我们建立的数据库名为Bugs,数据库用户名为Bugs,密码为空)

注意事项:

1、   安装Mysql时,要确保电脑中没有老版本的Mysql,如果有首先是要卸载mysql服务,不然就算卸载了mysql程序,服务中依然有mysql这项,问题就解决不了.假设我的mysql装在C:\MYSQL,先在我的电脑->管理->服务中将Mysql服务停止,然后在命令提示符c:\mysql\bin下运行mysqld-nt  -remove(中间有空格),会提示卸载成功.然后再在    控制面板 >>> 添加或删除程序  中卸载mysql,之后重启,再装上mysql运行mysqld.exe(win2000下是mysqld-nt.exe),命令提示符框一闪而过,这样你这可以在任务管理器中看到mysql这个进程了

二、安装Activeperl
Activeperl
的安装很简单,一路点击Next即可,它会自动安装到C:\perl目录。同时在系统变量Path中增加自己的 C:\perl\bin路径信息。

三、安装、配置WEB服务器。
对于IIS,一般Windows 2000会默认安装,如果没有安装,那么可以在控制面板 -> 添加删除程序 -> 添加/删除Windows组件中来添加“Internet 信息服务器,系统会自动安装相关组件(此时需要 Windows 的安装盘)。

配置Web 服务器的目的就是要让Web服务器能够调用perl去解析执行.pl.cgi的文件,同时增加Index.cgi为默认文档,然后增加Bugzilla所在目录的WEB共享别名。

IIS的配置
对于IIS,在安装ActivePerl的时候安装程序为我们自动生成了.pl.plx的映射,但是没有生成.cgi的映射,我们可以在 IIS管理器里面进行配置,在默认网站或者Internet信息服务上面按右键选择属性出现服务器属性对话框(依据IIS版本和设置所影响范围不同略有不同

虚拟目录标签下,选择配置按钮、“添加”应用程序扩展名映射。

可执行文件名:

C:\Perl\bin\perl.exeperl目录)  -xC:\Bugzillabugzilla目录)  -wT "%s"  %s
 扩展名: .cgi
 动作

 限制为:GET,HEAD,POST

 然后,在文档标签下,添加index.cgi文件为默认文档。

 

  注意事项:

  1、   对于没有进行过配置的IIS,可能会禁止匿名访问,如果我们要允许匿名访问,可以在设置页面的目录安全性标签中的匿名访问和验证控制中选择编辑,去掉集成Windows验证选项即可。

  2、   如果Bugzilla所在目录为NTFS分区,还需要设置所在目录的安全属性,允许IUSR_XX(Internet 来宾帐户,这里XXXX和计算机名相同)去读写该目录。

  3、   如果默认网站停止不能启动,可能是80端口被迅雷或其他应用程序占用的原因,停止或更改其他程序端口即可

 

四S四、Perl脚本的安装以及Bugzilla的初步配置。
  Bugzilla为我们准备了一个很好的脚本文件checksetup.pl来进行配置,我们随时可以运行chekcsetup.pl文件来进行服务器配置而不会对Bugzilla系统造成任何影响。

 1、运行该脚本的方法是:

在命令行下进入Bugzilla的主目录,键入:perl  checksetup.pl,运行后,该脚本会给出系统所缺的各种元素乃至获取办法。

 

 2、初次运行的时候,系统首先会验证perl模块是否足够,一般会缺少比较多的perl模块。如果我们是单独下载的每个perl模块进行安装,则需要使用ppm install <perl模块名.ppd> 进行。

下载地址:http://search.cpan.org/(注意模块版本应高于要求的版本)


如果可以连接上网络,那么一切很简单,只需要进入bugzilla目录下:

C:\>cd bugzilla

 

C:\Bugzilla>ppm

在弹出的Perl Package Manager窗口下安装bugzilla需要的perl模块,如果有缺少的或版本不对的再单独下载安装。

 

 3、当插件安装完后,再次运行perl checksetup.pl,系统会生成localconfig文件,此文件是包含了Bugzilla的一些配置信息,如果您的mysql安装到C:\mysql,所创建的数据库名称为bugs 数据库用户为bugs,密码为空,那么不需要对localconfig文件进行任何修改,否则需要对localconfig的相应条目进行修改。

# What SQL database to use. Default is mysql. List of supported databases

# can be obtained by listing Bugzilla/DB directory - every module corresponds

# to one supported database and the name corresponds to a driver name.

$db_driver = 'mysql';

 

# The DNS name of the host that the database server runs on.

$db_host = 'localhost';

 

# The name of the database

$db_name = 'bugs';

 

# Who we connect to the database as.

$db_user = 'bugs';

 

# Enter your database password here. It's normally advisable to specify

# a password for your bugzilla database user.

# If you use apostrophe (') or a backslash (\) in your password, you'll

# need to escape it by preceding it with a '\' character. (\') or (\)

# (Far simpler just not to use those characters.)

$db_pass = '';

 

# Sometimes the database server is running on a non-standard port. If that's

# the case for your database server, set this to the port number that your

# database server is running on. Setting this to 0 means "use the default

# port for my database server."

$db_port = 3306;

 

 4、修改好localconfig文件,再次运行 perl checksetup.pl,如果不出意外的话,会顺利编译模板,然后建立数据库,最后提示输入超级用户信箱、用户姓名以及口令。输入后,Bugzilla 基本安装完成,可以从 web 上来进行访问了。

 

 注意事项:

 1WindowsXP下安装Perl Cpan模块

a.http://search.cpan.org/搜索你所需要的模块下载,一般是gz,或者tgz格式

b.winRAR之类解压缩软件接压缩

c.进入COMMAN模式,进入到刚才解压缩的文件夹,含有“Makefile.PL”文件的目录下:

依次运行:

        perl Makefile.PL
        nmake
        nmake test
        nmake install

安装就完成了.(有依赖关系的模块需要先安装依赖模块)

 

 2、服务器输入http://localhost/Bugzilla/可以访问bugzilla,其他电脑输入服务器地址http://服务器IP/Bugzilla/不能访问

   可能是服务器防火墙阻止了80端口的访问

控制面板->防火墙->例外->添加端口

 

遇到的问题

⑴用帐号登录BUGZILLA后,每页上方都会显示:

  Use of uninitialized value  in integer addition (+) at c:/Perl/lib/Time/Local.pm line 76.

  解决方法:

     edit c:/perl/lib/Time/Local.pm, look for the following line   (should  be at line 35):

     $MinInt = -$MaxInt - 1;

     change it to:

     $MinInt = 0;

 

BUGZILLA安装参考文章链接

http://www.51testing.com/?98723/action_viewspace_itemid_11299.html

http://dev.csdn.net/article/49/49481.shtm

http://blog.csdn.net/ycw/archive/2004/02/07/4187.aspx

BUGAILLA安装技巧和注意事项

⑴这里讲一讲首页中的“常用功能”、”常用链接“的链接显示有些不习惯,可以修改 template\cn\default\global\common-links.html.tmpl
<ul> <li>  转换成表格 <table> <tr> <td> ,显示在一行中,就好看多了。

  同样的,英文也处理一下,
template\en\default\global\common-links.html.tmpl
<ul> <li>  转换成表格 <table> <tr> <td> ,显示在一行中,就好看多了。

 

⑵设置parameters

用超级用户登录后,点击parameters设置bugzilla的参数,其中urlbase是以后发邮件中包含的,.所以一定要修改它, maintainer修改为超级用户,下面的就不是那么重要了,点击最下面的Submit Changes完成修改,再回到这个页面上查看,看是否已经修改,如果不能修改,,,那么就只有出绝招了,嘿嘿,,打开bugzilla目录C:\bugzilla\data下的params,在这里面手动修改它的参数,完成后就OK.

⑶commentonresolve:设为ON,系统将强制要求开发者处理完BUG后,必须填写修改的内容。

关于Bugzilla2.20发邮件以及邮件乱码的问题

1. 刚才试了,在Bugzilla2.20下发邮件,不必要安装什么特殊的sendmail.exe软件之类,只需要Perl的Mail::Mailer模块(这个模块你肯定装了,不然Bugzilla都转不起来);当然, 与email发送相关的参数 如 smtp server之类一定要在 Bugzilla的系统设置(Parameters)里面 设好;

2. 要想邮件不出现乱码,在使用UTF8编码的汉化包下,做如下改动:

a. \Bugzilla\CGI.pm的第55行改为  $self->charset('UTF-8');

b. 进入Bugzilla的系统设置(Parameters)里面,在 newchangedmail 一项里的 文本框文字的第一行加上Content-type: text/plain; charset=UTF-8 ,加后变为:
Content-type: text/plain; charset=UTF-8
From: bugzilla-daemon
To: %to%

.......

保存退出。

c. 部分用户反映,经过以上两个步骤后,收到的email的主题仍为乱码,网上提供的解决方案是:

打开文件 \Bugzilla\BugMail.pm, 在第 586 行加上两行:

use Encode;
$substs{"summary"} = encode('MIME-Q', $substs{"summary"});

不知什么原因,我用Netscape Client接受的邮件的主题行仍然为乱码。。但用Foxmail接受的全部OK。

采用GB2312编码格式的汉化包(不推荐)可参照以上步骤解决邮件乱码问题。

(注明:我使用此方法并没有解决我邮件乱码的问题,但感觉这个方法以后会有用,所以贴在此处。)


4月23日

jira如何配置使用LDAP认证

今天的手又痒痒了,觉得应该是时候写点东西了。
这一周的时间在忙活LDAP认证,这个已经不是什么新鲜名词了概念就免了;
之所以学LDAP,还是为了SSO和PORTAL。
经过一周的时间,搭建好了LDAP服务器,用的开源的APACHE的DS,还有APACHE的studio;配置起来非常的简单主要掌握几个要点就好了:
1、server.xml的配置
Adding your own partition resp. suffix
添加自己的数据格式
<property name="contextPartitionConfigurations">
  <set>
    <ref bean="examplePartitionConfiguration"/>
    <ref bean="myPartitionConfiguration"/>
  </set>
</property>
然后查询examplePartitionConfiguration把他的bean配置重新复制一份需要修改几个地方
<bean id="myPartitionConfiguration"
      class="org.apache.directory.server.core.partition.
                            impl.btree.MutableBTreePartitionConfiguration">
Next give the partition a name and change the suffix to o=mydomain
<property name="name" value="mydomain" />

<property name="contextEntry">
    <value>
      objectClass: top
      objectClass: domain
      objectClass: extensibleObject
      dc: example ---> o:mydomaim
    </value>
</property>
重新启动apache ds;

2、LDIF文件的格式
第一步:组织结构以及管理员信息
dn: o=chinantn,dc=com
objectclass: organization
objectclass: top
o: chinantn

dn: cn=manager,o=chinantn,dc=com
objectclass: organizationalPerson
objectclass: person
objectclass: top
cn: manager
sn: badboyryan
userpassword:: c2VjcmV0

dn: ou=departments,o=chinantn,dc=com
objectclass: organizationalUnit
objectclass: top
ou: departments

dn: ou=market,ou=departments,o=chinantn,dc=com
objectclass: organizationalUnit
objectclass: top
ou: market

dn: ou=developer,ou=departments,o=chinantn,dc=com
objectclass: organizationalUnit
objectclass: top
ou: developer

dn: ou=service,ou=departments,o=chinantn,dc=com
objectclass: organizationalUnit
objectclass: top
ou: service

dn: ou=finance,ou=departments,o=chinantn,dc=com
objectclass: organizationalUnit
objectclass: top
ou: finance

dn: ou=directorate,ou=departments,o=chinantn,dc=com
objectclass: organizationalUnit
objectclass: top
ou: directorate

dn: ou=engineer,ou=departments,o=chinantn,dc=com
objectclass: organizationalUnit
objectclass: top
ou: engineer

dn: ou=partners,o=chinantn,dc=com
objectclass: organizationalUnit
objectclass: top
ou: partners

dn: ou=customers,ou=partners,o=chinantn,dc=com
objectclass: organizationalUnit
objectclass: top
ou: customers

dn: ou=suppliers,ou=partners,o=chinantn,dc=com
objectclass: organizationalUnit
objectclass: top
ou: suppliers

dn: ou=employees,ou=partners,o=chinantn,dc=com
objectclass: organizationalUnit
objectclass: top
ou: employees

第二步:人员信息

dn: uid=scf,ou=developer,ou=departments,o=chinantn,dc=com
objectClass: person
objectClass: uidObject
objectClass: organizationalPersono_ldapclient
objectClass: top
cn: sss
sn: scf
uid: scf
userpassword:: e01ENX1YTXNwY1ZWVFhUbFh1K1M0QllLY0hBPT0=
人员信息就少写一点了,有空你再慢慢的补充上。
第三步:导入LDIF文件,这个时候LDAP服务器里面就有了一棵树(组织结构)
第四步:被指jira让他利用LDAP认证来登录系统,如下图所示:


4月19日

jira与svn集成

jira插件安装--与subversion的集成插件

使用jira的过程中,如果能够与版本或者代码管理工具有机的集成,那样对jira的整体管理会有很大的帮助,jira本身自带了与CVS的集成,这里介绍一下与subversion的集成。

1、可以根据你安装的jira的版本下载对应的jira(最新版本3.12) subversion(SVN) plugin。这里介绍的是0.9.4,支持jira3.6的。下载地址为: 最新为0.10.1。
2、解压缩下载下来的文件,将压缩文件中的lib目录中的jar文件:atlassian-jira-subversion-plugin-0.9.4.jar、ganymed.jar、javasvn-1.0.5.jar拷贝到jira的WEB-INF\lib\目录中;

3、编辑\atlassian-jira-subversion-plugin-0.9.5\subversion-jira-plugin.properties文件,在其中添加svn服务器上的用户名和密码:
引用:
svn.username=yany
svn.userword=123456
保存后,拷贝该文件到jira的WEB-INF\classes\目录中;
注意:subversion-jira-plugin.properties文件中的svn.root=svn:/localhost/repos需要在硬盘上创建一个名为repos的repository,这样jira启动过程中根据subversion-jira-plugin.properties文件中的svn.root设置连接到svn的respository.

4、启动svnserver

5、重新启动jira程序,启动过程中会自动创建\indexs\plugins\atlassian-subversion-revisions\目录,用于保存subversion的索引。

6、在浏览器中访问jira,察看jiar系统的plagin菜单会看到jira Subversion plugin信息如下所示:


7、查看jira系统中的Issue(问题)详细信息界面,会看到Subversion Commits Tab,如下图:

其他说明:
引用:
JIRA Subversion plugin 支持多个Subversion repository。默认的repository设置为svn.root={svn root},增加repositories的配置:svn.root.1=...,svn.root.2=...,等。如果您没有为增加的respository设置用户名、密码和URL、修订索引和缓存大小的话,则新增的respository会使用缺省的配置信息。
具体可参考:
引用:
http://confluence.atlassian.com/display/JIRAEXT/JIRA+Subversion+plugin#JIRASubversionplugin-versions