Practice not-doing and everything will fall into place

My favorite book by Jon Kabat-Zinn is “Wherever You Go There You Are.” That’s why I was looking forward to reading “Full Catastrophe Living” when I saw that it was available at the library. When I picked up the book at the front counter, I flipped through it while the librarian was processing the borrow.

Flipping through “Full Catastrophe Living,” I could tell that it was very different from WYGTYA. This book was written like a manual. Encouraging chapter titles, but you could immediately tell this was a different breed of book. This was an authoritative manual on how to deal with stress.

Let’s start with the fact that stress is inevitable:

“The concept of stress says that, in one way or another, we are continually faced with the necessity of adapting to all the various pressures we experience in life.” – Kabat-Zinn

So how do we begin to deal with it?

“The very first and most important step in breaking free from a lifetime of stress reactivity is to be mindful of what is actually happening while it is happening.” – Kabat-Zinn

What’s the next step?

“There is an art of facing difficulties in ways that lead to effective solutions and to inner peace and harmony. When we are able to mobilize our inner resources to face our problems artfully, we find we are usually able to orient ourselves in such a way that we can use the pressure of the problem itself to propel us through it, just as a sailor can position a sail to make the best use of the pressure of the wind to propel the boat.” – Kabat-Zinn

By facing the difficulty head-on, we move on more easily.

“You move on. The next moment will have less carryover from the preceding ones because you faced them and dealt with them when they came up. Responding mindfully to stress from moment to moment will minimize the tension that we allow to build up inside of us, thereby reducing our need to cope with the discomfort that accompanies internalized tension.” – Kabat-Zinn

What else causes stress?

“Feeling threatened can easily lead to feelings of anger and hostility and from there to outright aggressive behavior, driven by deep instincts to protect your position and maintain your sense of things being under control.” – Kabat-Zinn

So of course this is leading to mindfulness. What exactly happens when we apply mindfulness to a stressful situation?

“When you bring awareness to stressful moments, you might see more clearly how your own unbalanced view could be contributing to an inappropriate overreaction on your part, one that is out of proportion to what the actual circumstances warrant.” – Kabat-Zinn

Notice that even feelings have a beginning and an end.

“If you can be mindful at such times, if you are watching carefully, you will also notice that even these recurring images, thoughts, and feelings have a beginning and an end, that they are like waves that rise up in the mind and then subside.” – Kabat-Zinn

So all of this comes to the final point:

“Practice not-doing and everything will fall into place – Lao Tzu

Take some time to think about nothing. Take some time to do nothing. Take some time to sit around and just do nothing. Does this sound familiar? That’s exactly what meditation is – time to think about nothing, do nothing, to just sit around doing “not-doing.”

Finally I’ll end with this quote from the book. It’s my hope that by reading this blog post you’ve learned why it’s so important to do nothing. To actively pursue doing nothing. Contact me if this post had an impact on you. How do you practice not doing?

“Inner peace exists outside of time. If you commit yourself to spending some time each day in inner stillness, even if it is for two minutes, or five or ten, for those moments you are stepping out of the flow of time altogether.” – Kabat-Zinn

 

Water/ Not Water – Hacking the Google Maps API

This is the second post on mentorship at Iolani High School. Read part one if you’re interested in learning more about the mentorship.

The second page she was tasked with creating would allow users on the web to direct the catamaran to a specific GPS coordinate. In order to make sure users didn’t put in a GPS coordinate that was on land, she needed to determine if the input GPS coordinate was in the water.

She emailed me to ask for help:

I’m working on the control page now, and I am trying to figure out how to detect water on Google Maps. I have to make sure that the locations sent to the CAT are actually in the Ala Wai Canal. Since the Ala Wai Canal and other bodies of water show up as blue in Google Maps, I think that there should be a way to determine whether a location is in water or not. I’ve done some research on it and most pages suggest using reverse geocoding, however, I’m not sure it will work in this case. Here’s one website:
I clicked on the link to stackoverflow and read that the reverse geocoding wouldn’t work for this issue. So I dug into the second solution proposed. This seems absurd. Here’s the solution posted on stackoverflow:

These are steps your service must perform:

  1. Receive latitude,longitude and current zoom from client.
  2. Send http://maps.googleapis.com/maps/api/staticmap?center={latitude,longitude}&zoom={current zoom`}&size=1×1&maptype=roadmap&sensor=false request to Google Static Map service.
  3. Detect pixel’s color of 1×1 static image.
  4. Respond an information about detection.

You can’t detect pixel’s color in client side. Yes , you can load static image on client’s machine and draw image on canvas element. But you can’t use getImageData of canvas’s context for getting pixel’s color. This is restricted by cross domain policy.

Prons – Highly accurate detection

Cons – Use of own server resources for detection

Let’s go over how this works again to make sure you understand how hacky this solution is.

  1. Sign up for the Google Maps API
  2. Create a webpage in PHP
  3. Pass the GPS coordinates to the PHP page as GET parameters
  4. Send the GPS coordinates to Google
  5. Get back a 10 pixel by 10 pixel image of the map
  6. Process that image with PHP to determine what color it is
  7. If it’s blue it’s water
  8. If it’s any other color it is not water

I smiled all day after this project. It’s such a silly little solution. And it may break if Google changes the color of water in their map. But it works! I messaged back the student:

Thanks for the email. This was a really interesting problem! I ended up coding an API endpoint to determine if a latitude and longitude coordinate is WATER or is NOT WATER with the second option you linked to on stackoverflow.

Specifically this section:These are steps your service must perform:

Receive latitude,longitude and current zoom from client.

Send http://maps.googleapis.com/maps/api/staticmap?center={latitude,longitude}&zoom={current zoom`}&size=1×1&maptype=roadmap&sensor=false request to Google Static Map service.

Detect pixel’s color of 1×1 static image.

Respond an information about detection.

You can test the solution with the following calls:
 
Waikiki land: (returns NOT WATER) <link removed>
Pacific Ocean: (returns WATER) <link removed>
Ala Wai: (returns WATER) <link removed>
I am sharing the link with you to show that it works. I will be taking this code down at the end of the week so it is not possible to use this for your project. I would like to show you how to create this code for your project on your own machine. I’m free to meet in person or to help you via email or phone.
Here are the steps you need to take to set it up:
  1. Sign up for the Google Maps API
  2. Set up billing (this requires a credit card)
  3. Host the API code on a server with PHP
Let me know how you’d like to proceed
We’re meeting on Tuesday to get this set up and running on her webserver. This was such a fun project that I just had to post about it. Here is the code I created to solve this issue:

<?php

///////////////////// Gets the image from Google Maps API&lt;/code&gt;

// Set up the page to take in GET variables
$latitude = $_GET["latitude"];
$longitude = $_GET["longitude"];

// echo $latitude;
// echo "
";
// echo $longitude;

// Sets up parameters for call
$mapsApiKey = "";
$zoom = 20;

// Set up the API call
$apiCall = "https://maps.googleapis.com/maps/api/staticmap?center=" . $latitude . "%2c%20" . $longitude . "&amp;amp;zoom=" . $zoom . "&amp;amp;size=10x10&amp;amp;maptype=roadmap&amp;amp;sensor=false&amp;amp;key=" . $mapsApiKey;
// echo "
";
// echo $apiCall;

?>

document.addEventListener('DOMContentLoaded', function() {

// Gets the image from the API call
var apiCall = '';
// alert(apiCall);

// Set image source as constructed API call string
var img = new Image;
img.crossOrigin = "anonymous"; // To fix the security issue of reading images from other sources
var src = apiCall;

// Sets up the canvas
var canvas = document.getElementById("myCanvas");
var ctx = canvas.getContext("2d");

// Fill in the backgorund color with red so we can see it
// ctx.fillStyle = "#FF0000";
// ctx.fillRect(0, 0, 10, 10);

// // Download the image
img.onload = function() { // ...then set the onload handler...
ctx.drawImage(img, 0, 0);

// Get color of image
var imgData = ctx.getImageData(0, 0, 1, 1);
var red = imgData.data[0];
var green = imgData.data[1];
var blue = imgData.data[2];
var alpha = imgData.data[3];

// Hides the canvas as we are not interested in seeing it
canvas.style.display="none";

console.log("red: " + red + " green: " + green + " blue: " + blue + " alpha: " + alpha);

// Determine if this response is WATER or NOT WATER
if (red == 170 &amp;amp;&amp;amp; green == 218 &amp;amp;&amp;amp; blue == 255) {
document.getElementById("findings").innerHTML = "WATER";
} else {
document.getElementById("findings").innerHTML = "NOT WATER";
}
};
img.src = src; // because the internet says you should put your src after your load

}, false);

Debugging without the console is like flying blind

I’m mentoring a highschool student at Iolani High School in the Robotics department.

Read Part Two if you’re interested in learning how we hacked the Google Maps API.

They’re building an autonomous catamaran to take various readings in the canal to monitor the health of the water source.

The student that I’ve been mentoring was tasked with creating 2 front end webpages for the project.

The first page is meant to take all of the sensor readings and display them on a graph so that other users can visually work through the data.

The second page allows users to tell the catamaran where it needs to travel to next by feeding it a GPS coordinate.

In this blog post I’ll share how we trouble shot the first issue. Read the second part of this story if you’re interested in seeing how we hacked the Google Maps API to get it to do what we needed it to do.

We worked on creating the first page with Google App Scripts to get the data from the catamaran and to populate a spreadsheet. The student ran into some problems getting the Javascript to populate the spreadsheet and emailed me:

I am having problems passing an array from my html document to a function in google script document.
I attached images of my code, but if it would be easier to view another way please let me know.

In the html document, the getCoord function (lines 110-120) I am cycling through an array of markers. First, I’m checking to see if the markers are visible on the map, then use getPosition to push the coordinates of the marker into an array named coord. I think something is going wrong here, and the array is empty when it gets sent to the google script document in line 81.

Previously, I passed the markers array to the google script document, but I don’t think getPosition works when it is not in the html document. In line 79, I tested getPosition in the html document and it does return the coordinates of the marker.
In the google script code, I want to input the coordinates into a google sheet. I’ve passed strings from the html document to the google script code which were successfully added to the google sheet. So, I think the syntax is correct.

Please email me if you know what may be going wrong or have any ideas about how to get around this.

I traced through the code and sent the following message back:

Thanks for sending over the code. I managed to find a few issues in the code and I’m happy to help.
The first issue is in index.html where you get the length of the markers array. You’re using markers.getLength(). Getting the length of an array in JavaScript is written as markers.length.
I found this error by using JavaScript’s console.log() function. Please let me know if you want some advice on how to use this debugging function to check on the state of variables in the web browser.
She took the feedback and did a lot more work than I thought she would be able to do.
Lesson learned: Debugging without the console is like flying blind.
That was it for the first page. In Part Two I’ll share a hilariously “hacky solution” we are using to determine if a GPS coordinate on water or land.

The real power of digital memories will be to trigger our human ones

I finished reading Clive Thompson’s “Smarter Than You Think” about 2 weeks ago. The topics have had time to stew. Now it’s time to put these thoughts down in a blog post. Here we go!

There is no question that technology is changing the world. Marc Andreessen famously said, “Software is eating the world.”

Thompson takes it a step further. Not only is software eating the world, it’s eating us, masticating us, and pooping us out changed for better or for worse. It all depends on how you see the world.

“Smarter Than You Think” contains stories that show that the contest between humans and computers has been settled. When IBM’s Deep Blue beat Kasparov, it signaled the end of human intelligence and the ascendance of the T-1000.

Read a bit further and Thompson makes his real point. In a battle of intellect between humans and computers, the computer will always win. However, team up the computer and the human and they beat computers!

Here is a procedure for pairing humans and computers to win the game of life in 2019:

“The one thing that both apocalyptics and utopians understand and agree upon is that every new technology pushes us toward new forms of behavior while nudging us away from older, familiar ones.” – Thompson

What happens when we get nudged too far from what we’re used to?

“Any economist will tell you that when you suddenly increase the availability of a resources people do more things with it, which also means they do increasingly unpredictable things.” – Thompson

What will we do with the power that we have harnessed from computers? What happens when our iPhones do more than just storing our images? What do we do with all these digital memories?

“The real power of digital memories will be to trigger our human ones.” – Thompson

Then what happens when we’re overwhelmed with too many digital memories?

“Viktor Mayer-Schonberger, the author of ‘Delete: The Virtue of Forgetting in the Digital Age’, says we’ll need to engineer more artificial forgetting into our lives. He argues our life traces would consist only of the stuff we’ve actively decided ought to stick around a day, a week, forever.” – Thompson

Contemplation is required to order this new chaos.

“We do not write in order to be understood; we write in order to understand.” – Thompson

Then we share it with the world.

“One of the unspoken cardinal rules of online expression is be more interesting – the sort of social pressure toward wit and engagement that propelled coffeehouse conversations in Europe in the nineteenth century.” – Thompson

And people comment.

“People walk around with tons of information and wisdom in their heads but with few outlets to show it off. When you see someone asking a question on a subject you know about, it catalyzes your desire to speak up.” – Thompson

And that commenting adds up to more commenting.

“Academic research into question-answering sites has found that answering begets answering: people who respond to questions are likely to stick around for months and and answer even more.” – Thompson

But never be negative in your responses.

“Negative comments create a loop: they poison the atmosphere, chasing off productive posters.” – Thompson

Why do you need to participate in your own evolution in this digital life? Why don’t we level up each other to make it easier?

“The fun in a game isn’t in having mastered it. It’s in the process of mastery – of figuring out the invisible dynamics behind how the thing works, revealing its secrets.” – Thompson

Thought the internet would save you from having to network in the real world? Think again!

“Reaping the cognitive benefits of the Internet often requires social work. This distresses anyone for whom social work is a chore or seems beneath them.” – Thompson

Above all be authentic:

“It’s about authenticity and bringing new information into the network. Those are the people whose message actually spreads. Quality, delightfully, seems to matter.” – Thompson

Above all be visible:

“To make social change begin to snowball, we need to make our thoughts visible. When members of society think in public and keep in ambient contact with one another, it creates a new environment – where we’re increasingly aware of what changes might be possible.” – Thompson

Above all, participate!

“Evidence suggests that the more socially active people are online, the more civically active they are offline, too.” – Thompson

I hope this blog helped you more clearly envision the changing world we are living in. By writing, sharing, and pairing with your computer I hope you more clearly see how to evolve by spreading your thoughts and participating with others to reap the benefits of the network.  I hope that these posts allow you to see your evolving position in the world. I hope the coming changes provide you with great riches and good health.

If this post clarified things for you, please contact me!