Entries in Computing (187)

Thursday
Feb132025

Multiple accounts with the same hosting provider over SSH

It is fairly common to want to set up two SSH connections from a given machine to the same remote host. For example you might have both a work and a personal account on Github and you might want to pull and push changes from work and personal repositories on your machine.

If you just follow the instructions for setting up a single SSH connection and repeat it twice, your scond connection will probably not work because SSH on your machine will use the first account name to try to connect to the second account.

The way to fix this is to set up a .ssh/config file in which you define aliases for your two accounts, for example: github.com_work and github.com_personal. Then you use these aliases in the git config remote.origin.url in the respective repositories, for example:

git config remote.origin.url git@github.com_work:account_name_work/project_name

git config remote.origin.url git@github.com_personal:account_name_personal/project_name

For an example of the .ssh/config file see the Git FAQ.

Sunday
Oct302022

Simula 67 as a successor to Algol 60

From "Software Engineering: As it was in 1968" by Brian Randall:

In the more rarified ALGOL world in which I moved, 1968 was something of a watershed. The IFIP ALGOL Committee (Working Group 2.1) which had been set up following the publication of the original ALGOL 60 Report, met in Munich not long after the Software Engineering Conference. A week-long debate of remarkable intensity culminated in a majority decision to approve the ALGOL 68 report that had been prepared by van Wijngaarden, Mailloux, Peck and Koster (41). In response, a renegade group (of which I was a member) produced a brief Minority Report (18), in which we stated that "it will be required from an adequate programming tool that it assists, by structure, the programmer in the most difficult aspects of his job, viz. in the reliable creation of sophisticated programs. In this respect we fail to see how the language proposed here is a significant step forward". My own recollection in fact is that several of us felt even then that the recently proposed SIMULA 67 Common Base Language (12) came closer to our ideal, and would perhaps turn out to have at least as much impact as an officially promulgated ALGOL 68.

I have known a long time (mainly from the writings of Edsger Dijkstra) about how in 1968 the Algol Committee split over the decision to approve van Wijngaarden's Algol 68 language, with a significant minority issuing their own report saying it was too complex to create reliable software with. I had always assumed that the minority would have preferred something like Wirth's Algol W, but from what Randall says above they might have actually gone for Simula 67. Now that would have been something. It would probably have brought forward the flourishing of object-oriented programming by over a decade

Thursday
Sep292022

How to connect to WH-1000XM3 Headphones from Ubuntu 20.04 

The Bluetooth connection to WH-100XM3 headphones from Ubuntu 20.04 can be a bit hit and miss. This seems especially so if you use the headphones on more than one machine. Here is a command line session record of me using bluetoothctl (the commands I entered are shown in underlined bold):

$ bluetoothctl
Agent registered
[bluetooth]# scan on
Discovery started
[CHG] Controller E0:D4:64:02:D3:88 Discovering: yes
[NEW] Device 94:DB:56:18:25:5D LE_WH-1000XM3
[CHG] Device D8:FC:93:42:60:A7 RSSI: -35
[CHG] Device D8:FC:93:42:60:A7 TxPower: 10
[bluetooth]# devices
Device 8C:EA:48:5B:E5:D3 [TV] Samsung AU7100 43 TV
Device D8:FC:93:42:60:A7 IVYSAUR
Device 94:DB:56:18:25:5D LE_WH-1000XM3
[bluetooth]# connect 94:DB:56:18:25:5D
Attempting to connect to 94:DB:56:18:25:5D
[CHG] Device 94:DB:56:18:25:5D Connected: yes
[CHG] Device 94:DB:56:18:25:5D Name: WH-1000XM3
[CHG] Device 94:DB:56:18:25:5D Alias: WH-1000XM3
[CHG] Device 94:DB:56:18:25:5D Modalias: usb:v054Cp0CD3d0422
[CHG] Device 94:DB:56:18:25:5D UUIDs: 00000000-deca-fade-deca-deafdecacaff
[CHG] Device 94:DB:56:18:25:5D UUIDs: 00001108-0000-1000-8000-00805f9b34fb
[CHG] Device 94:DB:56:18:25:5D UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[CHG] Device 94:DB:56:18:25:5D UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[CHG] Device 94:DB:56:18:25:5D UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device 94:DB:56:18:25:5D UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
[CHG] Device 94:DB:56:18:25:5D UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[CHG] Device 94:DB:56:18:25:5D UUIDs: 7b265b0e-2232-4d45-bef4-bb8ae62f813d
[CHG] Device 94:DB:56:18:25:5D UUIDs: 81c2e72a-0591-443e-a1ff-05f988593351
[CHG] Device 94:DB:56:18:25:5D UUIDs: 931c7e8a-540f-4686-b798-e8df0a2ad9f7
[CHG] Device 94:DB:56:18:25:5D UUIDs: 96cc203e-5068-46ad-b32d-e316f5e069ba
[CHG] Device 94:DB:56:18:25:5D UUIDs: b9b213ce-eeab-49e4-8fd9-aa478ed1b26b
[CHG] Device 94:DB:56:18:25:5D UUIDs: f8d1fbe4-7966-4334-8024-ff96c9330e15
[CHG] Device 94:DB:56:18:25:5D ServicesResolved: yes
[CHG] Device 94:DB:56:18:25:5D Paired: yes
Connection successful
[CHG] Device 94:DB:56:18:25:5D RSSI: -54
[CHG] Device 94:DB:56:18:25:5D Name: LE_WH-1000XM3
[CHG] Device 94:DB:56:18:25:5D Alias: LE_WH-1000XM3
[WH-1000XM3]# exit
$

If the connection fails then you might need to remove the LE_WH-1000XM3 entry from the device list by entering remove followed by its MAC addess, for example: [bluetooth]# remove 94:DB:56:18:25:5D, and then rerun the scan and connect commands.

Thursday
Sep012022

Haskell "done right"

There is a small portion of Java developers who dream about programming in Scala.
There is a sizable portion of Scala developers who dream about programming in Haskell.
All Haskell programmers want to program in Idris.

From IdrisTddNotes by Rober Peszek.

This tallies with my impression that Idris is Haskell "done right".

Saturday
Apr232022

Git Push asks for Password instead of using SSH Key

One recurring minor annoyance with git is that if you create a new local respository using git clone then it defaults to always asking for a password when you do git push instead of using a pre-existing SSH key. If you are pushing to Github then the push will fail because Github recently started blocking password-based access on security grounds.

To get it to use the SSH key you need to open .git/config in an editor and change the [remote "origin"] url so it starts ssh:// instead of https;//.