Montag, 31. Mai 2010

kernel : access to userspace : __user

access to userspace : __user

quoted from Professional Linux Kernel Architecture , page 27 by Wolfgang Mauerer:

1. The kernel uses __user to identify pointers to areas in user address space that may not be de-referenced without further precautions.

2. This is because memory is mapped via page tables into the userspave portion of the virtual address space and not directly mapped by physical memory.

3. Therefore the kernel needs to ensure that the page frame in RAM that backs the destination is actually present.

4. Explicity labeling supports the use of an automatic checker tool ( sparse) to ensure that this requirement is observed in practice.



Samstag, 29. Mai 2010

kobject.txt by Greg Kroah-Hartman

Everything you never wanted to know about kobjects, ksets, and ktypes
2
3 Greg Kroah-Hartman
4
5 Based on an original article by Jon Corbet for lwn.net written October 1,2003 and located at http://lwn.net/Articles/51437/
7
8 Last updated December 19, 2007
9
10
11 Part of the difficulty in understanding the driver model - and the kobject abstraction upon which it is built - is that there is no obvious starting place.

Dealing with kobjects requires understanding a few different types, all of which make reference to each other. In an attempt to make things
easier, we'll take a multi-pass approach, starting with vague terms and adding detail as we go.

To that end, here are some quick definitions of
some terms we will be working with.

- A kobject is an object of type struct kobject. Kobjects have a name and a reference count.

A kobject also has a parent pointer (allowing
objects to be arranged into hierarchies), a specific type, and, usually, a representation in the sysfs virtual filesystem.

Kobjects are generally not interesting on their own; instead, they are usually embedded within some other structure which contains the stuff the code is really interested in.

No structure should EVER have more than one kobject embedded within it.

If it does, the reference counting for the object is sure to be messed up and incorrect, and your code will be buggy. So do not do this.

- A ktype is the type of object that embeds a kobject. Every structure that embeds a kobject needs a corresponding ktype. The ktype controls what happens to the kobject when it is created and destroyed.

- A kset is a group of kobjects. These kobjects can be of the same ktype or belong to different ktypes.

The kset is the basic container type for collections of kobjects. Ksets contain their own kobjects, but you can safely ignore that implementation detail as the kset core code handles this kobject automatically.

When you see a sysfs directory full of other directories, generally each of those directories corresponds to a kobject in the same kset.

We'll look at how to create and manipulate all of these types. A bottom-up approach will be taken, so we'll go back to kobjects.

Embedding kobjects

It is rare for kernel code to create a standalone kobject, with one major exception explained below.

Instead, kobjects are used to control access to
a larger, domain-specific object. To this end, kobjects will be found embedded in other structures.

If you are used to thinking of things in
object-oriented terms, kobjects can be seen as a top-level, abstract class from which other classes are derived.
A kobject implements a set of capabilities which are not particularly useful by themselves, but which are nice to have in other objects. The C language does not allow for the direct expression of inheritance, so other techniques - such as structure embedding - must be used.

So, for example, the UIO code has a structure that defines the memory region associated with a uio device:
64
65 struct uio_mem {
66 struct kobject kobj;
67 unsigned long addr;
68 unsigned long size;
69 int memtype;
70 void __iomem *internal_addr;
71 };

If you have a struct uio_mem structure, finding its embedded kobject is just a matter of using the kobj member.

Code that works with kobjects will often have the opposite problem, however: given a struct kobject pointer, what is the pointer to the containing structure?

You must avoid tricks (such as assuming that the kobject is at the beginning of the structure)
and, instead, use the container_of() macro, found in :

80 container_of(pointer, type, member)
81
where pointer is the pointer to the embedded kobject, type is the type of the containing structure, and member is the name of the structure field to which pointer points.

The return value from container_of() is a pointer to the given type. So, for example, a pointer "kp" to a struct kobject embedded within a struct uio_mem could be converted to a pointer to the
containing uio_mem structure with:
88
89 struct uio_mem *u_mem = container_of(kp, struct uio_mem, kobj);
90
Programmers often define a simple macro for "back-casting" kobject pointers to the containing type.


Initialization of kobjects

Code which creates a kobject must, of course, initialize that object. Some of the internal fields are setup with a (mandatory) call to kobject_init():

100 void kobject_init(struct kobject *kobj, struct kobj_type *ktype);

The ktype is required for a kobject to be created properly, as every kobject must have an associated kobj_type. After calling kobject_init(), to register the kobject with sysfs, the function kobject_add() must be called:

106 int kobject_add(struct kobject *kobj, struct kobject *parent, const char *fmt, ...);

This sets up the parent of the kobject and the name for the kobject properly. If the kobject is to be associated with a specific kset,
kobj->kset must be assigned before calling kobject_add().

If a kset is associated with a kobject, then the parent for the kobject can be set to NULL in the call to kobject_add() and then the kobject's parent will be the kset itself.

As the name of the kobject is set when it is added to the kernel, the name of the kobject should never be manipulated directly. If you must change the name of the kobject, call kobject_rename():


119 int kobject_rename(struct kobject *kobj, const char *new_name);

kobject_rename does not perform any locking or have a solid notion of what names are valid so the caller must provide their own sanity checking
and serialization.

There is a function called kobject_set_name() but that is legacy cruft and is being removed. If your code needs to call this function, it is
incorrect and needs to be fixed.

To properly access the name of the kobject, use the function
130 kobject_name():

const char *kobject_name(const struct kobject * kobj);

There is a helper function to both initialize and add the kobject to the kernel at the same time, called surprisingly enough kobject_init_and_add():

137 int kobject_init_and_add(struct kobject *kobj, struct kobj_type *ktype,

struct kobject *parent, const char *fmt, ...);

The arguments are the same as the individual kobject_init() and kobject_add() functions described above.


Uevents

After a kobject has been registered with the kobject core, you need to announce to the world that it has been created. This can be done with a call to kobject_uevent():

150 int kobject_uevent(struct kobject *kobj, enum kobject_action action);

Use the KOBJ_ADD action for when the kobject is first added to the kernel.

This should be done only after any attributes or children of the kobject have been initialized properly, as userspace will instantly start to look for them when this call happens.

When the kobject is removed from the kernel (details on how to do that is below), the uevent for KOBJ_REMOVE will be automatically created by the kobject core, so the caller does not have to worry about doing that by hand.


Reference counts

One of the key functions of a kobject is to serve as a reference counter for the object in which it is embedded.

As long as references to the object exist, the object (and the code which supports it) must continue to exist.

The low-level functions for manipulating a kobject's reference counts are:

struct kobject *kobject_get(struct kobject *kobj);

void kobject_put(struct kobject *kobj);

A successful call to kobject_get() will increment the kobject's reference counter and return the pointer to the kobject.

When a reference is released, the call to kobject_put() will decrement the reference count and, possibly, free the object.
Note that kobject_init() sets the reference count to one, so the code which sets up the kobject will need to do a kobject_put() eventually to release that reference.

Because kobjects are dynamic, they must not be declared statically or on the stack, but instead, always allocated dynamically.

Future versions of the kernel will contain a run-time check for kobjects that are created statically and will warn the developer of this improper usage.

If all that you want to use a kobject for is to provide a reference counter for your structure, please use the struct kref instead; a kobject would be overkill.

For more information on how to use struct kref, please see the file Documentation/kref.txt in the Linux kernel source tree.


Creating "simple" kobjects

Sometimes all that a developer wants is a way to create a simple directory in the sysfs hierarchy, and not have to mess with the whole complication of ksets, show and store functions, and other details.

This is the one exception where a single kobject should be created.

To create such an entry, use the function:

struct kobject *kobject_create_and_add(char *name, struct kobject *parent);

This function will create a kobject and place it in sysfs in the location underneath the specified parent kobject.

To create simple attributes associated with this kobject, use:

int sysfs_create_file(struct kobject *kobj, struct attribute *attr);

or
int sysfs_create_group(struct kobject *kobj, struct attribute_group *grp);

Both types of attributes used here, with a kobject that has been created with the kobject_create_and_add(), can be of type kobj_attribute, so no special custom attribute is needed to be created.

See the example module, samples/kobject/kobject-example.c for an implementation of a simple kobject and attributes.



ktypes and release methods

One important thing still missing from the discussion is what happens to a kobject when its reference count reaches zero.

The code which created the kobject generally does not know when that will happen; if it did, there
would be little point in using a kobject in the first place.

Even predictable object lifecycles become more complicated when sysfs is brought in as other portions of the kernel can get a reference on any kobject that is registered in the system.

The end result is that a structure protected by a kobject cannot be freed before its reference count goes to zero.

The reference count is not under the direct control of the code which created the kobject. So that code must be notified asynchronously whenever the last reference to one of its
kobjects goes away.

Once you registered your kobject via kobject_add(), you must never use kfree() to free it directly. The only safe way is to use kobject_put().

It is good practice to always use kobject_put() after kobject_init() to avoid errors creeping in.

This notification is done through a kobject's release() method. Usually such a method has a form like:

void my_object_release(struct kobject *kobj)
{
struct my_object *mine = container_of(kobj, struct my_object, kobj);

/* Perform any additional cleanup on this object, then... */
kfree(mine);

}

One important point cannot be overstated: every kobject must have a release() method, and the kobject must persist (in a consistent state)
until that method is called.

If these constraints are not met, the code is
flawed. Note that the kernel will warn you if you forget to provide a release() method.

Do not try to get rid of this warning by providing an " empty" release function; you will be mocked mercilessly by the kobject maintainer if you attempt this.

Note, the name of the kobject is available in the release function, but it must NOT be changed within this callback. Otherwise there will be a memory leak in the kobject core, which makes people unhappy.

Interestingly, the release() method is not stored in the kobject itself; instead, it is associated with the ktype.

So let us introduce struct kobj_type:

struct kobj_type {
void (*release)(struct kobject *);
struct sysfs_ops *sysfs_ops;
struct attribute **default_attrs;
};

This structure is used to describe a particular type of kobject (or, more correctly, of containing object).

Every kobject needs to have an associated
kobj_type structure; a pointer to that structure must be specified when you call kobject_init() or kobject_init_and_add().

The release field in struct kobj_type is, of course, a pointer to the release() method for this type of kobject. The other two fields (sysfs_ops and default_attrs ) control how objects of this type are represented in sysfs; they are beyond the scope of this document.

The default_attrs pointer is a list of default attributes that will be automatically created for any kobject that is registered with this ktype.


ksets

A kset is merely a collection of kobjects that want to be associated with each other. There is no restriction that they be of the same ktype, but be very careful if they are not.

A kset serves these functions:

- It serves as a bag containing a group of objects. A kset can be used by the kernel to track "all block devices" or "all PCI device drivers."

- A kset is also a subdirectory in sysfs, where the associated kobjects with the kset can show up. Every kset contains a kobject which can be set up to be the parent of other kobjects; the top-level directories of the sysfs hierarchy are constructed in this way.

- Ksets can support the "hotplugging" of objects and influence how uevent events are reported to user space.

In object-oriented terms, "kset" is the top-level container class; ksets contain their own kobject, but that kobject is managed by the kset code and
should not be manipulated by any other user.

A kset keeps its children in a standard kernel linked list. Kobjects point back to their containing kset via their kset field. In almost all cases, the kobjects belonging to a kset have that kset (or, strictly, its embedded kobject) in their parent.

As a kset contains a kobject within it, it should always be dynamically created and never declared statically or on the stack.

To create a new kset use:

struct kset *kset_create_and_add(const char
*name,
struct kset_uevent_ops *u,
struct kobject *parent);

When you are finished with the kset, call:
void kset_unregister(struct kset *kset);
to destroy it.

An example of using a kset can be seen in the
samples/kobject/kset-example.c file in the kernel tree.

If a kset wishes to control the uevent operations of the kobjects associated with it, it can use the struct kset_uevent_ops to handle it:

struct kset_uevent_ops {

int (*filter)(struct kset *kset, struct kobject *kobj);
const char *(*name)(struct kset *kset, struct kobject *kobj);
int (*uevent)(struct kset *kset, struct kobject *kobj, struct kobj_uevent_env *env);

};

The filter function allows a kset to prevent a uevent from being emitted to userspace for a specific kobject. If the function returns 0, the uevent will not be emitted.

The name function will be called to override the default name of the kset that the uevent sends to userspace.

By default, the name will be the same as the kset itself, but this function, if present, can override that name.

The uevent function will be called when the uevent is about to be sent to userspace to allow more environment variables to be added to the uevent.

One might ask how, exactly, a kobject is added to a kset, given that no functions which perform that function have been presented. The answer is
that this task is handled by kobject_add().

When a kobject is passed to kobject_add(), its kset member should point to the kset to which the
kobject will belong. kobject_add() will handle the rest.

If the kobject belonging to a kset has no parent kobject set, it will be added to the kset's directory.

Not all members of a kset do necessarily live in the kset directory. If an explicit parent kobject is assigned before the kobject is added, the kobject is registered with the kset, but added below the parent kobject.


Kobject removal

After a kobject has been registered with the kobject core successfully, it must be cleaned up when the code is finished with it.

To do that, call kobject_put(). By doing this, the kobject core will automatically clean up all of the memory allocated by this kobject.

If a KOBJ_ADD uevent has been sent for the object, a corresponding KOBJ_REMOVE uevent will be sent, and any other sysfs housekeeping will be handled for the caller properly.

If you need to do a two-stage delete of the kobject (say you are not allowed to sleep when you need to destroy the object), then call
kobject_del() which will unregister the kobject from sysfs.

This makes the kobject "invisible", but it is not cleaned up, and the reference count of the object is still the same.

At a later time call kobject_put() to finish
the cleanup of the memory associated with the kobject.


kobject_del() can be used to drop the reference to the parent object, if circular references are constructed.

It is valid in some cases, that a parent objects references a child.

Circular references _must_ be broken with an explicit call to kobject_del(), so that a release functions will be called, and the objects in the former circle release each other.


Example code to copy from

For a more complete example of using ksets and kobjects properly, see the

sample/kobject/kset-example.c code.

Dienstag, 25. Mai 2010

ext2 and inode overview

富士康第 11跳( 2010-05-26 )
http://hk.dv.nextmedia.com/template/dv_channel/index.php?fuseaction=dv15.player&mode=section&id=15335&sort=promo&range=d&dv_iss=20100526&iss_id=20100526&sec_id=15335&art_id=14068831&av_id=14069388&page=1

ext2 and inode overview

1. Ext2 is based on inodes, ie, it makes a separate management structure known as an inode available on disk for each file.

2. The inode contains not only all meta-information but also pointers to the associated date blocks.

3. Hierarchical structures are set up by representing directories as regular files whose data section includes pointers to the inodes of all files contained in the directory.



Montag, 24. Mai 2010

Greg Kroah Hartman on the Linux Kernel

Greg Kroah Hartman on the Linux Kernel

http://www.youtube.com/watch?v=L2SED6sewRw&feature=related

ABSTRACT

The Linux Kernel, who is developing it, how they are doing it,
and why you should care.

This talk describes the rate of development for the Linux
kernel, and how the development model is set up to handle such a
large and diverse developer population and huge rate of change.

It will detail who is doing the work, and what companies, if
any, are sponsering it.

Finally, it will go into why companies like Google, and any other that uses or depends on Linux, should care about this development. Lots of numbers and pretty graphs will be shown to keep the audience awake.

Speaker: Greg Kroah Hartman

Greg Kroah-Hartman is a Linux kernel maintainer for the USB,
driver core, sysfs, and debugfs portions of the kernel as well
as being one half of the -stable kernel release team.

He currently works for Novell as a Fellow doing various kernel
related things and has written a few books from O'Reilly about
Linux development in the past.

EE4209/EE5809 Digital Audio Technology

Speex: A Free Codec For Free Speech

http://www.speex.org/
Speex: A Free Codec For Free Speech

有冇人讀過 ee4209/ee5809 想搵人幫下手

Speex is an Open Source/Free Software patent-free audio compression format designed for speech.

The Speex Project aims to lower the barrier of entry for voice applications by providing a free alternative to expensive proprietary speech codecs.

Moreover, Speex is well-adapted to Internet applications and provides useful features that are not present in most other codecs. Finally, Speex is part of the GNU Project and is available under the revised BSD license.

http://en.wikipedia.org/wiki/Speex

Unlike many other speech codecs, Speex is not targeted at cellular telephony but rather at Voice over IP (VoIP) and file-based compression.

The design goals have been to make a codec that would be optimized for high quality speech and low bit rate.

To achieve this the codec uses multiple bit rates, and supports ultra-wideband (32 kHz sampling rate), wideband (16 kHz sampling rate) and narrowband (telephone quality, 8 kHz sampling rate).

Since Speex was designed for Voice over IP (VoIP) instead of cell phone use, the codec must be robust to lost packets, but not to corrupted ones.

All this led to the choice of Code Excited Linear Prediction (CELP) as the encoding technique to use for Speex.[6] One of the main reasons is that CELP has long proven that it could do the job and scale well to both low bit rates (as evidenced by DoD CELP @ 4.8 kbit/s) and high bit rates (as with G.728 @ 16 kbit/s).

歐洲示威大家見得多,究竟人地係點組織出黎,大家可以睇睇。好詳細,好好用,有d 香港都可以參考


http://docs.google.com/viewer?url=http://www.reclaimingquarterly.org/web/resources/Handbook-RQ72.pdf

http://www.actupny.org/documents/CDdocuments/CDindex.html

http://gipfelsoli.org/rcms_repos/Tools/DA_Handbook.pdf



Linux Kernel in a Nutshell by Greg Kroah-Hartman

Linux Kernel in a Nutshell by Greg Kroah-Hartman

http://www.kroah.com/lkn/

motto :「你今日幫共產黨,聽日佢哋就殺你全家。」

http://www.youtube.com/watch?v=RkviavrdkQA
嚴敏華說出真史實被捕:你今日幫中共明日她會殺你全家!

林忌抱不平譏:共產龜縮「技安」牛高馬大怕弱小的「靜宜」!
http://www.youtube.com/watch?v=cu-T2Jv2iVs

http://talkerblog.blogspot.com/2010/05/g2g_1734.html

"北京日報社" 社長梅甯華拍案而起:袁騰飛是我舉報的!

1. 雖然公民有言論的自由,但是他的言論很多都已經違反我國憲法基本原則。他已經不再是否定一個"毛澤東",而是在否定社會主 義制度、否定中國共產黨的領 導、否定深入人心的社會主義歷史。袁騰飛看歷史是唯心主義的、更是反動的、有害的。滿腹經綸說的確實未經考證的野史。
 
2.  自己號稱是黨員,卻完全贊同"共產黨基本不幹人事","共產黨政府就是法西斯"。
 
3.  自己是人教版歷史教材的主要編寫者,卻說"中國歷史教科書真實率低於5%""我從來不往家拿書,嫌它髒。你們高考完了第一件事兒就是把書燒了。"
 
 4. 雖然口口聲聲"國家主權和領土完整",卻完全贊同"達賴佛爺獲得了諾貝爾和平獎,因為他反抗中共對西藏的武裝侵略";
 
  大叫"讓人民更有尊嚴",卻完全贊同"這個民族就是豬一樣的民族",只配享受轉基因糧、三聚氰胺奶、地溝油菜、毒假疫苗、豆腐渣校舍;
 

Sonntag, 23. Mai 2010

linux,- VFS- dentry objects

dentry objects

quoted form "Understanding the Linux kernel by Bovet and Cesati (2006), page 475.

1. the VFS consifers each directory a file that contains a list of files and othr directories.

2. once a " directory entry " is read into memory, however, it is transformed by the VFS into a dentry object
based on the dentry structure.

3. The kernel creates a dentry object for every component of a pathname that a process looks up; the dentry
object associates the component to its corresponding inode.

4. eg, when looking up the /tmp/test pathname, the kernel creates a
dentry object for the / root directory, a 2nd dentry object for the tmp entry of the root directory, and a 3rd dentry object
for the test entry of the /tmp directory.

金唐酒家蛇宴 Snake Feast (1960)
http://www.youtube.com/watch?v=B8uxyP86wTA&NR=1

金唐酒家原址在上海街。
蛇宴的菜單:

1. 太史蛇羮
2. 川貝蛇溶
3. 三蛇搶珠
4. 龍鳳蛇涏
5. 清燉蛇尾
6. 干貝蛇絲
7. 上湯蛇胆
8. 蛇王大會

Samstag, 22. Mai 2010

蛇宴同鄉會主席殺入垃圾會 Dum垃圾!

蛇宴同鄉會主席殺入垃圾會 Dum垃圾!
http://www.youtube.com/watch?v=SLkFuPnv7RY&feature=youtube_gdata

linux file object

quoted form "Understanding the Linux kernel by Bovet and Cesati (2006), page.471

A file object describes how a process INTERACTS with a file it has opened.
The object is created when the file is opened and consists of a file structure.

Notice that the file objects have NO corresponding image on disk, and hence no "dirty" field is included in the file structure to specify that the file objecthas been modified.

媚共政客監察組主席: 信任中共民主永不超生!
http://www.youtube.com/watch?v=Fe6iGdl7ctQ&feature=youtube_gdata

金唐酒家蛇宴 Snake Feast (1960)
http://www.youtube.com/watch?v=B8uxyP86wTA&NR=1

金唐酒家原址在上海街。蛇宴的菜單:

1. 太史蛇羮
2. 川貝蛇溶
3. 三蛇搶珠
4. 龍鳳蛇涏
5. 清燉蛇尾
6. 干貝蛇絲
7. 上湯蛇胆
8. 蛇王大會

Mittwoch, 19. Mai 2010

how new processes are generated?

how new processes are generated?

quoted from Mauerer's professional Linux kernel Architecture. p.6

1. fork : generates an exact copy of the current process that differs from the parent only in its PID (process identification).

After the system call has been executed, there are TWO processes in the system, both performing the SAME actions.

The memory contents of the initial process are duplicated -- at least in the view of the program.

Linux uses a well known technique known as copy-on-write that allows it to make the operation much more efficient by deferring the copy operations until either parent or child writes to a page-- read-only accessed can be satisfied from the same page for both.

2. exec : Loads a new program into an existing content and then executes it. The memory pages reserved by the old program are flushed, and their contents are replaced with new data. The new program then starts executing.



linux process address space

linux process address space

quoted from Mauerer's professional Linux kernel Architecture. p.4

Each process is assigned address space in the virtual memory of the CPU. The address spaces of the individual processes are totally independent so that the processes are unaware of each other-- as far as each process is concerned, it has the impression of being the ONLY process in the system.

If processes want to communicate to exchange date, eg, then special kernel mechanism must be used.



Montag, 10. Mai 2010

飯島真理 天使の絵の具~Macross 15th Anniversary Version

飯島真理 天使の絵の具~Macross 15th Anniversary Version
http://www.youtube.com/watch?v=vhw5sNM_kQ4&feature=related

天使の絵の具 2002 - 真理飯島
http://www.youtube.com/watch?v=hgaRpetXeNM&feature=related

Macross マクロス (Special Version): 愛おぼえていますか (Singing by me)
http://www.youtube.com/watch?v=aggBeDVYUdk&feature=related

Tenshi no Enogu 天使の絵の具 (another version)
http://www.youtube.com/watch?v=9DbKfJnvJo4&feature=related


尼采--反基督mp3
http://librivox.org/newcatalog/search.php?title=&author=Friedrich+Nietzsche&action=Search


尼采--反基督

1. 上帝愛世人有一個先決條件,這就是世人要相信他;誰不相信這愛,他就給誰投去凶神惡煞似的眼神,以示威脅!

2. 上帝存在的條件 :

"要是沒有聰明人,上帝本身也不能存在。 " 路德說過此話,說得在理;然而," 沒有愚人,上帝更不能存在。"
這句話,善良的路德沒有說過!



EE5412 Erlang B --Infinite sources, Lost Calls Cleared

Erlang B --Infinite sources, Lost Calls Cleared

gos -grade of services : the probability of loss.

eg. a grade of service of 0.01 means that, during a busy hour, the probability that an attempted call is blocked is 0.01.

The euation of infinite source LCC is called Erlang B

P = (A^N / N!) / (sum for x=0 to N |( A^x/x!) )

A= offered traffic, or erlang
N = number of servers
P = probability of blocking (grade of service--gos)

David Webb,一個連中文名也沒有的「鬼佬」,在香港傳媒的曝光率卻奇高。

他經常踢爆企業管治問題甚至上市公司醜聞,儼如小股民權益代言人,被冠以「股壇長毛」之名,但跟「政壇長毛」的經濟理念南轅北轍。

你以為只有草根左翼的梁國雄才反對功能組別?信奉自由市場的 Webb告訴你,功能組別其實阻香港發達,所以他跟政壇長毛一樣,反對到底。

香港民主,等你一票!

在香港,阻人發達是很嚴重的指控。在香港一些財團大亨眼中, David Webb 也阻人發達。不幸被他踢中的上市公司,輕則股價暴跌,重則清盤收場;近年經典戰績,還包括率先揭露電盈私有化種票疑雲,踢爆中信泰富炒燶外滙中榮智健女兒的角色。

Webb 卻認為,阻香港發達的,其實是造成官商利益千絲萬縷愛恨交纏的畸形政治制度。他指出,香港的定位是國際金融中心,但由小圈子選舉產生的特首領導的政府,卻因為受到商界壓力,市場改革舉步維艱,像延長董事股份禁售期的措施近乎胎死腹中,像引入上市公司季度報告的建議遲遲未能落實,長遠削弱香港市場的競爭力。

http://forum5.hkgolden.com/view.aspx?type=CA&message=2298120



EE5412 erlang--traffic intensity

EE5412 erlang--traffic intensity

erlang--traffic intensity

1. The basic measure of traffic is the traffic intensity, called erlang

A = lamda * h

A equals the average number of calls arriving during the average holding period.

We can also view the cell as a multi-server queuing system where the number of servers is equal to the channel capacity N.
The average service time at a server is h.

2. The parameter A , as a measure of busy-hour traffic, serves as input to a traffic model.

a) The manner in which blocked called are handled
b) the number of traffic sources (infinite or finite)


五區公投宣傳片系列 之《十八仝人撐公投》
http://www.youtube.com/watch?v=TC_63bsrMEE



EE4206/EE5806 Digital Image Processing

EE4206/EE5806 Digital Image Processing

quoted from Digital Image Processing : An algorithmic Introduction Using Java by Burger and Burge (2008) page : 63.

histogram specification


histogram specification is to modify the image to match an arbitrary intensity distribution, including the histogram of a given image.

This process relies on the alignment of the cumulative histograms by applying a homogeneous point operation.

To be independent of the image size (ie. the number of pixels), we first define normalized distributions, which we use in place of the original histograms.

Abraham and Isaac on faith

Macross Flashback 2012 Nueva Version

http://www.youtube.com/watch?v=pmfy-APs9b4&feature=PlayList&p=3B99BB7D373D3ED8&playnext_from=PL&index=15&playnext=5

Freitag, 7. Mai 2010

EE4206/EE5806 Digital Image Processing

EE4206/EE5806 Digital Image Processing

histogram equalization :

quoted from Digital Image Processing : An algorithmic Introduction Using Java by Burger and Burge (2008) page : 60.


1.The goal of histogram equalization is to find and apply a point operation such that the histogram of the modified image approximates a uniform distribution.

2. Since the histogram is a discrete distribution and homogeneous point operation can only shift and merge (but never split ) histogram entries, we only obtain an approximate solution in general.

3. In particular, there is no way to eliminate or decrease individual peaks in a histogram, and a truly uniform distribution is thus impossible to reach.

4. Based on point operations, we can thus modify the image only to the extent that the resulting histogram is approximately uniform.

5. The question is how good this approximation can be and exactly which point operation ( which clearly depends on the image content) we must apply to achieve this goal.

6. histogram equalization. The idea is to find and apply a point operation to the image (with original histogram h ) such that the histogram h-eq of the modified image approximates a uniform distribution.

7. The cumulative target histogram H-eq must thus be approximately wedge-shaped.

第一編 致死的病乃是絕望

一 絕望是致死的病

(甲)絕望是本人靈性上的病,它可能有三種表現:

(1)是不覺得有自我而絕望,(其實這不是正 經的絕望);
(2)是不願做他自己而絕望;
(3)是由於要做自己而絕望。

人乃是靈性。但靈性是什麼呢?靈性乃是自我。

自我又是什麼呢?自我 乃是那與自己的我發生關係的那個關係;或者說,自我就是那在關係中使這關係與自己發生關係的;自我本不是關係,卻是你把關係與自我相關連的。

人是有限與無限,暫時與永恆,自由與必然間的一個綜合,總之,自我是一個綜合。綜合乃是介乎兩重因素間的一種關係。

如些看來,人還不是一個自我。

在兩件事物發生關係時,那關係本身是第三者,作為一種否定的統一, 而那原來的兩者也對那關係發生關係;甚至對這第二個關係發生關係;當人被認為是靈性時。人即是身體與靈魂間的一種關係。但若是關係本身與自我發生關係,那 麼,那關係就成為積極性的第三者,而這即是自我。
那使關係本身與自我發生關係的關係(即是說,那個自我 ),必須是由 它自己本身而生,要不然,便是由外而來的。

若那使關係本身與自我發生關係的那個關係是外來的,那關係自然是一 個第三者,但這第三者又再是與那外來的發生關係的一種關係。

這種由關係發生關係而來的關係,就是人的自我;這乃是一種關係本身 與自我聯繫的關係,就在關係本身與它的自我聯繫時,又進而與外來的某物發生關係。

這樣,其中就發生兩種真正的絕望:一是因不願做他自己而絕望,二是因要做 他自己而絕望。若人的自我是由其本身而構成,就只有一種的絕望,那即是不願做他自己本身,而要將自我除去,這就和那願做自己的絕望不同。

然則那種因願做他 自己而絕望,其故何在呢?這就由於自我不能靠自己達到平衡以至平安,只有使自己與那產生整個關係的“大能”( 譯者按,指上帝 )發生關係,它才能得寧息。

老 實說,那種願做自我的第二種絕望,不僅是一種特別的絕望,反而是,一切絕望畢竟皆從這種絕望而來。

若一個絕望的人自以為知自己的絕望,而不把它當作一件落 在自己身上的事去無謂地談它( 恰如一個頭昏的人,神經質地自己哄騙自己說,他頭上好像一塊石頭壓著,一類的話,其實他頭上的重壓並不是外來的壓力,而只是 反射他內在的病症 ),可是,他若想只靠自己去除掉這絕望,那麼,他費盡一切的力量,只是使自己更深陷於絕望之中。

絕望所表現的關係失調,不只是一種關係上 的失調,而是在一種與他的自我所發生的,卻由外來的權能所造成的關係上顯出失調;這樣,人的自我關係中的失調,也是使自我和那造成自我的權能之間所應有的 關係失調。

所以,一個人的絕望之完全被解除,其條件不外如下列的方式:他必須 與他的自我發生美好的關係,願意做他自己,這樣,自我就很透亮地以那支持自我的權能為依據。

http://www.edzx.com/zxdj/%E5%AE%8F%E9%81%93%E4%B9%A6%E5%AE%A4/e_book/%E5%8E%86%E4%BB%A3%E5%90%8D%E8%91%97%E9%9B%86%E6%88%90/%E7%AC%AC%E4%BA%8C%E9%83%A8/%E7%A5%81%E5%85%8B%E6%9E%9C%E7%9A%84%E4%BA%BA%E7%94%9F%E5%93%B2%E5%AD%A6/index.htm



Donnerstag, 6. Mai 2010

黃子華棟篤笑- 股市凶兆

Diese Zusammenfassung ist nicht verfügbar. Klicke hier, um den Post aufzurufen.

Mittwoch, 5. Mai 2010

祁克果的人生哲學

Diese Zusammenfassung ist nicht verfügbar. Klicke hier, um den Post aufzurufen.

Dienstag, 4. Mai 2010

MS5312 審時度勢 — 香港和 世界應採用的基準

1996 Policy address 總督彭定康先生

審時度勢 — 香港和 世界應採用的基準


89. 中國奮力持續推行經濟改革,國際社會當然希望改革能夠取得成果,並會因而格外關注香港的發展。

國際社會也當然希望確知兩套制度能夠在一個國家內同時實施,並行不悖。我希望國際社會不會以先入為主的看法來衡量香港,而是根據事實作出判斷。

明智的人定會留意事態的發展,用一些明確的基準來加以衡量。那些基準肯定會包括以下所列:


— 香港是否仍然擁有一支精明能幹且能秉承一貫專業精神的公務員隊伍?身居要職的人員是否深得同事及廣大市民的信任?他們是否純因本身的才幹而獲聘任?


— 特區政府是否根據本身的政策,自行編製財政預算,還是受到壓力,須按照北京所定的目標行事?


— 香港金融管理局是否在不受外力干預的情況下,管理香港的外匯基金?


— 香港在國際經濟組織中,是否表現出真正自主?


— 香港的立法會究竟是因應香港市民的期望和特區政府的政策制定法例,還是在北京的壓力下執行立法的工作?


— 香港的法院是否繼續在不受干預的情況下運作?


— 廉政公署是否繼續大力打擊各類貪污活動,包括那些可能涉及中國利益的活動?


— 香港在執法工作方面,是否會繼續維持本身的國際聯絡網?


— 港粵邊界狀況是否維持不變?香港人民入境事務處是否繼續實施獨立的過境管制?


— 香港是否仍然享有新聞自由,可以不受約束地報道中國的消息,以及一些會引起中國強烈反應的消息?


— 集會自由是否會受到新的約制?近年舉行的周年紀念活動和晚會是否仍舊准予舉行?


— 駐港的外國記者和傳媒機構是否可以繼續自由採訪,不受管制?


— 人們以和平方式表達對政治、社會或宗教的意見,會否受到迫害或騷擾?

— 香港在不斷演進的期間,是否會繼續以公平和公開的選舉,選出能夠真正代表民意的立法會議員?


— 支持民主的政界人士能否繼續活躍於香港政壇,還是會在外力壓制下,被擯諸局外或受到排斥?


— 在《聯合聲明》和《基本法》訂明的各個範疇內,行政長官是否真正能夠行使自主權?


90. 這些都是舉世關心的問題。我們都希望答案能讓世人放心。


91. 剛才提到的莊嚴時刻,固然是對我的接任人而言;但對我來說,這個時刻也同樣肅穆,因為到時我便要告別香江。


92. 歷任總督無不為香港鞠躬盡瘁,其中一、兩位更名副其實,死而後已。歷任總督無論是在任期間還是離任之後,都對香港充滿熱忱。

即使回到那灰濛濛的青葱島國後,還是滿心關切p(雖然有時也會感到失望),遙遙關注香港的種種發展。我也不會例外,只是心裏存着一份遺憾、一點憂慮和一個使我感到安慰的事實。


93. 對我來說,任內的一大憾事,是未能把我個人認為最能保障香港利益的構想,通過投票來加以證驗,而大多數自由社會的領導階層,都是經由投票確認的。

不過,香港已獲得許諾,日後政體會不斷發展,終有一天能夠實現這個目標。但願我能有幸目睹這天來臨,屆時中國和那些敢於挺身為香港市民請命的人,都應各記一功。


94. 我感到憂慮的 - 我要盡力強調這點 - 我感到憂慮的,不是香港的自主權會被北京剝奪,而是這項權利會一點一滴地斷送在香港某些人手裏。

大家都知道,我重複,大家都知道,過去幾年來,一直有人暗中上告北京,要求推翻一些由香港政府真心誠意作出的決定,也有人因為一己私利受損,而進行閉門游說,設法推翻一些符合社會整體利益的決定。

這種做法會使中國官員介入明確屬香港自主範圍的事,因而貽害香港。

假如香港人要保持自主,那麼每一個人,不論來自商界、政界、新聞界、學術界,或是其他社會領袖,以至公職人員,都必須群起捍衞自主、堅持自主。


http://74.125.153.132/search?q=cache:bYa2HwgCEhQJ:www.legco.gov.hk/yr96-97/chinese/lc_sitg/hansard/961002hc.doc+%E5%89%8D%E8%B7%AF%E4%B8%8D%E7%AE%A1%E6%9C%89%E4%BD%95%E6%8C%91%E6%88%B0%EF%BC%8C%E9%83%BD%E4%B8%8D%E6%9C%83%EF%BC%8C%E6%88%91%E9%87%8D%E8%A4%87%EF%BC%8C%E9%83%BD%E4%B8%8D%E6%9C%83%E4%BD%BF%E9%80%99%E9%A1%86%E6%B5%81%E6%98%9F%E9%A3%9B%E5%A2%9C&cd=3&hl=zh-TW&ct=clnk&gl=hk

EE5412 Telecommunication Networks

EE5412 Telecommunication Networks

中共封殺最牛歷史教師
http://forum5.hkgolden.com/view.aspx?type=CA&message=2285220

http://hk.apple.nextmedia.com/template/apple/art_main.php?iss_id=20100504&sec_id=15335&subsec_id=15336&art_id=13993422

1. lost calls delayed (LCD) : blocked calls can be put in a queue awaiting a free channel

2. a blocked call can be rejected and dropped. a) if the user hangs up and waits some random time interval before another call attempt, known as lost calls cleared (LCC). If the user repeatedly attempts calling, it is known as lost calls held ( LCH).

For cellular systems, the LCC model is generally used.

assumptions:

1. poison arrivals
2. Exponential holding time ( not needed for infinite sources, LCC)
3. Equal traffic intensity per source
4. Calls served in order of arrival (for delay calculations)

For LCC systems, P is the probability that a call request will be cleared, or lost. This is the ratio of calls unable to obtain service to the total call request, it is called gos (grade of service).

現在讓我們思考一下一般人認為最容易認識,和知道得最清晰的事物,這就是我們摸得到、看得見的物體,但是我指的,並非普遍的物體,因為普遍的概念往往比較雜亂而模糊,因此讓我們來思考一種特殊的物體,

就以一塊蜜蠟作例子吧,當它剛從蜂巢新鮮地取出來時,尚沒有失掉蜜中的甜味,仍然保留著陣陣芬芳的花香;它的顏色、形狀和大小都是顯然而見的,而且質硬性冷,可隨意用手拿起來,如果用手指彈它,還會發出聲音,總而言之,凡是能令人清晰地辨認一個物體的必備條件,無不包含在這塊蜜蠟中。

可是,當我在說話時,如果把它放置於火旁,則剩餘的甜味就會蒸發,香氣亦隨之消失,顏色也因而改變,形狀亦起變化,而且體積變大,固體變成液體,冷變為熱,很難再用手拿起來,即使用手指彈它,也不會發出聲音。經過這一番變化之後,同一塊蜜蠟還存在嗎?

我們必須承認它存在,沒有人會懷疑這一點,也沒有人會提出異議。

那麼,我在這塊蜜蠟中最清晰地知道的是什麼呢?當然不是我憑感官而覺察到的任何東西,因為凡是屬於味覺、嗅覺、視覺、觸覺和聽覺的一切東西都改變了,不過該蜜蠟仍然存在,而且仍然是原來的那一塊。

EE5412 Telecommunication Networks

EE5412 Telecommunication Networks

黃毓民 在My Radio 反擊李慧玲的歪曲事實,而作出的回應!Part 1
http://www.youtube.com/watch?v=DJ0RVQ8xgnM&feature=youtube_gdata

Erlang

lamda : the mean rate of calls (connection requests ) attempted per unit of time

h : the mean holding time per successful call

The basic measure of traffic is the traffic intensity, expressed in a dimensionless unit, the Erlang:

A = lamda * h

The parameter A, as a measure of busy-hour traffic serves as input to a traffic model.

1) The manner in which blocked calls are handled

2) The number of traffic sources

2 questions:

1. Given a measured value of P for a particular N, how much must N be increased to reduce P to a given level?

2. Given lamda, h , and a desired value for P, what capacity (N) is required?

當然,如果這些東西真的都屬於我的本性,那確實相當可觀。但是為什麼它們不該屬於我的本性呢?我豈不是一個這樣的東西嗎?

我現在幾乎懷疑一切,可是又在理解和設想某些事物;我肯定只有一件事物是真實的,而否定其他的一切;我既想多知道這些事物,卻又不願意受騙;我想像出許多事物,甚至有時置自己的意志不顧;我也能感覺許多事物,就像透過身體各器官的媒介而來的。

縱然我每天都要睡覺,縱然那個創造我的「神明」費盡心機來欺騙我,可是,上述這一切作用,難道就沒有一種如同「 我確實存在 」一樣真實嗎?這些屬性中,有沒有一種能與我的思想分開呢? 或者可以說與我自己分開呢?但是事情本身就很清楚明瞭:是我在懷疑、是我在理解、是我在意欲,根本不必在此補充任何東西來加以說明。

而且我確實具有想像的能力,即使我所想像的事物有可能( 像我以前所假設的那樣)完全都是虛假的,可是這種想像能力卻仍然不斷地發揮作用,並構成我思想的一部分。

總而言之,是同一個我在感覺,也就是說,似乎能藉著感官而知覺到某些事物的那種東西就是我。因為我確實看見光、聽到聲音、感覺到熱。

可是有人會說,那些現象都是假的,我只是在作夢。 隨便他怎樣說好了,反正我的確覺得自己看到光、聽到聲音、感覺到熱,這是鐵一般的事實。真正說來,這就是所謂我的感覺( feeling),說得更精確一點,也即是我的思想(thinking )。

Montag, 3. Mai 2010

EE4206/EE5806 Digital Image Processing

EE4206/EE5806 Digital Image Processing

Modified Auto-Contrast

quoted from Digital Image Processing : An algorithmic Introduction Using Java by Burger and Burge (2008) page : 58-59

1. The mapping function could be strongly influenced by only a few extreme (low or high) pixel values, which may not be representative of the image content.

2. This can be avoided to large extent by "saturating" a fixed percentage (s-low, s-high) of pixels at the upper and lower ends of the target intensity range.

3. Predefined quantiles (s-low and s-high) of image pixels are "saturated", i.e., mapped to the extreme values of the target range. ) The intermediate values are mapped linearly to the interval [a-min, a-max].


最後要談到思想,在這裡,我發現了它才是我的真正屬性,只有思想與我密不可分。

有我,我存在,這是毋庸置疑的,可是,我能存在多久呢?我思想多久,就存在多久,換言之,只有當我思想時才存在。因為如果我完全停止了思想,則我或許就會完全不存在了。

我現在既然一律不承認任何虛妄的事物,因此,嚴格說來,我只是一個思想物(thinking thing),也就是說,我是一個心靈( mind),一個靈魂( soul ) ,或是一個理解(understanding),一個理性(reason ) ,這些名詞的意義都是我以前所不知道的。

無論如何,我是一個真實的東西,而且是實際存在的,可是,我到底是什麼勿東西」呢?我已經答覆過了:我是一個思想的東西。

EE4206/EE5806 Digital Image Processing

EE4206/EE5806 Digital Image Processing

Modified Auto-Contrast

quoted from Digital Image Processing : An algorithmic Introduction Using Java by Burger and Burge (2008) page : 58-59

1. The mapping function could be strongly influenced by only a few extreme (low or high) pixel values, which may not be representative of the image content.

2. This can be avoided to large extent by "saturating" a fixed percentage (s-low, s-high) of pixels at the upper and lower ends of the target intensity range.

3. Predefined quantiles (s-low and s-high) of image pixels are "saturated", i.e., mapped to the extreme values of the target range. ) The intermediate values are mapped linearly to the interval [a-min, a-max].


最後要談到思想,在這裡,我發現了它才是我的真正屬性,只有思想與我密不可分。

有我,我存在,這是毋庸置疑的,可是,我能存在多久呢?我思想多久,就存在多久,換言之,只有當我思想時才存在。因為如果我完全停止了思想,則我或許就會完全不存在了。

我現在既然一律不承認任何虛妄的事物,因此,嚴格說來,我只是一個思想物(thinking thing),也就是說,我是一個心靈( mind),一個靈魂( soul ) ,或是一個理解(understanding),一個理性(reason ) ,這些名詞的意義都是我以前所不知道的。

無論如何,我是一個真實的東西,而且是實際存在的,可是,我到底是什麼勿東西」呢?我已經答覆過了:我是一個思想的東西。

EE4206/EE5806 Digital Image Processing

EE4206/EE5806 Digital Image Processing

quoted from Digital Image Processing : An algorithmic Introduction Using Java by Burger and Burge (2008) page : 57-58
Automatic Contrast Adjustment


1. Automatic constrast adjustment (auto-contrast) is a point operation whose task is to modify the pixels such that the available range of values is fully covered.

2. This is done by mapping the current darkest and brightest pixels to the lowest and highest available intensity values respectively, and linearly distributing the intermediate values.

3. Original pixel values a in the range [a-low, a-high] are mapped linearly to the target range[a-min, a-max].

4. Let us assume that a-low and a-high are the lowest and highest pixel values found in the current image, whose full intensity range is [a-min, a-max].

5. To stretch the image to the full intensity range, we first map the smallest pixel value a-low to zero, subsequently increase the contrast by the factor (a-max - a-min)/ (a-high - a-low), and finally shift to the target range by adding a-min.

我知道自己存在,而且在探究這個存在的「我 」到底是什麼。因此,嚴格說來,有關我對自己存在所有的知識,絕對不能依靠我不知道其存在的那些事物,由此可知,這種知識也不能依靠我想像中虛構的任何事物。

其實,「 在想像中虛構 」或 「 我構成一個影像」這類說法,就足以證明我的錯誤。因為如果我想像自己是一種東西,則我非得構成一個影像不可,而所謂想像,只是思維有形物體的形狀 ( figure)或 影像( image)罷了。

不過我已確實知道我是存在的,而且一般說來,這些影像就是與物體本性有關的事物,也許只是一些夢境或幻想而已。

因此,我實在沒理由說:「 為了較清晰地知道自己是什麼,所以我應該刺激自己的想像。 」

Sonntag, 2. Mai 2010

嚴復 : 法意--孟德斯鳩傳

嚴復 : 法意--孟德斯鳩傳

孟德斯鳩,法國南部兒奄郡人也,姓斯恭達,名察理。世為右族,家承兩邑之封,凡二百餘年,曰布來德,曰孟德斯鳩。世即以其一封稱之曰孟德斯鳩男爵雲。生一千六百八十九年,當名王路易第十四之世。當是時,法戰勝攻取,聲明文物冠諸歐,然值政教學術,樂新厭古,人心物論,窮極將變時。

於是論治道者,英有郝伯思、洛克,義有墨迦伏勒,而法有孟德斯鳩。則導福祿特爾、盧梭輩先路者也。家於西土僅中貲,以善治生,未嘗窘乏。地望勢力,高不足以長驕,卑常足以自厲,然約情束欲,安命觀化,幼而好學,至老弗衰。常語人曰:吾讀書可用蠲忿釋悁,雖值佛逆,得開卷時許,如回溫泉以銷冰雪,扇清風而解熱煩也。其姿之近道如此。

年二十五,入博爾都郡議院為議員。法舊制諸郡議院,法家所聚,民有訟獄,則公享之。先是其季父入貲,為其院主席,父子冠假,衣黑衣,時以為寵。逾二載而季父捐館舍,遺令以其位傳猶子孟德斯鳩,俸優政簡,時事國論,多所與聞,然而非其好也。視事十稔,年幾四九,又以其位讓人,退歸林墅。

蓋自茲以往,至於沒齒,都三十年,捨探討著述之事,無以勞其神慮;而捨歷史政治,又無以為其探討著述。若孟德斯鳩者,殆天生以為思想學問者歟?

其著書甚蚤,年方二十齡,有《神學論》。又嘗考羅馬宗教所與治術關係者。然不甚求知於人,世亦不知重也。年三十二,成《波斯文錄》。借彼土之文辭,諷本邦之政教,移情剡目,通國為懽,而教會深銜之。方其罷博爾都議院主席也,適巴黎國學有博士闕待補,孟德斯鳩甚欲得之。而翊教伏烈理使謂其長曰:「《波斯文錄》於國教多微辭,今國學顧容納其作者,王將謂何?」其長懼而不敢。

孟德斯鳩乃以書抵之曰:「足下辱我已甚。吾計惟出奔他國,庶幾棲息餘生,自食其力。所不能得諸同種者,猶冀遇諸他人耳。」伏烈理不得已罷攻,而孟德斯鳩補博士。已而游奧之維也納,更匈牙利,盡交其賢豪。踰嶺度威匿思入羅馬,謁教王。教王禮遇有加,不以《文錄》為意。北旋,登瑞士諸山,溯來因之水,北出荷蘭,渡海抵大不列顛,居倫敦者且二稔。

於英之法度尤加意,慨然曰:「惟英之民,可謂自由矣。」入其格致王會,被舉為會員。最後乃歸法,徜徉布來德、巴黎間。一千七百三十四年,成《羅馬衰盛原因論》。論者稱其裁勘精究,斷論切當,於古得未嘗有者。

顧所發憤,乃在《法意》一書,當此時,屬稿者已六七年矣,前論特其嚆矢而已。精銳綆修,窮晝夜矻矻,凡十有四年,而《法意》行於世。遐搜遠引,鉤湛矚幽。凡古今人事得失之林,經緯百為,始終條理。於五洲禮俗政教,莫不籀其前因,指其後果。既脫稿,先以示同時名碩海羅懷紂。海羅懷紂歎曰:「 作者宇宙大名,從此立矣。」印板既布,各國迻翻,一載間板重者二十二次。風聲所樹,暨可知矣。福祿特爾嘗稱曰:「 人類身券,失之久矣,得此而後光復。」拿破崙於兵間攜書八種自隨,而《法意》為之一。

後為其國更張法典,勒成專編,近世法家仰為絕作,而《法意》則其星宿海也。年六十有六,卒於家。方其彌留也,以宗教有懺悔之禮,神甫輩以孟生平於其法多所誹毀,頗欲聞其臨終悔罪之言,然卒不可得,但叩之曰:「 孟德斯鳩,若知帝力之大乎?」對曰:「唯其為大也,如吾力之為微。」

譯史氏曰:吾讀《法意》,見孟德斯鳩粗分政制,大抵為三:曰民主,曰君主,曰專制。其說蓋原於雅理斯多德。吾土縉紳之士,以為異聞,慮叛古不欲道。雖然,司馬遷《夏〔殷〕本紀》言伊尹從湯言九主之事,注家引劉向《別錄》。

言九主者,有法君、專君、授君、勞君、等君、寄君、破君、國君、三歲社君,凡九品,是何別異之眾耶?向稱博極群書,其言不宜無本。而三制九主,若顯然可比附者。然則孟之說非創聞也,特古有之,而後失其傳雲爾。


孟德斯鳩以專制政體為 三種基本的政府形態之一,使得專制政體成為 18世紀 政治思想中的一個核心主題。他也是西方思想家中第一個將中國划入「 專制政體 」的。他的這個說法強烈影響了西方對中國的印象,一針見血地總結 中國政治制度的細節和特點,以「 專制 」二字描述。

崔東壁遺書 清史稿 · 儒林三 崔述

崔東壁遺書 清史稿 · 儒林三 崔述

崔述,字武承,大名人。乾隆二十七年舉人,選福建羅源縣知縣。武弁多藉海盗邀功,誣商船為盗,述平反之。未幾,投效歸。著書三十餘種,而考信錄一書,尤生平心力所專注。

凡考古提要二卷,上古考信錄二卷,唐虞考信錄四卷,夏商考信錄四卷,豐鎬考信錄八卷,豐鎬彆錄三卷,洙泗考信錄四卷,洙泗馀錄三卷,孟子事實錄二卷,考古續説二卷,附錄二卷。又有王政三大典考三卷,讀風偶識四卷,尚書辨僞二卷,論語馀説一卷,讀經餘論二卷,名考古异錄。

其著書大旨,謂不以傳注雜於經,不以諸子百家雜於傳注。以經為主,傳注之合於經者著之,不合者辨之,异説不經之言,則辟其謬而削之。

如謂易傳僅溯至伏羲,春秋傳僅溯至黄帝,不應後人所知反多於古人。

凡緯書所言十紀,史所云天皇、地皇、人皇,皆妄也。謂戰國楊、墨横議,常非堯、舜,薄湯、武,以快其私。毁堯則託諸許由,毁禹則託諸子高,毁孔子則託諸老聃,毁武王則託諸伯夷。

太史公尊黄、老,故好采异端雜説,學者但當信論、孟,不當信史記。謂夏、商、周未有號為某公者,公亶父相連成文,猶所謂公劉也。“古公亶父 ”,猶言 “昔公亶父 ” 也。謂匡為宋邑,似畏匡、過宋本一事,“ 匡人其如予何 ”、“ 桓魋其如予何 ”,似一時一事之言,記者小異耳。其説皆為有見。

述之為學,考據詳明如漢儒,而未嘗墨守舊説而不求其心之安;辨析精微如宋儒,而未嘗空談虚理而不核乎事之實。然勇於自信,任意軒輊者亦多。

他著有易卦圖説一卷,五服异同匯考三卷,大名水道考一卷,聞見雜記四卷,知味錄二卷,知非集三卷,無聞集五卷,小草集五卷。

嘉慶二十一年,卒。年七十七。

睇樓竟跳樓豪宅成凶宅
http://orientaldaily.on.cc/cnt/news/20100426/00176_031.html



增廣昔時賢文

增廣昔時賢文

http://zh.wikisource.org/zh/%E5%A2%9E%E5%BB%A3%E6%98%94%E6%99%82%E8%B3%A2%E6%96%87

001昔時賢文,誨汝諄諄。

002集韻增廣,多見多聞。

003觀今宜鑒古,無古不成今。

004知己知彼,將心比心。

005酒逢知己飲,詩向會人吟。

006相識滿天下,知心能幾人。

007相逢好似初相識,到老終無怨恨心。

008近水知魚性,近山識鳥音。

009易漲易退山溪水,易反易覆小人心。

010運去金成鐵,時來鐵成金。

011讀書須用意,一字值千金。

012逢人且說三分話,未可全拋一片心。

013有意栽花花不發,無心插柳柳成蔭。

014畫虎畫皮難畫骨,知人知面不知心。

015錢財如糞土,仁義值千金。

016流水下灘非有意,白雲出岫本無心。

017當時若不登高望,誰信東流海洋深。

018路遙知馬力,事久見人心。

019兩人一般心,有錢堪買金。

020一人一般心,無錢堪買針。

021相見易得好,久住難為人。

022馬行無力皆因瘦,人不風流只為貧。

023饒人不是痴漢,痴漢不會饒人。

024是親不是親,非親卻是親。

025美不美山中水,親不親故鄉人。

026鶯花猶怕春光老,豈可教人枉度春。

027相逢不飲空歸去,洞口桃花也笑人。

028紅粉佳人休便老,風流浪子莫教貧。

029在家不會迎賓客,出門方知少主人。

030客來主不顧,應恐是痴人。

031貧居鬧市無人問,富在深山有遠親。

032誰人背後無人說,那個人前不說人。

033有錢道真語,無錢語不真。

034不信但看筵中酒,杯杯先敬有錢人。

035鬧裡有錢,靜處安身。

036來如風雨,去似微塵。

037長江後浪推前浪,世上新人換舊人。 ( 一說此句典出宋劉斧《 青瑣高議 》。我聞古人之詩曰:「 長江後浪推前浪,浮事新人換舊人。 」)

038近水樓台先得月,向陽花木早逢春。

039古人不見今時月,今月曾經照古人。

040先到為君,後到為臣。

041莫道君行早,更有早行人。

042莫信直中直,須防仁不仁。

043山中有直樹,世上無直人。

044自恨枝無葉,莫怨太陽偏。

045萬般皆是命,半點不由人。

046一年之計在於春,一日之計在於晨。

047一家之計在於和,一生之計在於勤。

048責人之心責己,恕己之心恕人。

049守口如瓶,防意如城。

050寧可負我,切莫負人。

051積善成名,積惡滅身。

052再三行好事,第一莫欺心。

053虎生猶可近,人熟不堪親。

054來說是非者,便是是非人。

055遠水難救近火,遠親不如近鄰。

056有錢有酒多兄弟,急難何曾見一人。

057人情似紙張張薄,世事如棋局局新。

058山中也有千年樹,世上難逢百歲人。

059力微休負重,言輕莫勸人。

060無錢休入眾,遭難莫尋親。

061平生莫做皺眉事,世上應無切齒人。

062士者國之寶,儒為席上珍。

063若要斷酒法,醒眼看醉人。

064求人須求大丈夫,濟人須濟急時無。

065渴時一滴如甘露,醉後添杯不如無。

066久住令人賤,貧來親也疏。

067酒中不語真君子,財上分明大丈夫。

068出家如初,成佛有餘。

069積金千兩,不如明解經書。

070養子不教如養驢,養女不教如養豬。

071有田不耕倉廩虛,有書不讀子孫愚。

072倉廩虛兮歲月乏,子孫愚兮禮義疏。

073同君一夜話,勝讀十年書。

074人不通古今,馬牛而襟裾。

075茫茫四海人無數,那個男兒是丈夫。

076白酒釀成延好客,黃金散盡為收書。

077救人一命,勝造七級浮屠。

078城門失火,殃及池魚。

079庭前生瑞草,好事不如無。

080欲求真富貴,須下死工夫。

081百年成之不足,一旦壞之有餘。

082人心似鐵,官法如爐。

083善化不足,惡化有餘。

084水太清則無魚,人太緊則無智。

085智者減半,愚者全無。

086在家由父,出嫁從夫。

087痴人畏婦,賢女敬夫。

088是非終日有,不聽自然無。

089寧可正而不足,不可邪而有餘。

090寧可信其有,不可信其無。

091竹籬茅舍風光好,道院僧房總不如。

092命裡有時終須有,命裡無時莫強求。

093道院迎仙客,書房隱相儒。

094庭栽棲鳳竹,池養化龍魚。

095結交須勝己,似我不如無。

096但看三五日,相見不如初。

097人情似水分高下,世事如雲任捲舒。

098會說說都是,不會說無理。

099磨刀恨不利,刀利傷人指。

100求財恨不多,財多害人己。

101知足常足終身不辱,知止常止終身不恥。

102有福傷財,無福傷己。

103差之毫釐,失之千里。

104若登高必自卑,若行遠必自邇。

105三思而行,再斯可矣。

106使口不如自走,求人不如求己。

109小時是兄弟,長大各鄉里。

110妒財莫妒食,怨生莫怨死。

111人見白頭嗔,我見白頭喜。

112多少少年亡,不到白頭死。

113牆有縫,壁有耳。

114好事不出門,惡事傳千里。

115賊是小人,智過君子。

116君子固窮,小人窮斯濫矣。

117貧窮自在,富貴多憂。

118不以我為德,反以我為仇。

119寧向直中取,莫向曲中求。

120人無遠慮,必有近憂。

121知我者謂我心憂,不知我者謂我何求。

122晴乾不肯去,直待雨淋頭。

123成事莫說,覆水難收。

124是非只為多開口,煩惱皆因強出頭。

125忍得一時之氣,免得百日之憂。

126近來學得烏龜法,得縮頭時且縮頭。

127懼法朝朝樂,欺公日日憂。

128人生一世,草生一春。

129白髮不隨人而去,看來又是白頭翁。

130月到十五光明少,人到中年萬事休。

131兒孫自有兒孫福,莫把兒孫作馬牛。

132人生不滿百,常懷千歲憂。

133今朝有酒今朝醉,明日愁來明日憂。

134路逢險處難迴避,事到頭來不自由。

135藥能醫假病,酒不解真愁。

136人平不語,水平不流。

137一家養女百家求,一馬不行百馬憂。

138有花方酌酒,無月不登樓。

139三杯通大道,一醉解千愁。

140深山畢竟藏猛虎,大海終須納細流。

141惜花須檢點,愛月不梳頭。

142大抵選他肌骨好,不敷紅粉也風流。

143受恩深處宜先退,得意濃時便可休。

144莫待是非來入耳,從前恩愛反成仇。

145留得五湖明月在,不愁無處下金鉤。

146休別有魚處,莫戀淺灘頭。

147去時終須去,再三留不住。

148忍一句息一怒,饒一著退一步。

149三十不豪,四十不富,五十將近尋死路。

150生不認魂,死不認屍。

151父母恩深終有別,夫妻義重也分離。

152人生似鳥同林宿,大限來時各自飛。

153人善被人欺,馬善被人騎。

154人無橫財不富,馬無夜草不肥。

155人惡人怕天不怕,人善人欺天不欺。

156善惡到頭終有報,只爭來早與來遲。

157黃河尚有澄清日,豈可人無得運時。

158得寵思辱,居安思危。

159念念有如臨敵日,心心常似過橋時。

160英雄行險道,富貴似花枝。

161人情莫道春光好,只怕秋來有冷時。

162送君千里,終須一別。

163但將冷眼觀螃蟹,看他橫行到幾時。

164見事莫說,問事不知。

165閒事莫管,無事早歸。

166假袍染就真紅色,也被旁人說是非。

167善事可作,惡事莫為。

168許人一物,千金不移。

169龍生龍子,虎生豹兒。

170龍游淺水遭蝦戲,虎落平陽被犬欺。

171一舉首登龍虎榜,十年身到鳳凰池。

172十年窗下無人問,一舉成名天下知。

173酒債尋常到處有,人生七十古來稀。

174養兒防老,積穀防饑。

175雞豚狗彘之畜,無失其時。

176數口之家,可以無饑矣。

177常將有日思無日,莫把無時當有時。

178時來風送滕王閣,運去雷轟薦福碑。

179入門休問榮枯事,觀看容顏便得知。

180官清書吏瘦,神靈廟祝肥。

181息卻雷霆之怒,罷卻虎狼之威。

182饒人算之本,輸人算之機。

183好言難得,惡語易施。

184一言既出,駟馬難追。

185道吾好者是吾賊,道吾惡者是吾師。

186路逢險處須當避,不是才人莫獻詩。

187三人同行,必有我師焉。

188擇其善者而從之,其不善者而改之。

189少年不努力,老大徒傷悲。

190人有善願,天必從之。

191莫飲卯時酒,昏昏醉到酉。

192莫罵酉時妻,一夜受孤淒。

193種瓜得瓜,種豆得豆。

194天網恢恢,疏而不漏。

195見官莫向前,做客莫在後。

196寧添一斗,莫添一口。

197螳螂捕蟬,豈知黃雀在後。

198不求金玉重重貴,但願兒孫個個賢。

199一日夫妻,百世姻緣。

200百世修來同船渡,千世修來共枕眠。

201殺人一萬,自損三千。

202傷人一語,利如刀割。

203枯木逢春猶再發,人無兩度少年時。

204未晚先投宿,雞鳴早看天。

205將相額頭堪走馬,公侯肚裡好撐船。

206富人思來年,貧人思眼前。

207世上若要人情好,賒去物件莫取錢。

208死生有命,富貴在天。

209擊石原有火,不擊乃無煙。

210人學始知道,不學亦徒然。

211莫笑他人老,終須還到我。

212但能依本分,終身無煩惱。

213君子愛財,取之有道。

214貞婦愛色,納之以禮。

215善有善報,惡有惡報。

216不是不報,日子未到。

217人而無信,不知其可也。

218一人道好,千人傳實。

219凡事要好,須問三老。

220若爭小利,便失大道。

221年年防饑,夜夜防盜。

222學者如禾如稻,不學者如蒿如草。

223遇飲酒時須飲酒,得高歌處且高歌。

224因風吹火,用力不多。

225不因漁父引,怎得見波濤。

226無求到處人情好,不飲任他酒價高。

227知事少時煩惱少,識人多處是非多。

228入山不怕傷人虎,只怕人情兩面刀。

229強中自有強中手,惡人自有惡人磨。

230會使不在家豪富,風流不用著衣多。

231光陰似箭,日月如梭。

232天時不如地利,地利不如人和。

233黃金未為貴,安樂值錢多。

234世上萬般皆下品,思量惟有讀書高。

235世間好語佛說盡,天下名山僧佔多。

236為善最樂,為惡難逃。

237羊有跪乳之恩,鴉有反哺之義。

238你急他未急,人閒心不閒。

239隱惡揚善,執其兩端。

240妻賢夫禍少,子孝父心寬。

241既墜釜甑,反顧無益。

242反覆之水,收之實難。

243人生知足何時足,人老偷閒且自閒。

244但有綠楊堪繫馬,處處有路透長安。

245見者易,學者難。

246莫將容易得,便作等閒看。

247用心計較般般錯,退步思量事事難。

248道路各別,養家一般。

249從儉入奢易,從奢入儉難。

250知音說與知音聽,不是知音莫與談。

251點石化成金,人心猶未足。

252飽了肚,賣了屋。

253他人睨睨,不涉你目。

254他人碌碌,不涉你足。

255誰人不愛子孫賢,誰人不愛千鐘粟,奈五行不是這般題目。

256莫把真心空計較,兒孫自有兒孫福。

257與人不和,勸人養鵝。

258與人不睦,勸人架屋。

259但行好事,莫問前程。

260河狹水急,人急計生。

261明知山有虎,莫向虎山行。

262路不行不到,事不為不成。

263人不勸不善,鐘不打不鳴。

264無錢方斷酒,臨老始看經。

265萬事勸人休瞞眛,舉頭三尺有神明。

266但存方寸地,留與子孫耕。

267滅卻心頭火,剔起佛前燈。

268惺惺常不足,懞懞作公卿。

269點塔七層,不如暗處一燈。

270眾星朗朗,不如孤月獨明。

271兄弟相害,不如陌生。

272合理可作,小利莫爭。

273牡丹花好空入目,棗花雖小結實成。

274欺老莫欺少,欺人心不明。

275隨分耕鋤收地利,他時飽暖謝蒼天。

276得忍且忍得耐且耐,不忍不耐小事成大。

277相論逞英雄,家計漸漸退。

278賢婦令夫貴,惡婦令夫敗。

279一人有慶,兆民咸賴。

280人老心未老,人窮志不窮。

281人無千日好,花無百日紅。

282殺人可恕,情理難容。

283乍富不知新受用,乍貧難改舊家風。

284座上客常滿,杯中酒不空。

285屋漏偏逢連夜雨,行船更遇打頭風。

286筍因落籜方成竹,魚為奔波始化龍。

287記得少年騎竹馬,看看又是白頭翁。

288禮義生於富足,盜賊出於貧窮。

289天上眾星皆拱北,世間無水不朝東。

290君子安貧,達人知命。

291忠言逆耳利於行,良藥苦口利於病。

292順天者存,逆天者亡。

293人為財死,鳥為食亡。

294夫妻相和合,琴瑟與笙簧。

295有兒貧不久,無子富不長。

296善必壽考,惡必早亡。

297爽口食多偏作病,快心事過恐生殃。

298富貴定要安本分,貧窮不必枉思量。

299畫水無風空作浪,繡花雖好不聞香。

300貪他一斗米,失卻半年糧。

301爭他一腳豚,反失一腿羊。

302龍歸晚洞雲猶濕,麝過春山草木香。

303平生只會量人短,何不回頭把自量。

304見善如不及,見惡如探湯。

305人窮志短,馬瘦毛長。

306自家心裡急,他人未知忙。

307病有高人說藥方,貧無達士將金贈。

308觸來莫與說,事過心清涼。

309秋至滿山多秀色,春來無處不花香。

310凡人不可貌相,海水不可斗量。

311清清之水為土所防,濟濟之士為酒所傷。

312高草之下或有蘭香,茅茨之屋或有公王。

313無限朱門生餓殍,幾多白屋出公卿。

314醉後乾坤大,壺中日月長。

315萬事命已定,浮生空自忙。

316千里送毫毛,寄得不寄失。

317一人傳虛,百人傳實。

318世事明如鏡,前程暗似漆。

319人生一世,如駒過隙。

320良田萬頃,日食一升。

321大廈千間,夜眠八尺。

322千經萬典,孝義為先。

323一字入公門,九牛拖不出。

324衙門八字開,有理無錢莫進來。

325富從升合起,貧由不算來。

326家無讀書子,官從何處來。

327萬事不由人計較,一身都是命安排。

328急行慢行,前程只有多少路。

329人間私語,天聞若雷。

330暗室虧心,神目如電。

331一毫之惡勸人莫作,一毫之善與人方便。

332虧人是禍饒人是福,天眼恢恢報應甚速。

333聖賢言語,神欽鬼服。

334人各有心,心各有志。

335口說不如身逢,耳聞不如目見。

336養軍千日,用在一朝。

337國清才子貴,家富小兒驕。

338利刀割體痕易合,惡語傷人恨難消。

339公道世間惟白髮,貴人頭上不曾饒。

340有錢堪出眾,無衣懶出門。

341為官須作相,及第必爭先。

342苗從地發,樹向枝分。

343父子和而家不退,兄弟和而家不分。

344官有正條,民有私約。

345閒時不燒香,急時抱佛腳。

346幸生太平無事日,恐逢年老不多時。

347國亂思良將,家貧思賢妻。

348池塘積水須防旱,田地深耕足養家。

349根深不怕風搖動,樹正何愁月影斜。

350奉勸君子,各宜守己。

351隻此呈示,萬無一失。