More Kotlin Features to Love

Constants are important

One of the things that I’ve come to appreciate more and more as a programmer are constants. Before I would have yawned and said big deal why? Now I’d say they are so important as they prevent so many needless bugs. If we are guaranteed that something is not null then we can focus simply on getting our work done instead having to null check the world.
(more…)

Read More

Debugging with Jack

Overriding Variable Contents in the Debugger

Debugging is always a very important feature of an IDE. One useful tip that I don’t hear much about while debugging is being able to change the contents of a variable in the middle of debugging session. If the debugger is halted on a line you simply need to execute the Evaluate Expression Command(⌥+F8). From there you simply run any valid java command it will update the contents of your variable. It’s not limited to assignment, you can evaluate any java expression.


(more…)

Read More

Love for Kotlin

I spent a fair amount of time learning how annotation processors work. I made a sample library called ascent on github for injecting custom fonts into fields. It was a great way to learn. The benefit of annotation processors is boilerplate destruction. I’ve always disliked having to write code over and over again, one example of that is converting values from dp to px values in custom views. The designers I’ve worked with love to give me Custom Views, so I’ve frequently run into this problem. Here is a piece of code that was very common in my code base that I really wanted to get rid of:


(more…)

Read More

Why I Love Zeplin

Screen Shot 2016-01-31 at 7.51.15 AM

One of my favorite apps is Zeplin. If you haven’t heard of it before, it’s an amazing desktop app that helps you build pixel perfect mobile apps. To understand why it’s amazing let’s look at a typical workflow for coding up a design. Back when I first started android development the development flow was the following:
(more…)

Read More

Book Review: 100 Android Interview Questions

I’m finally getting around to reading through this book that one of my colleagues wrote. I do like a good portion of the questions. I was a little disappointed that the questions weren’t all android specific(some that were Java specific). Overall I think this is a good set of questions to use as the basis for either preparing for an interview. There are a number of questions that I have asked candidates in the past that also happened to be in the book.

Read More

Manually Edit Git Hunks to Stage

One of my favorite features of git is the ability to commit partial changes to a file. Sometimes this is super easy as the changes I want to commit may not be near other changes I don’t want staged. Other times if the changes are too close to each other git has no idea what to do and it fails. Fortunately there is a manual option for only staging lines that you wish.
(more…)

Read More

Reformat Code in Android Studio

Quick Android Tip of the Day. Ever open a source file in android studio and realize that the code isn’t properly formatted? 3 Keystrokes is all that is needed to fix that. This works in XML files too not just Java and Kotlin.

Auto Format Code Hot Key
Mac: ⌘ + ⌥ + L or Command + Option + L
Win/Linux: Control + Option + L

Read More

No Ternary Operator :(

While programming with kotlin I wanted to use the ternary operator something like the following

condition ? true_result : false_result.

I couldn’t find it anywhere in the documentation, I went to the github repo and took a look to see if I could find the grammar for kotlin. Sure enough they have an expressions file. I took a look and unfortunately wasn’t able to find any indication of a ternary operator. I figured this might caused by the existing use of the null check operator ?

Unfortunately kotlin doesn’t have this in the language, the closest thing that is available is this:

val max = if (a > b) a else b

Not horrible but not great either.

Read More

Two movies I loved this year

woman-in-gold_posterI watched the Woman in Gold this weekend. I loved this movie, don’t worry there will be no spoilers. Actually I lied there will be spoilers but you will have to highlight the text to see them. The movie is based on a true story of a woman trying to reclaim a portrait of her aunt that the Austrian government has in their possession. I loved watching Helen Mirren, Ryan Reynolds, and Tatiana Maslany. Tatiana Maslany is one of my favorite actors, the main character in orphan black. Which if you haven’t seen I highly recommend.

Highlight for spoilers:

This movie has a few stories. The primary story centers around Maria Altmann(played by Helen Mirren/Tatiana Maslany) living in Austria. We watch her learn so much from her aunt. And then watch her fleeing Austria from the nazis leaving her parents behind.
The second story is about Maria and Randy Schoenberg(her friends son) an attorney work to reclaim artwork that was seized by the nazis that was currently in the Austrian governments possession. The story explains that the Austrian government is trying to improve it’s image by writing the wrongs of the past by changing the Art Restitution handling. But as the main characters soon discover, it is only for PR purposes. We follow the characters try to provide additional information for their case, and the Austrian government simply not care. After all the government doesn’t want to give away the now famous artwork.
There was arguably a third minor story that is about Randy Schoenberg’s career. He starts out as an inexperienced attorney, who initially only looks into the case because of the amount of money the artwork is worth. But after one trip to Austria, he knows what he needs to do. He quits his job to pursue the case full time. The case ends up giving him career clarity, and at the end of the film his field of expertise is art restitution. It was amazing watching the case first show up in California, then the Supreme Court, only to voluntarily go back to vienna for a trial by arbitration. Watching a smug government official lose at every step is very rewarding.

After reflecting I realized that Helen Mirren was also in another movie that I loved earlier this year. I have to give her props for making me dislike the character so much.
trumbo The movie is Trumbo. This movie follows Dalton Trumbo through the Mc Carthy era. I found this movie awesome for similar reasons; the subject is fighting for their rights. Trumbo is such a witty like able character(played amazingly well by Bryan Cranston) you can’t help but root for him. I learned so much about the writer, as well as other famous people during that time.

Highlight for spoilers:

This movie was refreshing in that it was honest about what people did. John Wayne is often considered an American hero, but in this movie he is clearly not. After watching the movie, I found out that the Dalton’s daughter was responsible for making the movie accurate. There was no apology/makeup between John and Dalton and original parts of the film or screen play indicated that they made up, and the daughter is responsible for having the movie corrected.
I found myself rooting for Dalton as he works his around the blacklist. It was also rewarding watching him win oscars for the brave one, and roman holiday. Especially since the names were either made up or there was a front person who pretended to do the writing. Watching his house become a busy hub for his underground writing network. It becomes more enjoyable watching Edna, and John Wayne fail to oppress the writers in the end. In the end Dalton wins because he left such an amazing legacy. Edna was probably forgotten before this movie, and will likely be forgotten again.

Read More