MathJax

Monday, August 7, 2017

Ha! Slow flight hypothesis 100% confirmed!

Easy-peasy. The Archers are well above slow flight in the pattern. Went back up with the instructor again today and it was night and day. He asked what I'd been eating. I told him it was a bowl of humility and reflection.

Still suuuuper-smokey. We had Paine all to ourselves again for that exact reason.

Sunday, August 6, 2017

Knocking the rust off

It's been almost a year since I've flown, so I decided to go up with my club instructor. I remember some time gaps from before and I've always been glad to get used to the airplane again before taking up a passenger, but this gap was long enough where I wanted the instructor as well.

The interesting thing about rust is you forget what feels normal, and there's a lot of feeling involved in takeoffs and landings. Normal is very important because while there's usually a cautious side to err on, there are extreme mistakes on both sides.

A consistent but gentle crosswind at Paine. So, so, so much smoke, cutting down visibility to as little as 4 miles (not something I'd fly in alone, especially being so deconditioned). A new (to me) airport in Sequim, Washington. Back-taxiing on the runway only, no taxiway. It's a small place.

The air was smooth and the smoke kept most pilots on the ground, so we had the skies to ourselves, with strobes and nav lights on during the daytime just to be sure. Did I mention it's smokey in the greater Seattle metropolitan area? It's really smokey. Like, there's a lot of smoke.

When I finished my training and earned my certificate I was pretty proud of my landings and my pattern work. They were good for a long time, but after a year some nominally-conscientious habits were getting in the way.

First of all, it's 30 degrees in the pattern. You don't really need or want to be steeper because of a higher stalling speed, but you don't want to be shallow, either, because then you can try overcorrecting with the rudder and get into a cross-controlled condition, which neither is nor feels good. Next, inversion of control is great at low speeds, but in Piper Archers that speed is really low. I had decided that while still at 70-80kts to control for airspeed with pitch and arrest sink rate with power. That's too fast for that and you'll feel silly. And this is really a second-guessing of myself anyway, since the natural thing to do if you've played any kind of flight simulator game is to compensate for your sink rate with back pressure on the yoke. It's way more effective.

After half a dozen landings I went from some of my worst in years to some I'm far less embarrassed about. I'm happy with the decision-making that was pushing for a lesson and it's good to get to know the airplane again. One or two more times with the instructor and I should be better than new.

Monday, April 24, 2017

Why would I want you to play good chess?


Perhaps because I am a colossal nerd? Perhaps this condition is necessary, but not sufficient. ;-)
NEEEEEEEEEERRRD
Perhaps because I want more competition? No, the internet solves this problem nicely.
chess.com. Easy-peasy.
Perhaps to share the joy of the game? Sure, there's joy in the game, but there's lots of joy in this world, and much of it is more accessible. YouTube solves this by searching for kittens and babies and Richard Feynman videos.
Kittens < Feynman ≤ Babies
Perhaps to imitate Ben Franklin? Ben Franklin has already done a far better Ben Franklin impression than I ever could. The same goes for other people who had a famous love of chess.
Most chess players don't end up on US currency, but it couldn't hurt.
Perhaps chess is for brainiacs and if more people get into it than I can look cool by comparison? For the love of God, no. In fact, people suffer from the myth that chess is only for the smarty-pants. You've got it backwards: you're not a chess player because you're a smarty-pants, playing chess helps boost the way you think about other things in life. More on that later.

Another non-reason for me to suggest the game to you: Increase the chance that humankind produces a chess mind to rival the machines and stave off the Terminator revolution. This would make about as much sense as encouraging people to get into weightlifting so that mankind can compete with cranes.

So what reasons do I have for recommending the game? How am I convinced of its broad appeal? Why would I assume that more chess players in the world would be good for the world, and not just good for the chess world? (The chess world can fend for itself, that's not my concern either.) Enough suspense, here are my reasons.

Chess exercises the brains of its human players by letting well-matched opponents present puzzles to one another. It illustrates a certain way of solving problems in that while there are lots of tips to help you evaluate moves, there is a ground truth of what can actually help you find checkmate. You see both how generalizations are helpful and also how they can be undone by specific circumstances.

The mental pressure presented by a tense position helps illustrate reacting emotionally versus solving the problem the board has actually presented. Is this a "ghost threat?" Is it better to block or better to counterpunch? Have I considered the in-between move? There is a difference between the instinct you feel when you are attacked and your actual option of moves. The Jack Sparrow line about "what a man can do" vs. what he can't applies heavily.

You cannot become good at chess without expecting your opponent to play good moves. You can't get good at chess without learning to see your opponent's threats, plans, and options. You aren't the only force in the world. Other people have plans, too, and these plans interact.

You learn to take advantage of the opportunities presented, rather than clinging to secondary concerns. "I really hoped he would let me win in four moves." "I need my queen." "He's not playing the opening right." "Endgames are boring." "Material determines everything." Fiddlesticks. A win is a win, and chess is a field wherein to grapple with the difference between a heuristic and a prejudice. A field which, after all, is still just a game.

Playing a lot of chess lets you experiment with ideas--provided your goal is to become a better player over time, and not never to risk a lost game by challenging your own understanding. A game between players of an intermediate range and up is almost a wager of ideas: "I'll bet it's worth giving you this pawn because of the key squares or the attack that I get in return. Do you accept?"

Such wagers are possible in spite of neither player controlling hidden information and in spite of overt chance such as dice rolls or cards because of another lesson the game teaches: The human mind is amazing, but also finite, with very real limitations. There is a duality to the game, where your challenge is both to find the best move, but also to recognize that both you and your opponent tire. You both have limited short-term memory. You each have certain patterns of play which you individually prefer. So in addition to finding the "best" move--perhaps you can't decide. Perhaps you see a choice between two, or even three variations which don't have a clear advantage to one side or the other, so what do you do then? You can play to confound your opponent's preferences: open the center in a game that started as a French Defense, close up a position that started as an Italian Game. Or, over the board, if there is a position where you can give the opponent more calculating to deal with than you have to do, let him burn the calories. He might be more exhausted or more invested in the game's outcome, and accepting that lots of calculation might still not yield a clear winner can let you save for a moment in the game that does matter. Of course, whether the present position actually is such a critical moment or not is another sort of wager between players.

So after reading these points about the sort of lessons that chess can teach, does it really make sense for you to go to the trouble of learning yourself? Isn't it enough to take the present article as a Cliff's Notes or spoilers for the game? The reason you should still play yourself is because I might be wrong. At most generous, my description of the game's benefits is incomplete. Without playing yourself, you're trusting both my interpretation of the game's lessons and my ability to pass on these lessons in writing. There's no reason to take that chance when the game is out there, free to enjoy, and more approachable than ever before. The way you experience these truths through play is more complete than I could efficiently express in words. Moreover, you're guaranteed to discover insights of your own. The game is easily large enough for that.

For the sake of argument, let's say I've convinced you. You're ready to strike off on your own and explore the game. How can you go about it? If it's so obviously an enriching part of one's life, why isn't everybody into the game?

Historically, there have been far more barriers to approaching the game. Playing against a much stronger player is very demotivating, and only since online chess became common has there been such a convenient source of well-matched human opponents. Online play also allows you to fit chess into your life in a way that was not possible in the past, where the only way to play a game was to sit down with somebody else who was free to devote a block of time to completing a chess game. With online play, you can spread a game (or many games) over several days, examining positions and making moves when it's convenient to your schedule. This level of convenience is still very young, and it will only improve with time.

Another barrier to entry is that chess does have a learning curve, and it is not always easy to humble oneself to a new hobby. I've felt this myself through exploring Go and Xiàngqí, other games in the chess family. It's hard to be a beginner again when you already have so much else that makes you feel good or that you are already good at. Here are some words of encouragement: Everyone is terrible at first. Everyone struggles to adapt. Like biking uphill, more progress is made than is felt, but it is the same for all riders. Proficiency at chess is not a measure of general intelligence or one's worth as a human being. Losing is the natural risk of playing against a mutually beneficial opponent.

With a game as overtly objective as chess, players pressure themselves to find "the right move." This is a worthy struggle, but it can also be paralyzing. As finite beings, we all roll the dice at some point, and learning to get better at that process requires experimentation and a willingness to make instructive mistakes.

When you feel a game has nothing left to play for--you're down a few pieces without compensation and your opponent is wise to your shenanigans to win the pieces back or draw--feel free to resign. Note the critical moment from that game and move on to the next. What's lovely about games generally is that we can always play another, and each loss carries with it a lesson.

Saturday, April 22, 2017

Fun with Fractals

Here's a fun thing to click on:

-gon
Square
Scalene triangle
Pointy

Iterations:



If you had the tiniest bit of fun clicking on that, you should be able to have much, much more fun downloading the code and fiddling with it. The most direct way is to save this web page to your computer and then edit the code directly. There's lots more to play with than what was simple to put in the UI. The real fun is hidden in the code!

Code is available on GitHub at https://github.com/johngorski/fractals. Your git client should also work just fine:
git clone https://github.com/johngorski/fractals.git
Unsurprisingly, you can learn more about Koch Snowflakes on Wikipedia.

Wednesday, April 5, 2017

Happy Birthday!

Marking one's circumnavigation of our closest star bears some reflection and introspection. Because the human being is not a creature built for contentment, one could just as easily acquiesce to thoughts of dreams not realized, hopes unmet, and the measure of regret one can hardly help but accumulate as we traverse our mortal plane.

"Happy birthday" invites us back to the present. Beyond mere greeting and social protocol, it reminds the recipient to count his blessings. Good health, good friends, general prosperity, accomplished achieved, and years more...many more. It restores the perspective otherwise robbed by our risk-averse problem-solving nature.

And so, to all who wished me a happy birthday in-person, over the phone, via text, over email, through Facebook, or in the quiet of your own heart, I thank you.

Monday, April 3, 2017

Transhumanism Through JUnit

Unit testing allows you the super-human ability to check your code's necessary assumptions every build.

You know that idea that you can put your brain into software and then live on through space and time, effecting your will independent of the limitations of your physical body?

For the parts of your brain that worry about how pieces of your code function, that idea has been a reality for decades. Don't worry. Write tests.

Thursday, March 30, 2017

Liskov Substitution Principle: Write This, Not That!

Let's start with
interface Fruit {}

class Apple implements Fruit {}
class Orange implements Fruit {}
Now we want to eat the fruit. But we can only eat Apples.
void eat(Fruit fruit) {
    if (!(fruit instanceof Apple)) {
        throw new IllegalArgumentException("I only like Apples!");
    }
    // Om nom nom....
}
So that's one way to only eat apples, but look! There's an if block, an instanceof check, and an unchecked exception. Plus now we need unit tests to make sure we reject these unsuitable Oranges. Bleh! Compare that to another way to eat only Apples:
void eat(Apple fruit) {
    // Om nom nom....
}
Now the type checker won't let us eat() anything but Apples, which is what we were trying to do anyway. The problem with the first code is that we're lying about which types of input are acceptable in our method signature, and therefore we have to play catch-up with more complicated code in the method definition. We can and should choose to eat Apples if it's true that those are the only Fruit that does it for us. Less to write. Less to test. Fewer opportunities for mischief.

Friday, March 24, 2017

YAGNI, meet YDNIA

Software crafts(wo)men avoid overbuilding for the present need. Usually, the intrinsic complexity of the problem at hand is exciting enough. Conjecture about how a client may want to generalize in the future, unless the client has that exact need in the present, only serves to clutter the built solution. The mantra is "You Aren't Going to Need It" (YAGNI).

Working software systems evolve over time. Sometimes the need for a feature disappears entirely. Maybe some code was in place to support a launch or a migration, and that work is complete. This is where we meet YAGNI's twin, YDNIA: You Don't Need It Anymore.

Clinging to the past can be as limiting as preparing for a future that will never be. Make your software live in the present.

Thursday, March 16, 2017

Java 8 Stream: stream().sorted.collect() throws NullPointerException

Here's what I ran into:

return map.keySet().stream()
    .sorted()
    .collect(Collectors.joining(":"));

was throwing NullPointerExceptions.

Why?

Turns out the original map actually had a value defined for the null key, as in
"a" -> "b"
null -> "c"

So the obvious first place to look is why on earth that silly null -> "c" mapping exists.

Another option, if this is safe for your use case, is to filter with java.util.Objects::nonNull:

return map.keySet().stream()
    .filter(Objects::nonNull)
    .sorted()
    .collect(Collectors.joining(":"));

Tuesday, January 24, 2017

Don't hate me for my Dune review

DuneDune by Frank Herbert
My rating: 3 of 5 stars

Don't hit me for only 3 stars! Dune is good at world-building. Dune is good at inspiring the realtime strategy genre of video games. Like Seinfeld, Dune is more fun to talk about than it is to consume. Sadly, Dune is bad at being the book that so many of its fans claim that it is.

It's on a lot of people's sci-fi required reading lists for its strategy, plots-within-plots, and subtle political maneuvering. Reading with a kid-brain in a different decade might have seen those cool things. Reading the book as a 30-year-old in 2016/2017, the characters are hollow, self-satisfied gnostics. Characters only make mistakes when another character's circuitous but perfectly-executed plan involves careful deception. Arrakis' relationship with water is inconsistent. Sand worms are a problem until they aren't. Harkonnens are cartoony bad guys for no reason. Stillsuits are gross. The political maneuvering is clumsy. Jihad is lame. The we-have-Mentats-because-we-decided-we're-never-making-computers-again plot line is undeveloped. The empathy-is-a-greater-power-than-being-smart-all-the-time is suggested only to be immediately discarded.

Herbert wantonly transmutes conjunctions to commas, drives the reader crazy. He attempted to drive up the pace of certain scenes this way, never admitted the experiment was a horrible failure.

The hard sci-fi is inconsistent, the human elements are childish, and the comma-spliced verbal phrases are borderline unreadable. Three stars for historical significance and because so many people remember the book so fondly. Give this one to Michael Bay for a movie remake.

View all my reviews