Hey, Mom! The Explanation.

Here's the permanent dedicated link to my first Hey, Mom! post and the explanation of the feature it contains.

Sunday, May 20, 2018

Hey, Mom! Talking to My Mother #1049 - May 2018 - Original Material and Updates

at Barista, Alberta St, Portland 1805.19
Hey, Mom! Talking to My Mother #1049 - May 2018 - Original Material and Updates

H Mom,

Yesterday, I spent some time in Portland with my lovely wife who had an appointment at her salon.

We ate at the RADIO ROOM, which I have been wanting to try.

I had a fantastic burger with pork belly and a "Radio Mary." We tried the house special pickle platter, featuring pickles and pickled vegetables with a mustard dip. It was all right, but we had hoped for something a bit more special.

We sat on the lower patio, corner booth in the picture below, which is in the middle of the photo.

I love these outings to Portland with Liesel. While she's in the salon, I go to Barista (see photo up top) and have an iced latte and do some work. Yesterday's Kotlin post was made at Barista. Good Internet, and one of the other patrons and I shared supervision of gear for bathroom breaks.

Also, in the photo above, I am listening to the Cubs game, which went to extra innings before the Cubs lost in the 11th.

I like this picture of me. Rockin' the 1987 Dungeons and Dragons shirt. Yellow. I tend to wear yellow a lot in the spring.

Hi.... so I just came back to my computer, and the image above was shown on the screen saver. I have seen this image a couple of times in the last few days, so it seemed like a sign. This is my all-time favorite story buy Adrian Tomine who does the comic Optic Nerve. This story was originally published in mini-comic form. I would like to get scans of the entire thing as I would post it. A lot of my things are packed away, still, or still in Michigan, though I am pretty sure I have a copy of this story in one of his books, which are here and shelved. I forget the name of the story, but it's short, just a few pages, maybe six. I believe this is the last page. Tomine conveys some much without any exposition or dialogue. The regret of the woman for sleeping with this man is very evident. If I remember the story, it's a relationship that's lingering. Maybe she breaks up with him and sleeps with him one last time. But these panels make us wonder what she will do next. It think it's a beautiful sequence.

I promised some original content today. I am a day behind finishing this one off as it is now Monday. I have promised myself about fifteen minutes of writing before I do some work. I will probably finish this one in a bit of back and forth today: work some, write this entry some, and so on.

I am not feeling especially verbose, so this one may end up short.

I finished Who Killed Sherlock Holmes? and have moved on to vN by Madeline Ashby as pictured here.

Here's the Amazon synopsis: "Amy Peterson is a self-replicating humanoid robot known as a VonNeumann.

For the past five years, she has been grown slowly as part of a mixed organic/synthetic family. She knows very little about her android mother's past, so when her grandmother arrives and attacks her mother, Amy wastes no time: she eats her alive. 

Now she carries her malfunctioning granny as a partition on her memory drive, and she's learning impossible things about her clade's history - like the fact that she alone can kill humans without failsafing... File Under: Science Fiction [Von Neumann Sisters | Fail Safe Fail | The Squid & the Swarm | Robot Nation]"

I like it a lot so far. The opening chapter was published as a short story and had made a copy of it but didn't get to reading it. Madeline Ashby hit my radar when I read Company Town recently, which is a strongly-plotted, character driven, speed thrust of a novel. I loved it. I read Company Town traditionally, with my eyes only, but I am listening to the audio book for vN.

Who Killed Sherlock Holmes? -- my previous audio -- was a project as it's the third book in the Shadow Police series by Paul Cornell. After some reading online, I learned that universally it was recommended that new readers ingest the previous two books -- London Falling and The Severed Streets -- before reading the third. The books are all well written and have intriguing elements, but I found the audio book to be slow at times, especially a long section in the middle of the second book. Still, I would recommend them all to anyone with a taste for police procedurals and the supernatural.

For my new traditional read (by which I mean non-audio), I am deep into Nick Harkaway's Gnomon, which came  highly recommended by Warren Ellis.  I engaged in this read after finishing Rachel Armstrong's Origamy, also recommended by Ellis, though not as enjoyable, and my friend Helene Dunbar's new book Bommerang, which was very enjoyable, an engaging, powerful, reasonably quick read.

Here's the Amazon synopsis for Gnomon "A Best Science Fiction Book of 2017 -- The Guardian
From the widely acclaimed author of The Gone-Away World and Tigerman, comes a virtuosic new novel set in a near-future, high-tech surveillance state, that is equal parts dark comedy, gripping detective story, and mind-bending philosophical puzzle.

In the world of Gnomon, citizens are constantly observed and democracy has reached a pinnacle of 'transparency.' Every action is seen, every word is recorded, and the System has access to its citizens' thoughts and memories--all in the name of providing the safest society in history.

When suspected dissident Diana Hunter dies in government custody, it marks the first time a citizen has been killed during an interrogation. The System doesn't make mistakes, but something isn't right about the circumstances surrounding Hunter's death. Mielikki Neith, a trusted state inspector and a true believer in the System, is assigned to find out what went wrong. Immersing herself in neural recordings of the interrogation, what she finds isn't Hunter but rather a panorama of characters within Hunter's psyche: a lovelorn financier in Athens who has a mystical experience with a shark; a brilliant alchemist in ancient Carthage confronting the unexpected outcome of her invention; an expat Ethiopian painter in London designing a controversial new video game, and a sociopathic disembodied intelligence from the distant future.

Embedded in the memories of these impossible lives lies a code which Neith must decipher to find out what Hunter is hiding. In the static between these stories, Neith begins to catch glimpses of the real Diana Hunter--and, alarmingly, of herself. The staggering consequences of what she finds will reverberate throughout the world.

A dazzling, panoramic achievement, and Nick Harkaway's most brilliant work to date, Gnomon is peerless and profound, captivating and irreverent, as it pierces through strata of reality and consciousness, and illuminates how to set a mind free. It is a truly accomplished novel from a mind possessing a matchless wit infused with a deep humanity.

I can't do much better than this description. I have hit the alchemist part, which I much prefer to the shark-obsessed Greek business man, though that was okay. It's an enjoyable novel with a great deal of amazingly well-crafted writing on a sentence level. I am not blown away or gripped securely in its maw, but I am not bored either.

WHAT ELSE........

I played Ultimate today at Vancouver pick up for the second time.

Wisely, I stretched my groin a lot before and a little after and I am much less sore. I was wrecked for three days the last time. This time I just a little sore. I need more working out  and playing, though. It's time to get my bike re-assembled and back in service. This week promises to be dry and very warm. I need to find some good bike trails for longer rides, too.

Though I am writing from the next day, Monday, not only can assure you, Mom, that I am not too bad after my day of Ultimate, but that I am going to take dogs for a walk at this cool park in Longview. They did not get a walk yesterday. Also, I foolishly took Ibuprofen PM with a sleep aid prior to playing Ultimate, which really knocked me out as Liesel and I tried to watch a movie from 7-9 p.m.

I finished my grading and did not do much back and forth, practicing task switching. I am still having trouble with task switching.

I could provide more updates, but this feels like a good sized post and it's time to walk the dogs.

See? I do original content sometime... :-)


Reflect and connect.

Have someone give you a kiss, and tell you that I love you.

I miss you so very much, Mom.

Talk to you tomorrow, Mom.


- Days ago = 1051 days ago

- Bloggery committed by chris tower - 1805.20 - 10:10

NEW (written 1708.27) NOTE on time: I am now in the same time zone as Google! So, when I post at 10:10 a.m. PDT to coincide with the time of your death, Mom, I am now actually posting late, so it's really 1:10 p.m. EDT. But I will continue to use the time stamp of 10:10 a.m. to remember the time of your death, Mom. I know this only matters to me, and to you, Mom.

Saturday, May 19, 2018

Hey, Mom! Talking to My Mother #1048 - KOTLIN - You should learn Kotlin, totally

Hey, Mom! Talking to My Mother #1048 - KOTLIN - You should learn Kotlin, totally

Hi Mom,

So I managed to catch up. Whew! My Facebook friends are probably annoyed with the flood of posts today, but it can't be helped (unless I want to skip pushing my stuff to social media). This one will hit LINKED IN, also.

As you know, I am in a self-study mode learning programming languages and computer science concepts. Sometimes I feel like I have a handle on the big things -- encapsulation, polymorphism, lambdas, regex, iteration, recursion, etc. -- and then other times I feel like I don't really know nearly enough.

One of my recent projects has been to learn Kotlin as I may use it to build an Android app.

I am also posting on Kotlin because I foolishly agreed to do a presentation on it May 30th at the next Code and Learn in Vancouver.

I had posted on Kotlin before, here:


Some longtime developers are burned out on new languages, especially ones that claim to be the next hot ticket and intended to replace long time serviceable mammoth languages like Java.

But I am a new developer, and I am excited about Kotlin. It's cleaner than Java and has solved many of the headaches Java users must contend with, like the null pointer exception that is not supposed to exist in Java because there are no pointers but does exist because Java is written in C.

So, expect a lot of Kotlin posts as I ramp up for the presentation.

Here's the first. This one may form the basis of my presentation.

I also have code that I want to share with the Code and Learn crew just because there's a value I can't track, but the code is not listed here. That may be my next post.

From -


Why you should totally switch to Kotlin

It’s time to start using a modern programming language

I want to tell you about a new programming language called Kotlin and why you should consider it for your next project. I used to prefer Java but the last year I’ve found myself coding Kotlin whenever I could, and at this point I really can’t think of a situation where Java would be a better choice.
It’s developed by JetBrains, and the fact that these are the people behind a suite of IDEs, such as IntelliJ and ReSharper, really shines through in Kotlin. It’s pragmatic and concise, and makes coding a satisfying and efficient experience.
Although Kotlin compiles to both JavaScript and soon machine code, I’ll focus on its prime environment, the JVM.

So here’s a couple of reasons why you should totally switch to Kotlin (in no particular order):

0# Java Interoperability

Kotlin is 100% interoperable with Java. You can literally continue work on your old Java projects using Kotlin. All your favorite Java frameworks are still available, and whatever framework you’ll write in Kotlin is easily adopted by your stubborn Java loving friend.

1# Familiar Syntax

Kotlin isn’t some weird language born in academia. Its syntax is familiar to any programmer coming from the OOP domain, and can be more or less understood from the get go. There are of course some differences from Java such as the reworked constructors or the val var variable declarations. The snippet below presents most of the basics:
class Foo {

    val b: String = "b"     // val means unmodifiable
    var i: Int = 0          // var means modifiable

    fun hello() {
        val str = "Hello"
        print("$str World")

    fun sum(x: Int, y: Int): Int {
        return x + y

    fun maxOf(a: Float, b: Float) = if (a > b) a else b


2# String Interpolation

It’s as if a smarter and more readable version of Java’s String.format() was built into the language:
val x = 4
val y = 7
print("sum of $x and $y is ${x + y}")  // sum of 4 and 7 is 11

3# Type Inference

Kotlin will infer your types wherever you feel it will improve readability:
val a = "abc"                         // type inferred to String
val b = 4                             // type inferred to Int

val c: Double = 0.7                   // type declared explicitly
val d: List = ArrayList()     // type declared explicitly

4# Smart Casts

The Kotlin compiler tracks your logic and auto-casts types if possible, which means no more instanceof checks followed by explicit casts:
if (obj is String) {
    print(obj.toUpperCase())     // obj is now known to be a String

5# Intuitive Equals

You can stop calling equals() explicitly, because the == operator now checks for structural equality:
val john1 = Person("John")
val john2 = Person("John")
john1 == john2    // true  (structural equality)
john1 === john2   // false (referential equality)

6# Default Arguments

No need to define several similar methods with varying arguments:
fun build(title: String, width: Int = 800, height: Int = 600) {
    Frame(title, width, height)

7# Named Arguments

Combined with default arguments, named arguments eliminates the need for builders:
build("PacMan", 400, 300)                           // equivalent
build(title = "PacMan", width = 400, height = 300)  // equivalent
build(width = 400, height = 300, title = "PacMan")  // equivalent

8# The When Expression

The switch case is replaced with the much more readable and flexible when expression:
when (x) {
    1 -> print("x is 1")
    2 -> print("x is 2")
    3, 4 -> print("x is 3 or 4")
    in 5..10 -> print("x is 5, 6, 7, 8, 9, or 10")
    else -> print("x is out of range")
It works both as an expression or a statement, and with or without an argument:
val res: Boolean = when {
    obj == null -> false
    obj is String -> true
    else -> throw IllegalStateException()

9# Properties

Custom set & get behavior can be added to public fields, which means we can stop bloating our code with mindless getters & setters.
class Frame {
    var width: Int = 800
    var height: Int = 600

    val pixels: Int
        get() = width * height

10# The Data Class

It’s a POJO complete with toString()equals()hashCode(), and copy(), and unlike in Java it won’t take up 100 lines of code:
data class Person(val name: String,
                  var email: String,
                  var age: Int)

val john = Person("John", "john@gmail.com", 112)

11# Operator Overloading

A predefined set of operators can be overloaded to improve readability:
data class Vec(val x: Float, val y: Float) {
    operator fun plus(v: Vec) = Vec(x + v.x, y + v.y)

val v = Vec(2f, 3f) + Vec(4f, 1f)

12# Destructuring Declarations

Some objects can be destructured, which is for example useful for iterating maps:
for ((key, value) in map) {
    print("Key: $key")
    print("Value: $value")

13# Ranges

For readability’s sake:
for (i in 1..100) { ... } 
for (i in 0 until 100) { ... }
for (i in 2..10 step 2) { ... } 
for (i in 10 downTo 1) { ... } 
if (x in 1..10) { ... }

14# Extension Functions

Remember the first time you had to sort a List in Java? You couldn’t find a sort()function so you had to ask either your tutor or google to learn of Collections.sort(). And later when you had to capitalize a String, you ended up writing your own helper function because you didn’t know of StringUtils.capitalize().
If only there was a way to add new functions to old classes; that way your IDE could help you find the right function in code-completion. In Kotlin you can do exactly that:
fun String.replaceSpaces(): String {
    return this.replace(' ', '_')

val formatted = str.replaceSpaces()
The standard library extends the functionality of Java’s original types, which was especially needed for String:
str.replaceAfter(":", "classified")

15# Null Safety

Java is what we should call an almost statically typed language. In it, a variable of type String is not guaranteed to refer to a String— it might refer to null. Even though we are used to this, it negates the safety of static type checking, and as a result Java developers have to live in constant fear of NPEs.
Kotlin resolves this by distinguishing between non-null types and nullable types. Types are non-null by default, and can be made nullable by adding a ?like so:
var a: String = "abc"
a = null                // compile error

var b: String? = "xyz"
b = null                // no problem
Kotlin forces you to guard against NPEs whenever you access a nullable type:
val x = b.length        // compile error: b might be null
And while this might seem cumbersome, it’s really a breeze thanks to a few of its features. We still have smart casts, which casts nullable types to non-null wherever possible:
if (b == null) return
val x = b.length        // no problem
We could also use a safe call ?., which evaluates to null instead of throwing a NPE:
val x = b?.length       // type of x is nullable Int
Safe calls can be chained together to avoid those nested if-not-null checks we sometimes write in other languages, and if we want a default value other than null we can use the elvis operator ?::
val name = ship?.captain?.name ?: "unknown"
If none of that works for you, and you absolutely need a NPE, you will have to ask for it explicitly:
val x = b?.length ?: throw NullPointerException()  // same as below
val x = b!!.length                                 // same as above

16# Better Lambdas

Oh boy, is this a good lambda system — perfectly balanced between readability and terseness, thanks to some clever design choices. The syntax is first of all straight forward:
val sum = { x: Int, y: Int -> x + y }   // type: (Int, Int) -> Int
val res = sum(4,7)                      // res == 11
And here come the clever bits:
  1. Method parentheses can be moved or omitted if the lambda is the last or the only argument of a method.
  2. If we choose not to declare the argument of a single-argument-lambda it’ll be implicitly declared under the name it.
These facts combined makes the following three lines equivalent:
numbers.filter({ x -> x.isPrime() })
numbers.filter { x -> x.isPrime() }
numbers.filter { it.isPrime() }
And this allows us to write concise functional code — just look at this beauty:
    .filter { it.age >= 18 }
    .sortedBy { it.name }
    .map { it.email }
    .forEach { print(it) }
Kotlin’s lambda system combined with extension functions makes it ideal for DSL creation. Check out Anko for an example of a DSL that aims to enhance Android development:
verticalLayout {
    padding = dip(30)
    editText {
        hint = “Name”
        textSize = 24f
    editText {
        hint = “Password”
        textSize = 24f
    button(“Login”) {
        textSize = 26f

17# IDE Support

You have a number of options if you intend to get started with Kotlin, but I highly recommend using IntelliJ which comes bundled with Kotlin—its features demonstrate the advantage of having the same people design both language and IDE.
Just to give you a minor but clever example, this thing popped up when I first tried to copy-paste some Java code from Stack Overflow:

IntelliJ will notice if you paste Java code into a Kotlin file
And that’s all for now. Thank you for reading! This is my first ever medium post. If you are not yet convinced about Kotlin here is some more convincing:


Reflect and connect.

Have someone give you a kiss, and tell you that I love you.

I miss you so very much, Mom.

Talk to you tomorrow, Mom.


- Days ago = 1050 days ago

- Bloggery committed by chris tower - 1805.19  -10:10

NEW (written 1708.27) NOTE on time: I am now in the same time zone as Google! So, when I post at 10:10 a.m. PDT to coincide with the time of your death, Mom, I am now actually posting late, so it's really 1:10 p.m. EDT. But I will continue to use the time stamp of 10:10 a.m. to remember the time of your death, Mom. I know this only matters to me, and to you, Mom.