Timmurphy - timmurphy.org - timmurphy.org

Latest News:

Custom signal handlers in C++ 16 Aug 2013 | 05:22 pm

Using the signal(...) routine (defined in the csignal or signal.h headers), you can define how various signals are handled by your program. The routine takes two arguments; the first is the signal you...

Editing a file in hex mode in Vim 27 Jul 2013 | 05:37 pm

Native Vim doesn’t have a hex editing mode built in, however it is possible to edit a file in hex by converting the file back and forth using xxd. To do this, open your file in Vim and run :%!xxd. Fro...

Internal Write (sprintf) in Fortran 90 12 Jul 2013 | 08:36 am

If you need to generate a string which is made up of different variables (integers, floats, other strings, etc), you could use the sprintf routine in C. To achieve the same results in Fortran 90, you ...

Template Metaprogramming in C++ 27 Jun 2013 | 02:22 pm

One frequently used feature of C++ is templates. Templates can be applied to classes and functions to make your work more generic without sacraficing runtime performance. It’s a fantastic feature that...

Functors in C++ 11 Jun 2013 | 07:36 pm

One neat feature of C++ is Functors, or function objects. Essentially, functors are just like normal objects, but they can be ‘called’ like any other function; they can take any number of arguments of...

Splitting a string with a given delimeter in python 28 May 2013 | 02:19 pm

Strings in python can be split using any given delimeter. Unlike other languages, the delimeter can be a string of any length; it’s not limited to one character. To do this, you can use the .split( ) ...

<string> contains <substring> in bash 13 May 2013 | 11:54 am

There are a few ways to find out if a string contains a substring using bash. Below are a couple of ways this can be done without invoking any other processes. Star Wildcard One very simple method is ...

Reversing a string in Python 25 Apr 2013 | 09:32 am

If you need to reverse a string in python, the easiest way is to do use the my_string[::-1] syntax. For example, to print a reversed string, you could write: my_string = "ABCDE" print my_string[::-1] ...

Running C++ code from a C program 11 Apr 2013 | 09:33 am

There are times where you have a C program but would like to call code written in C++. This is quite easy to do, and if done right will work on all (compliant) compilers on multiple platforms. To achi...

How to find the UUID of a disk in Linux 24 Mar 2013 | 06:19 pm

If you need to find the UUID of a hard disk in Linux, to add an entry to fstab for example, you can use the blkid command. There are many other methods available, but blkid prints the UUID with the la...

Recently parsed news:

Recent searches: