昨天,今天,明天,每天的每天,你是否都多懂得一点点...

星期四, 十二月 10, 2009

Ramdisk

This tool is cool

Create a virtual hard drive. 

Choose fixed media.

Then convert to ntfs

convert r: /fs:ntfs

then

rdutil link c:\ramdisk 

link c:\ramdisk to the root of r drive

or 
rdutil link c:\temp\abc TEMP\abc

link c:\temp\abc to the temp\abc of r drive.

I tried system internal junctin.exe command, it cannot link to the ramdisk, but can link the other way.

--
Feng

星期五, 十二月 04, 2009

MICROSOFT 多媒体键盘设置千千静听

默认启动的是WMP,这个不用说了。 比罗技设起来方便, 罗技要去改player.ini文件增加千千静听的支持,我试了,居然没有成功。

而微软的键盘就没办法增加千千静听的支持,但是可以把多媒体键MAP 到其它组合键 ,其实罗技也可以(但不支持多媒体播放键, 支持其它一些键)。 

所以,只要把千千静听的全局快捷键打开,设个特别复杂的组合, 然后,再在键盘设置里面找到从列表中选择,双击键入,然后MAP过去就可以了。

罗技就不知道怎么搞咯。

--
Feng

星期四, 十一月 19, 2009

手机保密码

诺基亚3310,坏的了手机(电池只能用几分钟)刚才又拿来用,居然问我手机保密码。。。不懂是什么。。。
 
最后,上网查了下,原来可以算出个万能码
 
 


--
Feng

星期三, 十一月 18, 2009

System.SecurityException with network drive

I put my vs2005 project files in a network drive (mounted by net use command). Then I encounter a problem of security exception. Visual studio gave me a security warning when I opened the project. It also brought trouble when I was trying to debug (F5).
 
The solution for this is adding the network drive as a trusted location.
 
caspol -m -ag 1 -url file://H:\* FullTrust
 
You may need to open Visual Studio 2005 Command Prompt to execute this command, otherwise, caspol may not be found.
 

--
Feng

foxit brings ask.com

if you install foxit pdf reader, you have a chance to install ask.com toolbar. If you install ask.com toolbar, you will be able to use some extra functionalities beyond free version. But, the truth is that, you still get watermark.... It means that you don't get anything by  installing the annoy toolbar.
 
What is worse? Once you uninstall the toolbar, you browser's search string is still hooked. If you put a incomplete url such as: doc.google.com, you will be redirected to ask.com. That's not what you want right? I hate this. What I did is use hijackthis to unhook it. Used unlocker to release the handers and delete the ask.com dll file in the program files folder (it didn't leave with the uninstallation, what the!!)

--
Feng

星期三, 十一月 11, 2009

XPATH 和 xslpattern

上班几个月了,才发现公司里没人使用xpath, 而经过实验,xpath是完全可以使用的。。。绝不会带来任何麻烦,而且效率要高得多。原因是公司里的人都对XPATH了解不多。都是用 dom 的 getElementByTagName, nextSibling 这些Dom methods 来 navigate dom object. 当然,他们写了很多function, 结合regular expression, 也能相当快的找到要找到NODE. 但比起xpath来,显得低效,而且繁锁。

昨天发现Xpath本来就是被 xmldom 所支持的,使用它并不会对我们的程序有什么影响,今天便试了下。

真的方便很多,可是却好像有些函数使用不了。比如 matches, contains等。试了几次都不行,觉得奇怪。搜索了好久,好发现要加这句

objTP.SetProperty "SelectionLanguage", "XPath"

神了,用了这句, matches可以用了。。。但是, 原来写好的xpath都不起作用了。。。晕。。。

于是,我想,既然现在把 SelectionLanguage 设成了XPath, 而且原来写的xpath 反而不能用了,那原来用的肯定不是xpath. 既然有setProperty, 一定也有 getProperty, 于是, 我便 wsh.echo objTP.GetProperty "SelectionLanguage", 于是,我发现,原来使用的并不是xpath, 而是一种叫 xslpattern 的东西。只不过它的写法几乎和 xPath一模一样。 只不过它并不支持 Xpath的函数。 这就是为什么我用不了 xPath函数的原因。 

只是设成Xpath后,我原来写的pattern居然无效了。。。很奇怪。。。

于是我突然觉得xPath很复杂, 还是 xslpattern好些, 便拼命的在网上搜索关于 xslpattern 的东西, 希望能找到它的文档, 希望它也有类似matches的函数。在网上找了半天,发现关于它的东西实在太少了。不好最好我好像还是找到了。。。


不过,我同时找到了为什么用XPath反而不工作的原因。

问题就出在name space, 我想很多朋友都被这个xmlns 困惑过。 因为有了 xmlns 这个attribute后,我们就不能原来那样用xpath了。而是要先定义一个 name space.

objTP.SetProperty "SelectionNamespaces", "xmlns:cf=""http://www.w3.org/1999/xhtml"""

定义过name space 后, 在 xpath query 里面,还得用上它。

for each objTagDiv in objTP.selectNodes(".//cf:div[@id='TopMenu']")

原来只要写 //div 就可以,现在却要写 //cf:div 了,而且每个child node 都得加了 cf: 在前面, 实在麻烦。

而 xslpattern却没有这个麻烦,它跟本不认识 xmlns. 

但它毕竟是过时的东西了,我不能背着时代的潮流走,所以我还得在xpath上下点工夫。

呵呵,不过我有更邪恶的方法,我打算在loadXML之前, 把 xmlns这个attribute 删掉。那就无后顾之忧了。

--
Feng

星期五, 十一月 06, 2009

X-MicrosoftAjax and ctl00%24ScriptManager1

For some .Net websites, if you don't provide following line in the request header

X-MicrosoftAjax: Delta=true

You don't need to provide ctl00%24ScriptManager1 either. (only eventtarget and viewstate)

But in this way, the return content will be the whole page. 

If you provide Both of them,the return content will be feed in a tag by javascript, this will save quite a lot of traffic.



--
Feng

星期四, 十月 29, 2009

5800 sd 卡空了

昨天装了几个游戏,特别是装了个开心听的音乐软件,软件是不错,会自动下载歌词,还可以下载歌曲,应该和酷狗是一类的。就是太占资源了,打开后,手机卡得要命。也不懂怎么玩的,后来SD卡里啥也没有了,空空一片。。。。晕。。。。

不知道是什么原因,很可能是我从大容量储存切换到PC套件模式的时候没有从电脑上先弹出。 

我第一个反应是,手机认为我还是在大容量储存模式,所以我没办法使用储存卡的东西。 于是我便关机,重启。。。问题一样, 这时候,我才想到可能是SD卡出问题了。接上电脑,果然,里面白白一片呀。啥也没有。 

再关机,把卡拨出,再插上。。。一样,只不过手机自动生成了一些必要的文件夹。

没办法,估计是传说中的分区表坏了,正好在DOSPY看到一款诺顿磁盘医生,我想它应该可以修复分区表。就下载来用了下,哇,用完后分区表没有回来,而是出现了一个FOUND.000文件夹。这个好像和CHKDSK的作用相当。。。

于是又试了DISKGENIUS, 没有办法找到原来的分区表。找来找去都是现在的样子。 想找找有什么文件索引恢复工具,发现好像对硬盘还是不太了解。。。最后不了了之。只好格了。。。当然,在这之前,我已经用PowerDataRecovery 恢复了大部分文件。但是软件还是要重新装过。。。累呀。。。只有一个搜狗输入法还在,默认安在C盘的。

刚才装了handyshell, 装的时候说已存在,覆盖安装。 装好后,不需要输入序列号。。。

然后,发现MAIL FOR EXCHANGE和自带的同步的设定都还在。

继续装。。。还有好多东西要装。。。GARMIN,字典,计算器,秒表。。。

--
Feng

星期三, 十月 14, 2009

Dom class attribute

class is not really a attribute, that's why we cannot get it by using GetAttribute() method. 

The only reason of using class is applying css to a dom object. How about style attribute and id attribute?

Id should be a real attribute although it can be used to apply css. It's a identify of a dom object. we can use GetElementByID to get a dom object. 

We can use style= to specify css for dom objects. style may not be a real attribute either. 

All by guessing :)

--
Feng

IE class attribute

For IE dom, to get the value of class attribute, the correct way is:

objTag.className

But not objTag.class

This is different from objTagA.href. 

IE also supports GetAttribute method. But this method has difference between different version of IE. (versions below IE7 are not supported.)

--
Feng

星期五, 九月 25, 2009

vim 设置BOM 头

原来如此简单

set fenc=utf-8 bomb

只是在设置FENC 的时候, 后面要加个BOMB, 告诉VIM 要加BOM 头

--
Feng

星期日, 九月 20, 2009

vbs get shell output

Option Explicit

Dim oShell, oExec, sLine

dim url
url = "http://www.tek-tips.com/viewthread.cfm?qid=1520693&page=20"
Set oShell = CreateObject("WScript.Shell")
'Set oExec = oShell.Exec("%COMSPEC% /c md5 ""-d" & url & """")
Set oExec = oShell.Exec("md5 ""-d" & url & """")

Do While oExec.Status = 1
WScript.Sleep 50
Loop

Do Until oExec.StdOut.AtEndOfStream
sLine = oExec.StdOut.ReadLine
Loop
WScript.Echo sLine


--
Feng

MD5 Message Digest Utility

http://www.fourmilab.ch/md5/

support encoding string.

--
Feng

星期六, 九月 12, 2009

东西与物事

东西为什么叫东西?

A:我和她已经各分东西了。
B:哦?那你分到了什么东西?
A:一幢房子,一千万美元,还有一个女儿。

看来,东西,不仅可以是物事,更可以是钱,甚至可以是人。

--
feng
this is a mail posted via mutt+msmstp.
Sat Sep 12 12:58:35 NZST 2009

星期四, 九月 10, 2009

vim silent run

Don't ask me to press any key!!!


:silent !dir & pause
--
Feng

Re: redirect vim command output

...or fixed it...
On 9/10/09, feng <fengnz@gmail.com> wrote:
> :redir > log.txt
> :ls
> :redir end
> :e log.txt
> --
>
> Feng
>


--
Feng

redirect vim command output

:redir log.txt
:ls
:redir end
:e log.txt
--
Feng

http header vim syntax

syntax match header /^\p\{-}:.*/ contains=header_name contains=header_value
syntax match header_name /^\p\{-}:/ contained
syntax match header_value /:\@<=.*/ contained
syntax match method /\c^get.*\|^post.*/
syntax match direction /^+++.*/
syntax match status /\c^http.*/

"syntax match num /\d*/ contained

highlight link header_name Statement
highlight link header function
highlight link method include
highlight link direction type
highlight link status lcursor
"highlight link deep_link underlined

--
Feng

星期五, 九月 04, 2009

C# window location

Before setting Form.Location, you have to set the Property StartPostion to Manual.

--
Feng

星期二, 九月 01, 2009

VIM syntax

syntax match wine_name /^[^|]\+/ 
syntax match add_desc /\(^[^|]*|\)\@<=[^|]\+/ contains=num
syntax match vintage /\(^[^|]*|[^|]*|\)\@<=[^|]\+/ 
syntax match bottle_size /\(^[^|]*|[^|]*|[^|]*|\)\@<=[^|]\+/ 
syntax match price /\(^[^|]*|[^|]*|[^|]*|[^|]*|\)\@<=[^|]\+/ 
syntax match deep_link /\(^[^|]*|[^|]*|[^|]*|[^|]*|[^|]*|\)\@<=[^|]\+/ 

syntax match num /\d*/ contained

highlight link wine_name cursor 
highlight link add_desc Statement
highlight link vintage include
highlight link bottle_size function
highlight link price lcursor
highlight link deep_link underlined
存为 dat.vim 放在vimfiles\syntax目录下. 在vimrc里加入 autocmd BufRead *.dat :set ft=dat






--
Feng

其它博客地址

此博客的同步博客地址: http://fengnz.wordpress.com
这里进入我的MSN SPACE.