How to Move Your Contacts with Phone Numbers from Apple Mail to Mozilla Thunderbird

I recently switched from an aging Apple Macbook Air to a shiny new, substantially lighter LG gram running Windows 10.  This involved switching from Apple Mail to the free open-source Mozilla Thunderbird.  In principle, Apple Mail can export my address book (contacts) in the human-readable vcard or VCF, Virtual Contact File, format and Thunderbird can import an address book in vcard format.  BUT, as it happens, Thunderbird failed to import the telephone numbers for my contacts, a long standing problem with Thunderbird.

Mozilla Thunderbird
Mozilla Thunderbird

To export the Apple Mail contacts, bring up the Apple Contacts application, select All Contacts, and select File | Export | Export vCard…

Apple Contacts Export Closeup
Apple Contacts Export Closeup

Then save the vCard file:

Apple Contacts Save Dialog Box
Apple Contacts Save Dialog Box

To import the Apple Mail contacts with the phone numbers successfully, I wrote a Python 3 script to convert the VCF file to a comma separated values (CSV) file that Thunderbird could import with the phone numbers.  I used Python 3.6.4 installed as part of the Anaconda Python distribution.  Python and Anaconda are both available for Windows, Mac OS X, and most major flavors of the free open-source GNU/Linux operating system.  In principle, the Python script should run correctly on any of these platforms.

By default the script (below) assumes the vcard file is named jfm_contacts.vcf and writes the Thunderbird compliant CSV to tbird_imports.vcf

To run the script using ipython (installed by Anaconda) and override these defaults:

C:\Users\John McGowan\Code>ipython
Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 6.2.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: run convert_vcf_to_csv.py mytest.vcf -o tbird_mytest.csv
Reading vcard (vcf) file:  mytest.vcf
WARNING: VCARD  19  ( Apple Inc. )  1-800-MY-APPLE  MAY NOT BE A VALID PHONE NUMBER
WARNING: VCARD  301  ( Name )  Mobile  MAY NOT BE A VALID PHONE NUMBER
WARNING: VCARD  301  ( Name )  Home  MAY NOT BE A VALID PHONE NUMBER
WARNING: VCARD  301  ( Name )  Work  MAY NOT BE A VALID PHONE NUMBER
WARNING: VCARD  301  ( Name )  Fax  MAY NOT BE A VALID PHONE NUMBER
Processed  503  vcards
Wrote Thunderbird Compliant CSV file with phone numbers to:  tbird_mytest.csv
ALL DONE

DISCLAIMER:  Note that this script is provided “AS IS” (see license terms for more details).  Giant corporations like Apple work long and hard to lock users into their “ecosystems” by, for example, using obfuscated non-standard “standard” formats for key contacts and other critical information stored in their products.  Make sure to keep backups of your address books and contacts before using this script or similar software.

convert_vcf_to_csv.py


"""
convert Apple Mail VCF archive to CSV file for Mozilla Thunderbird (tbird)
tbird cannot read phone numbers from Apple Mail VCF file
"""

import sys
import os.path  # os.path.isfile(fname)
import re # regular expressions
import phone  # my phone number validation module

VERBOSE_FLAG = False  # debug trace flag

# CSV file header generated by exporting contacts from Mozilla Thunderbird 52.6.0
TBIRD_ADR_BOOK_HEADER = 'First Name,Last Name,Display Name,Nickname,Primary Email,Secondary Email,Screen Name,Work Phone,Home Phone,Fax Number,Pager Number,Mobile Number,Home Address,Home Address 2,Home City,Home State,Home ZipCode,Home Country,Work Address,Work Address 2,Work City,Work State,Work ZipCode,Work Country,Job Title,Department,Organization,Web Page 1,Web Page 2,Birth Year,Birth Month,Birth Day,Custom 1,Custom 2,Custom 3,Custom 4,Notes'  # was carriage return here

# John Nada from John Carpenter's THEY LIVE
DUMMY_CONTACT = 'John,Nada,John Nada,Nada,nada@nowhere.com,nada@cable54.com,NADA,999-555-1212,888-555-1234,777-555-6655,111-555-1234,111-555-9876,123 Main Street, Apt 13, Los Angeles, CA, 91210,USA,Work Address,Work Address 2,Work City,Work State,Work ZipCode,Work Country,Job Title,Department,Organization,Web Page 1,Web Page 2,Birth Year,Birth Month,Birth Day,Custom 1,Custom 2,Custom 3,Custom 4,Notes'

# break into values
FIELD_NAMES = TBIRD_ADR_BOOK_HEADER.split(',')
FIELD_VALUES_START = DUMMY_CONTACT.split(',')
for index, value in enumerate(FIELD_VALUES_START):
    FIELD_VALUES_START[index] = ''  # try single space

# build dictionary to map from field name to index
FIELD_INDEX = {}
for index, field_name in enumerate(FIELD_NAMES):
    FIELD_INDEX[field_name] = index

if VERBOSE_FLAG:
    print(FIELD_INDEX)

    print(TBIRD_ADR_BOOK_HEADER)
    print(DUMMY_CONTACT)


if len(sys.argv) < 2:
    VCARD_FILE = 'jfm_contacts.vcf'
else:
    VCARD_FILE = sys.argv[1]  # 0 is script name


def usage(cmd):
    """ usage message """
    print("Usage: ", cmd, "  [-license] [-o output_file.csv] ")
    print("   -- generate Thunderbird Compliant CSV file with importable telephone numbers ")
    print("   -- from Apple Mail generated .vcf (vcard) file")
    print("   -- (C) 2018 by John F. McGowan, Ph.D.")
    print("   ")
    print("   -license -- print license terms")
    print(" ")
    print("In Mozilla Thunderbird 52.6.0, Tools | Import | Address Books | Text file(LDIF,csv,tab,txt) | choose output file from this program.")
    print(" ")
    print("Tested with Python 3.6.4 installed by/with Anaconda")

def license_terms():
    """ license terms """
    license_msg = """Copyright 2018 John F. McGowan, Ph.D.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    """
    print(license_msg)

if VCARD_FILE == "--help" or VCARD_FILE == "-h"\
   or VCARD_FILE == "-help" or VCARD_FILE == "-?":
    usage(sys.argv[0])
    sys.exit(0)

if VCARD_FILE == "--license" or VCARD_FILE == "-license":
    license_terms()
    sys.exit(0)

OUTPUT_FILENAME = 'tbird_imports.csv'
OUTPUT_FLAG = False
for arg_index, argval in enumerate(sys.argv):
    if OUTPUT_FLAG:
        OUTPUT_FILENAME = argval
        OUTPUT_FLAG = False
    if argval == "-o":
        OUTPUT_FLAG = True


# write import file with one dummy contact (John Nada from THEY LIVE)
OUTPUT_FILE = open(OUTPUT_FILENAME, 'w')
OUTPUT_FILE.write(TBIRD_ADR_BOOK_HEADER)
OUTPUT_FILE.write('\n')
OUTPUT_FILE.write(DUMMY_CONTACT)
OUTPUT_FILE.write('\n')

COMMA_DELIM = r"\,"

VCARD_COUNT = 0
b_processing = False  # processing a vcard

# check if input file exists
if os.path.isfile(VCARD_FILE):
    print("Reading vcard (vcf) file: ", VCARD_FILE)
else:
    print("Input vcard (vcf) file ", VCARD_FILE, " does not exist (missing)!")
    sys.exit(0)

input_file = open(VCARD_FILE)
for line in input_file:
    values = line.split(':')
    if values[0] == 'BEGIN':
        if len(values) > 1:
            if values[1] == 'VCARD\n':
                VCARD_COUNT = VCARD_COUNT + 1
                b_processing = True
                FIELD_VALUES = FIELD_VALUES_START.copy()

    if b_processing:
        tag = values[0]
        if tag == 'END':  # reached end of vcard
            if VERBOSE_FLAG:
                print("END OF VCARD ", VCARD_COUNT)
            b_processing = False
            # process non-dummy contact
            if FIELD_VALUES[FIELD_INDEX['Display Name']] != FIELD_VALUES_START[FIELD_INDEX['Display Name']]:
                contact_record = ','.join(FIELD_VALUES)
                if VERBOSE_FLAG:
                    print(contact_record)
                OUTPUT_FILE.write(contact_record)
                OUTPUT_FILE.write('\n')

        # parse info for the contact
        if tag == 'N':
            contact_name = values[1].strip().replace(';', ' ')
            if COMMA_DELIM in contact_name:
                contact_name = contact_name.split(COMMA_DELIM)[0]
            if isinstance(contact_name, str):
                name_parts = contact_name.split()
                if len(name_parts) > 1:
                    contact_first_name = name_parts[1]
                    contact_last_name = name_parts[0]
                else:
                    contact_first_name = ''
                    contact_last_name = ''
                FIELD_VALUES[FIELD_INDEX['First Name']] = contact_first_name
                FIELD_VALUES[FIELD_INDEX['Last Name']] = contact_last_name

        if tag == 'FN':  # FN (full name) is usually first_name last_name
            contact_fullname = values[1].strip().replace(';', ' ')
            if COMMA_DELIM in contact_fullname:
                contact_fullname = contact_fullname.split(COMMA_DELIM)[0]
            if isinstance(contact_fullname, str):
                FIELD_VALUES[FIELD_INDEX['Display Name']] = contact_fullname
                name_parts = contact_fullname.split()
                contact_first_name = name_parts[0]
                if len(name_parts) > 1:
                    contact_last_name = name_parts[1]
                else:
                    contact_last_name = ''
            else:
                contact_first_name = ''
                contact_last_name = ''
            FIELD_VALUES[FIELD_INDEX['First Name']] = contact_first_name
            FIELD_VALUES[FIELD_INDEX['Last Name']] = contact_last_name

            #print(contact_fullname)

        if tag == 'ORG':  # ORG (organization)
            contact_org = values[1].strip().replace(';', ' ')
            # Apple vcard uses semicolon as embedded delimiter
            FIELD_VALUES[FIELD_INDEX['Organization']] = contact_org

        if tag == 'NOTE': # NOTE (notes) in VCF
            contact_notes = values[1].strip().replace(r'\n', ' ')
            FIELD_VALUES[FIELD_INDEX['Notes']] = 'NOTE: ' + contact_notes

        if tag == 'TITLE':  # TITLE
            contact_title = values[1].strip()
            FIELD_VALUES[FIELD_INDEX['Job Title']] = 'TITLE: ' + contact_title

        if tag.startswith('EMAIL'):  #process emails
            contact_email = values[1].strip()
            FIELD_VALUES[FIELD_INDEX['Primary Email']] = contact_email

        if tag.startswith('TEL'):  # process phone numbers
            contact_phone = values[1].strip()
            # remove special characters and other noise
            contact_phone = re.sub('[^A-Za-z0-9() -]+', ' ', contact_phone)
            contact_phone = contact_phone.strip() # remove leading/trailing whitespace
            if not phone.is_valid_phone(contact_phone):
                print("WARNING: VCARD ", VCARD_COUNT, " (", contact_fullname, ") ", \
                      contact_phone, " MAY NOT BE A VALID PHONE NUMBER")
                
            if "HOME" in tag:
                FIELD_VALUES[FIELD_INDEX['Home Phone']] = contact_phone
            elif "WORK" in tag:
                FIELD_VALUES[FIELD_INDEX['Work Phone']] = contact_phone
            elif "MAIN" in tag:
                FIELD_VALUES[FIELD_INDEX['Work Phone']] = contact_phone
            elif "CELL" in tag:
                FIELD_VALUES[FIELD_INDEX['Mobile Number']] = contact_phone
            elif "OTHER" in tag:
                FIELD_VALUES[FIELD_INDEX['Custom 1']] = 'OTHER PHONE: ' + contact_phone
            else:
                FIELD_VALUES[FIELD_INDEX['Work Phone']] = contact_phone
                
        if tag.startswith('ADR'):  # physical addresses
            contact_address = values[1].strip().strip(';')
            contact_address = contact_address.replace(r'\n', ';')
            if "HOME" in tag:
                FIELD_VALUES[FIELD_INDEX['Home Address']] = contact_address
            elif "WORK" in tag:
                FIELD_VALUES[FIELD_INDEX['Work Address']] = contact_address
            elif "OTHER" in tag:
                FIELD_VALUES[FIELD_INDEX['Custom 2']] = 'OTHER ADDRESS: ' + contact_address
            else:
                FIELD_VALUES[FIELD_INDEX['Home Address']] = contact_address

        # just ^URL;....:url
        if tag.startswith('URL'):  # url
            contact_url = values[1].strip()
            index = FIELD_INDEX['Web Page 1']
            if not FIELD_VALUES[index]:
                FIELD_VALUES[index] = contact_url
            else:
                FIELD_VALUES[FIELD_INDEX['Web Page 2']] = contact_url

        if tag.startswith('item1.URL'):  # item1.URL...:https:remaining_url
            contact_url = ':'.join(values[1:])
            contact_url = contact_url.strip()
            if contact_url[:4] != 'http':
                contact_url = 'http://' + contact_url

            index = FIELD_INDEX['Web Page 1']
            if not FIELD_VALUES[index]:
                FIELD_VALUES[index] = contact_url
            else:
                FIELD_VALUES[FIELD_INDEX['Web Page 2']] = contact_url

        if tag.startswith('item2.URL'):  # item2.URL...:https:remaining_url
            contact_url = ':'.join(values[1:])
            contact_url = contact_url.strip()
            if contact_url[:4] != 'http':
                contact_url = 'http://' + contact_url

            index = FIELD_INDEX['Web Page 1']
            if not FIELD_VALUES[index]:
                FIELD_VALUES[index] = contact_url
            else:
                FIELD_VALUES[FIELD_INDEX['Web Page 2']] = contact_url

print("Processed ", VCARD_COUNT, " vcards")
OUTPUT_FILE.close()
print("Wrote Thunderbird Compliant CSV file with phone numbers to: ", OUTPUT_FILENAME)
print('ALL DONE')

convert_vcf_to_csv.py expects a module phone.py which contains code to check if a phone number is valid. The convert_vcf_to_csv.py script will print warning messages if it encounters a phone number that may be invalid although it still inserts the suspect phone number in the CSV file.

phone.py


'''
validate phone number module

(C) 2018 by John F. McGowan, Ph.D.

'''

import re

def is_valid_phone(phone_number):
    ''' determine if argument is a valid phone number '''
    result = re.match(r'\d?[ -]*(\d{3}|\(\d{3}\))?[ -]*\d{3}[- ]*\d{4}', phone_number)
    return bool(result != None)

 

Usage message

convert_vcf_to_csv.py --help
Usage:  convert_vcf_to_csv.py   [-license] [-o output_file.csv]
   -- generate Thunderbird Compliant CSV file with importable telephone numbers
   -- from Apple Mail generated .vcf (vcard) file
   -- (C) 2018 by John F. McGowan, Ph.D.

   -license -- print license terms

In Mozilla Thunderbird 52.6.0, Tools | Import | Address Books | Text file(LDIF,csv,tab,txt) | choose output file from this program.

Tested with Python 3.6.4 installed by/with Anaconda

By default, convert_vcf_to_csv.py writes an output file tbird_imports.csv which can be imported into the Thunderbird Address Book as follows:

(1) Bring up the Mozilla Thunderbird Address Book by clicking on the Address Book button in Thunderbird:

Address Book Button in Thunderbird
Address Book Button in Thunderbird

(2) Select Tools | Import

Import Menu Item in Thunderbird Address Book
Import Menu Item in Thunderbird Address Book

(3) This brings up an Import dialog.  Select the Address Books option in the Import dialog.

Select Address Books Item in Import Dialog
Select Address Books Item in Import Dialog

(4) Select Next button.  This brings up a File Type Selection Dialog.  Select Text File (LDIF, .tab, .csv, .txt)

Select Text File Type for Import
Select Text File Type for Import

(5) Select Next button.  This brings up the Select address book file dialog.  By default this displays and imports LDIF format address book.  Select comma separated values (CSV) instead:

Select address book file dialog box
Select address book file dialog box

(6) Now open the Thunderbird compliant CSV file, default name tbird_imports.csv:

Open tbird_imports CSV file
Open tbird_imports CSV file

(7) The new address book will now be imported into Mozilla Thunderbird complete with phone numbers.  The new address book will appear in the list of address books displayed but the individual contacts may not be displayed immediately.  Switch to another address book and back to see the new contacts or try searching for a new contact.

NOTE: Tested with Python 3.6.4 installed by Anaconda, Mozilla Thunderbird 52.6.0 on LG gram with Windows 10, and VCF contacts file exported from Apple Contacts Version 10.0 (1756.20) on a 13 inch Macbook Air (about 2014 vintage) running Mac OS X version 10.12.6 (macOS Sierra).

(C) 2018 by John F. McGowan, Ph.D.

About Me

John F. McGowan, Ph.D. solves problems using mathematics and mathematical software, including developing gesture recognition for touch devices, video compression and speech recognition technologies. He has extensive experience developing software in C, C++, MATLAB, Python, Visual Basic and many other programming languages. He has been a Visiting Scholar at HP Labs developing computer vision algorithms and software for mobile devices. He has worked as a contractor at NASA Ames Research Center involved in the research and development of image and video processing algorithms and technology. He has published articles on the origin and evolution of life, the exploration of Mars (anticipating the discovery of methane on Mars), and cheap access to space. He has a Ph.D. in physics from the University of Illinois at Urbana-Champaign and a B.S. in physics from the California Institute of Technology (Caltech).

How to Reduce Facebook Distractions

I find Facebook useful for keeping in touch with friends and family that I can’t see in person regularly.  I live in California and many of my relatives live on the East Coast of the United States.  Similarly my busy life makes keeping in touch with some friends and acquaintances even in California in person difficult.  However, Facebook became very distracting for me the last few years, primarily due to political posts during the 2016 Presidential election and even worse after Donald Trump won.  I found Facebook was contributing heavily to distractions and wasted time.

Here are the steps that I have taken to largely eliminate the Facebook distractions in my life:

  • Remove the Facebook and Facebook Messenger apps from my smartphone entirely; only check Facebook on my laptop and desktop computers.
  • Configure my Facebook account to only send absolutely essential email and other notifications.  No marketing or promotional notifications, no “someone liked this post” notifications, etc.
  • Install Matt Kruse’s Social Fixer add-on for Facebook and enable its’ built-in politics filter as well as add some custom filters for “Trump,” etc.  I’ll say more about Social Fixer below.
  • Use SelfControl on the Mac and ColdTurkey on Windows to block Facebook entirely during my work day as well as sometimes at home.

Social Fixer

I have been using Social Fixer for about three months with a dramatic reduction in mostly political distracting posts.  Social Fixer is a Javascript add on for Facebook available for both the Safari web browser on the Mac and the Firefox Web browser on a number of platforms.  It comes with a built-in politics filter as well as user customizable filters and many other features to enable fine control over what Facebook shows you.

Social Fixer Web Site
Social Fixer Web Site

The politics filter proved quite good although occasionally something will slip through.  This enables me to keep in touch with friends who are freaking out over Trump (for example) or other hot button topics without being inundated with a continuous stream of distracting political posts.

Social Fixer Add On for Firefox
Social Fixer Add On for Firefox

At least so far, I have found Social Fixer is a better option than unfollowing a friend on Facebook, where you lose all of their posts whether distracting (e.g. politics) or not.

Don’t Get Your News from Facebook

Facebook, YouTube and many other social media services appear to be using recently developed — we might say unproven, mostly untried — methods such as Deep Learning and Machine Learning to recommend, prioritize, and otherwise manage a wide range of posts, notably posts with political content.  As I discussed in my previous post on reducing YouTube distractions, what these methods appear to do frequently is promote posts that generate strong often irrational instinctive reactions such as our “fight or flight” response.  This often overrides our higher cognitive function which we need to use for most (not all) political issues.   If you really care about politics or humanity, as I do, you want to avoid this sort of content so that you can think calmly and rationally about important issues.

What Should You Do Instead?

IMHO

  • Set aside some time each day or week depending on your schedule when you are calm and collected to study current events and the issues dispassionately.
  • Avoid your “Ideological Echo Chamber.”  Identify a range of web sites or other sources that discuss the issues deeply and carefully from many points of view, not just your own.  If you are a conservative, you should be following at least a few liberal and left-wing sources.  If you are a liberal, you should be following at least a few conservative and right-wing sources.  You should also be following some “fringe” sources that don’t fit neatly into the traditional right-left paradigm.
  • Fact-check and check the context of quotes and “facts” on all sides.  A genuine fact can be highly misleading if other facts are omitted.  Search engines such as Google and other Internet services make this much easier than years ago, when access to a top-notch library was generally needed.
  • Remember that Wikipedia is not reliable on “controversial” subjects.  There are many examples of interest groups and activists capturing Wikipedia pages or bogging them down in flame wars.
  • Wherever possible use primary sources: read the actual memo, watch the unedited long form video, etc.  Wikipedia is not a primary source.
  • Consider finding or organizing a dedicated forum — online or real-world — to share your concerns with friends, neighbors, colleagues and others rather than broadcasting your concerns with posts on Facebook or other general purpose social media platforms.

Conclusion

In my experience, it is possible to largely eliminate the distractions from Facebook using these methods:

  • Remove the Facebook and Facebook Messenger apps from my smartphone entirely; only check Facebook on my laptop and desktop computers.
  • Configure my Facebook account to only send absolutely essential email and other notifications.  No marketing or promotional notifications, no “someone liked this post” notifications, etc.
  • Install Matt Kruse’s Social Fixer add-on for Facebook and enable its’ built-in politics filter as well as add some custom filters for “Trump,” etc.
  • Use SelfControl on the Mac and ColdTurkey on Windows to block Facebook entirely during my work day as well as sometimes at home.

(C) 2018 by John F. McGowan, Ph.D.

About the author

John F. McGowan, Ph.D. solves problems using mathematics and mathematical software, including developing gesture recognition for touch devices, video compression and speech recognition technologies. He has extensive experience developing software in C, C++, MATLAB, Python, Visual Basic and many other programming languages. He has been a Visiting Scholar at HP Labs developing computer vision algorithms and software for mobile devices. He has worked as a contractor at NASA Ames Research Center involved in the research and development of image and video processing algorithms and technology. He has published articles on the origin and evolution of life, the exploration of Mars (anticipating the discovery of methane on Mars), and cheap access to space. He has a Ph.D. in physics from the University of Illinois at Urbana-Champaign and a B.S. in physics from the California Institute of Technology (Caltech).

How To Reduce YouTube Distractions

YouTube PullDown Menu with Settings Menu Item

YouTube can be very distracting.  It is easy to spend many minutes, hours, even days watching videos of little or no value. If for example, you value your time only at the federal minimum wage in the United States — $7.25/hour — then ten hours of wasted YouTube watching in a week represents $72.50.  Many people who use YouTube, especially professionally, should value their time much higher than the minimum wage.  I usually value my time at $50/hour for business planning purposes.

Distracting YouTube videos are also often highly emotional and frequently negative; they generate anger, frustration, high blood pressure and other adverse consequences whose costs beyond the immediately wasted time are difficult to even evaluate.

YouTube is funded mostly by advertising and the distracting videos often have the purpose and sometimes the effect of getting us to buy something that we don’t need or that may even be harmful to us.

In this post I will discuss several ways to reduce time wasting distractions from YouTube, present some general observations and opinions on distractions caused by YouTube, and suggest some ways YouTube might improve the end user experience and even make more money by doing so.

Active Distractions

By active distractions, I mean distractions such as e-mail notifications and smartphone notifications that actively interrupt the user.  They buzz.  They beep.  They flash across the computer screen.  They appear as alarming red badges on icons.

Like most social media web services, YouTube by default enables many active e-mail, smartphone, and computer notifications.  Most of these can be turned off either in the YouTube account settings or the settings for the smartphone or computer.  Generally, all you really need to receive are any bills or receipts.

Passive Distractions

For me, a bigger problem with YouTube — and also other social media such as Facebook — has been passive distractions.  A passive distractions is typically something that appears in your field of view such as a thumbnail image and/or catchy emotive headline that stimulates a strong emotional response and often an urge to click on the image or link.  On YouTube this is typically one or more of the recommendations produced by YouTube.

YouTube appears to be collecting and storing a detailed personal history of everything you click on, watch, or do on YouTube.  Probably this is integrated with other information that Google is collecting about you.

I have used YouTube for many years and it seems to be getting much better in the last few years at finding “recommendations” that “push my buttons”  — get me to click and watch videos that often aren’t that useful but cause a strong emotional reaction.  This may be the consequence of new algorithms such as the Machine Learning and Deep Learning research that Google publicizes heavily.

Removing Distracting Recommendations from Your YouTube Home Page

At present (January 28, 2018), you can remove the recommendations from your default YouTube home page by clearing and pausing the search and watch histories in the YouTube Settings.

For me, removing the recommendations on the YouTube Home Page significantly reduces the passive distractions, although once I watch a video, YouTube will still push distracting recommendations on the individual video page — not the Home Page.  It will also occasionally recommend some YouTube channels on the Home Page which is markedly less distracting than the personalized video recommendations.

Upper Left Corner of My YouTube Home Page
Upper Left Corner of My YouTube Home Page

You can get to the YouTube Settings by clicking on the avatar icon/thumbnail in the upper right corner of your YouTube Home Page.

YouTube PullDown Menu with Settings Menu Item
YouTube PullDown Menu with Settings Menu Item

Clicking will bring up a pulldown menu with a Settings Menu Item.  Select the Settings menu item.  This brings up the Settings Overview page.  At the bottom of the Settings Overview page (as well as the other Settings pages) there is a History button.

My YouTube Settings Overview Page with History Button Circled
My YouTube Settings Overview Page with History Button Circled

Click on the History button to bring up the settings for the search and watch histories.

Clear and Pause Watch History Menu
Clear and Pause Watch History Menu

Use this menu to clear and pause both the search and the watch histories.  Once this is done (at least for me), the personalized video recommendations disappear from your YouTube Home Page.  Mostly you see your subscribed channels and occasionally YouTube will recommend an unsubscribed channel.  I usually click the X button to dismiss the recommended channel.

YouTube Pushing Unsubscribed Channel
YouTube Pushing Unsubscribed Channel

So far, this has greatly reduced the passive distractions for me from the YouTube Home Page and using YouTube.

It is pretty clear from the video recommendations that appear when watching a specific YouTube video (not the Home Page), that YouTube continues to retain watch and search history information despite the change in the settings.  I still see highly personalized recommendations which can sometimes be distracting.

Blocking YouTube Entirely

You can block YouTube, Facebook, and other distracting web sites or applications entirely by using software such as SelfControl, ColdTurkey, and other competing products.  These can be configured to block access to the web site or software application (such as a game) on your computer for certain periods of time such as during the work day (9 AM to 5PM for example).

One of the problems with blocking web sites is that YouTube has lectures, technical presentations, sales presentations, and other content that is genuinely useful at work.  Facebook, on the other hand, is usually entirely a personal activity and blocking it during work is not a problem for most people unless your work involves Facebook.

The Race to the Bottom of the Brain Stem

What YouTube specifically and many other social media services (Facebook, Twitter, etc.) appear to be doing, whether by design or somewhat unwittingly, is what former Google engineer Tristan Harris has labeled as “the race to the bottom of the brain stem.”  In practical terms, they are using “Big Data” and machine learning algorithms to identify highly emotional topics that “push our buttons,” that invoke primal impulses such as “fight or flight” that override our higher cognitive function.  That gets us to click and watch videos of little or no real value.

The primal impulses are nothing new.  They include such hot button topics as:

  • Sex
  • Violence
  • Interpersonal Conflict
  • Our personal and group sense of identity
  • Religion and spirituality

For example, if you are a heterosexual guy it is almost certain if YouTube pushes a thumbnail of a pretty scantily clad young woman, you will have an emotional response and be distracted regardless of your higher cognitive function — and often click and watch.  If you are a heterosexual woman, you probably will have the same reaction to a scantily clad athletic young man.  Music videos, a popular YouTube video category, in particular exploit this a lot.

In fact, much of the mock drama on YouTube seems to incorporate many of these hot button topics in a single video.  And people watch.

Many other social media sites are doing the same thing or something similar.  We even have a President who clearly practices this sort of emotional hot button pushing on Twitter, on cable and broadcast TV, and on YouTube.

Violence and interpersonal conflict in particular invoke the powerful and often short-sighted fight or flight response.

Waiting for greedy, short-sighted corporations or politicians to fix this emotional hot button pushing problem is unlikely to succeed.  Government action is also difficult to reconcile with the ideal of a free press.

People — customers, consumers — need to look out for themselves, reduce the distractions, and find effective ways to insulate themselves from the emotional hot button pushing.

Why Primal Impulses Override Our Higher Cognitive Function

Primal impulses override our higher cognitive function for good reasons.  The example that is often given is our ancestors thousands of years ago encountering a major predator such as a tiger or bear.  There is no time for higher cognitive function.  The fight or flight response kicks in and, in this case correctly, overrides and even shuts down our capacity for careful, time consuming analysis.

A more relevant modern example is handling a car accident or near car accident.  There just isn’t time to perform an in depth rational analysis of what is happening.  The driver needs to react immediately. In a serious car accident, hitting the brakes or turning sharply — a flight response — can be the difference between life and death.

The problem is that in the modern world we are often confronted with threats or emotional stimuli that don’t in fact require an immediate emotional response.  They often require careful thought. Nonetheless, the primal instincts can take over completely.  High intelligence, education is often not an adequate defense.  The response is fast and instinctive as it needs to be in a car accident.

YouTube, other social media services, and other new technologies are rapidly developing greater and greater ability to invoke these primal impulses, overriding the higher cognitive function of even highly intelligent, educated, experienced people.  An immediate consequence is high levels of distraction and wasted time.  More serious consequences could include stoking conflicts and starting a major war, even a nuclear war.

A Better YouTube?

YouTube is funded primarily by advertising which creates a strong perverse financial incentive for the emotional hot button pushing and the distraction.  The more advertising you watch, the more money they make.

A YouTube or YouTube competitor funded by short free sample videos and micro-payments for longer, more in depth content could avoid this perverse financial incentive and probably make more money.   By most accounts, YouTube is not profitable and seems to be struggling to find a viable business model.

My personal impression from using YouTube is that advertising on YouTube is mostly ineffective.  I go to YouTube for the content, either “how to” information or entertainment.  I don’t go to YouTube for the advertising and generally ignore it.  My educated guess is most YouTube viewers are the same although I am well past the main age demographic of YouTube viewers.

I would be willing to pay directly for some of the content, but typically not short few minute videos or low quality content.  I don’t like subscriptions since they often prove expensive and difficult to cancel.  My personal unscientific impression based on my personal experience is that free short or lower quality content and micropayments for longer in depth content would bring in more money than advertising.

YouTube uses free samples and micro-payments with movie trailers and one time rental or purchase payments for many movies, but it is clearly not their major source of revenues.  In my own experience, I will pay a few dollars to “rent” a movie from YouTube a few times per month.  I have never bought something based on a YouTube ad.

YouTube — and many social media services — would be better if the end users had fine grained control over the algorithms in their account settings.  There are add on products such as Social Fixer for Facebook that add this to some social media services.  Nanny software that enables parents to control or try to control what their children see on the Internet is a related product.

It would be better to be able to configure YouTube to block emotional hot button content except for a few hours per week when you have the time and are prepared to deal with emotional topics.

Conclusion

It is currently possible to reduce the passive distractions from personalized YouTube recommendations on your YouTube Home Page — in my experience a major source of the distractions — by clearing and pausing the watch and search histories in the YouTube Account settings.  It is also possible to completely block YouTube using blocking software such SelfControl, ColdTurkey, and many others.  I have had pretty good results with these methods.

More generally, it is increasingly important due to the rapidly improving distraction technology to insulate yourself from the emotional hot button pushing on YouTube and many other social media services.  It is an on-going battle.  YouTube could easily disable the method described in this blog post.

It is important and prudent to evaluate on a monthly or even weekly basis the distractions and emotional hot button pushing from current “technology” including social media services and smartphone operating systems.  The distraction technology is improving rapidly.

The distractions are costly in time and productivity and probably have other hidden or difficult to measure costs such as buying something you don’t need, voting for a politician or public policy that is harmful, or getting into an unnecessary conflict with colleagues, friends, or family.

 

(C) 2018 by John F. McGowan, Ph.D.

John F. McGowan, Ph.D. solves problems using mathematics and mathematical software, including developing gesture recognition for touch devices, video compression and speech recognition technologies. He has extensive experience developing software in C, C++, MATLAB, Python, Visual Basic and many other programming languages. He has been a Visiting Scholar at HP Labs developing computer vision algorithms and software for mobile devices. He has worked as a contractor at NASA Ames Research Center involved in the research and development of image and video processing algorithms and technology. He has published articles on the origin and evolution of life, the exploration of Mars (anticipating the discovery of methane on Mars), and cheap access to space. He has a Ph.D. in physics from the University of Illinois at Urbana-Champaign and a B.S. in physics from the California Institute of Technology (Caltech).

How to Reliably Retrieve Your Checked Luggage at the Baggage Carousel

One of the many stressful, error-prone inconveniences of modern air travel is identifying and correctly retrieving your checked luggage from among often hundreds of other remarkably similar looking bags.    Worst case, in a distracted hurry, you incorrectly take someone else’s luggage and never recover your own luggage!  🙁

The cause of this problem is that most luggage today looks quite similar.  Most bags are a dark gray or black color with rollers on one end and an extensible handle on the other end.  The printed tags provided by the airlines are remarkably similar, featuring unreadable bar codes and numbers.

Most tags with your name and address that you can buy at convenience stores or other locations are small and frequently gray or black as well, looking at a distance like every other tag on every other bag.

Consequently, it is frequently impossible to identify your luggage until it is right on top of you, about to go by on the carousel.  You may have to run after it or wait until it comes around again even if you can identify it.    This is often stressful and frustrating after a long trip, especially on top of other mishaps or delays.

While I have never ended up with someone else’s bags, it is easy to see how a distracted traveler could fail to check the tag and leave the airport with someone else’s luggage, worst case never recovering their own luggage.

Here is my solution:

Large Distinctive Luggage Tags (DIY)
Large Distinctive Luggage Tags (DIY)

Historically, travelers solved this problem by putting labels or stickers,  often provided by hotels or other travel related firms, on their luggage which was typically a hard surface.  Modern luggage like mine is often canvas or some other soft flexible material.  Stickers such as those now widely used to personalize laptops won’t stick properly to soft luggage.

However, one can use large cruise tags used for personalizing and tracking luggage on cruise ships (cruise tags are available through Amazon and other sources) to hold appropriately sized pieces of paper or cardboard with colorful distinctive stickers affixed to the paper or cardboard:

Closeup of DIY Luggage Tag
Closeup of DIY Luggage Tag

Here I used stickers derived from vintage luggage labels from the 1930’s and 1940’s.  Books of stickers are available from Amazon and many other sources.

A cruise tag is a transparent flat pouch that can hold an identifying tag of your choosing or design.  It is easy to cut a piece of paper or cardboard that fits within the pouch and mount stickers on the piece of paper or cardboard as shown.

Obviously, if you choose to follow my example, you should select your own stickers that reflect your personal identity and style, just as you would for a laptop.

Select a pattern of bright colors that is easily identifiable at a few dozen feet (roughly ten meters) — the typical size of a baggage carousel at an airport.  As the bag approaches it will be easy to confirm your identification as the sticker becomes fully readable and retrieve your bag easily before it rushes past you.

Finally, yes I successfully used this DIY (do-it-yourself) solution to the checked bag retrieval problem on my latest trip across the United States.  🙂

(C) 2017 John F. McGowan, Ph.D.

John F. McGowan, Ph.D. solves problems using mathematics and mathematical software, including developing gesture recognition for touch devices, video compression and speech recognition technologies. He has extensive experience developing software in C, C++, MATLAB, Python, Visual Basic and many other programming languages. He has been a Visiting Scholar at HP Labs developing computer vision algorithms and software for mobile devices. He has worked as a contractor at NASA Ames Research Center involved in the research and development of image and video processing algorithms and technology. He has published articles on the origin and evolution of life, the exploration of Mars (anticipating the discovery of methane on Mars), and cheap access to space. He has a Ph.D. in physics from the University of Illinois at Urbana-Champaign and a B.S. in physics from the California Institute of Technology (Caltech).

How to Turn Off or Hide the Distracting Red Notification Badges on the App Store Icon

A persistent source of distractions on the Macintosh (Mac OS X) and also the iPhone (IOS) is the annoying red notification badge on the App Store icon urging you to update your apps and sometimes operating system, sometimes with disastrous consequences.

App Store in Dock Urging Update to Mac OS High Sierra
App Store in Dock Urging Update to Mac OS High Sierra

It is, for example, generally a good practice to wait some time after an update is announced and pushed by a vendor until the almost inevitable bugs are worked out before actually updating.  This is particularly true of major operating system updates such as Apple’s macOS High Sierra update which featured a major security bug enabling anyone to trivially log on as an all-powerful root user, giving new meaning to the Apple “It Just Works” slogan.

In addition, the red notification badges are simply annoying and distracting, often interfering with the user’s ability to focus and concentrate on cognitively demanding work, presumably the main goal of using a computer.

Fortunately, there are some options to turn off or hide the distracting red notification badges.  On Mac OS X, in the System Preferences, there is a control for the App Store.  In this control, one can turn off automatic checking for updates:

System Preferences Menu Item in Apple Menu
System Preferences Menu Item in Apple Menu
App Sore Control in System Preferences
App Store Control in System Preferences (Third from Left on Third Row)
App Store System Preferences
App Store System Preferences

Note that by default automatic checking for updates is turned ON.

Unfortunately, this does not help if the App Store is already aware of an update.  In my case, App Store is aware of an update for the Xcode IDE (Interactive Development Environment for software) which says it includes the super-buggy macOS High Sierra update:

Unwanted Xcode Update with macOS High Sierra
Unwanted Xcode Update with macOS High Sierra

As mentioned, I would rather hold off until the bugs are worked out and I don’t want to be annoyed or distracted by the red notification badge.

By default, the App Store is included in the Dock.  However, one can remove the App Store and other apps from the Dock so that the annoying red badge is hidden unless you explicitly open the App Store.

Right Click on App Store Icon to See Options
Right Click on App Store Icon to See Options

Right click on the App Store icon in the Dock to see the options.  The App Store has an option “Keep In Dock.”  By default this option is checked.  Simple un-check the “Keep In Dock” option to remove the App Store from the Dock.  You must explicitly launch the App Store for it to appear on the dock and the App Store will leave the Dock when it is closed.

Tested on a MacBook Air (13 inch, early 2014) with macOS Sierra version 10.12.6

iPhone App Store

On the iPhone, one can turn off the red notification badges on the App Store icon by launching the iPhone Setting app:

iPhone Settings App
iPhone Settings App

In Settings, select Notifications:

Notifications in Settings App
Notifications in Settings App

Then, turn off notifications from the App Store:

App Store Notification ON/OFF Setting
App Store Notification ON/OFF Setting

Now, you will have to open the App Store to see if any updates are available.  The often annoying and distracting red notification badges will no longer display.

(C) 2017 by John F. McGowan, Ph.D.

About the Author

John F. McGowan, Ph.D. solves problems using mathematics and mathematical software, including developing gesture recognition for touch devices, video compression and speech recognition technologies. He has extensive experience developing software in C, C++, MATLAB, Python, Visual Basic and many other programming languages. He has been a Visiting Scholar at HP Labs developing computer vision algorithms and software for mobile devices. He has worked as a contractor at NASA Ames Research Center involved in the research and development of image and video processing algorithms and technology. He has published articles on the origin and evolution of life, the exploration of Mars (anticipating the discovery of methane on Mars), and cheap access to space. He has a Ph.D. in physics from the University of Illinois at Urbana-Champaign and a B.S. in physics from the California Institute of Technology (Caltech).

Google Can’t Legally Fire Workers for “Virtually Any Reason”

Silicon Beat, the tech blog of the (San Jose) Mercury News, recently published an article by Ethan Baron “Google’s fired engineer: James Damore’s claim against search giant revealed” which contained the following factually incorrect statement:

California law allows employers to fire workers for virtually any reason — and the Constitutional protection of free speech doesn’t apply to private company workplaces.

In fact, it is illegal under California law, which is broader than United States federal law, to fire workers for many reasons including political activities or affiliations.

In practice, under the “at will” doctrine of employment it is generally difficult to prove that someone has been fired for an illegal reason.  That is however different from saying it is legal to fire someone for virtually any reason.

It is, among other exceptions, illegal under federal law to fire a worker for various labor organizing activities and D’Amore appears to be making a case under these exceptions.

For those unfamiliar with the case, James D’Amore, then a Google engineer, wrote and distributed a detailed critique of Google’s gender diversity programs internally which was then leaked to the press causing a furor.   Google apparently specifically requested feedback from engineers who had attended its diversity training programs.  D’Amore was one such engineer.  He was fired shortly thereafter.

Google incidentally is being sued for gender discrimination and the US Department of Labor is reportedly investigating the company for discrimination against its female employees.

Again, in practice under the “at will” doctrine it is difficult to prove someone has been fired for protected labor organizing activities.   One can for example simply give a labor activist a poor performance review or even refuse to cite a reason.   See, for example, this recent article on firings by Tesla:  “Tesla employees detail how they were fired, claim dismissals were not performance related”  (CNBC, October 17, 2017)

Because D’Amore appears to have been fired specifically for distributing a political document dealing with working conditions and employment policies at his employer instead of for a pretext such as alleged poor performance, however transparent the pretext may be, he probably has an unusually strong case.  Standard Disclaimer: I am not an attorney. 

The moral here may be to be careful about asking for honest feedback from your employees.  They may give it to you.   🙂

(C) 2017 by John F. McGowan, Ph.D.

About

John F. McGowan, Ph.D. solves problems using mathematics and mathematical software, including developing gesture recognition for touch devices, video compression and speech recognition technologies. He has extensive experience developing software in C, C++, MATLAB, Python, Visual Basic and many other programming languages. He has been a Visiting Scholar at HP Labs developing computer vision algorithms and software for mobile devices. He has worked as a contractor at NASA Ames Research Center involved in the research and development of image and video processing algorithms and technology. He has published articles on the origin and evolution of life, the exploration of Mars (anticipating the discovery of methane on Mars), and cheap access to space. He has a Ph.D. in physics from the University of Illinois at Urbana-Champaign and a B.S. in physics from the California Institute of Technology (Caltech).

Another Labor Law Compliance Poster SCAM

We received another labor law compliance poster scam mailing this week.  This was an official looking mailing from Personnel Concepts with a somewhat similar style and typography to an IRS or similar mailing from the federal government.

Yes, federal law does require employers to post several labor law posters in easy of view of any employees.  However, these posters are available for free from the government!

Personnel Concepts Labor Law Compliance Poster Mailing

See this earlier post for more details on labor law poster compliance scams:  http://wordpress.jmcgowan.com/wp/corporate-compliance-services-labor-law-poster-scam/

(C) 2017 by John F. McGowan, Ph.D.