我的备忘录


用Mplayer播放高清电影(蓝光原盘)

Posted in Linux, MacosX, mplayer by Kafeifei on the 05月 10th, 2008

前提还是你的cpu必须强劲,默认情况下mplayer是单线程的,所以显得力不从心,如果你的cpu是双核或支持超线程,那么试试加上一下参数:

-lavdopts threads=8

或者,来自这里:http://ubuntuforums.org/showthread.php?t=629701

-vfm ffmpeg -lavdopts lowres=2:fast:skiploopfilter=all:threads=8

---------
蓝光原盘抓出来的文件一般以 .ts 结尾 h264 标准
------- update ------
mac下,mplayer的性能明显差很多,经过大量测试,发现问题主要在音频驱动上,我的配置:

−vf scale=-2 -lavdopts lowres=1,1400:fast:skiploopfilter=all:threads=8 -ao openal -vo macosx

播放《汽车总动员》时勉强不卡!或许因为ntfs-3g的性能不佳吧,另外lowres这个配置未生效。
−vf scale=-2 可以修正字幕被拉扁的问题(视频质量未见异常)。

dpkg-divert

Posted in Linux by Kafeifei on the 04月 1st, 2007

换了显卡 ati(fglrx) -> nvidia

安装 deb 包 提示错误 :

I too am having major pains installing the nvidia drivers. Now, it's partially my fault, as I had an ATI card in and changed them out. But aside from that, whenever I try to do 'apt-get install nvidia-glx', I get the following error:

dpkg-divert: `diversion of /usr/lib/libGL.so.1 to /usr/lib/nvidia/libGL.so.1.xlibmesa by nvidia-glx' clashes with `diversion of /usr/lib/libGL.so.1 to /usr/lib/fglrx/libGL.so.1.xlibmesa by xorg-driver-fglrx'
dpkg: error processing /var/cache/apt/archives/nvidia-glx_1.0.8774+2.6.17.5-11_i386.deb (--unpack):
subprocess pre-installation script returned error exit status 2
Errors were encountered while processing:
/var/cache/apt/archives/nvidia-glx_1.0.8774+2.6.17.5-11_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

使用

dpkg-divert --remove /usr/lib/libGL.so.1
dpkg-divert --remove /usr/X11R6/lib/libGL.so.1

解决问题

都是dash惹的祸

Posted in Bsd, Linux, MacosX, Unix, bash, dash, shell by Kafeifei on the 03月 6th, 2007

困扰我一个春天的问题!
Ubuntu
某天下了一个nerolinux,然后安装
安装失败,提示某脚本出错,看上去是语法错误
出错嘛就删除了哦
结果删除失败,提示同样的错误
导致使用apt-get任何时候都提示这个错误
几经搞整以后造成“新立得”无法正常运行
准备好光盘准备重装了
同时继续寻找希望,搜编google没有正解
其中错误包括:

dpkg (子进程):无法执行新的 post-removal script: No such file or directory
dpkg: 作下列清理工作时发生错误:
子进程·post-removal script·返回了错误号·2
在处理时有错误发生:
-------------------------------------
软件包nerolinux 需要重新安装,但是我无法找到相应的安装文件。

仔细看了一下错误文件
/var/lib/dpkg/info/nerolinux.xxx
打开一看,语法好像不太寻常,我看到了 function 字样
再看头部 #!/bin/sh
改为 #!/bin/bash 后解决问题
ls -l /bin/sh 这个东西是链接到 dash 而不是 bash的
自从ubuntu 6.10 开始就是这样,很让人头痛,很多脚本运行有问题
见过有人为了装一个软件先把 bash->sh 装完了再 dash->sh 回去

妈B的,不改回去了,也没见哪个脚本运行不正常的!
最后,不知道这个dash是啥东东,本来想大骂一顿的,不过…… 还是算了……

ssh SendEnv 问题

Posted in Linux, MacosX, Unix, bash, shell by Kafeifei on the 03月 5th, 2007

远程主机不支持 zh_CN.UTF-8 我机器确是
ssh时:

debug1: Sending environment.
debug1: Sending env LANG = zh_CN.UTF-8
debug1: Sending env LC_CTYPE = zh_CN.UTF-8

造成远程很多程序不能运行

我认为既是远程,就不管那么多了,语言环境随它去比较好

修改
/etc/ssh/ssh_config
注销掉 SendEnv LANG LC_*
即可

再谈 jre / ZendStudio 中文字体问题

Posted in Linux, Zend, bash, java, php, shell by Kafeifei on the 01月 23rd, 2007

找了若干资料,终于有了结果
原来如此简单:

把 Courier New 的几个字体文件 copy 到 jre/lib/fonts/

cd xxx/jre/lib/fonts
mkfontscale
cp fonts.scale fonts.dir
cd ../
cp fontconfig.properties.src fontconfig.properties
vi fontconfig.properties

修改相关位置:

monospaced.plain.latin-1=-monotype-courier new-medium-r-normal--0-0-0-0-m-0-iso8859-1
monospaced.bold.latin-1=-monotype-courier new-bold-r-normal--0-0-0-0-m-0-iso8859-1
monospaced.italic.latin-1=-monotype-courier new-medium-i-normal--0-0-0-0-m-0-iso8859-1
monospaced.bolditalic.latin-1=-monotype-courier new-bold-i-normal--0-0-0-0-m-0-iso8859-1

最后再 cp 一个你喜欢的中文字体到 xxx/jre/fonts/fallback/
打开 ZDE,设置字体为 monospaced
这下爽了,我顶你个肺!

注意:此方法只在 Ubuntu 下测试通过,另外 Windows 是不适用的,如果是suse或者redhat之类的系统,主意看 xxx/jre/lib 下面的fontconfig.xxxx 文件,与当前系统相关做相应的修改就可以(没试过)

相关网址:http://java.sun.com/j2se/1.5.0/docs/guide/intl/fontconfig.html

再说关于jre的字体问题

Posted in Linux, MacosX, Zend, java, php by Kafeifei on the 01月 22nd, 2007

其实最简单的解决ZendStudio中文问题方法就是:
(ZDE自带了JRE)
Zendxxx/jre/lib/fonts/
目录下面建一个叫 fallback 的目录,然后 ln 或干脆 cp 一个中文字体进去就OK了,以前还去改什么字体配置文件,真傻B了!
同样sun-jre也是一样的,建立 fallback 目录。
这种方法对 jre1.5 一上版本有效,其他版本据说要修改 lib 下面某个 font开头的文件。

另外说一下,jre1.6 对文字的处理看上去好像调用了操作系统的东西,例如平滑效果。

不知道有没有高人能把 ZendStudio 里的文字效果做成和平果一样的,Courier New 的英文,黑体中文,平滑处理。平果唯一让我怀念的就是这个东西,写代码的时候心情高很多。

Ubuntu 6.10 Edgy 下ZendStudio不能运行的问题。

Posted in Linux, php by Kafeifei on the 10月 29th, 2006

升级完发现系统速度居然比6.06更快!
其他都还不错,只是ZDE不能运行了,出现以下错误信息:

Configuring the installer for this system's environment...
nawk: error while loading shared libraries: libm.so.6: cannot open shared object file: No such file or directory
dirname: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/bin/ls: error while loading shared libraries: librt.so.1: cannot open shared object file: No such file or directory
basename: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
dirname: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
basename: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
hostname: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory

Launching installer...

grep: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
/tmp/install.dir.9288/Linux/resource/jre/bin/java: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory

尝试手动链接 /usr/lib/ 下的文件也不行,发现原来这些文件在 /lib/ 下都是存在的,google以后找到问题所在,然后看到 http://192.150.14.120/cfusion/knowledgebase/index.cfm?id=tn_18831 写的好像是叫修改版本号,具体的搞不懂 echo $LD_ASSUME_KERNEL 也是空的,最后还是注释刁解决问题:

修改 ZDE 把第1488行注释掉(可能是其他行)。

1448 #export LD_ASSUME_KERNEL=2.2.5

另外安装文件也有同样的问题,看引用文写了个脚本:

#!/bin/bash
if [ "x$1" == "x" ]
then
echo "usage: $0 filename";
fi
newfile="new_$1";
cat $1 | sed "s/export LD_ASSUME_KERNEL/#xport LD_ASSUME_KERNEL/" > $newfile;
chmod +x $newfile;
echo $newfile;

保存为例如 newglibc

$chmod +x newglibc

以后遇到这种问题直接:

$ ./glibcFix ZendStudio-xxx.bin
new_ZendStudio-xxx.bin
$ ./new_ZendStudio-xxx.bin

就可以运行了

好像写得有点白痴,太无聊了吧,想多写两个字。

bash 中的正则表达式

Posted in Linux, bash, shell by Kafeifei on the 09月 13th, 2006

类似

$ps ax | grep -v grep | grep httpd | tr -s ' ' | cut -d ' ' -f1

的方法来取得pid确实还挺好用的,不过今天要取得这个程序执行了多长时间,这个就麻烦了,因为时间中间有空格
翻了半天的man还是没好的解决方案,换了台机器,ubuntu 的,发现 ps 有不小的区别,可以这样:

$ps -eo pid,lstart,args | grep httpd | grep -v grep
2374 Wed Sep 13 00:41:59 2006 /usr/local/httpd/bin/httpd -k restart
2469 Wed Sep 13 00:42:03 2006 /usr/local/httpd/bin/httpd -k restart
22470 Wed Sep 13 00:42:03 2006 /usr/local/httpd/bin/httpd -k restart
22472 Wed Sep 13 00:42:03 2006 /usr/local/httpd/bin/httpd -k restart
22474 Wed Sep 13 00:42:03 2006 /usr/local/httpd/bin/httpd -k restart

其中最前面的数字是pid 中间 Wed Sep 13 00:41:59 2006 是开始时间,后面的所有是"args" (linux下面的ps有lstart这个参数)
这个就麻烦了,args自然只是为了匹配进程特征,中间的时间才是我要的东西。
再找找关于grep的说明(这些小工具都强到一种境界,据说一个sed就写了一本书),一个 -o 参数搞定

$pid=ps -eo pid,lstart,args | grep httpd | grep -v grep | egrep -o ^\ ?[0-9]+\

注意最后有一个空格 "\ " 这样比较保险一点
发现出来的内容

2374
2469
22470
22472
22474

有空格,加一个 tr:

$pid=ps -eo pid,lstart,args | grep httpd | grep -v grep | egrep -o ^\ ?[0-9]+\ | tr -d ' '

同理时间也就简单了:

$ps -eo pid,lstart,args | grep httpd | grep -v grep | egrep -o \ [A-Z][a-zA-Z0-9\ :]+\ [0-9]{4}

转换成时间戳:

$ps -eo pid,lstart,args | grep httpd | grep -v grep | egrep -o \ [A-Z][a-zA-Z0-9\ :]+\ [0-9]{4} | ......

操,卡住了,做的时候都是传的变量。。。

幸好高人(hightman)指点

$ps -eo pid,lstart,args | grep httpd | grep -v grep | egrep -o \ [A-Z][a-zA-Z0-9\ :]+\ [0-9]{4} | xargs -ishit date -d "shit" +%s
1157349945
1158050727
1158144618
1158145964
1158147191

在MacosX安装fontconfig-2遇到的问题

Posted in Bsd, Linux, MacosX, Unix by Kafeifei on the 09月 11th, 2006

make install 遇到这样的提示

dyld: Symbol not found: _FSPathMakeRef
Referenced from: /usr/local/lib/libfreetype.6.dylib
Expected in: flat namespace

实际上是运行 fc-cache 时出现的问题,实际上就是freetype没有安装好,只要重新安装一次freetype,在 ./configure 加上一句 --with-old-mac-fonts 然后 make clean;make;make install 搞定。

我是看这里找到的解决方法:
http://mail-index.netbsd.org/pkgsrc-bugs/2006/06/28/0019.html


17 项查询 - 0.513 秒