11 May 2009

Firefox - 自己打造双击关闭标签栏

不知道为什么,firefox一直没有双击关闭标签栏这个功能,非常不方便
为了它安装一个tab mix plus,又不想.毕竟插件安装多了,firefox会非常臃肿.

Do It Yourself - Using double-click to close tab in firefox without add any plug-ins.

修改方法如下:



1,打开firefox目录,再进入chrome目录,打开browser.manifest,修改

1,Enter the directory of firefox,cd to chrome,open the file named browser.manifest,change the following:
content browser jar:browser.jar!/content/browser/ xpcnativewrappers=yes contentaccessible=yes

to:
content browser file:browser/content/browser/ xpcnativewrappers=yes contentaccessible=yes


2,解压缩browser.jar到browser文件夹,然后进入..\firefox\chrome\browser\content\browser\,修改tabbrowser.xml,找到onTabBarDblClick方法:

2,upzip browser.jar to browser directory,then cd ..\firefox\chrome\browser\content\browser\,change the file named tabbrowser.xml,find the method named onTabBarDblClick(see picture shown below):

<method name="onTabBarDblClick">
        <parameter name="aEvent"/>
        <body>
          <![CDATA[
            // See hack note in the tabbrowser-close-button binding
            if (!this._blockDblClick && aEvent.button == 0 &&
                aEvent.originalTarget.localName == "box") {
              // xxx this needs to check that we're in the empty area of the tabstrip
              var e = document.createEvent("Events");
              e.initEvent("NewTab", true, true);
              this.dispatchEvent(e);
            }
          ]]>
        </body>
      </method>

给if后面增加else语句,变为

add Else condition after if statement like:
<method name="onTabBarDblClick">
        <parameter name="aEvent"/>
        <body>
          <![CDATA[
            // See hack note in the tabbrowser-close-button binding
            if (!this._blockDblClick && aEvent.button == 0 &&
                aEvent.originalTarget.localName == "box") {
              // xxx this needs to check that we're in the empty area of the tabstrip
              var e = document.createEvent("Events");
              e.initEvent("NewTab", true, true);
              this.dispatchEvent(e);
            } else { this.removeTab(this.mCurrentTab);
            }
          ]]>
        </body>
      </method>


3,保存tabbrowser.xml,重新打开Firefox浏览器即可.

3,save tabbrowser.xml,restart your Firefox and Enjoy.

8 May 2009

Firefox播放real和QuickTime的办法

firefox播放嵌入real和QuickTime的页面,总是提示下载插件,却不能安装.
又不想为了这个安装庞大的real player和QuickTime,方法如下.


让Firefox 播放 real media, quicktime media

##CONTINUE##

1. Real Alternative
让firefox 支持 Real media
点击下载

2. QuickTime Alternative
让firefox 支持 quicktime media。安裝 QT Lite 版够用了。
点击下载
Quicktime 7 Professional 注册码:
Name: CORE MAFIA
S/N: DFXY-5TJN-HU3N-DQXF-WDQ3

3. K-Lite Code Pack
K-Lite Code Pack。K-Lite Codec Pack,你只需要安裝它,就可以利用Windows MediaPlayer或其他常见的播放器播放各种格式的影片了.安裝 Standard 版就够了。因版权问题,Mega 版只包含 Real Alternative, 沒有 QuickTime Alternative,所以需要另外安裝 QT Alternative。
点击下载

VMware瘦身+关闭后台进程

前两天从6.0.2更新到6.5.1,结果只要运行虚拟机就会有VMware-tray.exe进程,
还必须手动终止.非常郁闷.6.0的时候一切正常.

没办法,只要手动干掉.捎带着给VMware瘦身一下.



1,删除help文件夹下一切东西,用不着;
2,pkg文件夹整个删除,这是备份文件,删除完全没有影响;
3,直接给VMware-tray.exe改名,我改成VMware-tray.exe.bak,运行虚拟机.关闭后没有启动进程,一切正常.

5 May 2009

Python Tips - 迅雷,快车,qq下载地址转换

可以转换迅雷,快车和qq下载地址的模块

迅雷,快车和qq下载都有专用的地址,其转换规则如下:

1、普通地址转换为迅雷地址
在原地址前面加”AA”,后面加”ZZ”(注:不包括引号),即AAhttp://**ZZ
然后用base64编码后,在地址前加thunder://.

2、普通地址转换为快车地址
在原地址前后都加上”[FLASHGET]“(注:不包括引号),地址变为
[FLASHGET]http://**[FLASHGET]
用base64编码后,在地址前加flashget://,后面还要加上”&字符串”,字符串随便什么都行.

3、普通地址转换为旋风地址
旋风相对就简单多了,将原地址直接base64编码,然后在地址前加qqdl://

逆向及反着来一次.


python地址转换代码如下:

#! /usr/bin/env python
# PyThunder.py
# transfer special download address to the normal http address
# including thunder, flashget and qq download
# http://52xenos.blogspot.com

from base64 import decodestring, encodestring

def decThunder(strThu):
""" Thunder decode """
if strThu.startswith('thunder://'):
strHttp = strThu[strThu.index('thunder://')+len('thunder://'):]
strHttp = decodestring(strHttp)
if strHttp.startswith('AA') and strHttp.endswith('ZZ'):
strHttp = strHttp[len('AA'):len(strHttp)-len('ZZ')]
return strHttp
else:
return 'Wrong'
else:
return 'Wrong'

def encThunder(strHttp):
""" Thunder encode """
if strHttp.startswith('http://'):
strThu = 'AA' + strHttp
strThu += 'ZZ'
strThu = encodestring(strThu)
strThu = 'thunder://' + strThu
return strThu
else:
return 'Wrong'

def decFlash(strFla):
""" Flashget decode """
if strFla.startswith('flashget://'):
strHttp = strFla[strFla.index('flashget://')+len('flashget://'):strFla.index('&')]
strHttp = decodestring(strHttp)
if strHttp.startswith('[FLASHGET]') and strHttp.endswith('[FLASHGET]'):
strHttp = strHttp[len('[FLASHGET]'):len(strHttp)-len('[FLASHGET]')]
return strHttp
else:
return 'Wrong'
else:
return 'Wrong'

def encFlash(strHttp):
""" Flashget encode """
if strHttp.startswith('http://'):
strFla = '[FLASHGET]' + strHttp + '[FLASHGET]'
strFla = encodestring(strFla)
strFla = 'flashget://' + strFla
strFla += '&test'
return strFla
else:
return 'Wrong'

def decQQ(strQQ):
""" QQdown decode """
if strQQ.startswith('qqdl://'):
strHttp = strQQ[strQQ.index('qqdl://')+len('qqdl://'):]
strHttp = decodestring(strQQ)
return strHttp
else:
return 'Wrong'

def encQQ(strHttp):
""" QQdown encode """
if strHttp.startswith('http://'):
strQQ = encodestring(strHttp)
strQQ = 'qqdl://' + strQQ
return strQQ
else:
return 'Wrong'

def main():
""" main entry here """
while True:
strFlag = raw_input("""Please input the type:
1 : other -> http
2 : http -> other
0 : exit\n""")
if strFlag == '0':
break
elif strFlag == '1':
print "You choose other->http"
strOther = raw_input("""Please input the address:(0 for back)\n""")
if strOther == '0':
continue
elif strOther.startswith('thunder://'):
if decThunder(strOther) != 'Wrong':
print decThunder(strOther)
elif strOther.startswith('flashget://'):
if decFlash(strOther) != 'Wrong':
print decFlash(strOther)
elif strOther.startswith('qqdl://'):
if decQQ(strOther) != 'Wrong':
print decQQ(strOther)
elif strFlag == '2':
print "You choose http->other"
strType = raw_input("""Please specify the type:
1 : http->thunder
2 : http->flashget
3 : http->QQ down
0 : back\n""")
if strType == '0':
continue
elif strType == '1':
strHttp = raw_input("Please input the address:(0 for back)\n")
if strHttp == '0':
continue
elif encThunder(strHttp) != 'Wrong':
print encThunder(strHttp)
elif strType == '2':
strHttp = raw_input("Please input the address:(0 for back)\n")
if strHttp == '0':
continue
elif encFlash(strHttp) != 'Wrong':
print encFlash(strHttp)
elif strType == '3':
strHttp = raw_input("Please input the address:(0 for back)\n")
if strHttp == '0':
continue
elif encQQ(strHttp) != 'Wrong':
print encQQ(strHttp)

#test module
if __name__ == '__main__': main()

4 May 2009

Ubuntu Tips - vmware中释放鼠标问题

vmware虚拟Ubuntu从804到810再到904,虽然VMware版本也从6.0升到6.5,但是除了804中直接安装vm tools好使之外,810和904死活不能释放鼠标.

If you also meet the problem of releasing mouse from vmware, please read this post, which I find from the internet.

从一老外的blog看到解决办法,目前ok.

方法如下:

##CONTINUE##


sudo apt-get install xserver-xorg-input-vmmouse


注销后再登陆ok.

Log-out and log-in, It should be ok now.

2 May 2009

Software - Flv Extract: FLV分解软件

一款可以将flv文件中的音频和视频分解的软件,
小巧实用,可惜是日文版,汉化过的版本比较低.

An amazing software which can extract video and audio from flv files. It's made by janpanese.

官方网址:

Website:

##CONTINUE##

http://www.paw.hi-ho.ne.jp/milbesos/

下载地址:

Download:

http://www.paw.hi-ho.ne.jp/milbesos/download/hugflash2_6_3.lzh