Wednesday, December 12, 2012

Mac OS X 下用 iTunes 截取音乐任意部分的方法

右击进入歌曲 显示简介->选项,里面有“起始时间”和“停止时间”两个选择,填入你刚才记录的时间段。

选中歌曲,右击选择“转换所选内容为ACC”。就可以完成音乐截取了。
Read more ...

Tuesday, December 11, 2012

Mac OS X 下直接从视频中提取音频文件

  • 找到并右键点击需要进行操作的视频文件
  • 在弹出的右键菜单中选择“编码所选视频文件”(Encode Selected Video Files)
  • 在弹出的“编码媒体”(Encode Media)对话框的“Setting”下拉菜单中选择“Audio Only”
  • 选择好目标文件的路径后点击“Continue”即可
Read more ...

Problem with printing PDFs from Safari

Problem:
When I view a PDF in Safari it looks good. When I go to print it either the preview is totally blank or one page that I was viewing at the time previews and the print dialog box shows the additional 8 pages but they are all blank. I'm baffled. If I use Chrome and go from its interface to preview it works perfectly. Thank you for any guidance.

Solution:
Go to /Library/Internet Plug-Ins
Move the Adobe PDF plugin to the Trash.
Quit then relaunch Safari.
Read more ...

Thursday, December 6, 2012

iTunes 播放 ape flac

APE是Monkey's Audio,一种无损压缩格式。这种格式的压缩比远低于其他音频格式,但能够做到真正无损,同时其开放源码的特性,也获得了不少音乐发烧友的青睐。在现有不少无损压缩方案中,APE是一种有着突出性能的格式,令人满意的压缩比以及飞快的压缩速度,在国内应用比较广泛,成为了不少朋友私下交流发烧音乐的选择之一。

由于其无损压缩的特性,造就了APE音乐CD级的音质输出,同时接近原文件一半大小的压缩比,也减少了存储空间的占用,而通过MP3这种目前主流的播放器来表现,则更为人性化。
      具体表现在:
  1.高压缩比:APE的压缩比大约在55.50%,接近源文件的一半大小。

  2.编码速度快:编码速度考验用户的耐心,同FLAC(国内目前只有台电T19支持FLAC无损压缩音频格式)一样,APE有着超快的编码速度,这在目前众多的音频编码标准中具备了同FLAC相同的速度优势。

  3.平台的广泛支持:音频压缩不但需要硬件的支持,也需要的软件的支持,因此能够被更广泛的平台支持,也就意味着被更多用户使用。FLAC与APE在这方面做的都非常出色,能够兼容所有系统平台,现在无论您是Windows用户还是众多版本的Linux用户,哪怕您是Mac OS的忠实FANS,都无需担心无法使用FLAC或APE。

  4.开源特性:同FLAC一样,APE具备开源特性,这意味着任何组织或个人都可以免费使用这种压缩技术,任何组织或个人都可以修改和发布基于这两种技术的新产品,这给众多MP3厂商降低成本提供了有力保障,且消费者也能够以相对低廉的价格购买到只有世界级MP3(例如:iPod支持ALAC)才支持的无损压缩音频、CD级的音质表现!

  5.资源的广泛性:庞大的网路资源,决定了APE的普及度,用户只需通过网路搜索引擎,即可找到数量众多的APE下载资源,无论您使用BT还是讯雷皆可轻松获取APE资源。

       和APE一起的CUE文件有什么用?
       通常我们下载的APE文件有两种:一种是下载一张专辑中有好几个APE文件一个文件一首歌,就和我们平时听的MP3文件一样。还有一种是一张专辑只有单个APE文件,并且附有一个CUE文件。其实这个CUE文件很小,但是非常有用,它记录着这个大的APE文件中的音乐的段落,音乐的名称以及作者专辑等内容。对于第一种APE,您就可以像播放MP3一样,将所有的APE文件全加到千千静听中,进行播放就行了。对于第二种APE,如果只把APE文件加到播放器中,你就会发现一整张专辑成了一首歌。所以对于第二种APE,你要将APE带的CUE文件利用Foobar、千千静听打,这些播放软件就会自动依照CUE中的内容,将指定的APE文件分段后在播放列表中出现。如果你想把这个APE文件还原成CD的话,也要利用到这个CUE文件。

然后打开偏好设置,进行如下设置。
点 import settings


然后去网上寻找一款可以加载虚拟CD的软件比如DAEMTOOLS,先点击挂载,选择想要挂在的文件,选择以CUE后缀结尾的文件。接着会自动跳出虚拟CD,ITUNES 会自动跳出,询问你是否需要导入CD。导入后还可以自己添加专辑图片。选中全部音乐然后get info,在artwork中添加相应图片即可。

Read more ...

Sunday, November 11, 2012

彻底关闭win8的休眠和睡眠功能

右键cmd,以管理员权限运行

powercfg -h off 命令来关闭休眠.

关闭睡眠
输入 gpedit.msc (组策略)
计算机设置-管理模板-系统-电源管理
电源管理-睡眠设置
将“睡眠时允许待机(S1-S3)(接通电源)”设置为“已禁用”
将“睡眠时允许待机(S1-S3)(使用电池)”设置为“已禁用”


重启生效!
Read more ...

Thursday, November 8, 2012

MAC下德语助手无限使用

找到文件
/Users/xxx/Library/Preferences/com.eusoft.dehelper.plist
xxx为用户名

用xcode打开,也可以用PlistEdi Pro 打开。
找到 MAIN_TimesLeft
这个就是使用次数,把它修改位10000000就行了。

这样就可以长期使用了。不过如果你方便买正版的话还是花点钱吧。
Read more ...

Tuesday, October 16, 2012

Print plot in MATLAB in Mac OS X

If you receive an error when using the File-> Print option in Mac OS X in MATLAB.

Problem sending file to output device, system returned error :
lpr: The printer or class was not found.

...

Just follow the steps.

1. In Safari, navigate to http://localhost:631
2. Click on the “Administration” tab, and then “Edit Configuration File”
3. At the top of the editable block of text, add these lines:

Printcap /etc/printcap
PrintcapFormat BSD # For Snow Leopard only


4. Click “Save Changes”. It may take 30 seconds or longer for these changes to go into effect.
5. Restart MATLAB.
Read more ...

Monday, October 8, 2012

Run MATLAB script in terminal

Just type command like following.

matlab -nojvm -nodesktop -r "run <the-script>.m"
matlab -nojvm -nodesktop -r "<the-script>"
matlab -nojvm -nodesktop -r "run <the/path>/<the-script>.m"
Read more ...

MATLAB runtime_error solution

When you running MATLAB, if you encountered an error like this:

terminate called after throwing an instance of 'std::runtime_error'  what():  locale::facet::_S_create_c_locale name not valid

It is easy to solve just by setting environmental variable LC_ALL="en_US.utf8"

bash: export LC_ALL="en_US.utf8"
csh: setenv LC_ALL "en_US.utf8"

It is better to add this to your bash or csh profile.
e.g.
.bshrc
.cshrc
.bash_profile
Read more ...

Thursday, October 4, 2012

如何删除Mac App Store中别人帐号已购应用程序的更新提示

如果安装了别人破解的应用程序,Mac App Store 提示应用程序有更新,会需要输入别人的AppleID信息。如果要清除提示。

1. 在Mac App Store中安装一个免费的App,然后在“应用程序”中找到这个App,右击 –> “显示包内容”–> 进入文件夹“Contents”–> 拷贝“_CodeSignature”,“_MASReceipt”。

2. 在“应用程序”中找到那个破解的App,右击 –> “显示包内容”–> 进入文件夹“Contents”,把刚才拷贝的“_CodeSignature”,“_MASReceipt”粘贴进来覆盖原来的。
Read more ...

Friday, September 14, 2012

Hackintosh T420

1. U盘制作
参看这里,首先下载X-Flash。
然后将X-Flash复制到桌面,双击打开安装程序,使其在桌面展开。最后将格式化成HFS+日志系统的U盘拖入X-Flash图标即可。最后可以美化一下,右击U盘点 get info 然后把安装程序里面的狮子图标拖动到U盘信息的左上角。


当然,最后需要替换OSIstall。
替换 mac安装盘目录System/Library/PrivateFrameworks/Install.framework/Frameworks/OSInstall.framework/Versions/A/里的osinstall。

替换mac安装盘目录System/Installation/Packages 里的 osinstall.mpkg

2. FakeSMC设定参看这里

3. HD3000可参看这里
HD3000花屏还可以试试添加EDID,以及display注入。参看这里

4. 电源管理补丁

5. HD3000 集显的机器 显卡id0126 按道理能够直驱的。
但是-v时出现
SNB Framebuffer did not show up
然后跳2下可以进入系统,但是显卡没驱动不能改分辨率,显示显存64M。

如果出现以上情况可以试试,查看
/System/Library/Extensions/AppleIntelSNBGraphicsFB.kext/Contents/info.plist
找到如下内容
01168086 01268086
在前面添加 0x
然后修复权限,重建缓存试试。
我的改过之后就成功驱动了。

6. RTC补丁解决BIOS重置
终端输入

sudo perl -pi -e 's|\x75\x30\x89\xd8|\xeb\x30\x89\xd8|' /System/Library/Extensions/AppleRTC.kext/Contents/MacOS/AppleRTC

7. 解决 Transcript Offline - Buffer Pool Allocate [181000] failed
1. 打开 AppleIntelSNBGraphicsFB 里面 info 文件,将“FBCControl”-“Compression”的值改为‘1’,将“FeatureControl”里面的"FBC"的值改为‘1’,将“FBClientController”栏全部内容删除;

2. 打开 AppleIntelHD3000Graphics 里面 info 文件,IOKitPersonalities 下面Gen6 下面 VRAMMethod 和 VRAMOverride 两项删除。保存后修复权限重建缓存,重启错误解决。


8. 解决smc更新提示
以我的本本为例,和MacBook Pro 8,1的配置比较接近,SMBIOS.plist为MacBook Pro 8,1

http://support.apple.com/kb/HT1237?locale=zh_CN去查看你对应机型的SMC版本和Boot Rom版本并记下来

1、将你的SMBIOS.plist里面的SMbiosversion字段的值的前面部分修改成和Boot Rom版本一致。比如的MacBook Pro 8,1最新的的Boot Rom版本是MBP81.88Z.0047.B27,则修改SMbiosversion字段的值为MBP81.88Z.0047.B27.1104221557;

2、将你的FakeSMC.kext里面的Info.plist的REV值修改成和SMC版本一致,方法参考【變色龍系列三】FakeSMC.kext 設定說明【08/05】。比如MacBook Pro 8,1最新的SMC版本是1.68f98,则rev值为AWgPAACY。

修改好之后保存重启,这两个更新就不在了,其他机型以此类推。
相关dsdt ssdt 以及驱动:

Read more ...

Install TEX/LATEX in Mac OS X

1. Install MacTex based on Texlive.
Download MacTex from here.
or you can also install from MacPorts.

sudo port install texlive
sudo port install texlive-latex-extra

You can see the list of  texlive ports here. Around 99% of the packages are included in texlive-latex-extra.

2. Use Emacs as an editor.

You can down emacs for mac from here.
or install from macports:
sudo port install emacs-app +fullscreen

If you want to use emacs to edit tex file, you have to install auctex or aquamacs.
For installing aquamacs, you can see here.

I am using auctex.

2.1 Download auctex from here.

2.2 Install

./configure --with-emacs=/Applications/Emacs.app/Contents/MacOS/Emacs --with-lispdir=/Applications/Emacs.app/Contents/Resources/site-lisp --with-texmf-dir=/usr/local/texlive/texmf-local

instead this by: (if you used macports)
./configure --with-emacs=/Applications/MacPorts/Emacs.app/Contents/MacOS/Emacs --with-lispdir=/Applications/MacPorts/Emacs.app/Contents/Resources/site-lisp --with-texmf-dir=/usr/local/texlive/texmf-local


in OS X 10.11, if u installed the texlive via macports, the texmf-local location is changed to
/opt/local/share/texmf-local

make

sudo make install

Before do this, maybe you have to install make
go to Xcode Preferences, install Command Line Tools in Downloads.

2.3 load auctex
edit your ~/.emacs
put following in.

(setenv "PATH" (concat "/usr/texbin:/usr/local/bin:" (getenv "PATH")))
(setq exec-path (append '("/usr/texbin" "/usr/local/bin") exec-path))
(load "auctex.el" nil t t)
(load "preview-latex.el" nil t t)

P.S.
If you want to swap CTRL and CAPS LOCK

Go into System Preferences, Enter the Keyboard & Mouse preference pane, In the Keyboard tab, click Modifier Keys... Swap the actions for Caps Lock and Control.

If you want to use option as META

In the menu bar, click Terminal, Click Preferences... Under the Settings tab, go to the Keyboard tab, Check the box labeled Use option as meta key.

Read more ...

Add Color to the Terminal in Mac OS X

This post is from here.


Adding colorized ls output to the Terminal in Mac OS X is a good way to make navigating around the command line a bit easier on the eyes.

We’ll cover a customizable setting, and you can get a preview of color ls output by typing “ls -G” at the command line. The preview with ls -G will depend on the Terminals color settings and won’t necessarily represent the colors shown below, however.

Open Terminal and type: nano .bash_profile

Use the arrow keys to navigate to the bottom of the document and paste in either of the blocks of text below, depending on the terminals appearance (see man entry below for further customizations)

Colors for Dark Terminal Themes:

export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced




Colors for Light Terminal Themes:

export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad




After the strings are pasted into .bash_profile confirm that it looks something like this in nano:



Hit Control+O to save and open a new Terminal window
Type "ls" or "ls -la" to confirm the colorized output

This will work with Mac OS X 10.6, OS X 10.7, and OS X 10.8, as long as you are using the bash shell. If you aren't certain what shell you are using, look in the Terminal window titlebar for "bash", or you can check with the following command:

echo $SHELL

The output will be "/bin/bash" if it's bash, and something else if not.

Don't forget that you can also change the appearance of Terminal windows instantly and change the Terminal wallpaper too.

Customizing LSCOLORS Manually

If the above color choices weren't doing it for you, you can set whatever you want. Here's the manual page on LSCOLORS if you want to give it a shot. The default is "exfxcxdxbxegedabagacad" but clearing out the .bash_profile color entry will remove any hideous color combinations too.

LSCOLORS The value of this variable describes what color to use for which attribute when colors are enabled with CLICOLOR. This string is a concatenation of pairs of the format fb, where f is the foreground color and b is the background color.

The color designators are as follows:

a black
b red
c green
d brown
e blue
f magenta
g cyan
h light grey
A bold black, usually shows up as dark grey
B bold red
C bold green
D bold brown, usually shows up as yellow
E bold blue
F bold magenta
G bold cyan
H bold light grey; looks like bright white
x default foreground or background


Note that the above are standard ANSI colors. The actual display may differ depending on the color capabilities of the terminal in use.

The order of the attributes are as follows:

1. directory
2. symbolic link
3. socket
4. pipe
5. executable
6. block special
7. character special
8. executable with setuid bit set
9. executable with setgid bit set
10. directory writable to others, with sticky bit
11. directory writable to others, without sticky bit


The default is "exfxcxdxbxegedabagacad", i.e. blue foreground and default background for regular directories, black foreground and red background for setuid executables, etc.
Read more ...

Make an alias in Mac OS X shell

1.
nano ~/.bash_profile

add you alias like following

alias l='ls -lah'

then run source ~/.bash_profile in terminal.

2.
nano /etc/profile (for a normal user)
nano ~/.profile (for a root/su do)

Add your alias like so to the file:
alias aliasname='mycommand /path/path'
(notice no space between equal sign and ')

Load/reload your profile with:
. /etc/profile
...or for root/superuser do:
. ~/.profile
Read more ...

Thursday, August 30, 2012

The ps Command

This post is from here.



The ps (i.e., process statuscommand is used to provide information about the currently running processes, including their process identification numbers (PIDs).
A process, also referred to as a task, is an executing (i.e., running) instance of a program. Every process is assigned a unique PID by the system.
The basic syntax of ps is
ps [options]
When ps is used without any options, it sends to standard output, which is the display monitor by default, four items of information for at least two processes currently on the system: the shell and ps. A shell is a program that provides the traditional, text-only user interface in Unix-like operating systems for issuing commands and interacting with the system, and it is bash by default on Linux. ps itself is a process and it dies (i.e., is terminated) as soon as its output is displayed.
The four items are labeled PID, TTY, TIME and CMD. TIME is the amount of CPU (central processing unit) time in minutes and seconds that the process has been running. CMD is the name of the command that launched the process.
TTY (which now stands for terminal type but originally stood for teletype) is the name of the console or terminal (i.e., combination of monitor and keyboard) that the user logged into, which can also be found by using the tty command. This information is generally only useful on a multi-user network.
A common and convenient way of using ps to obtain much more complete information about the processes currently on the system is to use the following:
ps -aux | less
The -a option tells ps to list the processes of all users on the system rather than just those of the current user, with the exception of group leaders and processes not associated with a terminal. A group leader is the first member of a group of related processes.
The -u option tells ps to provide detailed information about each process. The -x option adds to the list processes that have no controlling terminal, such as daemons, which are programs that are launched during booting (i.e., computer startup) and run unobtrusively in the background until they are activated by a particular event or condition.
As the list of processes can be quite long and occupy more than a single screen, the output of ps -aux can be piped (i.e., transferred) to the less command, which lets it be viewed one screenful at a time. The output can be advanced one screen forward by pressing the SPACE bar and one screen backward by pressing the b key.
Among the information that ps -aux provides about each process is the user of the process, the PID, the percentage of CPU used by the process, the percentage of memory used by the process, VSZ (virtual size in kilobytes), RSS (real memory size or resident set size in 1024 byte units), STAT (the process state code), the starting time of the process, the length of time the process has been active and the command that initiated the process. The process state codes include D, uninterruptable sleep; N, low priority; R, runnable (on run queue); S, sleeping; T, traced or stopped; Z, defunct (zombie).
In contrast to most commands, the hyphen preceding ps's options is optional, not mandatory. Thus, the following could be (and sometimes is) used in place of the above command:
ps aux | less
An alternative set of options for viewing all the processes running on a system is
ps -ef | less
The -e option generates a list of information about every process currently running. The -f option generates a listing that contains fewer items of information for each process than the -l option.
Among the columns displayed by ps -ef, UID contains the username of the account that owns the process (which is usually the same user that started the process) and STIME displays the time the process started, or the starting date if it started more than 24 hours ago.
The processes shown by ps can be limited to those belonging to any given user by piping the output through grep, a filter that is used for searching text. For example, processes belonging to a user with a username adam can be displayed with the following:
ps -ef | grep adam
The -l option generates a long listing, and when used together with the -e and -f options creates a table with 15 columns:
ps -efl
The additional columns of most interest are NI and SZ. The former shows the nice value of the process, which determines the priority of the process. The higher the value, the lower the priority. The default nice value is 0 on Linux systems.
The latter displays the size of the process in memory. The value of the field is the number of pages the process is occupying. On Linux systems a page is 4,096 bytes.
ps is most often used to obtain the PID of a malfunctioning process in order to terminate it with the kill command. For example, if the PID of a frozen or crashed program is found to be 1125, the following can usually terminate the process:
kill 1125
ps -ef or ps -efl can then be used to confirm that the process really has stopped. If it has not, then the more forceful -9 option should be used, i.e.,
kill -9 1125
The pstree command is similar to ps in that it can be used to show all of the processes on the system along with their PIDs. However, it differs in that it presents its output in a tree diagram that shows how processes are related to each other and in that it provides less detailed information about each process than does ps.
Read more ...

Monday, August 13, 2012

Friday, August 10, 2012

Mac OS X 下修改机器名和主机名

This post is from here.


修改主机名和计算机名
sudo scutil --set HostName NewName
sudo scutil --set ComputerName NewName

修改终端提示符
vi ~/.profile
添加
export PS1="[\u@\h \W]\$ "
Read more ...

Wednesday, August 1, 2012

Ubuntu下WebQQ桌面化

This post is from here.


sudo add-apt-repository ppa:loneowais/fogger
sudo apt-get update
sudo apt-get install  fogger

然后可以搜索 fogger 打开程序,添加WEBQQ即可。

但是中文提示可能是乱码。
可以参考这里修改:


修改方式如下:

打开终端执行: sudo vim /opt/extras.Ubuntu.com/fogger/fogger/AppWindow.py  (vim不熟悉可以使用gedit,前面带行号)

22 import re         #22行加上该句

252 def unescape(self,url):
253     def repl(mobj):
254          try:
255              return unichr(int(mobj.group(0)[2:],16))
256          except:
257              return mobj.group(0)
258      return re.sub(‘%u[0-9a-fA-F]{4}’,repl,url)
259
260 def on_resource_request_starting(self, widget, frame, resource, request, response, data=None):
261      uri = urllib.unquote(request.props.uri)
262      uri = self.unescape(uri)
263      if uri.startswith(‘http://fogger.local/’):
264          request.props.uri = ‘about:blank’

因为是python代码,请严格按照四个空格键进行缩进,如果使用(tab)键有可能为制表符,这样严重影响代码运行。

修改好的脚本下载:

免费下载地址在 http://linux.linuxidc.com/

用户名与密码都是www.linuxidc.com

具体下载目录在 /2012年资料/7月/31日/Ubuntu下WebQQ桌面化替代方案完美版/

如果修改麻烦,可以下载后执行sudo cp  -f AppWindow.py  /opt/extras.Ubuntu.com/fogger/fogger/AppWindow.py 即可。
Read more ...

Wednesday, July 25, 2012

配置 Ubuntu 12.04

首先安装 ubuntu-restricted-extras


sudo apt-get install ubuntu-restricted-extras


>> qq

sudo add-apt-repository ppa:lainme/libqq
sudo apt-get update
sudo apt-get install libqq-pidgin

empathy 里面就有qq了。
或者看这里


>> stardict

sudo apt-get install stardict

词典


>> trash


click here.

>> Ubuntu在顶部面板显示系统状态条

click here.

>> ubuntu tweak


click here.

>> mac thema


click here.

>> 修改grub参数


click here.

>> proxy setting


click here.


>> 解决 ibus 输入法图标


启动项加入
ibus-daemon -r -d -x


>> fix graphics unknown


sudo apt-get install mesa-utils


>> Fixing Google Chrome's 100% CPU Usage on Ubuntu


sudo apt-get install m4


or click here.


>> BIOS不能屏蔽显卡的


显卡切换:终端sudo su
echo IGD > /sys/kernel/debug/vgaswitcheroo/switch
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch
第一句是切换到集成显卡;
第二句是关闭没有连接的显卡;
此时独显指示灯熄灭。
然后把这两句加入到/etc/rc.local文件里的exit 0之前保存;以便开机时自动运行。


>> indicators


link1; link2


>> 无线网络不稳定


更换network-manager:


sudo apt-get install wicd


连接好网络后,


sudo apt-get remove network-manager
注意先后顺序。


>> Psensor



Psensor 是一个监控硬件温度的工具,并且与Unity很好的整合在一起,支持使用桌面通知系统高温报警,拥有应用程序指示器。

支持监控以下硬件温度:

主板和CPU温度
Nvidia GPU温度
实验性ATI/AMD GPUs温度监控,Ubuntu PPA中未启用。
硬盘温度
风扇转速
CPU使用率


首先安装监控cpu 主板 风扇等需要的包:


sudo apt-get install lm-sensors hddtemp
sudo sensors-detect
回复"yes"即可。
重启或通过以下命令加载 sensor需要的模块。
sudo service module-init-tools start
sudo apt-get install psensor


或者通过stable PPA安装


sudo add-apt-repository ppa:jfi/ppa 
sudo apt-get update 
sudo apt-get install psensor


另外还有个unstable Ubuntu PPA,可能会有bug


sudo add-apt-repository ppa:jfi/psensor-unstable 
sudo apt-get update 
sudo apt-get install psensor

>> 美化 terminal


link1; link2


emacs -nw .bashrc


在最后添加试试。


PS1="\[\033[0;32m\]├ \[\033[0;33m\]\d\[\033[0;32m\] ┼ \[\033[0;33m\]\t\[\033[0;32m\] ┼ \[\033[0;36m\]\u\[\033[0;32m\] ┼ \[\033[0;36m\]\h\[\033[0;32m\] ┼ \[\033[0;35m\]\w\[\0\
   33[0;32m\] ┤ \n\[\033[0;31m\]\$\[\033[0;32m\] >> \[\033[0m\]"


>> Install Jupiter


sudo add-apt-repository ppa:webupd8team/jupiter
sudo apt-get update
sudo apt-get install jupiter


>> install Unity Window Quicklists


sudo apt-add-repository ppa:alanbell/unity
sudo apt-get update
sudo apt-get install unity-window-quicklists


There's a bug with the autostart .desktop file and Unity Window Quicklists doesn't start automatically on login, so let's fix it:


sudo sed -i 's/OnlyShowIn=UNITY/OnlyShowIn=Unity/g' /etc/xdg/autostart/unity-window-quicklists.desktop


>> indicator-cpufreq


click here.


>> 让Ubuntu支持CPU动态调频


click here.

Read more ...

use byobu instead of terminal in ubuntu

sudo apt-get install byobu

byobu-tmux

press F9 to get help.


Read more ...

PPT in shell

Download tpp from here.

tar zxvf tpp-1.3.1.tar.gz

We have to install ruby firstly.

sudo apt-get install ruby ruby-dev

and we also need ncurses-ruby.

tar jxf ncurses-ruby-1.3.0.tar.bz2
cd ncurses-ruby-1.3.0
ruby extconf.rb

If we get error like this,

checking for unistd.h... yes
checking for locale.h... yes
checking for ncurses.h... no
checking for ncurses/curses.h... no
checking for curses.h... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby1.8
extconf.rb:38: ncurses header file not found (RuntimeError)

then,

sudo apt-get libncurses5-dev

then run
make
sudo make install

then
cd tpp-1.3.1
sudo make install

now tpp are completely installed.
try it.

tpp example.tpp


if you want to have huge text printed

sudo apt-get install figlet


example:

Read more ...

Friday, July 20, 2012

德语 zu 的用法

This post is from here.


um…zu的目的不定式结构

um…zu的目的不定式结构在句中作目的状语,意为“为了……”。目的不定式结构中不能出现主语,其动作主体应该同主句主语一致。目的不定式结构可放在句首、句中或句末,并用逗号将前后句分开。提问用wozu,warum或zu welchem Zweck, mit welcher Absicht
Viele Deutsche fahren gern mit dem Fahrrad, um gesund zu bleiben.
Wozu fahren viele Deutsche gern Fahrrad?
注意:
1. zu位于动词不定式之前,如动词是分离动词,则zu位于两者之间,并连写,例如:
ich gehe zum Bahnhof, um meine Großmutter abzuholen.
2. 目的不定式结构放在句首,主句用反语序,也就是,紧跟的是可变位动词;目的不定式结构放在主句后,主句用正语序:
Um gesund zu bleiben, fahren viele Deutsche Rad.
Viele Deutsche fahren Rad, um gesund zu bleiben.
3. 目的不定式假设主语同主句主语不一致时,用damit目的从句,如:
Herr Li gibt seinem Sohn 100 Yuan, damit er (der Sohn) das Englischwörterbuch kauft.
李先生给他儿子100元钱,以便他儿子买一本 英语 字典。
带zu的不定式作宾语和作名词的定语
带zu不定式可作部分动词的宾语和部分名词的定语,它一般放在句尾和被修饰的定语之后。“zu”位于动词不定式前面。如遇可分动词,则放在可分动词中间并连写。带“zu”的不定式用逗号同主句分开,但在简单不定式前则不必加逗号。
1. 作一部分及物动词的宾语,如versuchen, vergessen
versuchen--> Versuch doch bitte, für mich ein paar Kinokarten für morgen Abend zu besorgen!
vergessen--> Ich habe vergessen, Ihnen Bescheid zu sagen, dass wir morgen keinen Deutschunterricht haben.
2. 作部分动词的介词宾语,如bitten, helfen
Sie bittet ihn (darum),morgen Abend zusammen ins Kino zu gehen.
3. 作名词宾语,如zeit, Lust, Chance, Gelegenheit, Wunsch, Absicht, Geld
Zeit--> Ich habe Zeit, dir beim Umzug zu helfen.
Lust--> Sie hat Lust, mit ihm ins Kino zu gehen.
Chance--> Wir haben gute Chance, ins Ausland zu gehen.
Gelegenheit--> Sie hat keine Gelegenheit, uns ihre Meinung zu sagen.
Wunsch--> Das Kind hat den Wunsch, einen PC zum Geburtstag zu bekommen.
Absicht--> Herr Zhang hat keine Absicht, die Wohnung zu verkaufen.
Geld--> Wir haben kein Geld, ein Auto zu kaufen.
4. 带zu不定式作主语
Es ist gut, Deutsch zu lernen.
Es ist schön, jetzt nach Hause yu gehen.
was ist schön?
同位语
同位语在句子中可以以第一、第二、第三、第四格的形式出现,它的性、数、格与同位名词相同。
N. Herr Li, ein guter Lehrer, gibt uns Unterricht.
G. Das ist das Arbeitszimmer meines Freundes, eines guten Technikers.
D. Der löwenwirt stritt oft mit seinem Nachbarn, dem Bärenwirt.
A. Gestern habe ich meine Freundin, eine deutsche Studentin aus München.
Read more ...

view pdf in chromium

In command line:
sudo cp path/to/libpdf.so /usr/lib/chromium-browser/

you can install a chrome and find it in path /opt/google/chrome/
and you can also download from the following link.

Read more ...

Wednesday, July 11, 2012

How to Add a Network Printer in Linux

This post is from here.


>> Install the CUPS application through your distribution's graphical package manager or command-line tools.

>> Open the CUPS Web interface by typing "http://localhost:631" into a browser window.


>> Click "Add Printer" under the "Administration" section.


>> Choose a suitable option. Here I choose AppSocket.

>> Type the correct URI to use with your printer. you can get printer IP address by typing lpstat -s in ternimal.(with printer connected)

>> Type the name of the networked printer as it is named on the server. Also the description and location.

>> Select the right MAKE and Model, then Click Add Printer.
Read more ...

28 个 Unix/Linux 的命令行神器

This post is from here.


下面是Kristóf Kovács收集的28个Unix/Linux下的28个命令行下的工具(原文链接),有一些是大家熟悉的,有一些是非常有用的,有一些是不为人知的。这些工具都非常不错,希望每个人都知道。本篇文章还在Hacker News上被讨论,你可以过去看看。我以作者的原文中加入了官网链接和一些说明。

dstat & sar

iostat, vmstat, ifstat 三合一的工具,用来查看系统性能(我在《性能调优攻略》中提到过那三个xxstat工具)。
你可以这样使用:
1
alias dstat='dstat -cdlmnpsy'
dstat screenshot

slurm

查看网络流量的一个工具
slurm screenshot

vim & emacs

真正程序员的代码编辑器。
vim screenshot

screen, dtach, tmux, byobu

你是不是经常需要 SSH 或者 telent 远程登录到 Linux 服务器?你是不是经常为一些长时间运行的任务而头疼,比如系统备份、ftp 传输等等。通常情况下我们都是为每一个这样的任务开一个远程终端窗口,因为他们执行的时间太长了。必须等待它执行完毕,在此期间可不能关掉窗口或者断开连接,否则这个任务就会被杀掉,一切半途而废了。
Screen是一个可以在多个进程之间多路复用一个物理终端的窗口管理器。Screen中有会话的概念,用户可以在一个screen会话中创建多个screen窗口,在每一个screen窗口中就像操作一个真实的telnet/SSH连接窗口那样。请参看IBM DeveloperWorks的这篇文章《使用 screen 管理你的远程会话
gnu screen screenshot
dtach 是用来模拟screen的detach的功能的小工具,其可以让你随意地attach到各种会话上 。下图为dtach+dvtm的样子。
tmux是一个优秀的终端复用软件,类似GNU Screen,但来自于OpenBSD,采用BSD授权。使用它最直观的好处就是,通过一个终端登录远程主机并运行tmux后,在其中可以开启多个控制台而无需再“浪费”多余的终端来连接这台远程主机;当然其功能远不止于此。与screen相比的优点:可以横向和纵向分割窗口,且窗格可以自由移动和调整大小。可在多个缓冲区进行复制和粘贴,支持跨窗口搜索;非正常断线后不需重新detach;……  有人说——与tmux相比,screen简直弱爆了
byobu是Ubuntu开发的,在Screen的基础上进行包装,使其更加易用的一个工具。最新的Byobu,已经是基于Tmux作为后端了。可通过“byobu-tmux”这个命令行前端来接受各种与tmux一模一样的参数来控制它。Byobu的细节做的非常好,效果图如下:

multitail

MultiTail是个用来实现同时监控多个文档、类似tail命令的功能的软件。他和tail的区别就是他会在控制台中打开多个窗口,这样使同时监控多个日志文档成为可能。他还可以看log文件的统计,合并log文件,过滤log文件,分屏,……。
multitail screenshot

tpp

终端下的PPT,要是在某某大会上用这个演示PPT,就太TMD的Geek了。
tpp screenshot

xargs & parallel

Executes tasks from input (even multithread).
xargs 是一个比较古老的命令,有简单的并行功能,这个不说了。对于GNU parallel ( online manpage )来说,它不仅能够处理本机上多执行绪,还能分散至远端电脑协助处理。而使用GNU parallel前,要先确定本机有安装GNU parallel / ssh / rsync,远端电脑也要安装ssh。
xargs screenshot

duplicity & rsyncrypto

Duplicity是使用rsync算法加密的高效率备份软件,Duplicity支持目录加密生产和格式上传到远程或本地文件服务器。
rsyncrypto 就是 rsync + encryption。对于rsync的算法可参看酷壳的rsync核心算法
Encrypting backup tools.
duplicity screenshot

nethack & slash’em

NetHackWiki),20年历史的古老电脑游戏。没有声音,没有漂亮的界面,不过这个游戏真的很有意思。网上有个家伙说:如果你一生只做一件事情,那么玩NetHack。这句话很惹眼,但也让人觉得这个游戏很复杂不容易上手。其实,这个游戏很虽然很复杂,却容易上手。虽然玩通关很难,但上手很容易。NetHack上有许多复杂的规则,”the DevTeam thinks of everything”(开发团队想到了所有的事情)。各种各样的怪物,各种各样的武器….,有许多spoilers文件来说明其规则。除了每次开始随机生成的地图,每次玩游戏,你也都会碰到奇怪的事情: 因为喝了一种药水,变成了机器人;因为踢坏了商店的门被要求高价赔偿;你的狗为你偷来了商店的东西….. 这有点象人生,你不能完全了解这个世界,但你仍然可以选择自己的面对方式。
网上有许多文章所这是最好的电脑游戏或最好的电脑游戏之一。也许是因为它开放的源代码让人赞赏,古老的历史让人宽容,复杂的规则让人敬畏。虽然它不是当前流行的游戏,但它比任何一个当前流行的游戏都更有可能再经受20年的考验。
Slash’EM 也是一个基于NetHack的经典游戏。
nethack screenshot

lftp

利用lftp命令行ftp工具进行网站数据的增量备份,镜像,就像使用rsync一样。
lftp screenshot

ack

ack是一个perl脚本,是grep的一个可选替换品。其可以对匹配字符有高亮显示。是为程序员专门设计的,默认递归搜索,省提供多种文件类型供选。
ack screenshot

calcurse & remind + wyrd

calcurse是一个命令行下的日历和日程软件。remind + wyrd也很类似。关于日历,我不得不提一个Linux的Cycle日历,也是一个神器,呵呵。
calcurse screenshot

newsbeuter & rsstail

newsbeuter 和 rsstail 是命令行下RSS的阅读工具。
newsbeuter screenshot

powertop

做个环保的程序员,看看自己的电脑里哪些程序费电。PowerTOP 是一个让 Intel 平台的笔记本电脑节省电源的 Linux 工具。此工具由 Intel 公司发布。它可以帮助用户找出那些耗电量大的程序,通过修复或者关闭那些应用程序或进程,从而为用户节省电源。
powertop screenshot

htop & iotop

htop 和 iotop  用来查看进程,内存和IO负载。
htop screenshot

ttyrec & ipbt

ttyrec 是一个 tty 控制台录制程序,其所录制的数据文件可以使用与之配套的 ttyplay 播放。不管是你在 tty 中的各种操作,还是在 tty 中耳熟能详的软件,都可进行录制。
ipbt 是一个用来回放 ttyrec 所录制的控制台输入过程的工具。
与此类似的还有Shelr 和 termrec 
ipbt screenshot

rsync

通过SSH进行文件同步的经典工具(核心算法
rsync screenshot

mtr

MTR – traceroute 2.0,其是把 traceroute 和 ping 集成在一块的一个小工具 用于诊断网络。
mtr screenshot

socat & netpipes

socat是一个多功能的网络工具,名字来由是” Socket CAT”,可以看作是netcat的N倍加强版。
netpipes 和socat一样,主要是用来在命令行来进行socket操作的命令,这样你就可以在Shell脚本下行进socket网络通讯了。
socat screenshot

iftop & iptraf

iftopiptraf可以用来查看当前网络链接的一些流量情况。
iftop screenshot

siege & tsung

Siege是一个压力测试和评测工具,设计用于WEB开发这评估应用在压力下的承受能力:可以根据配置对一个WEB站点进行多用户的并发访问,记录每个用户所有请求过程的相应时间,并在一定数量的并发访问下重复进行。
Tsung 是一个压力测试工具,可以测试包括HTTP, WebDAV, PostgreSQL, MySQL, LDAP, and XMPP/Jabber等服务器。针对 HTTP 测试,Tsung 支持 HTTP 1.0/1.1 ,包含一个代理模式的会话记录、支持 GET、POST 和 PUT 以及 DELETE 方法,支持 Cookie 和基本的 WWW 认证,同时还支持 SSL。
siege screenshot

ledger

ledger 一个命令行下记帐的小工具。
ledger screenshot

taskwarrior

TaskWarrior 是一个基于命令行的 TODO 列表管理工具。主要功能包括:标签、彩色表格输出、报表和图形、大量的命令、底层API、多用户文件锁等功能。
taskwarrior screenshot
下图是TaskWarrior 2.0的界面:

curl

cURL是一个利用URL语法在命令行下工作的文件传输工具,1997年首次发行。它支持文件上传和下载,所以是综合传输工具,但按传统,习惯称cURL为下载工具。cURL还包含了用于程序开发的libcurl。cURL支援的通訊協定有FTP、FTPS、HTTP、HTTPS、TFTP、SFTP、Gopher、SCP、Telnet、DICT、FILE、LDAP、LDAPS、IMAP、POP3、SMTP和RTSP。
curl screenshot

rtorrent & aria2

rTorrent 是一个非常简洁、优秀、非常轻量的BT客户端. 它使用了 ncurses 库以 C++ 编写, 因此它完全基于文本并在终端中运行. 将 rTorrent 用在安装有 GNU Screen 和 Secure Shell 的低端系统上作为远程的 BT 客户端是非常理想的。
aria2 是 Linux 下一个不错的高速下载工具。由于它具有分段下载引擎,所以支持从多个地址或者从一个地址的多个连接来下载同一个文件。这样自然就大大加快了文件的下载速度。aria2 也具有断点续传功能,这使你随时能够恢复已经中断的文件下载。除了支持一般的 http(s) 和 ftp 协议外,aria2 还支持 BitTorrent 协议。这意味着,你也可以使用 aria2 来下载 torrent 文件。
 rtorrent screenshot

ttytter & earthquake

TTYtter 是一个Perl写的命令行上发Twitter的工具,可以进行所有其他平台客户端能进行的事情,当然,支持中文。脚本控、CLI控、终端控、Perl控的最愛。
Earthquake也是一个命令行上的Twitter客户端。
ttytter screenshot

vifm & ranger

Vifm 基于ncurses的文件管理器,DOS风格,用键盘操作。
vifm screenshot
Ranger用 Python 完成,默认为使用 Vim 风格的按键绑定,比如 hjkl(上下左右),dd(剪切),yy(复制)等等。功能很全,扩展/可配置性也非常不错。类似MacOS X下Finder(文件管理器)的多列文件管理方式。支持多标签页。实时预览文本文件和目录。

cowsay & sl

cowsay  不说了,如下所示,哈哈哈。还有xcowsay,你可以自己搜一搜。
cowsay screenshot
 sl是什么?ls?,呵呵,你会经常把ls 打成sl吗?如果是的话,这个东西可以让你娱乐一下,你会看到一辆火车呼啸而过~~,相当拉风。你可以使用sudo apt-get install sl 安装。
最后,再介绍一个命令中linuxlogo,你可以使用 sudo apt-get install linuxlogo来安装,然后,就可以使用linuxlogo -L
来看一下各种Linux的logo了
Read more ...