摸不到头脑的vue.js起步

摘了些资料
一、APP.vue 文件结构解读
在这里插入图片描述
<.template><./template>标签包裹的内容:这是模板的HTMLDom结构
<.script><./script>标签包括的js内容:你可以在这里写一些页面的js的逻辑代码。
<.style><./style>标签包裹的css内容:页面需要的CSS样式。

二、关于VUE项目目录结构在这里插入图片描述

展开阅读全文

摸不到头脑的VBA

12-17

大家好,我是一个WEB程序员,做ASP.NET和ASP的。rn对ACCESS数据的程序开发不了解,我有这样的一个需求,想把我现在ACCESS里面的所有结构全部导成JETSQL脚本。在网上我查了好久也没找到怎么做。查到了下面这段VBA脚本,但由于对ACCESS不了解,根本无从下手,请问下面的VBA脚本如何运行呢。rn[code=VBScript]rnFunction CreateSQLString(ByVal FilePath As String) As Booleanrnrn'本函数根据当前MDB中的表创建一个 *.jetsql 脚本rn'这个函数不是最完美的解决方案,因为 JET SQL DDL 语句不支持一些 ACCESS 特有的属性(DAO支持)rn'This function create a "*.jetsql" script based on current mdb tables.rn'This function is not the BEST, because the JET SQL DDL never support some DAO property. rn Dim MyTableName As Stringrn Dim MyFieldName As Stringrn rn Dim MyDB As New ADOX.Catalogrn Dim MyTable As ADOX.Tablern Dim MyField As ADOX.Columnrn Dim prorn Dim iC As Longrn rn Dim strField() As Stringrn Dim strKey As Stringrn Dim strSQL As Stringrn Dim strSQLScript As Stringrn rn Dim objFile, stmFilern Dim strText As StringrnrnOn Error GoTo CreateSQLScript_Errrn rn MyDB.ActiveConnection = CurrentProject.Connectionrn rn For Each MyTable In MyDB.Tablesrn If MyTable.Type = "TABLE" Thenrn '指定表的类型,例如“TABLE”、“SYSTEM TABLE”或“GLOBAL TEMPORARY”或者“ACCESS TABLE”。rn 'ADOX 无法判断该表是否已经被删除,还有两种方式判断,rn '方法一:(用 DAO)rn 'If CurrentDb.TableDefs(strTableName).Attributes = 0 Thenrn '方法二:(在判断 ADOX.Table.Type 的基础上再判定表名)rn 'If Left(MyTable.Name, 7) <> "~TMPCLP" Thenrn rn strSQL = "create table [" & MyTable.Name & "]("rn For Each MyField In MyTable.Columnsrn ReDim Preserve strField(iC)rn strField(iC) = SQLField(MyField)rn iC = iC + 1rn Nextrn strSQL = strSQL & Join(strField, ",")rn '获取当前表的字段信息后立即重新初始化 strField 数组rn iC = 0rn ReDim strField(iC)rn rn '加入键信息rn strKey = SQLKey(MyTable)rn If Len(strKey) <> 0 Thenrn strSQL = strSQL & "," & strKeyrn End Ifrn strSQL = strSQL & ");" & vbCrLfrn strSQLScript = strSQLScript & strSQLrn rn 'Debug.Print SQLIndex(MyTable) 'Never support the INDEX,to be continued...rn '暂未支持 index 脚本,未完待续...rn End Ifrn rn Nextrn rn rn rn Set MyDB = Nothingrnrnrn 'create the Jet SQL Script Filern Set objFile = CreateObject("Scripting.FileSystemObject")rn Set stmFile = objFile.CreateTextFile(FilePath, True)rn stmFile.Write strSQLScriptrn stmFile.Closern Set stmFile = Nothingrn Set objFile = Nothingrnrnrn CreateSQLScript = Truernrn rnrnCreateSQLScript_Exit:rn Exit FunctionrnrnCreateSQLScript_Err:rn MsgBox Err.Description, vbExclamationrn CreateSQLScript = Falsern Resume CreateSQLScript_ExitrnrnEnd FunctionrnrnFunction RunFromText(ByVal FilePath As String)rn'本函数将 CreateSQLScript 生成的 *.jetsql 脚本来生成 mdb 数据库中的表rn'This Function run the "*.jetsql" which is created by CreateSQLScript to create the tables in current mdb database.rnOn Error Resume Nextrn Dim objFile, stmFilern Dim strText As Stringrn Set objFile = CreateObject("Scripting.FileSystemObject")rn Set stmFile = objFile.OpenTextFile(FilePath, 1, False)rn strText = stmFile.ReadAllrn stmFile.Closern Set stmFile = Nothingrn Set objFile = Nothingrn rn Dim strSQL() As Stringrn Dim i As Longrn strSQL = Split(strText, ";" & vbCrLf)rn For i = LBound(strSQL) To UBound(strSQL)rn CurrentProject.Connection.Execute Trim(strSQL(i))rn If Err <> 0 Thenrn Debug.Print "Error SQL is:" & strSQL(i)rn Err.Clearrn End Ifrn NextrnEnd FunctionrnrnFunction SQLKey(ByVal objTable As ADOX.Table)rn'调用 ADOX 生成有关“键”的 JET SQL DDL 子句rn'Reference ADOX and create the JET SQL DDL clause about the "Key"rnrn Dim MyKey As ADOX.Keyrn Dim MyKeyColumn As ADOX.Columnrn Dim strKey As Stringrn Dim strColumns() As Stringrn Dim strKeys() As Stringrn Dim i As Longrn Dim iC As Longrn rn For Each MyKey In objTable.Keysrn rn Select Case MyKey.Typern Case adKeyPrimaryrn strKey = "Primary KEY "rn Case adKeyForeignrn strKey = "FOREIGN KEY "rn Case adKeyUniquern strKey = "UNIQUE "rn End Selectrn rn For Each MyKeyColumn In MyKey.Columnsrn rn ReDim Preserve strColumns(iC)rn strColumns(iC) = "[" & MyKeyColumn.Name & "]"rn iC = iC + 1rn Nextrn ReDim Preserve strKeys(i)rn strKeys(i) = strKey & "(" & Join(strColumns, ",") & ")"rn rn '获取信息后,立即初始化数组rn iC = 0rn ReDim strColumns(iC)rn rn i = i + 1rn Nextrn SQLKey = Join(strKeys, ",")rnEnd FunctionrnrnFunction SQLField(ByVal objField As ADOX.Column)rn'调用 ADOX 生成有关“字段”的 JET SQL DDL 子句rn'Reference ADOX and create the JET SQL DDL clause about the "Field"rnrn Dim p As Stringrn Select Case objField.Typern Case 11rn p = " yesno"rn Case 6rn p = " money"rn Case 7rn p = " datetime"rn Case 5rn p = " FLOAT" 'or " Double"rn Case 72rn 'JET SQL DDL 语句无法创建“自动编号 GUID”字段,这里暂时用rn '[d] GUID default GenGUID() 代替部分功能,详情请看文章rn '如何用JET SQL DDL创建自动编号GUID字段 rn 'http://access911.net/?kbid;72FABE1E17DCEEF3rnrn If objField.Properties("Autoincrement") = True Thenrn p = " autoincrement GUID"rn Elsern p = " GUID"rn End Ifrn Case 3rn If objField.Properties("Autoincrement") = False Thenrn p = " smallint"rn Elsern p = " AUTOINCREMENT(1," & objField.Properties("Increment") & ")"rn End Ifrn Case 205rn p = " image"rn Case 203rn p = " memo" 'Access "HyperLink" field is also a MEMO data type.rn 'ACCESS 的超级链接也是 MEMO 类型的rn Case 131rn p = " DECIMAL"rn p = p & "(" & objField.Precision & ")"rn Case 4rn p = " single" 'or " REAL"rn Case 2rn p = " smallint"rn Case 17rn p = " byte"rn Case 202rn p = " nvarchar"rn p = p & "(" & objField.DefinedSize & ")"rn Case Elsern p = " (Unknown,You can find it in ADOX's help. Please Check it.)"rn End Selectrn rn p = "[" & objField.Name & "]" & prn rn If IsEmpty(objField.Properties("Default")) = False Thenrn p = p & " default " & objField.Properties("Default")rn End Ifrn rn If objField.Properties("Nullable") = False Thenrn p = p & " not null"rn End Ifrn rn rn rn SQLField = prnEnd Functionrnrn'Please copy these code in VBA module and press F5 to run the follow functionrn'请将以下代码 COPY 到 VBA 模块中,然后按 F5 键运行以下两段函数rnFunction RunTest_CreateScript()rn CreateSQLString "c:\temp.jetsql"rnEnd FunctionrnrnFunction RunTest_RunScript()rn delAllTablern RunFromText "c:\temp.jetsql"rnEnd FunctionrnrnFunction delAllTable()rn'在生成新表时先删除数据库中所有的表rn'Delete all table in current mdb.rnOn Error Resume Nextrn rn Dim t As New TableDefrn For Each t In CurrentDb.TableDefsrn If t.Attributes = 0 Thenrn CurrentProject.Connection.Execute "drop table [" & t.Name & "]"rn End Ifrn NextrnEnd FunctionrnrnFunction CreateEGTable()rn CurrentProject.Connection.Execute "create table [表e2]([ID] AUTOINCREMENT(1,1),[URL] memo,[备注] memo,[长整] smallint default 0,[大二进制] image,[日期] datetime,[数字同步复制ID] GUID,[数字字节] byte default 0,[文本50UNICODE 关] nvarchar(50),[文本50UNICODE开] nvarchar(50),[文本50必填是允许空否] nvarchar(50) not null,[小数精度18] DECIMAL(10) default 0,Primary KEY ([ID]))"rnEnd Functionrn rnrn rnrnrn[/code] 论坛

丈二和尚摸不到头脑,向吧友求助...

08-06

先上代码rnrn[code=C/C++]#include rn#include rn#include rn#include rn#include "StringC.h"rn#include "Thread.h"rnrnDWORD WINAPI TransmitFileThread(LPVOID lparam);rnDWORD WINAPI SendMessageThread(LPVOID lparam);rnDWORD WINAPI CommandThread(LPVOID lparam);rnrnint nThread=0;rnEvent tevent("te",0);rnrntypedef struct _PER_IO_DATArnrn OVERLAPPED Overlapped;rn SOCKET csocket;rn WSABUF DataBuf;rn char buffer[1024];rn u_short AcceptType;rn unsigned long len;rn unsigned long OperationType;rn unsigned long dwFlags;rnPER_IO_DATA, *LPPER_IO_DATA;rnrntypedef struct _SEND_IFOrnrn SOCKET csock;rn u_short sendtype;rnSEND_IFO,*LPSEND_IFO;rnrntypedef struct _CMD_IFOrnrn HANDLE handle;rn int nt;rnCMD_IFO,*LPCMD_IFO;rnrnclass IOCPSockrnrnpublic:rn IOCPSock()rn rn sockSvr=NULL;rn hCompletionPort=NULL;rn ListenPort=5000;rn nThread=4;rn WorkThreadCount=IOCPSock::CPUNumberX2();rn rn ~IOCPSock()rn static int CPUNumberX2(void)rn rn SYSTEM_INFO SystemInfo;rn GetSystemInfo(&SystemInfo);rn return SystemInfo.dwNumberOfProcessors*2;rn rn int Init(void)rn rn int err;rn wVersionRequested=MAKEWORD(2,2);rn err=WSAStartup(wVersionRequested,&wsaData);rn if (err!=0)rn rn printf("error\n");rn return GetLastError();rn rn if (LOBYTE(wsaData.wVersion)!=2||HIBYTE(wsaData.wVersion)!=2)rn rn printf("error\n");rn WSACleanup();rn return GetLastError();rn rn return 1;rn rn int CreateSock(void)rn rn sockSvr=WSASocket(AF_INET,rn SOCK_STREAM,rn 0,rn 0,rn 0,rn WSA_FLAG_OVERLAPPEDrn );rn if(INVALID_SOCKET==sockSvr)rn rn printf("error\n");rn return GetLastError();rn rn return 1;rn rn void SetListenPort(short n)rn rn ListenPort=n;rn rn int Bind(void)rn rn SOCKADDR_IN addrSvr;rn ZeroMemory(&addrSvr, sizeof(SOCKADDR_IN));rn addrSvr.sin_family = AF_INET;rn addrSvr.sin_port = htons(ListenPort);rn addrSvr.sin_addr.S_un.S_addr = htonl(INADDR_ANY);rn int nRet = bind(sockSvr, (SOCKADDR*)&addrSvr, sizeof(SOCKADDR));rn rn if(SOCKET_ERROR == nRet)rn rn printf("error\n");rn return GetLastError();rn rn return 1;rn rn int Listen(short port=5000,int MaxListen=500)rn rn int nRet = listen(sockSvr, MaxListen);rn if(SOCKET_ERROR == nRet)rn rn printf("error\n");rn return GetLastError();rn rn return 1;rn rn int CreateIOCompletionPort(void)rn rn hCompletionPort = CreateIoCompletionPort(rn INVALID_HANDLE_VALUE, rn NULL, rn NULL, rn 0rn );rn if(hCompletionPort==NULL)rn rn printf("error\n");rn return WSAGetLastError();rn rn return 1;rn rn int CreateWorkThread(void *WorkThreadName,int ThreadCount=0)rn rn DWORD dwThreadID = 0;rn int i=0;rn nThread=(ThreadCount!=0)?ThreadCount:WorkThreadCount;rn for(i=0; icsocket = sockAccept;rn pOlp->dwFlags = 0;rn pOlp->DataBuf.buf = pOlp->buffer;rn pOlp->DataBuf.len = 1024;rn pOlp->AcceptType=0;rn pOlp->OperationType = FD_READ;rn rn nRet = WSARecv(pOlp->csocket, rn &pOlp->DataBuf, rn 1, rn &pOlp->len, rn &(pOlp->dwFlags), rn &(pOlp->Overlapped), rn NULLrn );rn if(SOCKET_ERROR == nRet)rn rn if(WSAGetLastError() != ERROR_IO_PENDING)rn rn return WSAGetLastError();rn rn rn rn return true;rn rn int CloseIOCompletionPort(void)rn rn PER_IO_DATA ol;rn ol.OperationType=0xFFFF;//FD_CLOSE;rn for(int i=0; i 论坛

没有更多推荐了,返回首页