content

Drupal 8: How to put a View or Block between the Content and Comments

I’m not going to discuss this code much, but in short, the source code below is for a Drupal 8 preprocess_node function that I use to set variables for (a) a custom view and (b) a custom block. I set the variables in this function, and then display them in my node.html.twig file like this:

{{ similar_by_terms }}

and this:

A way to migrate Drupal 6 Photo content type to Drupal 8

The main script in this project — MigrateAllD6Photos.php — now seems to be working. The code is ugly and doesn't check for SQL errors, but for my purposes it seems to be working okay. To get that script to work and migrate your Drupal 6 photo content type to a Drupal 8 photo content type, you also need to run a couple of queries shown here.

How to show an HTML string in an Android TextView

Filed under “What I learned about Android today,” you can display an HTML string in an Android TextView. However, this approach has severe limitations, and you’ll probably want to display your HTML in a WebView instead.

To display an HTML string in a TextView, you need to use the Android Html.fromHtml() method, as shown in this code:

Please help - Stack Overflow is copying my content

So what I learned tonight is that the Stack Overflow (SO) website has copied my content almost 800 times without linking back to my website once. This image shows the Google search results:

Google search results

Basic Android “Toast” syntax examples

Android Toast FAQ: How do I create a Toast message in Android? (Or, Can you share some Android Toast message syntax examples?)

Here's one example of the Android Toast syntax:

Toast.makeText(ProjectActivity.this, "Your message here" , Toast.LENGTH_SHORT).show();

and here's a second example, this time referring to the Android application context as the first method parameter:

Drupal CCK module - How to hide the Body field

Some times you just have to laugh at yourself ... I was just struggling to figure out how to hide the Body field on a new CCK form, and just as I was thinking I might have to resort to some jQuery magic, I finally read the help text under the Body field on the CCK "Submission Form Settings":

To omit the body field for this content type, remove any text and leave this field blank.

Drupal block/view tip - How to insert a block or view into your content area ($content)

Drupal block/view FAQ: How do I insert a Drupal block or Drupal view into my HTML content area ($content)?

There are several different approaches to this problem, depending on what you really want to achieve.

Insert a Drupal view into your HTML content

If you really want to include a Drupal view into your Drupal content, you can use the Insert View filter, as described on this Inserting Views page on drupal.org.

Would you pay for online content?

I was just reading the online version of the Chicago Tribune sports section this morning, and I wrote a friend that I'd probably be willing to pay a small amount to read the Trib online. I wouldn't pay very much ... maybe $1 or $2 a month ... but I grew up in Chicago, so it's nice to read deeper stories about Chicago sports than I can find without looking around harder.

The Chicago Tribune Sports section

Let Eclipse suggest variable names with control-space keystroke

I just learned that Eclipse can automatically create (or suggest) variable names for you. The suggestions are based on the class of the object you're about to create, and any characters you've typed for the variable name so far.

For example, if I'm in a method and I type Connection, followed by a space, then press the [Control][Space] keys, Eclipse adds a variable named connection, so my line changes to Connection connection.