Tuesday, 28 December 2021

Text formatting on a mainframe

Today I recalled that as a student in the 70s I discovered that the line printer attached to the Univac 1108 mainframe at my university's computer centre could print lower case characters. So I modified the Ratfor workalike of the Unix roff program that I had entered into the computer to treat all alphabetic characters as lower case, and implemented escape codes to raise (and lower later) the case for capitalised words and acronyms. This was to be able to use punch cards as input, as the terminals were not always available. I don't remember if I implemented auto-detection of beginning of sentences, probably not. I even typeset my undergraduate thesis this way.

At that time I was using Ratfor as a structured Fortran, having been introduced to it and the book that described it, Software Tools, at a work experience stint, and had not yet encountered Unix in person. It was only when I did my masters that I learnt Unix and C.

I have wondered if the computer operators were surprised by the appearence of lower case printout since everybody else seemed to accept that UPPER CASE was the only case available.

Monday, 4 October 2021

Have you tried turning it (VirtualBox) off and on again?

I had a strange problem where USB devices were detected on the host system (Linux) but did not appear as available devices for a VirtualBox guest (XP). The strange thing was that I could use the devices normally on Linux, but they just didn't appear to the guests, not just XP but also a Debian guest.

I searched high and low for reports of the problem but nobody else seemed to have had it. And it was working before, although I was not sure if there was an intervening Linux kernel upgrade.

Finally in desperation I decided to reboot the system. Lo and behold, after that the devices became available to the guest. My best guess it that somehow the part of VirtualBox handling the USB forwarding got wedged. So give the old The IT Crowd advice a try.

Saturday, 27 March 2021

My first and only postcardware

Back in the 90s I wrote a couple of DOS programs that turned a PC, even an ancient model like the XT, into a diskless printer spooler, using the LPR or JetDirect protocols over Ethernet.  It was my attempt to repurpose superannuated PCs for useful work. The PC could even be network booted, thus not requiring even a floppy drive.

Anyway, I released the program as open source postcardware, which is a variant of shareware, where the user is encouraged to send a postcard to the author if they like the program. I got a few postcards, mostly from Europe, in the years that followed. Here are the 4 I found in my old letters. I think I have another from New Caledonia but I haven't found it yet.

Since then I have released open source software under more conventional but less interesting licenses.

A Bonn scene

Same author, also Bonn

Heidelberg in winter

Lisbon, but I think the author was Dutch

Tuesday, 8 December 2020

Get gitlab browsing statistics for your project

Unlike github, gitlab doesn't provide a web page to see the browsing activity on your project. But there is an API to fetch this information in JSON format. I explain how it's done so you can avoid the pitfalls I encountered.

In the documentation, all the API calls are with respect to a base URL, which is currently:

https://gitlab.com/api/v4

This StackOverflow post confirms this base URL. It also shows how the access token is passed to the GET request, as an extra header.

Getting a personal access token is described here with screenshots. You can set an expiry date for the token. Make sure you save a copy of it as you cannot see it again once generated.

Now if you look at the API documentation, the relative URL to get the statistics for the last 30 days is described here and is:

/projects/:id/statistics

This is where I got fooled. The : is not to be entered literally. Instead substitute the numeric ID of your project.

Putting it all together, here is the curl command to get the statistics for a fictional project ID of 1234.

curl -H 'PRIVATE-TOKEN: yourtokenhere' https://gitlab.com/api/v4/projects/1234/statistics

And here is typical output:

{"fetches":{"total":3,"days":[{"count":3,"date":"2020-11-23"}]}}

There is no newline at the end, JSON doesn't need it. But you'll be using some other utility to parse and display the statistics in a user-friendly form.

Now you can use this information to get all the other information exposed by the API. Some relative URLs don't require authentication if the project is public.


Monday, 30 November 2020

Upgrading unetbootin to remove qt4 dependency

When my openSUSE Leap 15.2 showed a libqt4 update I wondered what application needed these old libraries. Removing libqt4 removed a bunch of library dependencies and the one application that appeared was unetbootin. A search showed that Ubuntu 20 users had encountered missing libqt4 problems too, and the official solution is to upgrade to unetbootin 681. Even though libqt4 is still supported in Leap 15.2 I decided to upgrade. This can be done as a one-click install from software.opensuse.org and the "experimental" package is from the filesystems repo. I guess the next release of Leap will make unetbootin 681 official.

As a bonus this freed up about 150 MB of disk space now that nothing needs qt4 any more.

Friday, 4 September 2020

Ripping CDs to AAC (M4A) files

Since MP3 is officially obsolete and AAC is a better format, I have decided to rerip all the CDs I own to this format.

This is quite easy with k3b,  you just have to add another external encoder specification. I got most of the info I needed from this blog post. One problem was ffmpeg was spitting out too many messages, so I did this:

ffmpeg -v 24 -i - -b:a 256k %f

The -v 24 is to suppress the normal informative output from ffmpeg which is quite verbose.

I also wanted to add tags, so after ripping I run this kid3-cli command in the directory:

kid3-cli -c 'select all' -c 'totag 3' -c save -c exit

This puts the tags implied by the filenames into the tags.

Don't forget to specify Write WAV Header as the original blog post says.

Wednesday, 5 August 2020

Accessing Samba 4.11 shares from old clients, e.g. XP, Android apps, media players, etc

NB: Please do not do this if you are running a work network, as SMB1 has insecure authentication, and traffic is in clear. Get your clients updated. I did this only because I run Samba on a home network serving only a few of my applications, and only for legacy clients.

When I upgraded my Linux distro I discovered that starting with Samba 4.11 the minimum protocol support level has been raised to SMB2 by default. This made the shares I export inaccessible to an XP virtual machine driving a scanner and a chip programmer, and also an app on my Android tablet.

There are lots of confusing posts on the Internet some about older versions. This relates to these changes. You can still enable SMB1 support, using these lines in smb.conf:
min protocol = NT1
ntlm auth = Yes
Restart nmb and smb and the changes should take effect.

SMB1 support may be removed in future, so hopefully my applications will be also updated before then.