置顶随笔
#
2006年7月19日
#
I have tried several ways which are used to work for VCL application but no success. So I was wondering how a .Net application use help file written in CHM? By searching in CNBLOGS, I found the article
如何通过C#调用CHM帮助文件. So I wrote a test VCL.Net application which have a menu item named "PMOHelp1", its click event handler as below:
procedure TFormMain.PMOHelp1Click(Sender: TObject);
begin
Help.ShowHelp(System.Windows.Forms.Form.Create ,
Borland.Vcl.Forms.Application.HelpFile )
end;
because Help.ShowHelp requires a control within System.Windows.Forms namespace, so the code just create a unnamed WinForm's Form(which is different from VCL's Form). VCL/VCL.Net application can store its help file's name in the global variable Application's property "HelpFile", but because there is also an Application variable in WinForm, so the code needs to point out which one it should use.
Above just another example shows that VCL.Net can coexist or can take advantage of WinForm's technic very well.
2006年7月14日
#
Here comes a solution:
For each import sheet:
1. Copy the sheet inot a temp table in the database(SQL Server)
2. Run distribution SQL scripts to distribute the data from the temp table into other existing table
3. Drop tem table
Base on above solution, for any import job, only the scripts need to be changed to do the distribution.
This solution is providing convenience to the developer not to the end user. Developer can build a seperated tool to do the import job. The tool needs some information to do the import job:
1. How to connect to the destination database
2. Which import job? This infomation is used to identify the corresponding SQL scripts need to be run.
3. File name of the excel file which hold the data to be imported
The destination database must be specified by the end user, so this info is gained by interactive with the end user. Same as the file name. The tool needs a configuration file to hold the scripts for all import jobs. XML can be one of the candidates. A simple one will look like below:
<?xml version="1.0" encoding="UTF-8"?>
<OMCSInternational>
<Import name="Import Task" DB="SQLServer">
<FromExcel>
<Sheet name="sheet1" temptable = "ImportHelpTask">
<Distribution id="ImportInterval" name="Import Intervals" order="1">
insert into [Interval]([Interval] ) select distinct [Interval] from ImportHelpTask where [Interval] not in (select [Interval] from [Interval])
</Distribution>
<Distribution id="ImportTrade" name="Import Trades" order="2">
...
</Distribution>
</Sheet>
</FromExcel> sheet="sheet1"/>
</Import>
<Import name="Import Equipment" DB="SQLServer">
...
</Import>
</OMCSInternational>
In conclusion, the tool lists all it supports import task, when end user selects a task and provides a excel sheet as well as the info to connect to the databse, it will import the data in the sheet base on the scripts.
2006年7月12日
#
After some research on the internet, I found a lot articles regarding "Import data from Excel to database". There are a few ways to transfer data from an Excel sheet to a table in a database, the only problem is those articles only explain them in pure technical point of view, i.e. how to make the connection to Excel sheet, etc. None of them provides a solution from application's point of view. For example, my application needs to import user's historical data from Excel sheets which is a match of the logical view of the database. Because of these, the application can not just copy each indivisual column from Excel sheet into the corresponding field of tables in the database. It needs to do something like "look up" and "calculating". This is a common task within our products. I am going to find some existing modules/code/component.
2006年7月3日
#
一直都用CVS,没有什么大问题,只是觉得有些地方不大好用,比如移动文件的位置。据CVS自己的文档说,这种变动需要手工完成。不记得从哪里查得Subversion支持这种变动,便一直想试试,苦于找不到机会。趁今日有空,着手安装再试试看是否有此项功能。
找到Subversion 的 book (
http://svnbook.red-bean.com/nightly/en/index.html)并下载它的1.3.2的Windows安装EXE。执行并一路Next。 安装时没有选创建桌面等快捷,所以找不到地方启动。看看book吧。
在book的A Quick Start中有一段:
$ svnadmin create /path/to/repos
$ ls /path/to/repos
conf/ dav/ db/ format hooks/ locks/ README.txt
我虽然用的是Windows,不过也许也是用command line也说不定。打开cmd,敲入svnadmin,果然有反应,看来是要用
command line 了。那就照book说的先建一个新的repository吧. 运行svnadmin create g:\SubRepo.
不过从上面的例子来看,它只是访问本地的repository,那remote的怎么访问呢?
看book中提到svnserver,想必要运行它。运行svnserver -d --listen-port=8080 --root=g:\后,打开TortoiseSVN,
用“file:///G:/SubRepo”的形式能访问到上面建立的repository,但用http://localhost:8080不能访问?!也许是我
的TortoiseSVN太老了(我记得是去年装的!),下一个最新的试试了。
在新的TortoiseSVN里输入http://localhost:8080也还是得到“Error * Propfind request..."的错误。到Google里
查这个错误,建议我读Server Configuration那一章,一读,发现应该使用svn://localhost:8080,如果server使用
svnserve 的话!果然改用svn://后就可以访问repository了。
接下来,赶紧import一个工程,checkout它,在IDE里把一个文件另存到一个新的子目录下,关闭工程。到TortoiseSVN里去
commit,不好,不让,说是Authorization failed.
刚才看server configuration是好像看到关于Authorization的东西在它的repository目录下,到那里去看一下吧。
在SubRepo的conf目录下,确有三个文件,这三个文件里的内容就是控制subversion的用户如何存取repository的。做相应的
调整后,TortoiseSVN果然可以进行写操作了。如果你对repository里的文件进行移动,那么单更新checkout的工程时,工程
里的文件也会做相应的移动。这正是我要的!
有空还需要看看如何让subversion服务器发出email通知相关的项目人员。
2006年6月27日
#
1、
http://support.microsoft.com/kb/q288095/Queries that contain a large number of arguments (thousands) inside an IN or a NOT IN clause, may generate a stack overflow。
2005年10月28日
#
摘要: 日前发现一个很好的树状数据的算法[http://www.sitepoint.com/print/hierarchical-data-database,作者Gijs Van Tulder],想对它做些补充。在这篇文章中已对单个节点的操作做出了详细说明,但未提到对分支的操作如移动、复制和删除。在这里我试图对此作一些拓展,使之更易懂、更完善。首先,我们总结一下这个算法的精髓。这个算法实际上是把象树这样一...
阅读全文
2005年9月22日
#
摘要: 公司搬完家后,不知为何,用WinCVS访问CVSNT变得时好时坏,就是时快时慢,大部分时间都很慢很慢。 今天终于忍无可忍,决定看一看能不能找到问题。 于是在自己的机器上装一个CVSNT,看看是不是服务器有问题。折腾半天,好不容易让自己连上了,check in/check out, 再diff等等果然很快。再让同事试连一下,竟怎么也练不上!!!恼火!不试了。想到以前在server上有装过WinCVS...
阅读全文
2005年9月10日
#
摘要: DELPHI.NET 可以开发VCL.NET Application, 也可以开发WinForm Application。不过我发现,其实这两种Application是可以做到“你中有我,我中有你”的!也就是说在一个Application中,既可以有VCL.NET Form 也可以有WinForm Form,他们可以互相调用、传递参数。实验如下:1、建立一个VCL.NET ...
阅读全文