clearcase的两个错误(no_rmelem_cmd & EVIL_TWIN)

1. no_rmelem_cmd

jialiang:[] ct rmelem test2

CAUTION! This will destroy the element, all its branches and versions,
including all data, meta-data and history, and will remove the element
from all directory versions that now contain it. Once you destroy the
element, there will be no way to restore it to its current state.
If you want to preserve the element, but remove references to it from
future directory versions, use the “rmname” command.

Element “test2” has 2 branches, 3 versions, and is entered
in 4 directory versions.
Destroy element? [no] yes
rmelem not allowed ; disable no_ rmelem_cmd preop trigger
cleartool: Warning: Trigger “ no_rmelem_cmd “ has refused to let rmelem
proceed.
cleartool: Error: Unable to remove element “test2”.

(这里出现错误的原因是因为,管理员不让用户使用rmelem命令)

2.EVIL_TWIN

什么是evil twin,就是在当前version下没有要追加的目录test1,但是在以前的版本里面有过test1,但是后来被删除了。

所以clearcase的管理员在用户check in element是,hook了一个trigger,来检查用户要提交的element时候有evil
twin,这样就会出现

下面的错误。

jialiang:[] ct mkelem -mkpath test1
Creation comments for “test1”:
.

Search for Evil-Twin, please be patient…

Error: duplicate name ‘test1’ found in directory version
somedir@@/main/some_branch/18
cleartool: Warning: Trigger “AVOID_EVIL_TWIN” has refused to let lnname
proceed
.
cleartool: Error: Unable to create directory element “test1”.
cleartool: Error: Unable to create element “test1”.

解决方法:不能check in当前的test1,需要将它删除,然后从18版将test1 merge过来,然后再test1下进行修改。

使用下面的命令:

ct merge -q -narrows -g -to . .@@/main/some_branch/18

clearcase中一些常用的命令

clearcase缩写为ct,在linux下可以使用alias,在windows下可以使用doskeys.

1. 是文件或目录可编辑

ct co -nc yourfile/yourdir

2. 修改完成文件后,提交

ct ci -nc yourfile/yourdir

3. 取消修改

ct unco yourfile/yourdir

4. 给clearcase中追加新的文件或者目录

ct co -nc parent_dir

ct mkelem yourfile/yourdir(这种情况是创建)

ct mkelem -mkpath yourfile/yourdir(这种情况是文件或目录已经存在)

ct ci -nc parent_dir

5. 删除文件或目录(这里的删除和ct rmelem不一样,我会写文章说明)

ct coparent_dir
ct rmname yourfile/yourdir
ct ci parent_dir

6. 显示当前的工作view

ct pwv

7. 显示当前view的conf-spec

ct catcs

8.显示出当前目录和子目录下被check out出来的element

ct lsco -cview -rec

9.显示出当前目录和子目录下自己新建的目录或文件

ct ls -r -view_only
ct lsprivate

10.显示图形化的diff

ct diff -g -pre yourelement
ct diff -g yourelement yourelement@@/main/5

11. 显示版本tree

ct lsvtree -g yourelement

12.获得element的具体信息

ct describe yourelement

13. 其他

cleartool find
cleartool lstype
cleartool man fmt_ccase
clearimport

refs:

http://www.ibm.com/developerworks/rational/library/836.html

rdesktop连接中文windows xp后,使用 alt+shift切换输入法失效

rdesktop连接中文windows xp后,使用 alt+shift 切换输入法失效的原因是, alt+shfit在X
desktop上被映射到meta_l上了,

所以解决方法有两个:

1.将alt+shift映射取消掉,只要在运行rdesktop的命令之前先运行xmodmap -e “keysym Alt_L = Alt_L”就可以了;
2.不取消映射,然后将windows切换输入法的快捷键改成ctrl+shfit,就好;这是如果已经按了alt+sfhit,可以再按几下alt,就可以回复正常了。

refs:

http://mirror.hamakor.org.il/archives/linux-il/08-2004/11454.html
http://sourceforge.net/tracker/?func=detail&aid=1160416&group_id=24366&atid=381347

eclipse plugin启动顺序

依赖关系

两个plugin test1和test2;
1. test1和test2没有依赖关系
因为没有显式说明是early start,所以使用lazy start,只有在真正使用到时,才会调用具体的构造函数和start方法;
test1 contructor
test1 start
test2 contructor
test2 start

2. test2依赖于test1
这个依赖分三种:
2.1 如果只是在test2的MANIFEST.MF文件中的Require-Bundle中出现;
这时两个是没有关系的;

2.2 如果在test2中的java文件中出现import test1中的包:
这时两个还是没有关系的;

2.3 在test2中使用到了test1中的类:
在使用的地方才会初始化test1;例如在test2的构造函数处使用test1中的类:
test2 contructor
test1 contructor
test1 start
test2 start

3. 相互依赖
如果出现相互依赖,运行程序的时候,会提示有错误,但是如果不管错误提示,继续执行的话,还是可以启动;
但是最好还是将相互依赖打破,因为这样不符合设计规范。

4. early starup

一般不推荐使用early startup,因为eclipse设计时就是为了快速启动,才将显示(plugin.xml)和实现(.java,.icon,
etc)分离的。
使用early startup,需要在plugin.xml文件中追加一个extension
org.eclipse.ui.startup,同事实现IStartup接口。

这样eclipse就会使用单独的进程启动该plugin。
如果有依赖的plugin,它同时将依赖的plugin初始化;
需要注意的是:如果没有实现IStartup,eclipse会报错,但是也会将plugin在单独的进程中启动。
实现了IStartup:
test2 contructor
test1 contructor
test1 start
test2 start
test2 early startup

没有实现IStartup:
test2 contructor
test1 contructor
test1 start
test2 start

!ENTRY org.eclipse.ui 4 4 2011-06-17 10:58:47.328
!MESSAGE Bad extension specification

!ENTRY test2 4 0 2011-06-17 10:58:47.359
!MESSAGE startup class must implement org.eclipse.ui.IStartup

refs:

http://www.peterfriese.de/why-you-should-be-careful-when-using-early-
startup/

https://bugs.eclipse.org/bugs/show_bug.cgi?id=91603

ClearCase的lincense获得时间

When a user runs a Rational ClearCase client utility, such as cleartool or a
GUI program, that utility attempts to obtain a license. If it gets one, the
user can keep the license for an extended period. Entering any Rational
ClearCase command renews the license. If the user does not enter a Rational
ClearCase command for a substantial period—by default, 60 minutes—another
user can take the license.

简单的说:当你开始使用ct时,就会获得一个license,但是这个license是有时间限制的,默认是60秒;只要你在这60秒内什么都没有做,你的license就有可能被分配给别人,反过来只要你使用了,这60秒的限制就会被重新设置陈60秒,重新开始计时。

以下是获取license的步骤:

Whenever a user runs a Rational ClearCase command or GUI, a license-
verification check is made. If the user already has a license, the check
succeeds and the command or GUI runs. If the user does not have a license, the
following steps occur:

1. The Rational ClearCase client software looks for the name of the license
server host.

2. The command or GUI communicates with the license server process on the
license server host, to see whether the user can get a license. (The license
server process is actually the albd_server, performing these duties in
addition to its other tasks.)

3. If a license is available, the license server grants the user a license
and the command or GUI runs.

4. If no license is available, the license server returns a message to that
effect and the command or GUI exits with an error message.

kelvin 四线连接电阻测试法

什么是kelvin四线电阻测试法

可参见:http://en.wikipedia.org/wiki/Kelvin_connection

它的目的是为了在测试小电阻时,去除线阻的干扰。

见下图:

假设通过电流表的电流是I,通过电压表的电流是I_wire,电压是U,通过电阻的电流是I_subject,

那么:

I = I_wire + I_subject

因为电压表的缘故(这里可以通过动态调整,使得通过电压表的电流趋向于零),所以I_wire –> 0,

所以I = I_subject

I = U/R_subject

R_subject = U/I

refs:

http://www.cirris.com/testing/resistance/fourwire.html

http://www.allaboutcircuits.com/vol_1/chpt_8/9.html

xiami flash播放器对歌曲链接的解密算法

1. 本文是学习只用,不要将之用在非法用途

2. 先下载xiami的flash播放器, 通过Sothink SWFDecompiler 将之反编译;

3. 然后找出它的解密函数,关键代码如下:

public function getLocation(param1:String) : String { var _loc_2: =
undefined; var _loc_3:
= undefined; var _loc_4: = undefined; var _loc_5: =
undefined; var _loc_6: = undefined; var _loc_7: = undefined; var _loc_8: =
undefined; var _loc_9:
= undefined; var _loc_10: = undefined; _loc_2 =
Number(param1.charAt(0)); _loc_3 = param1.substring(1); _loc_4 =
Math.floor(_loc_3.length / _loc_2); _loc_5 = _loc_3.length % _loc_2; _loc_6 =
new Array(); _loc_7 = 0; while (_loc_7 < _loc_5) { if (_loc_6[_loc_7] ==
undefined) { _loc_6[_loc_7] = “”; } _loc_6[_loc_7] = _loc_3.substr((_loc_4 +
1)
_loc_7, (_loc_4 + 1)); _loc_7 = _loc_7 + 1; } _loc_7 = _loc_5; while
(_loc_7 < _loc_2) { _loc_6[_loc_7] = _loc_3.substr(_loc_4 * (_loc_7 - _loc_5)

  • (_loc_4 + 1) * _loc_5, _loc_4); _loc_7 = _loc_7 + 1; } _loc_8 = “”; _loc_7 =
    0; while (_loc_7 < _loc_6[0].length) { _loc_10 = 0; while (_loc_10 <
    _loc_6.length) { _loc_8 = _loc_8 + _loc_6[_loc_10].charAt(_loc_7); _loc_10 =
    _loc_10 + 1; } _loc_7 = _loc_7 + 1; } _loc_8 = unescape(_loc_8); _loc_9 = “”;
    _loc_7 = 0; while (_loc_7 < _loc_8.length) { if (_loc_8.charAt(_loc_7) == “^”)
    { _loc_9 = _loc_9 + “0”; } else { _loc_9 = _loc_9 + _loc_8.charAt(_loc_7); }
    _loc_7 = _loc_7 + 1; } _loc_9 = _loc_9.replace(“+”, “ “); return _loc_9; }//
    end function

4. 使用python实现后的算法是:

import sys import re import math import urllib import pdb def main(xiamistr):
print xiamistr; var_first = int(xiamistr[0]); var_sub = xiamistr[1:];
var_floor = math.floor(len(var_sub)/ var_first); var_floor = int(var_floor);
var_mod = len(var_sub)% var_first; print len(var_sub); print var_floor; print
var_mod; var5 = 0; result = []; tmp = 0; while var5 < var_mod: tmp =
(var_floor + 1) var5; result.insert(var5, var_sub[tmp : tmp + var_floor +
1]); var5 = var5 + 1; print result; var5 = var_mod; while var5 < var_first:
tmp = var_floor
(var5 - var_mod) + (var_floor + 1 ) * var_mod;
result.insert(var5, var_sub[tmp : tmp + var_floor]); var5 = var5 + 1 ; print
result; tmpStr= “”; var5 = 0; tmp2 = “”; while var5 < len(result[0]): tmp = 0;
while tmp < len(result): tmp2 = result[tmp]; try: tmp2 = tmp2[var5]; except
IndexError: tmp2 = “”; tmpStr = tmpStr + tmp2; tmp = tmp + 1; var5 = var5 + 1;
print “tmp str “ + tmpStr; tmpStr = urllib.unquote(tmpStr); print tmpStr;
print urllib.unquote(tmpStr); var5 = 0; tmp2 = “”; while var5 < len(tmpStr):
if tmpStr[var5] == “^”: tmp2 = tmp2 + “0”; else: tmp2 = tmp2 + tmpStr[var5];
var5 += 1; print tmp2; tmp2.replace(“+”, “ “); print tmp2; if name ==
main“: if len(sys.argv) < 2: print(“Usage: %s url”%sys.argv[0]); else:
main(sys.argv[1]);

5. 一个简单的例子是:

输入:
7h%3.65531E88pt2.n2EE%%1563tFxe5%%22719p%it%25F5613%2a%5FE%29_33Fm2E455%71.AfiF%%4E545m

输出: http://f3.xiami.net/62500/400543/01%201769748511_1586933.mp3

6. 通过上面的方法,就可以写出一个自动下载虾米歌曲的软件, 具体的思路如下:

6.1 通过http请求得到某个专辑的页面,可以得到所有歌曲的一览和songId;

6.2 通过songId可以构造http请求得到对应歌曲的信息(xml格式)

6.3 然后通过上面的程序将xml 中location项解密,即可以得到歌曲下载地址。

-—-

to xiami:

注意自己的安全。

因为已经有人写了这样的程序,就不再重写了。

http://www.appinn.com/longkey-xiami-music-dl/

to 自己

1. actionscript 中的子字符串处理函数有两个: substring 和substr,注意区分;

2. 异常处理:

try :
tmp2 = tmp2[var5];
except IndexError:
tmp2 = “”;

-–
get mustc info:
http://www.xiami.com/song/playlist/id/1770506132/object_name/default/object_id/0

python debug:
http://www.blogjava.net/Skynet/archive/2009/04/07/264259.html

my csdn blog xiami decrypt
http://blog.csdn.net/lantianjialiang/article/details/6339326

网页版飞信(Fetion)的安全问题

1. 用网页登录飞信的网站( 这里显示的是https,但是在传输密码时没有加密 ):
https://webim.feixin.10086.cn/

2. 使用firebug可是看到它使用的是https://webim.feixin.10086.cn/js/login.js?2010121001
来实现登录的。

具体的source不贴出来的,但是关键的部分如下:

function j() { var m = new Object(); m.success = k; m.error = b; if
(calluser) { m.url = loginUrl + “?calluser=” + calluser } else { m.url =
loginUrl } m.type = “POST”; var l = 0; if (!f(“#login_chk_1”).attr(“checked”))
{ l = 400 } m.data = { UserName: f(“#login_username”).val().trim(), Pwd:
f(“#login_pass”).val(), Ccp: f(“#login_code”).val(), OnlineStatus: l };
m.dataType = “json”; loadingPanel.show(); f.ajax(m) }

3. 从source中可以看到它是通过ajax 用post方法将数据传输到server的,但是使用firebug查看的话,

它是将密码明文发送的, 所以会有中间人攻击的可能,尤其是公司是经过代理上网的,管理员在代理服务器上

可以通过http post数据得到用户的密码

4. 例子如下:

POST /WebIM/Login.aspx HTTP/1.1

UserName=13468718000 & Pwd=aaaaaaaaaa &Ccp=8kvs&OnlineStatus=400

^用户的手机号码(这里是随便输入的) ^密码

看来网上安全需要注意,我还尝试了renren和web.qq.com。

renren也是通过明文来传输密码的,但是web.qq.com不是,它是通过md5算法散列的, 关键的一行是

“H += md5(md5_3(B.p.value) + G);”

^密码 ^verifycode(可以通过http get 数据获得)

例如,一个web qq登录请求:

GET
/login?u=555555555&p=F018505DE8B66FBCB8CD7F1A04101870&verifycode=!AG0&remember_uin=1&aid=1003903&u1=http%3A%2F%2Fweb.qq.com%2Floginproxy.html%3Flogin_level%3D3&h=1&ptredirect=0&ptlang=2052&from_ui=1&pttype=1&dumy=&fp=loginerroralert&mibao_css=
HTTP/1.1

密码”111111111”经过4次md5散列后的变成了”F018505DE8B66FBCB8CD7F1A04101870”,
verifycode是:!AG0

refs: js beauty online 很好用 http://jsbeautifier.org/?

-—

https://mail.qq.com 也是通过明文来传输密码的,例如,一个登录请求:

POST /cgi-bin/login?sid=,2,zh_CN HTTP/1.1

sid=%2C2%2Czh_CN&firstlogin=false&starttime=1303269953187&redirecturl=&f=html&p=111111&ept=0&delegate_url=&s=&ts=1303269964&from=&ppp=&chg=0&target=&checkisWebLogin=9&uin=dddd&aliastype=@qq.com&pp=000000&verifycode=

uin=dddd 是用户名, p=111111是密码

如何从ted上下载字幕

本来已经有人写了python脚本从ted上下载字幕了,但是他的网站被墙同时有些ted的地址他解析不了,

所以我将他的python 脚本下载了下来,修改了一下。

谢谢: http://tedtalksubtitledownload.appspot.com/

source 如下:

#! /usr/bin/env python import simplejson import pdb import urllib import sys
import re def getFormatedTime(intvalue): mils = intvalue%1000 segs =
(intvalue/1000)%60 mins = (intvalue/60000)%60 hors = (intvalue/3600000) return
“%02d:%02d:%02d,%03d”%(hors,mins,segs,mils) def availableSubs(subs): a =
subs.find(“LanguageCode”) if a == -1: return [] subs =
subs[a+len(“LanguageCode”):] return [re.search(“%22([^A-Z]+)%22”,
subs).group(1)] + availableSubs(subs) def getVideoParameters(urldirection): ht
= urllib.urlopen(urldirection).read() var = re.search(‘flashVars =
{/n([^}]+)}’, ht) if var: var = var.group(1) else: return None var =
[a.replace(‘/t’, ‘’) for a in var.split(‘/n’)] # debug pdb.set_trace() for a
in range(len(var)): if var[a]: var[a] = var[a][:var[a].rfind(‘,’)] resultado =
[] for a in var: l = a.find(‘:’) if l != -1: resultado.append((a[:l],
a[l+1:])) return dict(resultado) def downloadSub(idtalk, lang, timeIntro):
print(“Downloading subtitles for language %s”%lang) c =
simplejson.load(urllib.urlopen(‘http://www.ted.com/talks/subtitles/id/%d/lang/%s'%(idtalk,
lang))) salida = file(‘subs_%s_%s.srt’%(idtalk,lang), ‘w’) conta = 1 c =
c[‘captions’] for linea in c: salida.write(“%d/n”%conta) conta += 1
salida.write(“%s –> %s/n”%(getFormatedTime(timeIntro+linea[‘startTime’]),
getFormatedTime(timeIntro+linea[‘startTime’]+linea[‘duration’])))
salida.write(“%s/n/n”%(linea[‘content’].encode(‘utf-8’))) salida.close() def
main(tedurl): print(“Loading information about TED talk number %s…”%tedurl)
vidpar = getVideoParameters(tedurl) if not vidpar: print(“There was a problem
fetching information about that TED Talk”) sys.exit(1) print(“Download all
subtitles (write ‘all’ when prompted) or only one (specify wich)?”) a =
raw_input() availables = availableSubs(vidpar[‘languages’]) idtalk =
vidpar[‘ti’] idtalk = int(idtalk[1:3]) if a == “all”: for lang in availables:
downloadSub(idtalk, lang, int(vidpar[‘introDuration’])) else: while a not in
availables: print(“We’re sorry, the only available languages are:”) for a in
availables: print(“/t”+a) a = raw_input() downloadSub(idtalk, a,
int(vidpar[‘introDuration’])) if name == “main“: if len(sys.argv) < 2:
print(“Usage: %s tedurl”%sys.argv[0]) else: main(sys.argv[1])

要使用它的话,需要先下载simplejson包,地址是: http://pypi.python.org/pypi/simplejson/

在通过http代理上网的环境中也可以使用。

具体使用例子如下:

D:/Document and Setting/test/My Documents/Downloads/TEDTalkSubtitles>
TEDTalkSub
itles.py

http://www.ted.com/talks/barry_schwartz_on_the_paradox_of_choice.html
Loading information about TED talk number
http://www.ted.com/talks/barry_schwar
z_on_the_paradox_of_choice.html…
Download all subtitles (write ‘all’ when prompted) or only one (specify wich)?
chi_hans
Downloading subtitles for language chi_hans

D:/Document and Setting/test/My Documents/Downloads/TEDTalkSubtitles >dir
ドライブ D のボリューム ラベルは programe です
ボリューム シリアル番号は 447B-7E2B です

D:/Document and Setting/test/My Documents/Downloads/TEDTalkSubtitles のディレク
トリ

2011/04/15 14:16

.
2011/04/15 14:16 ..
2011/04/15 14:34 31,879 subs_93_chi_hans.srt
2011/04/15 14:16 31,928 subs_93_eng.srt
2011/04/15 14:26 2,639 TEDTalkSubtitles.py
3 個のファイル 66,446 バイト
2 個のディレクトリ 13,469,048,832 バイトの空き領域

D:/Document and Setting/test/My Documents/Downloads/TEDTalkSubtitles>

refs:

http://pythonconquerstheuniverse.wordpress.com/category/the-python-debugger/

http://meyerweb.com/eric/tools/dencoder/