## Profanity in Book Titles

Powell’s Books emailed a list of self-care titles aimed at making readers happier and healthier and saner.

A surprisingly high (to me) percentage of the titles — 3 out of 25 (12 percent) — contain the word “fuck.” One title includes the word “shit” but it’s also one of the titles that uses “fuck” so I’m not going to double-count it.

Is this a new publishing industry strategy to reawaken people’s interest in reading? Personally I don’t care for it . . .

## Problem Statement

You work for a very large company that markets many different products. In some cases, one product you market competes with another. To help deal with this situation you have split the intended consumers into two groups, namely Adults and Teenagers. If your company markets 2 products that compete with each other, selling one to Adults and the other to Teenagers will help maximize profits. Given a list of the products that compete with each other, you are going to determine whether all can be marketed such that no pair of competing products are both sold to Teenagers or both sold to Adults. If such an arrangement is not feasible your method will return -1. Otherwise, it should return the number of possible ways of marketing all of the products.

The products will be given in a compete whose kth element describes product k. The kth element will be a single-space delimited list of integers. These integers will refer to the products that the kth product competes with. For example:

```compete = {"1 4",
"2",
"3",
"0",
""}
```

The example above shows product 0 competes with 1 and 4, product 1 competes with 2, product 2 competes with 3, and product 3 competes with 0. Note, competition is symmetric so product 1 competing with product 2 means product 2 competes with product 1 as well.

Ways to market:

1. 0 to Teenagers, 1 to Adults, 2 to Teenagers, 3 to Adults, and 4 to Adults
2. 0 to Adults, 1 to Teenagers, 2 to Adults, 3 to Teenagers, and 4 to Teenagers

## Definition

Class: `Marketing`

Method: `howMany`

Parameters: `String[]`

Returns: `long`

Method signature: `long howMany(String[] compete)`

## Constraints

• compete will contain between 1 and 30 elements, inclusive.
• Each element of compete will have between 0 and 50 characters, inclusive.
• Each element of compete will be a single space delimited sequence of integers such that:
• All of the integers are unique.
• Each integer contains no extra leading zeros.
• Each integer is between 0 and k-1 inclusive where k is the number of elements in compete.
• No element of compete contains leading or trailing whitespace.
• Element i of compete will not contain the value i.
• If i occurs in the jth element of competej will not occur in the ith element of compete.

## Examples

`{"1 4","2","3","0",""}Returns: 2The example from above `
`{"1","2","0"}Returns: -1Product 0 cannot be marketed with product 1 or 2. Product 1 cannot be marketed with product 2. There is no way to achieve a viable marketing scheme.`
`{"1","2","3","0","0 5","1"}Returns: 2`
`{"","","","","","","","","","", "","","","","","","","","","", "","","","","","","","","",""}Returns: 1073741824`
`{"1","2","3","0","5","6","4"}Returns: -1   `

Solution below . . .

## How to Win Friends and Influence People

Caveat: The book advises against saying things like “That’s the dumbest thing I’ve ever heard.”

So you can be an influential person with lots of friends but you’ll have to put up with a lot of nonsense . . .

## 2018: The Year in Books

These are the books I read in 2018, roughly in the order listed. The ratings are mine. They don’t represent a consensus of opinion.

Books of the Year: Middlemarch by George Eliot (fiction), Lincoln in the Bardo by George Sanders (contemporary fiction) and Factfulness: Ten Reasons We’re Wrong About the World–and Why Things Are Better Than You Think by Hans Rosling (non-fiction).

## How Our Careers Affect Our Children

Mothers spending time on themselves — on relaxation and self-care — and not so much on housework, was associated with positive outcomes for children. It’s not just a matter of mothers being at home versus at work, it’s what they do when they’re at home with their non-work time. If mothers were not with their children so they could take care of themselves, there was no ill effect on their children.  But to the extent that mothers were engaged in housework, children were more likely to be beset by behavior problems.

“How Our Careers Affect Our Children”, Harvard Business Review

We’re studying the effects of working mothers, mothers spending time on themselves, mothers engaged in housework . . . I wonder what is the effect of mothers actually spending time with their children?

## Competitive Programming: UVa 612 – DNA Sorting

One measure of “unsortedness” in a sequence is the number of pairs of entries that are out of order with respect to each other. For instance, in the letter sequence DAABEC, this measure is 5, since D is greater than four letters to its right and E is greater than one letter to its right. This measure is called the number of inversions in the sequence. The sequence AACEDGG has only one inversion (E and D) — it is nearly sorted — while the sequence ZWQM has 6 inversions (it is as unsorted as can be — exactly the reverse of sorted).

You are responsible for cataloging a sequence of DNA strings (sequences containing only the four letters A, C, G, and T). However, you want to catalog them, not in alphabetical order, but rather in order of “sortedness,” from “most sorted” to “least sorted.” All the strings are of the same length.

### Input

The first line of the input is an integer M, then a blank line followed by M datasets. There is a blank line between datasets.

The first line of each dataset contains two integers: a positive integer n (0 < n <= 50) giving the length of the strings; and a positive integer m (0 < m <= 100) giving the number of strings. These are followed by m lines, each containing a string of length n.

### Output

For each dataset, output the list of input strings, arranged from “most sorted” to “least sorted.” If two or more strings are equally sorted, list them in the same order they are in the input file.

Print a blank line between consecutive test cases.

Time limit: 3.000 seconds

### Sample Input

`110 6AACATGAAGGTTTTGGCCAATTTGGCCAAAGATCAGATTTCCCGGGGGGAATCGATGCAT`

### Sample Output

`CCCGGGGGGAAACATGAAGGGATCAGATTTATCGATGCATTTTTGGCCAATTTGGCCAAA`

Solution below . . .

## Student Loan Debt Sets Record

U.S. Student Loan Debt Sets Record, Doubling Since RecessionBloomberg

What happened to parents saving up to pay for college? Is that not a thing anymore?

I don’t find it morally defensible to encourage a kid to incorporate academics into his or her life from an early age, to emphasize the importance of education, then when the kid is admitted to college to say “Congratulations, here’s your student loan application. Have fun paying that off till you’re 60.”

## More Christmas Songs That Should Be Banned

A pair of hop-a-long boots and a pistol that shoots
Is the wish of Barney and Ben
Dolls that’ll talk and will go for a walk
Is the hope of Janice and Jen

— “It’s Beginning to Look a Lot Like Christmas”

Baby dolls for little girls and guns for little boys?! Continuing to segregate and advertise toys based on gender just works to perpetuate nasty sexist stereotypes, plus it severely limits the development of all young people.

Be sure to engage in a conversation about sexism with your friends and families over the holidays!

## Sailing to Byzantium

That is no country for old men. The young
In one another’s arms, birds in the trees
– Those dying generations – at their song,
The salmon?falls, the mackerel?crowded seas,
Fish, flesh, or fowl, commend all summer long
Whatever is begotten, born, and dies.
Caught in that sensual music all neglect
Monuments of unageing intellect.

An aged man is but a paltry thing,
A tattered coat upon a stick, unless
Soul clap its hands and sing, and louder sing
For every tatter in its mortal dress,
Nor is there singing school but studying
Monuments of its own magnificence;
And therefore I have sailed the seas and come
To the holy city of Byzantium.

O sages standing in God’s holy fire
As in the gold mosaic of a wall,
Come from the holy fire, perne in a gyre,
And be the singing?masters of my soul.
Consume my heart away; sick with desire
And fastened to a dying animal
It knows not what it is; and gather me
Into the artifice of eternity.

Once out of nature I shall never take
My bodily form from any natural thing,
But such a form as Grecian goldsmiths make
Of hammered gold and gold enamelling
To keep a drowsy Emperor awake;
Or set upon a golden bough to sing
To lords and ladies of Byzantium
Of what is past, or passing, or to come.

— William Butler Yeats, “Sailing to Byzantium”

## The Time for Song and Frivolity is Over!

A colleague went to see his son’s Christmas pageant, a day care thing where the kids try to sing “Jingle Bells.”

He says once his older daughter got to kindergarten, the school didn’t do singing Christmas shows anymore . . .

THIS IS KINDERGARTEN! THE TIME FOR SONG AND FRIVOLITY IS OVER! DO YOU HEAR YOUR PARENTS GOING AROUND SINGING ALL THE TIME? THAT’S WHAT GROWING UP IS ALL ABOUT! ALL JOYOUS ACTIVITIES ARE SURRENDERED OR STRIPPED AWAY FROM YOU!

## Activities That No One Does Anymore

I got an email today from a company wanting to introduce me to their faxing API (Application Programming Interface).

Faxing!? Will they also help me do other activities that no one does anymore, like playing the zither or baking my own bread?

## Are You Sure?

I was closing out of Remote Desktop Connection Manager and got the popup shown here.

Am I sure? To the extent that we can really be sure about anything, then yes I’m sure.

Why is the No option selected as the default? Is there an assumption that I’m flying by the seat of my pants, acting randomly and without certitude?

That I’m not a confident person? That I lack the courage of my convictions?

## Teaching Computer Science: What is a Computer Science Integration Specialist?

Sheena Vaidyanathan, a computer science integration specialist at Los Altos School District in California, says that states, school districts and boards of education have not prioritized computer science education the way they should. Even if not every child will grow up to work as a computer scientist, she thinks everyone should at least get exposure to how computers work.

A couple of things I don’t understand there . . . one is why everyone needs to know “how computers work.” They work on electricity, that’s about all I know about it.

Actually, I know a little more than that, but there’s no reason that everyone should know “how computers work,” any more than everyone should know how phones work, or how cars work, or how refrigerators work.

You can use things without knowing how they work.

I do think everyone can benefit from understanding how programmers think, which is based in part on knowing how computers work, but if you know that computers do exactly what you tell them to do — no more and no less — that’s about all you need to know.

The other thing I don’t understand is what is a “computer science integration specialist”? I had to look up a job description:

• Consult with each school leader or their designees to gather information about program needs, objectives, functions, features, and data metric requirements. Research need and create plans for computer science/technical personnel and other resources required for implementations for each school.
• Analyze, define, and document all relevant requirements for the teaching and learning of computer science, including but not limited to the impact on courses of study, streams of data and data capture, logical processes, computer lab or other learning environment requirements. Write and maintain specifications and document relevant workflows.
• Perform (department management approved) intervention(s) on the identified gaps by implementing existing or developing new appropriate interventions or programs to help create cultures or conditions of success in which computer science programs can flourish.

It goes on and on like that, but after reading the whole thing, I find myself no wiser as to how a person in this role is helping students learn computer science.

Money is available for this but not for hiring teachers with actual computer science education or experience?

Thus spoke The Programmer.

## Angelino Heights

The “Charmed” house:

Scheerer House, Queen Anne cottage:

Out of place amongst the Victorians:

Heim House:

Sessions House, 1889:

The gardener said the house was used in a DiCaprio movie but didn’t know which one (Pretty sure it wasn’t Titanic.):

The Michael Jackson “Thriller” house:

## Elvis Costello at the House of Blues

First time I’ve seen a concert at House of Blues in Anaheim. It’s a general admission standing room venue that holds I’d say around 1,500 people plus a seated balcony that you can get into for a premium price.

Pros and cons you can probably guess: You’ll have to stand for about 3 hours but once the show starts, you don’t really think about it. If the 64-year-old performer can stand for the whole show, so can I.

On the plus side, you can get quite close to the stage. Maybe not right in front unless you’re first in line to get in, but the sides of the stage you can get to easily.

Also, you get to see an A-list performer in a small room.

I don’t go to concerts in large venues anymore — Staples Center, Honda Center, the Forum, Rose Bowl, etc. I wouldn’t enjoy that.

I go to medium-sized venues, but even then, I prefer something unusual or unique like the Neil Young solo acoustic show at the Dolby Theater.

I’ve included the set list (to the best of my recollection) here as a Spotify playlist. Everything after “Everyday I Write the Book” was performed as an encore.

## Making it Easier for Women to Do Things They Don’t Want to Do

Apple launching tech camps for women in bid to diversify industry

Like other major tech companies, Apple has been trying to lessen its dependence on men in high-paying programming jobs.

I don’t think “dependence” is the right word there. Is that dependence like alcohol dependence, or like dependence on foreign oil?

It’s an oblique way of saying “we’re trying to employ fewer men,” but explicitly singling out members of a certain group for unwelcome attention sounds discriminatory and possibly illegal.

Women filled just 23 percent of Apple’s technology jobs in 2017, according to the company’s latest breakdown.

“Just” — why do we assume that working at Apple is a goal that a lot of women have? Maybe women found better jobs? Or something else they’d rather be doing?

Industry critics have accused the technology companies of discriminating against women through a male-dominated hierarchy that has ruled the industry for decades.

I’m more inclined to think that if women wanted to work in technology in greater numbers, they’d be doing so.

I’ve noticed recently that when President Trump says something, the media report it, but they’ve started following it up with a caveat along the lines of “He offered no evidence to support his claims.”

Now there’s a phrase you could use all day long! “Industry critics have accused technology companies of discriminating against women. They offered no evidence to support their claims.”

The fact that men outnumber women — or the other way around — in a profession is not evidence of discrimination. It may be evidence that women have more of a preference for “helping professions” — healthcare, social work, teaching, counseling, in all of which women significantly outnumber men — and men have more of a preference for technology.

It’s the simplest available explanation. That doesn’t mean it has to be right, but I think it is.

Thus spoke The Programmer.