(1) [Serializable()] //Set this attribute to all the classes that you define to be serialized
public class Serializeclass : ISerializable
(2) Stream stream = File.Open("Serializeclass", FileMode.Create);
BinaryFormatter bformatter = new BinaryFormatter();
bformatter.Serialize(stream, sc);
stream.Close();
(3) stream = File.Open("Serializeclass", FileMode.Open);
bformatter = new BinaryFormatter();
物件可以serialized自己,但是無法de-serialized自己(除非透過一個空殼子)
questioner 發表在 痞客邦 留言(0) 人氣(18)
http://en.wikipedia.org/wiki/List_of_Google_services_and_tools
questioner 發表在 痞客邦 留言(0) 人氣(7)
Download the eclpise
Use eclpise CVS to import the plugin and app parts from higgins
Use eclpise software update to update the emf, ecf and emft plug-ins.
Modify the error message
make setup-method to become public
- use MANIFEST.MF to extend some methods need by emf.higgins
questioner 發表在 痞客邦 留言(0) 人氣(21)
http://www.codinghorror.com/blog/archives/000542.html
與系統核心(尤其是有硬體有關的或是與作業系統的程式)還是用native codeing比較好。
但是如果要放在網路上的應用,還是考量一下系統架構跟程式維護的便利性吧。
questioner 發表在 痞客邦 留言(0) 人氣(14)
比較 managed & unmanaged code的執行效能
results shows that the optimization switches in managed C++ and C# have relatively small effects, and that there is only a 2% difference between managed and unmanaged code. Significantly, C# code is as good, or better than managed C++ or C++/CLI which means that your choice to use a managed version of C++ should be based on the language features rather than a perceived idea that C++ will produce 'more optimized code'.
http://www.grimes.demon.co.uk/dotnet/man_unman.htm
questioner 發表在 痞客邦 留言(0) 人氣(55)
http://www.shadows.com/
Discover the web you've always wanted but could never find!
Shadows is the link-sharing website for people. By people. With Shadows, you have the power to discover the web's most fascinating content – the most interesting pages saved, discussed, and rated by you, your friends, and the Shadows community.
questioner 發表在 痞客邦 留言(2) 人氣(32)
http://www.newty.de/
=======================
動態指派函數去執行(這也是後來event hanlder都需要用此)
You can use them to replace switch/if-statements, to realize your own late-binding or to implement callbacks.
The calling convention tells the compiler things like how to pass the arguments or how to generate the name of
a function. Some examples for other calling conventions are __stdcall, __pascal and __fastcall. The calling
convention belongs to a function's signature: Thus functions and function pointers with different calling
convention are incompatible with each other! For Borland and Microsoft compilers you specify a specific
calling convention between the return type and the function's or function pointer's name.
=======================
結論就是
Callback 是pointer to function一種實作(透過pointer to function,可以達到late binding),
但是這個實在windows有用到event 發出時給系統處理,因此callback function位置與變數需要被全域化
(也可以理解成被OS觸發執行,而非程式設計者),這樣系統才不會被整個callback function要處理的內容給hold住。
Windows的event透過pointer to funtion實作的好處
在message queue中,只要透過message 對應到的function名稱,就可以執行。
而callback這個keywork,在windows程式設計中,如果用了這個keyword,系統會給函數一個全域的id(這是交給系統處理的),
這樣可以方便系統管理(這也意味者,如果有其他介面要跟call back function溝通,就需要有好的架構設計)。
questioner 發表在 痞客邦 留言(0) 人氣(448)
Hmm..找到一段bug…在VC++可以過->離開後new_num就是39119,但在BCB離開後,這個會變成任意數字,不過也因為這樣剛好找到
這個地方的new_num應該改成i
//Find Bugs...
for(i=0;i
{
if(gene[new_num].pix_inten_recor!=NULL)
free(gene[new_num].pix_inten_recor);
gene[new_num].pix_inten_recor=NULL;
if(gene[new_num].periphery_x!=NULL)
free(gene[new_num].periphery_x);
gene[new_num].periphery_x=NULL;
if(gene[new_num].periphery_y!=NULL)
free(gene[new_num].periphery_y);
gene[new_num].periphery_y=NULL;
}
questioner 發表在 痞客邦 留言(0) 人氣(18)
A:這次的版本,你到底找到什麼bug了?為什麼memory leak的問題都沒有了
B:我也不知道,我只是每次把free之後,就把pointer設為NULL,每次calloc之前,都會先check是否為NULL
<看來不同compiler之間還是有差異的>
questioner 發表在 痞客邦 留言(0) 人氣(13)
請問下面程式有幾處會出現問題!?
====================
int i;
double *dia;
dia=(double *)calloc(gene[0].periphery_num,sizeof(double));
for(i=0;i
{
dia[i]= (gene[0].center_x-gene[0].periphery_x[i])*(gene[0].center_x-gene[0].periphery_x[i])
+
(gene[0].center_y-gene[0].periphery_y[i])*(gene[0].center_y-gene[0].periphery_y[i]);
dia[i]=pow(dia[i],0.5)*10;
if(dia[i]>FC_parmeter.r_radius || dia[i]
return 0;
}
return 1;
free(dia);questioner 發表在 痞客邦 留言(0) 人氣(21)