The Guardian

Latest news, sport, business, comment, analysis and reviews from the Guardian, the world's leading liberal voice

Sleaford Mods go metal detecting: best podcasts of the week

A delightfully leftfield new interview show takes Jason Williamson to dig up rusty old nails. Plus, Ant and Dec launch their first ever podcast

In this offbeat interview show, producer and host James Deacon takes a ramble through green space with a celebrity, as they attempt a spot of metal detecting and intimate chat with themed questions (“What’s one piece of gold you’ve found in your life?”). Sleaford Mods frontman Jason Williamson is the first guest for an hour of introspection and digging up rusty nails. Works better as a visualised, rather than audio, podcast. Alexi Duggins
Widely available, episodes weekly

Continue reading...

Los Saldos review – prodigal big-city son reconnects with his heritage in rural Spain

Raúl Capdevila Murillo’s debut documentary follows the director’s journey back to his farming family, whose way of life is newly endangered

Raúl Capdevila Murillo’s debut documentary has all of the components of a thrilling retro western. Set to a rousing score, the opening titles feature giant letters in bold yellow, splattering over the horizon of a dusty landscape. Then we get the return of the prodigal son, fresh from the hubbub of the so-called civilised big city. The son is, in fact, Capdevila Murillo himself, and instead of gunfight, Los Saldos – or Remainders – is about a different kind of struggle, that of the film-maker’s own family, farmers unsettled by industrial changes.

Shot in widescreen, the film lends a majestic quality to ordinary life in Binéfar, north-eastern Spain. We observe José Ramón, the director’s father, on his daily rounds, driving around in his pickup truck, tending to his crops and animals. The rhythm is slow and languid; even the mere discussion of a new water tank results in protracted discussion between José Ramón and his neighbours who, like him, are the remnants of a vanishing line of work. Meanwhile, a major meat-product company is planning a macro abattoir in the area. The news lingers in the air like a bad smell, as news reports and political discussions unspool on radio and TV.

Continue reading...

The Bed Trick by Izabella Scott review – a bizarre story of sexual duplicity

A brilliant analysis of the trial of Gayle Newland and the literary and social antecedents of ‘sex by deception’

In September 2015, Gayle Newland stood trial accused of sex by deception. It was alleged that she created an online identity as a man and used this character, Kye Fortune, to lure another woman into a sexual relationship, which was consummated repeatedly with the assistance of a blindfold and a prosthetic penis. The woman believed she was having sex with Kye until one day her ring caught on his hat and she felt long hair. Tearing off her blindfold, she realised her male lover was actually her female friend. As these lurid, almost fairytale details seeped out, the case went viral. “Sex attacker who posed as man found guilty” was one of the milder headlines.

The trial caught Izabella Scott’s attention because it was a real-life example of a plot device she recognised from literature. The bed trick can be found in folk stories and operas, in Chaucer and Shakespeare. Often told for comic effect, it concerns sex by trickery and deception, under cover of darkness. “The plot suggests,” Scott writes, “that, in bed, anyone might be mistaken for anyone else.”

Continue reading...

A new start after 60: I jumped in the sea for the first time, and finally began to heal

Despite living on an island, David Warr avoided the water for five decades – until a swimming teacher made the link between his fear and a childhood trauma

When David Warr was 11 he thought he was dying. At his school swimming lesson, he jumped in and swam – then realised with horror that his feet couldn’t feel the bottom. He recalls his teacher, standing on the side of the pool, shouting at him to “just swim” and his own immobilising fear. “I thought, ‘I can’t. I don’t know what to do.’ I started to panic hard. I thought, ‘She’s going to let me die.’”

Warr, 61, has blocked out how he reached safety, but for five decades he refused to go out of his depth again. He lives on the island of Jersey where water is a fact of life – but even when his sons were small, he would only wade a bit, and watch them swim with envy and pride. In contrast, he felt he was “battling the water”.

Continue reading...

Sargasso

Hopeloos Genuanceerd

Wie houdt de VS in bedwang?

Met alle ontwikkelingen op het politieke wereldprobleem vraag je je onwillekeurig af wie de ‘nieuwe geallieerden’ zullen zijn die de VS in bedwang gaan houden als het allemaal echt fout gaat. Maar wie daar vandaag naar zoekt, vertrekt eigenlijk al vanuit een historisch beeld dat misleidend is. De geallieerden van de Tweede Wereldoorlog bestonden voor die oorlog ook al niet als vanzelfsprekend ‘moreel’ blok. Ze ontstonden pas toen neutraliteit onhoudbaar werd en de kosten van afzijdigheid hoger lagen dan die van handelen. Daarvoor waren het losse staten met overlappende belangen, geen hecht front. Dat gegeven maakt de vergelijking met nu ongemakkelijk actueel.

Maar in de jaren dertig waren er in elk geval staten die Duitsland op papier de baas konden. Groot-Brittannië en Frankrijk beschikten samen over legers, industrie en imperiale middelen die Duitsland hadden kunnen afremmen of vroegtijdig hadden kunnen verslaan, mits ze bereid waren die macht in te zetten. De Verenigde Staten stonden erbuiten, maar vormden een potentiële overmacht die iedereen kende. Het probleem lag niet in een gebrek aan capaciteit, maar in terughoudendheid, verdeeldheid en uitstel.

Dat onderscheidt die periode fundamenteel van het heden. Vandaag ontbreekt een vergelijkbare constellatie. Er is geen groep staten die, zelfs theoretisch, de Verenigde Staten kan corrigeren of indammen. Europa wordt vaak genoemd, en tegelijk is duidelijk waarom dat niet werkt. Militair blijft het afhankelijk. Politiek opereert het gefragmenteerd. Economisch weegt voorzichtigheid zwaar. Op papier bestaat er geen Europese macht die de VS aankan, zelfs niet collectief.

China wordt vaak opgevoerd als tegenwicht, maar is van een totaal andere categorie, waar op zichzelf ook niets goeds is te verwachten. Het is een systeemrivaal. China balanceert macht met macht, en stelt geen grenzen uit normatieve overwegingen. Dat levert spanning op, geen gezamenlijke rem. Historisch gezien lijkt dat meer op rivaliserende blokvorming dan op een geallieerd front dat stabiliteit bewaakt.

Rusland past al helemaal niet in dat beeld. Het was toen een van de geallieerden, maar dat was meer uit noodzaak dan uit liefde, en pas nadat het eerst samenspande met de agressor. Ook nu functioneert het niet als potentiële geallieerde tegen ontsporing, maar – eigenlijk net als toen – als actor die instabiliteit benut en zelfs stimuleert. Waar de Verenigde Staten minder geremd opereren, vergroot Rusland zijn speelruimte. Dat maakt het geen tegenmacht die begrenst, maar een factor die versnelt.

Wat overblijft is een losse verzameling middelgrote staten die belang hebben bij regels, voorspelbaarheid en multilaterale structuren. In theorie zouden zij samen een vorm van moderne geallieerden kunnen vormen. In de praktijk ontbreekt ook hier het beslissende element. Zij beschikken niet over voldoende militaire macht, en nog minder over de bereidheid om collectief kosten te dragen zolang directe schade uitblijft.

Het contrast met de jaren dertig is hier scherp. Toen bestonden er landen die Duitsland hadden kunnen stoppen voordat het systeem kantelde. Dat gebeurde niet, en de gevolgen zijn bekend. Nu ontbreekt zelfs die theoretische mogelijkheid. Er is geen equivalent van Groot-Brittannië, Frankrijk en de VS samen, geen latente overmacht die slechts gewekt hoeft te worden.

De verwachting dat er vanzelf nieuwe geallieerden opstaan die Amerika in bedwang houden, is daarom weinig realistisch. De geallieerden van toen ontstonden uit nood, niet uit vooruitziende planning. Ze konden ontstaan omdat de machtsverhoudingen dat toelieten. Die voorwaarde ontbreekt nu.

De ongemakkelijke conclusie is dat de vraag naar ‘geallieerden’ vandaag eigenlijk te laat wordt gesteld. Niet omdat ze zich nog moeten vormen, maar omdat de structurele voorwaarden ervoor ontbreken. Wat rest is geen blok dat corrigeert, maar een wereld die – sinds een jaar – probeert te leven met een macht waarvoor geen gelijkwaardige rem bestaat.

Wel.nl

Minder lezen, Meer weten.

Warmtepomp moet goedkoper worden voor sociale huurwoningen

DEN HAAG (ANP) - Een warmtepomp in huurwoningen moet veel goedkoper worden, vinden woningcorporaties, installateurs en fabrikanten. Daarvoor hebben de branches een plan gemaakt met het ministerie van Volkshuisvesting en Ruimtelijke Ordening. De samenwerking moet ertoe leiden dat de kosten van warmtepompen in een groot aantal huurwoningen met de helft omlaag gaan.

Nu kiezen corporaties voor hun sociale huurwoningen vaak niet voor warmtepompen als verwarmingsoplossing. Maar als de kosten omlaag gaan, wordt deze duurzamere verwarmingsmethode wel een optie. Daarbij gaat het dan om de som van afschrijvingen, service- en onderhoudskosten en vervangingskosten tijdens de levensduur van een sociale huurwoning.

"Als we erin slagen de totale levensduurkosten van de warmtepomp te halveren, komt verduurzaming binnen bereik voor tienduizenden corporatiewoningen. Onze installateurs hebben de kennis en kunde om de technische kant van het plan waar te maken", zegt voorzitter Mark Harbers van Techniek Nederland.


Gemeenten vertrouwen op de scanauto, maar het systeem faalt te vaak

De scanauto gold ooit als een wonder van efficiëntie: in één straatrit duizenden kentekens checken en automatisch beboeten wie niet betaald heeft. Maar in de praktijk rammelt het systeem aan alle kanten. In steeds meer gemeenten duiken voorbeelden op van foutief geregistreerde boetes, van verkeerd gelezen kentekens tot auto’s die helemaal niet geparkeerd stonden. In Amsterdam gaat het volgens de gemeente om 2 procent van de boetes ddie na protest wordt ingetrokken. En omdat weinig mensen protesteren (onfeilbare scanauto, niet waar) zal het percentage hoger liggen.

De foutmarge blijft meestal geheim, maar interne cijfers wijzen erop dat een paar procent van alle boetes onterecht is. Dat lijkt weinig, maar bij miljoenen controles per jaar loopt dat uit op tienduizenden valse beschuldigingen. Toch vertrouwen gemeenten blind op hun computersysteem – en moeten burgers zelf maar bewijzen dat ze níét fout stonden.

Bezwaar maken heeft zin: uit cijfers van de RDW en meerdere lokale onderzoeken blijkt dat een aanzienlijk deel van de bezwaren wordt toegekend. Vaak is een betaalbewijs of GPS-data al genoeg om een boete kwijtgescholden te krijgen. Maar veel automobilisten slikken de straf uit gemak, waardoor de fout onopgemerkt blijft.

De les is duidelijk: technologie is handig, maar niet onfeilbaar. Als je zeker weet dat je hebt betaald, laat die scanauto je niet intimideren – en vecht je boete aan.


gregcpb has added a photo to the pool:

gregcpb has added a photo to the pool:

The Daily WTF

Curious Perversions in Information Technology

CodeSOD: Threading the Needle in a Haystack of Files

Today we return to Jessica (previously), who still suffers under Windows Forms. But it's not all Windows Forms. There's also random CLI tools kicking around. CLI tools which should really be designed to run as a service,

Let's start with the Main method of this particular tool.

static void Main(string[] args)
{
    if (!LoadConfigs())
    {
        return;
    }

    if (args.Length > 0)
    {
        if (args.Any(a => string.Compare(a, "Test", true) == 0))
        {
            RunTest(out string message);

            Console.WriteLine(message);
            
            return;
        }
    }

    _userCache = new Dictionary<string, Employee>();
    _itemCache = new Dictionary<string, bool>();

    InitializeFileCache();

    WriteLog("File watcher started.");
    
    Task.Run(() => { ProcessLogQueue(); });

    Task.Run(() => { ProcessFilesInFolder(); });

    while (true)
    {
        Thread.Sleep(1000);
    }
}

We first try and load a config file, and if we fail, we quit. Then, if the word "Test" appears in any of the CLI arguments, we run a test of some kind, and then quit. Then, we prepare a pair of cache objects that map IDs to either employees or boolean values, and initialize that from a file. Then we kick off a pair of background threads, and then we sleep forever. Now, there are obvious nits here- you're not meant to kick off tasks directly, really, and async/await keywords are a "better" way to do this.

That they aren't awaiting the tasks is a problem we'll come back to.

For now, let's start with the logging portion. You can see WriteLog, which Jessica did not provide the implementation of, but I can infer it's pretty simple: it puts your message into a thread safe queue. How do I know this? Because of ProcessLogQueue's implementation:

private static void ProcessLogQueue()
{
    if (!Directory.Exists(_config.LogLocation))
    {
        Directory.CreateDirectory(_config.LogLocation);
        WriteLog($"Created Log location: {_config.LogLocation}");
    }
    while (true)
    {
        while (_concurrentQueue.TryDequeue(out string result))
        {
            string fileName = _config.LogLocation + $@"\{DateTime.Now.ToString("yyyy-MM-dd")}_CreationLog.log";
            if (!File.Exists(fileName))
            {
                using var fs = File.Create(fileName);
            }
            using (var fw = File.AppendText(fileName))
            {
                fw.WriteLine(result);
            }
        }
        Thread.Sleep(5000);
    }
}

They wrote their own logging library, but left out anything like "log levels" or "filtering" or "safe error handling against write failures". Mostly, this pulls a message off the queue and appends it to a file. It doesn't keep the filehandle open, which I'd make a comment about the performance overhead, but a bigger barrier to performance is the fact that if the queue is empty, this thread sleeps for five seconds. So if you're not logging so fast that multiple messages are in the queue, you're spacing out your log messages by five seconds at a time.

What's important to note about this logger is that this is not a logging program. It's a file watcher which needs to log messages. They just reinvented the logging library badly, is all. It'd be trivially easy to drop in a logging library and ditch this entirely.

How about processing files?

private static void ProcessFilesInFolder()
{
    while (true)
    {
        bool canAccess = RunTest(out string message);
        if (canAccess)
        {
            foreach (var file in Directory.GetFiles(_config.WatchLocation, "*.csv"))
            {
                ProcessFile(file);
            }
        }
        else
        {
            WriteLog(message);
        }
        Thread.Sleep(60000);
    }
}

Here, we see RunTest is used again- clearly this is a test to see if we can read from the correct directory. If we can't, we keep trying once a minute, though. If we can, we scan a directory, do something to all the CSV files, and try again in a minute. Once again, we don't see any error handling around Directory.GetFiles. Maybe there is in ProcessFile somewhere.

But the key here is that if I'm reading the docs right, exceptions in Task objects arrive at the main thread when you call Wait or otherwise check the result of the task. Which means this is the kind of program which fails silently- nothing checks for exceptions in the child threads, and since the child threads are where the work happens, it's easy for this program to reach a state where the main thread spins away, waking up every second just to go back to sleep, without any errors being detected.

And that brings us to the other key point here. Remember those two "cache" dictionaries? They're populated out of a file, and the entire point of those caches is to keep tabs on which entries have already been processed. Something the program can't do otherwise. I mean, it could, because processed IDs are stored in the database and there is an API that lets you query the database. It just doesn't. It relies on a local cache file to tell it what it's already processed. And while you or I might use some sort of unique key constraint to keep existing entries from being reprocessed by the database, the people behind this did not. Which means if the cache file is inaccurate (because the program crashed), or worse gets lost this processing program will create hordes of duplicate entries in the database.

Which is a thing that has happened, and is the reason Jessica ended up looking into this code. The customer refuses to run the service, because they ran it and it created duplicate entries. Now they don't trust it to work correctly.

[Advertisement] Utilize BuildMaster to release your software with confidence, at the pace your business demands. Download today!