mplayer播放视频时声音图像不同步问题

转一篇文章,我遇到的问题和下面的一样,连看的视频都一样,解决方式当然也一样 原文在这里 电脑里有《老友记》还是mkv格式的,mplayer播放出现声音图像不同步,快进有抖音。总不能老重启回xp去看吧。捣鼓了N久,解决同步问题,但是快进还有点小瑕疵,有时会有点破音,再按下空格快进就OK了。 ...

November 20, 2009 · notsobad

emacs对模板文件的语法高亮

emacs中的语法高亮,应该是默认启用的 我有些.tpl的文件,实际上是些html模板文件,需要html的语法高亮,这就要一些配置。 在~/.emacs中加几行,声明这几种文件的类型即可 ;HTML (autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t) (setq auto-mode-alist (cons '("\\\\.html$" . html-helper-mode) auto-mode-alist)) (setq auto-mode-alist (cons '("\\\\.htm$" . html-helper-mode) auto-mode-alist)) (setq auto-mode-alist (cons '("\\\\.tpl$" . html-helper-mode) auto-mode-alist))

November 19, 2009 · notsobad

mysql中设置utf8编码

MySQL的编码很复杂,一直也搞不大懂。 参考mysql网站上的一个帖子setting utf8 in my.cnf 修改自己的/etc/mysql/my.cnf,添加了写编码相关的字段 最终版本: /etc/mysql>cat my.cnf |grep -v ^# [client] port = 3306 socket = /var/run/mysqld/mysqld.sock default-character-set = utf8 [mysqld_safe] …… 后在db shell中查看编码 mysql> show variables like "%character%";show variables like "%collation%"; +--------------------------+----------------------------+ | Variable_name | Value | +--------------------------+----------------------------+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | /usr/share/mysql/charsets/ | +--------------------------+----------------------------+ 8 rows in set (0.00 sec) +----------------------+-----------------+ | Variable_name | Value | +----------------------+-----------------+ | collation_connection | utf8_general_ci | | collation_database | utf8_general_ci | | collation_server | utf8_general_ci | +----------------------+-----------------+ 3 rows in set (0.00 sec) 这样编码就统一为utf8了

November 19, 2009 · notsobad

php版本比较函数version_compare()

在有些情况下,php需要对版本做比较。一般我们都会使用strcmp()的字符串比较来代替, 但是在版本号超过两位的时候,比较就会有问题了。 比如: 4.1.10与4.1.2比较 strcmp(“4.1.10”, “4.1.2”); 会返回-1 错误。 version_compare(“4.1.10”, “4.1.2”); 就会返回1 正确, 前段时间就因为这个犯了错误。 总之版本比较时一定要用version_compare(); 详细的使用说明参考php手册: http://php.chinaunix.net/manual/en/function.version-compare.php

November 19, 2009 · notsobad

emacs的一些资料

一个emacs的站点,请直接访问这里:Xah’s Emacs Tutorial 很有用的tips,比如 “How To Make Emacs Use Modern User Interface ”, 让你的emacs和常用编辑器更像一些,对于初学者很有用, 下面给出目录: General Tips Emacs Basics Emacs Intermediate How To Make Emacs Use Modern User Interface Emacs and MS Windows Tips Emacs Advanced Tips Emacs Less-known Tips New Features in Emacs 23 Fun Things To Do With Emacs General Tasks Emacs and Unicode Tips Emacs and HTML Tips Emacs and Unix Tips File Management with Emacs Specific Tasks Find and Replace with Emacs FIND → REPLACE Interactively Find and Replace String Patterns on Multiple Files Rename Files by a Text Pattern Emacs Regex Emacs Keyboarding Emacs’s Keyboard Shortcut Layout Defining Your Own Keyboard Shortcuts A Ergonomic Keyboard Shortcut Layout Why Emacs’s Keyboard Shortcuts Are Painful How To Avoid The Emacs Pinky Problem General Emacs Tips Where to get JavaScript, PHP, Visual Basic, … How To Install Emacs Packages Long Term Emacs Productivity Tips Emacs Modernization ...

November 19, 2009 · notsobad

windows的命令行刻录cd/dvd工具

最早的windows xp是不支持dvd刻录的,因为在windows xp发布的时候很少有人买得起dvd的刻录机。 在大概2007年微软开始让windows xp支持dvd刻录,并且为此出了一个升级包。升级包可以在: http://support.microsoft.com/kb/KB932716 下载。 但是vc6.0不支持Image Mastering API Version 2.0 (IMAPI2),所以也不支持dvd刻录。 所以要想编写dvd刻录功能相关的代码需要选择vs2005/2008系列的开发环境。 至于用vc6编写的程序只能通过调用外部程序来实现dvd刻录了。 这里主要说的就是这种情况下可以使用的外部程序。 ...

November 18, 2009 · notsobad

vs2008 控制台项目中打印CString类型

今天写个小程序,第一次使用vs2008。 知道vs2008默认打开了unicode字符的支持。自己也对unicode有些认识,所以想开始全部使用wchar。 建了个windows console的控制台项目,想打印一下其中的CString类型输出。 ...

November 18, 2009 · notsobad

perl配合fire xpath 快速准确爬取网页数据到mysql数据库

perl+HTML::TreeBuilder::XPath+firefox+fire xpath可以快速准确地爬取自己需要的网页数据。 前段时间从一个网站上收集一些信息。上网找了很多方法,不是步骤复杂,就是抓取的内容不够准确。 最后选择了perl+HTML::TreeBuilder::XPath+firefox+fire xpath的方法: ...

November 17, 2009 · notsobad

ssh的密钥登录

ssh登录输入密码很麻烦,以前我是写一个expect脚本来登录,不过那比较土,安全的做法是用公钥、私钥的方法,参考这篇文章 1. On the client run the following commands: $ mkdir -p $HOME/.ssh $ chmod 0700 $HOME/.ssh $ ssh-keygen -t dsa -f $HOME/.ssh/id_dsa -P '' This should result in two files, $HOME/.ssh/id_dsa (private key) and $HOME/.ssh/id_dsa.pub (public key). 2. Copy $HOME/.ssh/id_dsa.pub to the server. 3. On the server run the following commands: $ cat id_dsa.pub >> $HOME/.ssh/authorized_keys2 $ chmod 0600 $HOME/.ssh/authorized_keys2 Depending on the version of OpenSSH the following commands may also be required: $ cat id_dsa.pub >> $HOME/.ssh/authorized_keys $ chmod 0600 $HOME/.ssh/authorized_keys An alternative is to create a link from authorized_keys2 to authorized_keys: $ cd $HOME/.ssh && ln -s authorized_keys2 authorized_keys 4. On the client test the results by ssh'ing to the server: $ ssh -i $HOME/.ssh/id_dsa server 5. (Optional) Add the following $HOME/.ssh/config on the client: Host server IdentityFile ~/.ssh/id_dsa This allows ssh access to the server without having to specify the path to the id_dsa file as an argument to ssh each time.

November 16, 2009 · notsobad

javascript的log

js开发中,需要打印些log,经常会用到firebug的console.log 但是不宜直接在代码里写console.log,因为没有装firebug的人访问时会报错,所以需要封装一下。 if($.browser.msie){ //ie忽略,因为安装了IE develop toolbar的话,也会存在console这个全局函数 var log = function(){}; } else { //Firefox 需要考虑到没有安装firebug插件的情况 var log = window.console && console.log || function(){}; } 精简一点 ...

November 15, 2009 · notsobad