2022年7月7日 星期四

[Unreal] plugin B include plugin A

B.Build.cs:
PublicDependencyModuleNames.AddRange(
  new string[]
  {
		"A plugin",
		// ... add other public dependencies that you statically link with here ...
  }
  );
B.uplugin :
"Plugins": [
  {
    "Name": "A plugin",
    "Enabled": true
  }
]
A plugin class :
#define A_API DLLEXPORT

class A_API UUtilityBPLibrary : public UBlueprintFunctionLibrary
{
	...
};

2014年11月25日 星期二

[Web] 使用Ajax更新局部頁面後javascript失效問題

  • 可以重新讀取js檔(因使用第三方js使用此方法較快)
<script type="text/javascript">
    function load_js()
    {
        var head= document.getElementsByTagName('head')[0];
        var script= document.createElement('script');
        script.type= 'text/javascript';
        script.src= '../thirdparty/Metro-UI-CSS-master/docs/js/metro.min.js';
        head.appendChild(script);
    }
   
    function js_AddToCar(Id) {
        $.ajax({
            type: "POST",
            url: "/AddCartFun",
            data: { msg: Id }

        })
        .done(function (data) {
            $('li#brid').html(data);
            load_js();
        });

    };
</script>
  • 若是自己的function可以使用重新綁定(live, bind)元件事件

2014年11月24日 星期一

[C/C++] C++ 運算子重載(4)

class E
{
public:
    int *num;   // 指標必須再new 1份
    E& operator=(const E& rhs)
    {
        this->num = new int((*rhs.num));   // 避免互相影響
        return *this;
    }
}
class A
{
    //member operator
    A& operator+=(const A& rhs)
    {
        this->num += rhs.num;
        return *this;
    }
    int num;
};
E test1;
*test1.num = 5;
    
E test2;
test2 = test1;

2014年11月23日 星期日

[C/C++] C++類別成員覆蓋性(3)

#include <iostream>
using namespace std;

class CA{
  public:
     CA(){a=2; b=3; c=4; }
     int a, b, c;
};

class CB: public CA{
  public:
     CB(){ a=100; b=200;}
     int a, b;      // 可以覆蓋覆類別
     int getX(){ return a*b; }
     int getY(){ return CA::a*CA::b*c; }    // 若要使用父類別
};

int main()
{
  CB b;
  cout<< "a*b= "<< b.getX()<< endl;
  cout<< "a*b= "<< b.getY()<< endl;
  b.a = 1;
  b.CA::a = 5;
  b.c = 2;
  cout<< "a*b= "<< b.getX()<< endl;
  cout<< "a*b= "<< b.getY()<< endl;
  return 0;
}

[C/C++] C++類別繼承筆記(2)

#include <iostream>

using namespace std;

class A
{
    public :
    A() : ia(10){}
    
    int ia;
};

class B : public A
{
    public :
    B() : ia(20){}      // error    ia不屬於本身類別成員
    B(){ ia = 20; }     // OK       須在建構式內設定值
    int ib;
};

int main()
{
    A ca;
    B cb;
    
    ca = cb;    // OK       A有的成員 B都會有
    cb = ca;    // error    B因繼承A 可能有A沒有的成員
    
   cout << ca.ia << endl;  // 20
   
   return 0;
}

2014年10月28日 星期二

[Web Matrix] 遇到下列站台已停止



  • WebMatrix執行預覽時若遇到下列站台已停止時
  • 執行 IISExpress.exe /trace:Error 查看是否正常
    • 錯誤: Failed to load global module C:\Program Files (x86)\IIS Express\diprestr.dll
  • 解決辦法:刪掉IIS設定檔

  • 重新啟動WebMatrix 加入網站資料夾

2014年10月27日 星期一

[8] fatal error C1900



  • 重灌VS2008 professional版遇到舊程式碼編譯出錯,訊息如下
    • fatal error C1900: Il mismatch between 'P1' version '20080116' and 'P2' version '20070207'
  • 解決辦法: 安裝VS2008 SP1
    • http://www.microsoft.com/zh-tw/download/details.aspx?id=10986