As a brief note, if you ever need to use the Flutter CupertinoDatePicker — a spinning wheel chooser — in “time-picker/time-chooser” mode, I can confirm that this example works:
Here’s a little example of a Flutter time preferences widget, something I’ll be using in the new version of my Just Be app. Probably most important thing about this source code is that it shows an example of how to use the Flutter
My choice was to store my datetime data as a SQLite
INTEGER field. I did this so I can query and sort that field easily myself. (The benefit of storing a datetime field as a
TEXT field is that you can read it easier, but I think an
INTEGER field is a little easier to work with, though YMMV.)
Sometimes when I embark on little projects like my Scala file-find command, I think, “This is a waste of time, the existing tools are good enough.” But then, if I’m motivated enough — if I really want something — I think, “But I can use this better tool for the rest of my life...”
I just released the file-find command four days ago, and I use it almost every day while learning Flutter and Dart, so I think it’s going to be well worth it.
The Persistence of Memory, by Salvador Dali. A favorite painting, and the melting is fitting for a 99 degree day.
If you need to copy a directory on Unix/Linux and want to preserve the date/time information while copying the directory and files, use the
-p option to save the date/time information, and the
-r option to copy the directory properly. For instance, I just used this
cp command to copy a directory named OldDir to a new directory named NewDir, while retaining all of the date/time file information:
“He realized then that history is a wave that moves through time slightly faster than we do.”
~ from the book, Green Mars
The book, Advanced Scala with Cats, has a nice little function you can use to run a block of code “slowly”:
def slowly[A](body: => A) = try body finally Thread.sleep(100)
I’d never seen a try/finally block written like that (without a
catch clause), so it was something new for the brain.
In the book they run a
factorial method slowly, like this:
slowly(factorial(n - 1).map(_ * n))
FWIW, you can modify
slowly to pass in the length of time to sleep, like this:
def slowly[A](body: => A, sleepTime: Long) = try body finally Thread.sleep(sleepTime)
I’ve written several things about the Linux
cron command and crontab file format before, and as a quick note, here’s some information on the format of the crontab date and time fields.
Crontab date/time fields
First, from the crontab man page documentation:
This short blog post contains a collection of Scala number and date examples. I created most of these in the process of writing the Scala Cookbook. Unlike the Cookbook, I don’t describe the examples here much at all, I just show the examples, mostly as a reference for myself (and anyone else that can benefit from them).
Scala numeric types
Scala has these numeric types: