Thursday, January 26, 2012

HDD power off disable for HP 6510b

 sudo hdparm -B 254 /dev/sda

That prevents drive parking at sec interval when running on battery.

Tuesday, January 3, 2012

OpenGL tutorials

http://ogldev.atspace.co.uk/index.html

http://www.arcsynthesis.org/gltut/index.html  -- book

Thursday, December 29, 2011

GCC vector intrinsics example

typedef int v4si __attribute__ ((vector_size(16)));

typedef int RGBA[4];

void diff(const RGBA & a, const RGBA & b, RGBA & out) {
#if 0
    for(int i = 0; i < 4; ++i)
        out[i] = a[i] - b[i];
   
    for(int i = 0; i < 4; ++i) {
        int v = out[i];
        if (v < 0) v =0;
        if (v > 255) v = 255;
        out[i] = v;
    }
#else
v4si va = *(v4si*)a;//{a[0], a[1], a[2], a[3]};
v4si vb = *(v4si*)b;//{b[0], b[1], b[2], b[3]};
v4si vr;
    vr = __builtin_ia32_psubd128(va, vb);
    *(v4si*)(&out[0]) = vr;
   
#endif
   
}

Wednesday, December 28, 2011

nimrod programming language

Found this interesting:

http://force7.de/nimrod/download.html

Integer division optimization

The idea is to replace division with multiplication and bit shift.

Found it interesting (GCC does it for you, but FPC not):
 
http://www.codeproject.com/KB/cs/FindMulShift.aspx

http://libdivide.com/

Thursday, December 22, 2011

Memory Leaks

Nice article on the topic: http://www.delphibasics.co.uk/Article.asp?Name=Memory

By the way, Pascal's manner of declaring variables in a single place ('var section') seems unproductive for C/C++ fans but it is very helpful in tracking resources (class references) -- look for the known block in a function and check if all of the references are properly freed on return.

Saturday, December 17, 2011

Lazarus problem solution for Ubuntu 11.10

" Lazarus applications have problems to run on latest Ubuntu 11.10 where the reason is new Taskbar menu and scrollbar.

To get application running like on older Ubuntu we have to remove some functionality from Ubuntu using by this command:

sudo apt-get remove appmenu-gtk3 appmenu-gtk appmenu-qt
liboverlay-scrollbar-0.2-0 "

http://62.166.198.202/view.php?id=20520