Time of Update: 2015-06-18
標籤:#include <string.h>#include <iostream>#include <vector>#include <stdio.h>#include <stdlib.h>#include <boost/algorithm/string.hpp>int main() { //std::string bns = "list://cp01-spi-fresh2.cp01.baidu.com:8004";
Time of Update: 2015-06-18
標籤:伺服器端:#include <sys/types.h>#include <sys/socket.h>#include <stdio.h>#include <stdlib.h>#include <errno.h>#include <string.h>#include <unistd.h>#include <netinet/in.h>#define SERVPORT 3333#define
Time of Update: 2015-06-18
標籤:
Time of Update: 2015-06-18
標籤:一個例子是1 template<typename T, int MAXSIZE> 2 class Stack {};在這裡我就想起了C語言是怎麼弄資料結構的,不得不說模板是很方便的東西。上面的例子是一個類模板,函數模板其實也是類似的。浮點數和類對象是不允許作為非類型模板參數的。對上面這句話的補充:這是曆史原因,C++ Templates的作者認為C++在未來可能會允許使用浮點數和類對象作為非類型模板參數。不太好理解的是這個例子1 template<char const *
Time of Update: 2015-06-18
標籤: 1 void showTime() const; 2 Clock& operator ++(); 3 Clock operator ++(int); 4 private: 5 int hour,minute,second; 6 }; 7 Clock::Clock(int hour,int minute,int second){ 8
Time of Update: 2015-06-18
標籤:int kernel_x;int kernel_y;int mat_x;int mat_y;int **kernel;int **mat;int pos_archor_x;int pos_archor_y;void getValue(int pos_x,int pos_y){int temp_x_kernel_start,temp_x_kernel_end;int
Time of Update: 2015-06-18
標籤: 1 #include<iostream> 2 using namespace std; 3 class Complex{ 4 public: 5 Complex(double r=0.0,double i=0.0):real(r),imag(i){} 6 friend Complex operator + (const Complex &c1,const Complex &c2); 7 friend Complex operator -
Time of Update: 2015-06-18
標籤:#include<iostream>using namespace std;class Complex{public: Complex(double r=0.0,double i=0.0):real(r),imag(i){} Complex operator + (const Complex &c2) const; Complex operator - (const Complex &c2) const; void display()
Time of Update: 2015-06-18
標籤:在C#的學習中,容易混淆virtual方法和abstract方法的使用,現在來討論一下二者的區別。二者都牽涉到在衍生類別中與override的配合使用。一、Virtual方法(虛方法) virtual 關鍵字用於在基類中修飾方法。virtual的使用會有兩種情況:
Time of Update: 2015-06-18
標籤:建議直接用json.net: http://www.cnblogs.com/xwgli/archive/2013/08/30/3290964.html 添加引用:System.Runtime.SerializationJsonHelper.cs代碼如下:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Web;using
Time of Update: 2015-06-18
標籤:[轉]WebService的緩衝機制2008年02月19日 星期二 11:22WebService的緩衝分為兩種,一種是簡單的輸出緩衝,一種是強大的資料緩衝一、輸出緩衝輸出緩衝的使用非常簡單,比較適用於WebService的參數比較少,結果比較單一的情況,例如股票資訊,可以設定5-10秒的緩衝,天氣預報,則可以設定30分鐘甚至數小時的緩衝使用方法是:在WebMethod屬性上指定CacheDuration屬性即可,例如這樣,600秒內這個WebService的所有輸出資料都將從緩衝中讀取,
Time of Update: 2015-06-18
標籤:原文地址:http://www.biye5u.com/article/Csharp/fileprog/2011/4198.html本文給出了一個在C#中拷貝指定檔案夾下的所有檔案夾目錄到指定檔案夾中的方法。public static void CopyFolder(string strFromPath,string strToPath){ //如果源檔案夾不存在,則建立 &
Time of Update: 2015-06-18
標籤:#include <stdio.h>#include <string.h>extern "C" __declspec(dllexport)int TCharParm(char* in,int len,char* out){memset(out,0,4);memcpy(out,in,len);return 0;}extern "C" __declspec(dllexport)int tl_add(int a,int b){return a+b;} set PATH=
Time of Update: 2015-06-18
標籤:由於修改預設的app.config檔案,總是會在執行完後被舊檔案覆蓋,不清楚是什麼原因。所以替代辦法是在另外一個自訂的設定檔中進行讀寫。1.讀取//讀取Debug檔案夾下自訂的PrintSetting.config中的配置資訊 private string getConfig(string key) { string fileName =
Time of Update: 2015-06-18
標籤:c# il asm emit 內嵌 中間代碼(IL)是來源程式的一種內部表示 舉個例子C語言編譯一個程式 那麼C語言編譯器會把代碼全部翻譯為可以被機器識別的機器指令 同理C#編譯器也是一樣的 不過它是被C#(CSC)編譯為可以被CLR識別的指令 該指令稱為中間代碼。C#可以內嵌彙編但需要通過Emit還有一種則通過Mono
Time of Update: 2015-06-18
標籤:作用此介面的主要用途是釋放非託管資源。 當不再使用託管對象時,記憶體回收行程會自動釋放分配給該對象的記憶體。 但無法預測進行記憶體回收的時間。 另外,記憶體回收行程對視窗控制代碼或開啟的檔案和流等非託管資源一無所知。檢查在 Visual Studio 中運行程式碼分析的時候,如果某一個類中,包含了實現 IDisposable 模式的屬性,則會提醒你該類同樣需要實現 IDisposable 模式,而實現 IDisposable
Time of Update: 2015-06-18
標籤:1.什麼是WebClient? 源自MSDN:提供用於將資料發送到由 URI 標識的資源及從這樣的資源接收資料的常用方法。2.OpenRead() 為從具有String指定的URI的資源下載的資料開啟一個可讀的流。 需要先引用System.Net和System.IO. public static void GetPage(string uri) {
Time of Update: 2015-06-18
標籤:在做項目時,對圖片的處理,以前都採用在上傳時,限制其大小的方式,這樣帶來諸多不便。畢竟網站營運人員不一定會對圖片做處理,經常超出大小限制,即使會使用圖片處理軟體的,也由於個人水平方面原因,處理效果差強人意。於是採用C#為我們提供的影像編輯功能,實現一站式上傳,通過程式產生所需大小、尺寸的靶心圖表片。進入正題-->先說圖片壓縮第一步:需要讀取一個圖片檔案,讀取方法:// <param
Time of Update: 2015-06-18
標籤:這裡介紹一下C#的委託委託的用處:1、方法參數化2、輪播1、將方法參數化 public class Test { public delegate void TestEventHandler(string name); public Test() { this.Start("run", this.Run); } private void Start(string name,
Time of Update: 2015-06-18
標籤:1.最近在研究太陽神三國殺源碼,在三國殺的源碼中採用很多函數指標的方式進行資料傳遞,感覺很實用,class ConfigDialog : public FlatDialog { Q_OBJECTpublic: ConfigDialog(QWidget *parent = 0); ~ConfigDialog();private: Ui::ConfigDialog *ui; typedef void (ConfigDialog::*Callback)