add and remove parts to a filename using prename

you may want to use prename, which is the package that installs the same rename programme that is used in many of the examples on the web:
sudo dnf install prename

prename 's/Text to remove goes here //' *.txt
prename 's/^/Text to add goes here /' *.txt

Loading Prices Paid Data into PostgresSQL Server on Fedora

If you want to analyse the housing market in England and Wales you can use the Prices Paid data from https://www.gov.uk/government/statistical-data-sets/price-paid-data-downloads

Once you have the big file downloaded you need to upload it to your database. Put the file into the shared folder where you have allowed the postgres user and your current user to have access to the files. Mine is a folder in root called Database_Files. CD into the data directory and check out the file to see if it contains column names:

head pp-complete.txt

A cursory inspection reveals no headers.

Check out https://www.gov.uk/guidance/about-the-price-paid-data#explanations-of-column-headers-in-the-ppd for the headers

You’ll have to create the table before hand.

CREATE DATABASE prices_paid;

CREATE TABLE prices_paid.public.price_paid(
   Transaction_unique_identifier CHAR(250) PRIMARY KEY NOT NULL,
   PRICE INT    NOT NULL,
   Date_of_transfer  timestamp NOT NULL,
   postcode  CHAR(50),
   Property_type CHAR(1),
   old_new CHAR(1),
   duration CHAR(1),
   paon text,
   saon text,
   street text,
   locality text,
   town_city text,
   district text,
   county text,
   ppd_category char(1),
   record_status char(1)
);

I use DBeaver COMMUNITY for a nice SSMS like experience. Log into your database using a client and run the following SQL

COPY prices_paid.public.price_paid 
FROM '/Database_Files/pp-complete.csv'
quote '"'
 CSV
;

On my laptop it took 42 minutes. Which I think is too long. I then indexed the postcode field as that’s the one I would probably use most.

create index idxpostcode on prices_paid.public.price_paid (postcode);

meson build system, dependencies

meson is Yet Another Build System (YABS). One of it’s aims is to be easier to use than the other YABS. Maybe it is maybe it isn’t.

Here is my context: Fedora 34 and I like to pretend I am a programmer. I can make thing happen in Python, but then Python is easy. But I have a project which I want to work quickly and Python is a scripting langauge and I want to pretend I am a programmer so no C# or Python or anything easy.

I have been using Clion (I had a JetBrains subscription for a couple of years but I’m not a developer so I could not justify spending money on a subscription. So I have a fallback version from 2017. I like the debugging support in Clion, like being able to open objects in memory using a mouse when the program is paused.

Now I want to add a GTK UI for my program as I want to be able to interact with a graph to inform a big block of data to work in the program. For some reason (to do with CMAKE, a YABS, probably) it won’t compile a GTK program. My least favourite programming task is chasing around dependencies and interacting with YABS and I never learnt CMAKE enough to make it muscle memory, or something that’s integrated into my mind. It’s currently something I’ll always have to look up (because I’m not a programmer).

GTK (a widget tool-kit kind of thing) is also something I don’t know how to use so I thought I’d mock something up in Gnome-Builder. and then integrate it into the program I’m writing later by which time CMAKE will have magically come into focus. Default Gnome-Builder can indeed use complex templates to build Hello World programs (which it then insists on making into a Flatpak) and have loads of “hey look this is how you should write this code” templates, but I want something very simple.

So making a new Command Line program. Then install GTK4 (probably a mistake because it’s new [October 2021]).

Then in meson.build in the folder add

gtk_dependency = dependency(‘gtk4’)

add this to the Deps square brackets

deps = [
gtk_dependency
]

Wait how did you know to use dependency(‘gtk4’)? use pkgconf –list-all | grep gtk to show you all the packages you can use as dependecies (that have gtk in them).

Find linux command

Find mp3 files containing the word fish in the filename, ‘below’ current older

find . -iname *fish*.mp3

Use Grep to find a string within a file, and don’t return the filename only the examples and then find only the distinct examples.

grep -rh --include="*.R" "library("  . | sort --unique

This example was to help me remember the name of a library I had used somewhere in one of my .R files but I couldn’t remember which one etc. the library I was looking for was called “tabplot”

Gnome Tracker-Miner

I was having problems with tracker miner beavering away for 1/4 of an hour every time I booted up. Had a look at the journalctl output etc and noticed errors around the database.

So I Duck Duck Go-ed some stuff and eventually found:

tracker reset --hard

Once I ran that and rebooted, it ran again for a bit then settled down again. Problem solved.

PyCharm

Run selected code:

search for Execute Selection in Python Console, to find and/or change your keyboard combination.

kdevelop: you need GDB 7 or greater… Fedora 33 … use LLDB instead (oh no that’s busted too).

You need gdb 7.0.0 or higher.
You are using: GNU gdb (GDB) Fedora 10.1-2.fc33

I was using Kdevelop under Gnome on Fedora 33 and wanted to debug a program. Unfortunately the above error pops up telling me it won’t work I need GDB version > 7 but all I have is GDB version 10, and any fool knows 10 < 7 so what’s a guy to do?

So I thought I’d try LLDB instead (Run -> Launch Configurations -> Debug) but that gave an error of can’t find lldb-mi. So more ducking (DDG) later I found a bug report from Arch (if only I was linux enough for Arch) that stated that LLDB-mi no longer comes with LLDB install and you had to build it from source.

So I:

sudo dnf install lldb-devel llvm-devel 

then downloaded the repo from https://github.com/lldb-tools/lldb-mi

cd Projects/github/
git clone https://github.com/lldb-tools/lldb-mi
cd lldb-mi
cmake .
make
sudo make install

…and LLDB debugging in Kdevelop works fine now.

Not sure what’s up with GDB but I’m sure it’ll be sorted at a later date. It was after an update that it started falling over.