Meow Mix Mantra

In my life, one of the meditation related challenges has been helping my son meditate. More specifically, helping him make meditation part of his daily routine.

We came up with the Mindful Minecraft Meditation plan together. That worked great for awhile. We’ve meditated together. He understands and has felt the benefits.

We’re even still making discoveries together. Here’s one. When he was really wound up last time, hugging him and having him focus on our slow and steady breathing helped him feel calm. It’s a technique similar to focusing on a stuffed animal as described in the video in Meditation Yields a Better Brain. In regards to focus and happiness, he has discovered a Meow Mix Mantra.

Coming at you with a disco ball and cats dancing, this remix of the old Meow Mix commercial is funny and hypnotic. With its cat theme, up-beat music, and occasional lasers coming from a cat’s eyes, the Meow Mix song [10 hours] YouTube video is something he has really latched on to.  Unless you suffer from photosensitive epilepsy, you will want to play it to fully understand [warning: lots of flashing and scene changes]:

As a family, we agreed to not play it at the dinner table. However, that brings up a challenge that has not been figured out quite yet with any of his meditative practices, schedule.

Due to school and what not, kids schedules are pretty full. When not using his small allotment of iPad time, he prefers to play with toys over meditating.

I feel certain that if we used something that provided tangible feedback such as the “brain sensing headband” called Muse, the idea of meditating would be even more attractive. With the cost being in the triple digits, that’s not a gamble we want to take though.

After a family discussion, our kid decided to not meditate at this time. That of course is fine. It is a decision that many adults make. Was it because he felt something else was threatened on the schedule though?

Regardless, he is sold on the Meow Mix Mantra and it’s good enough for him meow (now). May you find your happiness too.

“Good” Meditation Growth Then Tears Flowed

I have been using the iPhone app Meditation for Skeptics by 10% Happier for some time now. As said in earlier posts like 10% Happier App is Growing, the app has answered questions I’ve had for a long time, brought different perspectives to my meditation practice, and has given me insightful conversations with real-live meditation coaches.

Recently, something special happened.

After finishing a 20 minute meditation, I did the last two sessions of the 10% Happier app with Sharon Salzburg. I’ve done them before, but decided to revisit them.

After I completed the two sessions, I felt an urge to tell Sharon she did a good job. I thought: Why not? She earned it! It would also exercise my kindness mental muscle. So, I started writing a quick Twitter tweet saying she did “good” and then changed it to “great”. Great is better than good, right?

Sharon Salzberg. As you have heard many times I'm sure, you did great with your role in the 10% happier app.

Great Job Tweet

Why in the world did the word “good” still feel like higher praise than “great”? What’s going on? Then, the answer hit me. So, I shared my moment of “ah ha!”

This just helped me realize that when a grandfather told me "I did good" he meant it on two levels. Good for others too.

Why Grandpa Said “Good”

Time to share what I truly felt. She did well and it was a wonderful gift for all.

So, you did good.

Sharon Did Good Tweet

Boom! Feelings of gratitude, missing grandpa, and love washed through me. Tears flowed. It wasn’t sadness, but just “wow!” What to do?

Fortunately, I knew what to do. In my experience and from what I have learned from others on this path, it’s best to let the feelings flow through you. Let the tears stream down the face and to breathe deep. If such an experience is new to you, you may feel silly when it hits you. However, take comfort in that this is all normal and healthy.

This is a natural breakthrough. Sometimes such experiences can be interpreted as unsettling, embarrassing, or even scary.

I suggest comparing these experiences with those experienced with meditation. One obvious source is the 10% Happier app made by Dan Harris and others. Other local sources may serve you as well. Good luck on your journey and be well!

Swizzle Swift Class Methods

While writing some test Swift code, I ran into a situation where I wanted the implementation of a class method swapped out with some fake code. Basically, I wanted to swap out SomeClass‘s saveSomeThings class method with a fake one.

Inspired by NSHipster’s Swift & the Objective-C Runtime article, I came up with some concise code that does what I want. Focusing on only what shows the concept, we have the following example SomeClass:

The saveSomeThings method implementation is what we want to swap out with some fake code for testing purposes. How, you might ask? First, ensure the method has the dynamic keyword as discussed in this Stack Overflow post. Next, we grab a handle to the class method like so:

Now we need something to swap it with. What if we had a method inside a SomeTestClass class like the following just for testing purposes?:

We can grab a handle to the method like so:

The actual call to swap the implementation between the saveSomeThings and forTesting_SaveSomeThings is done using method_exchangeImplementations like this:

The SomeTestClass prefixes the originalMethod and swizzledMethod because I am storing them as static members of the SomeTestClass.

Those are all the magical pieces of this puzzle! Besides being on github, here is a complete Swift playground example to see it all in context:

At CARFAX, I have been fortunate enough to work on such interesting challenges like the one above in Swift, Objective-C and Java based languages. Since CARFAX is a growing company with opportunities that open up from time to time, you might want to checkout the CARFAX Career link.

Regardless, I hope you found the above information interesting and useful. Enjoy!

Hit Your Own Server On Your Mac With Your iPhone

To truly evaluate the user experience, there is no substitute for having the app on your iPhone and in your hands. Yet, it’s rare that a person can make an iPhone app that doesn’t depend on a server of some kind.

If you don’t have a server deployed somewhere yet, what can one do? Well, you can hardcode values in the app. However, that can be more trouble than it’s worth. Also, you’re not testing the whole app end to end. So, what one can do is create a mock server that returns hardcoded values using Node.js or some other framework. Great!

Just one thing, the mock server your iPhone depends on is not ready to be deployed. It’s on your machine only. What to do?

You can run the server locally on your mac and have your iPhone hit it over wireless. Sounds easy enough. Right?

After figuring out your IP address of your machine for the phone to hit, changing the iPhone app to hit whatever URL it needs, and probably temporarily turning off App Transport Security so you can hit it with an http as opposed to an https URL, you may find that your iPhone app still cannot hit the machine your mock server is running on.

Stack Overflow to the rescue! After digging into the google world, I found the key sentence I was looking for in a Stack Overflow post:

I turned off my WI-FI on my Mac and then turned it on again, which solved the problem.

Although I’m not positive, it seems like I had to flip the wireless from on to off and back to on more than once. To test that the phone can reach the machine, I used safari on the iPhone to check that I can hit anything at all on that machine.

Once I figured all this out, I was so happy that I decided to write this for others to use. If it wasn’t for Stack Overflow and our community of knowledge sharers, where would we be today?

Vision Versus Implementation

When a vision is shared and agreed upon, that’s a good feeling. A direction has been laid out. Metaphorically, the compass has a true north to point towards. What confuses people sometimes is the difference between a vision and an implementation of that vision.

What’s the risk? Who cares? Well, let’s come up with a crazy simple example. Let’s say the vision is to go after fruit. The leader says:

We want fruit.

So, someone eventually says,

We need to do these things to get oranges. It’s what the leader wants. Don’t you support our fruit vision?

The vision was changed into an implementation. What even compounds the confusion is that the leader had suggested that for a specific team, the implementation of the vision will probably be apples.
Now, it’s easy to see the error in this case when dealing with apples and oranges. It can be harder when a generic word like “initiative” is used.

In this case, what can help is to add on “vision” or “implementation” as needed. For example, someone can propose that a specific team support the “initiative-vision” by using this specific “initiative-implementation.” If a certain implementation doesn’t work, one can try a different implementation without throwing out the whole vision.

Separating out the the vision versus the implementation enables a certain amount of freedom and likelihood of success. It makes the vision more resilient, adaptable, and much more likely to succeed as it gets more fully embraced within the entire group.

May your visions bear fruit. Try not to go bananas while going after it.

Fire! Wife, Apple Watch, and Meditation are Heroes

Ring! Ring! There goes my Apple Watch. The iPhone is in another room and my hands are dirty-dishes-gross. “That’s weird and annoying”, I think reflexively to myself. My wife is calling but she just left.

With the final ring sounding, I quickly do the right thing regardless of my thoughts. I rinse off a pinky finger and answer the call on my Apple Watch with it. I hear her Apple Watch’ed voice say loudly “Get a trashcan full of water and …. <something about a bin>.” What’d she say? After quickly rinsing off my hands, I grab a trashcan, yank the trash out, and mutter about needing caffeine while filling it up with water.

Next, I’m outside. Hmm! Lots of smoke is coming from the trash bin area. Uh oh… A quick emotion check reveals slight concern and the thought that I better get out there soon and see what’s up. I’m slightly surprised about how matter-of-fact my mind feels.

Keeping a clear mind is a credit to the meditation training I’ve done over my life and most recently received from my two favorite meditation apps. At some point, I run toward the smoke and check out the situation. Oh! This fire could spread quickly!

My wife had emptied the wastebasket full of water and tells me to get the fire extinguisher. “Good thinking”, I reflect while running back. I dug it out from the back of the closet, run it out to her, and she puts the fire out while I am running back for more water. Success!

A photo of the inside trash bin area that caught fire.

Where the Fire Started Inside the Bin Area

Just then, the maintenance person shows up that my wife had called. Good. He can do any needed follow up with whomever.

Fire scorched trash bin area fence

Fire Scorched Fence Outside of the Bin Area

Let’s recap. The trash bin area is completely surrounded by a dry timber fence. If I hadn’t been wearing my Apple Watch, had my meditation training, and/or my hero wife hadn’t seen the fire, it might have gone completely up in flames. As my wise wife said, who knows if a floating fire ember would have started another fire on a nearby home?

As far as who the hero is that kept people and property safe, the credit goes to my wife.

This is also a moment of gratefulness. I am grateful for my wife’s levelheadedness. I’m also thankful to Apple for their innovation and specifically my Apple Watch. Finally, I feel lucky to have experienced first hand the fruit of all of my meditation training which kept the whole event in perspective and kept me from overreacting.

May you also be as blessed as I in such times!

An Apple iOS Distribution Certificate Dying

In an iPhone developer’s life, there is sometimes mystery around some of the Apple related administrative work that is needed. Certificates expire, Provisioning Profiles have to get regenerated, and test devices come and go.

One interesting question was brought to my attention recently:

If the iOS Distribution Certificate expires, will the iPhone apps in the App Store still work?

Yes. The iPhone apps will still work. From the Apple documentation:

If your Apple Developer Program membership is valid, your existing apps on the App Store will not be affected.

So, it’s well understood that Distribution Certificates expire. What about if someone adds a test device, will that invalidate the iOS Distribution Certificate? The short answer is “no.” Devices are added to Provisioning Profiles as opposed to certificates.

For detailed information, look at the Registering Devices Using Member Center section of the Maintaining Identifiers, Devices, and Profiles Apple documentation and Exporting Your App for Testing (iOS, tvOS, watchOS).

I hope that clears up some of the mystery around an iOS Distribution Certificate dying and point to some helpful Apple documentation.

Mobile Architecture Going Right and Wrong

Most decisions have positive and negative outcomes. When it comes to choosing what technologies to use for a software development team, it often comes down to two different “right” choices. They are right for different reasons and optimize for different things. A smart move is to optimize those things which serve peoples’ best interests (and the interests of their company) even at the expense of other concerns.

Imagine this situation brought to my attention: A team member observes upcoming code duplication between two systems down the road between an iOS and Android product. Among other things, they point out a technological solution that involves adding an additional language that would let them share code between iOS and Android.

From that single point of view, a solution like that sounds OK. Yet, what are the consequences? As you would expect there are pros and cons.

Cons

Let’s start with the cons. Adding new things to a technology stack of this kind may cause the following things:

  • Overstressed team by spreading the team too thin
  • Integration overhead
  • Expertise silos
  • Resistance to refactoring
  • Unforeseen issues due to an increase in overall architecture complexity
  • Increased time and pain around troubleshooting
  • Longer time to get new team members up to speed
  • Enjoyment of work going down for some and potentially all

Overstressed Team by Spreading the Team Too Thin

This deserves diving into a little. Imagine the team has recently adopted Android. Let’s say they recently also adopted a new programming paradigm such as Functional Reactive Programming. Now add a couple new team members. What’s the potential result? A magnification of the concerns listed above.

Pros

Good things that come can come from adding more to the technology stack:

  • Reduction of duplicate code
  • A new thing to learn (which can be good or bad depending on how much one has to learn currently already)

Summary

Which idea is right? Both are right in some ways and painful in other ways. As someone once said:

The hardest decisions in life are not between good and bad or right and wrong, but between two goods or two rights.

Of course decisions need to be made in part against the “-ilities” of architecture. In this case, Architecture complexity increases as one adds technologies. Lessons of the past have taught me that with the adoption of any addition to a technology stack, there can be costs to pay from an architecture and team point of view.

However, consider the people aspect of this too. The quality of a person’s life and their happiness affects productivity. So, measure decisions against those things that will make you excited about working and contributing as well. I highly suggest keeping those in mind. Otherwise, nothing will get done if you are fighting against the human nature of people seeking happiness.

Kotlin, RxJava, and Android is Fun Times 3

It’s almost springtime and time to explore new domains! So even though I still love RxSwift and Swift, I’m looking into Kotlin, RxJava, and how it relates to Android.

Kotlin

Kotlin makes a great first impression! Kotlin has a feel similar to Swift. The functions are denoted with fun. Also, the syntax seems lean.

Some examples are available to try online at http://try.kotlinlang.org After that, a deeper dive into the Kotlin Reference seems like a good idea.

Fun So Far .. Yet Time For an IDE

As described in the Kotlin: Getting Started with IntelliJ IDEA, I installed a plugin into Android Studio to see Kotlin work correctly. It’s a good feeling to know that I am using 1.0.0 of Kotlin. Did you know that Kotlin started in 2010?

RxJava

With Kotlin knowledge and plugin installed, we move on to RxJava. There’s an insightful and well done Berlin droidcon video by Ivan Morgillo titled Android reactive programming with RxJava. In the context of the Android world, he goes over the concepts of Rx and shows some great RxJava examples.

Android Reactive Programming with RxJava

Ivan is also the author of an RxJava book titled RxJava Essentials released in mid-2015.

Looking around, I see 2016 RxJava Basics by Cosmin Stefan-Dobrin presentation slides that have some good content in there too. Two very interesting slides in there have the title: “Retrofit and RxJava, sitting in a tree.” Although outside of the scope of this article, Retrofit is worth a look.

Finally, there is an RxJava community on Glitter. Having used the RxSwift community on Slack, I know the importance of a strong and supportive community.

All together, it looks like Kotlin and RxJava have what is needed to help one be successful with their Kotlin / RxJava / Android adventure!

 

Guilt and the Ego Trip

Listening to Joseph Goldstein’s Dharma Talks, I found something interesting in relation to guilt. Feelings can be powerful tools for learning. However, guilt can be something that kids and adults get hung up on.

In response to doing something stupid or not nice, I know a young loved one who likes to say “I’m bad.” In his own way, Joseph points out that a person can sometimes get hung up on the story of being bad as opposed to learning from the experience and then moving on.

14:12-ish into his “2015-11-18 Q & A” Dharma Talks, he talks about how we often “justify guilt” in a way that’s not useful. He also points out a technique of “wagging the finger at [guilt]” at 15:07. In other words, he points out that we can notice this unhelpful guilt. It can be identified. We can then change it into “a feeling of wise remorse”, take responsibility and do all of this with understanding.

How to share this concept with a child? My initial thought is to do it with a picture.

BK

Image from BK at https://flic.kr/p/p3yhro

Good luck with your exploration of how to internalize this idea and share this concept with both the young and old.