2009年6月25日星期四

linux添加用户

要在系统上添加用户:
使用 useradd 命令来创建一个锁定的用户账号: 中
useradd <username>
使用 passwd 命令,通过指派口令和口令老化规则来给某账号开锁:
passwd <username>
useradd 的命令行选项在表 25-1中被列出。
-c comment 用户的注释。
-d home-dir 用来取代默认的 /home/ username 主目录。
-e date 禁用账号的日期,格式为:YYYY-MM-DD
-f days 口令过期后,账号禁用前的天数(若指定了 0 ,账号在口令过期后会被立刻禁用。若指定了 -1 ,口令过期后,账号将不会被禁用)。
-g group-name 用户默认组群的组群名或组群号码(该组群在指定前必须存在)。
-G group-list 用户是其中成员的额外组群名或组群号码(默认以外的)列表,用逗号分隔(组群在指定前必须存在)。
-m 若主目录不存在则创建它。
-M 不要创建主目录。
-n 不要为用户创建用户私人组群。
-r 创建一个 UID 小于 500 的不带主目录的系统账号。
-p password 使用 crypt 加密的口令。
-s 用户的登录 shell,默认为 /bin/bash 。
-u uid 用户的 UID,它必须是独特的,且大于 499。
表 25-1. useradd 命令行选项
添加组群
要给系统添加组群,使用 groupadd 命令:
groupadd <group-name>
groupadd 的命令行选择在表 25-2中被列出。
-g gid 组群的 GID,它必须是独特的,且大于 499。
-r 创建小于 500 的系统组群。
-f 若组群已存在,退出并显示错误(组群不会被改变)。如果指定了 -g 和 -f 选项,而组群已存在, -g 选项就会被忽略。
表 25-2. groupadd 命令行选项
口令老化
为安全起见,要求用户定期改变他们的口令是明智之举。这可以在 用户管理器 的 「口令信息」 标签上添加或编辑用户时做到。
要从 shell 提示下为用户配置口令过期,使用 chage 命令,随后使用表 25-3中的选项,以及用户的用户名。
重要:要使用 chage 命令,屏蔽口令一定要被启用。
-m days 指定用户必须改变口令所间隔的最少天数。如果值为 0,,口令就不会过期。
-M days 指定口令有效的最多天数。当该选项指定的天数加上 -d 选项指定的天数小于当前的日期,用户在使用该账号前就必须改变口令。
-d days 指定自从 1970 年 1 月 1 日起,口令被改变的天数。
-I days 指定口令过期后,账号被锁前不活跃的天数。如果值为 0,账号在口令过期后就不会被锁。
-E date 指定账号被锁的日期,日期格式为 YYYY-MM-DD。若不用日期,也可以使用自 1970 年1月1日后经过的天数。
-W days 指定口令过期前要警告用户的天数。

2009年6月24日星期三

2009年5月19日星期二

mget一次传送多个文件都要回答y

使用ftp –i <ip>
或者prompt命令关闭Interactive mode

修改命令行窗口的Code Page

chcp 950 中文繁体big5
chcp 936 中文简体gbk

Sorting Multilingual Data

Oracle9i之前,中文是按照二进制编码进行排序的。在oracle9i中新增了按照拼音、部首、笔画排序功能。

1、设置NLS_SORT参数值
      SCHINESE_RADICAL_M 按照部首(第一顺序)、笔划(第二顺序)排序
      SCHINESE_STROKE_M 按照笔划(第一顺序)、部首(第二顺序)排序
      SCHINESE_PINYIN_M 按照拼音排序

2、Session级别的设置,修改ORACLE字段的默认排序方式:
      按拼音:alter session set nls_sort = SCHINESE_PINYIN_M;
      按笔画:alter session set nls_sort = SCHINESE_STROKE_M;
      按偏旁:alter session set nls_sort = NLS_SORT=SCHINESE_RADICAL_M;

3、语句级别设置排序方式:
      按照笔划排序
      select * from dept order by nlssort(name,'NLS_SORT=SCHINESE_STROKE_M');
      按照部首排序
      select * from dept order by nlssort(name,'NLS_SORT=SCHINESE_RADICAL_M');
      按照拼音排序,此为系统的默认排序方式
      select * from dept order by nlssort(name,'NLS_SORT=SCHINESE_PINYIN_M');

4、修改系统参数(数据库所在操作系统):
      set NLS_SORT=SCHINESE_RADICAL_M ;export NLS_SORT (sh)
       setenv NLS_SORT SCHINESE_RADICAL_M (csh)
      HKLC\SOFTWARE\ORACLE\home0\NLS_SORT (win注册表)

Oracle 官方说明

NLS_SORT NLS_SORT specifies the collating sequence for ORDER BY queries. NLS_COMP NLS_COMP specifies the collation behavior of the database session.

Property

Description

Parameter type

String

Syntax

NLS_SORT = { BINARY | linguistic_definition }

Default value

Derived from NLS_LANGUAGE

Modifiable

ALTER SESSION

Range of values

BINARY or any valid linguistic definition name

  • If the value is BINARY, then the collating sequence for ORDER BY queries is based on the numeric value of characters (a binary sort that requires less system overhead).
  • If the value is a named linguistic sort, sorting is based on the order of the defined linguistic sort. Most (but not all) languages supported by the NLS_LANGUAGE parameter also support a linguistic sort with the same name.

    Note:

    Setting NLS_SORT to anything other than BINARY causes a sort to use a full table scan, regardless of the path chosen by the optimizer. BINARY is the exception because indexes are built according to a binary order of keys. Thus the optimizer can use an index to satisfy the ORDER BY clause when NLS_SORT is set to BINARY. If NLS_SORT is set to any linguistic sort, the optimizer must include a full table scan and a full sort in the execution plan.

         You must use the NLS_SORT operator with comparison operations if you want the linguistic sort behavior.

Property

Description

Parameter type

String

Syntax

NLS_COMP = { BINARY | LINGUISTIC | ANSI }

Default value

BINARY

Modifiable

ALTER SESSION

Basic

No

Values:

  • BINARY

Normally, comparisons in the WHERE clause and in PL/SQL blocks is binary unless you specify the NLSSORT function.

  • LINGUISTIC

Comparisons for all SQL operations in the WHERE clause and in PL/SQL blocks should use the linguistic sort specified in the NLS_SORT parameter. To improve the performance, you can also define a linguistic index on the column for which you want linguistic comparisons.

  • ANSI

A setting of ANSI is for backwards compatibility; in general, you should set NLS_COMP to LINGUISTIC

2009年5月18日星期一

FLT_EPSILON

FLT_EPSILON
This is the minimum positive floating point number of type float such that 1.0 + FLT_EPSILON != 1.0 is true. It's supposed to be no greater than 1E-5.

2009年5月13日星期三

《潜伏》中的一段对话

        余则成:是觉得无路可走了吗?
晚秋:(哭,点头)
余:其实你面前有一条通往未来的路啊。(秋流泪摇头)值得你活下去。那一路很美好,就像你的诗歌一样。怎么会觉得无路可走了呢?
秋:你愿意娶我吗?
余:比娶你更美好。还多了一份自由。你不是最向往自由吗?
秋:(点头)
余:你也知道我的身份了。你愿意去吗?
秋:那我就再也见不到你了。
余:那儿有很多人都像我一样。那是另一个世界,好地方,好风光。你那么年轻,那么漂亮,可以选择的。你想想,晚秋,你站在一列雄壮的队伍里,迈着大步,高唱着战歌,去改变整个中国,那是什么气势?一个小小的余则成,就是路边的一个送行者,你看见了他,他看见了你,你们挥挥手就过去了。再往前就是更有意义的生活。沮丧吗?无非就是一个小布尔乔亚的无病呻吟。留恋它就是一种高度近视。有时候看得远一点,不就什么都有了么。包括爱。