What is the use of -fno-stack-protector?

In the standard/stock GCC, stack protector is off by default. However, some Linux distributions have patched GCC to turn it on by default. In my opinion, this is rather harmful, as it breaks the ability to compile anything that’s not linked against the standard userspace libraries unless the Makefile specifically disables stack protector. It would … Read more

What is a buffer in Node.js?

A Buffer is a chunk of memory, just like you would have it in C/C++. You can interpret this memory as an array of integer or floating point numbers of various lengths, or as a binary string. Unlike higher-level data structures like arrays, a buffer is not resizable. It corresponds roughly to: char* or char[] … Read more

What are the differences between readable and data event of process.stdin stream?

They are two different APIs that allow you to access the same stream of data blocks. The ‘readable’ API was introduced in Node 0.10.0 as part of “Streams 2”, so if you search for that, it should help. The core of the issue is that the ‘readable’ interface allows for much simpler managing and buffering … Read more

std::cout won’t print

Make sure you flush the stream. This is required because the output streams are buffered and you have no guarantee over when the buffer will be flushed unless you manually flush it yourself. std::cout << “Hello” << std::endl; std::endl will output a newline and flush the stream. Alternatively, std::flush will just do the flush. Flushing … Read more

How to know actual size of byte buffer`s content in nodejs?

You need byteLength: var buff = fs.readFileSync(__dirname + ‘/test.txt’); console.log(Buffer.byteLength(buff)); For node 0.10.21 you can try this: Update buffer.toSTring() is unsafe, since buffers are meant to store binary data and toString() will attempt to do character encoding translation which will corrupt the binary data. console.log(buff.toString().length);

Buffered files (for faster disk access)

Windows file caching is very effective, especially if you are using Vista or later. TFileStream is a loose wrapper around the Windows ReadFile() and WriteFile() API functions and for many use cases the only thing faster is a memory mapped file. However, there is one common scenario where TFileStream becomes a performance bottleneck. That is … Read more

Use of Vertex Array Objects and Vertex Buffer Objects

Fundamentally, you need to understand two things: Vertex Array Objects (VAOs) are conceptually nothing but thin state wrappers. Vertex Buffer Objects (VBOs) store actual data. Another way of thinking about this is that VAOs describe the data stored in one or more VBOs. Think of VBOs (and buffer objects in general) as unstructured arrays of … Read more