Category Archives: Programming

Linked List: An important concept to grasp

By | February 22, 2016

Understanding linked lists is very important when learning C. Understand it, master it and be able to teach it. This link explains it very well. http://cslibrary.stanford.edu/103/LinkedListBasics.pdf The key is to get your hands dirty and not only write the code samples, but experiment and alter the values and play around with it. Here is a link… Read More »

What is nice?

By | February 19, 2016

Knowing a nice person is good, being nice, even better but in the computer world, there is this funky concept of “nice” which determines the scheduling priority of a process. The scope here is that you are doing some programming and you want to be able to control or set the priority. You can set… Read More »

How swab32 or bswap_32 works

By | February 15, 2016

If you have come across some code with reference to swab32 or bswap_32 and wondered how it works, here is the answer. swab32 will probably be a function that calls bswap_32 which will probably be a macro. The macro will probably be defined as: ( (((x) << 24) & 0xff000000u) | (((x) << 8) &… Read More »

How to install or upgrade MongoDB on Ubuntu

By | December 29, 2015

Step 1: Add Mongodb to your sources.list.d (for Ubuntu 14.04) This allows you to get the latest files from mongodb.org when you run sudo apt-get install echo “deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.0 multiverse” | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list Step 2: Reload the local package database sudo apt-get update Step 3: Install MongoDB sudo apt-get install -y mongodb-org -y automatically… Read More »

True or false in C

By | December 26, 2015

A simple concept in the C language is the evaluation of a boolean expression with an if statement. But what if the condition is not a typical relational or boolean expression? In C, it is possible to write: if (x){ // if x is true or great than zero printf(“x is true/has a value/great than… Read More »

How does CPU memory work and what every programmers should know about memory

By | December 7, 2015

Came across this detailed paper “What Every Programmer Should Know About Memory” by Ulrich Drepper dated 21 November 2007. (http://www.akkadia.org/drepper/cpumemory.pdf) It is a long read but provides a wealth of background which explains some good fundamental concepts that are still valid today. Another article, http://marek.vavrusa.com/c/memory/2015/02/20/memory/ puts another “practical” spin on the original paper and is also… Read More »