前幾天發現一個有趣的專案: Hashgen, http://www3.sympatico.ca/vladimir.shiryaev/hashgen/
編譯之後
發現它是一個可以把字典檔變成 C/C 的 Hash 搜尋 function / Class.
產生出來的原始碼效率很好!
看過程式以後,了解他首先把字典檔變為陣列,再找出適當的 Hash 大小,並宣告陣列來存放 Hash 的資料,也因此效率很好~~
用法很簡單
1.先建立字典檔.一行一個單字,命名為 mydict,如
the
pencil
pen
keyword
…
2.執行 hashgen -T testme.c -o myhash.h mydict 之後,就會產生 testme.c 和 myhash.h 了,此時你就可以進行編譯.
如果要產生 C 的 code, 就用 hashgen -T testme.c -l c -o myhash.h mydict
這裡介紹的只是一個簡單的用法,裡面還有更多參數,可以讓你指定 hash value…等等的~
更進階的用法:
你也可以在字典檔中指定 hash value
用法是使用 [ declarations ] 和 [ entries ] 這 2 個 section
如
[ options ]
entry-struct-name=TokenEntry
[ declarations ]
struct TokenEntry {
const char* name;
const char* value;
};
[ entries ]
pen, “this is my pen”
pencil, “this is my pencil”
book, “this is my book”
限制:
雖說 key 的字串長度,可以無限長,但在此只有前 32 個字元會被用來 hashing.
當 keyset 大於 3000 個的時候,有可能會因此而變慢.
目前還沒有想到比較好的應用方法
似乎只適合用在字典固定的場合,而不適用於動態增加的場合.
VFP Toolkit for Visual Studio.NET
其實他根本就是一個 wrapper
把 .net 的 code 給包裝起來
看起來的確變的很類似 vfp
但實際上宣告變數以及語法仍然遵循 c# 或 vb.net
而非原來的 vfp
不過文件上說的沒錯
他提供了絕大部分的 vfp 函數
可是~
存取資料時
仍然要使用 sqlconnect
而不是 use
也因此沒有索引的功能
但有提供索引搜尋跟切換索引的功能
只是這些東西仍然依存於 .net dataview 元件的能力
換言之
如果要細調其執行效能
恐怕仍然需要了解 .net ado.net
source code 很有幫助,並不是很困難
建議也下載回去看
對上手 .net 有相當的助益
VFP OLEDB Drivers How-To
限制:
以6.0而言,似乎一定要用 ado 來開啟
範例:
OConn = CREATEOBJECT(“ADODB.Connection”)
OConn.ConnectionString = “provider=vfpoledb.1;;
data source=.\testdbc.dbc”
OConn.Open
語法:
Provider = VFPOLEDB
Data Source=cPath
Specifies the path to the Visual FoxPro database or folder containing free tables. For example, d:\vfp7\samples\data\testdata.dbc
Mode=cMode
Specifies one of the following: Read, ReadWrite, Share Deny None (default), Share Deny Read, Share Deny Write, Share Exclusive (inclusive of the previous two modes).
可以丟如下指令
The Visual FoxPro OLE DB Provider supports the native Visual FoxPro language syntax for the following commands:
CREATE TABLE – SQL Command
Creates a table having the specified fields.
DELETE – SQL Command
Marks records for deletion.
DROP TABLE Command
Removes a table from the database specified with the data source and deletes it from disk.
INSERT – SQL Command
Appends a record to the end of a table that contains the specified field values.
SELECT – SQL Command
Retrieves data from one or more tables.
UPDATE – SQL Command
Updates records in a table with new values.
The Visual FoxPro Language Reference contains detailed information about the following supported commands:
ALTER TABLE – SQL Command
Programmatically modifies the structure of a table.
CREATE TABLE – SQL Command
Creates a table having the specified fields.
Using Data Definition Language (DDL)
You cannot include DDL in the following places:
In a batch SQL statement that requires a transaction
Following a previously executed statement that required a transaction if not in auto-commit mode and if your application has not yet called SQLTransact.
For example, if you want to create a temporary table, you should create the table before you begin the statement requiring a transaction. If you include the CREATE TABLE statement in a batch SQL statement that requires a transaction, the provider returns an error message.
DELETE – SQL Command
Marks records for deletion.
DELETE TAG Command
Removes a tag or tags from a compound index (.cdx) file.
DROP TABLE Command
Removes a table from the database specified with the data source and deletes it from disk.
INDEX Command
Creates an index file to display and access table records in a logical order.
INSERT – SQL Command
Appends a record to the end of a table that contains the specified field values.
SELECT – SQL Command
Retrieves data from one or more tables.
The Visual FoxPro OLE DB Provider supports the native Visual FoxPro language syntax for this command.
SET ANSI Command
Determines how comparisons between strings of different lengths are made with the = operator in Visual FoxPro SQL commands.
SET BLOCKSIZE Command
Specifies how disk space is allocated for the storage of memo fields.
SET COLLATE Command
Specifies a collation sequence for character fields in subsequent indexing and sorting operations.
SET DELETED Command
Specifies whether records marked for deletion are processed and whether they are available for use in other commands.
SET EXACT Command
Specifies the rules for comparing two strings of different lengths.
SET EXCLUSIVE Command
Specifies whether table files are opened for exclusive or shared use on a network.
SET NULL Command
Determines how null values are supported by the ALTER TABLE – SQL, CREATE TABLE – SQL, and INSERT – SQL commands.
SET PATH Command
Specifies a path for file searches.
Provider Remarks
If you issue SET PATH in a stored procedure, it will be ignored by the following functions and commands: SELECT, INSERT, UPDATE, DELETE, and CREATE TABLE
If you issue SET PATH in a stored procedure and do not subsequently set the path back to its original state, other connections to the database will use the new path (because SET PATH is not scoped to data sessions).
If you want to create, select, or update tables in a directory other than that specified by the data source, specify the full path of the file with your command.
SET REPROCESS Command
Specifies how many times or for how long to lock a file or record after an unsuccessful locking attempt.
SET UNIQUE Command
Specifies whether records with duplicate index key values are maintained in an index file.
UPDATE – SQL Command
Updates records in a table with new values.
C++ ABI
ABI 是 Application Binary Interface, 它是一種介於使用者 C++ 程式碼和提供實作系統和 library 的物件程式碼.
這包含了 C++ 資料物件的記憶體配置,包含先行定義和使用者定義的資料型態,也包含了內部 Compiler 產生的物件,如: virtual tables.
它也包含了函數呼叫介面,例外處理介面,全域名稱空間和多樣物件程式碼的協定.
GCC 將在 3.2 版以後為編譯器提供此功能~