Ducktyping + Python Protobuf


Given a compiled Python protobuf as follows:

message Person {
    optional string email = 1;

Don’t use duck typing to see if an optional field has been set!

Though the value is known to be unset, accessing the value always returns a default value! (Source. See optional field description.)

import Person_pb2

person = Person()

    print('Oh wow you totally have an email!')
    print('It is: '.format(
    print('I got nothing')

> Oh wow you totally have an email!

> It is:

Use the compiled protobuf’s data member functions to check existance:

if person.HasField('email'):
    # do stuff

It’s not very clear you need to do it like this…

REST Example


Not RESTful

REST interface: “Do something and let me know when you’re done.”

Resource: “K.”

Resource: “Hey, I’m done.”

REST interface: “K.”


REST interface: “Do something.”

Resource: “K.”

REST interface: “Are you done?”

Resource: “No.”

REST interface: “Are you done?”

Resource: “No.”

REST interface: “Are you done?”

Resource: “No.”

REST interface: “Are you done?”

Resource: “No.”

Portrait Mode


Portrait Mode

(#1) Programming is like...


To be garbage collected player

Garbage collection is like if in basketball, coaches can substitute players by simply introducing the new player into play but the replaced player can remain on the court. You assume they won’t move or touch the ball or interfere with other players. And then every 5 minutes, the referees yell “FREEZE!” to check every player and sit out the ones that were substituted.

Active players

Troubleshooting Snap on Ubuntu Core


I got started with Ubuntu Core on the Raspberry Pi and I had some problems (nothing major) starting with snap on Ubuntu Core. Here are some quick resolutions:

  • is the snap daemon on? Restart the service with service snapd restart
  • errors installing snaps? Did you login? Do snap login