Time of Update: 2018-12-04
轉自:http://hi.baidu.com/luckymouse2009/blog/item/80042808ee129da62fddd47e.html C++ IO標準庫 檔案操作2009-07-01 14:23寫一個在一個流中同時讀寫檔案的小程式string login , user;fstream logfile("log.dat",fstream::in | fstream::out | fstream::trunc); if (!logfile){
Time of Update: 2018-12-04
驗證Email格式的主要代碼如下: public bool IsEmail(string str_Email) { return System.Text.RegularExpressions.Regex.IsMatch(str_Email, @"^([/w-/.]+)@((/[[0-9]{1,3}/.[0-9] {1,3}/.[0-9]{1,3}/.)|(([/w-]+/.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(/)?]$");
Time of Update: 2018-12-04
今天碰到一個很奇怪的現象,先貼下代碼給大家看看 int s = 0; for (int i = 0; i > sites.Count ; i++) { if (sites[i-1].direct == e.Node.Text) {
Time of Update: 2018-12-04
對於普通類型的對象來說,它們之間的複製是很簡單的,例如: int a=100; int b=a; 而類對象與普通對象不同,類對象內部結構一般較為複雜,存在各種成員變數。下面看一個類對象拷貝的簡單例子。 #include <iostream>using namespace std;class CA{ public: CA(int b) { a=b; } void Show () { cout<<a<<endl;
Time of Update: 2018-12-04
能整理大部分無用檔案 #!/usr/bin/python#syscleaner.pyimport osimport os.path#delete files and directory recursivelydef itedel(dir): print('in dir :'+dir) for doc in os.listdir(dir): try: if(os.path.isdir(doc)): itedel(dir+
Time of Update: 2018-12-04
Item 31: 最小化檔案之間的 compilation dependencies(編譯依賴)作者:Scott Meyers譯者:fatalerror99 (iTePub's Nirvana)發布:http://blog.csdn.net/fatalerror99/你進入到你的 C++ 程式中,並對一個 class 的 implementation(實現)進行了細微的改變。提醒你一下,不是 class 的 interface(介面),只是 implementation(實現),僅僅是
Time of Update: 2018-12-04
普通類對象的記憶體布局首先我們從普通類對象的記憶體布局開始。C000為一個空類,定義如下:struct C000{}; 運行如下代碼列印它的大小及對象中的內容。PRINT_SIZE_DETAIL(C000) 結果為:The size of C000 is 1The detail of C000 is cc
Time of Update: 2018-12-04
C++中,成員指標是最為複雜的文法結構。但在事件驅動和多線程應用中被廣泛用於調用回叫函數。在多線程應用中,每個線程都通過指向成員函數的指標來調用該函數。在這樣的應用中,如果不用成員指標,編程是非常困難的。 剛遇到這種文法時也許會讓你止步不前。但你會發現,使用恰當的類型定義之後,複雜的文法是可以簡化的。本文引導你瞭解成員函數指標的聲明,賦值和調用回叫函數。 成員函數指標的聲明
Time of Update: 2018-12-04
這是這個星期裡我比較頭大的兩個問題,一個一個說ArrayList是C#提供的一個動態數組類,用法類似std::list,但是他的核心結構是C#的Array類,所以繼承了Array的大部分方法。如果你用過迭代的方法刪除數組中的元素,比如下面:foreach (int sub in m_listTempArray){ if (sub == 1)
Time of Update: 2018-12-04
參考http://blog.csdn.net/aofengdaxia/article/details/5890464using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace
Time of Update: 2018-12-04
05年開始關注C++0x,其時C++0x的大部分草案其實都已經初具雛形。但幾個重大的特性:concepts, rvalue, memory-model, variadic-templates等都還在激烈的動蕩當中。於是一路看著這些特性不斷成長,不斷出revisions。其間也跟標準委員會中的一些大牛們,如Peter Dimov, Doug Gregor, Clark
Time of Update: 2018-12-04
1.HashMap does not exist in the c#。2.From the MSDNusing System;using System.Collections;class Example{ public static void Main() { // Create a new hash table. // Hashtable openWith = new Hashtable(); // Add some
Time of Update: 2018-12-04
1,set的含義是集合,它是一個有序的容器,裡面的元素都是排序好的,支援插入,刪除,尋找等操作,就 像一個集合一樣。所有的操作的都是嚴格在logn時間之內完成,效率非常高。 set和multiset的區別是:set插入的元素不能相同,但是multiset可以相同。 建立 multiset<ss> base; 刪除:如果刪除元素a,那麼在定義的比較關係下和a相等的所有元素都會被刪除 base.count( a
Time of Update: 2018-12-04
using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.Drawing;
Time of Update: 2018-12-04
c# 裡 建立臨時的 dataset 用於臨時儲存資料 DataSet temp_ds = new DataSet() 在 PageLoad 外邊 #region 臨時儲存 New DataSet //DataSet temp_ds = new DataSet(); DataTable temp_dt = new DataTable(); temp_dt.Columns.Add("temp1");//
Time of Update: 2018-12-04
net中前台javascript與後台c#函數相互調用問題C#代碼與javaScript函數的相互調用問:1.如何在JavaScript訪問C#函數?2.如何在JavaScript訪問C#變數?3.如何在C#中訪問JavaScript的已有變數?4.如何在C#中訪問JavaScript函數?問題1答案如下:javaScript函數中執行C#代碼中的函數:方法一:1、首先建立一個按鈕,在後台將調用或處理的內容寫入button_click中;
Time of Update: 2018-12-04
用C#寫winform,將EXCEL檔案中的資料寫入資料庫中,將DataGrid中的資料匯出為EXCEL格式。最後發現EXCEL記憶體流失,在應用程式不退出的情況下,總是有一個EXCEL進程不能清除!在網上找了許多答案,都是無用的答案!什麼不管三七二十一殺EXCEL進程啦,不是最有效方法!其實最有效方法就是下面這個方法: 1、對excel操作做成一個函數,然後調用此函數。在函數中調用GC.Collect();無用,因為GC不回收調用自己的那一段代碼塊!2、在函數的下面調用GC.Collect()
Time of Update: 2018-12-04
當前程式所在的檔案夾 System.IO.Directory.GetCurrentDirectory()顯示指定檔案夾下的檔案 if(this.textBox1.Text.Trim()=="") return;this.listBox1.Items.Clear();string[]
Time of Update: 2018-12-04
C#使用ConfigurationManager類操作設定檔 .net1.1中如果需要靈活的操作和讀寫設定檔並不是十分方便,一般都會在項目中封裝一個配置 檔案管理類來進行讀寫操作。而在.net2.0中使用configurationmanager 和webconfigurationmanager 類可以很好的管理設定檔,configurationmanager類在system.configuration中,
Time of Update: 2018-12-04
想作一個類似ClickOnce功能的小程式,用XML儲存程式資訊,然後判定伺服器上的程式版本是否更新,如果是則把新版本下載到指定路徑,然後調用.現在還有一個問題是不知道怎麼把Update程式關閉,待改.VS2005的ClickOnce功能的確不錯,比較好用.UpdateVer.xml<UpdateInfo> <PreVersion>1.0.0.1</PreVersion> <UpdatePath>http://localhost/testc1/