url

A Scala “Word of the day” shell script

I have a 19" monitor on the counter between my kitchen and living room, and it’s powered by a Raspberry Pi. I use the Linux Phosphor screen saver to show a scrolling “news and stock ticker” on the display, which I’ve programmed to show news from several different sources (Atom and Rss feeds, along with other news and data sources). An old version of the display looks like this:

My Raspberry Pi news ticker display

Today I added a new “Word of the day” feature to the display, and as with all of the other code, I wrote a Scala shell script to generate the output.

The keytool password for the Java security cacerts file is ...

In case you ever need to manually a certificate to your ${JAVA_HOME}/jre/lib/security/cacerts file, it turns out the password for that file when using the Java keytool command is changeit.

To add a certificate to that file, you’ll want to use a command like this:

keytool \
    -import \
    -alias "foobar.com" \
    -keystore ${JAVA_HOME}/jre/lib/security/cacerts \
    -file foobar.com.crt

I had to do this today for a Java/Scala script that accesses an HTTPS URL, and the site I’m accessing uses a “Let’s Encrypt” certificate.

How to get the URI of the current node in a Drupal 8 Twig template theme file

As a quick note, I was just able to get the URI of the current page (node) in a Drupal 8 Twig template theme file using this code:

{% set uri = path('entity.node.canonical', {'node': node.id}) %}

As an example, I’m rendering some different content based on the URI of the current node, so I first use that code to set the uri field, then I have a little Twig if/then/else condition like this:

{% if uri starts with '/foo' %}
    <div>Option Foo here ...</div>
{% elseif uri starts with '/bar' %}
    <div>Option Bar here ...</div>
{% else %}
    <div>Option Baz here ...</div>
{% endif %}

In summary, if you wanted to see how to get the URI of the current page/node when using a Drupal 8 Twig theme template file, I hope this example is helpful.

Source code for an Android AsyncTask (REST client) example

I just got back into using an Android AsyncTask, and it took me a little while to re-load the concepts in my head. I used AsyncTask’s a few years ago, but haven’t used them since.

To help remember how they work, I created a little AsyncTask example project, and I’ve included all of the source code for that project here. I’ll show all of the source code for my classes and configuration files, and then explain the code at the end.

How to use `curl` to get headers from a URL

Curl FAQ: How do I use curl to get the headers from a website URL?

Short answer: Use curl's -I option, like this:

$ curl -I URL

Here's a specific example, including a real URL and results:

Ad Free Yahoo Mail - receipt/bill/invoice information, URL

If you are an Ad Free Yahoo Mail customer and didn’t get a receipt for your bill, and you need to find information about that bill — an invoice, receipt, anything related to the payment — as of mid-2016 you can find your Yahoo payment information by starting at this URL: https://payments.mail.yahoo.com

It took me a long time to find that URL today, so I thought I’d share it here. (I could not find any way to see my Yahoo payments through their web mail interface, or any “settings” or “account” links.)

How to show an HTML WebView in an Android AlertDialog alvin January 3, 2016 - 2:55pm

If you want to show a WebView component in an Android AlertDialog, the following method shows how to do it:

A custom JavaFX web browser (to show stock quotes)

I’m currently doing something completely different, and writing a little custom web browser using JavaFX and its WebView component. I’m using it so I can easily look at stock quotes and charts. I just started on it, and the current UI looks like this:

A custom JavaFX WebView web browser