Thinking in a Simple Way

搭好梯子再上来 https://simpleface.wordpress.com

纪念一下2013年3月8日,雅思过啦!哈哈哈


2月23日 collingwood 雅思考试

终于在3月8日晚上拿到成绩,非常兴奋,这段时间的努力没有白费,给自己鼓鼓掌

Image

 

纪念一下今天一个历史时刻的到来,难以抑制的兴奋!!

How to Install Apache 2.4.2 from Source on CentOS 6.2 with SSL


This file ‘s origin is from :http://www.thegeekstuff.com/2012/05/install-apache-2-on-centos-6/

I found this tutorial is very helpful for me, you i save it to my blog ,in order to learn it .

If you try to follow the how to install Apache with SSL article that we discussed a while back, you’ll face an issue during “make” because of version compatibility between Apache 2.4.4 and APR utilities (Apache Portable Runtime Library) that comes with CentOS 6.

We’ve explained in this article how to solve that issue to get the latest Apache working on CentOS or RedHat.

Make sure you have gcc and openssl-devel installed.

# yum install gcc
# yum install openssl-devel

You also need “Apache Portable Runtime Library” APR to install Apache from source.

You’ll already have “apr” and “apr-util” package installed. Install the apr-devel and apr-util-devel packages.

# yum install apr-devel
# yum install apr-util-devel

Note: In our case (because of the version compatibility issues), we’ll be downloading these and installing it manually later. But, let us go with the flow for now and see what happens when you try to do it this way.

Download Apache

Download Apache from httpd.apache.org. The current stable release is 2.4.2.

Once you get the direct URL to download the latest stable version of Apache, use wget as shown below to download it directly to you server.

cd /usr/src
wget http://mirror.nyi.net/apache//httpd/httpd-2.4.2.tar.gz
tar xvfz httpd-2.4.2.tar.gz

Install Apache with SSL/TLS

View all available Apache installation and configuration options as shown below.

cd httpd-2.4.2
./configure --help

To install an Apache module, you would typically say –enable-{module-name}. For example, to install SSL with Apache, it is –enable-ssl. To install ldap module, it is –enable-ldap.

To uninstall any default module that comes with Apache, you would typically say –disable-{module-name}. For example, to disable basic authentication in Apache, it is –disable-auth-basic

In this example, we will install Apache with all default modules, with addition of –enable-ssl (to install mod_ssl for SSL support), and –enable-so, which helps to load modules in Apache during run-time via the Dynamic Shared Object (DSO) mechanism, rather than requiring a recompilation.

./configure --enable-ssl --enable-so
make
make install

Note: By default the above installs Apache under /usr/local/apache2. If you like to change this location, use –prefix option in the ./configure.

Fixing APR Utility Error Messages

You might’ve not faced this problem while installing older version of Apache as we discussed a while back.

When you execute the “make”, you might get “rotatelogs.c:(.text+0x5ed): undefined reference to `apr_file_link’” error message if you are doing this on CentOS 6.2 as shown below.

# make
rotatelogs.c:298: warning: implicit declaration of function âapr_file_linkâ
/usr/lib64/apr-1/build/libtool --silent --mode=link gcc -std=gnu99 -pthread
-o rotatelogs  rotatelogs.lo /usr/lib64/libaprutil-1.la -ldb-4.7 -lexpat -ldb-4.7 
/usr/lib64/libapr-1.la -lpthread
rotatelogs.o: In function `post_rotate':
rotatelogs.c:(.text+0x5ed): undefined reference to `apr_file_link'
collect2: ld returned 1 exit status
make[2]: *** [rotatelogs] Error 1
make[2]: Leaving directory `/usr/src/httpd-2.4.2/support'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/src/httpd-2.4.2/support'
make: *** [all-recursive] Error 1

This is because on CentOS 6, the latest APR version available through yum installation is 1.3.9 as shown below.

# rpm -qa apr*
apr-1.3.9-3.el6_1.2.x86_64
apr-util-1.3.9-3.el6_0.1.x86_64

However, Apache 2.4.2 needs the latest version of APR (which is currently 1.4.6).

So, go to APR download page and download both apr and apr-util.

cd /usr/src
wget http://mirror.atlanticmetro.net/apache//apr/apr-1.4.6.tar.gz
wget http://mirror.atlanticmetro.net/apache//apr/apr-util-1.4.1.tar.gz
tar xvfz apr-1.4.6.tar.gz
tar xvfz apr-util-1.4.1.tar.gz

Now, you should place this new version of apr and apr-util directories (without the version name in the directory) under “srclib” directory located under the httpd-2.4.2 directory that was created when you uncompressed the downloaded apache software.

In my example, I downloaded the httpd-2.4.2.tar.gz and uncompressed it under /usr/src. So, I need to place the latest apr and apr-util under this directory.

mv apr-1.4.6 /usr/src/httpd-2.4.2/srclib/apr
mv apr-util-1.4.1 /usr/src/httpd-2.4.2/srclib/apr-util

After this is done, we need to configure and make it again. If you execute the ./configure –help, you’ll see the following options that are related to APR

# cd /usr/src/httpd-2.4.2
# ./configure --help
  --with-included-apr     Use bundled copies of APR/APR-Util
  --with-apr=PATH         prefix for installed APR or the full path to apr-config
  --with-apr-util=PATH    prefix for installed APU or the full path to apu-config

If you decide to install the apr-1.4.6 and apr-util-1.4.1 on your system, you need to use “–with-apr” and “–with-apr-util” and provide the path where you installed these utility.

In this example, we didn’t do that. i.e We didn’t install the apr and apr-util that we downloaded. Instead we placed them under the httpd-2.4.2/srclib/apr-util. So, we should use “–with-included-apr” in the ./configure which will use these apr and apr-util only for the apache compilation and installation.

So, let us re-do the ./configure (using –with-included-apr), make and make install as shown below.

./configure --enable-ssl --enable-so --with-included-apr
make
make install

Now, make will not give “rotatelogs.c:(.text+0x5ed): undefined reference to `apr_file_link” error message anymore.

Enable SSL in httpd.conf

Apache configuration file httpd.conf is located under /usr/local/apache2/conf.

Uncomment the httpd-ssl.conf Include line and the LoadModule ssl_module line in the /usr/local/apache2/conf/httpd.conf file.

# vi /usr/local/apache2/conf/httpd.conf
LoadModule ssl_module modules/mod_ssl.so
Include conf/extra/httpd-ssl.conf

View the httpd-ssl.conf to review all the default SSL configurations. For most cases, you don’t need to modify anything in this file.

# vi /usr/local/apache2/conf/extra/httpd-ssl.conf

The SSL certificate and key are required before we start the Apache. The server.crt and server.key file mentioned in the httpd-ssl.conf needs to be created before we move forward.

# cd /usr/local/apache2/conf/extra
# egrep 'server.crt|server.key' httpd-ssl.conf
SSLCertificateFile "/usr/local/apache2/conf/server.crt"
SSLCertificateKeyFile "/usr/local/apache2/conf/server.key"

Create server.crt and server.key file

First, Generate the server.key using openssl.

# cd /usr/src
# openssl genrsa -des3 -out server.key 1024

The above command will ask for the password. Make sure to remember this password. You need this while starting your Apache later.

Next, generate a certificate request file (server.csr) using the above server.key file.

# openssl req -new -key server.key -out server.csr

Finally, generate a self signed ssl certificate (server.crt) using the above server.key and server.csr file.

# openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

After you’ve done with the above steps, you’ll see the following three files under /usr/src

# ls server*
server.crt  server.csr  server.key

Copy the server.key and server.crt file to appropriate Apache configuration directory location.

cp server.key /usr/local/apache2/conf/
cp server.crt /usr/local/apache2/conf/

Start the Apache

If you are getting the below error message, make sure to uncomment the line shown below in httpd.conf

# /usr/local/apache2/bin/apachectl start
AH00526: Syntax error on line 51 of /usr/local/apache2/conf/extra/httpd-ssl.conf:
Invalid command 'SSLCipherSuite', perhaps misspelled or defined by a module not included in the server configuration

# vi /usr/local/apache2/conf/httpd.conf
LoadModule ssl_module modules/mod_ssl.so

If you are getting the below error message, make sure to uncomment the line shown below in httpd.conf

# /usr/local/apache2/bin/apachectl start
AH00526: Syntax error on line 76 of /usr/local/apache2/conf/extra/httpd-ssl.conf:
SSLSessionCache: 'shmcb' session cache not supported (known names: ).
 Maybe you need to load the appropriate socache module (mod_socache_shmcb?).

# vi /usr/local/apache2/conf/httpd.conf
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so

Finally, this will prompt you to enter the password for your private key before starting up the apache.

# /usr/local/apache2/bin/apachectl start
Apache/2.4.2 mod_ssl (Pass Phrase Dialog)
Some of your private key files are encrypted for security reasons.
In order to read them you have to provide the pass phrases.

Server www.example.com:443 (RSA)
Enter pass phrase:

OK: Pass Phrase Dialog successful.

Verify that the Apache httpd process is running in the background

# ps -ef | grep http
root   29529     1  0 13:08 ?     00:00:00 /usr/local/apache2/bin/httpd -k start
daemon 29530 29529  0 13:08 ?     00:00:00 /usr/local/apache2/bin/httpd -k start
daemon 29531 29529  0 13:08 ?     00:00:00 /usr/local/apache2/bin/httpd -k start
daemon 29532 29529  0 13:08 ?     00:00:00 /usr/local/apache2/bin/httpd -k start
root   29616 18260  0 13:09 pts/0 00:00:00 grep http

To stop the apache use apachectl stop.

# /usr/local/apache2/bin/apachectl stop

Use httpd -l to view all the modules that are compiled inside the Apache httpd daemon.

# /usr/local/apache2/bin/httpd -l
Compiled in modules:
  core.c
  mod_so.c
  http_core.c
  event.c

By default Apache SSL runs on 443 port.

Open a web browser and verify that you can access your Apache using https://{your-ip-address}

Eearthquake happens 38 minutes ago, at 20:55 2012/6/19. is that right?


I felt that there was an earthquake happened 30 minutes ago?地震啦貌似8点55分左右整个屋子有很大的声音,桌子在晃

Unix shell and environment programming: Metacharacters and wildcard character


The Basics: Wildcards for grep

The Wildcard Character

So the first question that probably comes to mind is something like “does this grep thing support wildcards ? And the answer is better than yes. In fact saying thatgrep supports wildcards is a big understatement. grep uses regular expressions which go a few steps beyond wildcards. But we will start with wildcards. The canonical wildcard character is the dot “.” Here is an example :

>cat file big bad bug bag bigger boogy >grep b.g file big bad bug bag bigger 

notice that boogy didn’t match, since the “.” matches exactly one character.

 

The repetition character

To match repetitions of a character, we use the star, which works in the following way:

the expression consisting of a character followed by a star matches any number (possibly zero) of repetitions of that character. In particular, the expression “.*” matches any string, and hence acts as a “wildcard”.

To illustrate, we show some examples:

Examples: Wildcards

The File for These Examples

>cat file
big
bad bug 
bag
bigger
boogy

Wildcards #1

>grep "b.*g" file
big
bad bug 
bag
bigger
boogy

Wildcards #2

>grep "b.*g." file
bigger
boogy

repetition

>grep "ggg*" file
bigger

Read the repetion example carefully, and pay careful attention to the fact that the “*” in grep patterns denotes repetition. It does not behave as a wildcard in regular expression syntax (as it is in UNIX or DOS glob patterns). Recall that the pattern “.*” behaves as a wildcard (because .* means “repeat any character any number of times). The pattern “g*” matches the string “”, “g”, “gg”, etc. Likewise, “gg*” matches “g”, “gg”, “ggg”, so “ggg*” matches “gg”, “ggg”, “gggg”, etc.

Taking it Further – Regular Expressions

Back to top The wildcards are a start, but the idea could be taken further. For example, suppose we want an expression that matches Frederic Smith or Fred Smith. In other words, the letters eric are “optional”.

First, we introduce the concept of an “escaped” character.

An escaped character is a character preceded by a backslash. The preceding backslash does one of the following:
(a) removes an implied special meaning from a character (b) adds special meaning to a “non-special” character

Examples

To search for a line containing text hello.gif, the correct command is

grep 'hello\.gif' file

since grep 'hello.gif' file will match lines containing hello-gif , hello1gif , helloagif , etc.

Now we move on to grouping expressions, in order to find a way of making an expression to match Fred or Frederic

First, we start with the ? operator.

an expression consisting of a character followed by an escaped question mark matches one or zero instances of that character.

Example

bugg\?y matches all of the following: bugy , buggy but not bugggy We move on to “grouping” expressions. In our example, we want to make the string “ederic” following “Fred” optional, we don’t just want one optional character.

An expression surrounded by “escaped” parentheses is treated by a single character.

Examples

Fred\(eric\)\? Smith matches Fred Smith or Frederic Smith 
\(abc\)* matches abc , abcabcabc etc. (i.e. , any number of repetitions of the string abc , including the empty string.) Note that we have to be careful when our expressions contain white spaces or stars. When this happens, we need to enclose them in quotes so that the shell does not mis-interpret the command, because the shell will parse whitespace-separated strings as multiple arguments, and will expand an unquoted * to a glob pattern. So to use our example above, we would need to type

grep “Fred\(eric\)\? Smith” file

 

We now mention several other useful operators.

More on Regular Expressions

Back to top

Matching a list of characters

Back to top
To match a selection of characters, use [].

Example

[Hh]ello matches lines containing hello or Hello

Ranges of characters are also permitted.

Example

[0-3] is the same as [0123] 
[a-k] is the same as [abcdefghijk]
[A-C] is the same as [ABC]
[A-Ca-k] is the same as 
[ABCabcdefghijk]

There are also some alternate forms : 

[[:alpha:]] is the same as [a-zA-Z]
[[:upper:]] is the same as [A-Z]
[[:lower:]] is the same as [a-z]
[[:digit:]] is the same as [0-9]
[[:alnum:]] is the same as [0-9a-zA-Z]
[[:space:]] matches any white space including tabs

These alternate forms such as [[:digit:]] are preferable to the direct method [0-9]

The [] may be used to search for non-matches. This is done by putting a carat ^ as the first character inside the square brackets.

Example

grep "([^()]*)a" file returns any line containing a pair of parentheses that are innermost and are followed by the letter “a”. So it matches these lines

(hello)a
(aksjdhaksj d ka)a

But not this

x=(y+2(x+1))a

Matching a Specific Number Of Repetitions of a Pattern

Back to top
Suppose you want to match a specific number of repetitions of a pattern. A good example is phone numbers. You could search for a 7 digit phone number like this:

grep "[[:digit:]]\{3\}[ -]\?[[:digit:]]\{4\}" file

This matches phone numbers, possibly containing a dash or whitespace in the middle.

Nailing it Down to Start of the Line and End of the Line

Back to top
Here’s the deal. Suppose you want to search for lines containing a line consisting of white space, then the word hello, then the end of the line. Let us start with an example.

>cat file

	hello
hello world
	hhello

>grep hello file

	hello
hello world
	hhello

This is not what we wanted. So what went wrong ? The problem is that grep searches for lines containing the string “hello” , and all the lines specified contain this. To get around this problem, we introduce the end and beginning of line characters

The $ character matches the end of the line. The ^ character matches the beginning of the line.

Examples

returning to our previous example,

grep "^[[:space:]]*hello[[:space:]]*$" file

does what we want (only returns one line) Another example: 
grep "^From.*mscharmi" /var/spool/mail/elflord searches my inbox for headers from a particular person. This kind of regular expression is extremely useful, and mail filters such as procmail use it all the tims.

This or That: matching one of two strings

Back to top

The expression consisting of two expressions seperated by the or operator \| matches lines containing either of those two expressions.

Note that you MUST enclose this inside single or double quotes.

Example

grep "cat\|dog" file matches lines containing the word “cat” or the word “dog” 
grep "I am a \(cat\|dog\)" matches lines containing the string “I am a cat” or the string “I am a dog”.

Backpedalling and Backreferences

Back to top
Suppose you want to search for a string which contains a certain substring in more than one place. An example is the heading tag in HTML. Suppose I wanted to search for <H1>some string</H1> . This is easy enough to do. But suppose I wanted to do the same but allow H2 H3 H4 H5 H6 in place of H1. The expression<H[1-6]>.*</H[1-6]> is not good enough since it matches <H1>Hello world</H3> but we want the opening tag to match the closing one. To do this, we use abackreference

The expression \n where n is a number, matches the contents of the n’th set of parentheses in the expression

Woah, this really needs an example!

Examples

<H\([1-6]\).*</H\1> matches what we were trying to match before. 
"Mr \(dog\|cat\) came home to Mrs \1 and they went to visit Mr \(dog\|cat\) and Mrs \2 to discuss the meaning of life matches … well I’m sure you can work it out. the idea is that the cats and dogs should match up in such a way that it makes sense.

Some Crucial Details: Special Characters and Quotes

Back to top

Special Characters

Back to top
Here, we outline the special characters for grep. Note that in egrep (which uses extended regular expressions), which actually are no more functional than standard regular expressions if you use GNU grep ) , the list of special characters increases ( | in grep is the same as \| egrep and vice versa, there are also other differences. Check the man page for details ) The following characters are considered special and need to be “escaped”:

?  \  .  [  ]  ^  $

Note that a $ sign loses its meaning if characters follow it (I think) and the carat ^ loses its meaning if other characters precede it. 
Square brackets behave a little differently. The rules for square brackets go as follows:

  • A closing square bracket loses its special meaning if placed first in a list. for example []12] matches ] , 1, or 2.
  • A dash – loses it’s usual meaning inside lists if it is placed last.
  • A carat ^ loses it’s special meaning if it is not placed first
  • Most special characters lose their meaning inside square brackets

Quotes

Back to top
Firstly, single quotes are the safest to use, because they protect your regular expression from the shell. For example, grep "!" file will often produce an error (since the shell thinks that “!” is referring to the shell command history) while grep '!' file will not.

When should you use single quotes ? the answer is this: if you want to use shell variables, you need double quotes. For example,

grep "$HOME" file

searches file for the name of your home directory, while

grep '$HOME' file

searches for the string $HOME

Design Pattern – state pattern


State pattern is to help object to control their behaviours by changing their internal state

What do r w and x really mean for a directory in Unix Shell environment?


A directory is a file too, and “read” permission means you can read it. But you really cannot do very much without x permission as well. With directories, you usually have both read and execute permission or neither. On a directory, that x is officially called “search permission”. You need x to use a directory in a pathname. So if you try “cat /etc/passwd”, you will need x on / and /etc. You also need x to cd into a directory. Suppose you have read but not search (x) permission on a directory. What can you do? Not much. You can use “ls” to view the file names. Even “ls -l” will not work. Read access without search permission is not very useful. Still that is better than having only write permission on a directory…that is completely useless. I have not seen any other documentation that states this explicitly, so let me repeat it: write but no execute permission on a directory grants nothing at all.Suppose you have search (x) permission but no read permission on a directory. Now you can open files in the directory if you happen to know the file’s name. You can cd into the directory. And that is it. You cannot even create a new file. Adding write permission will allow you to create files. And you can then delete files if you happen to know their name.

PL/SQL programming & Operations(1)(用户管理)


1.用户管理

(1)建立用户(数据库验证) CREATE USER smith IDENTIFIED BY smith_pwd DEFAULT TABLESPACE users TEMPORARY TABLESPACE temp QUOTA 5m ON users;

(2)修改用户

ALTER USER smith QUOTA 0 ON SYSTEM;

(3)删除用户

DROP USER smith; DROP USER smith CASCADE;

(4)显示用户信息

DBA_USERS

DBA_TS_QUOTAS

2.系统权限

系统权限 作用
CREATE SESSION 连接到数据库
CREATE TABLE 建表
CREATE TABLESPACE 建立表空间
CREATE VIEW 建立视图
CREATE SEQUENCE 建立序列
CREATE USER 建立用户

系统权限是指执行特定类型SQL命令的权利,用于控制用户可以执行的一个或一类数据库操作。(新建用户没有任何权限)

(1)授予系统权限

GRANT CREATE SESSIONCREATE TABLE TO smith; GRANT CREATE SESSION TO smith WITH ADMIN OPTION;

选项:ADMIN OPTION 使该用户具有转授系统权限的权限。

(2)显示系统权限

查看所有系统权限:

system_privilege_map

显示用户所具有的系统权限:

dba_sys_privis

显示当前用户所具有的系统权限:

user_sys_privis

显示当前会话所具有的系统权限:

session_privis

(3)收回系统权限

REVOKE CREATE TABLE FROM smith; REVOKE CREATE SESSION FROM smith;

3.角色是一组相关权限的命名集合,使用角色最主要的目的是简化权限管理。

预定义角色。

ØCONNECT 自动建立,包含以下权限:ALTER SESSIONCREATE CLUSTERCREATE DATABASE LINKCREATE SEQUENCECREATE SESSIONCREATE SYNONYMCREATE TABLECREATE VIEW

RESOURCE 自动建立,包含以下权限:CREATE CLUSTERCREATE PROCEDURECREATE SEQUENCECREATE TABLECREATE TRIGGR

Ø显示角色信息,

§ROLE_SYS_PRIVS

§ROLE_TAB_PRIVS

§ROLE_ROLE_PRIVS

§SESSION_ROLES

§USER_ROLE_PRIVS

§DBA_ROLES

4.Oracle用户角色

每个Oracle用户都有一个名字和口令,并拥有一些由其创建的表、视图和其他资源。Oracle角色(role)就是一组权限(privilege)(或者是每个用户根据其状态和条件所需的访问类型)。用户可以给角色授予或赋予指定的权限,然后将角色赋给相应的用户。一个用户也可以直接给其他用户授权。

数据库系统权限(Database System Privilege)允许用户执行特定的命令集。例如,CREATE TABLE权限允许用户创建表,GRANTANY PRIVILEGE权限允许用户授予任何系统权限。

数据库对象权限(Database Object Privilege)使得用户能够对各个对象进行某些操作。例如DELETE权限允许用户删除表或视图的行,SELECT权限允许用户通过select从 表、视图、序列(sequences)或快照 (snapshots)中查询信息。

一、创建用户

Oracle内部有两个建好的用户:SYSTEM和SYS。用户可直接登录到SYSTEM用户以创建其他用户,因为SYSTEM具有创建别的用户的权限。在安装Oracle时,用户或系统管理员首先可以为自己建立一个用户。例如:

create user user01 identified by u01;

   该命令还可以用来设置其他权限,详细情况参见自学资料。要改变一个口令,可以使用alter user命令:

alter user user01 identified by usr01;

   现在user01的口令已由“u01”改为“usr01”。

   除了alter user命令以外,用户还可以使用password命令。如果使用password命令,用户输入的新口令将不在屏幕上显示。有dba特权的用户可以通过password命令改变任何其他用户的口令;其他用户只能改变自己的口令。

   当用户输入password命令时,系统将提示用户输入旧口令和新口令,如下所示:

password

   Changing password for user01

   Old password:

   New password:

   Retype new password:

   当成功地修改了口令时,用户会得到如下的反馈:

   Password changed

、删除用户

   删除用户,可以使用drop user命令,如下所示:

drop user user01;

如果用户拥有对象,则不能直接删除,否则将返回一个错误值。指定关键字CASCADE,可删除用户所有的对象,然后再删除用户。下面的例子用来删除用户与其对象:

drop user user01 CASCADE;

、3种标准角色

   Qracle为了兼容以前的版本,提供了三种标准的角色(role):CONNECT、RESOURCE和DBA。

1. CONNECT Role(连接角色)

   临时用户,特别是那些不需要建表的用户,通常只赋予他们CONNECTrole。CONNECT是使用Oracle的简单权限,这种权限只有在对其他用户 的表有访问权时,包括select、insert、update和delete等,才会变得有意义。拥有CONNECT role的用户还能够创建表、视图、序列(sequence)、簇(cluster)、同义词(synonym )、会话(session)和与其他数据库的链(link)。

2. RESOURCE Role(资源角色)

   更可靠和正式的数据库用户可以授予RESOURCE role。RESOURCE提供给用户另外的权限以创建他们自己的表、序列、过程(procedure)、触发器(trigger)、索引(index)和簇(cluster)。

3. DBA Role(数据库管理员角色)

   DBA role拥有所有的系统权限—-包括无限制的空间限额和给其他用户授予各种权限的能力。SYSTEM由DBA用户拥有。下面介绍一些DBA经常使用的典型权限。

  (1)grant(授权)命令

   下面对刚才创建的用户user01授权,命令如下:

grant connect, resource to user01;

  (2)revoke(撤消)权限

   已授予的权限可以撤消。例如撤消(1)中的授权,命令如下:

    revoke connect, resource from user01;

一个具有DBA角色的用户可以撤消任何别的用户甚至别的DBA的CONNECT、RESOURCE 和DBA的其他权限。当然,这样是很危险的,因此,除非真正需要,DBA权限不应随便授予那些不是很重要的一般用户。

   撤消一个用户的所有权限,并不意味着从Oracle中删除了这个用户,也不会破坏用户创建的任何表;只是简单禁止其对这些表的访问。其他要访问这些表的用户可以象以前那样地访问这些表。

四、创建角色

  除了前面讲到的三种系统角色—-CONNECT、RESOURCE和DBA,用户还可以在Oracle创建自己的role。用户创建的role可以由 表或系统权限或两者的组合构成。为了创建role,用户必须具有CREATE ROLE系统权限。下面给出一个create role命令的实例:

create role STUDENT;

   这条命令创建了一个名为STUDENT的role。

   一旦创建了一个role,用户就可以给他授权。给role授权的grant命令的语法与对对用户的语法相同。在给role授权时,在grant命令的to子句中要使用role的名称,如下所示:

grant select on CLASS to STUDENT;

现在,拥有STUDENT角色的所有用户都具有对CLASS表的select权限。

五、删除角色

  要删除角色,可以使用drop role命令,如下所示:

drop role STUDENT;

指定的role连同与之相关的权限将从数据库中全部删除。

 

5.oracle sys system 用户的区别

     sys是Oracle数据库中权限最高的帐号,具有create database的权限,
而system没有这个权限,sys的角色是sysdba,system的角色是sysoper。其余就是他们两个用户共有的权限了:
startup/shutdown/dba两个用户都是可以管理的。平时用system来管理数据库就可以了。这个用户的权限对于普通的数据库管理来说已经足够权限了

The differences between DDL and DML in database(SQL)


DDL
Data Definition Language (DDL) statements are used to define the database structure or schema. Some examples:

  • CREATE – to create objects in the database
  • ALTER – alters the structure of the database
  • DROP – delete objects from the database
  • TRUNCATE – remove all records from a table, including all spaces allocated for the records are removed
  • COMMENT – add comments to the data dictionary
  • RENAME – rename an object

DML
Data Manipulation Language (DML) statements are used for managing data within schema objects. Some examples:

  • SELECT – retrieve data from the a database
  • INSERT – insert data into a table
  • UPDATE – updates existing data within a table
  • DELETE – deletes all records from a table, the space for the records remain
  • MERGE – UPSERT operation (insert or update)
  • CALL – call a PL/SQL or Java subprogram
  • EXPLAIN PLAN – explain access path to data
  • LOCK TABLE – control concurrency

How to install .bin file in Linux/Unix/


In order to  install *.bin file,

first you need to  open your Terminal/bash window:

1st step : use”file” command to confirm whether it is executable or non-executable:

i.e :     file  /path/file.bin

lets take Adobe Reader for example, 

file /Downloads/AdbeRdr9.4.2-1_i486linux_enu.bin (file is the command)

Now you should see a sentence including the word “executable” and not “non-executable, not executable,… or something completely different)

After I enter the command:  file /Downloads/AdbeRdr9.4.2-1_i486linux_enu.bin

it will display:  ########################################################################### [dbastudent@192-168-1-134 Downloads]$ file AdbeRdr9.4.2-1_i486linux_enu.bin AdbeRdr9.4.2-1_i486linux_enu.bin: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV),  dynamically linked (uses shared libs), for GNU/Linux 2.2.5, stripped ######################################################################### If you do not see “executable,…)” the file is probably an cd-image(BIN/CUE) and not an executable .bin-file

2nd Step :

Now enter: chmod +x file.bin

E.G:  chmod +x AdbeRdr9.4.2-1_i486linux_enu.bin  (chmod +x  is the command to give permission to execute this file)

No path! Just the name of the file!!! Now the file is executable…

Last step: Type:        /path/file.bin

take AdobeReader for example it will prompt the following command,

then type the path name where you would like to install:

Enter installation directory for Adobe Reader 9.4.2 [/opt] home/dbastudent/AdobeReader/

That ‘s all . Hopes to help you .

Usability engineering UX techniques


There are various UX techniques , today I will introduce some of UX techniques which include both strengths and weaknesses.

Part1 . About User Research:

1.Context inquiry

Context inquiry is to observe user’s behavior as User carry out every tasks. and follow up the user.

The time will last 3-5 days ,normal about 90 minutes sessions.

Advantages: 1.  The data is very rich;

2. reduce the risk of self-reporting bias;

Disadvantages: 1. Observer’s bias

2. time consuming

3. not practical.

2. Diary Studies

Diary studies is about that users normally record events on a particular topic by using paper-diary, voice- recording,photos or mobile phone

Advantages:  1. rich data;

2.gain deep insight into user’s behavior

3.data is contextual.

Disadvantages: 1. time consuming,     2.Risk of self-reporting bias   3 User not reporting, 4 User not complete the tasks.

3.Interviews:

Interviews conducted one to one with users;

lasts about 45-90 minutes;

normally use open questions to avoid leading or biasing

and use close questions to zoom in finer details.

Advantages: 1. easy and quick to execute.

2. can talke a large number of users in a relatviely short time.

Disadvantages:1. data is not rich, 2. highly risk of self-reporting bias,

4. Focus group:

normally about 6-10 users grouped into a discussion workshop.

a series of group interviews. DETERMINE USER PRIORITIES,more often in market research,not often in User research

last 1-2 hours.

Advantages: can talk a large amount of people very quickly. 2.good for preferences,options ,trends.

Disadvantages: not good for task analysis,,2 big risk of self-reporting bias,3 need strong facilitators.

5. Log analysis.

Review  site’s analytics to determine items such as user’s path ways, search area;

Log analysis is an early analysis ahead of other UX work.

When budget does not allow any face to face tasks, it will provide an alternative solution.

Advantages: Insight into user behaviors. Disadvantages:1.Tell the what but not the why.

6. Survey/ Questionnaires:

Normally online survey of users.

Total 4-8 days.

When there is a requirement of quantitative data( validate qualitative findings)

To evaluate user’s satisfaction before redesign.

Ad: quick way of gathering quantitative data.

DisAdvantages: risk of users ‘misreport’ their actions and emotions.

Part 2.

Design Research:

1. Card Sorting: includes open card sorting: develop categories,  close card sorting: check categories.

Actually card sorting is about gathering data, and categorize the data into subgroups. and then labeling

a name for that groups. this is very useful for Information Architecture(I.A),which is to structure the design

of information to aid task completion (Alphabetical,(dictionary),Chronological(events,calendar),Geographical(travel,)

time: Total lasts 6-7 days

Card sorting is mainly used to test Information Architecture.

Use close sort to testing current IA, and use Open sort to generate a new IA.

Advantages: quick and Cheap

Disadvantages: ISN’T task based.

2.Competitive analysis

Competitive analysis is to identify the strengths and weaknesses of competitor’s products or services before starting work on

prototypes.

why copies can fail:

The specific UI element you are copying is not that good .

The design works fine in the original but may not good in your context.

Part 3. Design Research:

There are two design research I will introduce below,which are Information Architecture and Interaction Design.

1. Information Architecture: (I.A)  The structural design of information to aid user tasks completion and access to the content.

Alphabetical, Chronological, Geographical.

2. I.D: interaction design: is about the communication between people, or about the communication between human and machine.

The system, service or tool that must meet the needs of people by supporting activities(what they trying to do) and contexts(the operation environment).

Part 4. Evaluations:

There are several evaluation methods: Heuristics evaluations( i.e NIELSEN’S 10 principles), Usability testing(Prototyping,Accessibility usability test, IA testing, Eye tracking), Expert Review, Controlled Experiment(a/b testing,live testing),Card sorting.

Heuristic Evaluations: normally use guidelines to identify usability issues of given web site:

normally we are following Nielsen ‘s 10 principles:

1. the visibility of system status,(let the user’s know what the system’ are doing, and the status of the system)

2 match between system and real world ( following the real world conventions)

3.User feel control and freedom ( undo, redo, if some errors occur,they can click the exit button)

4. Error prevention( a careful design which will try best on avoiding errors)

5.Consistency and standard( user does not need to know different words has the same meaning)

6.Recognition rather than recall( should provide user a easy manner to operate, like more steps,minimize the memory load by making objects)

7.Flexibility and Efficienty(Accelerators,should provide functions for both inexperienced and experienced user),shortcuts for keyboard)

8.Aesthetic and minimalist design

9.Help and documentation

10.Error messages help user to recover(good error messages help the user to resolve the problems,and understand the system)

Remote testing(online tasks studies),

1. One is Moderated Remote testing( Qualitative data)

2. The other is Automated Remote testing(Quantitative data)

Advantages: Time aware research,2 Geographic diversity,3 ability to test anywhere,4, quicker to set up test

Disadvantages: Cannot watch participants in real time and ask questions

2. cannot conduct interview-based tasks

3.what people write in report can be very different to what they do.

Controlled Experiments:

It is actually to control practical values to compare each other, and identify the differences between them.

A/B testing

Live Testing.

Summary :

How to choose the right method

We will use an scenario based situation to compare these methods to check the suitable areas:

Situation: concept stage:

EXPENSIVE: Diary Study

Cheap:   Focus group, competitor analysis

Situation: user research

EXPENSIVE: Diary study

Cheap: Contextual inquiry, desk research(log analysis)

Situation: design

Expensive: DESIGN WITH USERS — paper- prototyping

Cheap: walkthrough prototype with stakeholders

Situation: building

Expensive: usability testing(work with users,)

Cheap: Card sorting(IA must be decided)

Situation: we are not sure it’s working(already built)

Expensive:usability testing

Cheap: Expert review, log analysis, accessibility testing,surveys,questionaires.