Friday, December 31, 2004

 

Category of TeleStar's Notes in 2004


Friday, December 24, 2004

 

Open source WebEdit

1.
FreeTextBox
The no.1 free ASP.NET HTML Editor for IE and Mozilla.
http://www.freetextbox.com/

2.
WebEditBox
http://www.webeditbox.com/

3.
FCKeditor
http://www.fckeditor.net/

4.
WordPress is a state-of-the-art semantic personal publishing platform with a focus on aesthetics, web standards, and usability. What a mouthful. WordPress is both free and priceless at the same time.
http://wordpress.org/

5.
Other Open Source WYSIWYG Through-The-Web Editors
http://www.cmsreview.com/WYSIWYG/OpenSource/Directory.html

Thursday, December 23, 2004

 

IE HTTP Tools

1.
HTTPLook is a http sniffer, which gives a complete picture of any site at work. HTTPLook can restore the data transmitted between the local computer and the server and show the control footing and contents of the captured resources.

http://www.httpsniffer.com/

2.
PowerBand是一个InternetExplorer的插件(同时也支持MyIE2/Maxthon)。提供了对HTML动态分析,跟踪,编辑的功能。能够方便快捷的分析HTML页面的结构,有助于网页设计人员/网站开发人员调试,分析晦涩的HTML代码。

http://www.stonebase.org/powerband

3.
ieHTTPHeaders
a convenient tools
http://www.blunck.info/iehttpheaders.html

4.
Internet Explorer Developer Toolbar
http://www.microsoft.com/downloads/details.aspx?FamilyID=E59C3964-672D-4511-BB3E-2D5E1DB91038&displaylang=en

5.
http://www.my-debugbar.com/wiki/IETester/HomePage
IETester is a free WebBrowser that allows you to have the rendering and javascript engines of IE8, IE7 IE 6 and IE5.5 on Vista and XP, as well as the installed IE in the same process.
(added April 5, 2009)

6.
http://livehttpheaders.mozdev.org/
LiveHTTPHeaders是FireFox下的一个插件,可以用来实时监测发起的http请求和响应,也可以修改请求参数之后重新发起请求。
(added April 15, 2009)

Wednesday, December 22, 2004

 

Open source DotNet controls

1.
MyTreeView
http://www.funkelab.com/website.aspx?objectid=1&displayid=1216
MyListView
http://www.funkelab.com/website.aspx?objectid=1&displayid=1157

2.
skmMenu
http://www.skmmenu.com/menu/

3.
dotMSN
dotMSN is a class library to make use of the MSN Messenger Service. The library is built in C# and can therefore be used by all languages the .NET environment supports. DotMSN provides an easy and consistent interface through a clean Object Oriented approach. DotMSN abstracts the low-level MSN protocol so you can quickly integrate dotMSN with your application and make direct use of MSN-connectivity. DotMSN is free and can be used in both non-commercial and commercial applications. The library can, among other things, be used for:

http://members.home.nl/b.geertsema/dotMSN/

4.
SourceGrid: C# grid control

"SourceGrid is a Windows Forms control written entirely in C#. My goal was to create a simple but flexible grid to use whenever it is necessary to visualize or to change a series of data in a table format.
There are a lot of controls of this type available, but often are expensive, difficult to customize or not compatible with .NET.
The Microsoft DataGrid for me is too DataSet orientated and therefore is often complicated to use in the cases in which the source data isn't a DataSet, and often it is not customizable enough."

http://www.devage.com/

5.
Printing in .NET

The ReportPrinting library provides a programmatic way (i.e. no visual designer) to print reports. Features include:

Printing DataTables using classes similar to the DataGridColumnStyle class for formatting (also includes header and summary rows).
Printing paragraphs of text using style classes.
Customizable page headers and footers.
Boxes, Lines, Graphics...
Thorough class documentation and completely open source (written 100% in managed C#) with examples in C# and VB.NET

http://www.mag37.com/DesktopDefault.aspx?tabid=1

Tuesday, December 21, 2004

 

Open source install projects

1.
首先,是从flier那里最先看到的这则消息,下面是他的blog

作者:flier_lu
出处:http://www.blogcn.com/user8/flier_lu/main.asp?id=1547635

MS刚刚在开源项目大本营SourceForge发布了一个开源的安装程序开发项目Windows Installer XML (WiX) toolset http://sourceforge.net/projects/wix/ ,支持使用XML格式编写MSI格式的安装程序项目。

例如一个简单的XML工程product.wxs文件

[code]
?xml version='1.0'?>
Wix xmlns='http://schemas.microsoft.com/wix/2003/01/wi'>
Product Id='000C1109-0000-0000-C000-000000000046' Name='TestAssemblyProduct' Language='1033' Version='0.0.0.0' Manufacturer='Microsoft Corporation'>
Package Id='000C1109-0000-0000-C000-000000000046' Description='Test Assembly in a Product' Comments='Test from: wix\examples\test\assembly\product.wxs' InstallerVersion='200' Compressed='yes' />

Media Id='1' Cabinet='product.cab' EmbedCab='yes' />

Directory Id='TARGETDIR' Name='SourceDir'>
Directory Id='ProgramFilesFolder' Name='PFiles'>
Directory Id='TestAssemblyProductDirectory' Name='testassm' LongName='Test Assembly'>
Component Id='TestAssemblyProductComponent' Guid='00030829-0000-0000-C000-000000000046'>
File Id='TestAssemblyProductFile' Name='assembly.dll' essembly='.net' KeyPath='yes' DiskId='1' src='http://blogs.msdn.com/$(env.WIX)/examples/data/assembly.dll'/>
/Component>
/Directory>
/Directory>
/Directory>

Feature Id='TestAssemblyProductFeature' Title='Test "ssembly Product Feature' Level='1'>
ComponentRef Id='TestAssemblyProductComponent' />
/Feature>
/Product>
/Wix>
[/code]

可以被编译、链接成一个MSI安装文件。

[code]
:\wix\examples\test\assembly> candle.exe product.wxs
Microsoft (R) Windows Installer Xml Compiler version 2.0.1510.0
Copyright (C) Microsoft Corporation 2003. All rights reserved.

product.wxs

E:\wix\examples\test\assembly> light.exe product.wixobj
Microsoft (R) Windows Installer Xml Linker version 2.0.1510.0
Copyright (C) Microsoft Corporation 2003. All rights reserved.

E:\wix\examples\test\assembly> dir

Volume in drive E is New Volume
Volume Serial Number is 8AC4-6AD2
Directory of E:\wix\examples\test\assembly

04/05/2004 05:04 DIR> .
04/05/2004 05:04 DIR> ..
02/23/2004 09:55 891 module.wxs
04/05/2004 05:04 52,736 product.msi
04/05/2004 05:04 4,976 product.wixobj
02/23/2004 09:55 1,281 product.wxs
4 File(s) 59,884 bytes
2 Dir(s) 90,014,191,616 bytes free
[/code]

此项目在MS内部的很多开发组被实际使用,如Yukon数据库, Office 12, Exchange "Kodiak," Update Services 和 Xbox divisions 等产品。

几天前我们刚说了dotNetInstaller,现在就有了这个。呵呵,最近微软公开的源代码还真多呀。那个游戏我最喜欢,可惜没时间看。接着我们来看看代码。

首先一眼看到wixcab,呵呵,cab包的用法,印象中这个应该是以前不知道而大家都想知道的。导出头如下

[code]
EXPORTS
CreateCabBegin
CreateCabAddFile
CreateCabAddFiles
CreateCabFinish
ExtractCabBegin
ExtractCab
ExtractCabFinish
[/code]

一目了然,代码也很中规中矩。

接下来是dutil目录的程序。老习惯,都是轻微封装的SDK函数加precom.h,而不象前面我们看得dotNetInstaller用MFC类。微软内部看来用MFC的人也不多,当然这也是为了开源之后,能够用GCC也能编译该代码,或者更进一步port到其它平台。不过dotNetInstaller对于VC程序员相对直接了当些。

再看个简单的,dark目录,就是后台程序。程序属性设置的相当复杂,有些命令参数我还得查看文档才能明白。然后,就是插入了wix的自定义错误处理,准备招架各种错误。其具体实现都在wix目录下面。安装程序的错误当然是千奇百怪,这里不可能一网打尽,不过常见的都列了。相对于目前的一些Installer开发软件而言,这也是很有价值的资料。

然后是wix目录。首先是Interop一些系统操作,如Cab,File,Msi等等。呵呵,这里的Msi调用方式和dotNetInstaller比较还是很有趣的。因为不知道入口点,dotNetInstaller只好shell完成各种操作,而这里好,直接找EntryPoint,Interop。到底是MS内部操作,爽。绝对是内部小秘密曝光。而且是这么的详尽细致。

Action,ActionTable是控制安装流程的。Library,Row,Column,Table是知识储存。Compiler,Linker,Decompiler是安装文件的组装和分解。其它相关的类不一而足。其实这些代码才是wix中最有价值的东西。经过修改,我们完全可以再其它地方用到类似的技术编写、储存、重放我们录制的操作。而其中的代码编写模式什么的,都值得我们学习。

Xsd表详细描述了内部机构。不错,我还没怎么涉猎这方面的东西呢。

最后是candle,lit,light三大门面的调用,这里就不赘述了。估计高人们马上就会总结的。

对了,本开源项目的文档化估计也会尽快完成的。当然,我们已经看到易用性还是很高的,自己扩展也很方便。

现在剩下的问题是如下的打包技术是如何实现的,参见
http://thinstall.com/

2.
dotNetInstaller是DevAge SOFTWARE公司 http://www.devage.com/ 推出的一个开源Install Builder软件,因为要用到其中的某些知识,所以下载下来看了看,觉得还是很不错的。

dotNetInstaller的基本结构是用MFC实现的。由于Install Builder类软件功能琐碎,所以作者Davide Icardi并没有使用类来封装那么多功能函数,而是定义了一个namespace DVLib将他们都装了进去。相应代码都在Tools目录下。这些代码都写的相当干净,调用起来很方便,我已经借用了好几个函数。

不过DownloadComponent部分进行封装了类,其基本方法就是使用URLDownloadToFile API 进行下载。相应的用法可以参见
http://msdn.microsoft.com/workshop/networking/moniker/reference/functions/urldownloadtofile.asp

http://www.codeproject.com/internet/urldownload.asp
这个函数是IE功能的一部分,有封装好的错误提示,而且可以自动进行多线程下载。我指得是多个文件一起下载的多线程,而不是一个文件多个部分一起下载的多线程。使用时用Process可以很清楚的看到这一点。对了,以前上课写Search Engine Project的时候我曾经偷懒使用这种方法来抓取网上的图片文件,结果不知为什么,下载的文件过多后机器会变得奇慢无比,也不知是不是IE的内部Cache机制的影响。所以各位请小心。
dotNetInstaller下载的都是些安装文件需要的Component,所以不用担心这一点。由于只是序贯操作,所以也无须为了多线程而编写复杂的线程排序管理代码。

其实我主要关心的还是如何安装msi文件部分。结果一看才知道原来简单之极。比如Davide Icardi给出的示例伪代码如下

[code]
/*virtual bool ExecWait(DWORD * pExitCodes)
{
CString l_command = "msiexec /I ";
l_command += "\"";
l_command += package;
l_command += "\"";
l_command += " ";
l_command += cmdparameters;
//if (silent)
// l_command += " /qn";
//if (suppressreboot)
// l_command += " REBOOT=ReallySuppress";

return DVLib::ExecCmdAndWait(l_command, pExitCodes);
};*/
[/code]

关键还是msiexec命令的用法。下面的几个地方都可以看看
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/msiexec.mspx
http://www.microsoft.com/resources/documentation/WindowsServ/2003/standard/proddocs/en-us/msiexec.asp
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q230781
http://helpnet.installshield.com/robo/projects/helplibdevstudio9/IHelpCmdLineMSI.htm
至于ExecCmd就是直白的CreateProcess封装,这个见得太多,不赘述。

InstallerEditorSetup则是用C#写的,不为别的,就图PropertyGrid和XML的方便呀。微软不写个MFC的PropertyGrid正是不好。其它开源的都不太稳定。XTreme的则还有些地方画的不好看。而微软的XML多少让人生出懒惰的放心。这部分不难,不过还是有很多小地方要小心才不会出错。估计作者Davide Icardi拼装那些字符串时还是很辛苦的。

3.
Nullsoft Scriptable Install System
http://nsis.sourceforge.net/home/
相对于Nullsoft的而言,dotNetInstaller的功能还不够强大,不过用的方便,而且着重考虑了dotNet用户,还是不错的。其实我这种懒人的正实想法是Nullsoft Scriptable Install System实在太过复杂,令人望而生畏。

4.
http://www.installsite.org/
很Cool的站点,好东西还是不少的。

Monday, December 20, 2004

 

Regular expression related resouces

1.
Regular Expression repository
一个正则表达式仓库
http://www.regexplib.com/

2.
http://royo.is-a-geek.com/iserializable/regulator/
非常的全面,而且居然还包含Intellisense功能

3.
Ultrapico
http://www.ultrapico.com/Resources.htm

4.
http://www.weitz.de/regex-coach/

5.
Mastering Regular Expressions, 2nd Edition
http://www.oreilly.com/catalog/regex2/chapter/index.html?CMP=ILL-4GV796923290
http://www.oreilly.com/catalog/regex2/chapter/ch08.pdf for Java
http://www.oreilly.com/catalog/regex2/chapter/ch09.pdf for .Net

6.
REGEXBUDDY
http://www.regexbuddy.com/
专业的REGEX生产工具

7.
http://regex.osherove.com/
The Regulator is an advanced, free regular expressions testing and learning tool.
It allows you to build and verify a regular expression against any text input, file or web, and displays matching, splitting or replacement results within an easy to understand, hierarchical tree.

Sunday, December 19, 2004

 

open source XML projects

1.
Xerces

参考网站:http://xml.apache.org/xerces-c/

Xerces-C++ 是一个非常健壮的XML解析器,它提供了验证,以及SAX和DOM API。XML验证在文档类型定义(Document Type Definition,DTD)方面有很好的支持,并且在2001年12月增加了支持W3C XML Schema 的基本完整的开放标准。

2.
XML4j

http://www.alphaworks.ibm.com/tech/xml4j

3.
XMLBooster

参考网站:http://www.xmlbooster.com/

这个库通过产生特制的parser的办法极大的提高了XML解析的速度,并且能够产生相应的GUI程序来修改这个parser。在DOM和SAX两大主流XML解析办法之外提供了另外一个可行的解决方案。

4.
Pull Parser

参考网站:http://www.extreme.indiana.edu/xgws/xsoap/xpp/

这个库采用pull方法的parser。在每个SAX的parser底层都有一个pull的parser,这个xpp把这层暴露出来直接给大家使用。在要充分考虑速度的时候值得尝试。

5.
Xalan

参考网站:http://xml.apache.org/xalan-c/

Xalan是一个用于把XML文档转换为HTML,纯文本或者其他XML类型文档的XSLT处理器。

6.
CMarkup

参考网站:http://www.firstobject.com/xml.htm

这是一种使用EDOM的XML解析器。在很多思路上面非常灵活实用。值得大家在DOM和SAX之外寻求一点灵感。

7.
libxml++

http://libxmlplusplus.sourceforge.net/

libxml++是对著名的libxml XML解析器的C++封装版本,C版本在
http://xmlsoft.org/index.html

8.
TinyXml

http://www.grinninglizard.com/tinyxml/

TinyXml is a simple, small, C++ XML parser that can be easily integrating into other programs.


Besides

标准定义
W3C的XML国际标准 http://www.w3.org/XML/
XML的开发接口DOM标准 http://www.w3.org/DOM/
XML的开发接口SAX标准 http://www.saxproject.org/

开发参考
XML相关的概念,开发应用 http://www.xml.com/
XML开发工具包Xerces,支持各种语言 http://xml.apache.org/
微软的XML开发工具包MSXML http://msdn.microsoft.com/xml/
IBM的XML4C开发工具 http://www.alphaworks.ibm.com/tech/xml4c

Saturday, December 18, 2004

 

Open source VOIP projects

By Klaus Darilion
From http://blog.csdn.net/ioke/archive/2004/12/14/215764.aspx
http://blog.csdn.net/ioke/archive/2004/12/14/215771.aspx

VoIP bookmarks from Klaus Darilion
Below you will find descriptions and links to SIP and RTP stacks, applications, test utilities, SIP proxies, SIP PBXs and STUN server and clients. Most of them are open source :-), but not all of them :-(
If you have any comments please feel free to contact me: --> klaus.darilion at pernau.at <-- There are also other VoIP related portals and link collections.
Note: I mainly searched for C/C++ stacks and applications. There also exist a lot of stacks and applications for other programming languages, especially for java. If you are looking for Java stacks/applications, please ask Google (search for: NIST java jain).
RTP Stacks (mainly open source C/C++ stacks)
jrtplib: A very nice, simple C++ RTP stack. Works on Windows, Linux.... ; License: Free; Homepage: http://lumumba.luc.ac.be/jori/jrtplib/jrtplib.html. This stack is not symmetrical, but you can use my version of rtpconnection.cpp (for jrtp version 2.8) to make it symmetrical. (send RTP and receive RTP on the same port, send RTCP and receive RTCP on the same port).
Common Multimedia Library: from UCL London, includes RTP stack; C; License: Free; Homepage: http://www-mice.cs.ucl.ac.uk/multimedia/software/common/
ortp: C; License: LGPL; Homepage: http://www.linphone.org/ortp/; without RTCP, from linphone
GNU ccRTP: C++; License: GPL (with linking exception); Homepage: http://www.gnu.org/software/ccrtp/
LIVE.COM Streaming Media: C++; License: LGPL; Homepage: http://live.com/liveMedia/
Morgan RTP DirectShow Filters: C++; License: ?; Homepage: http://www.morgan-multimedia.com/RTP/; based on liveMedia library
RTP from vovida.org: C++; License: VOCAL; Homepage: http://www.vovida.org/protocols/downloads/rtp/
RTPlib: RTP library from Lucent Technologies/Cloumbia University; C; License: Non-exklusive source code license; Homepage: http://www-out.bell-labs.com/project/RTPlib/
librtp: C; License: GPL; Homepage: http://gphone.sourceforge.net/template.php3?page=librtp; from Gnome-o-phone
Microsoft RTC API: The Mircosoft RTC API is a high level SIP and RTP Stack. It's included in Windows XP and also comes with the several Windows Messenger. Version 1.2 introduced a lot of new features is behaves strange when used with other SIP clients. Developer Homepage: http://www.microsoft.com/downloads/details.aspx?FamilyID=ae0bdc75-9f2f-4217-b97f-dfa0adf264aa&displaylang=en.
sipXmediaLib: Part of pingtel's open source releases for VoIP. License: LGPL; Homepage: sipfoundry.org.
SIP Stacksexternal SIP stack comparison
dissipate: C++; Linux, requries the qt-library, License: GPL; Homepage: http://www.div8.net/dissipate/; The original dissipate by Billy Biggs.
dissipate2: C++; Linux, requries the qt-library, License: GPL; Homepage: http://www.wirlab.net/kphone/; A enhanced dissipate, is part of the kphone distribution.
GNU osip: C; Linux+Windows+...; License: LGPL; Homepage: http://www.gnu.org/software/osip/; Also known as libosip. Note: The interface of osip has been changed and from now on it will be called osip2! Download the tar file from http://osip.atosc.org/download/osip/.
GNU eXosip: C; Linux+Windows+...; License: GPL; Homepage: http://savannah.nongnu.org/projects/exosip/; The extensible osip: "...It aims to implement a simple high layer API to control the SIP for sessions establishements and common extensions. Once completed, this eXtended library should provide an API for call management, messaging and presence features.... Download the tar file from http://osip.atosc.org/download/exosip/.
SIP from vovida.org: C++; Linux+Windows+...; License: Vovida Software License; Homepage: http://www.vovida.org/protocols/downloads/sip/
resiprocate: C++; Linux+Windows+...; Includes now a high level API (DialogUsageManager) which supports refers, ... License: VOCAL; Homepage: http://www.sipfoundry.org/reSIProcate/.
Microsoft RTC API: The Mircosoft RTC API is a high level SIP and RTP Stack. It's included in Windows XP and also comes with the several Windows Messenger. Version 1.2 introduced a lot of new features is behaves strange when used with other SIP clients. Developer Homepage: http://www.microsoft.com/downloads/details.aspx?FamilyID=ae0bdc75-9f2f-4217-b97f-dfa0adf264aa&displaylang=en.
sipXtackLib: Part of pingtel's open source releases for VoIP. License: LGPL; Homepage: sipfoundry.org. There is also a high level call library (sipXcallLib), which implements JTAPI in C++.
libmsip: A C++ SIP stack for Linux developed for the miniSIP project. Homepage: http://www.minisip.org/libmsip/.
RTP Applications
RAT - Robust Audio Tool; Supports a large number of codecs, ... License: Free; Homepage: http://www-mice.cs.ucl.ac.uk/multimedia/software/rat/
JMF - Java Media Framework: Can receive and send RTP streams; Homepage: http://java.sun.com/products/java-media/jmf/
MP3/RTP Plugin for Winamp: Homepage: http://www.live.com/multikit/winamp-plugin.html
Vomit - Voice over Missconfigured Internet Telephones: Plays back captured voice conversation; Homepage: http://vomit.xtdnet.nl/
RTP Tools: Several RTP utilities from the Columbia University; Homepage: http://www.cs.columbia.edu/IRT/software/rtptools/
UDP Packet Reflector/Forwarder: A tiny tool which forwards or reflects UDP packets. You can also add delay and packet loss. Very useful if you want to test RTP applications. Homepage: http://www.cs.ucl.ac.uk/staff/s.bhatti/teaching/z02/reflector.html. As I was not able to compile this tool I searched and found a binary somewhere in the web. You can download it local
SIP Phones (SIP User Agents)
x-lite, x-pro: A SIP client for Windows; Mac OS and Windows CE, http://www.xten.com/. A really nice SIP UA with a lot of features. The light version is free and really rocks, the pro version not. Supports multiple proxies.
eyeP Phone Lite: A SIP client for Windows, a FWD version is available for free http://www.eyepmedia.com/eyePPhoneFWD.htm.
SIPPS: SIP softphone with answering machine and a lot of features. They have also integrated support for nikotel.com for SIP-PSTN termination.http://www.sippstar.com/en/index.html. A Demo for testing is available. The configuration is a bit weird (what's the difference between a proxy and a redirect server?).
MSN Messenger: Microsofts Messenger, Version 4.6 allows also connections to other SIP servers than microsofts one. Nice design, works very well. Can be used with the SIP service of iptel.org. Homepage: http://messenger.microsoft.com/; local download of Version 4.6 for Windows NT (2000).
MSN Messenger: Microsofts Messenger, Version 4.7 allows also connections to other SIP servers than microsofts one. Nice design, works very well. Can be used with the SIP service of iptel.org. Homepage: http://messenger.microsoft.com/; local download of Version 4.7 for Windows XP.
Microsoft portrait: Windows SIP client that supports Audio, Video and IM. Uses RTC API 1.2 and therefore has poor compatibility with other SIP clients.http://research.microsoft.com/~jiangli/portrait/.
Ubiquity User Agent: Java based SIP Client for Windows, very useful, you have to register (free) to get an license; Homepage: http://www.ubiquity.net/useragent.php
EZ-Phone (Evaluation Version): SIP Phone for Windows; Homepage: http://www.hssworld.com/voip/download.htm
MySIP: SIP User Agent from Siemens; Homepage: http://www.mysip.ch/
SJPhone: SIP and H.323 Softphone for Windows, Linux and PocketPC from: http://www.sjlabs.com/products.html. The configuration for SIP is a little bit tweaky. And there must not be another SIP client running on port 5060 or the SJPhone won't work.
Linphone: A SIP Softphone for Linux (GNOME), needs libosip ans oRTP; Homepage: http://www.linphone.org/
KPhone: A SIP Softphone for Linux (KDE); Homepage: http://www.wirlab.net/kphone/index.html
Vovida: Complete SIP Suite for Linux (Uaser Agent, Proxy, ...), very, very big software contruct; Homepage: Vovida.org
Siphon: Linux SIP Softphone; Homepage: http://siphon.sourceforge.net/index.html
ActXPhone: An ActiveX-Control SIP Softphone based on the Microsoft Real Time Communications (RTC) API.http://www.pernau.at/kd/voip/ActXPhone/.
sipXphone: Part of pingtel's open source releases for VoIP. License: LGPL; Homepage: sipfoundry.org. This softphone also requires lots of other libraries from the sipX... software at sipfoundry.org.
Shtoom: An open source, cross plattform SIP client written in Python. License: LGPL; Homepage: http://www.divmod.org/Home/Projects/Shtoom/index.html.
Cornfed SIP-UA: A SIP user agent for Linux. License: Free for non-commercial use (binary distribution); Homepage: http://www.cornfed.com/products/.
MiniSIP: An open source SIP user agent for Linux which runs on PDAs. It is based on several libraries, including libmsip, a C++ SIP stack. Homepage: http://www.minisip.org/index.html.
SIP Test Utility
sipsak: SIP Swiss Army Knife, very useful test utility (Linux); Homepage: http://sipsak.berlios.de/
SIPNess: Ortena Networks SIP Messenger, very useful test utility for windows; Homepage: http://www.ortena.com/download.htm
SIP request generator: A web based generator of SIP requests: send SIP requests to SIP UAS and waits for final response: Download at http://obelix.ict.tuwien.ac.at/sip-gen/sip-gen.zip or test it online at Download at http://obelix.ict.tuwien.ac.at/sip-gen/sip-request-gen.php
NastysipA simple Linux-program from SX-Design that generates bogus SIP-messages and sends them to any peer. Download at http://www.sxdesign.com/index.php?page=developer&submnu=nastysip.
sipXtest: Part of pingtel's open source releases for VoIP. License: LGPL; Homepage: sipfoundry.org.
SIP Forum Test Framework (SFTF): A Framework to test SIP devices for common errors. License: GPL; Homepage: sipfoundry.org.
callflow: a powerful SIP call flow visualizer; Homepage: http://callflow.sourceforge.net/.
SIP Scenario Generator: a powerful SIP call flow visualizer; Homepage: http://www.iptel.org/~sipsc/.
SIPp: a powerful SIP performance testing tool sponsered by HP; Homepage: http://sipp.sourceforge.net/.
SIP Applications (Proxy, Location Server)
Sip Express Router (ser): Highspeed GNU SIP proxy with a lot of features and a lot of ongoing development. Homepage: http://www.iptel.org/ser/. A really cool SIP proxy - I like it! You can also take a look at the development homepage with web CVS. At the beginning you should read the admin guide and the mailing lists archive.
Ser Media Server (sems): Media Server add-on for ser SIP proxy. Homepage: http://sems.berlios.de/. Supports voicemail, IVR, SIP/PSTN gateway ...
Asterisk: Linux Software PBX with Gateway, SIP Proxy, Gateway (SIP, H.323, PSTN, ...); Homepage: http://www.asteriskpbx.com/
sipd: A Linux SIP proxy from SX-Design written in C (GPL): http://www.sxdesign.com/index.php?page=developer&submnu=sipd
partysip: A Linux SIP proxy based on osip2 (LGPL). Developer homepage is at: http://savannah.nongnu.org/projects/partysip/, you can download tar packages from: http://osip.atosc.org/download/partysip/.
mysip: A SIP proxy server from Siemens for Windows platforms. Homepage: http://www.mysip.ch/
Fomine RTC server: A SIP proxy server for Windows which uses its own SIP stack (does NOT need the RTC API) Homepage: http://www.fomine.com/rtc-server.html. The unregistered version can be used up to 5 users.
sipXpbx: Part of pingtel's open source releases for VoIP. License: LGPL; Homepage: sipfoundry.org. This PBX combines various sipX applications like a SIP proxy (sipXregistry, sipXproxy), a media server (sipXvxml) and lots more.
yate: Yet Another Telephony Engine - a PSTN gateway. License: GPL; Homepage: yate.null.ro. This gateway supports H.323, SIP and zaptel (->asterisk) based PSTN cards.
STUN server and clients
mystun: STUN server and client library from the iptel.org guys. License: GPL, Homepage: http://developer.berlios.de/projects/mystun/. You have to download the file via CVS.
Vovida STUN server: STUN server and client library/application for Linux and Windows from the Vovida guys. License: Vovida Software License 1.0, Homepage: http://www.vovida.org/applications/downloads/stun/. The files are hosted at sourceforge.
NAT traversal ALG (application level gateway)This applications can be installed on a linux NAT-box. They will rewrite your SIP messages and have some kind of UDP/RTP proxy for the media stream.
SaRP - SIP and RTP proxy: Perl implementation, License: GPL, Homepage: http://sourceforge.net/projects/sarp/.
siproxd: Siproxd is a proxy/masquerading daemon for the SIP protocol based on osip. License: GPL; Homepage: http://sourceforge.net/projects/siproxd/.

The VOIP - a reference guide to all things VOIP This Wiki covers everything related to VOIP, software, hardware, service providers, reviews, configurations, standards, tips & tricks and everything else related to voice over IP networks, IP telephony and Internet Telephony. ''Welcome to voip-info.org! Please e let me know at support@voip-info.org Thanks. ^ News This section is for news, ie news reports, press releases, product release announcements etc.
Research: Peer-to-Peer Internet Telephony using SIP PDF
Iconv application module for character conversion.
Version 0.9.2 of LDAPget application module released. bugfix.
Over 5 million VoIP subscribers worldwide - DMeurope Story
Interviews with bkw, twisted and David Mandelstam
Interview With drumkilla, the manager of the stable branch of Asterisk
Interview With bkw, one of the developers of Asterisk
Land Grab: What If Wal-Mart Got in the WiMax/VOIP Business? Robert X. Cringely Editorial
Interview With Mark Spencer, the creator of Asterisk - Slashdot Entry
http://www.voip-easy.com/: Cordless VoIP card DECT now compatible with SKYPE, MSN Messenger and any Audio applications based on Windows. Works in dual mode with SIP and Audio.
More News Information
Asterisk: Open Source PBX
SIP Express Router: An Open Source SIP proxy/router
VOIP Tools
Analog Telephone Adapters: VoIP analog telephone adapters ATA
Digital Telephone Adapters: VoIP Digital/TDM telephone adapters
VOIP Phones: VoIP phones both hardware and software
VOIP Gateways: VOIP to PSTN gateways (also known as: Media Gateways)
VOIP PBX and Servers
VOIP Routers
USB Phone
VOIP Session and Border Controllers and NAT traversal solutions
Open Source Software
Commercial Software
VOIP Billing
ENUM - map E164 telephone number into VoIP addresses
FXS-FXO Converters
Dial Pulse to Touchtone DTMF Converters
VOIP Test Equipment: How to analyze the speech quality of VoIP equipment
VOIP Silicon Chips specifically designed to support VOIP
VOIP Service Providers: VSPs, the next generation telco
Wireless VOIP
Low Bandwidth VOIP Using VOIP on dial-up or other low speed connections
VOIP over Satellite Using VOIP over satellite connections
NAT and VOIP
QoS - Quality of Service
PacketCable
FAX and VOIP
VOIP Codecs
VOIP Bandwidth Requirements
How To Debug and Troubleshoot VOIP
VOIP sites: VOIP sites on the Internet
VoIP Policy State and Federal VoIP policy and regualatory issues
VoIP Training: Seminars, tutorials, on-line classes
Protocols
IP Protocols: SIP, LTP, H.323, SCCP, MGCP, Megaco, IAX, STUN, ENUM, TRIP, SIMPLE, RTP, PINT, SCTP, T.37, T.38, COPS
ITU protocols: SS7, ISUP
ITU related standards: P.1010
OSP - Open Settlement Protocol
Markup Languages
IVR Presentation and dialog management: VoiceXML
Call control / conferencing / call routing: CCXML
IVR / Speech recognition definition: SRGS
IVR / Speech synthesis definition: SSML
IVR / prompting / recording / conferencing / DTMF / Voice: CallXML
Organizations
Standards Organizations: IETF, ITU, CCITT, ANSI, ISO, IEC, ETSI, IEEE, W3C
VoIP User Groups: List of local VoIP User Groups
Industry: SIP Forum, H.323 Forum, SIPfoundry, ChinaVoIP
Traditional Telephone Network
Analog Telephone Information
PBX features
Telecom terms: ANI, DNIS, PBX, CENTREX, E1, T1, BRI, PRI, ISDN, DID, Channelbank, Numbering plans, NEBS, CALEA, LATA, 911, PSAP, V and H Coordinates, NPA-NXX, Telecom Dictionary, CLEC, LNP, more
Telco Engineering Information Suggestions and Questions
How to add information to this wiki
Suggestions: Put your requests and suggestions here
Search VOIP sites on the Internet

Friday, December 17, 2004

 

PDF related open source projects

By 灵感之源
From http://www.cnblogs.com/unruledboy/archive/2004/12/21/79807.html

最近研究PDF的生成和解析,PDF文档是网络上最好的复合文件格式。 关于PDF的代码,真是多得不得了,光http://www.sourceforge.net上C#写的就超过8个,Java/PHP等不同语言写的版本就更加多了。 以下代码,如果无额外说明,皆为C#开发。
1、iTextSharp,类库,创建PDF、RTF、XML等,并可解析PDF,功能最强,
2、Report.NET,类库,创建PDF,不错,
3、sharpPDF,类库,创建PDF,不错,
4、iTextdotNET,J#, 类库,创建PDF,与Java原版最能保持更新同步,
5、PDFCreator ,VB6写的程序,图形化创建PDF最佳,
6、A pdf Forms Parser,类库,PDF解析器,效果不错,
7、pdf Library for creating pdf with tables and text, in C# ,类库,轻量级的创建,效果不错,
8、PdfCreator v1.1,同上,
9、pdfizer, a dumb HTML to pdf converter, in C#,转换HTML到PDF,效果不错,
10、Generate Thumbnail Images from pdf Documents,VB.NET写的把PDF页内容生成缩略图,效果不错,
11、TEXT to pdf Converter in .NET using Reporter.NET,利用Report.NET把纯文本转换成为PDF,
12、pdf creation using C# (and Office) from RTF/DOC files,从RTF/Doc文件中生产PDF文件,
13、Generate pdf documents from a HTML page using ASP.NET ,使用ASP.NET把HTML生成PDF

Thursday, December 16, 2004

 

Diff tools with source code

回答最初由 http://www.vcoresoft.com/ 的 RonaldW 发表的一个问题
各位能否提供类似TxtDiff的文本比较源码吗?老师布置了作业,我想参考他的算法.谢谢!

Diff tool
By Stephane Rodriguez.
http://www.codeproject.com/tools/difftool.asp

RGDiff - Visual Diff Tool
By Rob Groves
http://www.codeproject.com/useritems/rgdiff.asp

WinMerge
An Open Source visual text file differencing and merging tool for Win32 platforms. It is highly useful for determing what has changed between project versions, and then merging changes between versions.
http://winmerge.sourceforge.net/

补充:
aprenot
A Generic - Reusable Diff Algorithm in C#.
http://www.codeproject.com/csharp/C__Diff_Algorithm.asp

A Generic, Reusable Diff Algorithm in C# - II
http://www.codeproject.com/csharp/DiffEngine.asp

C# 版本的,算法也不同
4/30/2004修改

Addition:

Reflector Diff

"
I've just finished the first release of my Reflector Diff Add-In. I used the brilliant article by Michael Potter on creating a Diff Engine as my base. A big thank-you to him. I've always felt that if I'm coding something that someone else has done, I'm wasting my time. And I'd like to give a huge big thank-you to Lutz Roeder for all the help he's given me in getting this thing to work. He's been very patient, and has even helped me debug portions of my code, for which I am very grateful. He also pointed me in the direction of Denis Bauer's FileDisassembler to get ideas for a good way to implement the namespace diffs, which worked nicely.
"

http://codingsanity.blogspot.com/2004/10/reflector-diff.html
http://www.denisbauer.com/NETTools/FileDisassembler.aspx

Modified by 12/10/2004

Wednesday, December 15, 2004

 

Some open source editor

1.
Scintilla(http://www.scintilla.org/

虽然很强,可真的很难读懂(因为注释基本为零,又是基本C写的,还要兼顾多种操作系统)。居然有那么多程序员支持开发,真是佩服。不过Scintilla基础是好,从其网站上列出的以下书目就可以看出作者是谋而后动,成竹在胸啦。

The Craft of Text Editing describes how EMACS works, Craig A. Finseth

Span Tables are another data structure that can be used to represent documents in memory in a way that performs well when data is inserted and deleted, James Brown

Data Structures in a Bit-Mapped Text Editor, Wilfred J. Hanson, Byte January 1987

Text Editors: Algorithms and Architectures, Ray Valdés, Dr. Dobbs Journal April 1993

Macintosh User Interface Guidelines and TextEdit chapters of Inside Macintosh

BTW,Scintilla那么多封装
http://www.scintilla.org/ScintillaRelated.html
居然生生没有MFC或Windows SDK级的封装,真是^_^。我自己写了个SciEditor,封装了90%左右,估计够用了。再以后,就等着ScintillaNet
http://scide.net/
的成熟版本出来用现成的。

2.
Brainchild
http://www.codeproject.com/editctrl/brainchild.asp

3.
Crystal Edit
http://www.codeproject.com/editctrl/crysedit.asp
先天不足。

4.
CodeMax
http://groups.yahoo.com/group/codemax/
已停止开发

5.
CodeSense
http://www.ticz.com/homes/users/nlewis/HTML/Software_Development/CodeSense/Download/download.htm
功能不够多

6.
BCGEditor
http://www.bcgsoft.com/BCGPEdit/BCGPEditIntro.htm
不太稳定,而且too expensive to use

7.
目前坊间流传的代码还就是Scintilla最方便,因此有不少包装产品,如

NotePad++
http://notepad-plus.sourceforge.net/uk/site.htm
written in SDK

AnyEdit
http://www.anyedit.org/
first use Crystal Edit, then employ Scintilla
written in MFC

ScIDE
ScIDE is an integrated development environment, written in C#. It is bases around a plugin architecture, that allows the replacement of any core component easily. Behind Scide, is ScintillaNET - a .NET enabled version of the Scintilla Editor Component
http://sourceforge.net/projects/scide/

PNodePad
http://www.pnotepad.org/develop.html
written in WTL

Besides, TeXnicCenter still use Crystal Edit
http://www.toolscenter.org

Tuesday, December 14, 2004

 

Blog related software with source code

1.
BlogBuddy
http://blogbuddy.sourceforge.net/

2.
BlogReader
http://blogreader.sourceforge.net/
http://www.cnblogs.com/xhluo/
in C#

3.
TuntisPad
http://t-pad.sourceforge.net/
in VB.Net

4.
PortaBlog
http://sourceforge.net/projects/portablog/
in Java

5.
Semagic
http://semagic.sourceforge.net/
in C++
using LiveJournal http://www.livejournal.com engine

6.
IMHO Instant Blogger
http://sourceforge.net/projects/imho10
in C#

7.
RSS Bandit - Rss Bandit
RSS Bandit: a .NET RSS desktop feed aggregator.
http://www.rssbandit.org/

另外附录一个blogger网站比较的有趣总结
http://www.asymptomatic.net/blogbreakdown.htm

Monday, December 13, 2004

 

File find with source code

1. 运用多线程技术实现文件的快速搜索
作者:姜勇道
出处:http://www.vckbase.com/document/viewdoc.asp?id=445

其基本思想其实很简单,就是找到一个目录就开辟一个线程,文件的话当然在线程内就处理了。

基本数据结构如下:

首先要定义线程的参数结构用于文件信息的传递:
typedef struct tagTHREADPARAM {
CString strPath;
CString strFileName;
}THREADPARAM m_param;

因为线程要操纵全局变量,所以定义互斥体:CMutex m_mutexThreadCount,m_mutexThreadParam,m_mutexPath;

如果搜索完毕或搜索终止,要有事件通知,于是创建一个事件: CEvent m_event(FALSE,FALSE,NULL,NULL);

用CStringArray m_strPathArray存放结果

核心代码:

[code]
......
m_mutexThreadCount.Lock();
uThreadCount++;
m_mutexThreadCount.Unlock();
......

m_mutexThreadCount.Lock();
uThreadCount--;
//所有的线程完成,则激活事件,通知应用程序完成搜索(下同)
if(uThreadCount==0)
m_event.SetEvent();
m_mutexThreadCount.Unlock();
......
AfxBeginThread(GetFilePathThreadProc, &m_param, THREAD_PRIORITY_NORMAL);
::WaitForSingleObject(m_event.m_hObject,INFINITE);
......
[/code]

(按:操作系统的搜索功能是单线程的,但这样已经会使磁盘或CPU处于忙负荷,用多线程只会增加CPU的负荷,也不能减轻磁盘的负荷。不过,到是可以看看怎么玩CEvent)

2. 一个用多线程实现文件查找的例子
作者:Kelvin U.V
出处:http://www.vckbase.com/document/viewdoc.asp?id=449

这个更加复杂一些,增加了如下操作

//设置线程数及优先级
void ThreadSet(LONG MaxThreadCount=5,int priority=0);

//搜索选项
void FinderOption(FINDEROPTION FinderOption);

//查找操作
BOOL StartFinder(); //开始查找
void PauseFinder(); //暂停查找
void ResumeFinder(); //继续查找
void StopFinder(); //停止查找
void FinderReset(); //查找重置

每个线程通过自定义的消息与UI线程通信,反映当前的查找进度与查找结果。 //自定义通知消息=========================================================
//WM_THREADEXIT 主线程结束 WPARAM: 结束码
//WM_THREADCOUNT 活动线程数目 WPARAM: 线程数
//WM_FINDERITEM 查找结果 WPARAM: 结果字符串地址 LPARAM:文件属性
//WM_THREADPAUSE 程序暂停
//WM_FINDERFOLDER当前查找目录 WPARAM: 目录字符串地址
//========================================================

编程思路:

定义一个临时目录列表CStringList m_DirList; 线程每找到一个目录就将它放在m_DirList尾,若找到的是文件,就用MatchProc()进行比较,判断是否符合查找条件。若符合就向UI线程发送消息WM_FINDERITEM,以进行界面显示。然后,线程继续在当前目录中查找直到当前目录全部查找完毕。再从m_DirList队头取一个新的目录进行查找。

这里有一个要注意的地方就是m_DirList为每个线程所共有的资源,所以在访问m_DirList时要注意一下线程间的互斥,这可以用临界区操作来保证。

那么,如何来判断文件查找应该结束了呢?仅判断m_DirList为空是不够的,因为当m_DirList为空时,有可能还有活动的线程,这些活动的线程可能还会产生新的未查找的目录,故只有在m_DirList为空且当前的活动线程数为0时才可以断定查找结束。(这里的"活动线程"指正在进行查找操作的线程,"非活动线程"指处于等待新的待查目录状态的线程)

测试结果:

“程序编译运行后,仅进行文件名查找时经测试速度比Windows自带的查找程序稍快(Win9x的查找程序是独立的,而Win2000下是集成在Explorer中的),当线程数在5-10之间时速度最快,而超过50时速度反而变慢,这就说明了并不是线程越多越好。线程数过多,CPU的大部分开销花在线程间切换上,而且由于没有足够的待查目录,大多数的线程处在等待状态,占用了大量的系统资源,从而使速度变慢。当进行包含文字的查找时,我用的是KMP匹配算法,但是速度还是比Windows自带查找程序慢。”

(按:这篇文章明显认识到了线程不能太多。一般来说,Window现在倾向于开5-7个线程,比如Explorer,Internet Enplorer就开这么多。不过作者还不能很好的调配进程,"使用Sleep起一个延时作用,它把控制权先交到其他线程,当各线程运行检测到Event已经改变就执行相应操作
PumpMessage()",仍然未得线程池的精髓。另外,如果用户不坚持需要广度优先搜索的话,多线程实在没有太大必要。)

3. FindFile class for Windows projects
http://www.codeproject.com/file/win32findfile.asp
不便于移植,不过filter还行。

4. CFileFinder - Extend the functionality of CFileFind MFC class
By Samuel Gonzalo
http://www.codeproject.com/file/cfilefinderex.asp

(按:我很喜欢该作者的另外一个作品
CPath 1.2 - To work with path strings easily
http://www.codeproject.com/file/cpath.asp
作者在这里将两者结合得很好,我自己的搜索文件就是在这一基础上开发的。原文让我最不满意的两个地方实不能resume查询,GUI选项做的不够,不能直接Copy之。^_^)

(按:另外,看起来大家还都是喜欢CStringArray,没别的,就算MFC的STL封装不够快,可用起来舒服,又不容易错,谁不喜欢呢?
还有,说到GetLength64错误,这里可以参见
Bug in MFC's CFileFind::GetLength64()
http://www.codeproject.com/buglist/getlength64bug.asp.asp
what a ugly bug!

Sunday, December 12, 2004

 

DotNet plot programs with source code

1.
Nplot
http://netcontrols.org/nplot/

2.
Graphviz - Graph Visualization Software
http://www.graphviz.org/
http://blog.dotnetwiki.org/
Since Jonathan Frequently moves, the blog address is the most convenient link

3.
ZedGraph
http://zedgraph.sourceforge.net/

4.
3D Pie Chart
http://www.codeproject.com/aspnet/3dpiechart.asp

5.
Roll your own ASP.NET Chart Control
http://www.codeproject.com/aspnet/webchart.asp

6.
SharpVectorGraphics
http://sourceforge.net/projects/svgdomcsharp/
http://weblogs.asp.net/donxml/category/671.aspx

Hihi, catch the rabbit in his/her net

Besides, I think DotNetCharting is really nice, however, they do not give us source code

http://www.dotnetcharting.com/

Saturday, December 11, 2004

 

Spell checker with source code

还是为SciEdit做的,随便谈谈而已

1. A free Spell Checker with a dictionary editor program
By Peter Pearson
http://www.codeproject.com/cpp/spellchecker_pp.asp

这可是说是最为简单的一个例子,讲解也比较细致,其流程大致可以归纳为以下几步
a) 获得需要分析的单词,这里是从Editbox中获得流式文件,然后用最基本的字符串处理方法打成一个个单词,放进CStringArray中
b) 变lowercase后,比较单词表,未使用任何附加技术提高比对速度
c) 保存CStringArray IgnoreAll来处理Ignore的情况
d) 提供一个ListCtrl based对话框程序来编辑单词表,图标不错
e) 提供一个简单的单词替换对话框
f) 字典是最基本的每行一个单词格式的文本文件

改方法的缺点是速度太低。很多地方需要优化

2.
A Spell Checking Engine
By Matt Gullett
http://www.codeproject.com/cpp/spellchecker_mg.asp

这个例子有了很多改进的地方
g) 更加友好,强大的用户界面
h) 重载了CEdit class,新的CFPSSpellingEditCtrl和Spell Check Engine结合的更加方便,紧密:例如提供HotKey,弹出菜单等。同时重载了OnPaint,中规中矩的提供了红色下划波浪线提示错误。很友好,同时很重要的功能。这段代码写的不错。
f) 增加了Common Mistake库

最近还推出了多种商业版本 http://www.spellican.com/
使用XML进行单词储存,可是效率依然不是很高

3.
Spell Checker Dictionary Engine
By Martyn Pearson
http://www.codeproject.com/cpp/spelldictionary.asp

这个例子使用了编码理论中比较简单的一种单词储存方式Dynamic Acyclic Word Graph,然而该方法要求使用设计得比较好的单词库,该例子的作者显然没有能力提供合适的单词库。

4.
NetSpell - Spell Checker for .NET
By Paul Welter
http://www.loresoft.com/NetSpell

SpellEdit
By SteveKing
http://www.codeproject.com/editctrl/SpellEdit.asp

这两个项目都是和OepnOffice的Lingucomponent Project项目MySpell相关的,由于使用了Affix Compression技术,效率和字库大小都有相当的保证。
其相关网页在
http://lingucomponent.openoffice.org/
http://lingucomponent.openoffice.org/dictionary.html
http://lingucomponent.openoffice.org/download_dictionary.html

我比较喜欢NetSpell这个项目,纯粹的C#,移植得有自己特色

5.
Using the Microsoft Common Spell API
By Tibor Blazko
http://www.codeproject.com/cpp/csapi.asp
使用微软的现成产品是一种选择,不过要求有使用许可权限

6.
Aspell
http://aspell.sourceforge.net/

GNU Aspell is a Free and Open Source spell checker designed to eventually replace Ispell. It can either be used as a library or as an independent spell checker. Its main feature is that it does a much better job of coming up with possible suggestions than just about any other spell checker out there for the English language, including Ispell and Microsoft Word. It also has many other technical enhancements over Ispell such as using shared memory for dictionaries and intelligently handling personal dictionaries when more than one Aspell process is open at once.

不错的GNU,单词库,优于Word 97,但是不知道和后续的Word怎么比较

7.
Kevin's Word List Page
http://wordlist.sourceforge.net/

不错的资源网页

8.
Spelly - Spell Checker
By yonat
http://www.codeguru.com/tools/visualstudioadd-ins/article.php/c1411/

Spellcheck Macro for Visual Studio
http://www.wndtabs.com/spelly/

是VS用的Spell Checker,搞不懂这真的需要吗?

9.
TeXnicCenter中的MySpell插件
http://www.texniccenter.org/front_content.php

也部分使用了Affix Compression技术。呵呵,被他们称为TeXnicCenter的Fans

Friday, December 10, 2004

 

Chess Program in C#

1.
Yet Another Chess Board Control
By Cafechess
http://www.codeproject.com/csharp/GpChessControl.asp

A chess control with full move validation including checks, mates, stalemates. PGN and FEN parsers.

The GUI is not very cute. The translation of PGN and FEN is too simple but easy to understand.

2.
rnChessBoardControl v 1.1 FULL Beta for .Net 1.1
http://www3.sympatico.ca/crchapman/rnchesscontrol_full.html

This GUI looks much better.

3. Valil.Chess
By Valentin Iliescu
http://www.codeproject.com/csharp/chess.asp

Features summary
Three playing modes: play against the local engine, against a XML Chess Web Service, or in two-players mode.
Full understanding of the chess rules: draw by repetition / by 50 move rule / by insufficient material, castling, en passant etc.
Save/load games in PGN (Portable Game Notation) and FEN (Forsyth-Edwards Notation) formats.
Autosave feature: automatically resumes an interrupted game.
Move history in SAN (Standard Algebraic Notation) with navigation capabilities (go to first/previous/next/last position in a game).
C# local engine with six difficulty levels - can force the AI opponent to move.
Board editor.
Can rotate the board.
Gives next move hint
Skinnable graphics.
Accepts input using the mouse or the keyboard (using a cursor).
Integration capabilities with WinBoard engines (Crafty etc.).
Displays the game status.

The AI feature is good. It demonstrate how to implement a simple alpha-beta cut quickly.

Thursday, December 09, 2004

 

Open source CHM projects

1.
在http://www.blogcn.com/user8/flier_lu/main.asp?id=1196784 中,Flier 提到编译CHM项目的API接口,原文如下

Microsoft 提供的HTML Help Workshop只支持在GUI界面或者使用其自带的HCC.exe程序编译CHM项目文件(.hpp),并不直接提供API供第三方软件使用。而实际上其CHM项目编译器的HHA.DLL中提供了名为HHA_CompileHPP的导出函数,实现了对.hpp的CHM项目文件直接进行编译,并通过两个回调函数通知用户当前编译进度。

以下为引用:

BOOL WINAPI HHA_CompileHHP(PCSTR pszHhpFile, FARPROC pLogString, FARPROC pProgress);

参数pszHhpFile传入要编译的CHM项目工程文件文件(.hhp);pLogString和pProgress分别执行两个回调函数,向用户报告当前编译进度。

以下为引用:

typedef void (CALLBACK *LOGSTRINGPROCA)(PCSTR pszMsg);
typedef BOOL (CALLBACK *PROGRESSPROCA)(PCSTR pszFile);

使用时只需要载入动态链接库HHA.DLL,并通过函数名字(HHA_CompileHHP)或序号(0x13F)获得函数入口即可。

btw: CHM的文件格式好些也被搞定了,Code Project上有一个支持Pocket PC 2003的开源CHM阅读器。

下面HHA_CompileHHP的一个Delphi移值版本:

以下为引用:

unit ChmCompiler;

interface

uses
Windows, SysUtils;

type
TChmCompileFunc = function(pszHhpFile: PChar; pLogString: Pointer; pProgress: Pointer): Bool; stdcall;

TLogMessageEvent = procedure(Msg: string) of object;
TProgressEvent = function(FileName: string): Boolean of object;

TChmCompiler = class
private
FDll: HMODULE;
FProc: TChmCompileFunc;

FOnLogMessage: TLogMessageEvent;
FOnProgress: TProgressEvent;
protected
constructor Create;
public
destructor Destroy; override;

class function Default: TChmCompiler;

function Compile(FileName: TFileName): Boolean;

property OnLogMessage: TLogMessageEvent read FOnLogMessage write FOnLogMessage;
property OnProgress: TProgressEvent read FOnProgress write FOnProgress;
end;

implementation

uses
ActiveX;

var
GChmCompiler: TChmCompiler;

procedure LogMessageFunc(pszMsg: PChar); stdcall;
begin
Assert(Assigned(GChmCompiler));

if Assigned(GChmCompiler.OnLogMessage) then
GChmCompiler.OnLogMessage(pszMsg);
end;

function ProgressFunc(pszFile: PChar): Bool; stdcall;
begin
Assert(Assigned(GChmCompiler));

if Assigned(GChmCompiler.OnProgress) then
Result := GChmCompiler.OnProgress(pszFile)
else
Result := True;
end;

{ TChmCompiler }

constructor TChmCompiler.Create;
begin
FDll := SafeLoadLibrary('HHA.DLL');

if FDll = 0 then RaiseLastOSError;

FProc := TChmCompileFunc(GetProcAddress(FDll, 'HHA_CompileHHP'));
//FProc := TChmCompileFunc(GetProcAddress(FDll, PChar($13F)));

if @FProc = nil then RaiseLastOSError;

CoInitialize(nil);
end;

destructor TChmCompiler.Destroy;
begin
CoUninitialize();

FProc := nil;

if FDll <> 0 then
Win32Check(FreeLibrary(FDll));

inherited;
end;

class function TChmCompiler.Default: TChmCompiler;
begin
if not Assigned(GChmCompiler) then
GChmCompiler := TChmCompiler.Create;

Result := GChmCompiler;
end;

function TChmCompiler.Compile(FileName: TFileName): Boolean;
var
szFileName: PChar;
LogMessageProc, ProgressProc, CompileProc: Pointer;
Ret: BOOL;
begin
szFileName := PChar(FileName);
LogMessageProc := @LogMessageFunc;
ProgressProc := @ProgressFunc;
CompileProc := @FProc;
asm
XOR EAX, EAX
PUSH EAX
MOV EAX, ProgressProc
MOV ECX, LogMessageProc
MOV EDX, szFileName;
PUSH EAX
PUSH ECX
PUSH EDX
CALL CompileProc
MOV Ret, EAX
end;
Result := Ret;
end;

initialization
GChmCompiler := nil;

finalization
if Assigned(GChmCompiler) then FreeAndNil(GChmCompiler);
end.

2.
关于CHM的制作和分解,可以参见
http://bonedaddy.net/pabs3/hhm/
http://www.speakeasy.org/~russotto/chm/
看了这个站点后,基本已经没有什么秘密啦。

3.
Jed Wing的那个也很简单
http://66.93.236.84/~jedwin/projects/chmlib/

4.
Codejock Software的A guide to MSDN Collection Integration
http://www.codejock.com/developer/article01.asp
很直白,不过使用不慎可能导致程序自动退出

5.
更进一步集成入Visual Studio .NET Help Integration Kit
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/htmlhelp/html/hwmscextendingnethelp.asp

6.
至于HPP等文件应该怎么写,看看NDoc或者别的同类产品的原代码即可

7.
Volker Bartheld写的Revisited: HtmlHelpTest and makehhp
http://www.codeguru.com/Cpp/W-P/help/html/article.php/c6505/
和Peter Boulton写的Create HTML Help Files with the HTMLHelp Helper Utility
http://www.codeguru.com/Cpp/W-P/help/html/article.php/c6509/

8.
Klaus Weisser
HtmlHelp library and example viewer
http://www.codeproject.com/csharp/HtmlHelp.asp
C#下面的,做的不错

9.
在2003-5-29的blog “CHM相关项目” 中,我们讨论了CHM文件编译和反编译的基本思想和相关开源项目。但是各位同好也发现开发中可能还是有这样那样的问题,解决这些问题的最方便途径是去下面几个地点。

10.
http://www.mshelpwiki.com/
http://www.mshelpwiki.com/index.php?page=MSHelpWiki

The MSHelpWiki is a knowledgebase of Microsoft Help-related information, initially created by the MicrosoftHelpMVPs and maintained by the Help authoring community (and you, if you want to get involved).

There are lots of great Help-related sites on the Web and we hope this will tie them all together by becoming a central location where you can search for answers. Please help contribute by sharing your knowledge, adding links to available resources, and publishing your tips and tricks.

这两个站点带有官方色彩,消息灵通,值得注意。

11.
http://helpware.net/

The Helpware Group

Welcome to the home of The Helpware Group. Here you will find support for MS HTML Help 1.x and MS Help 2.0, FrontPage and Delphi. We are based in Melbourne Australia. Enjoy the site. All comments welcome.


http://www.helpware.net/FAR/far_faq.htm
有多种常见错误的分析和解决,非常有参考价值

顺便说起gozhhu留言中提到出现Access Violation,我想最有可能是这个问题

HTML Help Workshop May Cause an Access Violation When Editing Contents File with .hhc Extension
http://support.microsoft.com/?kbid=294990

SYMPTOMS
When you are editing an HTML Help contents file with the Microsoft HTML Help Workshop, you may receive an access violation in Hhw.exe. This can occur when you are moving, adding, or deleting items through the graphical interface for editing individual items.

Also, when you are editing large content files, you can receive illegal operations error messages simular to the following:

HHW caused an invalid page fault in module HHA.DLL
-or-



HHW caused an invalid page fault in module MFC40.DLL
CAUSE
This is due to a bug in the HTML Help Workshop's memory management code.
RESOLUTION
For additional information about how to resolve this issue using the hotfix found in the Resolution section of Q304412, click the article number below to view the article in the Microsoft Knowledge Base:
304412 FIX: HTML Help Compiler May Not Compile Correctly on Japanese Windows

STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

另外,也有可能是

HH_CLOSE_ALL Bug and HH_INITIALIZE Problem:

Marcel van Brakel has uncovered a real problem with HH_CLOSE_ALL. When you call HH_CLOSE_ALL on shut down, the HH API creates another thread and sometimes does not return until after you have performed UnLoadLibrary(hhctrl.ocx). In this case the HH_CLOSE_ALL thread returns to nothing and causes an access violation.

Discussion:

Ralph Walden (x-Microsoft) describes the problem:

The switch to a background thread was done after I left (the MS help team) in order to solve a problem with Visual Studio. I knew they should have fixed Visual Studio instead of "fixing" HTML Help (which wasn't broken). I've never actually tried it, but along with that change was a hack that allowed you to call the API in a way that it would create an interface, and then you'd call the API again to release that interface. You start off with HH_INITIALIZE and end with HH_UNINITIALIZE. Another alternative would be to set the HH_GPROPID_SINGLETHREAD property to TRUE -- that might get HTML Help back onto the parent's thread.

Fix:

As described by Ralph above, you can try using the HH_INITIALIZE, HH_UNINITIALIZE commands. These are documented in the HH Workshop online help.
Call HH_CLOSE_ALL earlier. Get more space between the HH_CLOSE_ALL and your call to UnloadLibrary. In VB and Delphi you would perform the call on the Form QueryUnload _not_ on the Form Close or Destroy.
Marcel van Brakel seemed to fix it by calling Sleep(0); immediately after the call to HH_CLOSE_ALL. Again providing more time for the rogue thread to return.
More Tips:

Here is an alternative to using HH_CLOSE_ALL. What I do with my applications is keep the handle of the HH Windows when making a help call: _HHwinHwnd := htmlhelp(...) and on shutdown call:

if IsWindow(_HHwinHwnd) then
SendMessage( _HHwinHwnd, wm_close, 0, 0 );

This is 10 times faster code, and eliminates the need for HH_CLOSE_ALL completely.

Also, as programming wizard Roland Mechling points out, don't blindly call HH_CLOSE_ALL on shutdown. If a user does not have HTML Help installed then this call will crash your application. Here is safer code. Notice we are checking if HH is installed before calling HtmlHelp();

procedure HHCloseAll;
begin
If @HH.HtmlHelp <> Nil then //HH API is available
begin
HH.HtmlHelp(0, nil, HH_CLOSE_ALL, 0);
Sleep(0);
end;
end;

这后一种情况chinashandongliu 在flier大人的blog上也提了出来,我想可能是同样的原因。

12.
另外附一篇

Chm不能运行的原因及对策

作者:coolstar

,试试改文件名和所在目录为英文名称

2,在控制面板-区域和语言选项-高级 三个中文全选上

3,检查你下载的文件是否不完整或者已经受损,否则应该重新下载,试试把文件名和所在目录改成英文

4,控制面板-管理工具---服务----Help and Support
启用在此计算机上运行帮助和支持中心。如果停止服务,帮助和支持中心将不可用。如果禁用服务,任何直接依赖于此服务的服务将无法启动。
看看这个是否被关闭或禁用了,以及和它相关的服务

5,是HH.EXE的动态链接库文件受损所致。检查一下系统目录下是否有Hh.exe这个文件(如C:\Windows下),这个文件用来打开CHM文件。如果破坏,请从别的正常的XP系统下System32
文件夹下复制HHActiveX.dll、hhctrl.ocx、hhsetup.dll等三(或者两个)个文件,到你的机器上的相同下,即可解决

6,如果你确认你下载的文件没问题,系统目录下也有Hh.exe,但仍然打不开,那可能是程序所需链接库文件受损,请下载安装微软的Hhupd.exe就能解决问题。 http://www.kaoyan.com/uploads/bbs/hhupd.exe


解决关联的问题

把下面的内容保存为一个reg文件,双击导入

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.chm]
@="chm.file"

[HKEY_CLASSES_ROOT\chm.file]
@="已编译的 HTML 帮助文件"

[HKEY_CLASSES_ROOT\chm.file\DefaultIcon]
@="C:\\WINNT\\hh.exe,0"

[HKEY_CLASSES_ROOT\chm.file\shell]

[HKEY_CLASSES_ROOT\chm.file\shell\open]

[HKEY_CLASSES_ROOT\chm.file\shell\open\command]
@="\"C:\\WINNT\\hh.exe\" %1"

Wednesday, December 08, 2004

 

HTML Editor

1.
Introduction to MSHTML Editing
http://msdn.microsoft.com/workshop/browser/editing/mshtmleditor.asp

2.
经常被提到的具有诸多衍生产品的 The HTMLEditor http://itwriting.co.uk/htmleditor/ 确实能让人学到不少东西。

首先是using mshtml; 这个引用域名。

然后是ComSupport.cs,令人恐怖的声明,将IE的COM引入到项目中。作者真的是花了很大的力气来干这件事情,佩服。主要的interface有
//
public interface IPropertyNotifySink
public interface IOleClientSite
public interface IOleContainer
public interface IDocHostUIHandler
public interface IOleInPlaceUIWindow
public interface IOleInPlaceFrame
public interface IOleInPlaceSite
public interface IOleInPlaceSiteEx
public interface IOleDocumentSite
public interface IOleDocumentView
public interface IOleInPlaceObject
public interface IOleInPlaceActiveObject
public interface IOleObject
public interface IPersistMoniker
public interface IPersistStreamInit
public interface IOleCommandTarget
public interface IServiceProvider
//
public interface IHTMLEditHost
public interface IHTMLEditServices
public interface IHTMLEditDesigner
public interface IDocHostShowUI

HtmlSite.cs Implements the site on which mshtml is hosted
直接使用上面声明的各种interface,IE的Host还是很麻烦的。不知作者在那里找的文档。

整个项目的精华都在HtmlEditor.cs 中,代码组织得很好,看起来比较好懂。

剩下的都是些辅助功能

ComStream.cs This class implements UCOMIStream for an easier way to read back the output from IPersistStreamInit. Thanks to microsoft.public.dotnet.general

ComposeSettings.cs 储存用户设定

utils.cs HTML文档的Load,或者URL的Load。相当麻烦,而且不知道有没有相关文档。

EventHandlers.cs文件中是HtmlEditor.cs 中Event的声明,目前这个版本的Event似乎不全(记得不准),而且可以看到不断增加Event的痕迹。估计以后还会不断增加吧。

CSnap.cs implement IHtmlEditHost,这一部分显然离完成还差很远。它和HtmlEditor.cs中的timer一起工作,及时刷新编辑效果。

DownloadOnlySite.cs 处理由于脚本等不能在线编辑的情况。

3.
Using IHTMLEditDesigner
By Rob Manderson
From http://www.codeproject.com/internet/disabledrag.asp

Implementing snap-to-grid in an MSHTML based application
By Rob Manderson
http://www.codeproject.com/internet/snaptogrid.asp

4.
HTML Editor for VC++ 6.0
by irekz
http://www.codeguru.com/Cpp/I-N/ieprogram/displayinginformation/article.php/c7273/
和The HTMLEditor的实现方法大致一样,也很不错

5.
WYSIWYG Web Builder
By Pablo Vandermeer
From http://www.pablovandermeer.nl/web_builder.html

This project started as a replacement for ‘good-old’ Frontpage Express that used to be part of Windows. Just a simple, easy-to-use utility to generate web pages. Web Builder has almost all the features Frontpage Express had, but gives you much more freedom of where you put your web objects (such as images, text, tables etc). This means that the finished page will display in your browser exactly the way it was designed.
The program generates HTML (HyperText Markup Language) tags while you point and click on desired functions; you can create a web page without learning HTML. Just drag and drop objects to the page position them 'anywhere' you want and when you're finished publish it to your web server (using the build in Publish tool).


Features:
- No HTML knowlegde needed!
- Drag and drop of the HTML objects: Text, Lines, Images, Marquees and Tables.
- Form layout object to create forms, including actions, hidden fields etc.
- Supports Form fields: Editbox, TextArea, Checkbox, Radiobutton, Combobox and Button.
- Rich text support: text object can contain different fonts, colors, links and sizes.
- Option to add custom HTML for each object (Before Tag, Inside Tag, After Tag).
- Custom HTML object.
- Scripting object (VbScript and Javascript).
- ActiveX, JAVA, Flash, Windows Media player, Quicktime and other Plug-In support.
- Publish to local drive or a FTP server.
- Images can be drag'n dropped from explorer on the document to speed up development.
- Easy Photo Gallery creation.
- Banners.
- Rollover images.
- Bookmarks.
- Customize scrollbar colors for Microsoft Internet Explorer.
- Meta tags.
- Printing/Print preview.
- Clipboard Copy/Cut/Paste.
- Aligning functions.
- Undo/Redo.
- and much more!

Try it and let me know what you think of it.
Who knows maybe one day it will be a standard part of Windows...

This one is super cool. However, it is not free now!

Tuesday, December 07, 2004

 

HTML Parser

1.
HTMLParser
http://htmlparser.sourceforge.net/

The two fundamental use-cases that are handled by the parser are extraction and transformation (the syntheses use-case, where HTML pages are created from scratch, is better handled by other tools closer to the source of data). While prior versions concentrated on data extraction from web pages, Version 1.4 of the HTMLParser has substantial improvements in the area of transforming web pages, with simplified tag creation and editing, and verbatim toHtml() method output.

In general, to use the HTMLParser you will need to be able to write code in the Java programming language. Although some example programs are provided that may be useful as they stand, it's more than likely you will need (or want) to create your own programs or modify the ones provided to match your intended application.

To use the library, you will need to add either the htmllexer.jar or htmlparser.jar to your classpath when compiling and running. The htmllexer.jar provides low level access to generic string, remark and tag nodes on the page in a linear, flat, sequential manner. The htmlparser.jar, which includes the classes found in htmllexer.jar, provides access to a page as a sequence of nested differentiated tags containing string, remark and other tag nodes. So where the output from calls to the lexer nextNode() method might be:

html>
head>
title>
"Welcome"
/title>
/head>
body>
etc...

The output from the parser NodeIterator would nest the tags as children of the html>, head> and other nodes (here represented by indentation):
html>
head>
title>
"Welcome"
/title>
/head>
body>
etc...

The parser attempts to balance opening tags with ending tags to present the structure of the page, while the lexer simply spits out nodes. If your application requires only modest structural knowledge of the page, and is primarily concerned with individual, isolated nodes, you should consider using the lightweight lexer. But if your application requires knowledge of the nested structure of the page, for example processing tables, you will probably want to use the full parser.
Extraction
Extraction encompasses all the information retrieval programs that are not meant to preserve the source page. This covers uses like:
text extraction, for use as input for text search engine databases for example
link extraction, for crawling through web pages or harvesting email addresses
screen scraping, for programmatic data input from web pages
resource extraction, collecting images or sound
a browser front end, the preliminary stage of page display
link checking, ensuring links are valid
site monitoring, checking for page differences beyond simplistic diffs
There are several facilities in the HTMLParser codebase to help with extraction, including filters, visitors and JavaBeans.
Transformation
Transformation includes all processing where the input and the output are HTML pages. Some examples are:
URL rewriting, modifying some or all links on a page
site capture, moving content from the web to local disk
censorship, removing offending words and phrases from pages
HTML cleanup, correcting erroneous pages
ad removal, excising URLs referencing advertising
conversion to XML, moving existing web pages to XML
During or after reading in a page, operations on the nodes can accomplish many transformation tasks "in place", which can then be output with the toHtml() method. Depending on the purpose of your application, you will probably want to look into node decorators, visitors, or custom tags in conjunction with the PrototypicalNodeFactory.
The HTML Parser is an open source library released under GNU Lesser General Public License, which basically says you are free to use the library "as is" in other (even proprietary) products, as long as due credit is given to the authors and the source code for the HTMLParser is included or available with the other product. For modified or embedded use, please consult the LGPL license.

2.
Use the MSHTML COM to parse the html file for you

By soarlove
From http://www.vccode.com/file_show.php?id=784

IE自带的MSHTML那套COM库实际上提供了一个轻量级的HTML解析引擎,只是因为MS文档中少有提及,故而知道的人不多。昨天一个朋友提起如何解析HTML的问题,于是写了个例子,大概说明如何使用IE这套轻量级解析引擎。
主要功能是由IMarkupServices接口提供的,通过他解析HTML文档生成一系列的类似iterator的IMarkupPointer,以及类似container的IMarkupContainer接口。
...
主要接口获取流程如下:
...
CLSID_HTMLDocument -> IHTMLDocument2 -> IPersistStreamInit
-> IMarkupServices -> IMarkupContainer, IMarkupPointer
-> IHTMLDocument2 -> IHTMLElement
...
主要实现伪代码如下:
...
CoCreateInstance IHTMLDocument2 from CLSID_HTMLDocument
QueryInterface IPersistStreamInit from IHTMLDocument2
spPersistStreamInit->InitNew()
QueryInterface IMarkupServices from IPersistStreamInit

IMarkupPointer spMkStart, spMkFinish
IMarkupContainer spMarkupContainer
IPersistStreamInit->CreateMarkupPointer(spMkStart)
IPersistStreamInit->CreateMarkupPointer(spMkFinish)

IMarkupServices->ParseString(strHTML, 0,
&spMarkupContainer, spMkStart, spMkFinish)
...
然后,可以通过两种方式对解析后的代码进行访问。
一是通过IMarkupPointer本身进行遍历访问(a stream-based model)
二是解析后通过DOM树进行访问(a tree-based model)。前者功能较强,因为某些HTML无法解析为树状结构,(如Where do you want to go today? 存在交叉的情况);而后者使用起来简单一些,一下示例为简便起见,使用DOM树进行简单遍历(可以递归了,呵呵)
btw:因为用了自己写的一个模板库(ftl那些东东),有些代码可能比较含糊。
如CComContext g_ComContext;是一个简单的COM环境初始化类
struct CComContext {
CComContext() { ::CoInitialize(NULL); }
~CComContext() { ::CoUninitialize(); }
};
其他的代码较长,略去,只把功能大概提及一下,因为不设计关键代码编译不通过的删去即可。其中ComCheck使用较多,其实就是检测返回值出错则抛出一个自定义异常(带自动错误报告功能)。
inline HRESULT ComCheck(HRESULT hr)
{ if(FAILED(hr)) throw CComError(hr); return hr; }
再就是log是一个自定义的Message Tracer,用于日志文件输出。

开发环境:Win2K srv sp2 + VC6 sp5 + IE6
完整代码如下:

// MarkupSvc.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include
#include
using namespace std;
#include
#include
#include
#include
#include
#include "ftl.h"
using namespace ftl;
CComContext g_ComContext;
CExceptionHandler g_ExceptionHandler;
CMsgTracer log;
void printElement(const CComPtr& spElement, int nLevel)
{
CComBSTR bstrTagName, bstrClassName, bstrID;
ComCheck(spElement->get_tagName(&bstrTagName));
ComCheck(spElement->get_className(&bstrClassName));
ComCheck(spElement->get_id(&bstrID));
USES_CONVERSION;
string strIndent(nLevel * 2, ' '),
strTagName(W2A(bstrTagName)), strClassName, strID;
if(bstrClassName)
{
strClassName = " class=\"";
strClassName += W2A(bstrClassName);
strClassName += "\"";
}
else
strClassName = "";

if(bstrID)
{
strID = " id=\"";
strID += W2A(bstrID);
strID += "\"";
}
else
strID = "";
CComPtr spDispatch;
CComPtr spHTMLElementCollection;
ComCheck(spElement->get_children(&spDispatch));
ComCheck(spDispatch.QueryInterface(&spHTMLElementCollection));
long lLength = 0;
ComCheck(spHTMLElementCollection->get_length(&lLength));
cout << strIndent << '<' << strTagName << strClassName << strID;
if(!lLength)
{
CComBSTR bstrInnerText;
ComCheck(spElement->get_innerText(&bstrInnerText));
if(bstrInnerText)
{
cout << '>' << endl
<< strIndent << " " << W2A(bstrInnerText) << endl
<< strIndent << " }
else
{
cout << "/>" << endl;
}
}
else
{
cout << '>' << endl;
CComVariant varName, varIndex;
CComPtr spChildElement;
for(int i=0; i {
spDispatch.Release();
ComCheck(spHTMLElementCollection->item(varName, varIndex,
&spDispatch));

spChildElement.Release();
ComCheck(spDispatch.QueryInterface(&spChildElement));
if(spChildElement)
printElement(spChildElement, nLevel+1);
}
cout << strIndent << " }
}
void print(const CComPtr& spMarkupContainer)
{
log << "-+ Enter print @ " << tmd::timestamp << " +-" << endl << endm;
CComPtr spHTMLDocument2;
ComCheck(spMarkupContainer.QueryInterface(&spHTMLDocument2));
log << "Query interface IHTMLDocument2 from IMarkupContainer OK!" << endl
<<
endm;
CComPtr spBody;
ComCheck(spHTMLDocument2->get_body(&spBody));
printElement(spBody, 0);
log << "-+ Leave print @ " << tmd::timestamp << " +-" << endl << endm;
}
void parse(const char *szFileName)
{
log << "-+ Enter parse @ " << tmd::timestamp << " +-" << endl << endm;
CComPtr spHTMLDocument2;
ComCheck(spHTMLDocument2.CoCreateInstance(CLSID_HTMLDocument));
log << "Create interface IHTMLDocument2 from CLSID_HTMLDocument OK!" <<
endl
<< endm;
CComPtr spPersistStreamInit;
ComCheck(spHTMLDocument2.QueryInterface(&spPersistStreamInit));
log << "Query interface IPersistStreamInit from IHTMLDocument2 OK!" <<
endl
<< endm;
ComCheck(spPersistStreamInit->InitNew());
log << "Initialize interface IPersistStreamInit OK!" << endl << endm;
CComPtr spMarkupServices;
ComCheck(spPersistStreamInit->QueryInterface(&spMarkupServices));
log << "Query interface IMarkupServices from IPersistStreamInit OK!" <<
endl
<< endm;
CComPtr spMkStart, spMkFinish;
ComCheck(spMarkupServices->CreateMarkupPointer(&spMkStart));
ComCheck(spMarkupServices->CreateMarkupPointer(&spMkFinish));
log << "Create interface IMarkupPointer with IMarkupServices OK!" << endl
<<
endm;
ifstream is(szFileName);
stringstream ss;
ss << is.rdbuf();
log << "Read the HTML from " << szFileName << " [size:" << ss.tellp() <<
"]
file OK!" << endl << endm;
CComPtr spMarkupContainer;
ComCheck(spMarkupServices->ParseString(CComBSTR(ss.str().c_str()), 0,
&spMarkupContainer, spMkStart, spMkFinish));
log << "ParseString HTML from " << szFileName << " with IMarkupServices
OK!"
<< endl << endm;
print(spMarkupContainer);
log << "-+ Leave parse @ " << tmd::timestamp << " +-" << endl << endm;
}
int main(int argc, char* argv[])
{
log << "-= begin @ " << tmd::timestamp << " OK =-" << endl << endm;
if(argc == 1)
{
cout << ExtractFileName(string(argv[0])) << " [html filename]" << endl;
return 1;
}
parse(argv[1]);
log << "-= end @ " << tmd::timestamp << " OK =-" << endl << endm;
return 0;
}

Please see the following articles also

Lightweight HTML Parsing Using MSHTML
By Asher Kobin
From www.codeguru.com/Cpp/I-N/ieprogram/article.php/c4385/

Loading and parsing HTML using MSHTML. 3rd way.
By Philip Patrick
http://www.codeproject.com/internet/parse_html.asp

Loading HTML content from a Stream
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/tutorials/webocstream.asp

MSHTML Reference
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/mshtml/reference/reference.asp

IHTMLDocument2 Interface
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/mshtml/reference/ifaces/document2/document2.asp

Monday, December 06, 2004

 

Some open source database

1.
MySQL
http://www.mysql.com/

2.
PostgreSQL
www.postgresql.org/

3.
BerkeleyDB
http://www.sleepycat.com/

4.
Firebird
http://firebird.sourceforge.net/

5.
SimpleSQL is a relational database designed to be extremely simple to use. It is initially written in Java.
http://www.simplesql.org/

6.
SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine.
http://www.sqlite.org/

7.
Minosse© is the first RDBMS (Relational DataBase Management System) entirelly written in C#, a new and flexible coding language.
http://www.minosse.com/

Wednesday, December 01, 2004

 

临江仙

梦后楼台高锁,
酒醒帘幕低垂。
去年春恨却来时,
落花人独立,
微雨燕双飞。

记得小苹初见,
两重心字罗衣。
琵琶弦上说相思。
当时明月在,
曾照彩云归。

This page is powered by Blogger. Isn't yours?