Skip to content

Category Archives: computing

Quiet program output

24-Oct-10

myprogram > /dev/null 2>&1 With: stdin == 0 stdout == 1 (default if omitted) stderr == 2 > /dev/null, redirects stdout (omitted) into /dev/null. 2>&1 Redirects stderr into stdout. Some confusing syntax: 2>1 Would redirect stdoud into a file called 1. 2&>1 Execute file 2 in the background and redirect its output to a file [...]

ctags

24-Oct-10

Ctags is a program that generates an index (or tag) file of names found in source and header files of various programming languages. A nice introduction to ctags and other related programs can be found here. An example of using ctags is this function counting script: 1 2 3 4 5 6 7 #!/bin/sh   [...]

Makefile template

24-Oct-10

This is not a finished example, but it contains enough information for me to use as a template most of the times. A bit of previous experience with GNU make and the places to modify are obvious. It helps me with the blank page syndrome. Some helpful links: GNU make GNU gcc GNU binutils   [...]

C Linux command line application skeleton

19-Oct-10

#include <stdio.h> #include <unistd.h> #include <string.h> #include <fcntl.h> #include <signal.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <errno.h> #include <pwd.h>   static int debug = 0;   static const char * log_file = "logfile.log"; static char * lock_file = "lockfile.lock";   #define BUFF_SIZE 64   /* Change this to the user under which to run [...]

C Linux command line application skeleton

19-Oct-10

#include &lt;stdio.h&gt: #include &lt;unistd.h&gt: #include &lt;string.h&gt: #include &lt;fcntl.h&gt: #include &lt;signal.h&gt: #include &lt;stdlib.h&gt: #include vsys/types.h&gt: #include &lt;sys/stat.h&gt: #include &lt;errno.h&gt: #include &lt;pwd.h&gt:   static int debug = 0;   static const char * log_file = "logfile.log"; static char * lock_file = "lockfile.lock";   #define BUFF_SIZE 64   /* Change this to the user under which to run [...]

Dropping cached memory

29-Sep-10

Did you ever want to know how much memory your kernel is using? Linux caches a lot of memory on disk accesses to try and speed up future disk accesses. As a consequence the free command displays the following:               total       used       free   [...]

cp vs install

02-Sep-10

The command cp attempts to open the destination file in write-only mode and write the new contents. The contents of an executable or dynamic library are mmap’d into the linear address space of relevant processes. Therefore, any change in the underlying file affects the mmap’d memory regions and can potentially break programs. When trying to [...]

Intel x86 architectures

10-Nov-09

The Intel core architecture Traditionally CPUs are connected via a front side bus (FSB) to the northbridge which contains the memory controller. Other I/O devices (PCI/PCIe,SATA/PATA,USB/IEE1394 etc) are connected to the southbridge.   Interprocessor communication travels through the FSB, as does the communication between CPU and RAM. All RAM access uses the northbridge. CPU and [...]

Porting your 32 bits application to 64 bits

28-Aug-09

The big difference: ILP32: int, long and pointers are 3 2bits.LP64: int are 32bits, long and pointers are 64 bits. Look out for: Problems with 64 bits long and pointer types: 32 bits applications usually assume int, long and pointers are the same size. int and long are not to be used interchangeably. All pointers [...]

Computer Hardware Chart

26-Aug-09

Surely this is a useful thing to keep handy, via Sonic840 at DeviantArt. Download in low resolution or high resolution.