Alvin Alexander | Java, Scala, Unix, Perl, Mac OS X
I’m not yet sure if I like the book Functional and Reactive Domain Modeling, but one thing is for sure: I couldn’t begin to understand it if I didn’t first do the research to write Learning Functional Programming in Scala. The author immediately jumps into monads as if they are commonly understood, and also designs his functions as “modules” in a very Haskell-ish way. I’m not saying the book is bad, just that it has a high barrier to entry.
Android 7 comes with a cool new “split screen” feature where you can look at two apps running at the same time. This little pictorial/tutorial shows how to use this split-screen feature.
Linux grep commands FAQ: Can you share some Linux/Unix grep command examples?
Sure. The name grep means "general regular expression parser", but you can think of the
grep command as a "search" command for Unix and Linux systems: it's used to search for text strings and more-complicated "regular expressions" within one or more files.
I think it's easiest to learn how to use the
grep command by showing examples, so let's dive right in.
Fun with Scala functions, including
scala> val add1 = (i: Int) => i + 1 add1: Int => Int = <function1> scala> val double = (i: Int) => i * 2 double: Int => Int = <function1> scala> val addThenDouble = add1 andThen double addThenDouble: Int => Int = <function1> scala> addThenDouble(1) res0: Int = 4 scala> val doubleThenAdd = add1 compose double doubleThenAdd: Int => Int = <function1> scala> doubleThenAdd(1) res1: Int = 3
I have a couple of Ubuntu Linux systems, including Raspberry Pi systems, test servers, and production servers. It seems like every time I have to use an
apt-get or other
apt command, I always have to search for the command I need. To put an end to that, I’m creating this “
apt-get reference page.” It’s very terse, as I’ve just written it for myself, but I hope it’s also helpful for others.
Have you ever felt like you were having someone else’s dream? This morning I was having a “back to school (college)” dream, and thought, okay, whatever, I’m bored, I’ll go with it.
The short story is that when I woke up I remembered that one of the teachers was named Don Monk. I figured that was a name made up by my brain, but I googled it just now and found two college professors with that name, one at Rutgers, and the other just down the road at the University of Colorado, Boulder.
As a quick note, I was just reminded that you can populate a Scala
List using a
Range, like this:
scala> (1 to 5).toList res0: List[Int] = List(1, 2, 3, 4, 5) scala> (1 to 10 by 2).toList res1: List[Int] = List(1, 3, 5, 7, 9) scala> (5 to 11).toList res2: List[Int] = List(5, 6, 7, 8, 9, 10, 11) scala> ('d' to 'h').toList res3: List[Char] = List(d, e, f, g, h)
Those are just a few examples. For many more ways to populate Scala lists with sample data, see How to populate Scala collections with a Range, How to generate random numbers, characters, and sequences in Scala, and Different ways to create and populate Lists in Scala.
In sad news, Talkeetna’s Mayor Stubbs passed away at the age of 20 on July 22, 2017.
I recently read that moose tend to attack dogs, and therefore people with dogs, because they look at dogs as a potential predator. Given that background, here’s a nice story on adn.com about a person and their dog in Alaska.
July 22, 2017 will go down as the day I (finally) switched this website to using HTTPS instead of HTTP. (See the padlock icon in the URL field of your browser.) I’ve been using a self-signed certificate to log in to this site for a long time, but yesterday I finally switched to “HTTPS for everyone.”
I’ve currently written this document as a “note to self” about how the Android
AsyncTask works. It’s currently incomplete, but if you want to know how an AsyncTask works, most of the answers are generally here. I provide documentation for most aspects of the
AsyncTask, though my coverage of (a) updating progress/status and (b) canceling an
AsyncTask is a little weak atm.
I just ran across this image. I created it way back when I was first learning how to create artistic effects with Gimp. I don’t know for sure because I didn’t save the working file, but I suspect that I created this image by starting with an image from a YouTube video, then blurred it a little bit, then applied the “oilify” effect to it one or more times.
P.S. — If you’re old enough, you can identify the pitcher and the batter, despite the Gimp artistic effects. :)
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.
I was just working with an example of how to use Android’s new Room Persistence Library, and the example I was working with ran some of its code on the main Android thread, also known as its “UI thread.” I knew this was bad, but I wanted to start with someone’s example, and then figure out a good way to get the Room method calls to run on a background thread, such as using an
AsyncTask. (The Android docs don’t specify a “best practice” for this atm.)
A series of recent emails has me thinking about “life-changing events.” These are events where your life is clearly headed down one path, and then perhaps in an instant it’s no longer on that same path.
For me there is just one “major” event, which happened when I was a teenager. I’ll call this a Level 1 event. After that there are a series of other important events that are all at a similar level of importance (Level 2), but they are not as direction-altering as the Level 1 event(s).
It's been an interesting thought process. There are at least two moments that didn’t seem too important at the time, but when I look back at those events years later I can see how they changed my direction.
FLiB is a fast, free internet browser for Android devices. Read on for more details ...
Just like my Jenny Lane Cottage painting, this is another small version of a “faux painting” I recently created from a photo. This one is of a sidewalk in Santa Fe, New Mexico. The complexity of this image was in removing several modern aspects from the original photo, including signs that were on those green columns, and modern automobiles that were in the background. Everything after that is what has become fairly standard work with Gimp for me, including making it look like an oil painting, and dramatically modifying and enhancing the colors.
I use my favorite images as screensavers, and this “hoodie” image of Luke Skywalker from Star Wars Movie #7 is a recent favorite. I found an image online, then worked with it in Gimp to get a decent effect. This Luke Skywalker sketch shows another approach you can take with Gimp.