jeudi 5 novembre 2009

An A-Z Index of the Apple OS X command line

An A-Z Index of the Apple OS X command line

a
alias Create an alias •
alloc List used and free memory
awk Find and Replace text within file(s)
b
basename Convert a full pathname to just a folder path
bash Bourne-Again SHell
bg Send to background •
bind Display readline key and function bindings •
bless Set volume bootability and startup disk options.
break Exit from a For, While, Until or Select loop •
builtin Execute a shell builtin •
bzip Compress or decompress files
c
cal Display a calendar
caller Return the context of a subroutine call •
case Conditionally perform a command •
cat Display the contents of a file
cd Change Directory •
chflags Change a file or folder's flags
chgrp Change group ownership
chmod Change access permissions
chown Change file owner and group
chroot Run a command with a different root directory
cksum Print CRC checksum and byte counts
clear Clear terminal screen
cmp Compare two files
comm Compare two sorted files line by line
command Run a command (not a function) •
complete Edit a command completion [word/pattern/list] •
continue Resume the next iteration of a loop •
cp Copy one or more files to another location
cron Daemon to execute scheduled commands
crontab Schedule a command to run at a later date/time
cut Divide a file into several parts
d
date Display or change the date & time
dc Desk Calculator
dd Data Dump - Convert and copy a file
declare Declare variable & set attributes •
defaults Set preferences, show hidden files
df Display free disk space
diff Display the differences between two files
diff3 Show differences among three files
dig DNS lookup
dirname Convert a full pathname to just a path
dirs Display list of remembered directories •
diskutil Disk utilities - Format, Verify, Repair
disown Unbind a job from the current login session •
ditto Copy files and folders
dot_clean Remove dot-underscore files
drutil Interact with CD/DVD burners
dscacheutil Query or flush the Directory Service/DNS cache
dscl Directory Service command line utility
du Estimate file space usage
e
echo Display message on screen •
ed A line-oriented text editor (edlin)
enable Enable and disable builtin shell commands •
env Set environment and run a utility
eval Evaluate several commands/arguments •
exec Execute a command •
exit Exit the shell •
expand Convert tabs to spaces
expect Programmed dialogue with interactive programs
Also see AppleScript
export Set an environment variable •
expr Evaluate expressions
f
false Do nothing, unsuccessfully
fc Fix command (history)
fdisk Partition table manipulator for Darwin UFS/HFS/DOS
fg Send job to foreground •
file Determine file type
find Search for files that meet a desired criteria
fmt Reformat paragraph text
fold Wrap text to fit a specified width
for Loop command •
fsck Filesystem consistency check and repair
fsaclctl Filesystem enable/disable ACL support
fs_usage Filesystem usage (process/pathname)
ftp Internet file transfer program
g
GetFileInfo Get attributes of HFS+ files
getopt Parse positional parameters
getopts Parse positional parameters •
goto Jump to label and continue execution
grep Search file(s) for lines that match a given pattern
groups Print group names a user is in
gzip Compress or decompress files
h
hash Refresh the cached/remembered location of commands •
head Display the first lines of a file
hdiutil Manipulate iso disk images
history Command History •
hostname Print or set system name
i
id Print user and group names/id's
if Conditionally perform a command •
info Help info
install Copy files and set attributes
j
jobs List active jobs •
join Join lines on a common field
k
kextfind List kernel extensions
kickstart Configure Apple Remote Desktop
kill Stop a process from running
l
l List files in long format (ls -l)
last Indicate last logins of users and ttys
launchctl Load or unload daemons/agents
ll List files in long format, showing invisible files (ls -la)
less Display output one screen at a time
let Evaluate expression •
lipo Convert a universal binary
ln Make links between files (hard links, symbolic links)
local Set a local (function) variable •
locate Find files
logname Print current login name
login log into the computer
logout Exit a login shell (bye) •
lpr Print files
lprm Remove jobs from the print queue
lpstat Printer status information
ls List information about file(s)
lsregister Reset the Launch Services database
lsbom List a bill of materials file
lsof List open files
m
man Help manual
mdfind Spotlight search
mdutil Manage Spotlight metadata store
mkdir Create new folder(s)
mkfifo Make FIFOs (named pipes)
more Display output one screen at a time
mount Mount a file system
mv Move or rename files or directories
n
net Manage network resources
netstat Show network status
networksetup Network and System Preferences
nice Set the priority of a command
nohup Run a command immune to hangups
ntfs.util NTFS file system utility
o
onintr Control the action of a shell interrupt
open Open a file/folder/URL/Application
osacompile Compile Applescript
osascript Execute AppleScript
p
passwd Modify a user password
paste Merge lines of files
pbcopy Copy data to the clipboard
pbpaste Paste data from the Clipboard
pico Simple text editor
ping Test a network connection
pkgutil Query and manipulate installed packages
plutil Property list utility
pmset Power Management settings
popd Restore the previous value of the current directory •
pr Convert text files for printing
printenv Print environment variables
printf Format and print data •
ps Process status
pushd Save and then change the current directory
pwd Print Working Directory •
q
quota Display disk usage and limits
r
rcp Copy files between machines
read Read one line from standard input •
readonly Mark a variable or function as read-only •
reboot Stop and restart the system
return Exit a function •
rev Reverse lines of a file
rm Remove files
rmdir Remove folder(s)
rpm Remote Package Manager
rsync Remote file copy - Sync file tree (also RsyncX)
s
say Convert text to audible speech
screen Multiplex terminal, run remote shells via ssh
screencapture Capture screen image to file or disk
sdiff Merge two files interactively
security Administer Keychains, keys, certificates and the Security framework
sed Stream Editor
select Generate a list of items •
set Set a shell variable = value •
setfile Set attributes of HFS+ files
shift Shift positional parameters •
shopt Set shell options •
shutdown Shutdown or restart OS X
sleep Delay for a specified time
softwareupdate System software update tool
sort Sort text files
source Execute commands from a file •
split Split a file into fixed-size pieces
stop Stop a job or process
su Substitute user identity
sudo Execute a command as another user
sum Print a checksum for a file
suspend Suspend execution of this shell •
sw_vers Print Mac OS X operating system version
system_profiler Report system configuration
systemsetup Computer and display system settings
t
tail Output the last part of files
tar Tape ARchiver
tee Redirect output to multiple files
test Condition evaluation •
textutil Manipulate text files in various formats (Doc,html,rtf)
time Measure Program Resource Use
times Print shell & shell process times •
touch Change file timestamps
tr Translate, squeeze, and/or delete characters
trap Execute a command when the shell receives a signal •
traceroute Trace Route to Host
true Do nothing, successfully
tty Print filename of terminal on stdin
type Describe a command •
u
ufs.util Mount/unmount UFS file system
ulimit limit the use of system-wide resources •
umask Users file creation mask
umount Unmount a device
unalias Remove an alias •
uname Print system information
unexpand Convert spaces to tabs
uniq Uniquify files
units Convert units from one scale to another
unset Remove variable or function names •
until Loop command •
users Print login names of users currently logged in
uuencode Encode a binary file
uudecode Decode a file created by uuencode
uuidgen Generate a Unique ID (UUID/GUID)
uucp Unix to Unix copy
v
vi Text Editor
w
wait Wait for a process to complete •
wc Print byte, word, and line counts
where Report all known instances of a command
which Locate a program file in the user's path
while Loop command •
who Print all usernames currently logged on
whoami Print the current user id and name (`id -un')
write Send a message to another user
x
xargs Execute utility - passing arguments
yes Print a string until interrupted

Commands marked • are bash built-in commands.
OS X Panther 10.3, Tiger 10.4 and Leopard 10.5 default to running the bash shell, this runs under 'Darwin' the open source core of OSX.

OS X Man Pages - Apple Developer Connection
Discussion forum
Links to other Sites, Books etc...

Mac OS X is a rock-solid system that's beautifully designed. I much prefer it to Linux - Bill Joy

lundi 2 novembre 2009

经济学原理——2009.11.2 学习笔记

经济来源于希腊语 oikonomos, 原意是管理一个家庭的人。 类比:家庭分工 社会分工。
稀缺性:社会资源有限,管理十分重要。经济学研究如何管理自己的稀缺资源(时间?)

本章讲述经济学的十大原理:

1.1: 如何决策
------------
原理1: 人们面临权衡取舍
天下没有免费的午餐——如何取舍,放弃些什么,追求些什么。
支配时间,支配收入。
环保-》污染管制-》利润下降-》收入减少。(环保 利益)
平等-》税收-》高收入-》高税收-》平等打破了效率。

原理2: 某种东西的成本是为了得到他所放弃的东西
利益与成本,大学: 利益-》丰富了知识
成本-》时间(这些时间可以用来工作=收入)
机会成本(opportunity cost): 是为了得到这种东西所放弃的东西。
大学球员:进入NBA or 再在大学打一年?

原理2:理性人考虑边际量
经济学家通常假设:人是理性的。
理性人(rational people):尽最大努力去实现自己的目标。
决策很少是黑与白的选择,而是在两者之间——边际变动(marginal change)。
理性人通过比较边际利益(marginal benefit)与边际成本(marginal cost)来做出决定。
ex: 飞机一趟旅行10w 么元,200个座位,每人应该500美元;如果有10个空位,飞机起飞前可以以300美元出售票价,因为此时的边际成本很小。
边际决策解释另外一个现象:水便宜,钻石贵。和钻石相比,水是不可或缺的。why?因为水太多了=边际利益微不足道。
正确理解边际利益和边际成本。

原理4: 人们会对激励作出反应
激励(incentive),在经济学中,激励起着中心作用。
有人这样定义经济学:人们对激励作出的反应,其余内容都是对此的解释。
价格对消费者和生产者行为的激励。
许多政策改变了人们面临的成本或利益。ex: 汽油税-》开小型车,拼车,公交车
安全带:减少了每次车祸的死亡人数,却增加了车祸的数量。-》司机的死亡几率减小,行人几率增大。
政策:激励作用。
激励型工资-》更有效率。

※即问即答:
1:权衡取舍:找工作 & 读博士
2:
3:SONY MD Player

1.2: 人们如何相互交易
--------------
原理5: 贸易可以使每个人的状况都变得更好
美国和日本经济的竞争:会使两国都变得更好。
相互交易使交易双方获益。

原理6: 市场通常是组织经济活动的一种好方法
计划经济-》市场经济。
亚当.斯密:看不见的手:价格会自动调整。-》税收扭曲了价格,也扭曲了家庭和企业的决策。计划经济之所以失败,是因为他们吧这只看不见的手绑起来了。
每个人所做的经济决策,全部都是基于他自己的利益-》经济的参与者大都是受利己心的驱动,受到“看不见的手”的指引,促进总体的经济福利。

原理7: 政府有时可以改善市场结果
为什么需要政府?政府用来实施规则并维持对市场经济至关重要的制度,只有这样,“看不见的手”才能发挥作用。
因为市场经济需要实施产权制度,以使个人能够占有稀缺资源。
ex: 只有确保了顾客在离开前会付费,餐馆才会提供服务。
政府干预:促进平等与效率。
“看不见的手”: 市场失灵(market failure)-》垄断。
政策: 什么时候使正确的?

※即问即答
1:一个国家闭关,无竞争,市场无生气
2:有市场因为有供求关系。政府宏观调控。

1.3: 整体经济如何运行
--------------
原理8: 一国的生活水平取决于他的生产物品与劳务的能力
各国的生活水平不同-》生产率(productivity)不同
提高生活水平,决策者-》工人收到良好的教育,拥有生产物频域先进的生产工具,最好的技术。

原理9: 当政府发行了过多的货币时,物价上升
通货膨胀(inflation)每年的增长率为2.5%,物价每30年翻一番。(与收入的增长率差不多?)

原理10: 社会面临通货膨胀与失业之间的短期权衡取舍
通货膨胀-》支出水平高-》雇佣更多的工人-》更少的人失业

※即问即答
三个原理:
1:生产率决定生活水平
2:货币发行过多引起通货膨胀
3:通货膨胀能提高就业率

1.4: 结论
---------------
回忆经济学十大原理
1:决策
2:理智
3:激励
4:通货膨胀-》就业
5:市场经济
6:货币过多-》通货膨胀

7:某种东西的成本是为了得到他所放弃的东西
8:贸易可以让双边都更好
9:政府可以适当干预
10:国家的生活水平取决于生产率

100 Free Applications for Mac OS X

http://www.usingmac.com/2008/11/12/100-free-applications

[Tips]快速获知文件类型- Mac OS X

有的时候碰上没见过的文件扩展名,有些朋友就手忙脚乱了,不知道该用什么软件打开文件。
有的朋友选择去google,这未尝不可,不过有时扩展名什么都说明不了,文件的真正类型有时可能和扩展名无关。

那么如何了解一个文件的类型呢?我们需要用到UNIX命令----> file。
这个命令读取文件头,返回文件类型,使用方法也相当简单。打开终端(“应用程序” > “实用程序” > “终端”),输入file和空格,不回车,把想探测的文件拖入终端窗口,回车即可 (或者直接输入文件的路径名)。

这个命令不仅可以用来获知文件类型,还有一个很实用的用途是获知Universal程序所包含的代码类型,需要注意的是,使用的时候不要将程序app拖进终端,而是要通过Show Package Contents来进入app包的内部,然后进入MacOS文件夹,找到真正的程序文件。

lundi 26 octobre 2009

How to input French in MacTex

Insert the following lines in front of your main document:

\usepackage[T1]{fontenc}
\usepackage[frenchb]{babel}
\usepackage[applemac]{inputenc}

dimanche 25 octobre 2009

[转] 7款Mac截图工具软件

截图是一个比较常用的功能,虽然Mac内置了截图程序,但远远不够用。本文简单介绍7款Mac截图工具软件,有免费的,也有收费的。虽然免费的功能很有限,但总比内置的要高级些,将就着用吧。选择了Mac, 你就得学会将就 :)

Grab

Mac OS X 内置的截图应用程序。Grab截屏的特点包括可截取带有光标的屏幕,光标样式可以在设置里选择。还可以利用Grab时间延迟功能,也能截取带菜单的截图。

用苹果电脑自带的截图功能的快捷键:

* 苹果+shift+3 抓全屏
* 苹果+shift+4 抓区域
* 苹果+shift+4 然后 空格 抓窗口

Skitch (免费)

Skitch是Mac平台上一款非常好玩的截图分享软件,和著名的漫画制作软件Comic Life出自的同一家公司:Plasq。比起Mac自带的截图工具,Skitch就好玩多了。它不仅有截图功能,还有丰富的界面特效,还可以直接用 iSight拍下自己的照片,用Skitch随意涂鸦一番,然后直接拖拽到桌面保存或拖拽到Mail.app发送给朋友。via

InstantShot! (免费)

InstantShot! 是Mac上的免费截图软件,它不但免费,而且还支持中文。支持自定义文件保存路径和文件前缀名等功能。

Capture Me (免费)

一款不错的MAC截图工具,使用Capture Me的时候,它会想一个照相机的镜头一样,半透明的摆放在桌面上,你可以任意的移动和改变它的尺寸,直至你把要截图的内容包括在其中,点击截图按钮以后,你可以以多种格式储存,而且可以指定储存的像素大小。

Snapz Pro X (收费)

Snapz Pro X是一款Mac电脑上的全能抓屏抓图软件,号称可以拍下屏幕上的一切(屏幕上的苍蝇除外)。但这是一个收费软件,其中29 美元版本功能只限于截图, 69 美元版本可以截取图片和动作。详细介绍可以看这篇文章。

Jing (免费)

简单的说,它可以让你做三种事情:截屏、录制视频、分享。三位一体的服务,感觉不错。当你在黄色的选项区里选择截图选项的时候,它会出现一个黄色对话框,截图后图片也保存在一个编辑框里,除了添加文字、注释等以外,它还可以点击箭头等指示图形,编辑完成以后,你可以通过JING上传到你的Flickr里,唯一不足的是,它只能以.png 格式保存。

QuickSnap (收费,14.95 美元)

又一个Mac上的收费屏幕截图软件。

另外,你还只可以查看帕兰映像之前介绍的6款Adobe AIR应用程序,这些程序虽然功能不是太强,但因为基于Adoeb AIR, 都跨平台。

mardi 20 octobre 2009

[转]Install Java 6 on Mac OS X Leopard

Installation

Java 6 isn’t installed by default. Java 6 is available as a simple Software Update, so if your system is up to date, Java 6 is installed, else upgrade your system. Note that Java SE 6 won’t appear for users on 32-bit Intel machines (Intel Core and Intel Core Duo) even if their systems are fully up to date.

Activation

Even though Java 6 is installed, Java 5 is still used by Mac OS X. You have to activate Java 6 by yourself. To do this, you need to run :
Applications -> Utilities -> Java -> Java Preferences
You will get the following window :

You just need to change the order of Java versions to use (Java application versions). Once Java SE 6 is on the top of the list, it should be activated.

Verification

You can check that Java 6 is correctly activated. You need to run a terminal (Applications -> Utilities -> Terminal) and to type the command: java -version
You should get this message :