Thursday, September 10, 2009

Three frames magic

Lately found a site with three frame animations and said I could try that. The weekend was bothering my sister to help me but she refused :)

Three frame apng
I needed no more, found APNG Edit for firefox and created this animated image, GIF has 256 colour limitation, flash is too much for a simple job.

The first version of this post was not animated, you need apng support and need a storage for your picture different as blogger or picasa, they messed my animation.

Monday, September 7, 2009

Windows 7 with new NVIDIA driver results in oversaturated odd colors - solution

Here's how to set (probably) correct colors for nvidia on win7:

control panel ->appearance and personalization ->display ->change display settings->advanced settings->GeForce 9300M GS->start the NVIDIA Control Panel->adjust desktop color settings:

set digital vibrance to 0% from 79%

was it easy? what a smart person was it to set it as default and overriding even calibrated monitors. Congrats.

Use regular expression in your C++ program (vbscript and groups)

There's a great tutorial how to reuse VB6 regular expressions in C++ on sourceforge and here's how to use it in more depth. Unfortunately there are not many examples how to use it in C++ and figuring out how to access groups was not hard, just took a while. The key is to use the version 2 of all the classes, starting with IRegExp2Ptr. So just an example how to do it:

IRegExp2Ptr regExp;
regExp.CreateInstance(__uuidof(RegExp));
regExp->Pattern = _bstr_t("^(\\d+)-(..)-(.*)\\.44$");

if (regExp->Test("11-ab-33.44") == VBOOL_TRUE)
{
IMatchCollection2Ptr matches = regExp->Execute("11-ab-33.44");
IMatch2Ptr match = matches->Item[0];
ISubMatchesPtr sbm = match->GetSubMatches();
_bstr_t val = _bstr_t(sbm->Item[0]); //11
_bstr_t val = _bstr_t(sbm->Item[1]); //ab
_bstr_t val = _bstr_t(sbm->Item[2]); //33
}