-
nfs server and client configuration - [康朴塔散思]
2008-12-18
On server:
/etc/exports
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes hostname1(rw,sync) hostname2(ro,sync)
#
# Example for NFSv4:
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt)
# /srv/nfs4/homes gss/krb5i(rw,sync)
#/the_whole_path_on_server x.x.x.x(rw,async)
x.x.x.x is the allowed client, then restart portmap and nfs server
On client:
sudo mount -t nfs y.y.y.y:/the_whole_path_on_server /the_whole_path_on_client
y.y.y.y is the nfs server's address
umount /the_whole_path_on_client
====================================================================
http://www.troubleshooters.com/linux/nfs.htm
Generally speaking, the permissions on the server don't affect the mounting or unmounting of the NFS share. But they very much affect whether such a share can be seen, executed, read or written. Often the cause is obvious. If the directory is owned by root, permissioned 700, it obviously can't be read and written by user myself. This type of problem is easy to diagnose and fix.
-
http://www.cplusplus.com/reference/clibrary/cstdio/sscanf.html
Format specifiers: A sequence formed by an initial percentage sign (%) indicates a format specifier, which is used to specify the type and format of the data to be retrieved from the str string and stored in the locations pointed by the additional arguments. A format specifier follows this prototype:
[=%[*][width][modifiers]type=]
where:
* An optional starting asterisk indicates that the data is to be retrieved from the str string but ignored, i.e. it is not stored in the corresponding argument. width Specifies the maximum number of characters to be read in the current reading operation modifiers Specifies a size different from int (in the case of d, i and n), unsigned int (in the case of o, u and x) or float (in the case of e, f and g) for the data pointed by the corresponding additional argument:
h : short int (for d, i and n), or unsigned short int (for o, u and x)
l : long int (for d, i and n), or unsigned long int (for o, u and x), or double (for e, f and g)
L : long double (for e, f and g)type A character specifying the type of data to be read and how it is expected to be read. See next table. -
The Linux Socket Filter: Sniffing Bytes over the Network - [康朴塔散思]
2008-12-07
-
http://www.linuxgem.org/posts/6524
稍微改动了一下
1 #!/bin/bash 2 # sort according to the length of the word 3 # 1.print the length before the word 4 # 2.sort the 1st column according to number 5 # 3.replace the first number with null 6 7 awk 'BEGIN { FS=RS } { print length, $0}' $* | sort -k1n | sed 's/^[0-9][0-9]* //' -
小资 or 文艺 or 土企鹅 - [锕忑]
2008-12-02
秦老师一贯的外交辞令再次为我这个不成熟的半成年人介绍了一个乐队,名字叫Guns N' Roses
和他们的新专辑,叫Chinese Democracy,哦~~~~好拉风的名字~~~~好嘈杂的音乐~~~~~
由此又认识了一个叫周云蓬的歌手,和他的专辑,叫中国孩子
然后又认识了一个台湾原住民叫胡德夫歌手的歌,怎么先打出“德芙”了,汗,他的《匆匆》听来听去就那么两个字,我实在是和小资们文青们有本质的差距,他们为什么能对这样乏味的歌曲写出如此高水准的评论呢?他的北京演出票价为三档,1000,1100,1200,恩,台湾人民果然均富啊。我不得不再次说出我的俗,我就是冲着那1200元去下载来听的。

我是一只土企鹅,我听不懂他们的歌,我还是喜欢在旅行的长途车上听司机们放《水中的月亮》,陌生的环境,给我安宁。
-
Stay curious! What does “> /dev/null 2>&1″ mean? - [康朴塔散思]
2008-12-02
http://www.xaprb.com/blog/2006/06/06/what-does-devnull-21-mean/
Here’s an example command:
wibble > /dev/null 2>&1
Output redirection
The greater-thans (
>) in commands like these redirect the program’s output somewhere. In this case, something is being redirected into/dev/null, and something is being redirected into&1.Standard in, out, and error
There are three standard sources of input and output for a program. Standard input usually comes from the keyboard if it’s an interactive program, or from another program if it’s processing the other program’s output. The program usually prints to standard output, and sometimes prints to standard error. These three file descriptors (you can think of them as “data pipes”) are often called STDIN, STDOUT, and STDERR.
Sometimes they’re not named, they’re numbered! The built-in numberings for them are 0, 1, and 2, in that order. By default, if you don’t name or number one explicitly, you’re talking about STDOUT.
Given that context, you can see the command above is redirecting standard output into
/dev/null, which is a place you can dump anything you don’t want (often called the bit-bucket), then redirecting standard error into standard output (you have to put an&in front of the destination when you do this).The short explanation, therefore, is “all output from this command should be shoved into a black hole.” That’s one good way to make a program be really quiet!
-
预防颈椎病,从看图做起 - [黑尔思]
2008-11-23
-
http://en.wikipedia.org/wiki/HTTP_302
The HTTP response status code 302 Found is the most common way of performing a redirection.
It is an example of industrial practice contradicting the standard. HTTP/1.0 specification (RFC 1945) required the client to perform a temporary redirect (the original describing phrase was "Moved Temporarily"), but popular browsers implemented it as a 303 See Other. Therefore, HTTP/1.1 added status codes 303 and 307 to disambiguate between the two behaviours. However, the majority of Web applications and frameworks still use the 302 status code as if it were the 303.
This status code should be used with the location header.
Example
GET /index.html HTTP/1.1
Host: www.example.comHTTP/1.1 302 Found
Location: http://www.wikipedia.org/index.php -
FTP data format - [康朴塔散思]
2008-11-12
http://en.wikipedia.org/wiki/File_Transfer_Protocol#Data_format
Data format
While transferring data over the network, several data representations can be used. The two most common transfer modes are:
- ASCII mode
- Binary mode: In "Binary mode", the sending machine sends each file byte for byte and as such the recipient stores the bytestream as it receives it. (The FTP standard calls this "IMAGE" or "I" mode)
In "ASCII mode", any form of data that is not plain text will be corrupted. When a file is sent using an ASCII-type transfer, the individual letters, numbers, and characters are sent using their ASCII character codes. The receiving machine saves these in a text file in the appropriate format (for example, a Unix machine saves it in a Unix format, a Windows machine saves it in a Windows format). Hence if an ASCII transfer is used it can be assumed plain text is sent, which is stored by the receiving computer in its own format. Translating between text formats might entail substituting the end of line and end of file characters used on the source platform with those on the destination platform, e.g. a Windows machine receiving a file from a Unix machine will replace the line feeds with carriage return-line feed pairs. It might also involve translating characters; for example, when transferring from an IBM mainframe to a system using ASCII, EBCDIC characters used on the mainframe will be translated to their ASCII equivalents, and when transferring from the system using ASCII to the mainframe, ASCII characters will be translated to their EBCDIC equivalents.
By default, most FTP clients use ASCII mode. Some clients try to determine the required transfer-mode by inspecting the file's name or contents, or by determining whether the server is running an operating system with the same text file format.
The FTP specifications also list the following transfer modes:
- EBCDIC mode - this transfers bytes, except they are encoded in EBCDIC rather than ASCII. Thus, for example, the ASCII mode server
- Local mode - this is designed for use with systems that are word-oriented rather than byte-oriented. For example mode "L 36" can be used to transfer binary data between two 36-bit machines. In L mode, the words are packed into bytes rather than being padded. Given the predominance of byte-oriented hardware nowadays, this mode is rarely used. However, some FTP servers accept "L 8" as being equivalent to "I".
In practice, these additional transfer modes are rarely used. They are however still used by some legacy mainframe systems.
The text (ASCII/EBCDIC) modes can also be qualified with the type of carriage control used (e.g. TELNET NVT carriage control, ASA carriage control), although that is rarely used nowadays.
Note that the terminology "mode" is technically incorrect, although commonly used by FTP clients. "MODE" in RFC 959 refers to the format of the protocol data stream (STREAM, BLOCK or COMPRESSED), as opposed to the format of the underlying file. What is commonly called "mode" is actually the "TYPE", which specifies the format of the file rather than the data stream. FTP also supports specification of the file structure ("STRU"), which can be either FILE (stream-oriented files), RECORD (record-oriented files) or PAGE (special type designed for use with TENEX). PAGE STRU is not really useful for non-TENEX systems, and RFC1123 section 4.1.2.3 recommends that it not be implemented.












