Thursday, April 30, 2009

firefox plugin failed to load

If your created a firefox plugin and it able to load up but NP_GetEntryPoints() never get called, and you are using visual studio, check your module definition file and make sure it is specified in your project file :)

Sunday, April 26, 2009

Multithread plugin architecture

Spending few weeks on a (overly?) complicated c++ plugin architecture, and today i have it working :) and this new plugin architecture is to replaced my old method, which was heavy in dll and light in exe.

My old method let the plugin handle threading and windowing, and this lead to a heavy dll, and it was hard to control under certain situation, such as web application. web browser doesn't provide enough facility for cleaning up resources when destroy command is given, this lead to a nightmare, my web application always crash at exit. with this new architecture, the resources could be free up immediately without synchrounous with external thread. my following work will be implementing a web application utilising this new architecture :)

Monday, April 6, 2009

elegant way to erase a node from an iterating list

It is always puzzle me why erasing a stl node inside a loop is so troublesome, example:

for (i = List.begin(); i != List.end(); )
{
temp_i = i; // to prevent the "chain" breaks by the erased node
++i;
List.erase(temp_i);
delete *temp_i;
}

There is a more elegant way to do the similar thing

for (i = List.begin(); i != List.end(); )
{
delete *i;
i = List.erase(i); // return element that followed the last element erased by the function call
}

elegant right?

Sunday, April 5, 2009

ICE is hot

yes i was talking about ICE network framework from zeroc. i use it to develop a multiplayer prototype, it was very complete, although i didn't use it to it fullness but i could see it is a well written libraries a lot of potential, it remind me python twisted framework. going to spend some time to go through the manual