time

Linux/Unix: How to copy a directory and save the date/time file information

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:

A Scala method to run any block of code slowly

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)

Format of the Linux crontab date and time fields

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:

Scala number, date, and formatting examples

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:

What Digital (eBook) and Print sales look like for a computer programming book

If you ever wondered what Digital and Print book sales look like for a technical book (a computer programming book, in this case), here you go. This is a slightly cleaned up chart that O’Reilly provides to me for sales of the Scala Cookbook over time, showing eBook sales vs the printed book sales.

All is one, all is one

I am without form, without limit
Beyond space, beyond time
I am in everything, everything is in me
I am the bliss of the universe
Everywhere am I.

~ Ram Kir

A friend of mine was a devout yoga practitioner, and even studied under B.K.S. Iyengar. Right before she passed away, she began to cry tears of joy, and said, “All is one, all is one.”

People don’t respect your time as an at-home writer

One thing I learned about being a full-time, at-home writer: people don’t respect your time. It’s like, “You’re a writer? Haha, that’s funny. Why don’t you come over and help me paint my house? I’m counting on you.” That sort of thing.

There is only time for loving ~ Mark Twain

“There isn't time, so brief is life, for bickerings, apologies, heartburnings, callings to account. There is only time for loving, and but an instant, so to speak, for that.”

~ Mark Twain