March 31, 2008
秃瓢
| 之前 | 之后 |
![]() |
![]() |
没哭,非常配合,完全出乎爸爸和姥姥的预料。不过也说明爸爸手艺高超。
嘿嘿,既然给我剃了个少林寺头,那我就练个无影手。

Filed by
charlie
at 2:10 pm under Life
No Comments
| 之前 | 之后 |
![]() |
![]() |
没哭,非常配合,完全出乎爸爸和姥姥的预料。不过也说明爸爸手艺高超。
嘿嘿,既然给我剃了个少林寺头,那我就练个无影手。

Filed by
charlie
at 2:10 pm under Life
No Comments
MS Access is wildly used, easily available and almost the most user friendly database product. I know many stuffs are working on MS Excel for compound information management and there exists such commercial solutions, the reasons coincide.
The solution described here is for
SDF files are downloaded directly from Pubchem ftp, it’s free and public.
As the structure description part (mol file) exists inside each compound, it’s not easy to parse the SDF file to csv and other table based format. I write a simple Python script to transform SDF file to Access accepted XML file. You can create a desired table in Access database and export it to XML format to get the XML template.
When data are ready, just run import command from Access.
You can also try RDkit to manipuate SDF and structure information in Python, it’s professional.
When transforming SDF file with Python, some further more actions be taken to generate BMP structure pictures.
Use Molconvert to convert the mol file into PNG format
os.system( “molconvert png %s/%s.mol -o %s/%s.png” %(folder, molid, folder, molid) )
Use PIL to convert PNG to BMP
Image.open( “%s/%s.png”%(folder, molid)).save(”%s/%s.bmp”%(folder,molid))
BMP pictures are needed because native Access only accepts BMP picture as OLE object and displayed on form control.
Public Sub load_img()
Me.Recordset.MoveFirst
While Not Me.Recordset.EOF
Me.pic.OLETypeAllowed = acOLELinked
Me.pic.SourceDoc = CurrentProject.Path & “img” & Me.cid & “.bmp”
Me.pic.Action = acOLECreateLink
Me.pic.SizeMode = acOLESizeStretch
Me.Recordset.MoveNext
Wend
End Sub
JME is a java package and I don’t know any way to combine it with Access directly. So an webcontrol is introduced to the Access form and JME embedded on the source page of the webcontrol. The dom object visit is more simple than I had imaged.
mol = Me.WebBrowser2.Document.applets.Item(0).MolFile()
This is truely the key technic of the solution. It is powered by opensourced checkmol/machmol. Acturally, just after read the usage part of source code of its dll version, I begun to think about to do something on Access. Access database uses JETSQL engine, it’s not as powerful as T-SQL, but it supports VBA functions. VBA code can easily visit exernal dll function, so JETSQL could be extended greatly.
So, the sturcture search code is really simple
select * from sample_data where MatchMol(query_mol, mol) > 0
MatchMol function is pre-defined by dll apis of checkmol/matchmol.
Code copied from MATCHMOLDLL.pas
——————————————————————————–
Private Declare Sub mm_SetMol Lib “matchmolDLL.dll” (ByVal st As String)
Private Declare Sub mm_SetCurrentMolAsQuery Lib “matchmolDLL.dll” ()
Private Declare Function mm_Match Lib “matchmolDLL.dll” (ByVal Exact As Boolean) As Long
Private Declare Function mm_GetRings Lib “matchmolDLL.dll” () As Long
Private Declare Function mm_GetAtomRing Lib “matchmolDLL.dll” (ByVal AtomNumber As Long) As Long
Private Declare Sub mm_Version Lib “matchmolDLL.dll” (ByVal st As String)
Public Function MatchMol(Needle As String, Haystack As String, Optional ExactMatch As Boolean = False) As Boolean
Static oldNeedle As String
If oldNeedle <> Needle Then
oldNeedle = Needle
mm_SetMol Needle
mm_SetCurrentMolAsQuery
End If
mm_SetMol Haystack
If mm_Match(ExactMatch) <> 0 Then MatchMol = True
End Function
——————————————————————————–
As a small database, there are about 2700 compounds are imported.
Such Access DB can NOT serves for Asp.net or other applications connect through ODBC/DAO, for “ODBC and DAO do not use or know anything about the code modules inserted into an .mdb file by Access. Only Access recognizes the modules. ” announced by MSDN KB [Q166113] You cannot use user-defined modules through ODBC or DAO.
Filed by
charlie
at 11:29 pm under MS_ACCESS, chemoinformatics
3 Comments
windows search以前叫msn desktop。自打vista,微软就很重视桌面搜索了。与之对应的更著名的桌面搜索软件是google desktop,实际上后者也更强大,更开放(windows search也是通过ifilter开放的)。
其实windows内置的搜索,很早很早以前就有了,叫index service。index service/ msn desktop/ vista/ windows search这一系列产品,貌似都是同样的技术基础。但是一个产品定位总是不准,形象一直变化,就显得不那么高档。这一点上来说,微软的市场能力还真不一定就比google强。
着两种桌面搜索产品以前都用过。说不上什么确切的理由,但是比较自然地用windows search替换了GDS。windows search在使用上,的确更贴近普通用户。贴两张图吧。
Filed by
charlie
at 9:29 pm under Tools
No Comments
实际上对.Net中的“委托(delegate)”的概念并不很懂。如果仅理解成自定义事件的话,在Access中也可以部分实现。
窗体2中的自定义事件FireFromF2被窗体1捕获处理,参数被传递。用法很简单,注意WithEvents关键字的使用。
上面的例子要求先f2开启状态下再打开f1才能成功注册事件(原因见最后的总结)。如果是子窗体的事件,就简单一些,应用更常见。
总结
Filed by
charlie
at 11:16 pm under Coding, MS_ACCESS
1 Comment
花了两天时间,搭建起了这个del.icio.us自定义搜索引擎,可以在自己del.icio.us书签的某个tag的站点中进行搜索。比如直接在job的tag下去搜已经收集好的51job/chinahr等站点。
需要输入del.icio.us的用户名和密码。我只能口头保证不窥探保存你的密码,使用前还请谨慎。因为不保存用户名和密码信息,所以cse的站点定义不会随着del.icio.us的书签更新而更新。需要更新的话,不妨再次访问这个程序。
调用了del.icio.us的api,但是不能频繁访问,否则就会摔过来503。
zooie早就做过相同的工作,提供的功能也更复杂。我的这个程序使用了google cse比较新的Linked CSEs,一来不必操作annotations xml文件;二来可以生成一段代码嵌到你需要的页面中。
相关的一些文档和链接
Filed by
charlie
at 10:46 pm under Engineer, webdev
No Comments
很多人都听说了双卡单待、支持存储卡、蓝牙、可更换电池的iphone克隆版HiPhone。我也感到很振奋。再到山寨机的专门网站去看过,心中的激动无法表达。上一次有这种兴奋感觉的时候,实在一位老人的生日宴会上看到那个凝聚民族智慧的可以喷火放音乐的生日蜡烛。中国不强大起来的唯一可能就是地球爆炸了。我很有幸生活在这个见证年代。当然也很荣幸参与过类山寨机的开发工作。
推荐这篇文章,再转几张图





Filed by
charlie
at 1:44 pm under Life, 不以物喜
No Comments
看了一遍电影“一年到头”,直到结尾“蓝莲花”的歌声里,湿润了。参与、咒骂春运的人很多,批判中国人这种习惯的人也不少。这种每年一次全国性的声势浩大的运动,绝对是让人感到震撼的。驱动这场运动的巨大力量,是中国人的传统和情感,更令人震撼和感动。
今年过年留在了北京,家人也都到这边团聚。年快过完了,却被这个电影又勾起来那种情绪,那种十年来每年春节前走出南门,坐375路到西直门倒地铁,北京站上车之后一夜的困倦、疲劳和急切。这种情绪在心里的烙印太深了。直到现在,半夜儿子把我和媳妇哭醒,看看表,互相很熟悉地嘟囔一声,“到沈阳了”。如果让我写一下记忆里过年最幸福的时刻,就是每次火车渐慢,红日东升,看到“工大集团”的牛逼大牌子,看到安发桥旁的烂尾楼,耳边回荡起王杰的“回家”,心里激动到湿润,恨不得跟火车司机喊一声“师傅踩一脚,我就这儿下了”。
类似的湿润还于观看动物世界里的角马迁徙、大马哈鱼产卵时… 其实配乐也可以用蓝莲花,“没有什么能够阻挡… …”
这段视频忍不住截下来了,放在了Youtube上。
Filed by
charlie
at 11:45 am under Life
No Comments
可以用于谷歌输入法的词典文件,包含大量中文化学词汇,多为化合物名称。词库容量很大,有15976条化合物名称中文词汇;包括各种多音字拼写(也包括拼错的)共有拼音条目6万余条。比较搜狗拼音化学词汇大全【官方推荐】的一千多条的量要大多了。
作者 zh.charlie@gmail.com
在谷歌拼音输入法的“属性设置”中导入
化合物中文名称,从Chemblink.com网站上采样获得。
词汇提取程序使用Python编写。其中,从unicode字符串中提取汉字的正则表达式:
ur'([\u4e00-\u9fa5]+)'
汉字到拼音的转换程序,使用了roy在水木上贴的python代码和数据库。
谷歌拼音输入法的词典格式和分析方法,在前一篇中有所介绍。
随便用。随意转载、修改、使用,不必注明原作者。对词典的正确性、全面性作者无法保证和负责。
google.pinyin.dict.for.chemists.zip
Filed by
charlie
at 7:33 am under Python, Tools, chemoinformatics
No Comments