Will Alexander

Sorry to call this to the attention of friends at a “poetry foundation” that is giving Will Alexander an award. Will Alexander is a purveyor of pseudo-intellectual surrealist word salad BULLSHIT.

https://www.poemhunter.com/poem/apprenticeship-2/

Unfortunately, the demise of poetry is going to be down this path. Go to college, learn to smoke pot and stick your finger in academic journals (philosophy, physiology, nuclear physics, gnostic theology, whatever) and grab any sort of exotic-sounding words you can and shake them up in a coffee can.

Buy postmodern theory journals and pretend that you know what they are saying. Ask people to worship your spittle when you read your word-salad “poems.”

What kinds of dupes give Will Alexander awards?

The only thing that Will Alexander seems really good at is PROMOTING himself in poetry circles and generating moronic self-promotional bios that people actually quote:

https://www.ndbooks.com/author/will-alexander

Advertisements

Caveat Acquia DevDesktop

Giant CAVEAT for Drupal Acquia DevDesktop users.

I was in a rush to shut down my laptop yesterday and DevDesktop wasn’t shutting down. So I killed it using the Windows Task Manager. Then when I tried to open it later, it was “missing an XML file.” Then it started up but was missing settings and would not start Apache and MySQL. Apparently, DevDesktop automatically saves its “dynamic.xml” settings file whenever it shuts down and I just happened to kill it when it was in the middle of that. Then when it starts but can’t find the file, it writes a NEW default XML file.

I noticed that settings were missing from the DevDesktop interface (like my name and email address, which are asked for when you install the program). That was clue #1.

I was lucky enough to have edited the “dynamic.xml” file on 12/4/17 (I bumped up the time allowed for startup) and saved a backup copy of it! Otherwise I would have been in deep trouble trying to figure out what the settings were that I needed to reset.

Even if you don’t plan on killing the application, make a backup of your initialization files! You won’t regret it when something happens.

Installing a Local Copy of your Pantheon Drupal 8 site with Acquia DevDesktop

I recently signed up for a Pantheon account. I figured it was time to try out the platform. Getting sites up and running in Drupal 8 and the latest WordPress was fairly easy, and connecting with SFTP and GIT was not that difficult. But I noticed that Pantheon recommends Kalabox for local development, and that requires extra software on Windows that I haven’t yet installed. Even more interesting . . . Pantheon reps at a WordCamp conference this past weekend informed me that Kalabox is shifting to a command-line tool called “Lando” that is Docker-based and Pantheon is going to be following that shift to Lando.

So, to fend off the growing requirements, I thought I would try to install the Pantheon GIT clone of the Drupal 8 installation and database SQL dump on Acquia DevDesktop, which I have been using for general local development.

The first attempt to install was a disaster. It generated a completely untelling error message: “Internal Server Error. The server encountered an internal error or misconfiguration and was unable to complete your request.”

There are a few preparatory steps you need to take that are outlined on the Pantheon site, and in this article by Michael Anello, “Getting a Drupal 8 Pantheon Site up and running locally on Acquia DevDesktop”:

https://www.drupaleasy.com/quicktips/getting-drupal-8-pantheon-site-up-running-locally-acquia-dev-desktop

There are three main issues that affect local installation.

First, local installations of Pantheon Drupal require the inclusion of a settings.local.php file that contains local settings of your Drupal installation that might otherwise conflict with the Pantheon server installation. The file is programmatically #include(d) in the
regular settings.php file and excluded from your GIT repository so that it is not uploaded when you push code to the server. You should see the following in the settings.php that is downloaded in your Drupal 8 code:

/**
* If there is a local settings file, then include it
*/
$local_settings = __DIR__ . “/settings.local.php”;
if (file_exists($local_settings)) {
include $local_settings;
}

See step 2 below for creating a settings.local.php file. There is a default example.settings.local.php file that you can copy in the Drupal download.

Remember that you do not want to push (upload) the settings.local.php file to the server. In order to ensure that, you need to add settings.local.php to your .gitignore file. If you use the example .gitignore file from https://github.com/pantheon-systems/drops-8 , you will already have an entry to ignore settings.local.php in the file:

# Pantheon commits a settings.php for environment-specific settings.
# Place local settings in settings.local.php
sites/*/settings.local.php

But if you decide to use your own .gitignore, you can either open the file and add the line “sites/*/settings.local.php” (no quotes), or if you are using GIT Bash shell (which I use), you can change directory to the top-level website code folder that has the .gitignore file and run the following command, to append the line to your .gitignore file:

$ echo ‘sites/*/settings.local.php’ >> .gitignore

Second, in Drupal 8, ‘hash_salt’ cannot be an empty string (Drupal 7 does not care). However, the server instance of Pantheon Drupal 8 apparently populates the variable dynamically (probably from a file that is outside the project directory) and does not include its salt value in the download.  In order to make Drupal 8 work locally, you have to add the following ‘hash_salt’ value to the bottom of the settings.local.php file that you create.

$settings[‘hash_salt’] = ‘whatever_you_want_to_use’; // cannot be an empty string

Try using http://drupalhashsalt.com to get a random salt string.

Third, if you are importing data from an .sql dump file, you will need to run the local site’s update.php script. In order to do that without an error, you need to add the following to the end of your settings.local.php file:

$settings[‘update_free_access’] = TRUE; // Reset to FALSE after updating, for security reasons.

There are a few steps missing from Anello’s list. Here’s a list with the additional steps:

  1. Clone your Pantheon Drupal 8 site code repository with GIT.
  2. Copy sites/example.settings.local.php to sites/default/settings.local.php (ensure this file is listed in .gitignore).  You can find an example local Drupal 8 .gitignore file here: https://github.com/pantheon-systems/drops-8
  3. Add the following to the bottom of sites/default/settings.local.php: $settings[‘hash_salt’] = ‘some_random_string’;  If you want to generate a salt string, try http://drupalhashsalt.com .
  4. In order to import your existing database, you will need to run update.php, which requires that you have ‘update_free_access’ set to TRUE:
    $settings[‘update_free_access’] = TRUE; reset it to FALSE after running update.
  5. Backup the site online and download the database backup and unzip it to an .sql file in your code directory.
  6. Import the site using Acquia DevDesktop, using the “import from database dump file” for the database.
  7. Run update.php from your local DevDesktop site URL, something like this: http://sitename.dd:8083/update.php

site_import

You should be able to access the site with your server user name and password, which are included in the database.

Javascript Character Count

I am trying to remember why I posted this.  I think that my friend Anna, who teaches JavaScript online, was working on a similar code topic and I decided to toss up a solution of my own.

/*
Count the number of specific characters in a string
Save as character_count.js and run:
$ node character_count.js
*/

characters = {};
var testString = “This is how I would have counted up the characters in a string. Of course, it doesn’t filter out the whitespace. And you can’t sort object keys directly.  And escaped characters give strange display results.”;
for (var i = 0; i < testString.length; i++) {
// if key exists increment count, if not, add key to object and initialize to 1
(testString.charAt(i) in characters)? characters[testString.charAt(i)]++ :
     characters[testString.charAt(i)] = 1;
}
// Get keys to sort alphabetically, and display character counts
Object.keys(characters).sort().forEach(function(key) {
     console.log(key  + ": " +  characters[key]);
});

Backing up Node projects on Windows

Does anyone else have this sort of NODE problem trying to back up projects to external drives? Node permits (encourages?) the godawful practice of recursive and redundant nesting of modules (dependency modules inside of modules inside of modules when a top-level instance of the dependency already even exists in the “node_modules” directory or in another module’s high level dependencies). I can’t imagine them fixing this sort of nightmare, since the technology is already “mature” . . . but they might want to look into fixing it some day. Just ONE “cannot create directory” error aborts a project copy.

Unable to create directory – E:\software\react\react-test-sites\peter1\node_modules\babel-preset-stage-0\node_modules\babel-preset-stage-1\node_modules\babel-preset-stage-2\node_modules\babel-plugin-transform-object-rest-spread\node_modules\babel-runtime\node_modules\core-js\fn\number\fn
141217 File(s) copied

Of course, the EASY way is just to remove all the Node dependencies and RERUN “npm install” on the “package.json” after you go grab your backup copy. BUT you don’t want to remove the “node_modules” directory from your actual project before backing it up. And that’s the rub.  And the same issue applies to node components installed with Bower that get installed in “bower_components” directories.

The answer seems to be to use the /exclude option of the xcopy command. I have never had to do that before.

c\software\react\:>xcopy /e /i /exclude:exclusion.txt “c:\software\react” “e:\software\react”

Then in the “exclusion.txt” (it can be named anything) in the current command line working directory, list the various things you want excluded, one per line:

\node_modules\ <– exclude all node files with this folder name in their paths
\bower_components\ <– exclude all bower files with this folder name in their paths
stupid_notes.txt <– exclude a file

Reference: http://stackoverflow.com/questions/12356646/xcopy-command-excluding-files-and-folders

TEST IT

Note: if you are backing up GIT projects, the command line needs the /h (copy hidden files/directories).

c:\software\save>xcopy /e /i /h /exclude:exclusion.txt “c:\software\angular\angular-seed” “e:\software\angular\angular-seed”

Proxy Server interference running Bower in Yeoman Ionic installation

Here’s some bizarre behavior. Installing “yo ionic” at the Santa Monica Library, I got Bower run errors because the library is using a proxy server that does not allow the default port that the git:// protocol uses. This was the same issue I was having running Git and Bower standalone. The difference is that Yeoman Ionic generator does a variety of build and installation tasks before launching Bower to install client javascript libraries.

The way I normally get around that is to set the local Git “config” file to use the https:// rather than the git:// protocol with the command

$ git config url."https://".insteadOf git://

You first want to create a “.git” folder with an empty “config” file in it to enable the command to write to it.

Unfortunately, the Yeoman “$ yo ionic” command refuses to accept a directory that is NOT EMPTY (i.e., has a “.git” folder in it) when it is installing Cordova plugins early in the Yeoman process.

Installing selected Cordova plugins, please wait.
{ [CordovaError: Current working directory is not a Cordova-based
project.]
name: 'CordovaError',
message: 'Current working directory is not a Cordova-based
project.' }
× Please run `yo ionic` in an empty directory, or in that of
an already existing cordova project.

So I created that /.git/config folder/file and then COPIED IT OVER AFTER Cordova installation and BEFORE “yo ionic” starts to run npm and bower to install dependencies. Since Bower comes after Npm, which takes a long time, there is time for the copy. That is completely mickey mouse. But the alternative is to set Git to use https:// globally using the –global flag in the above Git command. But some people don’t want to do that, although it should do no harm (you can “unset” the config).

You could also let the Yeoman generator fail its final Bower install stage and THEN create and set the /.git/config file and run Bower ($ bower install ) afterwards.

A fix for Bower failure because firewall blocks git:// protocol — error #128

I recently discovered that Bower was failing to install components of an Angular project because the public library wifi that I was using blocked the port that GIT uses to grab things using its git:// protocol. The following error occurs for the first attempted GITHUB download:

ECMDERR Failed to execute "git ls-remote --tags --heads git://github.com/jquery/jquery.git", exit code of #128 fatal: unable to connect to github.com: github.com[0: 192.30.252.128]: errno=No error

One way to fix that is to change to https://. But many people do not want to reconfigure their GIT profile and then have to change it back.

This should work for you if you do not want to alter your personal profile’s GIT configuration. It configures only your project directory.

If you are already working in a GIT configured project directory, you already have a “.git” folder and “config” file. If you have no “.git” folder and “config” file, create a “.git” folder with a “config” file in it.

--project (folder)
    --.git (subfolder)
        --config (file)

Run the following LOCAL GIT configuration command (do NOT use “–global” which will change your profile configuration) while in your project folder as the current working directory:

[project folder] $ git config url."http://".insteadOf git://

That should enter the following into your “.git/config” file:

[url "https://"]
    insteadOf = git://

You can also just type that into the “config” file. Those lines change the protocol from git:// to https://.

Place your already configured “bower.json” file in your project directory and run:

$ bower install

On the other hand, if you are creating a bower configuration file rather than using an already configured one, run

$ bower init

Answer the questions. That will create a bower.json file for you. Then run:

$ bower install thingamajig --save