research
Serialization with boost
Boost имеет множество полезных библиотек. И хотя многие возражают против использования его в серъезных коммерческих проектах, но тяжело переоценить удобство использования библиотек boost.
В процессе работы возникла задача сериализации данных некой структуры с последующим сохранением их в файл. ИМХО, для таких задач просто отлично подходит boost::serialization.
Watching Debug Message ( qDebug usage )
In QT qDebug is compiled as some winapi function.
Узел камикадзе ( Kamikaze knot )
Этот узел называют узлом камикадзе. Почему? Объясняю: если вам надо спуститься с горы или еще от куда нибуть, а есть только одна вервка и ее надо сохранить. Если привязать любым узлом веревку допустим к дереву – вы спуститесь но веревка сама не отвяжется и вам придется оставить ее. По этому делают узел камикадзе (рекомендуется делать в крайнем случае) на картинке показано – какую веревку разрезать. Концы узла подрезаются человек спускается, допустим, с горы. При этом узле он должен держать веревку в натяжении (Это очень ВАЖНО!) когда он спуститься то веревку нужно ослабить и подергать, после чего узел расподется и веревка окажется у вас. Преимущество очевидно – вы остались с веревкой, но очень большая опасность в том что если при спуске вы ослабите веревку то узел может развязаться именно по этому его называют узлом камикадзе.
Видео, как его завязывать Continue reading
What Programming Language to Learn (Next)
Chart below
How to Disable Windows 7 Auto Update Restart
Windows 7 automatic updates help to keep your computer secure and up to date with the latest bug fixes and security patches. It highly recommended that you have it enabled, but can be really annoying when it continuously nags you to reboot your computer. The good news it is very easy to disable the auto-restart using Local Group Policy Editor.
Tweaking Notepad++
There are some pre – installed themes in notepad++.
How to make more? here is the answer. Continue reading
Des, prog & doc.
Design
patterns and anti-patterns
Programming
Writing snippets for visual assist
C preprocessor and fun Macros
Google on c++
Coding advises
Documenting
File Header style
Self Documenting Code
Define Guard (google style) in Visual Assist
#ifndef $FILE_BASE_UPPER$_$FILE_EXT_UPPER$_ #define $FILE_BASE_UPPER$_$FILE_EXT_UPPER$_ $clipboard$ #endif // $FILE_BASE_UPPER$_$FILE_EXT_UPPER$_
Clamp variable to interval
#include <iostream> using namespace std; float Clamp( float a ) { float v = (a<0) ? 0 : (a<1) ? a : 1; return v; } int main () { cout<< -3 << "\t" << Clamp(-3) <<endl; cout<< 0.5f << "\t" << Clamp(0.5f) <<endl; cout<< 3 << "\t" << Clamp(3) <<endl; }
Output
-3 0 0.5 0.5 3 1
You can modify function to take interval , or use it as preprocessor directive.
Anonymous Structures
Found on MSDN
A Microsoft C extension allows you to declare a structure variable within another structure without giving it a name. These nested structures are called anonymous structures. C++ does not allow anonymous structures.You can access the members of an anonymous structure as if they were members in the containing structure.
// anonymous_structures.c #include struct phone { int areacode; long number; }; struct person { char name[30]; char gender; int age; int weight; struct phone; // Anonymous structure; no name needed } Jim; int main() { Jim.number = 1234567; printf_s("%d\n", Jim.number); }