The Linux Page

Help other users realize that everything is possible, especially avoiding Windows for their own personal use.

Welcome to The Linux Page


Fox Trot by Bill Amend. Click to enlarge.
Click to enlarge

This site is a collection of my own work with Linux. Certain things are easy, others take time to decipher and if I ever need to repeat the work (which usually happens!), then I need to remember everything by memory or... have a site with all the steps taken and to take again.

The following are my most recent posts:

A Telephone post with many lines to the surrounding homes.

I have noticed that quite a few people were trying to create UDP communication and I thought that proposing my class could help them. This is very basic as it does not define anything such as the size of a packet or any protocol to ensure arrival of the packets. However, it can be useful if you want to send a signal from one process to another, which is exactly how I use this implementation (i.e. I send a PING message to wake up a background process whenever the front end adds data to the database.)

This code is part of the Snap! C++ implementation. The latest version can be found in GitHub ...

Today I started to really have a need to be able to lower a window in MS-Windows without having to raise all the other windows in the right order. It is rather unfortunate that clicking a window forces it to be raised in the first place, X-Windows is way better for that since day one, but on top of that, there is no button to lower a window.

Okay so under Linux there is no button on the window to lower it, but you can middle click on the title bar and the window goes behind all the others (and yes, that happens by mistake once in a while, but the 99.9% of the time I use it right, it's a ...

Transporting PostgreSQL

When moving a database from one computer to another, you've got to copy all the data.

For that purpose PostgreSQL offers a pair of functions named pg_dump and pg_restore.

In most cases that works great, however, some applications may create things such as additional functions that will NOT make it across. I do not know how to get that to work (and maybe it works in newer version of PostgreSQL?)

In any event, in most cases the following commands are enough (I used them with Drupal websites and since they stopped using some of the definitions they have in the system.install file used on ...

Long command can be written as separate strings in cmake

Today I really wanted to write a command on multiple lines because I pass many command line options to it and it started to look really very long (much wider than my editor width).

There are many entries on how to run multiple commands: write one ADD_CUSTOM_COMMAND() per command. Simple enough. If you really only want one single ADD_CUSTOM_COMMAND(), you can always write a shell script (a .sh file) and put all the commands in there.

However, writing a single command with many command line options separated by spaces on multiple line is not well explained in the ADD_CUSTOM_COMMAND() ...

Merging PDF files together

Now that I have an HP scanner that directly generates PDF files, I have a new problem:

In some cases. I scan multiple documents and get separate PDF files. Later I need to merge those separate PDF files together to form a single PDF that I can share with others.

The Poppler project actually includes the perfect tool for this purpose. Here is the command one uses to do the merging:

pdfunite in-1.pdf in-2.pdf ... in-n.pdf out.pdf

Voilà!

Now out.pdf is one single PDF composed of all the input PDFs 1 to n.

Old insulator installation

The .install File

The default manner in installing files in a Debian or Ubuntu package is to create a <package-name>.install file. That file has an extremely simple format that goes like this:

<path & name of file to install>    <installation path>

You can repeat this for each and every file you want to install.

99% of the time, that works great and I tend to use it a log.

There are several issues with the default format in this file:

1. Path Variation

The path to the files changes if you have a single package or if you have two or more. In the ...

Endless Pier, Endless Possibilities with less

Adding More Support for Binaries

The less tool does a lot more than just show plain text files now a day.

This is done by piping the output of one or more commands run against the input, instead of directly showing said file contents.

The extension works through a set of variables named LESSOPEN and LESSCLOSE.

The LESSOPEN has a pipe at the start, end the name "lesspipe" for the script doing the heavy lifting:

| /usr/bin/lesspipe %s

The idea is for that script to write the results you want less to display to stdout.

So for example that script could do:

echo ...

Iconic Chess Pieces

Changing a Virtual Machine (VM) Icon

By default, VirtualBox assigns a default icon to your VMs. That icon appears in your bar of icons (usually on the left side of the screen) and also in the VirtualBox interface.

If you just have one or two VMs, that's certainly not a huge issue. When you have 50 to 100, it becomes tedious to know what's what since all the icons will look alike (by default, they select the icon based on the operating system defined for that VM).

The solution is to assign a new icon to your VMs.

First, make sure that your icon is a square such as 48x48, 96x96, ...

Colors in Hexadecimal

See Binary File Contents

The Linux system comes with a tool named xxd, which is very useful to print binary files to a list of hexadecimal bytes.

It is pretty well thought of. I had my own atype command, but I now tend to use xxd because it's by default on most Linux systems, so no need to compile & install my own tool.

The most interesting feature, which I found out today, is that the tool is capable of doing the inverse (see the -r option): it can read its own output and generate a binary file again. It actually doesn't need to be output from xxd, just hexadecimal codes.

Rusty lock... when a deadlock happens, locks tend to rust over time.

Once in a while, in rather complicated application, I end up with a deadlock.

Looking for what is happening can be tedious since a deadlock doesn't tell you anything other than: this thread is waiting on a mutex (or possibly even a condition on a mutex).

In case of a deadlock, though, the mutex is already locked by another mutex and it is easy to find out which other thread locked the mutex.

In many cases, when a deadlock occurs, the two threads use the same two (or more) mutexes and at some point both are trying to lock those two mutexes out of order (A then B for one and B then A ...

Thank you for visiting my website.