Search This Blog

Saturday, September 29, 2012

Programming fonts

My eyes loves good looking fonts.
Sometime ago adobe is released new font for programmers - Source Code Pro.
Looks nice ... but i've expected more. By my opinion absolutely best font is - Bitstream Vera Sans Mono.
But both of types have troubles with encoding. For example, cyrillic is not supported by them. For console i've usually use DejaVu Sans Mono.

Are you using Sublime Text, no? See it!

Few days ago i've arranged amazing video tutorial about sublime text. If you are not using this editor see this video tutorials to understanding powerfull of sublime text.

Perfect Workflow in Sublime Text 2

Friday, September 7, 2012

Loop for printing values of container

In the past my printing methods looks like that:

for (iterator it = begin(container), endIt = end(container); it != endIt; ++it) {
    if (it != begin(container)
        printDelimeter();
    printValue(it);
}

So, it's checking for begin to write delimeter looks ... uneffective. Reading stackoverflow.com i've notice that people use this method very often. Looking gtest code i've seen the more effective implementation:

if (container().empty())   
    exitHere();
iterator it = begin(container);
printValue(it);
for (iterator endIt = end(container); it != endIt; ++it) {
    printDelimeter();
    printValue(it);


It's so simple and easy.

Saturday, May 26, 2012

Eclipse CDT: Disabled build settings (Windows)

If you using Eclipse CDT under Windows OS, you can have some troubles when creating project and trying to change build settings, such as builder, build dir and other. It's happen when you choose toolchain for project.

Using toolchains is good, because eclipse automatically imports include dirs and macros for choosed compiler and add it to indexer. On screenshot above you can see default settings for mingw compiler.
But, if you using toolchain all settings on build settings page looked grayed, so they are disabled.
If you want to allow Eclipse change builder settings you need to open C++ Build - Tool Chain Editor tab and select another builder. See screenshot above.
You can choose Gnu make builder or linuxtools builder, i didn't see difference. 
Now, you can customize builder settings.

OCI : Handling no data found exception (01403)


Interesting things happen in this world. Exception 01403 (NO DATA FOUND) converts to OCI_NO_DATA status.

OCI error code :

/*————————Error Return Values——————————–*/
#define OCI_SUCCESS 0 /* maps to SQL_SUCCESS of SAG CLI */
#define OCI_SUCCESS_WITH_INFO 1 /* maps to SQL_SUCCESS_WITH_INFO */
#define OCI_RESERVED_FOR_INT_USE 200 /* reserved */
#define OCI_NO_DATA 100 /* maps to SQL_NO_DATA */
#define OCI_ERROR -1 /* maps to SQL_ERROR */
#define OCI_INVALID_HANDLE -2 /* maps to SQL_INVALID_HANDLE */
#define OCI_NEED_DATA 99 /* maps to SQL_NEED_DATA */
#define OCI_STILL_EXECUTING -3123 /* OCI would block error */

So, if database raised exception NO_DATA_FOUND(01403)  we expected OCI_ERROR, but OCI handles exception 01403 as OCI_NO_DATA.