Time of Update: 2018-12-04
今天效率需要,需要搞定一個多線程的程式,今天我用的關鍵字是Monitor.Enter(this);和Monitor.Exit(this);來說一下到底鎖的是什麼,之前對java中的同步關鍵字理解的應該還算可以,鎖的時候永遠鎖的是對象,所以也只有這些線程是在這個物件範圍內操作,並且遇到這個關鍵字才能起到同步的效果。先來一個同步起作用的例子,然後再來一個相反的例子來找個反面典型。 using System;using System.Collections.Generic;using System.
Time of Update: 2018-12-04
今天學java,裝了jdk6,用editplus配置了下環境,在看網易的視頻時,留心了下自加操作的區別.C++ 編譯器:Dev-cpp 4.9.9.2C++程式:#include<iostream>using namespace std;int main(){ int i=3; int count; count=(i++)+(i++)+(i++); cout << i << endl << count; system(
Time of Update: 2018-12-04
今天用sql2005,附加資料庫遇到這個錯誤...ITLE: Microsoft SQL Server Management Studio Express------------------------------附加資料庫時出錯。有關詳細資料,請單擊“訊息”列中的超連結。------------------------------BUTTONS:OK------------------------------TITLE: Microsoft SQL Server Management
Time of Update: 2018-12-04
public override void VerifyRenderingInServerForm(Control control) { //base.VerifyRenderingInServerForm(control); }private void Export(GridView gvUser, string Style, string FileType, string FileName) { Response.ClearContent();
Time of Update: 2018-12-04
將人民幣的數字表示轉化成大寫表示(C#版) chenyu001 [收藏] 關鍵字 .net出處 將人民幣的數字表示轉化成大寫表示(C#版) 實在沒有什麼好講的,就是一個方法,大家拿去用吧using System;namespace Test.Com{ /// <summary> /// 功能:字串處理函數集 /// </summary> public class
Time of Update: 2018-12-04
C++的容器大多數都是自動排序的,所以你使用這些容器時,你加入的元素類型必須是可以比較大小的,如果不是,則需要自訂定序,例如你自訂的結構體:#include <iostream>#include <set>using namespace std;struct ju{int id,x,y;bool operator <(const ju &a)const //排序並且去重複{if(id==a.id){if(x==a.x) return
Time of Update: 2018-12-04
使用反射FileInfo file=new FileInfo(Path.Combine(Application.StartupPath,@"C:/Documents and Settings/greatsft/案頭/test/Testdll/bin/Debug/Testdll.dll")); if(file.Exists) { try { Assembly ass=Assembly.LoadFrom(file.FullName); Type[]
Time of Update: 2018-12-04
(一)INIFile.cs using System;using System.Runtime.InteropServices;using System.Text;namespace CreateWebDir{ /// <summary> /// INIFile 的摘要說明。 /// </summary> public class INIFile { public string path; public INIFile(string
Time of Update: 2018-12-04
C# 使用者經常提出兩個問題:“我為什麼要另外編寫代碼來使用內建於 Windows 中的功能?在架構中為什麼沒有相應的內容可以為我完成這一任務?”當架構小組構建他們的 .NET 部分時,他們評估了為使 .NET 程式員可以使用 Win32 而需要完成的工作,結果發現 Win32 API 集非常龐大。他們沒有足夠的資源為所有 Win32 API 編寫託管介面、加以測試並編寫文檔,因此只能優先處理最重要的部分。許多常用操作都有託管介面,但是還有許多完整的 Win32 部分沒有託管介面。
Time of Update: 2018-12-04
System.IO.FileStream fs=new System.IO.FileStream(lstFile.Text,System.IO.FileMode.Open,System.IO.FileAccess.Read); long lngPos=fs.Seek(-128,System.IO.SeekOrigin.End); byte[] bInfo=new
Time of Update: 2018-12-04
1、DateTime 數字型 System.DateTime currentTime=new System.DateTime(); 1.1 取當前年月日時分秒 currentTime=System.DateTime.Now; 1.2 取當前年 int 年=currentTime.Year; 1.3 取當前月 int 月=currentTime.Month; 1.4 取當前日 int
Time of Update: 2018-12-04
object missing = System.Reflection.Missing.Value;object savech=WdSaveOptions.wdDoNotSaveChanges ;mydoc=wordApp.Documents.Open(ref myobj,ref missing,ref myfalse,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref missing,ref
Time of Update: 2018-12-04
在C#中使用非同步Socket編程實現TCP網路服務的C/S的通訊構架(二)----使用方法 一.TcpSvr的使用方法A.測試程式:using System;using Ibms.Net.TcpCSFramework;using System.Collections;using System.Net.Sockets;namespace Ibms.Test{ /// <summary> /// 測試TcpSvr的類 /// </summary> public
Time of Update: 2018-12-04
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;using System.Net;namespace XcDownLoadFile{ public class DownLoadFile { /// /// 下載檔案方法 /// /// 檔案儲存路徑和檔案名稱 ///
Time of Update: 2018-12-04
1.XmlString轉化成實體類對象XmlString轉化成實體類對象即XML的解析並給實體類賦值。比如,將XMl解析並產生Cost實體類:public static object GetCosts(string xmlString) { Model.COSTS myCosts = new COSTS(); //Xml解析 XmlDocument doc = new XmlDocument();
Time of Update: 2018-12-04
1. 今天寫程式,寫了這樣一行代碼:char * pArr[10] = new char[20]; 後來發現這樣寫是不對的。= 號左邊是char** 類型的,右邊是char*類型的,不可以賦值的。也不可以這樣寫: char * pArr[10]={new char[20]}; 這樣只是對數組裡的第一個元素裡的指標初始化了記憶體地區,其他9個元素沒有被分配記憶體。這裡可以在花括弧裡寫10個“new
Time of Update: 2018-12-04
驚豔的效果還在繼續,第二章開始講到了一些基本的傳統的(但是我居然還是不知道的)技法,利用模板的編譯特殊編譯特性帶來了些新的協助。有印象的東西就是Compile-time assertions,
Time of Update: 2018-12-04
套用一個現在很流行的句式,(好多什麼編程之美或者代碼之美的)。我想看了第三章Modern C++ Design能感受的就是遞迴之美。而其中主要介紹的TypeList就是這樣一個遞迴演繹的完美的例子。其實TypeList本身的定義非常簡單。就是一個有Head有Tail的一個簡單的空的定義template struct Typelist { typedef T Head; typedef U Tail;
Time of Update: 2018-12-04
Chapter 12 OOP Using C++• 12.1 OOP LanguageRequirements• 12.2 ADTs in Non-OOPLanguages• 12.3 Clients andManufacturers• 12.4 Reuse andInheritance• 12.5 Polymorphism• 12.6 LanguageComplexity• 12.7 C++OOPB andwagon• 12.8 Platonism: TabulaRasa Design• 1
Time of Update: 2018-12-04
編寫並測試3*3矩陣轉置函數,並使用數組儲存3*3矩陣。演算法:先在主函數中定義一個二維數組,然後通過print函數來完成輸出功能,這是通過喜歡來完成的,然後就是轉置,轉置時可以通過一個輔助數組來完成,先把距陣中的值傳到此輔助數組中,然後把i行j列中的值傳到j行i列中即可完成。代碼:#include<iostream.h>void main(){ int