Monday, November 26, 2007
Bad UI : Firefox "Restore last session"
Remember that nasty dialog that appears when you start Firefox?
"Your last Firefox session closed unexpectedly... " with 2 buttons: "Restore session" and "Start New Session".
Well, simply put, that's just stupid. That's just extra excise - and besides, why do I need to bother remembering what tabs I had opened? This appears even when I click some link from another application (like, Thunderbird), and Firefox is not opened yet.
But more to the point, I can end up clicking "Start New Session", and have all my previous tabs lost.
The solution
First of all, Firefox should not ask that stupid question, and by default start with no tabs. It should then keep a history of the last 10 "Tab Groups", so that in case you want to re-open any of those tabs, you could. You should be able to re-open a full Tab Group, or select some tabs from a Tab Group and open only those.
Wednesday, November 14, 2007
Tuesday, November 13, 2007
The Nerd Handbook
Monday, November 12, 2007
Boost Logging v2 - Your Killer Feature
I know everyone has his favorite feature he thinks a logging lib should provide. I've implemented what most people need. But just in case I forgot something...
Do you have a feature you can't live without? You can drop me an email, or drop a comment here - and other people can share their thoughts as well...
Best,
John
MFC v9 - updates
Seems to have quite a few interesting features, and I can't wait to get my hands on them :)
Until then, you can read about it here:
http://blogs.msdn.com/vcblog/archive/2007/11/09/quick-tour-of-new-mfc-functionality.aspx
http://blogs.msdn.com/vcblog/archive/2007/11/09/announcing-a-major-mfc-update-plus-tr1-support.aspx
http://blogs.msdn.com/vcblog/archive/2007/11/09/channel-9-pat-brenner-overview-of-new-mfc-update.aspx
http://blogs.msdn.com/vcblog/archive/2007/11/09/hola-from-barcelona-and-welcome-to-a-major-mfc-update.aspx
Saturday, November 10, 2007
Boost Logging v2 - your scenario, tags
I'm very excited. I've added 2 very cool features to the Boost Logging Lib:
- have the library find out the right logger/filter based on your application's needs
- allow for tags (extra information about the context of the logged message)
In case you're curious, take a peek ;)
Note : the latest code is only available on SVN.
Best,
John
Wednesday, November 7, 2007
C++ : default template parameters
Assume you have a templated class, and some template parameters have default values. What if you want to specify only some parameters, and leave some to their defaults?
The problem is that you need to specify all parameters until the last you want to change.
Example:
template<
class f_base = formatter::base,
class d_base = destination::base,
class f_ptr = f_base*,
class d_ptr = d_base*> struct logger { ... }
If you want to specify d_ptr, you'll have to specify f_base, d_base and d_ptr as well:
logger<formatter::base,destination::base,my_ptr> l;
The more complicated the params are, the more complicated the client code will look. And by the way, what if the defaults change?
There's an easy solution: use a default_ class:
struct default_ {};
template<class param, class default_type> struct use_default
{ typedef param type; };
template<class default_type> struct use_default <default_, default_type>
{ typedef default_type type; };
Now, the client code will look a lot simpler:
logger <default_,default_,default_,my_ptr> l;
In your class, you'll do something like this:
template<
class f_base = default_,
class d_base = default_,
class f_ptr = default_,
class d_ptr = default_> struct logger {
typedef use_default <f_base, formatter::base> ::type formatter_type;
typedef use_default <d_base, destination::base> ::type destination_type;
typedef use_default <f_ptr, formatter_type*> f_ptr_type;
typedef use_default <d_ptr, destination_type*> d_ptr_type;
...
};
Your users will be waaay happier with this interface - especially if you use it across multiple templated classes. All they will need to remember is which parameters to set, while forgetting the rest.
As a side-note, I've used this in the Boost Logging Lib v2.