2008年01月 存档

MySQL5 STOPPING server from pid file 错误

2008年01月12日,星期六


Starting mysqld daemon with databases from /var/lib/mysql
STOPPING server from pid file /var/run/mysqld/mysqld.pid
050810 11:29:48 mysqld ended

解决办法:找到MySQL配置文件里的 socket = /tmp/mysql.sock

检查/tmp/mysql.sock权限

LDAP的MD5算法

2008年01月12日,星期六

和php、MySQL的 md5() 函数不一样,LDAP里用户认证时候的md5算法有点不一样,留个记录。来源:OpenLDAP邮件列表

首先说说php和MySQL的md5函数,例如:
md5("testing") = "ae2b1fca515949e5d54fb22b8ed95575";
这个和Python的 hexdigest() 函数结果是一样的
>>> md5("testing").hexdigest()
'ae2b1fca515949e5d54fb22b8ed95575'

在LDAP里怎么表示的呢?

dn: cn=md5user,dc=my,dc=example,dc=com
objectClass: simpleSecurityObject
objectClass: organizationalRole
cn: md5user
description: MD5USER
userPassword: {MD5}CgIBDAUFBA4NBAsCCA0FBw==
]

怎么得到的呢?

我们研究 字符串 testing 的 MD5 字串:ae 2b 1f ca 51 59 49 e5 d5 4f b2 2b 8e d9 55 75
首先隔一个字符提取一个字符,得到一个新的字符串,例如:
a21c554ed4b28d575
得到:
a  2  1  c  5  5  4  e  d  4  b  2  8  d  5  7
那么把每一位看成十六进制,转换成对应的ASCII字符,例如第一位的 a,十六进制是 \x0A,也就是个回车:\n,把转换后的ASCII字符连起来,那么我们可以得到一串字符,不可显示的:'\n\x02\x01\x0c\x05\x05\x04\x0e\r\x04\x0b\x02\x08\r\x05\x07'

最后把这串不可打印的字符用base64编码之后,就可以得到LDAP标准的MD5字串,例如我们在Python里:

>>> '\n\x02\x01\x0c\x05\x05\x04\x0e\r\x04\x0b\x02\x08\r\x05\x07'.encode('base64'
).strip()
'CgIBDAUFBA4NBAsCCA0FBw=='

strip()是去掉一个没有用的回车符号。

最后我们用Python实现这一算法:

ActivePython 2.5.1.1 (ActiveState Software Inc.) based on
Python 2.5.1 (r251:54863, May 1 2007, 17:47:05) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from md5 import md5
>>>
>>> mysql_md5 = md5("testing").hexdigest()
>>> mysql_md5
'ae2b1fca515949e5d54fb22b8ed95575'
>>> binary_md5 = ''.join([ chr(int(mysql_md5[i:i+1],16)) for i in range(0,len(mysql_md5),2)])
>>> binary_md5
'\n\x02\x01\x0c\x05\x05\x04\x0e\r\x04\x0b\x02\x08\r\x05\x07'
>>> ldap_md5 = binary_md5.encode("base64").strip()
>>> ldap_md5
'CgIBDAUFBA4NBAsCCA0FBw=='
>>>

顺便说下,一个 single sign-on 的系统设计还真麻烦。要实现一个password同步、LDAP认证,AuthSub,等等,ho~~~累!

OneNote 2007命令行启动参数一览

2008年01月11日,星期五

来源:Microsoft Office Online

OneNote是我用过最爽的Office组件之一,也是我舍不得放弃盗版Windows平台的原因之一。

Switch Description
"filename" Opens a file, where filename is a fully qualified file
name, including the disk and folder path and .one file name
extension.
/new "filename" Creates a new section, called New Section 1, in the default
notebook folder (for example, OneNote Notebooks). The filename
parameter must include the disk and folder path and a unique file
name with the .one file name extension. If the specified file name
already exists in the target folder, the number in the section name
is increased incrementally (for example, if New Section 1 was the
specified file name but the file already existed, a file named New
Section 2 would be created).
/newfromexisting "folder" "filename" Copies the file that is specified by the filename
parameter to the folder that is specified by the folder
parameter. When executed, this command-line switch opens the
Save As dialog box to allow file renaming. To save
without renaming the file, click Save.
/import "filename" Imports data from an XML file specified by the filename
parameter into OneNote. This command-line switch supports the
OneNote 2003 SimpleImporter XML as well as OneNote 2007 XML. For
more information about the required format of supported XML files,
visit the

Microsoft Developer Network (MSDN)
.
/paste Pastes the contents of the Clipboard.
/notebookpath "path" Overrides the default path to the OneNote Notebooks folder that
is specified in Filing Rules (Options
dialog box, Tools menu).
/backuppath "path" Overrides the default path to the OneNote backup folder that is
specified in Filing Rules (Options
dialog box, Tools menu).
/openro "filename" Opens a file as read-only, where filename is a fully
qualified file name, including the disk and folder path and .one
file name extension.
/print "filename" Prints a file, where filename is a fully qualified file
name, including the disk and folder path and .one file name
extension.
/sidenote Starts OneNote in a miniature window and opens the Unfiled Notes
notebook section. If this section does not exist in the current
notebook, it will be created.
/audionote Starts recording audio on the current page.
/videonote Starts recording video on the current page. If, in a previous
OneNote session, no video capture device was specified, the
computer's default video capture device will be used.
/pauserecording Pauses audio or video recording. When executed, this
command-line switch does not start a new instance of OneNote; it
merely pauses an active recording session. A paused recording can be
resumed by executing /pauserecording a second time.
/stoprecording Stops recording audio or video. When executed, this command-line
switch does not start a new instance of OneNote; it merely stops an
active recording session.
/startsharing "password" "filename" Starts a live sharing session from for the OneNote section file
specified, where filename is a fully qualified file name,
including the disk and folder path and .one file name extension. The
page that was last selected in the OneNote section file will be used
as the shared page. Specify any text string for the password
parameter. Do not use the same password that you use to log on to
your computer or any other personal passwords that you use to access
your personal information.
/joinsharing "server" "password" "filename" Joins a live sharing session, where server is the IP
address or the domain name of the computer that is hosting the live
sharing session. For the password parameter, use the password
that was provided by the person hosting the session. Filename
is the name of the OneNote section file from which the page is being
shared.
/hyperlink "pagetarget" Starts OneNote and opens the page specified by the pagetarget
parameter. To obtain the hyperlink for any page in a OneNote
notebook, right-click its page tab and then click Copy
Hyperlink to this Page
.
/safeboot Starts OneNote in Safe Mode. A dialog box with boot options is
displayed.
/stationerytaskpane Displays the Templates task pane.
/applystationery "template" Applies the specified template file to the current page.
/sendto "filename1" "filename2" Inserts the contents of the files specified by the filename1
and filename2 parameters on the current page.
/insertdoc "filename" "time" Inserts the contents of the file specified by the filename
parameter as a printout on the current page and adds a time stamp
with the time specified by the optional time parameter.

大家知道OneNote有个托盘图标,单击这个图标可以新建一个便签,但事实上我不想新建而是在一个专门的临时页面写点东西,所以可以这样建立个快捷方式:
D:\Program Files\Microsoft Office\Office12\OneNote.exe /sidenote /paste /hyperlink onenote:///E:\OneNote\est的私人笔记本\杂项.one#未归档&section-id={34E79F40-C6A5-4376-B2F6-2DB9CB8AF64E}&page-id={5048A481-50AA-4135-94F6-081F2533F2DB}&object-id={256B54C6-4F1C-41B6-A78B-8778EEF8680D}

这条命令可以直接定位到我的一个笔记本,而不是新建一个临时页面。把这个命令加入Hoekey,就可以不要OneNote托盘图标了,嘎嘎~

一种新的密码输入方式:击键力学

2008年01月11日,星期五

腾讯QQ处理盗号都是通过很龌龊的驱动的之类的截获键盘输入,从而防止盗号记录键盘之类的木马,IBM这一期的DeveloperWorks发表了一篇很新颖的文章:通过击键力学判断输入密码的是否是原始用户。

http://www.ibm.com/developerworks/cn/opensource/os-keystroke/index.html

忽略输入的具体数据,仅测量输入总时间并检验击键之间的间隔时间有助于对用户进行身份验证。在密码中使用不可打印的字符(例如后退和回车)可以实现更高级别的密码模糊度(password obfuscation)。了解如何在击键力学中应用开源工具 xev 和 Perl 来测量更微妙的人机交互特性。
指尖上的螺纹和脊状纹路可以根据您触摸的物体来识别您。触摸方法,尤其是键入方法,同行为一样具有惟一性。击键力学是一个相对较新的领域,这项技术可以通过分析键入方式的统计信息来识别个人。许多商业产品通过分析密码输入的力度以及连续键入监视增强安全性。本文将使用示例代码来演示击键力学如何在验证及连续数据输入环境中增强应用程序安全性。

我觉得深有同感,每个人输入密码都是及其熟练的,那么这种熟练程度长期以来一定是固定的,那么我们可以根据密码输入的力度、时延等等特性做出统计分析,只有真正的用户输入正确的密码,以及正确的方式输入密码,符合统计规律,才能登入系统,呵呵

规定,龟腚~~~

2008年01月11日,星期五

1.乌龟的屁股 谜底:规定 ;
2.乌龟倒立 谜底:上面有规定;
3.乌龟翻筋斗 谜底:一个又一个规定;
4.大乌龟背上背个小乌龟 谜底:上面又有新规定

cnBeta的爆笑评论 http://www.cnbeta.com/articles/46902.htm

ps ImageXtender是个很不错的东西说~~

100条最有趣的格言

2008年01月9日,星期三

1. The only thing that interferes with my learning is my education.

2. As far as the laws of mathematics refer to reality, they
are not certain; as far as they are certain, they do not refer to reality.

3. Common sense is the collection of prejudices acquired by
age eighteen.

4. The release of atomic energy has not created a new problem.
It has merely made more urgent the necessity of solving an existing one.

5. If you are out to describe the truth, leave elegance to the
tailor.

6. I know not with what weapons World War III will be fought,
but World War IV will be fought with sticks and stones.

Fredrick Nietzsche Quotes

7. In the beginning was nonsense, and the nonsense was with
God, and the nonsense was God.

8. A casual stroll through a lunatic asylum shows that faith
does not prove anything.

9. Ah, women. They make the highs higher
and the lows more frequent.

10. Is man one of God’s blunders? Or is God
one of man’s blunders?

11. Many are stubborn in pursuit of the path
they have chosen, few in pursuit of the goal.

Mark Twain Quotes

12. Be careful about reading health books. You may die of a
misprint.

13. Don’t go around saying the world owes you a living. The
world owes you nothing. It was here first.

14. I didn’t attend the funeral, but I sent a nice letter saying
that I approved of it.

15. I have never let my schooling interfere with my education.

16. The man who doesn’t read good books has no advantage over
the man who can’t read them.

17. “Why do you sit there looking like an envelope without any
address on it?”

Voltaire Quotes

18.
Prejudices are what fools use for reason.

19. If there were no God, it would have been necessary to invent
him.

20. Every man is guilty of all the good he didn’t do.

21. No snowflake in an avalanche ever feels responsible.

22. The true triumph of reason is that it enables us to get
along with those who do not possess it.

23. It is hard to free fools from the chains they revere.

24. There are men who can think no deeper than a fact.

25. Anyone who has the power to make you believe absurdities
has the power to make you commit injustices.

26. Anything too stupid to be said is sung.

27. By appreciation, we make excellence in others our own property.

28. Governments need to have both shepherds and butchers.

Plato Quotes

29. One of the penalties for refusing to participate in politics
is that you end up being governed by your inferiors.

30. No one ever teaches well who wants to teach, or governs
well who wants to govern.

31. This City is what it is because our citizens are what they
are.

32. Courage is knowing what not to fear.

33. The measure of a man is what he does with power.

Winston Churchill Quotes

34. A lie gets halfway around the world before the truth has
a chance to get its pants on.

35. If you are going through hell, keep going.

36. The best argument against democracy is a five-minute conversation
with the average voter.

37. It has been said that democracy is the
worst form of government except all the others that have been tried.

George Carlin Quotes

38. Think of how stupid the average person is, and realize half
of them are stupider than that.

39. A house is just a place to keep your stuff while you go
out and get more stuff.

40. Religion has convinced people that there’s an invisible
man…living in the sky, who watches everything you do every minute of every day.
And the invisible man has a list of ten specific things he doesn’t want you to do.
And if you do any of these things, he will send you to a special place, of burning
and fire and smoke and torture and anguish for you to live forever, and suffer and
burn and scream until the end of time. But he loves you. He loves you and he needs
money.

41. You know the good part about all those executions in Texas?
Fewer Texans.

42. Reminds me of something my third-grade teacher said to us.
She said, “You show me a tropical fruit and I’ll show you a cocksucker from Guatemala.”

43. I never fucked a ten, but one night, I fucked five twos.

44. What year did Jesus think it was?

45. The real reason that we can’t have the Ten Commandments
in a courthouse: You cannot post “Thou shalt not steal,” “Thou shalt not commit
adultery,” and “Thou shalt not lie” in a building full of lawyers, judges, and politicians.
It creates a hostile work environment.

46. Atheism is a non-prophet organization.

47. “No comment” is a comment.

48. If a man smiles all the time, he’s probably selling something
that doesn’t work.

49. The reason they call it the American Dream is because you
have to be asleep to believe it.

Steve Martin Quotes

50. Boy, those French: They have a different word for everything!

51. There is one thing I would break up over, and that is if
she caught me with another woman. I won’t stand for that.

52. Hosting the Oscars is much like making love to a woman.
It’s something I only get to do when Billy Crystal is out of town.

53. I believe that sex is one of the most beautiful, natural,
wholesome things that money can buy.

54. You know what your problem is, it’s that you haven’t seen
enough movies - all of life’s riddles are answered in the movies.

55. First the doctor told me the good news: I was going to have
a disease named after me.

56. Why is it we don’t always recognize the moment when love
begins, but we always know when it ends?
* As Harris K. Telemacher in “L.A. Story” (1991)

Steven Colbert Quotes

57. “To sit here at the same table with my hero, George W. Bush…I
feel like I’m dreaming. Somebody pinch me. You now what, I’m a pretty sound sleeper,
that may not be enough…Somebody shoot me in the face.”
-Roasting Bush at the 2006 White House Correspondents’ dinner

58. On this show, your voice will be heard - in the form of
my voice.

59. There’s a phrase we live by in America: “In God We Trust”.
It’s right there where Jesus would want it: on our money.

60. Folks, the President needs a break. He’s like a Black and
Decker cordless Dirt Devil vacuum. If you don’t recharge his batteries, he can’t
suck.

61. I’ve always been a big fan of beauty. Sure, you can’t judge
a book by its cover but who wants to have sex with a book?

62. Now, I don’t see color. People tell me I’m white and I believe
them because police officers call me “sir”.

63. Asia: Four little letters, three billion little people.

64. “There’s nothing wrong with being gay. I have plenty of
friends that are going to hell.”

65. Jesus forgives sinners, not criminals.

Jon Stewart Quotes

66. I celebrated Thanksgiving in an old-fashioned way. I invited
everyone in my neighborhood to my house, we had an enormous feast, and then I killed
them and took their land.

67. Insomnia is my greatest inspiration.

68. We have it. The smoking gun. The evidence. The potential
weapon of mass destruction we have been looking for as our pretext of invading Iraq.
There’s just one problem - it’s in North Korea.

69. We declared war on terror—it’s not even a noun, so, good
luck.

70. Here’s how bizarre the war is that we’re in in Iraq, and
we should have known this right from the get-go: When we first went into Iraq, Germany
didn’t want to go. Germany. The Michael Jordan of war took a pass.
Jon Stewart’s Stand-up performance at RIT, 2005

Bill Maher Quotes

71. Everything that used to be a sin is now a disease.

72. I think flying planes into a building was a faith-based
initiative. I think religion is a neurological disorder.

73. Religion, to me, is a bureaucracy between man and God that
I don’t need.

74. They’re talking about banning cigarette smoking now in any
place that’s used by ten or more people in a week,
which, I guess, means that Madonna can’t even smoke in bed.

Jerry Seinfeld Quotes

75. Men want the same thing from their underwear that they want
from women: a little
bit of support, and a little bit of freedom.

76. Dogs are the leaders of the planet. If you see two life
forms, one of them’s making a poop, the other one’s carrying it for him, who would
you assume is in charge.

77. There’s very little advice in men’s magazines, because men
don’t think there’s a lot they don’t know. Women do. Women want to learn. Men think,
“I know what I’m doing, just show me somebody naked.”

78. Why do people give each other flowers? To celebrate various
important occasions, they’re killing living creatures? Why restrict it to plants?
“Sweetheart, let’s make up. Have this deceased squirrel.”

Larry David Quotes


79. Anyone can be confident with a full head of hair. But a
confident bald man - there’s your diamond in the rough.

80. If you tell the truth about how you’re feeling, it becomes
funny.

81. I’m surprized Hitler didn’t round up the toupee people.”

Dennis Miller Quotes

82.
A recent police study found that you’re much more likely to get shot by
a fat cop if you run.

83. The average American’s day planner has fewer holes in it
than Ray Charles’s dart board.

84. “The only way the French are going in is if we tell them
we found truffles in Iraq.”

Jay Leno Quotes

85. Here’s something to think about: How come you never see
a headline like ‘Psychic Wins Lottery’?

86. The Supreme Court has ruled that they cannot have a nativity
scene in Washington, D.C. This wasn’t for any religious reasons. They couldn’t find
three wise men and a virgin.

87. Now there are more overweight people in America than average-weight
people. So overweight people are now average. Which means you’ve met your New Year’s
resolution.

88. The New England Journal of Medicine reports that 9 out of
10 doctors agree that 1 out of 10 doctors is an idiot.

Rodney Dangerfield Quotes

89. My father carries around the picture of the kid who came
with his wallet.

90. Oh, when I was a kid in show business I was poor. I used
to go to orgies to eat the grapes.

91. I’m at the age where I want two girls. In case I fall asleep
they will have someone to talk to.

92. A girl phoned me and said, “Come on over. There’s nobody
home.” I went over. Nobody was home!

93. Bisexuality immediately doubles your chances for a date
on Saturday night.


Sarah Silverman Quotes

94. When God gives you AIDS - and God does give you AIDS, by
the way - make lemonAIDS.

95. I was raped by a doctor. Which is, you know, so bittersweet
for a Jewish girl.

Chris Rock Quotes

96. Every town has the same two malls: the one white people
go to and the one white people used to go to.

97. I live in a neighborhood so bad that you can get shot while
getting shot.

98. If a woman tells you she’s twenty and looks sixteen, she’s
twelve. If she tells you she’s twenty-six and looks twenty-six, she’s damn near
fourty.

99. “You know the world is going crazy when the best rapper
is a white guy, the best golfer is a black guy, the tallest guy in the NBA is Chinese,
the Swiss hold the America’s Cup, France is accusing the U.S. of arrogance, Germany
doesn’t want to
go to war, and the three most powerful men in America are named ‘Bush’, ‘Dick’,
and ‘Colon.’ Need I say more?”

100. “You won’t be able to take your eyes off the next four
presenters: Salma Hayek and Penelope Cruz.”
Chris Rock while hosting the Oscars

101. Gas is getting so expensive I’m gonna ride a mexican to
work.

pkgmgr - Vista下命令行软件包管理工具

2008年01月7日,星期一

vista默认安装没有telnet命令行工具:

命令行执行:start /w pkgmgr /iu:"TelnetClient"
或者

Control Panel, Programs, and then Turn Windows Features on or off. In the list, scroll down and select Telnet Client. Click OK to start the installation.

参考:
TechNet参考

Vista包管理器概述

用pkgmgr安装IIS7

【图】当岁月逐渐腐蚀了我们的软件……

2008年01月7日,星期一

3.jpg

原来GMA950集成显卡也有性能提升的余地的

2008年01月7日,星期一

好吧,我承认我火星。如果你是用的笔记本,显卡是Intel 945芯片集成的GMA 950的话,那么可以通过这个方式无损提升显卡性能50%以上:
首先安装好最新的Intel显卡驱动
开始 运行 igfxcfg
点击 显示设置 电源设置
拖到最高质量
11.jpg

我是不是有点火星??通过这个方法我成功的将CS 1.5的FPS从30提升到89,嘿嘿

dbus-python for Windows

2008年01月7日,星期一
ActivePython 2.5.1.1 (ActiveState Software Inc.) based on
Python 2.5.1 (r251:54863, May  1 2007, 17:47:05) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import dbus
>>> dbus
<module 'dbus' from 'C:\Python25\lib\dbus\__init__.pyc'>
>>>

成功!
把文件解压到 C:\Python25\lib\dbus\

dbus是个消息系统,dbus-python下载在这里。里面的dbus-bindings不是我编译的,是一个老外编译好的 http://www.slurdge.org/comment/reply/42

下载:dbus.rar