Thoughts for the week’s end

It rained this morning! We woke up late, to good air, and enjoyed coffee on the deck for a couple hours with my parents.

All week I had these notes about how horrible being outdoors was. The things I wanted most were to be able to open a window, to step outside for more than a second, and to enjoy a few moments of quiet without the constant hum of air purifiers—as grateful as I am that we have them.

And here we are. I’ve been outside. The air purifiers are off or running on very low. The sun peeked out for a minute. It’s cloudy and cool and comfortable.

A new level of madness was spending a week indoors due to bad air—Friday through Friday—without even having a place to drive to for a break due to a pandemic.

We spent several nights doing laps in the house to music for 45 minutes to an hour just to get a walk in. Who are we!

Michael Kiwanuka‘s 2019 album, Kiwanuka, was a joy to listen to this week. 🙌🏻

Still picking through Orwell’s essays, one by one. This time on Kipling.

His outlook, allowing for the fact that after all he was an artist, was that of the salaried bureaucrat who despises the “box-wallah” and often lives a lifetime without realising that the “box-wallah” calls the tune.

George Orwell, Rudyard Kipling, Horizon, February 1942

The footnote attached to “box-wallah” reads:

Strictly, a peddler, but in the context applied derogatively to those working in commerce in India.

The term made me think: “what are the odds this is why Dishwalla is named Dishwalla”. Sure enough, Dishwalla’s drummer confirms that the band name comes from an old issue of Wired.

Turns out it’s the second ever issue of Wired with this article.

Lajpat-Rai is a crucial link in this vast republic’s exploding market for satellite television – and a central supply port for a new generation of opportunistic entrepreneurs called “dish- wallahs”; wallah being a common Hindi phrase which translates to something between “hack” and “specialist.”

Dish-Wallahs“, Wired, April 1993

I have spent way too much time thinking about Dishwalla over the last month.

From the other room just now: “do you want to touch raw beef tongue?” 😂

Of course I did. Tacos tonight!

I’m about half-way in to Rage, Bob Woodward’s new book. The most striking part so far is how un-striking it all is when compared with how I felt while reading Fear just two years ago.

Dan Coats, former director of national intelligence, appears quite a bit at the beginning, which made his op-ed on the election slightly more interesting this week for some reason.

Rest in peace, Ruth Bader Ginsburg. May all current and future jurists—I mean, everyone really—be inspired by your life and your work.

My Own Words is now on my short-term reading list. I’m looking forward to being inspired rather than enraged.

60 some hours until fall!

Time for a whiskey. 🥃

Thoughts for the week’s end

Heyo 41.

I might be excited because I might buy myself a guitar today at our local music shop. I might also not be excited because I might postpone the visit yet again due to… pandemic!

I’m fairly certain they’ve done good a good job through everything—at some point I saw a notice that only one customer is allowed in the store at a time. But I still classify this as highly risky on my list of things Jeremy has done in the last 6 months.

Ooph, time goes.

So I’m browsing various models ahead of time, hoping to pop in and pop out. It will be a little weird to not sit and get to know the guitar for a bit, but also… pandemic!

One of the weirder decisions I made 9 years ago was to sell my guitars and amps and pedals and oh, it’s sad if I think too much about it. But stuff is stuff; the hobby went away for a bit and now it wants to come back.

I’m probably looking at a Telecaster this time around because I’ve always been curious of the sound. And if the hobby sticks, I can start poking at rejoining the Gibson family. 🎸

I caught up on a bunch of magazine reading last weekend and found James Meek’s history of the World Health Organization—accompanied by the history of the current SARS-Cov-2 outbreak—to be a very interesting read. It’s from early July, but still timely.

One thing the writer tries to clarify is the difference between communal health and “tech fixes”: (emphasis mine)

The divide between communal health advocates and tech fixers represents a deeper choice: between actions that aim to help an individual, so may indirectly help everyone, and actions that aim to help everyone, so may indirectly help the individual. Lockdown requires each individual to accept personal constraints for the sake of the community, even when they are not themselves ill. In theory, the tech fix can be for everyone, too, but because it is a thing to be obtained, rather than a constraint to abide by, it comes trailing issues of priority, price, privilege, exclusivity: what device, what pill, what treatment, what test can I get for myself, my family, my friends, to protect them?

James Meek, The Health Transformation Army, London Review of Books

I don’t know how I came across an old post of mine with a picture of a Pixies show taken on a (likely Nokia) camera phone circa 2004, but I did so now it’s here.

At some point these photos are going to classify as abstract.

What is the minimum number of people required on a video call before an Irish exit makes sense?

I’m thinking once you hit 10 it might be fair game.

Donating to politicians in other states seems like it should be wrong—if for nothing else because the amount of money involved in politics is wrong, but it also seems like the hate spread by existing politicians is worse, so here we are donating to politicians in other states.

You need a holiday, somewhere in the sun
With all the people who are waiting
There never seems to be one

Every once and a while the very beginning of Blur’s Advert pops into my head and I repeat it randomly throughout the day. It’s a sample used once that simply says: “food processors are great”. A keyboard starts looping, the bass comes in, and then the catchy guitar riff hits and it becomes a rock song. It has all the makings of a great track and I love it.

So I’ll be standing in the kitchen making coffee or lunch or anything and just start repeating out loud: “food processors are great”. Michelle asked me where it was from this week and of course I took the opportunity to play it.

This time I honed in on the chorus posted above and a song about advertising is now working in different ways as an anthem for our COVID summer.

A holiday, somewhere in the sun, would be fantastic indeed.

And of course I then made Thursday and Friday Blur listening days. It’s been a while since I went through the catalogue.

I can’t really pick a favorite. Leisure and 13 are the least likely, even though Tender, the first track on 13, is one of my favorite songs ever made and I thought I remembered the album being amazing.

Modern Life Is Rubbish, Parklife, The Great Escape, and Blur all have their moments where I’m like: oh right, this is my favorite album. Even as I’m writing this I have Modern Life Is Rubbish playing again and my brain is trying really hard to convince me to pick it.

And then Think Tank, which I don’t remember appreciating as much at the time, but I very much enjoy now. And the reunion album, The Magic Whip, turned out to be very excellent.

Anyhow. One day I’ll sit down and do a proper write-up of the best parts.

Stay well! May we see 46 before I see 42. 🎂

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!