Jazz all the way

Usually, when I work I need absolute silence. Especially when I write code. Any sound disturbs me. Those which have to do with human voices (phone calls, talks, music) are the most harmful. I never turn the music on or anything else when I program. I also prefer to leave all my development tasks for my night shifts.

But toda I found out that I can actually listen to music while writing code. I was looking for some new radio stations at Shoutcast to add to my music player and stumbled across some Jazz stations. I decided to try one before adding it to the list. I wasn’t yet programming, so it was OK to liste to it for some time.

It was only in the morning, 8 hours later that I noticed that I’ve programmed and did everything I had to do and never switched off the Jazz music. It didn’t disturb me even one bit. In fact I have a suspecion that it actually helped me. I will be repeating the experiment, but until than I’m surprised anyway…

Watching over logs in KDE

I know of a lot of people who enjoy having a terminal window with scrolling logs on their desktop. Setting one up was never a challange, but there are some nice KDE options that one could use that not so many people know about. At least I didn’t know until today.

Continue reading Watching over logs in KDE

Telling Gnu Arch the truth

Yet another problem (and solution) that I’ve stumbled across while using Gnu Arch. We have two branches in our archive: program--vendor--0.1 and program--local--0.1. Vendor’s version has all the source files in SomeDirectory, while our local version has all source files in somedir. Except for the name and few local changes, these two directories are practically identical.

But when we were creating branches and importing code, we weren’t very careful and ended up with these directories and files having different arch IDs. This makes comparing two source trees close to impossible, as arch thinks that directory SomeDirectory was removed together with all its content and directory somedir was added together with a bunch of files.

Telling Arch the truth is very simple. Basically, all that needs to be done is =id and *.id files under all .arch-ids/ directories in one source tree should be copied to the appropriate places in the other source tree. After that tla commit should be done.

In order to minimize the pain of manual labour, I wrote a tiny perl script to find all needed files and copy them appropriately. On the command line just specify two directories, which you know are the same, but which arch considers different. If any of the files weren’t copied, you’ll get their names in the warning. When script finishes, you’ll get the total count of copied files.

The script is here: fix_arch_ids.pl

Sending bulk HTML emails with perl

First of all, I have to warn you that using HTML in emails is almost always inappropriate. Use plain text. If you have to send HTML, than send it as an attachment.

For those cases, where HTML message has to be sent and there is no choice in the matter, here is a small perl script – send_html_mail.pl

Edit a few lines at the beginning of the file to suit your needs. From address and Subject line must be changed. Locactions of two files – list of recepients and the body of the message – can be either specified on the command line or will be taken from default values hardcoded in the script.

Run the script as:

send_html_mail.pl message.html recepients.txt

If you changed the location of data files or if you are using defaults, than you don’t have to pass any arguments to the script.

List of recepients is expected to be a comma separated list of names and emails. An example file could look like this:

You There,you@there.org
Him Somewhere,him@somewhere.net

Message body file should contain all your HTML, CSS, JavaScript and whatever else is that you want to send. Here is an example file for you:

<HTML>
<BODY>
<H1>Hi there!</H1>
<DIV>This is an HTML message.</DIV>
</BODY>
</HTML>

It is easy to change the script to send plain text messages instead of HTML. Just change the line that specifies Content-Type as “text/html” to “text/plain”.

PHP turns 10 or new ways of starting holly wars

Slashdot has an article about PHP turning 10 years old. Scrolling through the comments for the post, it seems that Slashdot editors found a new way of starting holly wars. But instead of limiting themselves with “X vs. Y” type of holly war, they do it in “X vs. everything else” manner. Makes for some interesting reading.