2006年11月25日星期六

Using X11R7

X11R7 is the X server that is used with Ubuntu. The base Xorg distribution consists of 30 RPM packages (almost 120MB), which contain the server, along with support and development libraries, fonts, various clients, and documentation. An additional 1,000 or more X clients, fonts, and documentation are also included with Ubuntu.

Note

A full installation of X and related X11R7 files can consume moreusually much morethan 170MB of hard drive space. This is because additional clients, configuration files, and graphics (such as icons) are under the /usr/bin and /usr/share directory trees. You can pare excessive disk requirements by judiciously choosing which X-related packages (such as games) to install on workstations. However, with the increased capacity of most desktop PC hard drives today, the size requirements are rarely a problem, except in configuring thin-client desktops or embedded systems.


The /usr directory and its subdirectories contain the majority of Xorg's software. Some important subdirectories are

  • /usr/bin This is the location of the X server and various X clients. (Note that not all X clients require active X sessions.)

  • /usr/include This is the path to the files necessary for developing X clients and graphics such as icons.

  • /usr/lib This directory contains required software libraries to support the X server and clients.

  • /usr/lib/X11 This directory contains fonts, default client resources, system resources, documentation, and other files that are used during X sessions and for various X clients. You will also find a symbolic link to this directory, named X11, under the /usr/lib directory.

  • /usr/lib/xorg/modules This path links to drivers and the X server modules used by the X server enables use of various graphics cards.

  • /usr/X11/man This directory contains directories of man pages for X11 programming and clients

The main components required for an active local X session is installed on your system if you choose to use a graphical desktop. These components are the X server, miscellaneous fonts, a terminal client (that is, a program that provides access to a shell prompt), and a client known as a window manager. Window managers, which are discussed later in this chapter (see the section "Selecting and Using Window Managers"), administer onscreen displays, including overlapping and tiling windows, command buttons, title bars, and other onscreen decorations and features.

Elements of the xorg.conf File

The most important file for Xorg is the xorg.conf configuration file, which can be located in the /etc/X11 directory. This file contains configuration information that is vital for X to function correctly, and is usually created during the installation of Ubuntu. Should you need to change resolution or refresh frequency post-install, you should use the gnome-display-properties application, which we will cover later in this chapter. Information relating to hardware, monitors, graphics cards, and input devices is stored in the xorg.conf file, so be careful if you decide to tinker with it in a text editor!

Of course, we would not send you in blindly to edit such an important file. Let us take a look at the contents of the file so that you can get an idea of what X is looking for. The components, or sections, of the xorg.conf file specify the X session or server layout, along with pathnames for files that are used by the server, any options relating directly to the server, any optional support modules needed, information relating to the mouse and keyboard attached to the system, the graphics card installed, the monitor in use, and of course the resolution and color depth that Ubuntu uses. Of the 12 sections of the file, these are the essential components:

  • ServerLayout Defines the display, defines one or more screen layouts, and names input devices.

  • Files Defines the location of colors, fonts, or port number of the font server.

  • Module Tells the X server what graphics display support code modules to load.

  • InputDevice Defines the input devices, such as the keyboard and mouse; multiple devices can be used.

  • Monitor Defines the capabilities of any attached display; multiple monitors can be used.

  • Device Defines one or more graphics cards and specifies what optional (if any) features to enable or disable.

  • Screen Defines one or more resolutions, color depths, perhaps a default color depth, and other settings.

The following sections provide short descriptions of these elements; the xorg.conf man page contains full documentation of all the options and other keywords you can use to customize your desktop settings.

The ServerLayout Section

As noted previously, the ServerLayout section of the xorg.conf file defines the display and screen layouts, and it names the input devices. A typical ServerLayout section from an automatically configured xorg.conf file might look like this:

Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen"
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
InputDevice "stylus" "SendCoreEvents"
InputDevice "cursor" "SendCoreEvents"
InputDevice "eraser" "SendCoreEvents"
EndSection

In this example, a single display is used (the numbers designate the position of a screen), and two default input devices, Mouse0 and Keyboard0, are used for the session. We also see that xorg.conf has been configured for use with a stylus (normally for use with a Tablet PC) but this can be ignored.

The Files Section

The Files section of the xorg.conf file might look like this:

Section "Files"
RgbPath "/usr/lib/X11/rgb"
FontPath "unix/:7100"
EndSection

This section lists available session colors (by name, in the text file rgb.txt) and the port number to the X font server. The font server, xfs, is started at boot time and does not require an active X session. If a font server is not used, the FontPath enTRy could instead list each font directory under the /usr/X11R6/lib/X11/fonts directory, as in this example:

Section "Files"
FontPath "/usr/share/X11/fonts/misc"
FontPath "/usr/share/X11/fonts/cyrillic" /> FontPath "/usr/share/X11/fonts/100dpi/:unscaled"
FontPath "/usr/share/X11/fonts/75dpi/:unscaled"
FontPath "/usr/share/X11/fonts/Type1"
FontPath "/usr/share/X11/fonts/100dpi"
FontPath "/usr/share/X11/fonts/75dpi"
# path to defoma fonts
FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
EndSection

These directories contain the default compressed fonts that are available for use during the X session. If you have installed it, then the xfs is configured by using the file named config under the /etc/X11/fs directory. This file contains a listing, or catalog, of fonts for use by the font server. By adding an alternate-server entry in this file and restarting the font server, you can specify remote font servers for use during X sessions. This can help centralize font support and reduce local storage requirements (even though only 25MB is required for the almost 5,000 fonts installed with Ubuntu and X).

The Module Section

The Module section of the xorg.conf file specifies loadable modules or drivers to load for the X session. This section might look like this:

Section "Module"
Load "bitmap"
Load "ddc"
Load "dri"
Load "extmod"
Load "freetype"
Load "glx"
Load "int10"
Load "type1"
Load "vbe"
EndSection

These modules can range from special video card support to font rasterizers. The modules are located in subdirectories under the /usr/lib/xorg/modules/ directory.

The InputDevice Section

The InputDevice section configures a specific device, such as a keyboard or mouse, as in this example:

Section "InputDevice"
Identifier "Generic Keyboard"
Driver "kbd"
Option "CoreKeyboard"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "gb"
EndSection

Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ExplorerPS/2"
Option "ZAxisMapping" "4 5"
Option "Emulate3Buttons" "true"
EndSection

You can configure multiple devices, and there might be multiple InputDevice sections. The preceding example specifies a basic keyboard and a two-button PS/2 mouse (actually, a Logitech Laser mouse).

The Monitor Section

The Monitor section configures the designated display device as declared in the ServerLayout section, as shown in this example:

Section "Monitor"
Identifier "C17-5"
Option "DPMS"
EndSection

Note that the X server automatically determines the best video timings according to the horizontal and vertical sync and refresh values in this section. If required, old-style modeline entries (used by distributions and servers prior to XFree86 4.0) might still be used. If the monitor is automatically detected when you configure X (see the "Configuring X" section, later in this chapter), its definition and capabilities are inserted in your xorg.conf file from the MonitorsDB database. This database contains more than 600 monitors and is located in the /usr/share/hwdata director.

The Device Section

The Device section provides details about the video graphics chipset used by the computer, as in this example:

Section "Device"
Identifier "ATI Technologies, Inc. RV350 AR [Radeon 9600 XT]"
Driver "fglrx"
BusID "PCI:1:0:0"
Option "UseFBDev" "true"
EndSection

This example identifies an installed video card as using an ATI Radeon 9600 XT (RV350) graphics chipset. The Driver entry tells the Xorg server to load the fglrx_drv.o module from the /usr/lib/xorg/modules/drivers directory. Different chipsets have different options. For example, here's the entry for a NeoMagic video chipset:

Section "Device"
Identifier "NeoMagic (laptop/notebook)"
Driver "neomagic"
VendorName "NeoMagic (laptop/notebook)"
BoardName "NeoMagic (laptop/notebook)"
Option "externDisp"
Option "internDisp"
EndSection

In this example, the Device section specifies the driver for the graphics card (neomagic_ drv.o) and enables two chipset options (externDisp and internDisp) to allow display on the laptop's LCD screen and an attached monitor.

The Xorg server supports hundreds of different video chipsets. If you configure X11 but subsequently change the installed video card, you need to edit the existing Device section or generate a new xorg.conf file, using one of the X configuration tools discussed in this chapter, to reflect the new card's capabilities. You can find details about options for some chipsets in a companion man page or in a README file under the /usr/lib/X11/doc directory. You should look at these sources for hints about optimizations and troubleshooting. However, this should be fairly rare as Ubuntu sports a comprehensive hardware detection system, automatically adjusting settings to take account of newly installed hardware.

The Screen Section

The Screen section ties together the information from the previous sections (using the Screen0, Device, and Monitor Identifier enTRies). It can also specify one or more color depths and resolutions for the session. Here's an example:

Section "Screen"
Identifier "Default Screen"
Device "ATI Technologies, Inc. RV350 AR [Radeon 9600 XT]"
Monitor "C17-5"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1280x1024" "1024x768" "800x600" "640x480"
EndSubSection
SubSection "Display"
Depth 16
Modes "1280x1024" "1024x768" "800x600" "640x480"
EndSubSection
SubSection "Display"
Depth 8
Modes "1280x1024" "1024x768" "800x600" "640x480"
EndSubSection
...

In this example a color depth of millions of colors and a resolution of 1280x1024 is the default, with optional resolutions of 1024x768, 800x600, and 640x480. Multiple Display subsection entries with different color depths and resolutions (with settings such as Depth 16 for thousands of colors) can be used if supported by the graphics card and monitor combination. You can also use a DefaultDepth enTRy (which is 24, or millions of colors, in the example), along with a specific color depth to standardize display depths in installations.

You can also specify a desktop resolution larger than that supported by the hardware in your monitor or notebook display. This setting is known as a virtual resolution in the Display subsection. This allows, for example, an 800x600 display to pan (that is, slide around inside) a virtual window of 1024x768.

Note

If your monitor and graphics card support multiple resolutions and the settings are properly configured, you can use the key combination of Ctrl+Alt+Keypad+ or Ctrl+Alt+Keypad- to change resolutions on the fly during your X session.


Configuring X

Although the Ubuntu installer can be relied upon to configure X during installation, problems can arise if the PC's video card is not recognized. If you do not get the graphical login that should come up when you reboot after installation (refer to Chapter 3, "Installing Ubuntu"), then you will have to do some configuration by hand in order to get X working. Note that some installs, such as for servers, do not require that X be configured for use to support active X sessions, but might require installation of X and related software to support remote users and clients.

You can use the following configuration tools, among others, to create a working xorg.conf file:

  • dpkg reconfigure xserver-xorg This is Ubuntu's text-based configuration tool, which guides you through creating an xorg.conf file.

  • Xorg The X server itself can create a skeletal working configuration.

The following sections discuss how to use each of these software tools to create a working xorg.conf file.

Configuring X with the dpkgreconfigure Option

You can use the dpkgreconfigure client to create or update an xorg.conf file. The beauty of this tool is that it is command line only, so it can be used if you have problems with your Xorg server. You start it by getting to a terminal and entering:

$ sudo dpkgreconfigure xserver-xorg

to bring up the configuration dialog for configuring X. Your best bet is to try the autodetect before heading on to manually configure the X server. Nine times out of ten Ubuntu gets it right, but if you need to manually configure X then make sure you have all the necessary details such as:

  • Graphics card make and chipset (e.g. ATI 9600 ([r350])

  • Amount of memory on your graphics card

  • Refresh rates (both horizontal and vertical) for your monitor

  • Supported screen resolutions for your monitor

  • Type of keyboard and mouse that you are using

If you have all of this information available then you will have no problem configuring X.

Using Xorg to Configure X

You can create the xorg.conf file manually by typing one from scratch using a text editor, but you can also create one automatically by using the Xorg server or configuration utilities (as discussed in the previous sections). As the root operator, you can use the following on the server to create a test configuration file:

# X -configure

After you press Enter, a file named xorg.conf .new is created in root's home directory, the /root directory. You can then use this file for a test session, like this:

# X config /root/xorg.conf.new

祸兮福所倚

一个叫Ashley的女孩在一次事故中大脑受到的损伤,与其说是损伤,不如说是“变异”,这是这个女孩玩游戏的视频

2006年11月24日星期五

求佛

过去有一位年轻和尚,一心求道,希望有日成佛。但是,多年苦修参禅,似乎没有进步。
有一天,他打听到深山中有一破旧古寺,住持某老和尚修炼圆通,是得道高僧。
于是,年轻和尚打点行装,跋山涉水,千辛万苦来到老和尚面前。
两人打起了机锋。
年轻和尚:请问老和尚,你得道之前,做什么?
老和尚:砍柴担水做饭。
年轻和尚:那得道之后,又做什么?
老和尚:还是砍柴担水做饭。
年轻和尚于是哂笑:那何谓得道?
老和尚:我得道之前,砍柴时惦念着挑水,挑水时惦念着做饭,做饭时有想着砍柴;得道之后,砍柴即砍柴,担水即担水,做饭即做饭。这就是得道。

2006年11月23日星期四

转型



打算学习下.Net,工作后别人看重的还是你能马上拿出来的本事,没人在乎你Linux内核看的怎么样,上面的就是代价

训练提前结束

突然的雪让训练提前一天结束,还记得年初从上海回来时下的大雪,本来13个小时的车程,硬是用了48个小时。14天什么事情也没有干,就是想着赶紧回来买些书看看,好久没有充电了。

2006年11月9日星期四

开训


短暂的三天休息时间已经享受到头了,下午又要返回去训练,这次是整整2周,2周里要把引体向上从现在的4个提高到最少8个,要不考核过不去,1000米也要再提高一下。


到底往哪个部门分配还不清楚,最理想的当然是网监处,不过听说都走关系,5个名额里面有没有我还是个问题。剩下的好像还有110指挥中心,和刑警大队。

2006年11月8日星期三

Thinking like a Genius


原文


"Even if you're not a genius, you can use the same strategies as Aristotle and Einstein to harness the power of your creative mind and better manage your future."


The following eight strategies encourage you to think productively, rather than reproductively, in order to arrive at solutions to problems. "These strategies are common to the thinking styles of creative geniuses in science, art, and industry throughout history."


1. Look at problems in many different ways, and find new perspectives that no one else has taken (or no one else has publicized!)



Leonardo da Vinci believed that, to gain knowledge about the form of a problem, you begin by learning how to restructure it in many different ways. He felt that the first way he looked at a problem was too biased. Often, the problem itself is reconstructed and becomes a new one.



2. Visualize!



When Einstein thought through a problem, he always found it necessary to formulate his subject in as many different ways as possible, including using diagrams. He visualized solutions, and believed that words and numbers as such did not play a significant role in his thinking process.



3. Produce! A distinguishing characteristic of genius is productivity.



Thomas Edison held 1,093 patents. He guaranteed productivity by giving himself and his assistants idea quotas. In a study of 2,036 scientists throughout history, Dean Keith Simonton of the University of California at Davis found that the most respected scientists produced not only great works, but also many "bad" ones. They weren't afraid to fail, or to produce mediocre in order to arrive at excellence.



4. Make novel combinations. Combine, and recombine, ideas, images, and thoughts into different combinations no matter how incongruent or unusual.



The laws of heredity on which the modern science of genetics is based came from the Austrian monk Grego Mendel, who combined mathematics and biology to create a new science.



5. Form relationships; make connections between dissimilar subjects.



Da Vinci forced a relationship between the sound of a bell and a stone hitting water. This enabled him to make the connection that sound travels in waves. Samuel Morse invented relay stations for telegraphic signals when observing relay stations for horses.



6. Think in opposites.



Physicist Niels Bohr believed, that if you held opposites together, then you suspend your thought, and your mind moves to a new level. His ability to imagine light as both a particle and a wave led to his conception of the principle of complementarity. Suspending thought (logic) may allow your mind to create a new form.



7. Think metaphorically.



Aristotle considered metaphor a sign of genius, and believed that the individual who had the capacity to perceive resemblances between two separate areas of existence and link them together was a person of special gifts.



8. Prepare yourself for chance.



Whenever we attempt to do something and fail, we end up doing something else. That is the first principle of creative accident. Failure can be productive only if we do not focus on it as an unproductive result. Instead: analyze the process, its components, and how you can change them, to arrive at other results. Do not ask the question "Why have I failed?", but rather "What have I done?"




越狱第十集

剧情设计的有些不尽人意,Burrows作为“杀害”了总统的弟弟,并且立刻机会被判死刑的人,在越狱并且被抓到后居然只有一辆警车压着他们父子两个,结果被一辆Ford成功救出。

也许他们父子两个在第九集就不应该被抓.