Monday, September 24, 2007

Remotely run X programs in Mac using Cygwin in local PC


1. Make sure X windows server has been installed in Cygwin (local PC)

2. Make sure X11 tunneling has been enable in remote Mac OS X.
http://developer.apple.com/qa/qa2004/qa1383.html

For security reasons, Mac OS X does not enable X11 forwarding by default. In order for clients to receive X11 forwarding, the system administrator must explicitly enable it on the Mac OS X system. This is done by altering the /etc/sshd_config file, either by manual edit, or as shown as below:
sed 's/#X11Forwarding\ no/X11Forwarding\ yes/' /etc/sshd_config > /tmp/sshd_config
sudo mv /tmp/sshd_config /etc/.
3. In local Cygwin, run "ssh -X myusername@remotemacserver"

4. In remote Mac, the DISPLAY will be automatically set as "localhost:10.0". It's ready to run X programs such as Amide.



Thursday, August 23, 2007

一个关于如何在普通PC上安装Mac OS X的详细说明

http://wiki.osx86project.org/wiki/index.php/Vmware_how_to

如果上面网址不能访问,请下载本地PDF文件:
Vmwarehowto.pdf

Wednesday, August 22, 2007

如何检查port是不是打开了?

1. 使用命令行:
telnet tutorsky.dyndns.org 5060
Trying 68.32.224.241...
Connected to tutorsky.dyndns.org. --这个显示5060端口是打开的
Escape character is '^]'.

telnet tutorsky.dyndns.org 5061
Trying 68.32.224.241...
没有出现connected to... --显示5061端口没有打开。

2. 访问这个网页:http://www.canyouseeme.org/

Success: I can see your service on 68.32.224.241 on port (5060)
Your ISP is not blocking port 5060

3. netstat

比如:netstat -a -p udp


Tuesday, August 21, 2007

PHP 和 MySQL for Mac

http://developer.apple.com/internet/opensource/osdb.html
http://developer.apple.com/internet/opensource/php.html

Wednesday, July 11, 2007

Mac上的Terminal

Unix Terminal Emulators

There are two levels of Chinese support that must be addressed. The first is in the Unix terminal emulation software, which needs to be set up to emulate a localized Chinese Unix terminal in order to handle double-byte Chinese character set encodings (as opposed to handling Chinese with Unicode). See the entries below for some details.

The second level is in the Unix operating system. The shell environment variables have to be set to the corresponding Chinese locale (when connecting to a localized Chinese server, for example). You can either type in the commands manually at the command line or add them to your ~/.cshrc file. Both terminal emulators start up with the default shell (tcsh, for example). When tcsh starts, it looks for and reads a number of initialization files. One of those files is ~/.cshrc. Placing setenv commands in the ~/.cshrc file ensures that the locale is set at startup and saves you the trouble of manually typing the commands every time.

Commands for the tcsh shell and Traditional Chinese locale (Big Five character set):

setenv LC_CTYPE zh_TW.Big5
setenv LANG zh_TW.Big5

Commands for the tcsh shell and Simplified Chinese locale (GB 2312 character set):

setenv LC_CTYPE zh_CN.EUC
setenv LANG zh_CN.EUC

To upload or download files containing Chinese, you must set the FTP transfer mode to binary format before you enter the get or put commands.

Apple Terminal

OS X only, in the /Applications/Utilities folder. This discussion is based on Terminal 1.4.1 in OS X 10.3.

UTF-8 is the default setting, and you can enter Unicode Chinese characters using the Character Palette without changing any settings. Other standard Chinese character set encodings are available in Terminal > Window Settings... Display, and thus Terminal shell windows can be set up to emulate localized Chinese Unix terminals.

iTerm

OS X only. iTerm is an open-source project focused on multilingual support, including Unicode and all standard East Asian encodings. Change the encoding in Preferences > Shell settings to set up iTerm to emulate a localized Chinese Unix terminal.

http://iterm.sourceforge.net/

以上来自http://www.yale.edu/chinesemac/pages/internet.html

其他资料:

http://tristan.ethereal.net/osx/terminal.html

http://apple.slashdot.org/article.pl?sid=03/06/09/1754234

http://www.rift.dk/news.php?item.7.6

Monday, July 2, 2007

Mac OS X 最大进程数默认为100

有时候会出现"fork: Resource temporarily unavailable" 或者 "tcsh: no more processes" 的错误,是因为进程数达到最大值了。

运行%launchctl limit,输出:

        cpu         unlimited      unlimited      
        filesize    unlimited      unlimited      
        data        6291456        unlimited      
        stack       8388608        67108864       
        core        0              unlimited      
        rss         unlimited      unlimited      
        memlock     unlimited      unlimited      
        maxproc     100            532            
        maxfiles    256            unlimited     

To change this you need to create /etc/launchd.conf file if it does not already exist and add the following line:

limit maxproc 512 2048

The first number is the soft limit and the second number is the hard limit. You can pick different values if you want.




按任务名称kill系列进程

A method for killing a process from the command line: using a variation on a script in this writeup. The secret is using the -o flag to control the output of ps. You can then use awk and grep as usual, and xargs to cycle through the results and kill all matching processes. Consider this command:
ps axco pid,command
That will output only the process ID and the command name, which makes for easy pickings for a script to find and kill! I changed the original script from the command ps e to ps axc -- -a, -x, and other flags will vary depending on the user's needs. However, do not invoke the script with the -u (e.g. ps aux ), which is the way that it is normally suggested to run the ps command. The -u flag specifies the format, and overides the -o flag.

Example: to add this to a script to kill the Finder you wold do:
ps axco pid,command | grep Finder | awk '{ print $1; }' | xargs kill -9
The original article explains how to variablize it, so you could set up a generic script and run it on multiple platforms with different versions of ps by invoking:
script_name $SIG $PROCESSNAME
Remember! This script kills all processes that are named $PROCESSNAME, so it's a good idea to use ps -c, which just prints the executable name, instead of the full path. That way it won't accidently kill another process that maches a folder or something else.

There are some other tricks for using ps in that writeup as well...