Category Archives: geek

Recreating and enhancing my tracking interface by using Tasker and Javascript

I got tired of setting up Tasker scripts by tapping them into my phone, so I looked into how to create Tasker interfaces using Javascript. First, I created a folder in Dropbox, and I used Dropsync to synchronize it with my phone. Then I created a simple test.html in that folder. I created a Tasker scene with a WebView that loaded the file. Then I started digging into how I can perform tasks, load applications, and send intents to Evernote so that I can create notes with pre-filled text. I really liked being able to reorder items and create additional screens using Emacs instead of Tasker’s interface.

Here’s my code at the moment. It relies on other Tasker tasks I’ve already created, so it’s not a standalone example you can use right off the bat. Still, it might be useful for ideas.

tasker-scripts/test.html:

<html>
    <head>
        <title>Sacha's personal tracking interface</title>
        <style type="text/css">
         button { padding: 20px; font-size: large; width: 45%; display: inline-block  }
        </style>
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
    </head>
    <body>
        <div id="feedback"></div>
        <!-- For making it easy to track things -->
        <div class="screen" id="main-screen">
        <button class="note">Do</button>
        <button class="note">Think</button>
        <button class="note">Note</button>
        <button class="note">Journal</button>
        <button class="switch-screen" data-screen="track-screen">Track</button>
        <button class="switch-screen" data-screen="play-screen">Play</button>
        <button class="switch-screen" data-screen="eat-screen">Eat</button>
        <button class="switch-screen" data-screen="energy-screen">Energy</button>
        <button id="reload">Reload</button>
        </div>
        <div class="screen" id="play-screen">
            <button class="play">Persona 3</button>
            <button class="play">Ni No Kuni</button>
            <button class="play">Hobbit</button>
            <button class="switch-screen"
                    data-screen="main-screen">Back</button>
        </div>
        <div class="screen" id="energy-screen">
            <button class="energy">5</button><br />
            <button class="energy">4</button><br />
            <button class="energy">3</button><br />
            <button class="energy">2</button><br />
            <button class="energy">1</button><br />
            <button class="switch-screen"
                    data-screen="main-screen">Back</button>
        </div>
        <div class="screen" id="eat-screen">
            <button class="eat">Breakfast</button>
            <button class="eat">Lunch</button>
            <button class="eat">Dinner</button>
            <button class="switch-screen"
                    data-screen="main-screen">Back</button>
        </div>
        <div class="screen" id="track-screen">
            <button class="update-qa">Routines</button>
            <button class="update-qa">Subway</button>
            <button class="update-qa">Coding</button>
            <button class="update-qa">E1 Gen</button>
            <button class="update-qa">Drawing</button>
            <button class="update-qa">Cook</button>
            <button class="update-qa">Kitchen</button>
            <button class="update-qa">Tidy</button>
            <button class="update-qa">Relax</button>
            <button class="update-qa">Family</button>
            <button class="update-qa">Walk Other</button>
            <button class="update-qa">Nonfiction</button>
            <button class="update-qa">Laundry</button>
            <button class="update-qa">Sleep</button>
            <button id="goToWeb">Web</button>
            <button class="switch-screen" data-screen="main-screen">Back</button>
        </div>
        <script>
         function updateQuantifiedAwesome(category) {
             performTask('Update QA', null, category);
             hideScene('Test');
         }

         function showFeedback(s) {
             $('#feedback').html(s);
         }
         function switchScreen(s) {
             $('.screen').hide();
             $('#' + s).show();
         }

         $('.switch-screen').click(function() {
             switchScreen($(this).attr('data-screen'));
         });
         function createEvernote(title, body) {
             sendIntent('com.evernote.action.CREATE_NEW_NOTE', 'activity',
                        '', '', 'none', '', '',
                        ['android.intent.extra.TITLE:' + (title || ''),
                         'android.intent.extra.TEXT:' + (body || '')]);
         }
         $('.note').click(function() {
             createEvernote($(this).text());
         });
         $('.energy').click(function() {
             createEvernote('Energy', 'Energy ' + $(this).text() + ' ');
             switchScreen('main-screen');
         });
         $('#reload').click(function() {
             performTask('Reload Test');
         });
         $('.update-qa').click(function() {
             updateQuantifiedAwesome($(this).attr('data-cat') || $(this).text());
             hideScene('Test View');
         });
         $('#goToWeb').click(function() {
             browseURL('http://quantifiedawesome.com');
         });
         $('.eat').click(function() {
             updateQuantifiedAwesome($(this).text());
             loadApp('MyFitnessPal');
         });
         $('.play').click(function() {
             performTask('Play', null, $(this).text());
         });

         switchScreen('main-screen');

         </script>
    </body>
</html>

You can find the latest version at https://github.com/sachac/tasker-scripts.

Thinking about simplifying capture on my phone

I’ve been thinking about temporary information: things like where I put down something I was holding, the task I’m working on just in case I get interrupted, thoughts that I want to explore later on.

The seeds of a good system are there, if I learn how to use them more effectively. I usually have my phone handy. Evernote can record audio, pictures, or text, and the creation date is an automatic timestamp. I can export the notes and process them using Emacs. Google Now’s “Note to self” command can create a note in Evernote, or I can tap the Create Note icon.

How can I improve how I use these tools?

If I get used to starting my note lines with a special keyword, then it’ll be easier for me to extract those lines and process them. For example:

DO Actions to add to my to-do list
THINK Thoughts to explore
PLACE Putting things down

If I add custom commands to Google Now, or make Google Now the fallback for another command line, then I can use that for my tracking system as well. AutoShare and AutoVoice might be handy. I should probably learn how to get Tasker working with Javascript, too. Alternatively, I can use Evernote’s e-mail interface, although there might be a slight delay if I’m offline.

If I create a custom single-click interface that can start the note with a specified keyword, that would be even better.

I could also use a more systematic review process. For example:

  • All THINK items can be automatically added to the end of my

questions.org as their own headings.

  • All DO items can be added to my uncategorized tasks.

Okay, let’s start by figuring out Javascript and Tasker, since that will make it easier for me to write actions that take advantage of intents.

First step is to save the JS library template from Tasker. The file is stored in /storage/emulated/0/Tasker/meta/tasker.js. Okay, I’ve created a Tasker scene that has a WebView component that loads the file that I synchronized with Dropsync.

The next step is to simplify development so that I can try things quickly. I want to be able to sync and reload my WebView scene by tapping a button. The Dropsync Tasker action returns immediately, so maybe I’ll just add a wait to it.

Hmm, maybe a good path might be:

  1. Set up easy sync/reload, so I can try things out quickly.
  2. Include JQuery.
  3. Run tasks.
  4. Launch apps.
  5. Send intents.
  6. Convert my current tracking menu to this format.
  7. Add buttons for creating notes (either e-mail-based or intent-based):
    • Do
    • Think
    • Place
  8. Add a command-line. Compare using it vs. using buttons.

On a related note, what kinds of things would I like my phone to be smart enough to do?

  • If I’m at home and I’m calling my cellphone from our home phone, set the ring volume to maximum, since that means I’m trying to find it.
  • If I say that I’m at a social event, ask me who I’m spending time with. Track that. Create a note with the person’s name as the title and “social” as the tag.
  • If I’m going to sleep, track that, then start tracking in Sleep as Android.
  • If I’m going to play a game, track that, then ask me what I’m going to do afterwards and how long I want to play. Load hints for the game (if I want). After the specified time, make a sound and remind me of what I was going to do.
  • If I’m going to read a book, show me the list of my checked-out books and let me pick one of them. Track that, then create a note with the title and author so that I can take notes.
  • NFC opportunities:
    • If I scan at the door, show me a menu: walk, subway, groceries, family, bike.
    • If I scan in at the kitchen table, track it as breakfast / lunch / dinner (as appropriate), then launch MyFitnessPal.
    • If I scan in at the table in front of the TV, show me a menu: relax, nonfiction, fiction, games.
    • If I scan in at my bedside table, treat it as going to sleep.

Mmm… Little things to tweak. =)

A deeper dive into absent-mindedness and misplacing things

I haven’t misplaced anything today, but I know I will at some point. This week? This month? Definitely this year, and probably more and more as the years go by. It got me thinking about misplacing things, and what I might be able to do about that.

When or why do I misplace things?

  • Active
    • Putting something down in one of many frequent places
    • Putting something down in an infrequent place
    • Getting distracted half-way and putting something down somewhere I don’t remember
    • Putting something down because my hands are full and I need to pick up something else
    • Putting something in a place that’s similar to but not the same as the place it should be, and not catching the mistake
    • Putting something somewhere near it should be instead of where it should be because that place is occupied or inaccessible
    • Putting something away for the long term, then forgetting where it is
    • Putting something away, then forgetting whether I have it or not
    • Putting aside something in progress or waiting for something else, then forgetting where it is or when I need to get back to it (ex: mismatched socks)
    • Shuffling things into similar things (ex: papers)
    • Making a mental note of where I put something, but not remembering it well enough
  • Passive
    • Someone moving or dislodging something from where I expect it to be
    • Forgetting to check for things that have accidentally fallen or been left behind (ex: gloves, scarves, things in pockets)
    • Leaving things in an opaque container for convenience, and then not taking them out and putting them away (ex: gloves)
    • Things falling out of pockets or through linings, un-noticed
    • Familiar tasks in familiar environments lead to automatic thinking and reduced attention
    • Forgetting to prepare or take something
    • Gaps when retracing steps
  • Retrieval
    • Skipping over something because something else is covering it or obstructing my view
    • Looking at something but not recognizing it
    • Limiting my field of view unnecessarily
    • Misremembering things that are similar to things I remember getting rid of, so I don’t look for them
    • Not searching in a systematic manner
    • Having a false memory of putting something away in a different place
      • Confusing with previous memory
      • Confusing plans with reality

What tools and tactics do people use to minimize the hassle of misplacing things?

  • Build automatic habits
    • Have one clearly defined place for each thing, or very few clearly defined places
    • Explicitly encode memories around picking things up or putting things down
      • Looking
      • Mental note
      • Note to self, out loud
      • Text note
      • Audio note, recorded
      • Picture
    • Have a handy holding place for in-between things or miscellaneous things, and review this frequently (ex: bin, belt bag)
  • Reduce retrieval costs
    • Regularly tidy with fresh eyes
    • Make lists of where things are
    • Label containers with their contents (ex: cabinets)
    • Keep things clear and tidy
  • Label
    • Label things so that in case they’re lost, someone might be able to return them to you
    • Offer rewards
  • Reduce the need for the item
    • Replace or supplement often-misplaced identification with always-present information or more frequently used devices (ex: biometrics, keycodes, smartphone)
    • Buy or budget for replacements (ex: pens)
    • Keep extra stock of items in multiple places (ex: pens)
    • Minimize the number of unneeded things you carry, and keep other things in a known place (ex: infrequently-used keys)
    • Eliminate the item entirely
  • Add alerts
    • Track location (ex: smartphones, parking)
    • Add proximity alerts (ex: smartphone-laptop Bluetooth proximity detection, tracking stickers)
  • Fill in gaps
    • Retrace steps
    • Ask someone else who might be able to look with fresh eyes or who might have different memories

When are these tools particularly useful?

From “External and internal memory aids: when and how often do we use them?” (Intons-Peterson and Fournier, 1986):

  • When intervening events may interfere
  • When there’s a long delay between encoding and retrieval
  • When accuracy is important
  • When information is difficult to remember
  • When there’s limited time to remember
  • When you want to avoid the effort of remembering

Based on these thoughts, what can I tweak about my life? Maybe I can pay closer attention to incidents of misplaced things and other action slips over the next few weeks so that I can see where the gaps are….

Building tools for myself: grocery receipt tracking

Today was another good day for writing code. I finally built that quick-feedback receipt item tracker I’ve been thinking about for a while. I’d built a simpler version into Quantified Awesome (not linked from the main interface, since it was very rough), but I found the browser roundtrip too disruptive. Today’s implementation uses Angular for faster responses. For good measure, I’ve got a NodeJS server proxying the requests to either my local development copy of Quantified Awesome or to my production version.

Here’s a screenshot:

2015-05-26 22_21_38-sachachua.com_8080_receipt

On the left side, I have a scanned receipt in Autodesk Sketchbook Pro (or a paper receipt on the side). On the right, my autocompleting tracking interface. It’s not pretty, but it fits what I have in my head. I like the way that typing in the first few characters of the receipt line item is often enough to uniquely identify the receipt item type and retrieve the price history. This means that as I track, I also get a sense of the price trends and what a good sale is.

Aside from keeping track of the prices, I’m also looking forward to analyzing our consumption by category on a more regular basis. I did a few analyses along those lines before (here’s a year of data), but it might be neat to have that kind of feedback on a daily basis. Entering my receipt archive was easy. I ended up typing in the receipts from here to January because it was fun. =)

Next up: fast categorization, some graphing… I’m also looking forward to making a quick price book interface. Hmm, if I dust off that grocery list tool I had started building into Quantified Aweome and I integrate the price book, that might be handy.

Thinking about adaptive menus for tracking

I’ve been thinking about building more tools for myself. Some of the ideas I’ve been playing around with are around simplifying activity tracking further, possibly getting it to the point where it suggests things for me to do when my brain is fuzzy.

My current tracking system has two tiers. For my most-common activities, I use a custom menu that I can open from my phone’s home screen. I created the menu using Tasker. It’s easy to configure menu items to update my Quantified Awesome activity records as well as run other logic on my phone. For example:

  • “Eat dinner” creates an activity record for “Dinner”, then starts MyFitnessPal so that I can log the meal
  • “Walk home” creates an activity record for “Walk – Other”, then starts step-by-step navigation of the walk back to my house
  • “Sleep” creates an activity record, then launches Sleep as Android
  • “Ni No Kuni” creates an activity record, prompts me for what I want to do after an hour of playing, opens a page with tips for the game, and then reminds me of my plans after that hour passes

One advantage of using something on my phone is that I don’t have to wait for the initial web page from Quantified Awesome to load. My keyboard occasionally takes a while to come up, too, so the menu-based interface gets around that as well. Also, as I get the hang of using Tasker, I can set up more intelligent processes. The menu has a link to open the web version, so if I want to track something less frequent, I can always use the web interface.

In the web interface, I usually type a substring to identify the category I want to track. For example, “kitch” results in an activity record for “Clean the kitchen”. I use this interface if I need to backdate entries (ex: -5m), too.

In addition to the two interfaces above, I’ve been thinking about taking advantage of the predictability of my schedule.

Research into adaptive menus turns up quite a few design ideas and considerations. Since I’m building this for myself, I can get around many of the challenges of adaptive interfaces, such as privacy and predictability. I’m curious about the following options:

  • Text-based input with minimal cues, as part of a more powerful command line
  • Context-sensitive menu with a handful of items (3-4, with a link to more): I can probably suggest candidate activities based on the past two activity records. That might mean a little bit of latency as I check, though. It also means that the menu will keep shifting, so I’ll need to read it and find the item I want to click on.
    • For everyday use?
    • For really fuzzy moments?
  • Static menu of frequent items, but adaptive highlighting (ex: green or bold, or fading out other things slightly)
    • Abrupt onset, others fading in over 500ms
    • Colour?
    • Weight?
  • Split menu: frequent items on top, everything else below
    • Static
    • Adaptive
  • Hierarchy of menus: speedy, but lots of tapping
  • Cut off menu: show only the activities that come after the one I’ve just tracked

Hmm… It might be interesting to play around with different menu options. It would be good to experiment with NFC as well, especially early in the morning. =)

Related:

Shifts in my writing

Sometimes, when I sit down to draw my five index cards of the day, I have a hard time delineating five interesting thoughts – things I want to remember or share. They often seem so inward-turned.

I was thinking about the shape of my blog, too. I feel like I’ve shifted from a lot of technical posts to a lot of reflective posts. Possibly less interesting for other people, but useful to me. It’s hard to tell. These are the kinds of posts I’ve been starting to find useful in other people’s blogs, anyway, so who knows? Maybe these things are interesting for other people too.

It’s wonderful to be able to flip back through my archive and see the patterns over time. Of the 2,800+ posts in my index as of April 2015, I’d classify around 170 as mostly reflective. (Totally quick classification, just eyeballing the titles and categories in my index.) Here’s the breakdown:

Year Reflections
2008 4
2009 9
2010 20
2011 7
2012 25
2013 20
2014 59
2015 25
Grand Total 169

While writing a recent post, I searched my archives to trace the evolution of my understanding of uncertainty over several years. I can remember not having these snapshots of my inner world. When I reviewed ten years of blog posts in preparation for compiling Stories from My Twenties in 2013, I was surprised by how many technical and tip-related blog posts I skipped in favour of keeping the memories and the questions, and the sense of things missing from my memories. Maybe that’s why I wrote almost three times the number of reflective posts in 2014 as I did in the previous year. 2014 was also the year I switched the focus of my experiment from other-work to self-work, and that might have something to do with it too. I’m glad I have those thinking-out-loud, figuring-things-out posts now.

The end of April was around 33% of the way through the year, so I’m slightly ahead of last year’s reflective-post-density (expected: 20 posts, actual: 25). Comments are rare, but I’ve learned a lot from them.

I’m fascinated by the ten-year journals you can buy in bookstores. They give you ways of bumping into your old selves, noticing the differences. I like the way blogs give me a little bit more space to write, though. =) Here’s a slice of my life going through May 14:

I have shifted. I focus on different things. I like the direction I’m going in. I can imagine, years from now, getting very good at asking questions, describing and naming elusive concepts, and exploring the options. If it seems a little awkward now, that’s just the initial mediocrity I have to get through. Hmm…