Unimaginable fires in the North Bay

At the moment, something like 3,000 homes have been lost in the North Bay. It’s hard to even fathom the thousands of tragedies unfolding in the North Bay this week and how people who’ve lost their homes, pets, friends, loved ones, or all of it are even coping right now. ❤️

In 2003, a meth addict trying to burn down a house started the Old Fire in the mountains near our house in Southern California. At the time, my dad worked for San Bernardino County and helped maintain their emergency communications system.

When the fires broke out, he was tasked with heading up the hill and bringing some emergency generators and other supplies to an *old* AT&T communications bunker on Strawberry Peak. It was built in the 1950’s and allegedly hardened to withstand a nuclear war. I ended up making the trip up with him.

For two days, we sat on top of the bunker and watched the fires slowly climb the mountain toward us. They were far enough away that we couldn’t hear trees burning, nor hear the bombers dropping Phos-Chek, nor smell smoke due to the wind blowing in a different direction, nor hear the sirens of firetrucks passing below on Highway 18.

At night, we watched the eerie glow of the flames play off the constantly changing patterns of smoke. Fortunately for us, the flames never reach the communications bunker.

Down below, 90,000 acres and 1,000 homes would ultimately be lost.

We had a few close calls growing up, but we were always lucky. I can’t even pretend to imagine the pain and suffering our friends and their families are going through right now.

Want to learn to code?

A friend of mine recently asked for some suggestions on which language she should use to learn to code.

There are so many different routes to go! Python and JavaScript might be easiest because they’re dynamically typed languages (basically they’re more forgiving with how you use variables and pass them around — it’s one less thing to worry about as you start out).

I find Python to be super fun and easy to pick up. Plus there’s tons of neat libraries available for manipulating data. One bonus: down the road, you can start playing with some of the many machine learning libraries that are available. Then you can build a model that will predict names of Android phones.

I’m partial to JavaScript. At this point, it’s probably one of the most popular languages right now. People are building web apps, desktop apps, native mobile apps, and backend servers with it due to the abundance of tools available. Plus, there’s a really addictive feedback loop with it: when you’re first starting out, you code something, refresh your browser and boom, there it is!

I’ve played only a little bit with Swift. I like it and I think Apple is doing some good work trying to provide tools to help people learn. For now, you’re mostly going to be limited to building mobile apps, though there are more tools being built that expand its uses (e.g., servers).

There are tons of great resources. Codecademy, Code School, Udemy, free tutorials, etc. When I started out, I started learning by trying to build a JavaScript app that could solve Sudoku puzzles. Somehow, I eventually did it! I was pretty hooked!

Getting excited for totality

We’ll be road tripping to Wyoming to see the total solar eclipse. Apparently, experiencing one is really weird.

During a solar totality, animals usually fall silent. People howl and weep. Flames of nuclear fire visibly erupt like geysers from the sun’s edge. Shimmering dark lines cover the ground.

I can’t wait!

Emoji Say What?

Here’s a random little side project that I’ve been working on: Emoji Say What?

It’s like a game of telephone, but using the latest in human communication technologies, hieroglyphics, emoji!

Basically, you visit the site and get a completely out of context sentence or set of emoji and it’s your job to decipher it. And so on and so on. It evolves over time and eventually you get something like this.

Using neural networks to generate names for craft beer.

I’ve been on a machine learning kick lately. Given a large enough dataset to train with, it’s really interesting to see what a neural network can come up with.

This week, it’s names for craft beer.

If you’re a fan of IPA beer, you’ve got names like Dang River, Yamquak, Yall in Wool, Wicked Geee, Yampy, and Oarahe Momnila Day Revenge Bass Cornationn Yerve Of Aterid Ale. Like strong pale ales? Trippel Lock, Third Maus, Third Danger, Spore of Gold and Drammnt. Stouts more your thing? Look for Sir Coffee, Shock Slate, Take Bean, Black Sink Stout, Shrump, Avidberry, or Cherry Trout Stout.

Naturally, I tried to create my own model using a Python library called Keras and a dataset of 7,500 craft beer names.

…I should leave this stuff to the professionals.

Update: Kaggle has a new tutorial teaching you how to do this exact same thing. Neat!

10% Happier

Recently, I decided to start meditating in order to be more mindful of the present, be less anxious about the future, and to just enjoy things as they happen. It’s not an end-all-be-all cure to life’s problems, but it feels good and definitely helps reshape your perspective on things.

I picked up the book 10% Happier by Dan Harris.

It definitely seems like one of those cheesy self-help books, but it was a pretty quick and easy read.

Perhaps the most powerful Tollean insight into the ego was that it is obsessed with the past and the future, at the expense of the present. We “live almost exclusively through memory and anticipation,” he wrote. We wax nostalgic for prior events during which we were doubtless ruminating or projecting. We cast forward to future events during which we will certainly be fantasizing. But as Tolle pointed out, it is, quite literally, always Now. (He liked to capitalize the word.) The present moment is all we’ve got. We experienced everything in our past through the present moment, and we will experience everything in the future the same way.

I’d encourage folks to try it.

Setting up tests using Tape

Test driven development has become an important process in the software engineering world. It allows coders to develop functions by first creating a series of tests that the new function must solve. The benefit of this is that once your app grows more complex and you add new functionality, you can see if any existing tests have failed, meaning that something broke (and now you know where to find it). Look no further than any popular project on Github and you’ll often see a “tests” folder.

Today, we’re going to talk about setting up tests using Tape.

Tape is an alternative to popular testing suites such as Jasmine and Mocha. Like any tool related to software engineering, there are some developers that strongly prefer Tape over other options. It’s fairly easy to setup and can easily be run in automated task runner tools such as Grunt and Gulp.

To use it as part of your project, you can install it through npm:

  npm install tape --save-dev

Once it’s been added as part of your project, you can create a new tests.js file and require the module.

For our demonstration, we’re going to write a simple test that checks if my name is Dave, plus a few additional parameters.

Start off by setting up your test.js file like so (you can name it whatever you prefer). I’ve commented the code for some additional clarity on what’s happening here.

// Require the Tape module imported from npm
var test = require('tape');

// Write your tests in the code block
test('All about Dave', function (t) {
    // The number of tests that you plan to run.
    // NOTE: If this number doesn't match up with the number
    // of tests that are run, your test will fail.
    t.plan(2);
    
    // Let's setup some variables to test
    var name = "Seymore";
    var city = "Oakland";
    var favBaseballTeam = "Athletics";

    // This test will check for my favorite baseball team.
    // The first parameter is the result, the second is
    // the value you're expecting, and the third is the message
    t.equal(favBaseballTeam, "Athletics", "Favorite baseball team should be Athletics");

    // This test will check for my name.
    // As you can probably assume, it will fail.
    t.equal(name, "Dave", "Name should be Dave");

    // This test will check if city has been set:
    if (city) {
      t.pass("City set");
    } else {
      t.fail("City not set");
    }
});

That’s it! You can run Tape from your terminal and point it to your newly created test.js file in order to run it.

Screenshot 2015-09-01 14.00.18

Using the Mongo CLI to find your data.

We’ve been working on many projects lately that have utilized MongoDB as the primary means of database storage. I have previous experience building and using MySQL databases, so the idea of these NoSQL databases is a new concept for me.

I’m not one to shy away from new technologies, so I’ve been trying to embrace MongoDB and learn how to use it.

One of the most important things I’ve been learning is how to view the databases, collections, and records that I’ve saved in my various applications through the MongoDB command line interface.

Let’s do a quick walk through and pretend I have a database dedicated to baseball.

Once you have Mongo installed on your machine, you run the interface by typing mongo in your terminal. Now, you can bring up a list of databases by typing show databases.

Screenshot 2015-08-20 10.24.51

How do we use a particular database? Easy! Just type use [database_name]


use baseball

Awesome! Of course, you’ll want to do more than just “use” the database. We want to see what’s inside it. This is accomplished by telling mongo to show us all collections (e.g., think of these as “tables” in a traditional SQL database).


show collections

Screenshot 2015-08-20 10.27.33

Awesome! Now we have a collection of teams and collection of players. Well, let’s display everything within a particular collection. In this case, let’s print out all teams that we have stored in our database.


db.teams.find()

Screenshot 2015-08-20 10.28.32

Great!

Now, let’s say you’re looking for a particular record. How do you limit your search to just one thing? Like this:


db.teams.find({team: “dodgers”})

Screenshot 2015-08-20 10.30.04

Now, you can imagine that if we had more data, there are a lot more things that we could search for and find. It’s pretty powerful!

Anyway, this was a quick tutorial on how to use the Mongo DB CLI. I hope you found it helpful!