Sunday, August 8. 2021
Currently, in CQRLOG 2.5.1 of Ubuntu 21.04, QSL export for label printing is broken due to a FreePascal bug:
TRegExpr exec: empty input string.
Version 2.5.2 contains a fix, though. Now I had the choice between these unpleasent options:
- Go through dependency hell by using the CQRLOG PPA for Ubuntu. This repo however has got some unresolvable dependencies. Attempts to work around these moved my system from MariaDB back to MySQL, resulting in a migration of the system database directory, what made a “downgrade” back to MariaDB another huge stumbling block. Luckily, I could switch back to 2.5.1 on MariaDB again.
- Go through dependency hell by trying to compile CQRLOG from source. Either I’d have to mess with several odd development packages on my system directly, or by using a Docker container. This was a path I didn’t really want to take.
- Delay printing QSL cards for several months until Ubuntu 21.10 is out (which hopefully contains that fix).
Couldn’t I somehow work around that bug? After all, I just wanted to dump certain log entries to a CSV. This could be done using an ordinary MySQL client! And this is the procedure to do so:
Start CQRLOG, this launches a MySQL (MariaDB) server instance in the CQRLOG data directory, which is ~/.config/cqrlog/database by default, listening on port 64000. Now, simply connect to it:
$ mysql -h 127.0.0.1 -P 64000
Use the desired database:
> use cqrlog001;
Query, using the columns you usually export:
> select qsodate, time_on, callsign, mode, freq,
rst_s, qsl_via, remarks, stx, stx_string
into outfile ’/path/to/qsl_test.csv’
fields terminated by ’,’
from cqrlog_main
where qsl_s in (’SMB’, ’SB’);
The resulting CSV is already almost in the usual format, except for the date. In Vim, I did these transformations:
:%s/^\(\d\+\)-\(\d\+\)-\(\d\+\)/\3-\2-\1
:%s/-05-/-May-
:%s/-06-/-Jun-
:%s/-07-/-Jul-
etc.
As soon as I was satisfied with the result (in gLabels), I marked these QSL as sent:
> update cqrlog_main set qsl_s = ’B’ where qsl_s = ’SB’;
> update cqrlog_main set qsl_s = ’MB’ where qsl_s = ’SMB’;
Querying around in that table is also a good opportunity for one’s own statistics.
Wednesday, October 19. 2016
I recently managed to reactivate my dear old Epson HX-20, a retro computer released in 1983 which I used at the end of the 1980’s and early 1990’s to learn programming. Since I even could read in some BASIC programs that were still stored on the micro cassette, I wondered if I could rescue the code directly, without using OCR on printouts or even typing it off by hand. I was aware that I was very lucky that this machine still worked after all those years—the soldering seemed to have been much more rigid back then, it might cause more issues to attempt to run old PCs which are a decade younger! To be on the safe side, I invested into a new NiCd battery pack and replaced the original one.
My research first led me to the machine’s RS-232 output, internally called “COM0”. Someone had used that some years ago to directly connect an HX-20 to a PC’s serial port, using a special cable and some adapters. Sadly, it seems that this is no longer an option, since these cables disappear, and serial-to-USB adapters only seem to work with a certain chip in this case.
Then I stumbled upon the GPL software HXTape, and I was totally baffled: What, the Epson HX-20 had an external cassette interface as well? I knew that concept from our even older machine, the Texas Instruments TI-99/4A. It connected to a special music cassette recorder and encoded data into simple “magnetic bits” onto the tape:
It was quite funny to listen to the noisy sounds when playing the MCs on an ordinary player.
This bidirectional data transfer works over ordinary mono audio cables, one for each direction. And now, it turns out the HX-20 had such an interface as well, and we never used it. But the point is, one could exploit it to decode the audio signals into the original bits and bytes by connecting the HX-20’s “MIC” port to the microphone input of a PC using a simple mono audio cable with standard 3.5 mm jacks! (How tremendous the analog world was! Keep a music cassette lying around in the basement for decades and then just play it. Try this with your ¡Phone!) And that audio decoding is exactly what HXTape is doing.
Continue reading "Rescuing data from an Epson HX-20 to a Linux PC"
Wednesday, December 4. 2013
My boot partition was so small that I couldn’t do any initramfs-updates any more, so I backed it up, deleted /dev/md0 (boot) and /dev/md1 (swap) to recreate both with new sizes, restored my backup, and after a reboot grub couldn’t find anything due to the new UUIDs of the partitions.
Before I rebooted, I should have merged the output of `mdadm -Es` into /etc/mdadm/mdadm.conf, followed by
# update-grub
# grub-install /dev/sda
# grub-install /dev/sdb
Instead, I had to go through this:
At grub rescue prompt:
> ls (md/md0)/
> set root=(md/md0)/
> set prefix=(md/md0)/grub
> insmod linux
> linux (md/md0)/vmlinuz-3.11.0-13-generic
> initrd (md/md0)/initrd.img-3.11.0-13-generic
> boot
... bringing me to a BusyBox/initramfs emergency prompt:
# ls /tmp
# cd /tmp
# mkdir disk
# mount /dev/md2 disk # root directory
# chroot disk
... bringing me to a simple bash prompt in my system:
# mount /boot
... as well as:
# mount /proc
# mount /sys
# mount /dev
... to be able to run:
# update-grub
# grub-install /dev/sda
# grub-install /dev/sdb
You wouldn’t learn much if you weren’t forced to fix things once in a while. — myself
Wednesday, November 27. 2013
Quote of myself from four years ago:
I had to do the migration to a parallel machine and had only one week to accomplish this. I’ll never do it this way again, however, rather pay for two servers for a short time and decide when to finally switch.
This is exactly how I did it this time.
Although Debian 5 lenny had been released in Feb 2009, it didn’t yet make it into Host Europe’s 4.0 line of virtual servers; instead, that virtual machine was still based on 2007’s Debian 4 etch, which received its last kernel update, still 2.6.18, by the provider in Aug 2011. I upgraded it to Debian 6 squeeze nonetheless. I noticed that this year’s Debian 7 wheezy does not run under an etch kernel (especially libc6, rkhunter and aide), and as squeeze is already oldstable since May and will no longer be maintained by next May, it was time to perform an upgrade.
Now I run an instance of their 7.0 line with the same price, but RAM and disk space were both doubled (to 2 GB and 100 GB, respectively). It is still based on squeeze with a 2.6.32 kernel; based on my experience, I expect it to run wheezy and jessie before I have to switch again (in about another four years).
Like previously (and like seven years ago), I did the TCP forwarding using rinetd, except for Postfix, for which I set up relaying again.
Tuesday, February 28. 2012
... or, actually, to Perl’s Finance::Quote, under Ubuntu 11.10:
- Clone one of the source modules in /usr/share/perl5/Finance/Quote (came with libfinance-quote-perl), say, Morningstar.pm, and place it under a new name into /usr/local/lib/perl/5.12.4/Finance/Quote, say, as Morningstar/AT.pm. (That’s what I did, I’ll probably make that module available.)
- Modify this module into a uniquely new entity, providing appropriate IDs, like morningstar_at.
- `perl -e ‘use Finance::Quote::Morningstar::AT’` should not display anything—especially no error.
- Copy /usr/share/perl5/Finance/Quote.pm to /usr/local/lib/perl/5.12.4/Finance and add Morningstar::AT to @modules.
- Execute `gnc-fq-dump | grep --color=auto morningstar`, you should see both morningstar and morningstar_at.
Your new quote source should now be available to GnuCash:
- Go to Tools → Security Editor → Add (or Edit) and enter the appropriate “Symbol/abbreviation” and “ISIN, CUSIP or other code”—note that the symbol is not the ISIN in the case of Morningstar.at, it’s the ID in the URL! Check Get Online Quotes, switch to Unknown and select morningstar_at.
- Go to Tools → Price Editor and click Get Quotes. After a few seconds you should see new entries with the current prices.
Friday, February 25. 2011
(I started this as a draft two years ago, but wasn’t sure about its correctness then.)
Usually, one uses the -a switch when archiving files with rsync from Unix to Unix. -a is an abbreviation for -rlptgoD, which means
- -r: recurse into directories,
- -l: copy symlinks as symlinks,
- -p: preserve permissions,
- -t: preserve modification times,
- -g: preserve group (ownership),
- -o: preserve owner,
- -D: preserve device and special files,
but this doesn’t make sense if the target is an MS FAT device (such as a USB key) or a CIFS/SMB/Samba host, as that old file system cr4p doesn’t know anything about symbolic links, file permissions, ownerships or other Unixy properties. Thus, rsync fails to match these features at all and synchronizes every single bit of every single file again.
The solution I found is to simply use the tuple of time-stamp and file size as the only criteria whether something has changed. This still results in warnings about that the time-stamps of directories couldn’t be set, but at least the sync works. An example command line could thus be
$ rsync -rt $source $target
Sunday, December 20. 2009
Probably.
|