EvoTalk

Archive for the ‘C++’ Category

10 五月, 2010

Install QT for VS2008 on WinXP

Posted by: asd In: C++| Code Snippet| 程式設計

1. 直接下載已編譯好的binary檔 QT binaries for windows,若要安裝其它較高版本 for vs2008,可到 qt-msvc-installer下載。
2. 解壓縮後,在環境變數User Variables加入 QTDIR=C:\Qt-4.4.3 及Path=C:\Qt-4.4.3\bin;.........
3. 安裝 QT for vs2008 addin
4. 在C:\Qt-4.4.3目錄下製作兩個文字檔「configure.cache」、「.qmake.cache」,這兩個檔是build source code產生的
configure.cache
view plain

CODE:

-platform

win32-msvc2008

-debug-and-release

-platform win32-msvc2008 -debug-and-release

.qmake.cache
view plain

CODE:

QMAKE_QT_VERSION_OVERRIDE = 4

OBJECTS_DIR     = tmp\obj\debug_shared

MOC_DIR         = tmp\moc\debug_shared

RCC_DIR         = tmp\rcc\debug_shared

sql-plugins    += sqlite

styles         += windows plastique cleanlooks motif cde

imageformat-plugins [...]

Tags:

03 二月, 2010

C# Call Method With String Name

Posted by: asd In: C++| Code Snippet

以變數名稱當作函式名稱來呼叫
參考:Call Static Method With a String Name in C#
帶參數的方法參考: 谁能讲解一下c# 中关于MethodBase Invoke方法?

view plain

CODE:

System.Text.Encoding utf_8 = System.Text.Encoding.UTF8;

 

// This is our Unicode string:

string s_unicode = "abcéabc";

 

// Convert a string to utf-8 bytes.

byte[] utf8Bytes = System.Text.Encoding.UTF8.GetBytes(s_unicode);

 

// Convert utf-8 bytes to a string.

string s_unicode2 = System.Text.Encoding.UTF8.GetString(utf8Bytes);

 

MessageBox.Show(s_unicode2);

reference : C# to convert from utf-8 bytes to string and back

31 十二月, 2009

Free C++ Skin Library

Posted by: asd In: C++| Code Snippet| 科技新知| 程式設計| 軟體使用

FreeCL(Free Control Library)是一個open source且free的Windows  skin library,包含了常用的Windows標準元件、Shell元件、IE風格 menu 以及 dialog

30 七月, 2009

Sort Map Value

Posted by: asd In: C++| Code Snippet| 程式設計

use stl set to simulate map
view plain

CODE:

#include <iostream>

#include <vector>

#include <algorithm>

#include <set>

#include <map>

using namespace std;

 

class compare

{

public:

 

 //the error is over here

 bool operator()(pair<int, int> p1, pair <int, int> p2) const

 {

  if (p1.second == p2.second)

   return p1.first <p2.first;

  else

     return p1.second <p2.second;

 }

};

 

typedef set<pair<int, int>, compare> MMap;

 

void main(int argc, char* argv[])

{

 MMap D;

 D.insert(make_pair<int, int>(1, 10));

 D.insert(make_pair<int, int>(2, 2));

 D.insert(make_pair<int, int>(3, 2));

 D.insert(make_pair<int, int>(4, 3));

 D.insert(make_pair<int, int>(5, 6));

 

 MMap::const_iterator iter(D.begin());

 MMap::const_iterator [...]

Tags:

Page 1 of 2212345...Last »