Time of Update: 2018-12-07
#include <iostream>#include <utility>#include <string>using namespace std;int main () { pair <string,double> product1 ("tomatoes",3.25); pair <string,double> product2; pair <string,double> product3;
Time of Update: 2018-12-07
#include "stdafx.h"#include <iostream>#include <typeinfo>using namespace std;class Base {};class Derived : public Base {};int main( ) {Base b, bb;Derived d;// Use typeid to test type equalityif (typeid(b) == typeid(d)) { // Nocout
Time of Update: 2018-12-07
iPhone SDK提供了預設的幾個TableView樣式,但是如果想提供更個人化的樣式就需要自己定義。 比如添加背景如的樣子。 其實自訂table view的樣子很簡單,無非就是把table view和table view cell的背景變成透明的,然後在指定視圖和cell的背景圖片(當然,也可以指定table view的背景圖片)@interface MainViewController : UIViewController <UITableViewDelegate,
Time of Update: 2018-12-07
原文連結:http://patmusing.blog.163.com/blog/static/135834960201002322226231/一、最簡單的實現方式// Singleton.h// C++:最簡單的方式實現Singleton設計模式#pragma once#include <string>#include <iostream>using namespace std;class Singleton{private:Singleton()
Time of Update: 2018-12-07
GOF著作中對Singleton模式的描述為:保證一個class只有一個實體(Instance),並為它提供一個全域訪問點(global access point)。從其描述來看,是非常簡單的,但實現該模式卻是複雜的。Singleton設計模式不存在一種所謂的“最佳”方案。需要根據當時的具體問題進行具體解決,下面將講述在不同環境下的解決方案。Singleton的詳細解釋,請大家看GOF的著作《設計模式》一書。俺比較懶,是不想抄了。J1 Singleton建立
Time of Update: 2018-12-07
(1)首先,需要有Adobe Acrobat Pro,普通版的acrobat reader是不支援pdf虛擬列印的。。(2)接下來的問題就是查看自己的pdf文檔究竟需要哪些字型,點擊File->Properties...,再點擊第三個Font標籤頁。 (3)如果這個pdf檔案在你的電腦上顯示都不正確的話,那麼就需要依照圖中提示的資訊下載相應的字型檔進行安裝。接下來就是關鍵的一步咯,重新列印該pdf檔案並加入內嵌字型。那麼先點擊File->Print...(4)Printer
Time of Update: 2018-12-07
// BoostTest.cpp : 定義控制台應用程式的進入點。//#include "stdafx.h"#include "boost/filesystem.hpp" // includes all needed Boost.Filesystem declarations#include <iostream> // for std::coutusing namespace boost::filesystem; using namespace
Time of Update: 2018-12-07
使用at()函數而不是operator[]:理由是at()可以拋出invalid vector[T] subscript異常,而operator[]不會做範圍檢查。因此,at()函數更加安全。使用vector的assign函數複製一個vector:include "stdafx.h"#include <vector>#include <iostream>int main( ){using namespace std;vector<int> v1, v2, v3
Time of Update: 2018-12-07
驗證數字:^[0-9]*$驗證n位的數字:^\d{n}$驗證至少n位元字:^\d{n,}$驗證m-n位的數字:^\d{m,n}$驗證零和非零開頭的數字:^(0|[1-9][0-9]*)$驗證有兩位小數的正實數:^[0-9]+(.[0-9]{2})?$驗證有1-3位小數的正實數:^[0-9]+(.[0-9]{1,3})?$驗證非零的正整數:^\+?[1-9][0-9]*$驗證非零的負整數:^\-[1-9][0-9]*$驗證非負整數(正整數 + 0) ^\d+$驗證非正整數(負整數 + 0) ^
Time of Update: 2018-12-07
#include "stdafx.h"#include "MFCThread.h"#include <deque>#include <iostream>#include <boost/shared_ptr.hpp>#include <boost/weak_ptr.hpp>#include <boost/enable_shared_from_this.hpp>using namespace std;using namespace
Time of Update: 2018-12-07
// BoostTest.cpp : 定義控制台應用程式的進入點。//#include "stdafx.h"#include <iostream>#include "boost/cast.hpp"#include "boost/shared_ptr.hpp"using namespace boost;using namespace std;class base1{public:virtual void
Time of Update: 2018-12-07
1,使用+=操作符#include <iostream> using namespace std;#include <boost/thread.hpp>#include <boost/assign.hpp>using namespace boost;using namespace boost::assign;int main(int argc, _TCHAR* argv[]){vector<int> v;v +=
Time of Update: 2018-12-07
#include "vtkActor.h"#include "vtkRenderer.h"#include "vtkRenderWindow.h"#include "vtkRenderWindowInteractor.h"#include "vtkProperty.h"#include "vtkInteractorStyleTrackballCamera.h"#include "vtkPoints.h"#include "vtkPolyVertex.h"#include
Time of Update: 2018-12-07
#include "stdafx.h"#include <vector>#include <algorithm>#include <iostream>#include <locale>#include <functional>using namespace std;class Widget{public:Widget(wstring str){str_ = str;}wstring str_;void Print(){wcout<
Time of Update: 2018-12-07
基本上這個問題在boost 1.38就有了,只是沒想到更新成boost 1.45後問題還是沒有解決... 如果是使用MFC開發程式 ,又剛好建立的MFC DLL工程中有使用boost::thread,就會發生compile正常但是一執行程式出現ASSERT。dllinit.cpp,Line: 587,ASSERT(AfxGetModuleState() !=
Time of Update: 2018-12-07
使用pimpl將實現細節移出標頭檔。將私人成員變數和私人方法移入Impl類,可以實現資料和方法的封裝,以避免在公開標頭檔中聲明私人方法。不能在實作類別中隱藏虛方法(virtual method),虛方法必須在公開類中出現以便由繼承類重載。可以在實作類別中加入指向公開類的指標,以便於Impl類調用公開方法。或者也可以將公開類傳給需要它的實作類別方法。與Bridge Pattern的區別:The Bridge pattern is about object-oriented design,
Time of Update: 2018-12-07
將LPCTSTR轉換為std::stringLPCTSTR folder_path;char str[1024]; wsprintfA(str, "%S ",folder_path); string str_(str);去掉string的空格:#include <iostream>#include <string>#include <boost/algorithm/string.hpp>using namespace std;using
Time of Update: 2018-12-07
最近給客戶上系統的時候,也是使用Citrix做為支援平台,可是發生了幾次類似的錯誤:Cannot connect to the Citrix MetaFrame server.Can't assign requested address.網上雖然有很多辦法,但是都不管用,即便是官方網站上面所說,一樣不能解決,後來仔細的回憶了出現問題的過程,想想應該是給伺服器升級補丁後,重啟伺服器後導致Citrix的相關服務不能正常運行。解決方案:再安裝Citrix MetaFrame
Time of Update: 2018-12-07
蹭網卡泛濫,偷連他人網路現象頻出……有貪便宜的人蹭你的網掛機下載,有喜歡翻箱 倒櫃的人竄入你的電腦偷看你的“電影”。看來大家有必要檢測一下自己的網路,看看家中無 線網路是否被他人利用,辦公室的無線網路是否正在被盜用。今天筆者就從自己經驗出發讓 我們能夠在第一時間發現家中的陌生人。 1 普通使用者 通過路由器管理介面查詢,查看有哪些主機串連到自己的無線網路 串連到家用網路的任何主機都需要通過無線路由器(貓)串連互連網,所以在無線路由
Time of Update: 2018-12-07
最近客戶要求在貨品資料中產生商品條碼(即EAN13,國際商品條碼),雖然系統中有商品條碼產生的工具,但是對不上號,根本無法使用,客戶的貨品資料已經有部分有條碼,更重要的是客戶要求產生商品條碼的貨品無法正常篩選出來(比如:GW開頭,或者是GM開頭,而且要求的是GW和GM後面全是數位貨品才要求產生),客戶又急著用,沒有辦法的情況下,就自己動手寫了一個小工具,雖然客戶無法使用,但是對於維護客戶的商品條碼產生,確是相當的方便,現記錄下,以便將來查看:產生EAN13條碼的SQL函數代碼:create