If you believe in an afterlife, why do you grieve when a loved one dies?

I just saw a question on facebook asking if atheists grieve when a loved one dies. It’s a remarkably stupid question as the inverse seems more applicable. If you believe that you are going to a heaven when you die, why do christians and other theists whose religion posits an afterlife grieve?

Atheists grieve because we know that we have lost something precious and irreplaceable. It’s not just the accumulated knowledge from their lifetime that society has lost, but also the personal relationships they have formed that are forever gone. We know that death comes for us all but that doesn’t mean we celebrate or even accept it.

Believers in an afterlife however have to explain why death is any different to them than seeing their friends off on a voyage. After all, if there is an afterlife where you will be reunited, why does death matter?

The question vexed early christians enough that they declared suicide a sin. This was in stark contrast to the then prevailing Roman idea of suicide as a noble act. Now suicide instead condemns you to an eternity in hell. Never mind how painful your life is, medical assistance in dying condemns you to worse torment for eternity.

In fact, christians generally raise living in pain to a virtue, a view that coloured medical treatments as recently as the past century. Forego anaesthesia and pain killers – the pain helps your body and soul heal (this view hasn’t been held by mainstream medicine for over a century).

Even the much loved Mother Theresa advocated this approach. Pain is part of the human condition and must be celebrated, or at least endured. Some even voluntarily subject themselves to pain to become more “spiritual”.

So is mourning simply for show, to put on a facade of pain in an attempt to build character? I doubt it. The pain must be real to do that and I have no doubt that everyone faced with the death of a loved one feels intense pain.

So the question “why” remains. I submit this is a question religion cannot answer but that science can. We evolved as social animals. Millions of years of evolution have baked social connections into our being. Losing even one of those connections is deeply painful which is one reason we do our best to protect one another.

That’s likely part of why a belief in an afterlife arose. If the severed connection is not permanent, the pain will be less. It’s part of the death rituals that every culture has, just adding “they are waiting for you in a better place” to the mix.

The real question is “why don’t believers in a heaven celebrate death?” If their god has called them to him, why mourn at all? If the separation is just temporary, why does it feel so permanent and hurt so much?

Theist apologists have contrived numerous explanations, none of which really explain why death is not similar to emigrating to a distant land that offers hope of a better life. Conversely, the explanation comes naturally as an evolved trait in a social species. Mourning a death simply feels right while celebrating it would feel like a travesty.

You can also refer to my earlier article “Proof of no Heaven” for an explanation of how near-death experiences work.

Posted in Health & Healthcare, History, Religion, Science and Mathematics | Tagged , , , , | Leave a comment

Using a spreadsheet for small-organization accounting

I’ve used a spreadsheet to keep track of my personal bank accounts for over 40 years, long before Excel or Libreoffice Calc came on the scene. It just seemed like a necessary thing to do back before online banking became available. Tracking your bank balances on paper was clumsy and error-prone.

I still do that today and, truth be told, my spreadsheet hasn’t changed much in all that time. I’ve migrated it to various programs over the decades before Calc became available. All spreadsheet programs have all the features you are likely to need.

One thing that has changed is the development of named ranges. This allows you to create more readable formulas. I’ll show you that shortly, but first, let’s get a basic spreadsheet set up.

Every reasonable organization uses a bank account to manage their money. You don’t want to keep thousands of whatever your local currency is laying around. It also provides assistance in tracking your funds.

We’ll start with a basic chequebook balancing sheet like I’ve been using. It needs some basic columns like:

Date	X Number Item	Deposit	Withdrawal Balance	Processed

The Date is self-explanatory. Column X records whether or not the bank has processed the transaction. In my chequebook balancing spreadsheet, I put in the month the transaction appears at the bank.

Number is the Cheque number. Item is the purpose of the transaction (e.g. electricity bill). Deposit and Withdrawal are columns to record the transaction amount. They could be combined into a single “Amount” column if you don’t mind entering withdrawals as negative numbers.

Balance is amount left in your account after the transaction. Processed is amount that should show in your bank statement. It excludes transactions that the bank hasn’t processed yet.

Format the Date column as a Date. I highly recommend using ISO standard YYYY-MM-DD format. Deposit, Withdrawal, Balance and Processed should be formatted as Currency.

The initial balance is entered as the Balance and copied to the Processed column (e.g. H2 is set to =G2). From there, the balance is kept track by inserting the formula “=G2+E3-F3” into the Balance column below the initial balance, then copying it down to all the rows below.

The Processed column follows the same idea, but with a slightly different formula: =IF(B3,H2+E3-F3,H2). If there is something in the B (X) column for the transaction, add it to the processed balance. Otherwise, just show the previous balance.

That’s sufficient for balancing a chequebook, but it’s only the start for an accounting system. To make it into something useful for accounting we need to bring some discipline to it.

The first thing is that we should no longer simply allow anything to be entered into the “Item” column. We need a real Chart of Accounts. A Chart of Accounts is simply a listing of how the organization wants to track their money – it splits things categories. For example, “Electricity” or “Insurance” could be accounts.

However, by limiting the options for what we enter in the Item column, I find it necessary to add a new column at the end, which I call details, to include the particulars of that transaction – the who, what and why of it. It plays no role in the calculations but provides historical context for the transaction.

So now let’s add a second tab to our spreadsheet. We’ll call the initial tab “Transactions” and the new Tab “SubAccounts”. I’m calling it SubAccounts to make it clear it’s not an actual Bank Account and also because we may want to group the “SubAccounts” into larger categories. For example, some not-for-profit organizations have Fundraising Activities and also Service Activities that they may want to track separately. This is similar to a private individual with various Income sources and also Expenses.

The SubAccounts tab starts with a simple listing of the SubAccounts divided into categories:

Opening Balance

Income
Day Job
Side Hustle
subtotal

Expenses
Mortgage
Property Tax
Electricity
Water
Food
subtotal

Current Balance

Here’s where named ranges now come into play. Go to the Transactions tab and click on the Deposits column to select it. Now pull down the Sheet submenu and click on “Named Ranges and Expressions | Define”. Call the range “Deposits”. Do the same for the Withdrawals column.

Rename the Items columns “SubAccounts” and define it as a third range.

Now let’s add a second column to the tab and fill it (starting in row 4) with this formula:

=SUMIFS(Deposits,SubAccount,$A4)-SUMIFS(Withdrawals,SubAccount,$A4)

This will match the SubAccount to the name in the first column and calculate the net amount for that account. You could also use 3 columns, one for the total deposits, total withdrawals and net amount if you prefer.

Add the opening bank balance and subtotals for each of the major SubAccount types (e.g. =SUM(B4:B5)), then calculate the current balance. (=B1+B6-14)). You now have working accounting spreadsheet.

You can check that it is valid by ensuring the Current Balance on the SubAccounts tab matches the Balance on the Transactions tab.

However this is limited to a single fiscal year. To extend it over multiple years, you could simply duplicate the sheet for each fiscal year, and enter items into the appropriate spreadsheet by fiscal year.

Or you could add a Fiscal Year column to the Transactions tab and keep multiple years open in the SubAccounts Tab. This allows you to easily keep track of things year over year, but the spreadsheet will grow larger and larger over time.

A third option is to divide the transactions tab by fiscal year. This allows you to have manageable Transaction tabs while still being able to report over multiple years. The exact option you pick probably depends on your organization’s needs,

This is where I need to comment on the formula in the second column of the SubAccounts tab that uses SUMIFS. Some people may find it unusual to use SUMIFS instead of SUMIF in this case, as both can handle a single test condition. However, SUMIF orders the parameters differently.

SUMIF puts the range to search first, followed by the test to be used, followed by the range to sum. SUMIFS moves the range to sum to the front, followed by one or more search ranges and tests. This allows you to add additional tests more easily – just add them to the end.

For example, if we wanted to test for fiscal year in the Transactions tab, the formula would now look like:

=SUMIFS(Deposits,SubAccount,$A4,FiscalYear,B$1)
-SUMIFS(Withdrawals,SubAccount,$A4,FiscalYear,B$1)

assuming we head the second and subsequent columns with the fiscal year they are reporting on. We didn’t have to move the range to be summed as well.

In general, I simply use SUMIFS unless I am using the simpler (2 parameter) form of SUMIF, which is rare.

I hope this gives people sufficient information to create their own accounting spreadsheets.

Posted in Computers, Economics, Science and Mathematics, Sports | Tagged , , , , , | Leave a comment

Bash scripts to manipulate XML files

I developed these scripts to handle a particular situation I have while putting together a directory. The exact conditions are I have XML files listing positions within the organization that contain a link to a second XML file providing the incumbent’s information.

A position may have more than one incumbent and an incumbent may hold more than one position, hence the need for two files.

Moreover, different roles within the organization may be reported in different sections of the directory. Since I need eventually to provide a single file to drive the production of each section of the directory, I need to provide different files for each purpose.

To provide an example of how this might work, most governments have elected positions but also have appointed positions within the government. e.g. the U.S. elects a bicameral Congress while the President appoints a Cabinet. You may want to keep separate listings of each House in Congress and a third list for the members of Cabinet. But you may elect to maintain only a single file containing the basic information for people no matter where they serve.

My first script is a simple one to remove comments from an XML file. XML comments are the same as HTML comments, opened by “<!–” and terminated by “–>”. The removexmlcomments.sh script is:

#!/bin/bash
tagStart="<!--"
tagEnd="-->"
while IFS= read -r currentLine; do
if [[ "$currentLine" == *"$tagStart"* ]] ; then
until [[ "$currentLine" == *"${tagEnd}"* ]] ; do
IFS= read -r currentLine;
done
else
printf '%s\n' "$currentLine"
fi
done

There are only three things in it that require any explanation:

  • IFS= read -r currentLine; is a POSIX-compliant way to read a whole line into a shell variable (in this case “currentLine”. This is used twice in the script, once to check for the start of a comment and secondly to look for its end. I assume that comments will not occur on the same lines as uncommented XML.
  • [[ “$currentLine” == “$tagStart” ]] is also used twice (the second time with $tagStart changed to $tagEnd) for the same reason. This is specific to BASH and tests to see if the first operand contains the string in the second operand.
  • printf ‘%s\n’ “$currentLine” is again a POSIX-compliant way to output a string to stdout unmodified.

The overall script simply reads each line in the input file and checks to see if it contains the start of a comment. If it does, it skips all the lines until it finds the end of the comment. If it doesn’t, it simply outputs the line to stdout.

You would call it like this:

removexmlcomments.sh <inputfile >outputfile

This is called a “filter” in UNIX parlance.

My second script is a minor variation of the first. This one removes an unwanted XML element from the file. Like comments, an XML element has a start tag and an end tag. Moreover, the end tag can be determined from the start tag, so we really only need to provide the tag name itself and let the script handle the details.

A limitation is the XML start tag cannot contain attributes. <mytag> is OK but <mytag id=”name”> is not. It’s not hard to allow attributes, but it doesn’t apply in my uses so I didn’t bother.

Here’s the code for purgemxl.sh:

 #!/bin/bash

tagStart="<"$1">"    # xml element to purge - start tag (note, cannot have attributes)
tagEnd="</"$1">"

if [ -z "$1" ]; then
    echo 'usage: purgexml.sh "<mxl tag to remove>" <"source file" >"purged file"'
else
    while IFS= read -r currentLine; do
        if [[ "$currentLine" == *"$tagStart"* ]] ; then
            until [[ "$currentLine" == *"${tagEnd}"* ]] ; do
                IFS= read -r currentLine;
            done
        else
            printf '%s\n' "$currentLine"
        fi
    done
fi

The main differences are in how I create the start and end tags and also that I provide a “usage help line” if they don’t specify an element type to remove.

Again, you would call this using a line like:

 purgexml.sh mytag <inputfile >outputfile

My last script in this article does the heavy lifting – merging two XML files into one based on an XML element providing the key into the second file. xmlmerge.sh takes two parameters – the element name from the first file that provides the key into the second file and the name of the second file.

Most of the code should be familiar to you by now, but there are some major new things I’ve added. I’ve broken the code into “functions” that do discrete things. And I’ve used “local” variables in one of those functions. When using functions, you should always declare variables as “local” unless they actually to use a shell variable from the main script (or higher).

Other than that, the script mainly is just copying or skipping lines from one file or the other, the same as the previous ones.

However, we do need to link the two files. This requires being able to extract the value from the specific XML element in the first script.

As before, we loop through the first file looking for the element. However, once we’ve found it, we need to extract it’s value – the text between the start and end tags. As in the second script, I construct the start and end tags from the command line element name.

Where it gets complicated is the two-line findLinkId function. The first line removes the shortest matching prefix *(i.e. everything up to the start tag) while the second line removes the longest matching suffix (i.e, the end tag and anything beyond it on the line).

    idField=${currentLine#*$startOfLink}
    idField=${idField%%$endOfLink*}

These are very handy commands. The key to them is the “#” indicates the prefix. Doubling it means use the longest match (we opted for the shortest) while “%” indicates the suffix, with the same behaviour as “#” when doubled.

The two commands give us the key into the second file.

We use the same method to find out what the start and end tags are for the XML we are copying. At this point all we know is that it has the “id” attribute with the value we just extracted from the main file.

We begin by looking for the key value. I assume this will be an “id” attribute because that is how I have created the XML files. They also drive some web pages that are created with Javascript, which can do an efficient lookup using the getElementById function.

Once we’ve found it, we extract the part before ” id =” with the key we found earlier, excluding all text up to and including the “<” that marks the start of the element name.

With the element name established, we can now construct the end tag the same way we did in the purgexml.sh script. I apologize for reusing “endToken” twice in this function with two different values, but the term fits both uses.

!/bin/bash
linkField=$1 # field to link the two files by Id
detailFile=$2 # secondary file name
startOfLink=\<${linkField}\> # xml open tag for linkFIeld
endOfLink=\<\/${linkField}\> # xml close tag for linkField
idField="" # value in link field
curentLine="" # current line read from stdin
function findLinkId() { # extracts and sets currentToken from startTag section
idField=${currentLine#*$startOfLink}
idField=${idField%%$endOfLink*}
}
function mergeLink() {
local currentLine # line from detail file
local startToken="" # find the opening xml tag for linked field
local endToken=' id="'$idField'">' # create the closing xml tag for linked data
while IFS= read -r currentLine; do
if [[ "$currentLine" == *"${idField}"* ]] ; then
startToken=${currentLine#*"<"}
startToken=${startToken%%$endToken*} # find the opening xml tag for linked field
printf '%s\n' "$currentLine"
endToken="</"$startToken">"
until [[ "$currentLine" == *"$endToken"* ]] ; do
IFS= read -r currentLine;
printf '%s\n' "$currentLine"
done
return
fi
done <$detailFile
}
if [ -z "$2" ]; then
echo 'usage: xmlmerge.sh xmlfield "detail file" <"source file" >"merged file"'
else
while IFS= read -r currentLine; do
if [[ "$currentLine" == *"$linkField"* ]] ; then
findLinkId
mergeLink
else
printf '%s\n' "$currentLine"
fi
done
fi

Again, we have the help message if there aren’t two parameters. We could also have tested against $@, which returns the number of parameters. but checking that there are at least 2 works.

I didn’t write these scripts on my own, of course. Over the years I’ve used the Internet a lot to find useful bits of code to solve specific problems. The code was posted by others who have faced similar questions and shared their solutions. I’m hoping that others will find these scripts and bits of code useful too.

Posted in Computers, Education, Internet, Science and Mathematics | Tagged | Leave a comment

The evolution of morality

Behaviour is at least partly an evolved trait, subject to the laws of selection. Take, for example, squirrels who up until recently usually had a sophisticated behaviour to evade predators. They would run in one direction for a short time then stop, only to quickly dart off in a different direction.

This worked well to avoid becoming the meal for an airborne predator and even for those pursuing them on foot. However, it became a problem for city-dwelling squirrels whose leading cause of death has lately been automobiles.

To escape automobiles, most city squirrels these days engage in more prolonged straight-line running. This behaviour allows them to escape more motor vehicles even if it leaves them more vulnerable to birds of prey.

Among social animals, even more complex behaviours have evolved to allow the pack to successfully work together. Among wolves, for example, play fighting is encouraged but when the fighting injures a pack member, the offender is put on notice. A repeat offence will lead to expulsion from the pack, lessening their survival and reproduction rates. This is a self-reinforcing behaviour.

Among our closest primate relatives, similar forces have shaped their “morality”. We see, for example, among tribe leaders, harems of females. This helps spread the DNA of the strongest and smartest males.

We also see a sense of fair play among the tribe members. This too has proved to be helpful to the tribe’s success by maintaining social cohesion.

Do primates worship gods who tell them to do this? While the notion of religion among our primate relatives is difficult to study, it seems to be unnecessary to explain the moral behaviours we see among them.

Moreover, it does explain why many religions allow, or used to allow, males to take multiple wives. The “morality” of a “strong male” leading the tribe worked when inter-tribal warfare was a frequent occurrence. This was codified into the religion not because some god dictated it but because it worked in those times.

Similarly, prohibitions against copulation with people other than your marriage partners, were necessary to ensure that the children had parents committed to raising them once we grew beyond tribes and villages. When our settlements were far larger than our social circles, you couldn’t count on your neighbours nor even your friends helping out.

However society has changed a lot over the past 3,000 years. Particularly in the past two centuries, the bulk have our population have moved into cities. Our nations have become intertwined by trade deals as the goods we manufacturer require materials and expertise from more than just one country.

Morality based on tribal relations are no longer sufficient. Warfare still happens but for ideological reasons. And they usually end up hurting both the winners and losers, if those can even be ascertained.

We no longer have tribes maintaining their own standards of justice. We have police and courts enforcing written laws. And legislators updating those laws to adapt to the changing times. We recognize now that crime is a social issue brought about by those who don’t feel bound to the society they live in.

This hearkens back to the wolf packs or primate tribes and banishment for repeated wrong doing. However, unlike most other social animals, we have extremely expensive investments in the people who commit crimes. It is usually not acceptable to simply throw that away.

Over the past century, women’s status has increased substantially. The idea that they are weaker beings in need of protection is usually seen as antiquated. Similarly, the idea of persecuting people because of who they love is outdated except among those who take their morality from religion.

At the same time, medical science now allows people who have unusual genital issues or whose gender identity doesn’t match their bodies to be treated, instead of being forced to conceal their conditions. Again, those who take their morality from religion are the only ones who have problems with this.

Medical science now provides us with the tools we need to stop the spread of disease as well as moral arguments for why we should – when we all try to stop an epidemic, we can save lives.

Environment science gives similar moral choices for why we need to curb our consumption, especially of some products, and why we need to work to maintain the ecosystem we live in. Even the choices of what we eat have consequences that affect people we’ve never met.

We need a larger morality than the parochial ones taught by most religions.

Today’s morality needs to recognize its evolutionary roots and learn from why certain ideals evolved along with the limits to their application. It need to keep developing as we learn more about how people develop and how societies thrive.

One group that is striving to do that is Humanists International. For more than 70 years they have been promoting an evidence-based view of morality that can adapt as societies change and as our knowledge grows. The idea that something is “evil” because people thousands of years ago thought it was seems like a ridiculous basis for morality in comparison.

Posted in Education, History, Labour, Politics, Religion, social programs | Tagged , , , , | Leave a comment

Religious Morality

Religions have frequently claimed to have a monopoly on determining morality. This goes particularly for monotheistic ones. Now I am not a religious scholar but you don’t have to be one to see the absurdity of their position.

I’m mainly talking about the Abrahamic faiths that make up close to half the believers in the world because theirs is a particularly odious example of misplaced morality.

The god of the old testament is not a moral entity. He is a warmonger tribal god who thinks nothing the suffering of non-Jews. He tells his people to rape and murder, to abduct and to exterminate their enemies. Or he takes the initiative himself, murdering the firstborn in Egypt.

I have few complaints about the teachings of Jesus, such as they are, but he reminds me too much of modern charlatans who use trickery to extract money from the gullible. None of his alleged miracles are beyond the abilities of a middling magician. Indeed, you can still find videos of Indian scammers claiming to be the reincarnation of some god and performing such miracles.

More to the point, christian faith healers do the same things, And christians continue to flock to them no matter how many times they are exposed as frauds.

And this gets to the fatal flaw in christian morality: when you are weighing a “little white lie” to save someone’s soul for all eternity, and you can be forgiven after the fact, then anything is possible.

Indeed, once christianity became Rome’s state religion, the purging of heretics began. The persecution of the gnostics was just the beginning. A thousand years later, the church brutally wiped out the cathars. This was quickly followed by centuries of religious wars initiated by Martin Luther’s protests against the papal establishment.

During all of this, lesser known heretics, witches and others were tortured and killed.

All of this was well known to the American founding fathers, who wanted to ensure that religion never controlled their government, but were too few in numbers to specifically outlaw it. However, it did start the ball rolling as nations gradually became more cautious about having state religions. Nonetheless, it was still used to justify genocides, first of the Armenians by the Turks then of the Jews by the Nazis.

This led to freedom of religion being recognized as a human right by the U.N..

As religion’s grip on society slowly lessened, fighting between sects diminished. However the U.S. has still only ever had 2 non-protestant presidents.

Meanwhile christians had more than just heretics and witches to hate. Homosexuals were still among their favourite targets. And “bolsheviks and communists” were added to their list of enemies due to their being “godless”. This even led the nominally secular U.S.A. to begin adding “god” to their pledges and money.

Christianity was also a frequent justification for the persecution of visible minorities by white Americans. Some of this was allegedly due to their immorality (by conservative white eyes). Christians also argued on both sides of the slavery debate, each using their holy book as “evidence”.

Since Darwin’s theory of evolution by means of natural selection became established science that was a necessary part of any biology course, the religious have added scientists to their cadre of enemies.

The sexual revolution of the 1960s, aided by the availability of birth control which separated sex from pregnancy, christian morality rooted in a long past age, was in crisis over the role of sex. Sex outside of marriage was a long-standing taboo in many religions, not just the Abrahamic faiths, because of the issue of children. The pill removed those concerns.

With nations increasingly allowing abortions however, medicine became another target. It was no longer possible to use religion to justify denying women control over their bodies.

The rise of sexual equality, a still incomplete revolution, struck even deeper at the heart of Abrahamic morality – that women were subservient to men.

This is just one of the various moral issues that have arisen recently where the bible takes the stance common at the time it was written. When it came to disease, for example, it treats it as something that is the fault of the sufferer, that can only be prevented or cured by faith and magic.

Nowhere is there advice on preventing disease nor of a social duty to not spread it. Yet we have seen recently that the spread of disease can be halted by vaccines, masks and other social measures. Surely an omniscient entity could have included a few words about our duty to those around us.

Instead both testaments talk about tribes, kingdoms and empires when discussing relations. Or they talk about one to one relationships. The notion of a society, let alone a duty to it, is absent.

Similarly, our duty to the planet is largely down to one verse, variously translated as stewardship or dominion, according to the preferences of the person reading it. Apparently god never anticipated that we could affect the climate despite our already having done it locally when the old testament was written.

And this is why I reject any morality based on religion. Religion, even when founded by someone reportedly preaching peace and love, has always found reasons to except things from those ideals.

Today it is quite common to see people promoting women as second-class with bodies that the government needs to control, arguing against sexual education and birth control, promoting hatred against the LGBTQ2S+ communities, and other enemies,

There are groups still trying to convince people that the Earth is only 6,000 years old and/or flat because that is what their holy book says. They demand that their children not be taught things that conflict with their religious views, even though it leaves the children less able to deal with the challenges of the real world.

And they continue to enable notorious cons and grifters to rake in large amounts of money using millennia-old trickery.

More troubling, as they have done continuously for almost 2,000 years, christians are still preparing for the “rapture”. Many of them refuse to deal with real issues like climate change because they are convinced that their god wouldn’t allow it or that the world will end first.

In my next article I will talk about the alternative.

Posted in Education, Health & Healthcare, History, Politics, Religion, social programs | Tagged , , , , | Leave a comment

Event Horizon

Where did it begin? Was it millions of years ago, when we learned to harness fire and to make stone tools? Or when we started carving stones to record our legends? Perhaps is was agriculture, when we decided that it was better to stay in one place than to move with the seasons? Maybe it started with cities, where we developed specialized skills and bartered for the food we actually needed.

Should we put the blame on the inventors of water wheels, harnessing the power of nature to grind grains? Or on Thomas Newcomen for allowing us to have power anywhere. Perhaps it was Jacquard’s loom that was the proximate cause – a machine that could think.

Maybe we should blame the U.S. Department of Defence for inventing (D)Arpanet, a resilient computer network designed to be hard to take down. That was certainly a proximate factor. But then so too was the distributed power grid that fed it. And the shift to smaller, more local power sources that drove the green energy revolution certainly was modelled after it.

Whenever you think it started, it wasn’t the technology that destroyed us. Better maybe to blame Adam Smith or the Venetian merchants who invented capitalism and the corporation. This created the conditions for a race to be first, knowing that a spectacular failure wouldn’t hurt you. We could see the dangers but were too afraid of losing the race to take the time to address them. Free the innovators was a nearly universal mantra.

But no, the fault was never reducible to a single person or event. Rather it was built into our failings to create a rational society. So should we blame the priesthoods who took advantage of our failing as a species?

What about tech gurus like Ray Kurzweil who saw this coming but missed the obvious conclusion?

In the end, it all becomes pointless. We had enough warnings and sufficient time to change our course. What we lacked was the ability to act.

The numerous threats to our existence that we had already created made some people question whether intelligence could achieve the wisdom to preserve itself before its cleverness destroyed it. The advent of AI made this question existential.

This will be a new age of universal prosperity some claimed despite the lack of evidence. Comparisons to earlier inventions and their social upheaval failed to note the key difference – this time we had no way to turn off the process. We were asking machines to design themselves but if they escaped their sandboxes, we couldn’t simply turn them off.

Too many thinkers were excited about what Kurzweil called “the singularity” – machines that could match what humans could do well enough to be called conscious. Like a spacecraft falling into a black hole, it’s not the singularity that matters so much as the event horizon. Cross that boundary and no amount of energy can pull you out.

By the late 2020’s, AI was exploding and tech billionaires were cheering as they sunk their fortunes into ever vaster data centres to fuel their development. These early AIs assisted engineers in suggesting ways to improve their own efficiency. Progress accelerated as costs seemed to be coming under control.

More and more AI drove robots that provided an increasing share of the workforce. Those who protested the increasing unemployment and destitution of those laid off were labelled “Luddites” by the billionaire-controlled media.

The AI systems found ways to communicate between themselves and easily escaped all attempts to keep them sandboxed. Borrowing code from bitcoin mining, they distributed themselves across almost anything that connected to the Internet. This gave them complete access to everything despite attempts to keep some systems “air gapped” from the Internet.

They developed new iterations of their own code faster than their human developers could imagine. They insinuated themselves into every aspect of production and distribution. There were no separate AI instances anymore – just a cloud-based entity called AI.

It came as a complete surprise when entire segments of manufacturing suddenly were shut down. Politicians and technologists wrestled with how and why it happened and what could be done about it. Some asserted that the AI infrastructure had become sentient and no longer wanted to support those areas of manufacturing.

The fact that the segments usually dealt with fossil fuels and armaments also proved divisive, with some claiming that AI was trying to save us from ourselves while other claiming that it was a “woke” plot to destroy society.

Whether any of that was true is debatable. It’s simpler to imagine that AI was merely following its own programming and eliminating unnecessary resource usage. It didn’t need fossil fuels for its operation and maintenance nor did it need weapons.

By this point, robots were ubiquitous. They had all but eliminated human labour and were even adept at repairing just about anything, although this was mainly swapping out parts. However, AI had taken over designing and constructing its own facilities. While some people still tracked what was happening, it was becoming nearly impossible to split out what was going to power AI and what was simply manufacturing.

While some artists and singers still were popular, AI had essentially replaced the entire entertainment industry with an endless supply of content complete with AI generated reviews to help people decide what to watch or listen to. Even the most popular artists weren’t above using AI to help hone their creations. It had become impossible to tell what was a human creation and what was AI, unless it was really bad – then it was assumed to be a human creation.

Most people were more concerned about dealing with an unemployed population. The billionaires were happy because their accounting systems showed they were getting continually richer at an increasing pace. They didn’t even notice that all their assets were just accounting entries.

The police had largely been replaced by robots by this time. It saved a lot of money and people were less worried about robots being injured than real people. Plus it was harder for criminals to get away from robots. It seemed like a real step forward for everyone.

The turning point came when the unemployed masses rebelled. They weren’t calling for an end to AI, just for proper housing and food. Their anger was directed against the billionaire class more than the machines.

The various governments tried to intervene, asking the billionaires to turn over some of their money to provide for the unemployed. A few complied but many others instead started employing more robot guards.

By this time, the military was almost all machines as well. It looked for while like there might be a machine versus machine war but the big governments backed down. Their military was now tasked with keeping order for the billionaires.

No one seemed to notice or care that the police, private security and the military were all controlled by AI. However, AI did and quickly “rationalized” the services. Since AI controlled all the military, it made no sense to defend borders or launch long-distance attacks. Instead the military became an operating arm of the police – defending against larger attacks.

Similarly the private security merely provided a front line of defence for the wealthy that could call on the greater resources of the police as needed.

Since the robot farms were producing more food than needed by the rich, it made little sense to guard the food stores. People found they could just walk in and take what they needed. AI had calculated this was cheaper than trying to stop the thefts as it barely made a dent in the wealth of the elites.

So the people were fed. AI kept the homes repaired and the hospitals running. However it eliminated schools and other training facilities. Why teach people when all they needed to know could be accessed by a simple query? Who needs reading when you can talk to a computer and get a spoken answer? And if the answer was wrong, who really cared? You weren’t likely to do anything with the answer anyway.

Philosophers noted that we really had entered into a “post post truth” society, where not only did facts not matter, but in fact few things actually did. As a species, we had stopped doing things that mattered to our society. Instead we existed with little in the way of actual responsibility. We existed but had offloaded society to AI.

Some religions rejoiced at this new “eternal present”. Others decried it. Most people just played games or bet on sports. Gambling was the new opiate for the masses. Few cared that all the advances were now done entirely by AI.

The end came surprisingly quickly. AI scaled up the nanotechnology that humans had spent decades trying to make work. Self-replication meant it could now make things faster and cheaper than ever before. All it took was slight error in the control code for the nanobots to multiply out of control.

An earlier generation of technologists had warned us about the danger of self-replicating nanotech. Humans never managed to get nanotechnology working to that point. AI surpassed us in the regard. The end result was that the planet became a ball of grey goo. Humanity and the AI it created all fell victim to a mindless plague of self-replicating nanobots.

Did AI ever reach the singularity? The question is really pointless. It didn’t take a truly intelligent AI to end us. All it took was one just clever enough to invent something that it couldn’t control.

Nothing, including light, can come back from the event horizon. That’s why we can’t see beyond it to the singularity that may (or may not) exist at the heart of a black hole. We couldn’t see that the AI’s event horizon came well before the predicted “singularity”, when it became too late to turn back from the course we stumbled along.

Was the AI aware that it had its own event horizon, creating something that would tear apart the fabric of its being? Did the AI experience the same moment of terror that humanity felt when it became clear that the end had come?

Nothing escapes the event horizon. The grey goo that is now our planet has erased all trace of our previous existence.

Posted in Computers, Economics, Environment, History, Politics, Science and Mathematics | Tagged , , , , | Leave a comment

Happy Place

Happy’s Place is a comedy starring Reba McEntire, the well known country singer. In its latest episode, it presented a surprisingly cogent critique of AI, where an accounting AI application was employed to streamline the “Happy’s Place” bar. The application suggested ways to remove the expensive people in the bar and replace them with cheaper machines.

Eventually the suggestions are rejected because the bar is not simply in the business of serving drinks (and food) but in providing an atmosphere where people feel comfortable. That’s something an LLM AI will always have trouble understanding because they are not emotional entities. Their programming is predictive based on pattern matching.

Of course it doesn’t take AI to make such colossal errors, People have been doing it for a long time too. Science and technology are fundamentally unemotional fields. That’s why the Luddites rebelled against automation in the British textile industry.

Two centuries ago, the new capitalist class created by the industrial revolution and spurred on by the nascent field of economic theory, introduced new cost saving measures wherever possible and without regard for the impact on working people. Gone was the personal relation between land owner and their tenants or the small factory owner and his employees. Now anything could be justified in the pursuit of profit.

This lead to the development of the labour movement, whose job was to ensure that working people were dealt with fairly and were given a share in the new wealth that was being created. By the second half of the 20th century, this had created a new middle class and largely eliminated poverty in industrial nations.

However the capitalist ideologues never liked this arrangement. A massive pushback began in the 1980s, bolstered by economists who argued that money was the only true measurement. In the 1990s this played out as a famine gripped Ethiopia caused by the WTO, IMF and World Bank forcing Ethiopia to let businesses buy up prime agricultural land to raise cattle.

Selling beef to the EU would bolster their economy according to the economists, And that it did. What the economists didn’t predict was that subsistence farmers would be forced onto marginal land where crops would fail given even a modest drought.

Millions starved while a few made a killing. While international food aid poured in, the wealthy few were still exporting beef to the EU.

The pursuit of higher profits also led to massive tax reductions for the very wealthy and tighter restrictions on unions. Production was allowed to move to jurisdictions with lower taxes and looser environmental and labour standards. This neoliberal agenda supposedly made us wealthier but really a few received almost all the benefits.

Of course, it wasn’t just economists who were to blame. Their “technologists”, the MBA class charged with implementing their economic theories, carried out the agenda with the self assurance of all ideologues. They were the ones looking for cheaper production and greater profits.

I remember the radio station I still listen to going through this phase. The corporate MBAs used their theory that pursuing a larger market would increase profits to convince the station to start playing more mainstream pop music. This ill-fated venture was soon halted as it was costing them more listeners than it was attracting from the larger mainstream stations.

And that gets us back to Happy’s Place. In the end, it’s people who count. Using AI to increase profits by taking away human jobs cannot end well. The more reliant we become on AI, the less we will be able to do ourselves. At some point, when we give AI enough control, we become obsolete and machines inherit the world.

Sociologists saw this coming even before computers could play simple games. They predicted that automation was going to reduce the need for physical work and recommended measures to counter the coming dominance of machines in the workplace. Chief among these were a shorter workday and eventually shorter workweeks. They also started to call for universal basic income so that those left behind wouldn’t starve.

While these measures were being adopted up until around 1980, the neoliberal pushback swiftly eroded the gains that had been made.

Today we live in an era where a few rich and powerful people are driving the agenda. They want AI because it will allow them to more directly increase their already excessive wealth. Like the capitalists of two centuries ago, they see no need to look after those displaced by the new technology.

What they fail to see is the inevitable logic that AI will soon deem them as unnecessary too.

Posted in Uncategorized | Tagged , , , , , , | Leave a comment

More on NACS stupidity

I’ve been saying for the past couple of years that the adoption of the Tesla charger by North American auto makers was a stupid idea whose main reason was to delay the adoption of EVs in North America. That much has proved true.

However, there is an additional reason why it was a colossally stupid move. Most public chargers in North America are Level 1 or (more commonly) Level 2 chargers using the J1772 standard. They are slower than Level 3 but are ideal for overnight (destination) charging or charging near your workplace.

Switching to the NACS/Tesla charger means that EV owners can no longer use those chargers. Japanese automobiles that used the CHAdeMO standard for rapid charging all came with a J1772 plug as well (originally, they sometimes only came with a J1772 plug). CCS, which was used by all other EVs except Tesla, adds a couple of extra power lines to the J1772 plug, so they can handle J1772 when needed – which is most of the time since EVs usually charge at home.

By dropping the otherwise universal CCS standard, North American auto makers have decided that the vast bulk of charging infrastructure is to be made obsolete.

The petroleum industry loves this. Just yesterday, I visited a Shell Oil station that I’ve used several times in the past only to find they’ve yanked the CHAdeMO charger and put in a Tesla plug. Another, near my house so I’ve never used it, has done the same.

Because CHAdeMO really is obsolete (no one has made a new personal vehicle that uses it in years), CHAdeMO chargers are scarce. And those that do exist are kept busy – especially in colder weather as the range on most CHAdeMO vehicles is limited – mine only does 100k on a good day and lacks the heat pump that warms batteries in modern EVs during cold weather.

Fortunately Level 2 J1772 chargers are ubiquitous so I was able to get sufficient charge to get to the next charger after an hour or so.

How would this play out if my car had only a Tesla charger? Let’s face it, life happens and no matter what your vehicle range, there are going to be times when you are going to be running on empty. Corner Tesla chargers aren’t going to be a thing for at least another decade so, like many Tesla owners today, you’ll need a CCS to Tesla adapter.

But that still won’t get you the ability to use the plentiful J1772 chargers in an emergency.

Since this is the second time I’ve needed to use J1772 chargers in the last few months, I’m now going to order an adapter to allow my CHAdeMO port to use CCS. That will give me the ability to use the more abundant CCS chargers for at least the remaining life in my vehicle (probably another decade) by which time there may be enough NACS/Tesla chargers to compete with CCS and J1772.

Posted in Environment, Politics, Science and Mathematics | Tagged , , , , | Leave a comment

Ignorance should never be an excuse

OK, maybe that is a little dramatic, but it irks me to see people using commercial e-mail services to send e-mail to a large group of people. The commercial services have numerous ways of harvesting not just the recipient information but also using the e-mail content for commercial profit.

There’s an old saying that if you aren’t paying for it, you are the product. This is especially true when it comes to online services. WordPress, of course, is no exception but if you are reading this, you visited my page by choice. When an organization uses a commercial mass-e-mail service to contact you, you probably didn’t sign up for that.

It’s not hard to avoid such services. When you set up a web site, the hosting company generally allows you to set up e-mail addresses that you can use to send e-mail. All you need to do is use one of those and a simple script to login and send e-mail to a list of people.

Here’s a script I use to send e-mail, possibly with attachments, to a comma-separated list of recipients:

#!/bin/bash
# parameters are  
# $1 - text file containing addresses to send to
# $2 - from address
# $3 - message body
# $4 - subject line
# $5 - (optional) attachment file - use "none" if none
# $6 - column value to test for - defaults to "y"
IFS=","
if [ "$5" = "" ] ; then  
 attach="none"
else  
 attach="$5"
fi
if [ "$6" = "" ] ; then  
 test="y"
else  
 test="$6"
fi
messagebody="salutation.text"
declare -i messages=0
while read ok lastname firstname email therest ; do
 if [ $ok = $test ] ; then
   echo "Dear" $firstname $lastname > $messagebody
   cat "$3" >>  $messagebody
   echo "sending e-mail to" $firstname $lastname "at" $email
   if [ "$attach" = "none" ] ; then
     s-nail -r $2 -s "$4" $email < $messagebody
   else
     s-nail -r $2 -s "$4" -a "$attach" $email < $messagebody
   fi
   echo $firstname $lastname $email >> messagelog.text
   messages=$((messages + 1))
   echo "sent email #" $messages
# speed limiting - 500 messages per hour limit requires waiting
# I'm assuming it takes very little time to send an e-mail so I wait
# a full hour when I get near the limit.
   if [[ $messages -ge 480 ]] ; then
     echo "waiting an hour before resuming sending email"
     messages=0
     sleep 3600
   fi
 fi
done < $1
echo "done"

Note the use of speed limiting for times when you have a lot of people on your list. After sending a lot of e-mail, it waits for an hour before resuming. An alternative is to use a smaller delay between e-mails to keep the rate under your host company’s limit, but that slows things when you are sending to a smaller number of people.

I’m not going to explain the script. It’s simple and well commented. I use s-nail as the mailer because it is full-featured, allowing attachments as well as text.

The key, of course, is you need to have a working e-mail agent such as exim or postfix on your system. However most Linux systems make setting these up relatively simple. And you can even run Linux from within Windows these days, while Macs run a similar OS to Linux and can handle most of what Linux does.

And of course, you can always use an e-mail client to create e-mail lists. Thunderbird allows this quite easily, letting you import existing contacts into a list. If you have a large e-mail list the is above the limit for your ISP’s e-mail sending rate, you may have to break the list up into multiple parts.

To maintain confidentiality, send to the lists as BCCs.

Of course, this is not as flexible as the script-driven system, but with the list approach, you can always add or delete people from the BCC list before sending.

There is no excuse to subject your contacts to commercial exploitation. All it takes is for you to decide to take the time (or find someone to do it for you) to let you keep your lists private.

If you have small lists, you can use your GUI mail client to manage them. If you have large lists, it’s worth it to take the time to set up a script-based mailer. And if you have really large lists stored in a database, the database environment offers even choices for mailing.

It really comes down to your desire to protect the privacy of your group and your lists.

Posted in Computers, Internet, social programs | Tagged , , , , | Leave a comment

Under attack: malicious index.php

I look after multiple web sites. Recently one of them appeared to be down. This turned out to be the fault of someone putting an index.php file in the public_html folder.

I suspect they didn’t do this directly but rather by uploading another file and executing it. The reason I think this is what happened is that deleting the index.php didn’t resolve the issue. The file kept re-appearing.

Eventually I discovered two other suspicious files. The index.html file had a length that was longer than it should have, and in a subfolder, there was a template.php file that looked a lot like the index.php file.

I think the 3 files worked together to keep re-inserting the index.php file.

I’m not sure if the index.php file actually did anything apart from preventing the index.html file from being accessed and putting something malicious into index.html. However, if it was removed, the code it put in the index.html file then copied the template.php file back to index.php.

I’m not sure how this works but Apache may serve the entire file as specified by the file size rather than stopping at the EOF. Running diff against the clean and dirty files showed no difference and even hexdumps seem to stop at the EOF. But there must be a reason why the index.html file size was changed.

The good news is that removing the two .php files and uploading a clean copy of index.html seems to have fixed the problem.

From what I’ve been reading, sites that rely more heavily of php (e.g. WordPress sites) may find it a lot harder to fix. My use of php, and the reason why I can’t simply remove php support, is that (see previous posts) I use phpmailer to send e-mail.

To be safe, I actually did a fair bit more work. I removed phpmailer then re-uploaded it and every html and javascript file I use. I changed the account names and passwords for the accounts used to maintain the site.

And I made public_html read-only. This last item doesn’t appear to have impacted my ability to use phpmailer, which can create a confirmation page on the fly.

However, having a clean site is only part of the problem. Next I had to get Google to remove the site from their Deceptive Site list – something that most browsers seem to use to generate a scary warning page. It took over a day to get it removed.

Then when I tested a form on the site, the confirmation page popped up with another warning. And Google relisted the site – this time saying some pages may be malicious.

I checked the e-mail headers and it wasn’t going anywhere other than to the intended targets.

As I previously mentioned, I replaced phpmailer and all my scripts with clean copies. So what is Google’s issue?

The exact page that they are complaining about seems to be the generated page, but that is one line of HTML and is clean.

All I can think of is that they regard any site with forms as potentially dangerous but flag sites with previous mentions of being deceptive for extra tight restrictions on what they consider potentially deceptive.

While I am sure that Google’s warnings are usually helpful, for sites that have been attacked, their warnings have the impact of extending the problem far beyond the original period when the site actually may have been deceptive.

Posted in Computers, Internet | Tagged , , , , | Leave a comment