Archives:

how to prevent nvidia GPU hangup on ( debian 10) 5/5 (4)

debian 10 have nvidia GPU driver, cuda 9 etc, it is a good thing  for deep learning ( keras or pytorch). but  if let it running for some time ( without any interrupt), it hang after the power management kick in. Work around is to turn off the power management by doing: sudo systemctl mask • Read More »


gdb and signal handling ( especially sigwaitinfo ) 5/5 (1)

How gdb generally works In a debugging session, when the debugger wants to set a breakpoint, it replaces an instruction by int3 When the trap instruction (0xCC on x86) is executed, the processor notifies the OS. On UNIX, the OS checks to see whether the process is being ptraced by somebody. If no, the SIGTRAP signal is delivered to • Read More »


c++ lambda capture, weak_ptr, shared_ptr many subtle caveats 5/5 (1)

Some notes about C++ lamba capture, shared_ptr/weak_ptr, they are not quite obvious! (1) lambda capture implement it is simply just put the captures as members either by copy or reference. special capture this point:  we don’t need to make a distinction between local variables and fields of a class when writing lambda functions. how to • Read More »


c++ why std::shared_ptr need atomic_store, atomic_load or why we need atomic shared_ptr 5/5 (1)

shared_ptr is some sort of confusing especially why we need atomic_store, atomic_load on that. It is NOT thread safe. In fact,  the primary intended use of std::shared_ptr is letting multiple threads control the lifetime of the same object, but not thread-safe. A good summary is: A shared_ptr behaves like a built-in type regarding thread-safety, Concurrent access to distinct • Read More »


c++ pass default shared_ptr reference as nullptr 5/5 (1)

First of all, shared_ptr can be a nullptr.  Nothing wrong passing a null shared pointer. In fact, a null shared pointer is an actual Null Object, which means that it’s designed exactly for those kinds of uses.   but if we want to pass the share_ptr as default nullptr reference, we need to put a const • Read More »


srtp and h.235.6 secure rtp No ratings yet.

SRTP RFCs and h.235 is Not an easy read. Here is my very high level beriefing: AES Encryption (1) AES is the foundation for both srtp and h.235.6 secured rtp AES is symmetric encryption,  it takes those two as input key + IV:  128/192/256-bits length key , ( + optional Initialized vector or counter) src input:    • Read More »


rabbitMQ exchanges, queue , routing keys, bindings No ratings yet.

RabiitMQ implement the  AMQP protocol. written in Erlang. it is a quite useful message broker or message middleware. It works like this: sender or receiver can create different type of Exchanges. Sender of course will send message to exchange. The receiver will create a queue, and binding to the exchange. The Exchange will route the • Read More »


cmake how to build debug version No ratings yet.

Some of projects use cmake,  usually we can build like: mkdir build && cd build cmake .. camke –build . it usually a release version.   we as developer need debug version, some doc said cmake –build [–config Release] . that seems indicate if want a debug version we do: make –build –config Debug . but • Read More »


SIP Register and Kamailio AoR No ratings yet.

The RFC 3262 said: https://tools.ietf.org/html/rfc3261#section-10 The To header field contains the address of record whose registration is to be created, queried, or modified. That means TO contains AoR, and it should be some sort of sip uri. Normally we will see display name part in front of the sip uri. So if we send sip • Read More »


quick sort No ratings yet.

Quick sort High level code are quite simple ( divide/conque, recursively partition the array): void quickSort(int arr[], int low, int high) {     if (low < high)     {         /* pi is partitioning index, arr[p] is now            at right place */         int pi = partition(arr, low, high);         // Separately sort elements before         // partition and after partition • Read More »