Profile

Cover photo
Chris Dawson
Works at Webiphany
Attended University of Washington
Lives in Portland, OR
281 followers|253,327 views
AboutPostsPhotosYouTube+1's

Stream

Chris Dawson

Shared publicly  - 
 
My son, at the beach.
1
Add a comment...

Chris Dawson

Help Center  - 
 
So, this is a threading question, I think.

I recently wrote a "toy" Android app (https://github.com/xrd/technocrat-android) for this webinar I presented for O'Reilly ("Building Slackbots with Hubot in a Docker playground": http://www.oreilly.com/pub/e/3711).

The app has a custom view with an onDraw() method where I draw the "batsignal." This 30 second video demonstrates what it should look like, but this is somewhat faked: https://www.youtube.com/watch?v=j4nBTzzTskg.

The code seems more complex that it needs to be. Right now, I have a while(true) loop (https://github.com/xrd/technocrat-android/blob/master/app/src/main/java/com/inqry/technocratsignal/MainActivity.java#L106) and inside that I call an AsyncTask named "LongOperation." Its only function is to call the custom view's update() method to trigger a redraw. Since this is UI code, I feel like I should be able to call the update() method right inside the main calling function (initializeTechnocratSignalViewAndServerPoll), rather than by instantiating an AsyncTask and then calling update() inside the onPostExecute() function.

I put together a branch (https://github.com/xrd/technocrat-android/blob/easier_flow/app/src/main/java/com/inqry/technocratsignal/MainActivity.java#L48) which simplifies the code, but when I run it, I just get a white screen where the custom view should be running. I have no idea why, in the debugger it definitely can find the view using findViewById (it is not null) but it never enters the onDraw() method if I set a breakpoint there.

And, this "working" code is really just a demo anyway. I just turn the "batsignal" to on manually once it has hit 9 seconds. In real life, I want to poll a JSON server endpoint and if the results of that say to turn on the batsignal, then do it. But, when I tried to put an AsyncTask inside the Runnable in which I am running this code, it didn't work. I imagine I'm not supposed to start a thread inside a thread, which is itself inside the main UI thread. Right? If so, is there a pattern for notifying the UI thread from inside a Runnable?

Anyone interested in pulling this code and seeing if the master branch and the easier_flow branch work for them?

Thanks for your eyeballs.
1
2
Wilhelm Fitzpatrick's profile photoChris Dawson's profile photo
3 comments
 
Thanks +Wilhelm Fitzpatrick​. This is great, I'll give these suggestions a try.
Add a comment...

Chris Dawson

Discussion  - 
 
Hi, I just wrote a book for O'Reilly on the GitHub API. There is a chapter in the book that explains how to write a single page app that speaks to the GitHub API using Github.js and AngularJS. The chapter includes Karma (using Jasmine) tests, and one of the reasons I chose AngularJS for the book was its strong commitment to testable JS code. Note there is no ReactJS chapter. :)

All the code samples are here: github.com/xrd/building-tools-with-github

You can find the book here: shop.oreilly.com/product/0636920043027.do

And, until tomorrow there is a good deal on all GitHub ebooks (50% off). http://shop.oreilly.com/category/deals/github.do?mobile=off&code=WKGTHB

Hope this helps people interested in writing testable AngularJS applications. Happy to answer questions on the code samples even if you don't buy the book. 
7
Add a comment...

Chris Dawson

Shared publicly  - 
1
Add a comment...

Chris Dawson

Shared publicly  - 
1
Add a comment...
In his circles
471 people
Have him in circles
281 people
Robson Ribeiro's profile photo
Brad Pearson's profile photo
Gallon Wang's profile photo
Takashi EGAWA's profile photo
Carl Cox's profile photo
Joel Leitch's profile photo
Rafael Solis's profile photo
Bissasse TUBE's profile photo
C Herteg's profile photo

Chris Dawson

Shared publicly  - 
1
Add a comment...

Chris Dawson

Shared publicly  - 
1
Add a comment...

Chris Dawson

Open Source Apps  - 
 
Hi, I just wrote a book for O'Reilly on the GitHub API. There is a chapter in the book that explains how to write an Android application that speaks to the GitHub API and writes Jekyll blog posts. The chapter includes both unit tests and Espresso tests. Note there is no iOS chapter! :)

All the code samples are here (including the full Android application which can be built from the command line with gradle): github.com/xrd/building-tools-with-github

You can find the book here: shop.oreilly.com/product/0636920043027.do

And, until tomorrow there is a good deal on all GitHub ebooks (50% off). http://shop.oreilly.com/category/deals/github.do?mobile=off&code=WKGTHB

Hope this helps people interested in writing testable Android applications. Happy to answer questions on the code samples even if you don't buy the book. 
3
Add a comment...

Chris Dawson

Shared publicly  - 
1
Add a comment...

Chris Dawson

Shared publicly  - 
 
On "Back to the Future 2" day, this needed to be published: "Monotone, Git, Linus and Marty McFly" http://webiphany.com/2015/10/21/monotone-git-linus-and-marty-mcfly.html
1
Add a comment...

Chris Dawson

Shared publicly  - 
 
Good times with grandpops last year. A great tradition. 
1
Joe T. aka Lucki Krow Joe's profile photo
 
Yo Chris! This looks like a new character scene from The Walking Dead!! You need to send this to AMC! All the actors are on here!
Add a comment...

Chris Dawson

Shared publicly  - 
 
I don't really care that someone on Facebook suggested this was nudity. I do wonder if Google's new image searching would find this photo if you searched for genitalia. I would argue it does not contain it. Oh well. Just remember the reason for the World Naked Bike Ride is that the creator said (paraphrased) "I could talk for hours about bike safety and people would ignore me. Have a naked bike ride and everyone is all atwitter." So, basically obscenity is rooted in the conflict between cars and bike commuting. 
1
Joe T. aka Lucki Krow Joe's profile photo
 
And it was created to highlight the negative effects of fossil fuels!!! 😉👍
Add a comment...
People
In his circles
471 people
Have him in circles
281 people
Robson Ribeiro's profile photo
Brad Pearson's profile photo
Gallon Wang's profile photo
Takashi EGAWA's profile photo
Carl Cox's profile photo
Joel Leitch's profile photo
Rafael Solis's profile photo
Bissasse TUBE's profile photo
C Herteg's profile photo
Education
  • University of Washington
  • Reed College
Basic Information
Gender
Male
Birthday
December 11
Apps with Google+ Sign-in
  • Monument Valley
Work
Occupation
CEO/President
Skills
JavaScript, Ruby on Rails, Android, Linux
Employment
  • Webiphany
    2001 - present
  • Box Populi
    CEO/President, 2003 - 2010
  • RealNetworks
    Application Engineer, 1999 - 2001
  • Virage
    Software Engineer, 2001 - 2003
  • Claris (Apple)
    Software Engineer, 1996 - 1997
Places
Map of the places this user has livedMap of the places this user has livedMap of the places this user has lived
Currently
Portland, OR
Previously
Portland, OR - Sapporo, Japan - Kanazawa, Japan - Rio de Janeiro, Brazil - Salvador, Bahia, Brazil - Seattle, WA
Links
Chris Dawson's +1's are the things they like, agree with, or want to recommend.
Millennials to Snake People
chrome.google.com

Replaces the text 'Millennial' with 'Snake People'.

Freehand Drawing
market.android.com

Freehand drawing is the simple drawing canvas. User can draw any shape and save them as image.Simple and light size of just 20Kb. :)Can be u

Fala Geral
market.android.com

Shop Google Play on the web. Purchase and enjoy instantly on your Android phone or tablet without the hassle of syncing.

the quiet place
amitaytweeto.com

have you ever noticed how many things require your attention?

Input/Output - Google I/O 2012
developers.google.com

Google I/O 2012 brings together thousands of developers for three days of deep technical content focused on building th

Aldiko Book Reader
market.android.com

Read and download thousands of eBooks right on your Android phone or tablet.Download one of the best Android eBook Readers now!★The leading

MediaHouse UPnP / DLNA Browser
market.android.com

Stream music, videos, movies and pictures from PC, NAS or any other device running UPnP/DLNA compliant media server. MediaHouse powers your

Google I/O 2012
developers.google.com

Google I/O 2012 brings together thousands of developers for three days of deep technical content focused on building th

The Story of Send
www.google.com

Follow an email on its journey to see what happens when you send a message. Along the way, discover our data centers with videos and photos.

Portland Real Estate & Homes for Sale Portland
ericsteindler.com

Portland Real Estate & Homes for Sale: Search all active real estate listings in the Portland area including bank owned foreclosures,REO

American Ninja
www.youtube.com

Spoof / Parody of "American Woman" by the Guess Who with a Ninja Twist.

Seven Steps to Creating a Data Driven Decision Making Culture.
www.kaushik.net

Home; Press, Videos, Podcasts; Speaking Engagements; Knowledge; About ▼. Avinash Kaushik; Mi Pequeña Pasión; Occam's Razor – What ? Disc

Moving Teachings: learn and teach on public transportation
www.youtube.com

MovingTeachings.com helps you connect with people sitting next to you on the bus. Everyone has a hidden talent; use MovingTeachings.com to e

AtmTag.com: stop paying outrageous ATM fees
www.youtube.com

Use AtmTag.com on your mobile phone to search for the closest and least expensive ATM for you.

"Cloud Atlas" in The New Yorker's Archive : The New Yorker
www.newyorker.com

In this week’s issue, Aleksandar Hemon chronicles Lana and Andy Wachowski’s long journey to make a film adaptation of David Mitchell’s best-

The Bravest Man in the Universe
www.bravestman.com

Join Bobby Womack in an interactive music journey. A Mobile Chrome experiment.

Web Lab: Orchestra
www.chromeweblab.com

Web Lab. A series of interactive Chrome Experiments made by Google. See the magic of the web brought to life. Open to the world online. Live

How to Get Me Involved in Your Smartup
jeffsayre.com

I receive six to eight requests for help from startups each year—from angel investing, to advising, to consulting, to joining as a founder.

Three Months, Three Weeks &Two Days
market.android.com

Shop Google Play on the web. Purchase and enjoy instantly on your Android phone or tablet without the hassle of syncing.