Thoughts for the week’s end

Time has been operating on a different scale since March. It’s yesterday, it’s tomorrow, it’s hardly ever today. I’ve blinked and here’s September.

One week has become 12. This is the third “Thoughts for the week’s end” draft in my posts list. Let’s see if it gets published. I cheated and copied one of the blurbs from an earlier draft. I then deleted the rest. Gasp!

If you went back 10 years and told me that one day a simple CMD-Shift-n would restore an entire window of accidentally closed tabs in my browser…

I finished The Decadent Society this week months ago (book club!) and the main argument is that we haven’t really done anything Big since putting someone on the moon 40 years ago.

But I dunno…. restoring browser tabs? That’s a pretty big one.

The book itself was interesting and thought provoking. I did find myself shaking my head in disagreement more as it went on—I have a feeling he could expose himself to a wider variety of art to see that things have progressed since Star Wars, 60s rock, and the age of white male dominated fiction.

But! I appreciate some of the arguments and it sometimes does seem like progress has gotten stale. Maybe that’s how it works though. Stale until not.

If you want the book in a nutshell, the author wrote an opinion piece for the New York Times covering the concept.

More recently I finished a series of unrelated, yet very related books that I haven’t been able to stop thinking about since. I would recommend each:

  • The End of Policing explores alternatives to the ever-growing multitude of things that fit under the “police” umbrella.
  • I expected How to be Anti-racist to be excellent and it surpassed my expectations. I very much enjoyed Kendi’s narration of his work through things he thought he knew and things he learned along the way.
  • One Person, No Vote made me angry and helped to convince me that Secretary of State may be the most important office in US state elections. The rampancy of active voter suppression is stunning.

It’s probably me and my thousand tabs and not having restarted Firefox for a couple weeks, but Gutenberg gets really laggy when I’m several paragraphs into something. I just went through one of those 90s moments where I typed this entire sentence before it appeared on the screen in front of me. Hey, there it is!

No previous version of myself before the last several years would have understood how interested I am in hearing Miley’s new material. The vibe from Midnight Sky is so great. It put Edge of Seventeen (which it samples) in my head and I ended up listening to a half-dozen Fleetwood Mac and Stevie Nicks albums this week.

I finished The Fly Trap this morning, a very readable and pleasant memoir by a Swedish entomologist. I could read books like this endlessly. More scientists should publish this style of memoir. Bonus: I’m pretty sure I had a hoverfly swing by and hang out with me for the last few pages.

That’s that. Have to hit publish before I wait another week! 🚢

Publishing to WordPress with RStudio

Note: I have no idea what I'm talking about, but it's working, so here we go!

Update July 24, 2020: I changed the XMLRPC library to one that supports httr and added some additional notes at the bottom.

This is an R Markdown document I created using RStudio, an open source IDE for working with R.

One of our clients uses R Markdown as part of their workflow for creating and publishing rich reports with charts and data in HTML. For a while they've been working with the ever so available tools: copy and paste. This seems to work well for the most part, but the images generated as part of the document are included inline and the WordPress editor removes some of that image data during the process of saving after pasting. (I'm pretty sure this is something that used to work, but I haven't gone back and verified yet.)

Our client found a great blog post explaining how to post from R Markdown to WordPress and asked us if that was an option with their site. While I generally have a knee-jerk reaction to publishing with XML-RPC, I don't really have a reason why it shouldn't work. So I checked it out!

Here's the quick version:

  1. Download and install the R binary from one of the many CRAN mirrors.
  2. Download and install RStudio.
  3. Open RStudio.
  4. Create a new R Markdown file.

From what I can tell, there are three important panes in the RStudio window.

  • The file pane used to edit the R Markdown document.
  • The Console pane used to issue commands in R syntax to manipulate the document and its configuration.
  • The Help/Viewer pane on the right displays help information or a preview of the document upon request.

The file pane has an “Knit” menu that provides options for publishing the document to HTML, PDF, or a Word document. Additional configuration is required to “knit” to WordPress.

In the console, I typed these commands:

install.packages( "knitr" )
install.packages( "devtools" )

This installs the packages required to publish over XML-RPC with commands that WordPress understands.

The josephguillaume/XMLRPC package is a fork of the duncantl/XMLRPC package and uses httr instead of RCurl to make HTTP requests. I believe this is an improvement, though I'm not familiar with the differences.

Once those are setup, an XML-RPC configuration needs to be set. Note the lowercase P in each command.

options(WordpressURL = c(""))
options(WordpressLogin = c( "username" = "password" ))

One minor word of caution: when I find myself publishing via XML-RPC or anything else that requires a plaintext username and password, I add separate user account to my site with a lower set of capabilities and then manually adjust the author information once the post is properly published.

Now we're ready to publish. The RWordPress package provides the knit2wp command. If you type ?knit2wp in the console pane, information appears in the help pane explaining how to manipulate the command to create a new post, edit a post, and assign categories and tags.

To publish this post as a draft on my site, I used:

knit2wp('testpost.Rmd', title='Publishing to WordPress with RStudio', publish = FALSE )

After I published the first version and made some changes, I used the following to edit the post:

knit2wp('testpost.Rmd', title='Publishing to WordPress with RStudio', action=c("editPost"), postid = 13616, publish = FALSE )

And here we are. This is pretty cool!


Data URI Images and unfiltered HTML

Note that images generated through RStudio (maybe RMarkdown in general?) are added to content as Data URIs and will not be uploaded to the WordPress media library. This also poses an issue if the user publishing a content is not allowed to push unfiltered HTML. WordPress will strip that data URI as a security precaution when the post content is saved. On single site WordPress, you'll need to be at least an Editor. On multisite WordPress, you'll need to be super administrator.

Ongoing use

If you're familiar with R, this may be obvious, but it wasn't to me! When you start RStudio again after exiting, you can use the library() command to reload required packages:

options(WordpressURL = c(""))
options(WordpressLogin = c( "username" = "password" ))

I'm sure there's a way to maintain a persistent state, but I haven't looked. 🙂

Why R Markdown?

I'm done with the overview, but I'm including this section as an example. The framework for it was provided by RStudio when I first created the document.

From what I can tell, the cars variable is already provided as a dataset. When I type cars in the console pane, I get a list of numbers populating speed and distance columns. If I type summary(cars) in the console, I see the a version of the table listed below, which this markdown document says to embed:

##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

And I can plot that same data into a graph with plot(cars):

plot of chunk Cars plotted

How cool!

Thoughts for the week’s end

Last Friday’s NYT crossword hit me like a sack of bricks. Looking back, I only spent 12 minutes on it before bailing, but it felt like an eternity and I got nowhere.

That feeling bled into Saturday and I didn’t even open the puzzle, I just spent more time reading instead. I finally got back into the groove on Sunday, which has become reliably solvable as long as I set aside the time.

At some point before solving Sunday’s I decided I had had enough of Thursday, Friday, Saturday and would just do old Monday, Tuesday, Wednesday puzzles in their place. But here I am, back on a 7 day streak and everything seems possible again.

Also, going back to 10 year old Monday puzzles is not that easy! It’s like playing old editions of Trivial Pursuit and trying to remember various geopolitical changes over the last 30 years.

We watched the Aaron Paul episode of Open Door on Hulu last week mostly because I thought that I always have fun watching other people show off their houses. Either the vibe of the show was way off, or I just don’t really enjoy the flaunting of extreme wealth anymore. Anyhow, that’s not the point.

Toward the end of the episode—we fast-forwarded pretty heavily—there’s a brief shot of them loading some dishes into a dishwasher. It hit me that no matter how great your kitchen is or how rich and famous you are, the dishwasher is still a dishwasher.

Then a few days later, up pops a headline about how Halsey fractured her ankle while loading the dishwasher. See!

I saw the Zeros and they looked like me
This is the America that I want to be
Anarchy and Hollywood, the land of the free
I saw the Zeros and they looked like me

Alejandro Escovedo, Sonic USA

I listened to a lot more Escovedo this week after gushing so much last week. I went through his 2018 album, The Crossing, a few times and the lyrics in Sonic USA made me go hunting.

The Zeros were a punk band in the mid-late 70s fronted by Javier Escovedo, Alejandro’s younger brother. I enjoyed this LA Weekly piece from 1999 on the band as a guide to how heavy of an inspiration various music can have on people.

And we don’t take requests
We won’t shut up and sing
Tell the truth enough
You’ll find it rhymes with everything

Jason Isbell and the 400 Unit, Be Afraid

I listened to Reunions again this week and looked up the line above only to find out I had already done so back in February. This was funny to me because I looked up the lyrics to Elton John’s Levon last night after an exchange with Rich on Twitter only to find I had already done so back in January.

Lyrics, they’re great!

“I dislike Man City because it is Oasis’s club. Noel Gallagher is the most overrated songwriter in the whole history of pop music. They were perfect for the Brit press because they behaved badly and got all the attention. Blur were really great. That guy Damon Albarn is a real fuckin’ songwriter.”

Steve Earle, on being an Arsenal fan

I know maybe 2 people that will enjoy this quote. I love it. 😂

I agree with the Damon Albarn part; I’m not invested in Man City vs Arsenal; and while I might at one point have thought Oasis is a bit overrated, I’ve generally stopped carrying opinions like that around. I do like Steve Earle.

I’ve been grabbing more and more albums through Bandcamp and listening to them via the Sonos app rather than through Spotify. The quality is often noticeably better and playing music that you’ve paid an artist for just feels better. How strange to be back at this point after so many years of streaming!

My spam detection rate is still at 99.6% after almost 1000 spam comments. I think my next task for Self Sustaining Spam Stopper is to assume that anything caught with the honeypots is spam and can just be deleted.

The last week has been yet another heartbreaking week.

The murder of George Floyd over twenty dollars added fuel to a righteous anger in people all over the country and there are now protests in every major city and many small towns. Police, in what has become a standard approach in the US, have reacted with violence and made a sad situation worse.

In times like this I default to trying to read everything and find some sense of understanding. I’m not always sure of what to say. For the moment, it’s helping to find pieces written by others that align with how I feel. I need to sort out what active steps I can take next.

After reading through Jake’s recently updated post on using thermodynamics to explain why riots and stampedes occur—he uses the equation provided by Gibbs free energy, I’ve been thinking through how this applies to the protests in an age of militarized police forces.

My take: The military gear worn by police when responding increases the stress of a situation. The task as commanded of the police—wear this riot gear and contain the protest—reduces the amount of empathy they can afford to have for protestors. The change in energy is drastic. What would we expect other than chaos?

The Marshall Project is a “nonprofit news organization that seeks to create and sustain a sense of national urgency about the U.S. criminal justice system.” Their site has plenty of curated material on a variety of topics, including police abolition. I reached Matt Taibbi’s article from 2014, “The Police in America are Becoming Illegitimate”, through that page and I’ve started to think through what a future without policing could look like.

I also connected with Paul Butler’s opinion piece from Saturday in The Guardian, “Policing in the US is not about enforcing law. It’s about enforcing white supremacy”.

We can’t expect things to get better without making drastic changes. We can’t expect groups with systemic power to forfeit that power voluntarily.

Black lives matter. ❤️

Thoughts for the week’s end

And it stoned me to my soul
Stoned me just like Jelly Roll
And it stoned me
And it stoned me to my soul
Stoned me just like going home
And it stoned me

– Van Morrison, And it Stoned Me

A three week break that seemed like two. Sounds about right.

Hello from the other side.

The line “and it stoned me” popped into my head the other day while I was in the midst of hunting memories due to a random song that popped out of somewhere which is how it always happens.

I listened to Alejandro Escovedo’s A Man Under the Influence a few times this week for the first time in quite a while. It’s one of those albums I can still associate a specific time and feeling with. There are a handful of albums from the early 2000s that probably fit in that way. One thing that was nice about pre-internet-everywhere was cars with CD players and the same disc on repeat for weeks at a time. 🙂

Anyhow. The entire album is great and I have good memories of several tracks. The other night I was specifically thinking of seeing Escovedo perform Velvet Guitar at the Metro in Chicago as part of benefit show for Neon Street, which I believe is or was a teen homeless shelter. The First Waltz was modeled after The Band’s The Last Waltz and gathered a bunch of excellent performers together for a few years.

It was at these shows that I learned of Alejandro Escovedo and watching him perform stoned me.

I even told Michelle the other night that watching him play that one song—Velvet Guitar— had permanently altered my relationship with music.

But there’s a problem! I don’t know what to trust or believe!

He was one of the few musicians that played at all 3 benefit shows over the years and I saw each of these performances:

  • March 25, 1999: Pissed off at 2am
  • March 22, 2001: I Wanna Be Your Dog
  • March 23, 2002: Velvet Guitar

So. I know Velvet Guitar impacted me, and I stand by most of the memory. But does my brain now mix that performance with the earlier ones? There’s no way I wouldn’t have fallen in love with him after seeing I Wanna Be Your Dog so I’m guessing I was already at least a passive fan by 2002.

I’m going to accept the ambiguity and, unless otherwise corrected, continue to remember that it was the Velvet Guitar performance that did the most.

It’s amazing how indelible a memory seems until you start to source it.

I’ll leave it at something like: sourcing may change memories, but it gives them a little more dimension.

Example: I had completely forgotten that Steve Earle played the 2002 show!

And bonus: We saw Iggy Pop perform I Wanna Be Your Dog at the Vic only a couple months later in 2001.

My actually indelible memory from that show is being absolutely convinced my ear drums were going to explode. Thanks, Iggy.

While digging through Escovedo’s catalog on Spotify, I ended up on the No Depression: What it Sounds Like, Vol 1 comp album. I enjoyed the listen, so I searched for No Depression to see if they had other volumes or playlists. I then ran into their Spotify playlist of favorite tracks for the month. The first track this month is Chuck Mead’s I Ain’t Been Nowhere, a great re-purposing of I’ve Been Everywhere.

And from all of that I finally ended up on the No Depression website, saw they were a quarterly nonprofit roots music journal, enjoyed what I was looking at, and subscribed.

No Depression’s site also reminded me that the new Steve Earle album, Ghosts of West Virginia, was due this week. It’s such a great surprise to forget that something is coming and then relearn about it the day before.

I fired it up Friday morning and it was good!

Other things that have been on repeat lately: Fiona Apple’s Fetch the Bolt Cutters is really, really good and I very much enjoy Jason Isbell’s Reunions.

I’ve been tinkering with my own plugin to stop spam comments, named as well as I can name things, and spent a bit of time over the last many months trying to dial in a handful of word lists as a way to stop most of the spam without relying on an external service.

It’s a game of whack-a-mole, really. You identify a handful of words or patterns that seem to do the trick against a handful of comments just in time for a new bot with new patterns to slide on through and leave a bunch more. Repeat.

A couple weeks ago, after letting the spam pile up a bit, I determined that this strategy was boring and annoying and was about opposite the amount of effort I really want to put into spam detection.

Instead, I added a couple of hidden honeypot inputs: one contains a string that should not change; the other a value that is cleared by JavaScript 1.5 seconds after page load. If either of these appear incorrectly, or if neither appear, the comment is classified as spam.

At about 3 weeks, I’m at a 99.7% spam detection rate. Simple success!

While doing some light pandemic reading, I noticed the words “viral titer” for the first time. I went a googling and landed on titer’s Wikipedia page.

Titer is concentration. Viral titer is the concentration of virus required to infect cells. Titer is also the temperature at which a fat solidifies. The Wikipedia entry adds: “The higher the titer, the harder the fat”.

The phrasing made me laugh and I hope the cleverness of the phrasing was intentional.

Now that I’ve spent this much time thinking about titer, it better appear in a crossword.

I think I’ve learned that schedule is important for me if I want to write regularly. Skipping the Thursday night session the one week was a disruptor. We’ll see what happens next week!

It’s Memorial Day weekend in the US, so this late Saturday posting is more like a Friday posting, which technically means I hit my deadline by my rules.

May it get sunny for a few days and may everyone find music that alters them. 🎸🍻