- 博客(27)
- 收藏
- 关注
原创 Simple Winsock select-modal server
void AppMain(int argc, TCHAR* argv[], TCHAR* envp[]){ int PortNo = 12345; SOCKET ListenSock; int Ret = 0; WSAData wsa; if ((Ret = WSAStartup(MAKEWORD(2,0), &wsa)) != 0)
2008-03-26 11:22:00 659
原创 MFC Ocx: Using ActiveX Controls in Nondialog Windows
Using ActiveX Controls in Nondialog WindowsMFC and ClassWizard make it wonderfully easy to use ActiveX controls in dialogs, but what about nondialog windows? It turns out that MFC allows any CWnd obje
2008-03-15 12:58:00 1192
转载 Return multiple dataset
// (1) OleDbDataAdapter da = new OleDbDataAdapter( "select * from jobs;select * from employee", //invalid OLE DB SQL ? "provider=Microsoft
2008-03-15 11:40:00 607
原创 SQL Server 2005 error handling
Extract from : SQL Server Error Handling Workbenchhttp://www.simple-talk.com/sql/t-sql-programming/sql-server-error-handling-workbench/--Catch Error:--=============================================BEGI
2008-03-11 09:48:00 755
原创 Improve performance using hash keys
use CheckSum function to turn a string key to a hash key(integer), this will improve performance
2008-03-11 09:40:00 544
原创 Compare 2 string with case sensitive
Select * from test where convert(varbinary, column1) = convert(varbinary, ABCD)
2008-03-11 09:35:00 622
原创 CSharp download (html, binary file)
download html : WebRequest/WebResponsedownload bin file: WebClient
2008-03-11 09:33:00 844
原创 How to use SubVersion (Import/Checkout)
how to use SVN1)select a native window folder "Import" to SVN, but the native folder is not linked to SVN2)remove the natie folderIn SVN Explorer, use "checkout" to local dir(which will link local fol
2008-03-11 09:31:00 633
原创 MFC how to handle ocx event
Insert ActiveX control in a dialog resource, and add event handler with wizard, then copy the macro/event codeto your project.ON_EVENT/ DataExchange....
2008-03-11 09:30:00 606
原创 Add remove window services
Install/Uninstall .Net wizarded window service : InstallUtil.exegeneral Add/Delete: sc.exe
2008-03-11 09:23:00 630
原创 CSharp restart program
start a new instance of the program and close the old one Process.Start(Application.ExecutablePath,Process.GetCurrentProcess().Id.ToString());this.Close();
2008-03-11 09:22:00 606
原创 MFC Macro
DECLARE_DYNAMIC/IMPLEMENT_DYNAMIC: use CObject::IsKindOf DECLARE_EVENTSINK_MAP/BEGIN_EVENTSINK_MAP/END_EVENTSINK_MAP: OLE container event sink (accept control event)DECLARE_MESSAGE_MAP/BEGIN_MESSAGE_M
2008-03-11 09:18:00 689
原创 MFC handle user defined message
----------------------------------1)#define WM_MYMESSAGE1 WM_USER + 1000----------------------------------2)protected: afx_msg LRESULT OnMyMessage1(WPARAM wParam, LPARAM lParam);LRESULT CMFCTest1Vi
2008-03-08 23:37:00 803
原创 Right click to open cmd.exe
1) open window explorer2) Tools -> Folder Options.3) File type tab4) Choose Folder file type5) Click Advanced6) Click New7) In "Action" Box: input "command" (this will be shown when you right click)8)
2008-03-02 12:09:00 863
原创 SQL read MS access(*.mdb)
select CustID, CustName from openrowset(Microsoft.Jet.OLEDB.4.0, C:/trade.mdb;Admin;, Customer)
2008-03-02 11:56:00 604
原创 SQL tree data struct(7): find the minimal cost route
-- find the minimal cost routecreate table flights(departure char(20), destination char(20), cost int)insert flights select Chicago, New York, 10 unionselect Chicago, Milwaukee, 20 unionselect
2008-03-02 11:54:00 818
原创 SQL tree data struct(5): AdjList2NestedSet
/*The organizational chart would look like this as a directed graph: Albert (1,12) / / / / Bert (2,3) Chuck (4,11) / | /
2008-03-02 11:52:00 865
原创 SQL tree data struct(6): NestedSet2AdjList
declare @personnel table(emp varchar(30), lft int, rgt int)insert @personnelselect Albert, 1, 12union all select Bert, 2, 3 union all select Chuck, 4, 11 union all select Donna, 5, 6 union all
2008-03-02 11:52:00 969
原创 SQL tree data struct(4): AdjList2MatPath (for printing tree struct)
if object_id(proc_print_tree) is not null drop procedure proc_print_treegocreate procedure proc_print_tree @raw_data_sql nvarchar(1000), @debug bit = 0with encryptionas if object_id(tempdb..#
2008-03-02 11:51:00 862
原创 SQL tree data struct(3): nested set (1,12) include (2,3) & (4, 11) ...
-- Credit to JOE CELKO-- http://archives.postgresql.org/pgsql-sql/2001-11/msg00004.php-- CREATE TABLE Personnel -- (emp CHAR(10) NOT NULL PRIMARY KEY, -- lft INTEGER NOT NULL UNIQUE CHECK (lft > 0
2008-03-02 11:49:00 840
原创 SQL tree data struct(2): materialized path (1.2.3...)
/*then materialized path representation of tree is easy to output: order by path, level*/declare @orgchart table (emp varchar(30), path varchar(100))insert @orgchartselect Albert, 1union all selec
2008-03-02 11:47:00 986
原创 SQL tree data struct(1): adjacency list (id, parentid)
declare @tree table(emp varchar(30), boss varchar(30))insert @treeselect Albert, NULLunion all select Bert, Albertunion all select Chuck, Albertunion all select Donna, Chuckunion all sel
2008-03-02 11:46:00 669
原创 clear sql server object by name
if object_id(clearobj) is not null drop proc clearobjgocreate proc clearobj @obj nvarchar(50), @debug int = 0with encryptionas declare @sql nvarchar(256) select @sql = drop + case (s
2008-03-02 11:44:00 553
原创 SQL & Regex(4): usage
-- ========================================================================exec clearobj DFA_simulate, 1gocreate proc DFA_simulate @str nvarchar(100), @match bit outputwith encryptionasdeclare @i
2008-03-02 11:40:00 597
原创 SQL & Regex(3): subset construction
-- Subset Construction: convert NFA to DFA-- require: NFA_trans_table is filled with NFA state data-- ========================================================================exec clearobj DFA_states
2008-03-02 11:39:00 722
原创 SQL & Regex(2): thompson construction
-- Thompson Construction : convert Regular Expression Parse Tree to NFA-- require: parse_node table is filled with tree-struct data-- ==================================================================
2008-03-02 11:38:00 651
原创 SQL & Regex(1): parse tree
-- convert regular expression string to parse treeif object_id(clearobj) is not null drop proc clearobjgocreate proc clearobj @obj nvarchar(50), @debug int = 0with encryptionas declare @sql nvarc
2008-03-02 11:37:00 1058
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人