Adiposity

A Windows XP I've installed in VirtualBox perhaps two years ago grew so much in size by updates alone that the 5 GB system partition became too small. Since my virtual Windows 7 broke from installing the Cisco 64 bit vpnclient and had to be deleted, I needed to act. No, deleting the files left from updates isn't a good idea. I did that after installing the .Net framework, and now I neither can update the framework, nor can I uninstall or reinstall that crap.

How to expand the disk in VirtualBox? First, create a new harddisk with the desired size (I've chosen three times the size of the old one) in the "Storage" menu of VirtualBox. Next, clone your old disk by the following command:

VBoxManage clonehd –existing old_hard_disk.vdi new_hard_disk.vdi

Select the new disk under "Storage", and resize the partitions. I used gparted to do that since the Windows tools are either not able to do that or too difficult to use (gparted was also my tool of choice prior to installing Windows 7, which is unable to create more than 3 logical partitions).

I know that I'm a complete idiot when it comes to Windows, but how can anybody not be, if one's mind is based on rational grounds? It all seems so horribly twisted and bizarre.

NumericQ

Mathematica is best known as a computer algebra system and its corresponding capabilities in symbolic computation. In recent years, however, Wolfram has implemented huge improvements in terms of raw speed in numerical computations. In my daily work, I found that Mathematica now often outperforms dedicated numerical systems such as Matlab.

In this context, a particularly convenient feature of Mathematica is how it's handling numerical objects. The following integral, for example, cannot be expressed in closed analytical form.

$ U(B) = S \int_0^\infty dt \exp(-\Delta x^2/4 D t) \exp(-t/\tau) \cos(g \mu_B B t/\hbar)/ \sqrt{4 \pi D t} $

Yet, it is still easily possible to use it in fitting experimental data:

Numerical fit

To compute the integral itself takes about 150 ms on my humble E6600. The fit to 32 datapoints takes about 60 s, and the plot 15 s (as indicated in the notebook). To obtain the result (the non-local electrical Hanle effect) experimentally, well, that took our student a year. Which is why we emptied a bottle Moët & Chandon after the measurement. 😊

Citations

Each journal has a different style for citing references in the body of the article. Some prefer inline citations in brackets, preceeding all punctuation symbols. Others use superscript citations directly behind the punctation symbol. If a manuscript is submitted to a journal of the former type, rejected there and subsequently resubmitted to a journal of the second type, all citations have to be touched to read

rhabarber.\cite{jones_prl_1970}

instead of the previous

rhabarber \cite{jones_prl_1970}.

The following command replaces all of the latter with the former, including those bound with a comma or a colon. The changes are written back to the manuscript at once.

sed 's/ \(\\\cite{.\+}\)\([,.:]\)/\2\1/' -i manuscript.tex

PS: In some cases, an easier solution is available. In REVTeX 4.1, for example, the proper position and spacing of the citations is automatically taken care of by the class option 'citeautoscript'. For classes compatible with the 'cite' package, the option 'super' will achieve the desired effect. In all other cases, the above one-liner will have to do.

Much ado about nothing

When the chief public-relation officer runs into your office in the early morning, and breathlessly asks whether the use of Google Analytics may render the company liable for prosecution, you know that something very weird has happened.

As it turned out, a character named Caspar seems to be on a personal crusade against the Google empire since quite some time. Last week, this individual theatrically announced the end of his negotiations with Google and threatened to sue individuals and enterprises alike for the use of Google Analytics, the root of all evil. Hysterical, isn't it? 8)

All this fuzz came to an abrupt stop when Caspar's homepage was discovered to make use of tracking code as well (his page at the University of Hamburg, which is also down, used Google Analytics).

While this little breeze in a teapot provided a welcome distraction from the daily routine, it also attracted my attention to Google Analytics. Since I'm born with a natural tendency towards statistics, and learned to be fond of pretty graphs, I quite like what I see there. Because of that, but partly also in response to the Google phobia fostered in this country, I decided to give Google Analytics a closer look. See the Impressum for further details.

Two more things:

  • When asking for privacy, don't cry for the big brother. It's up to you.
  • Going for a witch hunt while ignoring the actual problems hurts the cause.

Vectorize

To create a vectorized sketch from a photograph for a brochure or for use as a logo:

  1. Open the photograph in Gimp and create a sketch of it as described in the following. Please understand all values as suggestions only. Feel free to experiment. 😊
  2. Image/Scale image (150–300 dpi)
  3. Ctrl-Shift-D (duplicates the layer)
  4. Filters/Blur/Gaussian Blur (typically 2% of the dimension of the image)
  5. Colors/Invert
  6. set opacity to 50%
  7. right-click on layer, Merge Down
  8. Colors/Levels, set to 100–155
  9. Colors/Desaturate
  10. Colors/Levels, set max to 128, play with Gamma
  11. Save. A script called quick-sketch is available, but the above gives you a higher degree of control.
  12. To vectorize this sketch, open it in inkscape via the File/Import feature. Then:
  13. resize page to selection via Ctrl-Shift-D (Document properties)
  14. Shift-Alt-B (Trace Bitmap)
  15. Mode: Grays, check stack scans
  16. Options: suppress speckles 25, smooth corners 1, optimize paths 5.

Here's an example created by the above procedure:

Berlin

PS: If you don't see an image above, try another browser. Opera 11, IE 9 and all current Webkit incarnations (Chromium, Safari, Konqueror, Uzbl, Midori …) support svg as image format. Firefox will support it in the soon-to-be-released version 4.

Seafood

The first (and often lasting) impression an operating system leaves on us much depends on the shell it offers. For illustration, imagine you would be asked to configure the services on a stone-age Unix such as Solaris 2.2 using /bin/sh and nothing else. That's right, no bash. I tell you: this is a traumatic experience which can easily lead to frequent nightmares and a general restlessness.

Fortunately, all modern systems use the bash as their default shell. The bash is the least common denominator, and after one or two adjustments it's actually quite pleasant to use. Of course, it doesn't have the power of the almighty zsh, but then, who has?

There are a number of lesser known shells, and I like to try one from time to time. One to which I grew fond of is the fish shell, whose name seems at first just to be a pun, but actually translates to friendly interactive shell. And it is friendly, this fish. 😊

It's not only the greeting, it's the tab completion and streamlined history as well as the unique open command: features which are second to none and intuitive at the same time. The ease of use, however, has attained fish the dubious fame of being a good shell for novices. It certainly is, but is an experienced user truly above of being informed by the shell about the nature and intention of the several thousand binaries scattered across his system? I don't think so. 😉

Fish not only improves on immediately obvious features, but also attempts to establish a clean and consistent syntax and thus differs in several regards from the bash. The author of the fish shell described all of these aspects in an illustrative article in the early stage of development.

In its default configuration, the fish shell provides several ameneties and conveniences either not available or well-hidden in other shells (such as, for example, the autocd feature 😉 ). Out-of-the-box, the fish shell lacks only some aliases which I'm used too. Their setup is simple, though:

alias c='clear'
funcsave c

and so on for p, ' cd -p', s, 'cd ..', x, 'exit', etc. 😊

The fish functions are, by the way, stored at /home/username/.config/fish/functions.

Mandrolla

Many of you will know that that the future of Mandriva looks bleak. Most of the active developers of Mandriva were layed off following the liquidation of Edge-IT, a Mandriva SA subsidiary, earlier this year. A few days later, these developers announced a fork of Mandriva, purely community driven and called Mageia. The community was delighted and declared Mandriva dead almost unanimously. Mandriva SA, in turn, protested and assured that Mandriva is alive and intends to stay so.

I actually thought that all this bickering wouldn't matter to me any more, as I've planned to acquire a new computer and to install an entirely different distribution during the Christmas holidays. This won't happen for various reasons, and for a lack of both time and energy, I've decided to just let Mandriva continue to run on my trusted E6600. And why not? Everything works fine, and I have far fewer complaints than with certain other distributions. 😉

So, I was comfortably settled, when suddenly updates started to pour in. Imagine my surprise when one of these updates turned out to be a brand new kernel. Is Mandriva going to be a rolling distro after all?

No, it won't. Actually, this rather unexpected upgrade is officially a Christmas present. Others will suspect an act of desperation, but I'd say that was simply necessary to keep the distro on a competetive level. Who knows, perhaps there's life in the old dog yet. 😉

Bugbuntu

The parade of issues and bugs in recent versions of Ubuntu is becoming a nuisance. The drivers B43 and STA for the Broadcom wifi chipsets popular in notebooks have a particularly irritating and serious bug: when on battery, the wifi chipset toggles between the on and off state on a ms time scale even when a connection exists, resulting in a latency of several 100 ms and low transmission rates. Since my mini also has a Broadcom chipset:

cobra@mini ~> lspci | grep Network
03:00.0 Network controller: Broadcom Corporation BCM4312 802.11b/g LP-PHY (rev 01),

I've notived this problem when attempting to run applications from my desktop via ssh, such as 'ssh -Y -C mathematica'. It's unbearably slow.

A temporary solution is to simply switch off power management for the chip for the time being:

iwconfig wlan0 power off

A permanent one is established by editing /usr/lib/pm-utils/power.d/wireless and to ensure that all entries under case $driver concerning operation with battery are equal to the corresponding ones with ac power on (the above link has an explicit listing).

SSH in the LAN

My preferred protocol to connect networked devices is ssh. That includes local area networks, where even seasoned Linux users (for reasons which escape me, sshfs exists) usually employ smb/cifs.

If you want your ssh server to listen only to its local address (for example, 192.168.178.21), and only to specific users (for example, cobra) and devices (for example, 192.168.178.22) in the local network, add these lines to /etc/ssh/sshd_config:

ListenAddress 192.168.178.21
AllowUsers cobra@192.168.178.22

As usual, I'd also set

PasswordAuthentication no
PermitRootLogin no
StrictModes yes
MaxAuthTries 1
RSAAuthentication no
PubkeyAuthentication yes

In the present case, these settings serve convenience besides security, of course. Entering passwords in our local network on devices physically located in our very home would be, well, silly, to say the least.