mysql/mariadb error 35

I’ve had a problem with mysql failing to start with error 35 in the log file:

InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.

What to do? Google and you get a lot of Linux people saying that the answer is to reboot the box. Hmm. Well you don’t have to.

What causes the error is mysqld crashing, usually when system resources are exhausted. Rebooting will, indeed, unlock ibdata1 but so will killing the process that locks it. Yet the server isn’t running, so how can this be? Well actually part of it is – just not the part the service manager sees.

Run “ps -auxww | grep mysql” and you’ll find a few more. Send them a kill, wait for it to work and then restart. Obviously you can only do this and expect it to work if you’ve sorted out the resource problem.

Having a good argument

I’ve seen all sorts of stuff on forums about how to process command line argument in C or C++. What a load of fuss and bother. There’s a standard getopt() function in the ‘C’ library, similar to the shell programming command, but it’s not great.

The main problem with getopt() is that it produces its own error message. Although this saves you the trouble, it can be a bit user unfriendly for the user, especially when things get complex. For example, you might have mutually exclusive arguments and want to print out a suitable message. That said, it’ll work most of the time.

Here’s a page showing a good explanation for the GCC version, whcih is pretty standard.

Example of Getopt (The GNU C Library)

But rolling your own is not hard. Here’s a skeleton I use. It’s pretty self-explanatory. My rules allow single options (e.g. -a -b) or combined options (e.g. -ab), or any mixture. “–” ends options, meaning subsequent arguments are going to be a actual arguments.

Please generate and paste your ad code here. If left empty, the ad location will be highlighted on your blog pages with a reminder to enter your code. Mid-Post

If you want to pass something as an option, such as a filename, you can. -fmyfile or -f myfile are both handled in the example.

You can add code to detect a long option by adding “if (!strcmp(p,”longname”)) … just after the char c. But I don’t like long options.

#include <stdio.h>

void process(char *s)
{
    printf("Processing %s\n",s);
}

int main (int cnt, char **a)
{
    int i;
    for (i=1; i<cnt && a[i][0] == '-'; i++)
    {
        char *p = &a[i][1];
        char c;
        if (*p == '-')
        {
            i++;
            break;
        }
        while (c = *p)
            switch (*p++)
            {
            case 'a':
                printf("Option a\n");
                break;
                
            case 'b':
                printf("Option b\n");
                break;

            case 'f':
                if (!*p && i+1 < cnt)
                    printf("Value for f=%s\n", a[++i]);
                else
                {
                    printf("Value for f=%s\n", p);
                    while (*p)
                        p++;
                }
                break;
                
            default:
                printf("Bad switch %c\n",c);

            }
    }
    for (;i<cnt;i++)
        process(a[i]);
}

The above code assumes that options precede arguments. If you want to mix them the following code allows for complete anarchy – but you can end it using the “–” option, which will take any following flags as arguments. As a bonus it shows how to add a long argument.

#include <stdio.h>
#include <string.h>

void process(char *s)
{
    printf("Processing %s\n",s);
}

int main (int cnt, char **a)
{
    int i;
    int moreargs=1;

    for (i=1; i<cnt; i++)
    {
            if (moreargs && a[i][0] == '-')
            {
            char *p = &a[i][1];
            char c;
                if (*p == '-')
                {
                    moreargs = 0;
                    continue;
                }
                if (!strcmp(p,"long"))
                {
                    printf("Long argument\n");
                    i++;
                    continue;
                }

                while (c = *p)
                    switch (*p++)
                    {
                    case 'a':
                        printf("Option a\n");
                        break;

                    case 'b':
                        printf("Option b\n");
                        break;

                    case 'f':
                        if (!*p && i+1 < cnt)
                            printf("Value for f=%s\n", a[++i]);
                        else
                        {
                            printf("Value for f=%s\n", p);
                            while (*p)
                                p++;
                        }
                        break;

                        default:
                            printf("Bad switch %c\n",c);

            }
        }
    else
        process(a[i]);
    }
}



No talk from TalkTalk 2

Hardly a week goes by without someone contacting me about a problem with their email. Pretty much every time they’re just doing something wrong.

“Your message bounced back because you spelled your friends name wrong.”

I’ve learned to say it without sounding judgemental; or I think I have. Everyone’s done it, after all. It’d be nice if people checked before blaming the mail server, but so would world peace and I’m not hopeful I’ll see either.

But last week was a bit different. Someone got a bounce-back after emailing someone@talktalk.net, but the address in the bounce was someone@www.talktalk.co.uk. I know what you’re thinking; same as me. Someone had manage to type their address wrong in their iPad and the replies were to somewhere silly. (Why’s it always Apple users)

Not so this time. After more complaints I checked TalkTalk’s email server. First thing to check is the MX records. Hang on, there aren’t any!

An domain MX record simply tells other mail servers where to send email for that domain. In the absence of an MX record, a mail server is supposed to send email for a domain to it’s IP address (A record). Not everyone knows. this. As a final roll of the dice, it’s allowed to send it to a domain name’s alias (CNAME).

It turns out that talktalk.net lacks an a record, and it’s CNAME is www.talktalk.co.uk. This kinda makes sense – anyone going to the obsolete talktalk.net web site will end up at www.talktalk.co.uk. Great for web users, but it also means that all the email going to talktalk.net customers will be directed to their mail server. Not cool. Unsurprisingly their web server didn’t know what to make of it.

Was this something weird with my DNS? Nope. I tried it multiple DNS servers on several networks, and Google’s 8.8.8.8 service with exactly the same results. Definitely wrong; and it was a Saturday so there was no one at the company to TalkTalk to. I sent an email to the address their tech support suggested, and got a snotty “we’re not talking to you because you’re not a customer” response. Er, no. At this stage it was on behalf on an ISP trying to resolve a serious problem for their customers. How dumb can you get?

Now TalkTalk is an interesting company. It’s basically a mishmash of many ISPs purchased over time by Charles Dunstone’s Carphone Warehouse. These include Opal, Pipex, Nildram, and OneTel, AOL, Virgin’s ADSL business. The group has not been without its problems, including being slammed by the ASA and Ofcom for not delivering what it promised, and let’s not forget the famous 2015 data heist, malware infected home routers, slamming, and customer privacy concerns (Phorm, URL harvesting with Huawei and so on).

However, a big worry is how these disparate ISPs have been on-boarded to the TalkTalk communication bemouth. The answer is probably “badly”, and woe betide anyone on a legacy service such as an @talktalk.net email address. We had the same problem a year or so ago with @onetel.co.uk emails; TalkTalk had kindly left the service running but had no way of known which customers had left and who was using it for free. It was twenty years before they decided to pull the plug on it and see who squealed.

Naturally I phone around about the talktalk.net MX records to see what other were experiencing, and the consensus was that they’d decide to pull the plug on these legacy accounts too.

Of course, having bad/no MX records in your DNS doesn’t cause an overnight meltdown. DNS entries are often cached, and drop off senders’ servers over time. To add to the confusion, many high volume providers trying to save a few quid don’t even bother to check MX records when sending – they simply use the last known good destination server and “do something” when it fails to connect for a period. Freemail users may not have noticed a problem corresponding with their chums on TalkTalk.net – at least not for a while.

So what did I do? The user was convinced they were infected with malware (as they do) so for a quiet life I faked up the last known good talktalk.net zone in a local DNS server and sat back waiting for the actual server to be turned off. But a week later they’d fixed it; so that’s alright then. For now. I guess legacy customers of the worst domestic broadband provider in the UK (consistently, along with Virgin Media and Plusnet and Vodafone, according to Which? Surveys and Ofcom rankings for customer service) aren’t going to heed any warnings about shifting their email service elsewhere before it’s too late.

Graph showing trend data on residential consumer complaints received by Ofcom across fixed broadband by communications provider.   It shows the fixed broadband complaints per 100,000 subscribers for the Q2 2019 – Q1 2021 period.   Virgin Media generated the highest volume of fixed broadband complaints (at 33) in Q1 2021 followed by Vodafone at 24.    EE and Sky generated the lowest volume of fixed broadband complaints with both at 7.


Australia bites back

Well known conspiracy theorist and tennis player Novak Djokovic appears to have gained entry to Australia without the covid-19 vaccination that he and his wife Jelena oppose, even though it’s a requirement for everyone else.

Jelena Djokovic is on record as believing that 5G mobile phones are the real cause of Covid-19.

It appears Djokovic obtained this exception on a technicality – that he’d tested positive for Covid19 in the last six months. Normally exemptions are granted by an independent (and blind) panel to people with documented medical conditions (usually cardiac) that would make vaccination risky. Immunity through past infection makes the matter less urgent. Does Djokovic really have a dicky ticker? You wouldn’t think so to look at him.

Now the Australian Prime Minister, Scott Morrison, has said he could be on the next plane home because of another technicality – his visa was completed incorrectly.

You’ve got to admire the Australian way of doing things. However, I’d be surprised if the wealth of the rich and famous doesn’t prevail. But whilst I have no interest in watching tennis, I must say this is the shaping up to be the best soap opera coming out of the country since neighbours.

Meanwhile, in France, their controversial but entertaining president has made it clear his strategy is to “piss off” the vaccine dodgers, rather than forcing them to be vaccinated by law.

« Moi, je ne suis pas pour emmerder les Français », confie-t-il tout d’abord. Mais « je peste toute la journée contre l’administration quand elle les bloque. Eh bien, là, les non-vaccinés, j’ai très envie de les emmerder. Et donc, on va continuer de le faire, jusqu’au bout. C’est ça, la stratégie ». Source: Le Parisien

To put this in to context, the UK has been playing softly with the anti-vaxxers, but other European countries are gearing up for compulsory vaccination – starting with Austria, with Italy and Germany not far behind.

Has Macron gone mad? Politicians on the left and right have condemned his language, and the admission of his strategy. However, with 90% of France vaccinated, I suspect he’s gambling that the majority have lost patience with the needle-phobic 10% playing Jacques, and he’s basically asking people to side with him or them. Media politicians have been tricked into knee-jerk siding siding with “them”.

How to really add a plugin to WordPress manually

You’d have thought that a google search for “manually add plugin to WordPress” would turn up lots of articles on how to do this, but, er, no. They all seem to tell you to log in to the site and do this or that on the GUI. That’s not doing it manually – it’s using the GUI. If the GUI doesn’t work, then you need to do it manually. Here’s how:

The method is actually simple if you remember it. You download the plugin from the site (e.g. https://wordpress.org/plugins/) and you’ll end up with a DOS/Windows .ZIP file. Unpack this any way you wish and you’ll get a directory with some file in it. As a sanity check, one of these files will have the same name as the directory, but ending in .php.

Take this whole directory and copy it to /wp-content/plugins. That’s the directory – not the files in the directory.

That’s it. You’re done. It’ll appear in the plugins dashboard.

The Huawei thing

A few months ago I was asked for comment on the idea that an embattled Theresa May was about to approve Huawei for the UK’s 5G roll-out, and this was a major security risk. Politics, I assumed. No one who knew anything about the situation would worry, but politicians making mischief could use it to make a fuss.

Now it’s happened again; this time with Boris Johnson as Prime Minister. And the same old myths and half-truths have appeared. So is Chinese company Huawei risky? Yes! And so is everything else.

Huawei was founded by a brilliant entrepreneurial engineer, Ren Zhengfei in 1987, to make a better telephone exchange. It came from the back to become the market leader in 2012. It also made telephones, beating Apple by 2018. While the American tech companies of the 1980’s grew old and fat, Huawei kept up the momentum. Now, in 2020, it makes the best 5G mobile telephone equipment. If you want to build a 5G network, you go to Huawei.

Have the American tech companies taken this dynamic interloper lying down? No. But rather than reigniting their innovative zeal, they’re using marketing and politics. Fear, Uncertainty and Doubt.

Some arguments:

“Huawei is a branch of the evil Chinese State and we should have nothing to do with it.”

Huawei says it isn’t, and there’s no evidence to the contrary. The Chinese State supports Chinese companies, but that’s hardly novel. And whether the Chinese State is evil is a subjective judgement. I’m not a fan of communist regimes, but this is beside the point if you’re making an argument about technology.

“Huawei is Chinese, and we don’t like the government or what it does”.

So we should boycott American companies because we don’t like Trump? We do business with all sorts of regimes more odious that the CPC, so this is a non-argument. You could make a separate argument that we should cease trade with any country that isn’t a liberal democracy, but this could be difficult as we’re buying gas from Russia and oil from the Middle East.

“Huawei works for the Chinese secret service and will use the software in its equipment to spy on, or sabotage us.”

First off, Ren Zhengfei has made it very clear that he doesn’t. However, there have been suspicions. In order to allay them, Huawei got together with the UK authorities and set up the HCSEC in Banbury. Huawei actually gives HCSEC the source code to its products, so GCHQ can see for itself; look for backdoors and vulnerabilities. And they’ve found nothing untoward to date. Well, they’ve found some embarrassingly bad code but that’s hardly uncommon.

Giving us access to source code is almost unprecedented. No other major tech companies would hand over their intellectual property to anyone; we certainly have no idea what’s inside Cisco routers or Apple iPhones. But we do know what’s inside Huawei kit.

“Because Huawei manufactures its stuff in China, the Chinese government could insert spying stuff in it.”

Seriously? Cisco, Apple, Dell, Lenovo and almost everyone else manufacturers its kit in China. If the Chinese government could/would knobble anything it’s not just Huawei. This is a really silly argument.

Conclusion

So should we believe what the American’s say about Huawei? The NSA says a lot, but has offered no evidence whatsoever. The US doesn’t use Huawei anyway, so has no experience of it. In the UK, we do – extensively – and we have our spooks tearing the stuff apart looking for anything dodgy. If we believe our intelligence services, we should believe them when they say
Huawei is clean.

Being cynical, one might consider the possibility, however remote, that America is scared its technology companies are being bested by one Chinese competitor and will say and do anything to protect their domestic producers; even though they don’t have any for 5G. Or if you really like deep dark conspiracies, perhaps the NSA has a backdoor into American Cisco kit and wants to keep its advantage?

The US President’s animosity to trade with China is hardly a secret. Parsimony suggests the rest is fluff.

Amazon Echo vulnerable in Smart Speaker battle

When Google launched its smart speaker it was playing catch-up with Amazon. The Echo had an established ecosystem, and unless Amazon blew it, this lead looked unassailable. The field was Amazon’s to lose.

Since then, Amazon’s arrogance seems to have taken it towards such a losing strategy. Glitzy launches of new gadgets are not enough to maintain a lead. I have a sample of pretty much every Echo device ever sold, and the newer ones aren’t that much better than the old ones. The build quality was always good, and they work.

What could damage the Echo is the slide in functionality.

Most people assumed that the rough edges – things you should be able to do but couldn’t – would be addressed in time. Google stole a march by recognising the person speaking, but Amazon has caught up. Sort-of. Meanwhile Google has been catching up with Amazon on other functionality and ecosystem.

What Amazon is failing to realise is that they’re selling smart speakers. This is the core functionality. They came up with the technology to link speakers in groups, so you could ask for something to be played “Upstairs”.

This is still there, but it’s been made almost useless. In the beginning you could play anything you wanted on an Echo. All music purchased direct from Amazon was added to your on-line library. There was also Amazon’s Prime music service. The latter has gone down hill recently, with the good stuff moved to a separate “full” streamin service. The ability to play your own music by uploading your MP3 files to your library. This facility has just “gone”, as of the start of the year.

Loyal Amazon customer assumed that it would go the other way, and that you’d be able to stream from your local source to your smart speaker groups. Amazon has blocked this, although some third party skills can play media to a single Amazon speaker. Not so smart.

Now Echo users are about to be hit again. From next month feed of BBC Radio, and other things, is changing. You’ll still be able to get them, but only on a BBC skill. The effect of this is that you can’t use an Echo as a radio alarm clock and more, the alarms will be confined to built in sounds. No longer will I be able to wake up to Radio 4’s Today program at 6am. Unfortunately I will still have to wake up at that time.

Echo Dot with Time Display – but now no use as a radio alarm

Ironically, one of Amazon’s enhancements is an Echo Dot with a time display. Just in time for it to be made useless by the software.

Looking at the change, I also strongly suspect you won’t be able to play a radio station on a group of speakers either. The speaker group technology is limited to Amazon’s own streaming service.

The Echo/Alexa system used to just work. Unless Amazon reverses these catastrophic decisions, it just doesn’t work. And now the public has a taste for this functionally, someone else can walk in and provide it.

The Religion behind Climate Change

Global Warming is real. The high priests of the peoples’ religion have proved it to the satisfaction of all true believers. Or do I mean science has proved it to all right-thinking people?

Famously, Donald Trump thinks it’s all a conspiracy. He also thought (thinks?) that Obama was a foreign import jihadist and the American Democratic Party is run by commuinists. So if Donald Trump thinks Climate Change is a trick, logic dictates that it must therefore be real, right?

I think it’s time we looked at some facts:

The world’s climate has been getting warmer. For a long time. Between the 15th and 18th Century the River Thames froze over in London. In the early 1800’s it stopped, and hasn’t done so since. Therefore things must be getting warmer. Of this there is no doubt.

Is our industrial activity the reason? Well no. We didn’t start to industrialise and burn fossil fuels until well in to the 19th Century.

So it’s pretty clear that the planet has been warming up for a long time prior to major human industrial activity. We couldn’t have started it, because it began before we burnt fossil fuels to any scale.

But… is burning fossil fuels accelerating this natural change in our climate? Well that’s another question. 97% of Climate Change scientists say it is, so it must be true. I mean: who’s going to argue with one scientist, never mind the vast majority? Scientists are honourable people, not interested in worldly matters, and have no reason to lie to us about stuff we don’t understand.

Yeah, right!

Scientists are no more or less honourable than anyone else; they do care about money and there are all sorts of reasons not to believe them. This is strikingly similar to the high priests of the old religions, don’t you think? And when you look at it, the same driving forces appear to be shaping their behaviour.

For a long time the sun went around the earth. The priests said so. Anyone with deviant views was shouted down as an idiot, and if they persisted they could eventually be burnt at the stake as an example to others. No one who argues with priests or scientists is going to be taken seriously. OR ELSE!

Did the priests have any proof that their view of the cosmos was correct? They had irrefutable evidence. Ask any priest and they’d tell you – everyone knew it was true so it must be. Who was going to appear foolish (or be put to death) by disagreeing with the consensus? But in reality the priest had other reasons to believe they were correct: their careers and livelihood depended on them sticking to the story. If you were a priest you had a good job for life. People would respect you, give you money, a nice house and plenty of food, and not expect you to get involved in nasty worldly stuff. Becoming a priest has always been a good career choice. The only career-limiting thing you could do would be to question the “truth”. If anyone did, other people would too, and eventually the religion would lose control. And if a priest did it, even more so. Errant priests would never do.

Is the modern-day scientist really any different? It’s always a good idea to follow the money. They have a job in research and their salary is paid for by someone. To get on in the world they need to publish papers, so they can’t remain silent. When they’re working for a university department set up to study climate change, its not politic to say that the subject is over-blown and the world would be better off studying something else. They’re going to say it’s important, and probably real (but that funding is needed for further research). So the the majority of scientists who are paid to believe in climate change that express an opinion are unlikely to express one that’s going to see them out of a job; and then torn apart by their colleagues for breaking the faith.

Ask a scientist not involved in climate change research whether global warming is caused by human activity, and they won’t have a strong opinion because it’s not their field. Or they’ll close ranks with the rest of the “priesthood”, or “scientific community”.

Likewise, I don’t know if human activity is accelerating climate change. I suspect it may well be, but I can’t discount the fact that most academic researchers of the subject also say their pay-cheque is justified. Always follow the money.

Then there are the environmentalists, myself included. I don’t bang on about human-caused climate change. I don’t know how much we are to blame. I don’t know if we can slow or reverse it. But I do know that using irreplaceable resources as though the supply is infinite is a stupid idea. I do know that polluting the environment and destroying the natural world is a bad thing. So when a government, with the backing of its high priests of science, says it wants to reduce pollution and fossil fuel consumption I’m hardly likely to disagree, whatever the government’s real motive. (I suspect the real motive is tax revenue).

So what is it with society and its deference to scientists? In the past, if you were ill, you went to the priest for help. Not just the church infirmary; you did whatever the priest told you to in order to be cured. At the very least, you had nothing much to lose by trying. In the modern world we go and see a medical scientist (doctor), as we believe their results are better than the priests. Doctors can’t cure everything, in fact you could argue they can cure comparatively little. Many ailments cure themselves and the priest or doctor gets the credit anyway. But doctors do have demonstrably better outcomes than the priests they’ve displaced. If you’re ill, anyone you believe can cure you is going to be your best friend.

And then there are the politicians. Since the beginning of time the priests have been used by rulers to persuade the populous to go along with some policy or other. Do you want to plunder the tribe up the valley? Get your holy man to call it a religious duty and the plebs will do anything you ask of them, however foolish. Even if they’re not scared of you, they are of the priest. More precisely, they’re scared of the power that only the priest understands and can control. So the tribal chief is happy. The priest is happy because the chief keeps him in the easy life, and the plebs are happy because they’re doing the right thing for them and their mates without having to think for themselves. Or they’re dead on the battlefield, but living it up in the afterlife.

Now, if you’re a politician and announce you want to hike taxes it’s unlikely to have a positive effect on your chances of re-election. Unless you can persuade the people it’s a really good idea for some reason or other. The problem is that they won’t listen to you, because you’re a politician. If you can get the high priest (or scientists) to tell them that raising taxes is virtuous, and the wrath of something will descend on them otherwise, then you can still raise the taxes you need and avoid the blame when people have less money in their pockets and you have more to spend.

I’m not saying that using taxation to reduce pollution, or finite resource consumption, is a bad thing. Anything that does that is good. But I can’t help having a nagging feeling that the motivations of governments have more to do with the revenue, as government policies usually contradict these supposed ideals unless they can make money out of it.

The switch to sustainable transport is a good example – jobs and taxes are created by cars, so building more roads is a good thing as far as they’re concerned. And they can even boost economic activity by changing the rules to encourage people to buy newly produced cars. This is contradicts the idea that they want to reduce consumption, emissions and pollution. When Trump says he wants to put industry before environment he’s just being honest.

When it comes to whether pumping carbon dioxide and methane into the atmosphere is a good idea, it clearly isn’t. Atmospheric carbon dioxide levels have increased rapidly in the 20th century and it can only make the planet heat up. Victorian scientists raised the red flag at the boom in burning coal, and all the evidence suggests they were correct. What’s a stretch is the idea that by reducing carbon dioxide we can stop or reverse a trend that started a long time before we started; we need to accept the earth has been warming up since records began and plan accordingly. And please stop burning fossil fuels as this would be A Good Thing in itself.

My first draft of this diatribe ended about here, but in the summer the president of the Royal Statistical Society gave a very interesting address at their annual jamboree, which deserves a much wider audience as it drew together threads concerning why people are becoming disenchanted by experts, especially where statistics are concerned.

NSPCC claims that 6% of teenage boys read Pornhub

Petee Wanless, CEO of the NSPCC, has made a fool of himself and the organisation he represents by call8ng for unworkable restrictions to be placed o. Porn websites to prevent access by min
ors. This is on the back of some dubious looking research from avstat, who have made simar headline grabbing claims that 6% of males aged 12-16 have been looking at a site called Pornhub during the course of one month. This is based on a survey of traffic, apparently.

It’s pretty obvious to anyone in a position to see net traffic that this is most improbable, and it’s only a matter of time before the research is ripped to shreds. That the NSPCC is taking it seriously raises more questions of the organisation’s competence. Time for a new CEO, methinks.