2013年12月19日 星期四

C++/CLI opterator '^'(caret)(Handle to Object on Managed Heap), '%'(percent)(tracking reference)

都是C++ Managed新增加的符號

'^'(Handle to Object on Managed Heap)-->似Unmanaged的 '*'
A handle to an object on the managed heap points to the "whole" object, and not to a member of the object.
In Visual C++ 2002 and Visual C++ 2003, __gc * was used to declare an object on the managed heap. The ^ replaces __gc * in the new syntax.

'%'(tracking reference)                           -->似Unmanaged的 '&'
A tracking reference is similar to a C++ reference, to specify that a variable is passed to a function by reference and to create an alternative name for an object.

// Unmanaged
Int32* ptr = new Int32;    // usual pointer allocated on heap
Int32& nat = *ptr;         // object on heap bind to native object

// Managed(CLI)
Int32^ mngd = gcnew Int32; // allocate on CLI heap
Int32% rr = *mngd;         // object on CLI heap reference to gc-lvalue
Int32^% rr1 = mngd ;       // tracking reference handle to reference object 


2013年12月18日 星期三

warning C4627 xxxxxx xxxxxxxxxxx stdafx.h or rebuild precompiled header


原因:
    設定Precompiled Headers-->但是卻沒加入

解決方法:
    1. 宣告Precompiled Headers,並在每個.cpp檔前加入
        #include "precompiled Headers file name"
    2. 把Precompiled headers選項關掉。
        Project-->Properties-->Configuration Properties-->C/C++-->Precompiled Headers
        Create/Use Precompiled Header-->Not Using Precompiled Headers

Visual Studio (Direct Download)

Visual Studio 2008
Visual Studio 2008 Express Edition with SP1(English):
http://download.microsoft.com/download/e/8/e/e8eeb394-7f42-4963-a2d8-29559b738298/VS2008ExpressWithSP1ENUX1504728.iso

Visual Studio 2008 Express Edition with SP1(CHT):
http://download.microsoft.com/download/C/0/2/C02B3838-D80D-4E2B-9533-008612D100EC/VS2008ExpressWithSP1CHTX1504729.iso

Visual Studio 2008 Professional Edition(English)(Trial):
http://download.microsoft.com/download/8/1/d/81d3f35e-fa03-485b-953b-ff952e402520/VS2008ProEdition90dayTrialENUX1435622.iso

VS2008 Team Suite Edition(English)(Trial):
http://download.microsoft.com/download/d/8/9/d89c9839-ac45-4a6c-b25f-2f60b190e356/VS2008TeamSuiteENU90DayTrialX1429235.iso

Visual Studio 2008 Service Pack 1(English):
http://download.microsoft.com/download/a/3/7/a371b6d1-fc5e-44f7-914c-cb452b4043a9/VS2008SP1ENUX1512962.iso

MSDN Library 2008(SP1):
http://www.microsoft.com/downloads/info.aspx?na=90&p=&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=7bbe5eda-5062-4ebb-83c7-d3c5ff92a373&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f1%2ff%2f0%2f1f07c259-7ff2-4902-9205-ad1dfb87ccab%2fVS2008SP1MSDNENUX1506188.iso

Visual Studio 2010
Visual Studio 2010 Express Edition(English):
http://download.microsoft.com/download/8/b/5/8b5804ad-4990-40d0-a6aa-e894cbbb3dc/VS2008ExpressENUX1397868.iso

Visual Studio 2010 Express Edition(CHT):
http://download.microsoft.com/download/d/a/3/da3a3b50-03eb-4191-86db-a2334c2ddb0a/VS2010ExpressCHT.iso

Visual Studio 2010 Professional Edition(English)(Trial):
http://download.microsoft.com/download/4/0/E/40EFE5F6-C7A5-48F7-8402-F3497FABF888/X16-42555VS2010ProTrial1.iso

Visual Studio 2010 Premium Edition(English)(Trial):
http://download.microsoft.com/download/F/F/8/FF8C8AF1-D520-4027-A844-8EC7BC0FB27C/X16-42546VS2010PremTrial1.iso

Visual Studio 2010 Ultimate Edition(English)(Trial):
http://download.microsoft.com/download/2/4/7/24733615-AA11-42E9-8883-E28CDCA88ED5/X16-42552VS2010UltimTrial1.iso

Visual Studio 2010 Service Pack 1(Multi-language):
http://go.microsoft.com/fwlink/?LinkId=210710

SP1 hotfix(Multi-language):
http://go.microsoft.com/fwlink/?LinkId=210710


Visual Studio 2012
Visual Studio 2012 Express Edition for Windows Desktop(English):
http://download.microsoft.com/download/1/F/5/1F519CC5-0B90-4EA3-8159-33BFB97EF4D9/VS2012_WDX_ENU.iso

Visual Studio 2012 Express Edition for Windows 8(English):
http://download.microsoft.com/download/6/e/c/6ec5b3cf-cc0d-448a-9846-8af059de7f72/vs2012_winexp_enu.iso

Visual Studio 2010 Professional Edition(English)(Trial):
http://download.microsoft.com/download/D/E/8/DE8E42D8-7598-4F4E-93D4-BB011094E2F9/VS2012_PRO_enu.iso

Visual Studio 2010 Premium Edition(English)(Trial):
http://download.microsoft.com/download/1/3/1/131D8A8C-95D8-41D4-892A-1DF6E3C5DF7D/VS2012_PREM_enu.iso

Visual Studio 2010 Ultimate Edition(English)(Trial):
http://download.microsoft.com/download/D/E/8/DE8E42D8-7598-4F4E-93D4-BB011094E2F9/VS2012_PRO_enu.iso

Visual Studio 2013
Visual Studio 2010 Professional Edition(English)(Trial):
http://download.microsoft.com/download/A/F/1/AF128362-A6A8-4DB3-A39A-%20%20C348086472CC/VS2013_RTM_PRO_ENU.iso

Visual Studio 2010 Premium Edition(English)(Trial):
http://download.microsoft.com/download/D/B/D/DBDEE6BB-AF28-4C76-A5F8-710F610615F7/VS2013_RTM_PREM_ENU.iso

Visual Studio 2010 Ultimate Edition(English)(Trial):
http://download.microsoft.com/download/C/F/B/CFBB5FF1-0B27-42E0-8141-E4D6DA0B8B13/VS2013_RTM_ULT_ENU.iso


2013年12月17日 星期二

static in C++


static functionA static function is a function whose scope is limited to the current source file.

static void function() {
    cout << “function()";
}

static variable
in a function - 宣告初始化,只會呼叫一次
    for(int i = 0; i < 10; i++) {
        static int count = 0;
        count++;
    }

    count值-->10

a class member - 此變數或function是屬於class的,不屬任何instance的,所以只會有一份,也因此沒有instance,就可以呼叫。

class myClass {
    private:
        static int id;
    public:
        static int next_id() {
            id++;
            return id;
        }
};

int myClass::id = 0;





2013年12月16日 星期一

P-value

p-value:
    此測試結果有百分之幾的可能是由於機率的關係
    出錯的機率

Check Windows 8 dump file(WinDBG)

1. 下載、安裝 WinDBG Standalone Debugging Tools for Windows 8.1 (WinDbg)

2. Start WinDBG

3. 按File-->Open Crashdump, 選擇 .DMP 檔

4. Windows 8 DMP檔預設路徑:
    C:\Users\AABB\AppData\Local\Temp\ (取代AABB成你的登入帳號)

5. 加入讀取Symbols的路徑
按 CTRL + S,把下面路徑加入
SRV*C:\Symbols*http://msdl.microsoft.com/download/symbols
(Symbols抓下來,會自動放在C:\symbols,這個路徑)

6. 可能會有這個錯誤訊息 No runnable debuggees error in ‘g’

7. 按F5更新Mini dump檔

8. 收工




參考網址:
  http://www.windbg.org/
  http://msdn.microsoft.com/en-us/windows/hardware/hh852365
  http://windows7themes.net/debug-how-to-open-a-mini-dump-file-tmp-mdmp-on-windows-8.html

2013年12月4日 星期三

數學符號的念法

LetterName
Ααalpha
Ββbeta
Γγgamma
Δδdelta
Εεepsilon
Ζζzeta
Ηηeta
Θθtheta
Ιιiota
Κκkappa
Λλlambda
Ψψpsi
Μμmu
Ννnu
Ξξxi
Οοomicron
Ππpi
Ρρrho
Σσsigma
Ττtau
Υυupsilon
Φφphi
Χχchi
Ωωomega