Category Archives: Technology

Quote of the day: A beautiful, flexible, powerful mess

The web thrives on diversity. It’s the diversity of the web that sustains it and it’s the thing that will mean it’s still around long after all the monocultures, whether they be browsers or Facebooks or Googles, have long since vanished from the online ecosystem.

Scott Gilbertson on the value of diversity and why Firefox still matters

Flattr this!

Rolling back

I noticed that the Twenty Seventeen Theme that I installed on this blog at the start of the year wasn’t playing too nicely with Epiphany. Having lots of links in a post is a bit pointless if you have to hover your mouse over them in order for them to be highlighted.

So I have rolled back to the previous theme which, if I’m honest, looks a lot nicer than all this new-fangled modernity,

Flattr this!

Freedom to tinker

Talking about the way in which his embrace of Free Software has changed his attitude to computers, Bruce Byfield reaches a conclusion that rings very true for me.

All unknowing, I had wandered into the world of do-it-yourself. Originating in small groups of hobbyists who had few resources except themselves, free software naturally required more independence of its users. Far from discouraging users from tinkering, free software actually encouraged it with text configuration files and scripting so simple that it could be learned without taking classes. Because there were so many choices, it encouraged me to explore so I could make informed decisions. Just as importantly, because free software was a minority preference, the necessary compatibility with proprietary operating system sometimes required considerable ingenuity.

As a result of these expectations, I gradually lost my learned helplessness. I can’t say exactly when I shed the last of my conditioning, but after a couple of years, I realized that a major shift in my thinking had occurred. I still didn’t — and still don’t know everything about free software, but I no longer panic when a problem strikes.

Although I was using a number of open source applications before, I didn’t really start to delve into GNU/Linux until early 2007 when I installed Ubuntu on my PC alongside Windows XP. And, over the past ten years I have gone from being excessively cautious to (probably) a bit too casual.

There was never a sudden shift but, the more I have poked around the more I have found — all documented and backed by a helpful community. I have moved from really not wanting to do anything that might cause any sort of problem at all to being willing to break my install, safe in the knowledge that if the worst comes to the worst, I can just reinstall the operating system without even risking my data.

I am far from being able to claim any expertise but the openness and availability of information surrounding Free Software means that for any problem I am generally able to understand what the issue is and find or figure out how to fix it.

And that’s freedom.

Flattr this!

Learning Genie with Project Euler

I searched for Gnome Genie and was attacked by a Gnome Ninja.

I’ve recently started playing around with the Genie programming language. This is a variation of Vala but with a more Pythonesque syntax. And I do like Python.

Genie is a compiled language that uses the Vala compiler to produce C code which then compiles to an executable binary. This means that it has less overhead than programs written in Python and should run faster. This is not always a consideration but it can certainly be useful.

The inevitable Hello World program looks pretty simple:

[indent=4]
init
    print "Hello World"

The only problem I’ve found so far is that there appears to be a dearth of “Teach Yourself Genie” resources, either online or off. This is not helped by some of the results that come up when you search for “Genie” or even “Genie Gnome”.

So I’ve decided to have another crack at Project Euler. I have already solved a fair few of these problems in Python, if I can re-implement the same solutions in Genie I will count myself as having made some progress.

One down, 592 to go.

Flattr this!

Removing crapware from the phone

After wasting my time last night, I realised where I’d gone wrong. It appears that the Google Apps Installer on the Fairphone installs the Google Apps as System Apps. So they can’t (easily) be removed and the factory reset does nothing to them.

So what I need to use is the /system/app mover and BusyBox to make the system apps into user apps.

I have tried this with iFixit and successfully removed the default version and upgraded to the F-Droid version.

Going through the actual Google apps will require a little more care and may take some time.

Update

Now I’m confused. I’ve just glanced at the phone and the Google Apps appear to have vanished. The only thing I can think is that, when I restarted the phone, some cleanup happened. But the apps are removed, which is what I was trying to achieve, even if I’m not entirely sure how I achieved it.

Flattr this!

Removing Google Apps from a Fairphone

One of the nice things about the Fairphone is that none of the Google Apps are installed by default. There is a widget that allows you to manually install them and, when I received my phone back in 2014 I hesitated briefly, then tapped it.

This means, of course, that if I want to scrape all of these apps off my phone, the easiest approach is to backup and reset.

It worked, but the results aren’t quite what I expected. I still see apps like the Play Store, Gmail and Google+ on my phone, which leaves me wondering what the Google Apps Installer actually installs. This also means that my phone is still a lot less Googly than I would like and I have simply managed to find the slow way of removing an account.

However, I went ahead and installed F-Droid and started searching for current apps or replacements. This was successful and F-Droid does have everything I want, and more more. The only quirk I encountered was with the iFixit app which was installed by default on the phone. F-Droid tells me there is an upgrade, which I can’t install without first removing the original app. And I can’t remove the original app.

The Fairphone 1 is rooted by default, so I should be able to remove this. But right now, it’s late and I’m going to bed.

Flattr this!

Unplugging

Yesterday was Data Protection Day, which seeks to raise awareness and promote privacy and data protection best practices. Data protection and online privacy are issues that I have tended to think about in the abstract. While I am aware that my online data is exposed, I have a hard time motivating myself to do anything serious about it.

However, with the current global direction of travel, I started to think about how much of my data is going through US servers and the obvious first point of concern is Google, particularly Gmail.

Although I have a few email accounts, for the past few years I have been using Gmail as my primary email — and as my email client. The Accounts and Import page make it very easy to set up Gmail to send and receive from all of my email accounts, allowing me to easily synchronise everything across everything. It’s damnably convenient, but a complete disaster from a privacy point of view.

So today I have unplugged every other email account from Gmail. I have also installed and configured Geary on my desktop and started playing around with the default email client on my phone.

It’s not as convenient as letting Google do all the synchronisation for me, but the effort is minimal and it does mean that all of my email is no longer being pushed through the same server.

I haven’t decided whether to keep my Gmail account. It’s handy to have, but not irreplaceable. I shall watch how my email traffic changes over time and decide later. I shall also have to look into calendaring services.

But first, I shall see about scraping the Google Apps off my phone. This should be reasonably straightforward — if all else fails I just need to do a factory reset. But I must remember to take a backup first.

Flattr this!

Quote of the Day: Not All Change is Progress

There’s nothing wrong with helpful new features, but too often those helpful new features come with a price. They require relearning how to do things that you did reliably the day before. And even the most helpful features cease to be helpful if they require me to completely change my existing workflow.

Scott Gilbertson on the Joy of Vim.

With apologies to the Linux Luddites.

Flattr this!

Merging data with SQL MERGE

There have been times, many times, when I have needed to update the one or more columns in a table with values retrieved from another. My usual approach to this is to use an UPDATE with subselects but it turns out that there is a better way:

The MERGE statement updates a target (a table or view) using data from a source (result of a table reference). Rows in the target that match the input data may be updated or deleted as specified, and rows that do not exist in the target may be inserted as specified. Updating, deleting, or inserting a row in a view updates, deletes, or inserts the row into the tables on which the view is based if no INSTEAD OF trigger is defined on the view.

In order to play around with this, I build and populated a couple of test tables (imaginatively named TEST01 and TEST02) using the below scripts:

create table test01
 (key_field char(1) not null,
  data01 char(20),
  data02 char(30),
  data03 char(5),
  primary key (key_field));

insert into test01
 (Key_field, data01)
values('A', 'TEXT One');

insert into test01
 (Key_field, data01)
values('B', 'TEXT Two');

insert into test01
 (Key_field, data01)
values('D', 'TEXT Four');
create table test02
 (key_field char(1) not null,
  data01 char(20),
  data02 char(30),
  data03 char(5),
  primary key (key_field));

insert into test02
 (Key_field, data02)
values('A', 'More text one');

insert into test02
 (Key_field, data02, data03)
values('C', 'more text two', 'CODE');

insert into test02
 (Key_field, data01, data02)
values('E', 'TEXT five', 'More text five');

This gives me two tables with one matched row (key_field=’A’). To update the first table with the values in the second is really rather simple:

MERGE INTO test01 a
  USING (SELECT key_field, data01, data02, data03 from test02) b
  ON b.key_field = a.key_field
WHEN MATCHED THEN
   UPDATE SET data02 = b.data02, data03 = b.data03;

And the one matched row is updated in table TEST01 with the data from table TEST02.

If this was all I could do, I would be happy to have replaced a rather clunky approach with a more readable solution. But now the MERGE statement really starts to make a difference:

MERGE INTO test01 a
  USING (SELECT key_field, data01, data02, data03 from test02) b
  ON b.key_field = a.key_field
WHEN MATCHED THEN
   UPDATE SET data02 = b.data02, data03 = b.data03
WHEN NOT MATCHED THEN
   INSERT (key_field, data01, data02, data03)
   VALUES (b.key_field, b.data01, b.data02, b.data03)
NOT ATOMIC
  CONTINUE ON SQLEXCEPTION;

The WHEN NOT MATCHED clause means that not only can I update the matched rows, I can also do something about the rows that exist in table TEST02 that have now matched record in table TEST01. In this example, I have inserted the rows from table TEST02, other options allow me to either delete the row from table TEST01 or raise a SIGNAL statement.

And that NOT ATOMIC CONTINUE ON SQLEXCEPTION specifies that if an error is encountered on the insert, the MERGE will continue. Bad data happens, this saves be the burden of constantly having to refine my selection criteria to avoid the crap.

And a final note on the subject of selection criteria, the WHEN MATCHED and WHEN NOT MATCHED can both be extended with an AND to refine the selection to exactly what you want.

Do go and read up on the MERGE statement. It provides a powerful and flexible approach to updating tables from source data and one that I will be using in the very near future.

Flattr this!