2008-02-21

Phrase from Dennis

  • Eat your own dog food
  • Red Envelope

Google 了一下, 找到:

  • Eat one's own dog food
  • Sip your own champagne
  • Sip one's own champagne

2008-02-20

2008-02-19

[Ubuntu] Desktop vs. Server

Desktop 版跟 Server 版使用不同的 kernel:

desktop: linux-image (linux-image-2.6.15-23)
server: linux-image-server (linux-image-2.6.15-23-server)

desktop # uname -a
Linux ubuntu606 2.6.15-51-386 #1 PREEMPT Tue Feb 12 16:52:52 UTC 2008 i686 GNU/Linux
server # uname -a
Linux dapper-server 2.6.15-51-server #1 SMP Thu Dec 6 21:37:18 UTC 2007 i686 GNU/Linux

desktop 跟 server 的 /etc/lsb-release 也是相同的:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=6.06
DISTRIB_CODENAME=dapper
DISTRIB_DESCRIPTION="Ubuntu 6.06.2 LTS"

Compiling Expect 5.43 on Ubuntu 6.06

  • $ apt-get install tcl8.4-dev
  • $ wget http://expect.nist.gov/expect.tar.gz
  • $ tar -xzf ...
  • $ ./configure --prefix=... --with-tcl=/usr/lib/tcl8.4 --with-tclinclude=/usr/include/tcl8.4/tcl-private
  • $ make
  • $ make install

2008-02-17

Apt-file does not work for Dapper

近日发现 apt-file 不好用了, 不解. 看了一下 apt-file 的 man page, 它要用到 server 上的一个叫 Contents-i386.gz 的文件, 所有的信息应该都在这个文件里面, 然而 server 上的这个文件大小只有 677 个 byte. 到 server 的 Edgy 的目录里面看了一下, 这个文件的大小有 11M 呢, 不晓得 Dapper 里面的这个文件为什么这么小了. 心生一计, 来个偷梁换柱, 把 Edgy 里面的文件 download 下来改名成 Dapper 的就好了!

2008-02-15

Locale variables

Variable What it's for
LANG The basic language setting used by applications on the system, unless overridden by one of the other locale environment variables
LC_CTYPE The character set used to display and input text
LC_NUMERIC How non-monetary numeric values are formatted on screen
LC_TIME How date and time values are formatted
LC_COLLATE How to sort various information items (e.g. defines the order of the alphabet so items can be ordered alphabetically by the sort command)
LC_MONETARY How monetary numeric values are formatted
LC_MESSAGES Which language is to display messages to the end user
LC_PAPER Definitions of paper formats and standards
LC_NAME How names are formatted
LC_ADDRESS How to display address information
LC_TELEPHONE How telephone numbers are structured
LC_MEASUREMENT What units of measurement are used
LC_IDENTIFICATION
LC_ALL This variable serves as a powerful override over all the other locale environment variables. When its value is set, applications use that value to determine which locale settings to use regardless of the values of the other variables

Perl 5.10.0 released

Perl 5.10.0 Released

Today (December 18th, 2007) the Perl Foundation announces the release of Perl 5.10, the first major upgrade to the wildly popular dynamic programming language in over five years. This latest version builds on the successful 5.8.x series by adding powerful new language features and improving the Perl interpreter itself. The Perl development team, called the Perl Porters, has taken features and inspiration from the ambitious Perl 6 project, as well as from chiefly academic languages and blended them with Perl's pragmatic view to practicality and usefulness.

Significant new language features

The most exciting change is the new smart match operator. It implements a new kind of comparison, the specifics of which are contextual based on the inputs to the operator. For example, to find if scalar $needle is in array @haystack, simply use the new ~~ operator:

  if ( $needle ~~ @haystack ) ...

The result is that all comparisons now just Do The Right Thing, a hallmark of Perl programming. Building on the smart-match operator, Perl finally gets a switch statement, and it goes far beyond the kind of traditional switch statement found in languages like C, C++ and Java.

Regular expressions are now far more powerful. Programmers can now use named captures in regular expressions, rather than counting parentheses for positional captures. Perl 5.10 also supports recursive patterns, making many useful constructs, especially in parsing, now possible. Even with these new features, the regular expression engine has been tweaked, tuned and sped up in many cases.

Other improvements include state variables that allow variables to persist between calls to subroutines; user defined pragmata that allow users to write modules to influence the way Perl behaves; a defined-or operator; field hashes for inside-out objects and better error messages.

Interpreter improvements

It's not just language changes. The Perl interpreter itself is faster with a smaller memory footprint, and has several UTF-8 and threading improvements. The Perl installation is now relocatable, a blessing for systems administrators and operating system packagers. The source code is more portable, and of course many small bugs have been fixed along the way. It all adds up to the best Perl yet.

For a list of all changes in Perl 5.10, see Perl 5.10's perldelta document included with the source distribution. For a gentler introduction of just the high points, the slides for Ricardo Signes' Perl 5.10 For People Who Aren't Totally Insane talk are well worth reading.

Don't think that the Perl Porters are resting on their laurels. As Rafael Garcia-Suarez, the release manager for Perl 5.10, said: "I would like to thank every one of the Perl Porters for their efforts. I hope we'll all be proud of what Perl is becoming, and ready to get back to the keyboard for 5.12."

2008-02-14

Searching Ubuntu Packages

http://packages.ubuntu.com/

[Ubuntu] Components

Components

The Ubuntu software repository is divided into four components, main, restricted, universe and multiverse on the basis of our ability to support that software, and whether or not it meets the goals laid out in our Free Software Philosophy.

The standard Ubuntu installation is a subset of software available from the main and restricted components. You can install additional software using installation software such as Synaptic Package Manager or Aptitude. Other components are added by editing the /etc/apt/sources.list file. See "man sources.list" for more information on editing the sources.list file.

"main" component

The main distribution component contains applications that are free software, can freely be redistributed and are fully supported by the Ubuntu team. This includes the most popular and most reliable open source applications available, much of which is installed by default when you install Ubuntu.

Software in main includes a hand-selected list of applications that the Ubuntu developers, community, and users feel are important and that the Ubuntu security and distribution team are willing to support. When you install software from the main component you are assured that the software will come with security updates and technical support.

We believe that the software in main includes everything most people will need for a fully functional desktop or internet server running only open source software.

The licences for software applications in main must be free, but main may also may contain binary firmware and selected fonts that cannot be modified without permission from their authors. In all cases redistribution is unencumbered.

"restricted" component

The restricted component is reserved for software that is very commonly used, and which is supported by the Ubuntu team even though it is not available under a completely free licence. Please note that it may not be possible to provide complete support for this software since we are unable to fix the software ourselves, but can only forward problem reports to the actual authors.

Some software from restricted will be installed on Ubuntu CDs but is clearly separated to ensure that it is easy to remove. We include this software because it is essential in order for Ubuntu to run on certain machines - typical examples are the binary drivers that some video card vendors publish, which are the only way for Ubuntu to run on those machines. By default, we will only use open source software unless there is simply no other way to install Ubuntu. The Ubuntu team works with such vendors to accelerate the open-sourcing of their software to ensure that as much software as possible is available under a Free licence.

"universe" component

The universe component is a snapshot of the free, open source, and Linux world. In universe you can find almost every piece of open source software, and software available under a variety of less open licences, all built automatically from a variety of public sources. All of this software is compiled against the libraries and using the tools that form part of main, so it should install and work well with the software in main, but it comes with no guarantee of security fixes and support. The universe component includes thousands of pieces of software. Through universe, users are able to have the diversity and flexibility offered by the vast open source world on top of a stable Ubuntu core.

Canonical does not provide a guarantee of regular security updates for software found in universe but will provide these where they are made available by the community. Users should understand the risk inherent in using packages from the universe component.

Popular or well supported pieces of software will move from universe into main if they are backed by maintainers willing to meet the standards set for main by the Ubuntu team.

"multiverse" component

The "multiverse" component contains software that is "not free", which means the licensing requirements of this software do not meet the Ubuntu "main" Component Licence Policy.

The onus is on you to verify your rights to use this software and comply with the licensing terms of the copyright holder.

This software is not supported and usually cannot be fixed or updated. Use it at your own risk.

mailsend

Mailsend is a simple program to send mail via SMTP protocol (That's how all emails are sent). I needed to send a piece of alert mail from a program in a networked Windows machine, but could not find a simple program like this installed. So I wrote one. You might find it useful in some situations. The program does not use any config file and I plan to keep it that way. At this time I don't have any plan to port it to Unix. Well I had a need and I ported it to Unix (v1.05, Feb-24-2004).

cygpath: Convert Unix and Windows format paths, or output system path information

Refer to cygpath(1) for details

[kw: cygwin]

2008-02-08

[Mac OS X] Remove the scrollbar but not the buffer from Terminal

Remove the scrollbar but not the buffer from Terminal

Coming from a Linux background, I miss having a terminal window that had a buffer but did not display a scrollbar. Terminal previously would not allow you to have one without the other.

While setting up a special terminal window, I noticed that the .term files have a separate entry for the scrollbar and the buffer. While the GUI combines these, you can go into the .term file itself and turn off the scroll bar and keep the buffer!

[robg adds: To make this work, first you'll need to create a saved Terminal using File -> Save. Hopefully it saves in the default location (your user's Library -> Application Support -> Terminal folder). This allows the saved Terminal to be used from the File -> Library menu. Regardless of where it's saved, once you have a saved Terminal, open it in your favorite editor and search for:


<key>Scrollbar</key>
<string>YES</string>
Change the YES to NO, save the file, and then open it in Terminal. You should now have a window with scrollback but without the scrollbar.]

2008-02-06

MacPorts upgraded

今天升级 MacPorts 到 1.6 了, 同时发现 Tcl 8.5 release 了, Subversion 也有 1.4.6 了.

Changes in Tcl 8.5

2008-02-05

acct(2)

NAME
acct -- enable or disable process accounting

SYNOPSIS
#include <unistd.h>

int
acct(const char *file);

DESCRIPTION
The acct() call enables or disables the collection of system accounting
records. If the argument file is a nil pointer, accounting is disabled.
If file is an existing pathname (null-terminated), record collection is
enabled and for every process initiated which terminates under normal
conditions an accounting record is appended to file. Abnormal conditions
of termination are reboots or other fatal system problems. Records for
processes which never terminate can not be produced by acct().

For more information on the record structure used by acct(), see
/usr/include/sys/acct.h and acct(5).

This call is permitted only to the super-user.

NOTES
Accounting is automatically disabled when the file system the accounting
file resides on runs out of space; it is enabled when space once again
becomes available.

2008-02-04

Jabber servers

  • MSN
    • nedbsd.nl
    • jabber.no
  • Yahoo
    • jaim.at
    • jabber.no
  • QQ
    • freelinq.com

[cygwin] Run crond service

$ cron-config

2008-01-30

[Cygwin] Install xinetd service

  • $ xinetd-config
  • $ cygrunsrv -I xinetd -p /usr/sbin/xinetd -d 'CYGWIN xinetd' -a '-stayalive -pidfile /var/run/xinetd.pid'
  • $ cygrunsrv -S xinetd

How to start SSH service in Cygwin

  1. $ vim C:/cygwin/Cygwin.bat
    • Add one line: set CYGWIN=binmode tty ntsec
  2. Restart Cygwin
  3. $ ssh-host-config
    • windows 中会多一个 service 叫 CYGWIN sshd
  4. $ cygrunsrv -S sshd

[kw: cygwin ssh sshd]

Cygwin something

2008-01-28

[Apple] How to hide the menu bar and Dock

Have you ever wanted the ability to hide the Dock and/or the menu bar on an application-by-application basis? That is, when you launch iPhoto, the Dock is hidden, when you launch Google Earth both the Dock and the menu bar are hidden? This can be useful when working on a smaller screen with a program that requires most of the screen for its visuals, or if you just find the Dock and menu bar are cluttering your view of things.

While there are a number of third-party programs out that purport to do just this— ASM and MenuShade come to mind—it’s actually quite easy to do yourself. It just takes a couple of simple edits in one file within the given application.

As an example, I’ll change Stickies so that the Dock and menu bar both go into hiding when the application is launched. Note that they’re not lost for good—they’re simply hiding, and will reappear when you move the mouse into their typical locations. The key to this hint is a property list variable named LSUIPresentationMode. By setting this variable to a certain value within each application’s info.plist file, you can change how the Dock and menu bar behave within that application.

Whenever you do something like this, it’s a very good idea (read: do it!) to make a backup copy of the application in question. Make your modifications on the backup copy of the program, and then if something goes wrong, you’ll only have to delete the backup you created to get things back to normal.

To change how an application handles the Dock and menu bar, you need to find the program’s info.plist file. These are always located inside the application bundle, so start by control-clicking on the backup copy of the app and choosing Show Pacakge Contents from the pop-up menu. In the new window that opens, open the Contents folder and you should find the info.plist file. What you do next depends on whether or not you have Apple’s free Developer Tools, known as Xcode, installed.

Xcode is not installed

If you don’t have Xcode installed, the easiest way to implement this hint is to download and install Brian Webster’s PlistEdit Pro, a third-party shareware application. This $24.95 program works much like the Property List Editor program included with Xcode. There’s a free trial period, so you can test it out yourself before deciding to buy. If you choose to use this program, skip ahead to the Xcode is installed section of this hint for the how-to.

If you’re still reading, that means you’ve chosen not to use a property list editor of some sort. That’s OK; this hint isn’t really all that tough to implement, but you will need a pure text editor such as TextEdit. Open your text editor, then drag and drop the info.plist file onto the text editor’s icon in the Dock. If you’re using a copy of Stickies, as I am, then here’s what you’ll see:


To make Stickies hide the Dock and menu bar when launched, add the following two lines, just below the entry on row four:

<key>LSUIPresentationMode</key>
<integer>4</integer>

Save the changes, and you’re done. Jump down to Putting it to use to see how it works.

Xcode is installed

If you have Xcode (or PListEditor Pro), the changes are even simpler. With Xcode installed, just double-click on the info.plist file and it will open in Property List Editor; PListEditor Pro users may have to use drag-and-drop to open the file.

Once it’s open in either editor, click once on the Root entry in the Property List section of the window, then click the New Child button in the toolbar. Set the name of the entry to LSUIPresentationMode, the Class pop-up to Number, and give it a value of 4. Save the file, and you’re done with the editing.

Putting it to use

In the following short movie clip, you’ll see two versions of Stickies running. The first is the stock Stickies, and you can see both the menubar and the Dock remain visible when it’s launched. The second is my modified Stickies—when it’s launched, both the menu bar and the Dock vanish.

As you can see in the video, the menu bar and Dock both become visible again when you mouse into their respective regions, so nothing is lost for good. Note, however, that this trick will not necessarily work perfectly in every application—hide the menu bar in Photoshop CS2, for instance, and you may have issues selecting items in the menus. If you stick to Cocoa applications (typically those provided by Apple, plus many third-party apps such as those by OmniGroup), you should have good results. Modifying Carbon apps (such as Photoshop, BBEdit, etc.) may be more troublesome.

If you ever want/need to undo what you’ve done, just delete the backup copy of the app you modified, and you’re done. What, you didn’t work on a backup copy? Well, just open the info.plist file in your editor of choice, and remove the two lines you added (or use the Delete feature in your property list editor application). Just make sure the program isn’t running when you do this. Save your changes, relaunch the program, and things should be back to normal.


-- From MacWorld