August 1, 2007

Fixing the Firefox memory leak

in case you didnt know Firefox has a small memory leakage problems that can cause your pc to freeze up. basically what happens is when you minimize Firefox it stops consuming memory, however when you maximize it again the memory usage will increase, sometimes even doubling. fortunately, there is a small fix that you can implement.
heres what you do:

1. Open Firefox and go to the Address Bar. Type in about:config and then press Enter.
2. Right Click in the page and select New -> Boolean.
3. In the box that pops up enter config.trim_on_minimize. Press Enter.
4. Now select True and then press Enter.
5. Restart Firefox.


via

March 30, 2007

Eric Niebler @ NWCPP: Text Processing with Boost

Eric Niebler - Text Processing with Boost February 2007 meeting of the Northwest C++ Users Group.
The abysmal support in the C and C++ ... all » standard libraries for string handling has driven many programmers to other languages like Perl and Python. Boost aims to reverse that trend. Libraries such as Boost.Lexical_cast, Boost.String_algo, Boost.Regex, Boost.Xpressive and Boost.Spirit are invaluable tools for slicing and dicing strings. If your task is as simple as turning an integer into a string, or as complicated as developing a parser generator for a new scripting language, Boost has a library that can help. In addition to covering all the afore mentioned libraries from a user's perspective, we'll also look at how Boost can be used to get more out of the standard IOstreams, and discover some hidden gems in Boost for dealing with Unicode.

video here

Concepts Extending C++ Templates For Generic Programming

Concepts are a major addition to C++0x that make templates more robust, more powerful, ... all » and easier to write and use. At their most basic level, concepts provide a type system for templates. Using concepts, the C++ compiler is able to detect errors in the definition and use of templates before they are instantiated. One immediately obvious benefit of this separate type-checking capability is a dramatic improvement in error messages resulting from improper use of templates. Look a little deeper and we find that concepts support an entirely new programming paradigm, Generic Programming, enabling the construction of a new breed of generic libraries that provide better extensibility, composability, and usability than what is possible with today's C++.

This talk will provide an overview of the new features introduced by concepts and how they will benefit C++ programmers. We will see how concepts can be used to express the core components of the C++ Standard (Template) Library, and explore some of the new capabilities that concepts bring to the C++ language.

video here

New Features in the Next C++ Standard

New Features in the Next C++ Standard
The upcoming C++ standard will have many new features, several major and many minor. The ... all » major features are concurrency, template concepts, move semantics, generalized constant expressions, automatic variable typing, and garbage collection. We will present an overview of the major features and breeze through a list of other features, commenting on their likeliness to make the standard.

March 16, 2007

О вреде стандартов

Есть замечательный стандарт CORBA, в котором замечательно определен, в числе прочих, маппинг в C++. И всебы хорошо, вот только писАлся он без учета такой мелочи как STL.
Теперь это аукается необходимостью постоянной конвертации из корбовских типов в стл-ные и обратно, что конечно не добавляет программам ни скорости ни стабильности.

tip


locale loc("russian_Russia.1251");
locale::global(loc);

Из предисловия

этой книги: "Если прочитав главу о type list вы не упали со стула, значит вы сидели на полу".
Великолепно.

March 15, 2007

InType

Just found new interesting text editor InType.
Intype is a powerful and intuitive code editor for Windows with lightning fast response. It is easily extensible and customizable, thanks in part to its support for scripting and native plug-ins. It makes development in any programming or scripting language quick and easy.

Alpha version already supports for TM bundles. Programmers dream (TextMate on windows) becomes real.

Scope guard, вариант Александреску

Частенько приходится писать код вида:
HANDLE h = OpenSomeHandle();
...
CloseHandle(h);

Понятно, что такой код небезопасен и чреват многими багами, поэтому умные люди пишут обертки на манер auto_ptr.
Они прекрасно работают, но каждая со своими ресурсами, а хочется универсальности.
Отсюда и возникает идея универсального scope guard, который работал бы с любыми ресурсами.
А дальше был код:

class ScopeGuardImplBase
{
public:
void Dismiss() const throw()
{
dismissed_ = true;
}
protected:
ScopeGuardImplBase() : dismissed_(false)
{}
ScopeGuardImplBase(const ScopeGuardImplBase &other)
: dismissed_(other.dismissed_)
{
other.Dismiss();
}
~ScopeGuardImplBase() {}
mutable bool dismissed_;
private:
ScopeGuardImplBase& operator=(const ScopeGuardImplBase&);
};

template
class ScopeGuardImpl : public ScopeGuardImplBase
{
public:
ScopeGuardImpl(const Fun &fun) : fun_(fun)
{}
~ScopeGuardImpl()
{
if (!dismissed_) fun_();
}
private:
Fun fun_;
};

//fun - функция освобождающая ресурс
template
ScopeGuardImpl MakeGuard(const Fun &fun)
{
return ScopeGuardImpl(fun);
}

typedef ScopeGuardImplBase& ScopeGuard;

Использование:
ScopeGuard someHandle = MakeGuard(&CloseHandle);
Если освобождающей ресурсы функции необходимо передать параметры, то здесь нам поможет boost::bind.

Modern C++ design

Modern C++ design - одна из самых мощных книг по C++. В основном посвящена метапрограммированию.
Идея простая: если это может сделать компилятор, то незачем выполнять код в рантайме.
Обязательна к прочтению людям, думающим, что шаблоны нужны только для создания контейнеров.

March 14, 2007