success

A worthy struggle has its own rewards

Working with yoga is often interesting. You stretch and twist and focus, trying to be very conscious of your movements, and then one day in the middle of a twisting pose you see your left foot coming out from behind your right ear. At first that’s a real surprise, a shock. You think, “Well, that can’t be MY foot over there,” and then you realize it IS your foot, and with that comes a strong sense of accomplishment, and maybe a little smile.

Then you do the same pose in the opposition direction, but twist and stretch as you might, your right foot doesn’t come out from behind your left ear. You know you can’t push it any more, at least not while doing the pose properly, so you realize there’s a bit of an imbalance. You accept that there’s still more work to do, but it’s a good thing, so you push on.

I think life is like that too, or can be like that. If you enjoy the struggle, if it’s a worthy struggle — a path with heart — the effort comes willingly, and with its own rewards.

How to use multiple Scala Futures in a ‘for’ comprehension

Table of Contents1 - The correct approach (simplified)2 - A thorough example for verification3 - The wrong approach4 - Summary

As a quick note about Scala Futures, if you want to create multiple Futures and merge their results together to get a result in a for comprehension, the correct approach is to (a) first create the futures, (b) merge their results in a for comprehension, then (c) extract the result using onComplete or a similar technique.

Share it!

There’s just one person behind this website; if this article was helpful (or interesting), I’d appreciate it if you’d share it. Thanks, Al.

Scala best practice: How to use the Option/Some/None pattern

Table of Contents1 - Problem2 - Solution3 - Returning an Option from a method4 - Getting the value from an Option5 - Using Option with Scala collections6 - Using Option with other frameworks7 - Using Try, Success, and Failure8 - Using Either, Left, and Right9 - Discussion10 - Don’t use the get method with Option11 - See Also12 - The Scala Cookbook

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 20.6, “Scala best practice: How to use the Option/Some/None pattern.”

Back to top

Problem

For a variety of reasons, including removing null values from your code, you want to use what I call the Option/Some/None pattern. Or, if you’re interested in a problem (exception) that occurred while processing code, you may want to return Try/Success/Failure from a method instead of Option/Some/None.

Share it!

There’s just one person behind this website; if this article was helpful (or interesting), I’d appreciate it if you’d share it. Thanks, Al.

What are you willing to do to become successful?

I hear a lot of people say they want to be successful. For me this always comes down to, “What are you willing to do to make that happen?”

In my own case I had to overcome a fear of public speaking, learn how to write software, learn how to build and manage a company, learn some sales techniques, make sacrifices on how I spend my time, etc.

“Inspirational Dissatisfaction”

“Inspirational Dissatisfaction” is a term that I read a very long time ago, possibly in a book called Success Through a Positive Mental Attitude.

The term basically means, “I am so unhappy in my current situation that it is motivating the heck out of me to do something about it.” Rather than become sad or depressed about your current situation, you become motivated by it, so inspired by it that you become willing to do whatever it takes to change your situation.

Bruce Springsteen on making Born To Run: "We went to extremes"

There is some talk in this Rolling Stone article that Bruce Springsteen was on the verge of failure when the song “Born To Run” was released. Springsteen acknowledges that, but also adds, “I don’t know if it would have finished us — because what the [bleep] else were we going to do?”

I tend to look at that as perseverance: “Okay, you don’t like my work? Well, I’m not going anywhere, I’m going to keep working at it.”

When I first went to college I wasn’t a Springsteen fan at all — I barely knew who he was — but then I heard Hungry Heart, and became a fan. These days Born To Run, Hungry Heart, Badlands, Thunder Road, Pink Cadillac, Brilliant Disguise, and Secret Garden are some of my favorite songs. And Santa Claus is Comin’ to Town is one of my favorite Christmas songs/performances.