Monday, December 21, 2015

Pirates, Ninjas and Dreidels, Oh My!

I explained to my little buddy Nathan, that traditionally, we played dreidel with M&M's, like our ancestors surely did. But we didn't have any M&M's in the house, so he suggested we play with the Ninja vs. Pirate Army Men I had on hand.

And so we did!

He selected his army of pirates, I an army of ninjas (5 strong, each), his Dad and Sister joined in the fun, and the game began! Sadly, I was defeated in both games we played. That little pisher sure can spin!

Good times!

Friday, December 18, 2015

Smart Phone, Dumb Watch: Implementing a Pebble Pedometer

My Galaxy Note 5 has a built in step counter. However I find that every time I want to check it, I have to bring up the S Health App and dig around until I can find the screen I'm looking for. Further more, I'd love to be able to track steps for a given activity. Think electronic Ranger Beads. S Health will give me a pretty graph of my steps, but not the one number I want. I've tried looking for a lighter weight pedometer app, but every one I've found has been an ad infused disaster.

By now you know where I'm going with this: this is the perfect job for my Pebble. The Pebble classic lacks the step counter that the phone has, but provides the streamlined UI that I'm after. Here's what my Steps 'App' looks like on the Pebble Classic:

There's really not much to it. I select the Steps option on the home menu, and from there, I can see my Steps Since value, as well as the daily total and the previous 4 days. Steps Since is the arbitrary activity counter I mentioned. I can clear it from the watch anytime I want.

Behind the scenes the phone is tracking both the daily and steps since activity in text files. If I ever want to use this data for other purposes, I can.

The above is all written in Tasker and leverages AutoPebble. Most of this little app is pretty obvious, but I did have a few hurdles to get over.

First, it wasn't obvious to me how to gain access to the step counter. One would assume there's a magic Tasker variable, %STEPS you can query. That's not the case. Instead, you need to setup a profile which will be notified when N steps have been taken. Within this profile, I set that global variable I'm after. See:

Profile: Steps Taken Tracker (109)
  Event: Steps Taken [ Number:10 ]
  Enter: Anon (110)
    A1: Variable Add [ Name:%STEPS_DAILY Value:10 Wrap Around:0 ]
    A2: Variable Add [ Name:%STEPS_SINCE Value:10 Wrap Around:0 ] 

I setup this profile to be notified every 10 steps, and as you can see, it updates both the daily and since global variables. I'm not sure what the impact of being notified of every step would be, but it just seems excessive.

To track steps on a daily basis I needed to save and clear out the %STEPS_DAILY value at midnight. That was also an easy profile to write:

 Profile: Steps Daily Reset (116)
  Time: 12:00AM
  Enter: Anon (117)
    A1: Write File [ File:Tasker/steps.txt Text:%DATE: %STEPS_DAILY Append:On Add Newline:On ]
    A2: Variable Set [ Name:%STEPS_DAILY To:0 Do Maths:Off Append:Off ]

Clearing the %STEPS_SINCE is done on demand. In this case I save the start, end dates as well as the step count for the period being cleared. I also send a vibration request to the watch so I get a signal that value has been cleared:

Pebble Steps Clear Since (119)
  A1: Write File [ File:Tasker/steps.since.txt Text:%STEPS_SINCE_STARTED %TIMES %STEPS_SINCE Append:On Add Newline:On ]
  A2: Variable Set [ Name:%STEPS_SINCE_STARTED To:%TIMES Do Maths:Off Append:Off ]
  A3: Variable Set [ Name:%STEPS_SINCE To:0 Do Maths:Off Append:Off ]
  A4: AutoPebble App [ Configuration:Full Screen: false
    Control App: Go Back
    Check Pebble Connected: false
    Other Pebble App: unknown
    No Prefix if Command: false
    Do Not Disturb: false
    Vibration Pattern: 300
    Clear History: false
    Open Phone App: false
    Save Scren: false
    Don't Send Screen: false
    Go Back: false
    Go Back Multi: false Package:com.joaomgcd.autopebble Name:AutoPebble App Timeout (Seconds):20 ]

One final challenge was that I wanted to show the last 4 days worth of step activity on the watch, however, steps.txt contains all activity. To get around this, I wrote an action: Tail File which will grab the last N lines from the file and return them. As you can tell, it's written in JavaScript, which means that the coding is straightforward. However, it's note especially efficient. I find no other choice but to read in the entire file as a string, which will be painful once steps.txt gets huge. But I'll deal with it then. (One solution: setup a Profile to rotate the file every month, and then the file won't grow past 30 lines or so.)

Tail File (132)
  A1: JavaScriptlet [ Code:var file = local("par1");
    var max = local("par2");

    var lines = readFile(file).split("\n");

    if(lines[lines.length-1] == "") {
      lines.pop();
    }

    max = Math.min(max, lines.length);
    while(max != lines.length) {
      lines.shift();
    }

    setLocal("lines", lines.join("\n")); Libraries: Auto Exit:On Timeout (Seconds):45 ]
  A2: Return [ Value:%lines Stop:On ] 

For completeness, here's the actions to show the steps menu and clear the steps since value. That should just about do it for this exercise:

Pebble Steps Menu (114)
  A1: Variable Set [ Name:%newline To:
  Do Maths:Off Append:Off ]
  A2: Perform Task [ Name:Tail File Priority:%priority Parameter 1 (%par1):Tasker/steps.txt Parameter 2 (%par2):5 Return Value Variable:%labels Stop:Off ]
  A3: Variable Split [ Name:%labels Splitter:%newline Delete Base:Off ]
  A4: Array Process [ Variable:%labels Type:Reverse ]
  A5: Array Push [ Name:%labels Position:1 Value:Today: %STEPS_DAILY Fill Spaces:Off ]
  A6: Array Push [ Name:%labels Position:1 Value:Since: %STEPS_SINCE Fill Spaces:Off ]
  A7: AutoPebble List [ Configuration:Full Screen: false
    Header: Steps
    Labels: %labels(:)
    Long Click Actions: steps_clear_since
    Last Line Height Default: false
    Remember Position: false
    No Prefix if Command: false
    Do Not Disturb: false
    Clear History: false
    Open Phone App: false
    Save Scren: false
    Don't Send Screen: false
    Go Back: false
    Go Back Multi: false Package:com.joaomgcd.autopebble Name:AutoPebble List Timeout (Seconds):120 ]


Profile: AutoPebble, Steps Clear Since (118)
  Event: AutoPebble [ Configuration:Command Filter: steps_clear_since
  Case Insensitive: false
  Exact: false
  Case Insensitive: false ]
  Enter: Pebble Steps Clear Since (119)
  A1: Write File [ File:Tasker/steps.since.txt Text:%STEPS_SINCE_STARTED %TIMES %STEPS_SINCE Append:On Add Newline:On ]
  A2: Variable Set [ Name:%STEPS_SINCE_STARTED To:%TIMES Do Maths:Off Append:Off ]
  A3: Variable Set [ Name:%STEPS_SINCE To:0 Do Maths:Off Append:Off ]
  A4: AutoPebble App [ Configuration:Full Screen: false
    Control App: Go Back
    Check Pebble Connected: false
    Other Pebble App: unknown
    No Prefix if Command: false
    Do Not Disturb: false
    Vibration Pattern: 300
    Clear History: false
    Open Phone App: false
    Save Scren: false
    Don't Send Screen: false
    Go Back: false
    Go Back Multi: false Package:com.joaomgcd.autopebble Name:AutoPebble App Timeout (Seconds):20 ]

Wednesday, December 16, 2015

AutoPebble Programming: From Phone to Watch in one click

Before I dive into another AutoPebble programming example, I suppose I should take a step back and explain why I think all this matters.

My Galaxy Note 5 has a great many advantages: amazing screen, gobs of RAM, brilliant camera, handy stylus and more. But compact and always accessible aren't traits on the top of this list. That's where the Pebble appears to come in. With just couple of quick presses on a device that's literally at hand, I can perform tasks on my phone. It's like I get the speed and convenience of an old school flip phone, but the computing power of a tablet. Add to this that AutoPebble allows for quick and easy integration between the phone and watch, and you can start to appreciate just why I'm so loving this setup.

On to the code. Good news, this is a far simpler example than my last hack. Still, I think it makes for a useful Smart Watch feature. Here's a Show Clipboard AutoPebble profile and action:

Profile: AutoPebble, Show Clipboard (86)
Restore: no
State: AutoPebble [ Configuration:Command Filter: show_clipboard ]
Enter: Anon (87)
  A1: AutoPebble Text Screen [ Configuration:Full Screen: false
                               Title: Clipboard
                               Text: %CLIP
                               Vibration Pattern: 200]

The action consists of exactly one command: show a screen on the watch with the text %CLIP. %CLIP is a magic Tasker variable that will always equal the contents of the system clipboard.

But why do you care, right? So you can do this:

Step 1: highlight and copy some text on your phone:

Step 2: select the Clipboard option on the watch and pull in the contents of the clipboard:

Step 3: stroll through the store with confidence picking up the right ingredients with only the occasional glance to your watch.

Random DC: Disabled Veterans, Model Trains and Hallowed Halls

Last night David and I took a random'ish walk through the US Capital area of DC and I was treated to not one, but three new (to me) and remarkable sites.

First up, the American Veterans Disabled for Life Memorial. Apparently, this is the only military memorial in DC that's independent of branch or conflict. This memorial strikes me as a tough one to get right: you don't want to glorify war, nor condemn it. You don't want to trivialize the challenges Veterans with disabilities face, nor turn them into inpsirational props. I think the monument struck this balance well, and most importantly, it gets the conversation started.

Lightening things up from there, we wandered over to the US Botanic Garden. It was past 5pm, so in theory, the garden should have been closed. But they're doing holiday events, so it was open. David and I got to wander through a nearly empty Botanic Garden, and take in the very cool holiday train display. Seriously, if you've got a Thomas obsessed little one, you definitely need to make your way to this exhibit. What the train room lacks in size it makes up for in interesting detail. Oh, and the whole thing is free. Definitely a winner activity.

As if moths drawn to the flame, after the garden we made our way towards the brightly lit US Capitol and its Christmas tree. As has become our tradition, David and I stood by the tree and lamented the fact that we celebrate the holiday season by killing a gorgeous 74 foot tree. The practice of which seems only slightly perverse. (I know, we're literally a bunch of tree huggers.) And from there we found ourselves outside the stately Russell Office Building. David was smart enough to find a visitor entrance, and after a quick security check, in we went.

The big deal behind the Russell Office Building is that it houses the offices of the US Senators. We wandered through the halls and passed office after office of well known Senator. I was such a tourist, peeking my head in wherever I could and snapping tons of photos. It was remarkable to consider that some of the most influential people in the country walk these halls on a daily basis, and we were just roaming the corridors like a bunch of kids cutting math class. The building has that old school ornate quality about it that makes every part of it look interesting (and causes you to repeatedly mutter: man, they sure don't make 'em like they used to). Definitely a fun experience.

For a small city, DC is truly packed with amazing treasures just waiting for you to practically trip over them.

Tuesday, December 15, 2015

I'm a Person. Really, I am.

I finished reading Danny Gregory's blog entry on Zork and was inspired to drop him a quick dude, well written! type comment when I ran into a fairly common snag. Whatever I wrote looked like it was from an automated bot engaging in comment spam. Anything I could think to write (Nice, Well Said!, Keep the great posts coming!) seemed so obviously canned that surely a real human wouldn't write such a thing.

This isn't a new problem. Back in the day, I used to answer live chat requests on my company website. Those chat sessions always made for interesting discussions (note to self: find and install a new live chat platform). One challenge that I'd run into is that some folks wanted me to prove that I wasn't a bot. No matter what information I provided to them, it only tended to support their hunch that they were talking to a machine. I don't have any of those transcripts handy, but here's how I recall them going:

 Me: Howdy! How can I help you?

 Visitor: are you a real person?

 Me: Sure.

 Visitor: prove it.

 Me: Let's see. My name is Ben. It's currently cold outside.
     I'm sitting here in sweatpants.

 Visitor: are you really a person?

 Me: Yes. Really. I promise.

 ...

Just reading the above transcript I barely believe I'm human.

I suppose this all falls into the category of First World Internet Problems. But I find it fascinating that in our race to make computers appear more like humans, we've actually made humans appear more like computers.

There's no doubt that the Turning Test is a tough problem to solve. But who would have thought this sort of reversed Turning Test would be, in some respects, just as tricky?

Was this post autogenerated? Would you know if it was? Would it matter?

AutoPebble Programming: Eyes-Free Time Telling

I've always been fascinated with the challenge of being able to 'read' the current time without looking at a watch. Heck, why stop at the time, I'd love to be able to get all sorts of information from my devices without having to actually look at a physical device. I never did get a chance to buy this sweet braille watch from years ago, but now that I've got a hold of Shira's Pebble, I figured I could finally hack to together a solution.

Using AutoPebble, I'm able to send a vibration pattern to the watch which means that the Pebble can effectively talk Morse Code. At the core of my solution is this JavaScriptlet which maps text to a vibration pattern:

      function textToCode(text) {
        var code      = "";
        var letters   = text.toUpperCase().split("");
        var encoder   = {
          A: '.-',         B: '-...',       C: '-.-.',
          D: '-..',        E: '.',          F: '..-.',
          G: '--.',        H: '....',       I: '..',
          J: '.---',       K: '-.-',        L: '.-..',
          M: '--',         N: '-.',         O: '---',
          P: '.--.',       Q: '--.-',       R: '.-.',
          S: '...',        T: '-',          U: '..-',
          V: '...-',       W: '.--',        X: '-..-',
          Y: '-.--',       Z: '--..'
        };
        // Ben's Own Numeric Mapping
        encoder['1'] = encoder['A'];
        encoder['2'] = encoder['T'];
        encoder['3'] = encoder['H'];
        encoder['4'] = encoder['F'];
        encoder['5'] = encoder['V'];
        encoder['6'] = encoder['X'];
        encoder['7'] = encoder['S'];
        encoder['8'] = encoder['E'];
        encoder['9'] = encoder['N'];
        encoder['0'] = encoder['Z'];

        for(var i = 0; i < letters.length; i ++) {
          var c = letters[i];
          var e = encoder[c];
          if(e) {
            if(code != "") {
              code += " ";
            }
            code += e;
          }
        }
        return code;
      }

      function codeToPattern(code) {
        var code    = code.split('');
        var dot     = 250;
        var pattern = [];

        for(var i = 0; i < code.length; i++) {
          var letter = code[i];
          if(letter == ' ') {
            continue;
          } else if(letter == '.') {
            pattern.push(dot);
           } else if(letter == '-') {
            pattern.push(dot * 3);
          }
          var peek = (i + 1) == code.length ? null : code[i+1];
          if(peek == null) {
            continue;
          } else {
            pattern.push(peek == ' ' ? dot*7 : dot);
          }
        }
        return pattern.join(",");
      }
var text = local("par1");
var code = textToCode(text);
var pattern = codeToPattern(code);

There are a couple of hacks above worth noting. First off, each letter is being treated as its own word. So: Hello World would actually be sent as H E L L O W O R L D. For someone who struggles to read even the most basic Morse Code, this simplification makes sense. Maybe one day I'll graduate to parsing words.

Second of all, you'll notice that I'm not using the proper Morse Code for numbers. Instead, I'm using a mapping I made up. It's sort of logical: A = 1, as it's the first letter in the alphabet, 2 = T, as in Two, 3 = H as in tHree, and so on. I did this for a few reasons: first, Morse Code is optimized for frequently letters. So using A = 1 means that I can send 1 as • —. Had I used the proper Morse Code for 1, I'd have to send • — — — —. Secondly, if I'm going to manage to learn anything through this exercises, I'd prefer it was 10 different letters, rather than the Morse Code numbers.

Regardless, the above does the heavy lifting of converting text into dots and dashes, and from there into a Pebble vibration pattern. I wrap up the above code as an action:

Parse Morse (88)
A1: JavaScriptlet [ 
  Code: .. code from above ...
  Libraries: Auto Exit:On Timeout (Seconds):45 
]
A2: Return [
  Value:%%par2 Stop:On
]

Note that Parse Morse is an example of me figuring out how to make Tasker Actions far more modular. Parse Morse takes in two arguments: the first is the text to parse, and the second is the value to return (either code or pattern).

I then setup the Pebble Morse Time action to listen for requests from AutoPebble, invoke Parse Morse and then present the encoded time on the watch. Here's the code for this action:

Pebble Morse Time (106)
Abort Existing Task
A1: Perform Task [
  Name:Parse Morse
  Priority:%priority
  Parameter 1 (%par1):%TIME
  Parameter 2 (%par2):code
  Return Value Variable:%code
  Stop:Off
]
A2: Perform Task [
  Name:Parse Morse
  Priority:%priority
  Parameter 1 (%par1):%TIME
  Parameter 2 (%par2):pattern
  Return Value
  Variable:%pattern
  Stop:Off
]
A3: Variable Set [
  Name:%newline
  To:

  Do Maths:Off Append:Off
]
A4: Variable Search Replace [
  Variable:%code
  Search:  Ignore Case:Off
  Multi-Line:Off
  One Match Only:Off
  Store Matches In:%code
  Replace Matches:On
  Replace With:%newline
]
A5: AutoPebble Text Screen [
  Configuration:Full Screen: false
  Title: Time
  Text: %code
  Vibration Pattern: %pattern
]

The above action include string handling that turns spaces into newlines. I chose to do thiss via a Variable Search Replace action, though I'm beginning to appreciate that it may have been easier to just do this as a Javascriptlet. The multi-line approach me to render the Morse Code for the time in a large font, with one "letter" per line. Here's how it looks on the watch:

That's T Z Z Z O'Clock, or 20:00 or 8:00pm.

To polish off my no-eyes solution, I've setup two short-cuts. A long press opens up AutoPebble and another long press kicks off the Pebble Morse Time task.

It's a crude solution, but technically, it does work. I can manage to get the time buzzed to me all without ever looking at a physical device.

As for my ability to interpret Morse Code, I've still got a ways to go. For now, I'm both vibrating and showing the Morse Code of the time, and as you can tell above, the current time is included in the header of the watch itself. I find that most of the time I can properly interpret a digit or two from the vibration, and read most of the remaining digits by looking at dots and dashes.

All in all, it's a fun experiment and is just more proof at how cool AutoPebble is. It probably took longer to write up this blog post than did it to code up this solution. Good times.

Monday, December 14, 2015

Holmes Run with Fall Foliage and Spring Weather

I'm always psyched when I discover a new section of biking/walking trail in the area. Yesterday, Shira, Dawn and I did a section of Holmes Run that I was totally unfamiliar with. It seems as though Holmes Run is split into different, perhaps non-connecting sections, so perhaps that's why I I hadn't been on it. Or maybe it's just been completed withing the last couple of years. All I know is that we started at Cameron Station Park and went "right" after crossing the bridge.

It's an excellent section of trail and worth your time to explore. Dawn says it goes all the way to Old Town Alexandria.

The weather was absolutely amazing yesterday (the high was apparently 71°F!) and it was a perfect day to be outside. Here's a few snapshots or the foliage along the trail; I couldn't resist stopping and snapping a handful of photos:

Friday, December 11, 2015

Software Defined Radio Fun: Accessing Real Time Flight Data

Here's another trick a $10 Software Defined Radio dongle can do on Android. You plug in the dongle, and kick off ADSB Receiver, a free Android App. And in a few moments, you'll see something like this:

That's live flight data. But the thing, that's not being pulled off the web. That's being received directly from the airplanes themselves (at least, as I understand it). The whole thing is powered by ADS-B, a standard by which planes broadcast their location data.

I won't claim to understand the arrangement, but I'm still amazed that I can pick up this data using little more than a $10 dongle and smart phone. There's no encryption used in the system, which I find surprising (though like most older protocols, that's not really shocking).

Is this actually useful? Sort of. One of our favorite parks, Gravelley Point, is directly adjacent to National Airport. It's the perfect place to sit back and watch the miracle of flight, as planes take off and land just overhead. Hitting the park with this app open, and also using the radio to listen to Air Traffic Control would be pretty sweet.

I also like the idea of discovering an open protocol that's all around us, yet invisible to most.

Makes me wonder what other data I can pick up with my little receiver...

Thursday, December 10, 2015

AutoPebble: Be a Wearable Tech Programmer in about 15 Minutes

Due to a possible upgrade in Smartwatches (more to come, if it pans out), Shira's letting me play with her classic Pebble. My first thought was to look into Tasker integration, and I was psyched to see that there are a number of options. In doing some research, I decided to focus on AutoPebble (rather, than say, PebbleTasker). AutoPebble is written by the same developer as AutoRemote and follows the same development strategy.

The strategy goes like this: AutoRemote and AutoPebble run on your Android Phone and handle incoming messages. These messages (which main contain a payload) are automatically passed to Tasker, where you can install a handler to respond to them. It's a simple glue layer that turns out to be remarkably powerful.

In the case of handling remote requests, AutoRemote's functionality needs to do little more than what's described above. If you send your phone the message say=:=Hello World, and you've implemented a tasker handler to intercept messages that being with say= you're basically done. In the above case, it's trivial to use the Say tasker action to recite the payload ("Hello World").

AutoPebble does the same thing, but adds another layer. Consider the start screen I put together here:

Using the Up and Down buttons, you can choose which option to invoke. When you press the Middle watch button next to Capture the following screen is shown:

The above screen is implemented by AutoPebble's two main pieces of functionality. The first is that selecting Capture sends the capture_list message, just like in the AutoRemote scheme. I've got a listener setup to handle this incoming request. This listener is implemented as a standard Tasker profile, so it can do anything tasker can do. The second bit of functionality is that AutoPebble allows you to render content on your Pebble. So in response to capture_list, I invoke the AutoPebble List action, which generates a UI list on the watch itself. In this case, capture_list effectively generates a sub menu. From the Capture submenu, I'm able to choose what I'd like to capture. Invoking one of these options sends yet another message to the phone using the AutoRemote style convention.

In the case above, I arrange for specific capture requests to be in the format capture=:=SRC where SRC is defined as one of the following: FrontCamera, BackCamera, Sound. Within Tasker, I invoke tasks that correspond to these different sources, and use the AutoPebble UI capabilities to give an informative message as to what the watch is doing.

Here's another quick app I wrote. Using the Barometric Pressure code I wrote yesterday, I'm able to display this information when asked for it on the watch. Now when Shira feels like she's getting a headache and wonders what the barometric pressure is, I'm only a couple of watch presses away from getting her an answer, as well as seeing the history of data I've seen before. Check it out:

I'm positively amazed how quickly I've been able to write useful apps for the Pebble. Most of the time spent struggling on the above apps was spent figuring out Tasker quirks, more so than anything else. Once you get how AutoPebble does it magic, there's not much to it. Bottom line, AutoPebble is an absolute winner. Yes, there are times when it's a bit slow and I've seen some quirky behavior. But from a programmer's perspective it does all the hard work, so I can just focus on the fun part.

I'm not sure how long this little experiment in wearable tech will last, but so far, it's a programmer's dream. Another device I can program; whoo!

If you'd like to see any of the Tasker code that powers the above screens, let me know, and I'll publish it.

Wednesday, December 09, 2015

Android Tasker: Automatically Storing Local Barometric Pressure Data

One of Shira's headache triggers is the weather, specifically barometric pressure. I was wondering how hard it would be to grab the current barometric pressure and store it all based on the phone's current geolocation.

Turns out, not that hard. One HTTP Request to openweathermap.org is all it takes to get the raw data. And parsing the JSON results turns out to be downright trivial thanks to this awesome Javascriptlet hack. JSON saves the day again!

Running this task appends the location, atmospheric pressure and timestamp to a text file.

Next up: using this text file. Stay tuned for more weather hacking fun.

Here's the Tasker Task described above. It's almost too easy to do!

Store Pressure Data (68)
    A1: Get Location [ Source:GPS Timeout (Seconds):100 Continue Task Immediately:Off Keep Tracking:Off ] 
    A2: Variable Split [ Name:%LOC Splitter:, Delete Base:Off ] 
    A3: HTTP Get [ Server:Port:api.openweathermap.org Path:/data/2.5/weather Attributes:lat=%LOC1
lon=%LOC2
appid=API_KEY Cookies: User Agent: Timeout:10 Mime Type: Output File: Trust Any Certificate:Off ] 
    A4: JavaScriptlet [ Code:var data = JSON.parse(global("HTTPD"));
var wloc = data.name;
var wpressure = data.main.pressure; Libraries: Auto Exit:On Timeout (Seconds):45 ] 
    A5: Write File [ File:Download/pressure.txt Text:%wloc: %wpressure | %DATE %TIME Append:On Add Newline:On ] 

Tuesday, December 08, 2015

Morocco Adventure - Day 8

[Written 12/1/2015]

Our vacation is winding down! We traveled from Marrakesh to Casablanca today to stage our exit from the country, which if all goes well, will happen tomorrow morning. This gave us one day to explore Casablanca and get yet another taste of what Morocco has to offer.

From our hotel (the very impressive Hyatt Regency, made more impressive because they upgraded us to a stunning suite on the 10th floor!), we plotted a path to the massive Hassan II Mosque via the old Medina.

Compared to Marrakesh, the old Medina in Casablanca is tiny. But it had everything one hopes to find in a Medina: a friendly Moroccan who just wants to chat, yet eventually offers to take you to a today-only Berber market (I kid you not, this happened today too), an initial touristy section of town, followed by narrow alleyways that take you to more mundane shopping for the locals (need to buy a live chicken or sardines? We found the place to pick them up). It's all good fun, and we navigated it sans map, which means that we hit a few dead ends. Still, we managed to make it to the other side without an issue.

From there, we made our way to the gigantic Hassan II Mosque (the third largest in the world, according to our guidebook). I asked Shira how'd she describe the Mosque and her answer was: "Ornate but tasteful." That's way better than my answer: "big" and "impressive." It really is a site to see and as beautiful as any Cathedral or Temple as I've ever seen.

We're finally cracking the code behind the various market stalls that serve food. You need to spend a minute or two figuring out what they are actually selling by watching others order. A stall typically only sells one thing, so if you're not in the mood (like I wasn't for the snails that one guy was serving), you can safely walk away. Otherwise, jump in and start pointing. Tonight we had some fresh bread stuffed with cheese and chocolate and it was heavenly. Combine that with some sesame candy we bought for $0.30 and you had one delectable snack. The food hasn't always been perfect here, but we've absolutely found some treats that rival the best we've had anywhere.

Oh, and for the record, we did stop by Rick's Cafe in honor of my In-Laws. Alas, we arrived before they were open, so we couldn't go in. And besides, the location wasn't used in the shooting of the Casablanca movie. But still, I was glad to share this touristy moment in their honor.

Driving in Casablanca is definitely less chaotic than in Marrakesh (mostly because there are mainly cars, versus cars, scooters, mopeds, horses, donkeys and bikes to contend with). But they still have a remarkably laxed view of traffic laws. We saw numerous cars and buses stop at red lights, pause for a few moments, and then pull through. Cause you know, red lights aren't that important to obey.

View Photos

Morocco Adventure - Day 7

[Written 11/30/2015]

Today we took a side trip to Essaouira, a coastal town a few hundred kilometers from Marrakesh. Like all the cities we've visited so far, it contained a medina surrounded by impressive looking ramparts. It also contained a section labeled Mellah. Apparently, anytime you come across a 'Mellah' quarter, you've stumbled onto the old Jewish section of town.

Whether it was in Rabat, Sale or El Jadida, the only indication that you were in a Jewish area was the notation on the map. Most of these cities contained Jewish cemeteries, but we never managed to visit one.

It was in Essaouira, however, that our luck changed. Not only did we find two different shuls we could tour, we managed to find something even more rare: a Moroccan Jew. We met Haim, who has spent the last 4 years restoring one of the shuls in Mellah. He took some time out to share some additional history of the area. You can find the website for the restoration project here.

At its high point, there were 39 shuls in the Medina, and only 3 mosques. All but one of the shul's were part of homes, with the shul Haim was renovating, being the only one that was a dedicated building. The town had a Jewish majority, going back to its creation in the 1700's, where it was established as a world wide trade port. Even in their heyday, the shuls were always modest from the outside, to the point of being almost invisible. Inside however, they could be as extravagant as they wanted.

The rest of Essaouira didn't disappoint. The port was especially picturesque, including impressive ramparts you could tour. In honor of being so close to the sea, I had sardines for lunch. Yum! I could have had any number of sea creatures on display at the market, you simply point to what's laying out and apparently they will cook it up for you.

On our way back to Marrakesh, we stopped at Marjane, a sort of Wal-Mart in Morocco. I've got to say, it's pretty dang impressive. You could buy everything from groceries to electronics, just like you would in the US. Shira and I like to visit grocery stores when traveling in other countries, and this was like hitting the jackpot. It's also quite a contrast shopping in a very Western store, and then getting on the road and dodging donkey carts and such. But that's just how Morocco is.

View Photos

Morocco Adventure - Race Du Soleil (Day 6)

[Written 11/29/2015]

Here's a tip: when your wife makes arrangements with a tour company to run a hike for us, and she asks them to combine their two day hike into one day, be afraid. Be very afraid. That's exactly what my beloved did. And so rather than a leasurely stroll through the mountains, we had a trek against time, trying to pack in the miles before the sun set.

In typical Moroccan fashion, as we were preparing to start our hike, they asked us if we wanted to sit down and have some mint tea. We were already behind schedule and had 7+ hours of hiking ahead of us, and they wanted to know if we wanted tea?! We passed.

The hike ended up being a 10 mile, almost circuit. We slogged up the first pass for a couple of hours, and then descended for a few more, before we had a classic Moroccan meal of tea, salad, veggie tajine and pomegranate seeds. And then it was back on the trail for another massive uphill to a pass, and then back down the other side.

I logged the whole trip using Run Keeper, but apparently the elevation data got totally whacked. According to the GPS, we had a total gain of 12,000 feet, a number which isn't technically possible. Perhaps the GPS was set to a sort of feels-like? Because heck yeah, it *felt* like we climbed 12,000 feet!

I definitely found myself sucking wind while climbing that first monster pass. Our guide walked up it like it was nothing. So typical.

The area doesn't have a whole lot of vegetation or obvious wildlife. We passed through distinctive smelling juniper trees, which was a treat, and saw an awwwwww inducing herd of goats. They were more than happy to eat our orange peels (now that's recycling!). We also saw a number of mules, which are the region's preferred method of hauling materials from point A to B. The views more than made up for any lack of unusual flora or fauna.

We passed through a number of Berber villages, which are apparently very much in use today. The villages appear to subsist on very little: a winter wheat field here; a hammam (bath) there. Each village has its own mosque and imam, and our guide was very clear on the point that all Moroccans practice the exact same form of Islam. From the smallest mosque in a tiny village, to the massive mosques in Marrakesh, everyone is on the same page, if you will.

We received almost the exact same messages from our guide as we did from the young shopkeeper we spoke to in Rabat: they're proud of the security measures the government has put in place to make Morocco safer, and they are acutely aware of the damage that's been done to Islam by the latest attacks in Paris. Our guide make it very clear that in his mind, the terrorists in France absolutely do not represent the religion he and his countrymen practice.

After our epic hike and a hot shower, neither Shira nor I could imagine going out for a fancy sit down dinner. So we stepped outside our hotel, and purchased a few essentials: a persimmon ($1.00), a pomegranate ($0.70), two pita sized pieces of bread ($0.20) and a heaping box of pastries ($6.00) and had a fantastic improvised meal.

It's off to bed, where I'll probably be dreaming of a steep climb that never ends, as that was my reality earlier today.

View Photos

Monday, December 07, 2015

Morocco Adventure - Day 5

[Written 11/28/2015]

Day 5 of our Morocco Adventure was spent experiencing the Marrakesh Medina in all it's twisty-and-turny glory. It's not supposed to be a question of whether you'll get lost traversing the narrow alleys of the souks, but how often and how severely. For my part I handed the map to Shira and stood back as she navigated. Needless to say, we didn't get lost once. Shira: 1, Marrakesh: 0.

The souks really are pretty endless here, with always one more set of stores around the corner. Along with shopping we hit a number of guide book recommended sites, which didn't disappoint. There was a medrasa, much like the one we saw in Sale, but about 10 times bigger. Outside of the Medina, we hit the Jardin Majorelle, which includes a remarkable cactus garden, not something you'd immediately associate with a relaxing garden. But it totally works.

The garden also offered a museum, which I insisted we visit (it's our first of the trip, thank you very much). The topic was on Berber culture; Berbers being the indiginous people of Morroco (versus the Arabs, who arrived later). Here's the part that blew my mind: there were Berber Jews, and the museum had a pretty healthy exhibit on the topic. On one hand, this shouldn't be surprising; there are American Jews, and French Jews, etc., so why not Berber Jews? On the other hand, I just didn't see that coming. Alas, the whole movement is effectivly wiped out (as is most of Morrocan Jewry). But man, that would have been a sight to see: Jews that dressed and spoke Arabic just like their neighbors, but of course, were Jewish.

After the museum, it was back into the souks for more oggling and shopping.

There's a sort of arms race between the government and the con-artists that work the tourists in the souk. Over the years the government has worked hard to make the souks a friendly place for tourists. The latest effort involves a large number of undercover "tourist police." The idea is that the shabbily dressed man loitering on the corner is actually a police office, ready to jump in and save a tourist. The con-artists, for their part, have figured out more ingenoius ways to rope in toursts, all while not getting caught.

We were warned about this extensively by our hotel and knew to expect it. So when someone came up to us a few blocks from the museum and started chatting, we weren't surprised how the conversation went. First he told us that he worked in the gardens and saw us there. What did we think of them? Then after a bit of chummy back and forth, he asked us if we wanted to see a one day only Berber market (I could hear our hotel advisor: "I can promise you, there's no one day berber market going on today, or any day). It didn't take any more than a couple of no thank yous to have him move on.

The upshot to all this is two fold: first, I really do believe you're safe in the souks, and good for the Morrocan police for for making this possible. Second, it really is unfortunate that the only pople who stop and chat with you are out to con you. We spoke to a few more people throughout the day, and sooner or later, they all got around to asking if they could lead us off to some market or site. That's such a shame. In most other countries, the casual interaction with people can be a true delight. In Japan, one group of ladies stopped to ask how we liked the country. Shira and I eagerly waited for a catch, but no, it never came. They just wanted to chat. The shopkeepers for their part aren't nearly as sleazy. They're shopkeepers, and experts at being on the right side of the bargain. But we had a number of positive experiences with them, whether we bought or not.

View Photos

Morocco Adventure - Day 4

[Written 11/27/2015]

Day 4 of our Morocco Adventure was spent traveling from Rabat to Marrakesch. Of course I insisted that we stop at El Jadida along the way, which only added 2 or 3 hours(!) to this otherwise 3 hour trip. El Jadida turned out to be a worthy place to stop, as its Medina was straight out of a picture book. Of course we arrived at around 2pm, when one of the main sites of the city is closed (it would re-open at 3pm), but that's just my luck.

What made the stop in El Jadida so costly in terms of time is that we switched from an Autoroute to an older surface road. That means we went from a modern toll road to one shared by donkeys, motor-cycle powered mini-trucks and mopeds. As a passenger, it made for entertaining scenery, as a driver, not so much.

Speaking of scenery, much of our trip was spent passing either flat farms, or flat brown scrubby areas. It wasn't until we started to near Marrakesh that we started to see mountains in the far distance. There were occasional trees, but most of the landscape was dominated by cactus, which almost appeared to be cultivated to form boundaries along the landscape.

By now you're tired of hearing about how crazy Morrocan drivers are. But I've got to say, the traffic in Marrakesch makes Rabat look absolutely tame. As we made our way to our Riad (hotel) in the Madina, traffic got exponentially more insane. By the time we rounded the last traffic circle, every available space on the road was clogged with either a car, horse, donkey, moped, scooter or pedestrian. Any void was immediately filled with one of these. As one resource noted, the stop lights and pedestrian crossings here are merely for decoration. It was truly something else. Luckily, we parked the car at the hotel and won't touch it for another few days.

After a long and harrowing car ride, stepping into Riad Dar Anika was like stepping into an alternate universe. We started the evening with milk, tea, pastries and dates. We then checked out our room, which was covered in rose petals. And finally, we had dinner, which consisted of 5 very yummy courses. It was the perfect end to a long day.

View Photos

Sunday, December 06, 2015

Morocco Adventure - Day 3

[Written 11/26/2015]

Next time you're driving down the street, take a moment to note that at nearly every intersection there's a street sign, and on nearly every building there's a number. These, believe it or not, are luxuries. Luxuries you won't frequently find in Rabat, Morocco. We know this especially well because we drove to nearby Sale, located just North of Rabat today, and finding our destination required us to combine our GPS, a local area map, a hand-drawn map by the hotel and a good bit of luck.

But find it we did! And Shira's definitely getting the hang of this driving thing. Just treat every road like a free for all, and you're good to go.

Sale was definitely worth whatever effort it took to get there. Thanks to an ad hoc Moroccan guide, we got an exhaustive tour of the old city. This included the Medrasa we were looking for (which had truly breathtaking architecture involving beautiful carved walls) as well as a tour of the fortress and prison which our guide book didn't even mention. Fun times!

We got lunch at the market, which involved somes sort of sandwich stuffed with veggies while we convinced the chef to forgo the meat. As a bonus, we got a big 'ol glass of mystery juice, which Shira is quite certain was beet juice. Moroccan borscht, yum!

As usual we found a bakery and went to town. We picked up 6 different pastries, which came to a total of about $1.60. Market food is just so cheap here. Like the olives we picked up yesterday: we got a sampler pack of 6 different varieties that came to a total of about $0.90. Oh and we picked up a persimmon that was at least two times the largest persimmon I've ever seen, and it tasted delish!

After the tour of Sale, we searched out a collection of pottery stores. And sure enough, we managed to stumble on them. Like most shopping experiences in Rabat, it was incredibly low key. Folks were glad to answer questions, but nobody pushed us to buy anything. We chatted up one 20 something clerk who talked about how proud he was of the security and safety of Morocco. He also said that most folks his age have a simple dream: make it to Miami to party for a week. After that, he explained, he'll be able to die happy. It was hilarious.

This is our last day in Rabat. Tomorrow we make our way to Marrakech, which has a reputation for being pricier and more of a tourst trap. Hopefully Rabat has prepared us well.

Had our oddest Thanksgiving meal yet, a tuna panini, omelet, Moroccan salad and french fries. All for $7.50!

View Photos

Morocco Adventure - Day 1 & 2

[Written 11/25/2015]

Greetings from Rabat, Morocco! We landed yesterday afternoon in Casablanca, and immediately made our way to Rabat. Our flights were uneventful. We had a 5 hour(!) layover in Paris and were surprised to see no additional security presence in the airport. It felt like just a normal Tuesday morning in any international hub.

Our drive to Rabat was also fairly uneventful. Through a glitch in the GPS we started the trip on the N1 versus the more ideal A3. And what's the difference between the N1 and A3? A3 is highway, while N1 is colorful surface road. While the traffic moved fairly quickly on the N1, you've got distractions like folks herding sheep or pedestrians walking across the road, which slows everything down. Still, by some minor miracle we traversed the city at night and found our hotel.

We totally cheated and ordered room service for dinner. Yet, thanks to the exchange rate our extravagant meal was all of $15.00. Try that at your next luxury hotel and tell me how that works out for you.

Today was spent walking throughout Rabat and taking in its main sights. We started by touring the ruins at Chellah, an ancient city which is right next to Rabat. The only people we saw were guards and folks working on the grounds. Other than that, the site was all ours. Unlike some historic ruins, at Chellah you can get up close and personal to the whole thing. You can effectively walk among the ruins that you're admiring, rather than just observe them from a safe distance.

If the remains of the city weren't enough, there's a stork population that now calls the site home, and they're equally interesting to observe. Who knew storks were so loud? They make a sort of clapping noise that is delightfully eerie. Definitely an awesome site.

We hit the other main attractions in the city, including the Medina, Kasabah and the Hassan Tower (which is ensconced in scaffolding, which was a shame). Oh, and of course the museum at the Kasabah was closed, that's so typical for me. Shira got off the hook with that one.

We're finding the city to be safe and welcoming. Being a pedestrian requires a certain level of boldness, as cars will yield to you in an intersection, but only after you've stepped in and started walking. I rely on a technique I first started using in Italy of simply standing with a local and crossing when they cross. I figure they must know what the heck they are doing.

Another quirk of the city: like Ecuador, this appears to be a BYOTP bathroom situation. That is, Bring Your Own Toilet Paper. At Chellah, they had a couple of ladies who would provide a roll of toilet paper for a nominal fee, but in other locations, it's expected you'll have your own. Not terribly difficult to deal with, but good to know before you have to go.

I have to say, I'm loving the architecture of Rabat. It's all towers and castle walls and such. My inner toddler just thinks the buildings are so cool.

It's time to go find some dinner. Between Shira's high school French, and my hand gestures, how hard could that be?

View Photos

Friday, December 04, 2015

Review: I Am Legend

WARNING: Spoilers Below. The very short review: this is a great book that's absolutely worth reading. Now go, read it (or listen to it, as I did) then come back and give me your comments.

Saying I Am Legend by Richard Matheson is good book is like saying Hamlet is a good play. Duh. If the book itself weren't good enough, it apparently launched a new genre of horror fiction, and many of the modern zombie and horror classics can be traced back to it. Here's a few parts of the book that struck me as impressive:

1. The scientification of Vampires. This key theme of the book, that Vampire behavior isn't just supernatural but can be explained using "science" definitely helped make it a page turner. How can the author explain the fear or garlic or dislike of crosses in physiological terms? It gets more impressive when you consider this was one of the first books to do this, even though the practice is now common (if not expected).

2. Some questions get answer, some don't. As mentioned, the book tries to explain why vampires behave the way they do. It also touches on bigger questions like why should the last man on Earth keep living? This question never fully gets answered, which to me seems totally appropriate. Finding that balance of what to provide closure on, and what to leave open, is just so key.

3. It's all about the loneliness. One of the main themes of the book is how one deals with the immense loneliness of being the last man on Earth. This part of the book gets awfully messy, which is sort of the point. I kept wanting to tell the main character to pull it together and make a plan, but that's easy for me to say. The book reminded me of the recent reality show Alone. It's a reality show, so take this with a grain of salt. But the original thought was that the show would be about outdoor skills and which contestant can best execute them. Instead, it turned into a cry fest as the primary challenge became dealing with the massive loneliness that the underlying scenario brought about. Hence the name Alone. The 30 56 days or so folks spent in the woods alone maps surprisingly neatly to the years the main character endures.

4. The book ages surprisingly well. The book is set in the 1970's and reads as quite plausible for the time period. There's talk about air conditioners and germ theory and other concepts that seem appropriately modern. I would have believed you if you told me the book was written in the 70's or last year. In fact, it was published in 1954. I find that remarkable, and wonder how the author managed to give just enough tech references to keep the book relevant, but not step into any traps. The fact that this is one individual living alone does explain why older tech like record players and movie projectors make sense over more modern items like stereos and TVs. Without a society to send out content on radio waves, there would be nothing to receive. Still, it's well done. And of course it shows that the themes of survival and loneliness are universal. It all reminded me of 1984, another novel that ages just as gracefully.

5. What a well played ending. Yes, I managed to figure out the plot twist before the last few pages. But still, so well done. I love a book that messes with your perspective on the world so entirely.

If you still haven't read the book, go do so.

Wednesday, December 02, 2015

Morocco Adventure: Tech Recap

According to the in-flight map, we've got a mere 1 hour and 12 minutes before we touch down in DC and officially end our Moroccan Adventure. In this home stretch, it makes sense to take a few minutes and think about what worked (and didn't) this trip. One decision that worked was to leave the laptop at home and travel with just my Galaxy Note 5 and a few accessories. Here's how we did it:

Photo Backup - For years now, my standard approach has been to use a Micro SD card (plus adapter) in my DSLR. In the past, I could pop this card directly into my cell phone to access photos. The Note 5 doesn't have a Micro SD slot, but for a few dollars I was able to pick up the tiny Leef Access Micro SD adapter on Amazon. I plug the adapter into my phone, and then insert the SD card, and voila!, my cell phone can access the DSLR photos. And here's where I got clever: every night I'd copy the DSLR photos to my cell phone, and my cell phone photos over to my DSLR card. That way, I had a backup of both types of photos, one on an SD card and on on my phone. I also made sure Google Photo Backup was running, and nightly all the photos from my phone (which included both DSLR and cell phone) were pushed to Google over the hotel's WiFi.

I experimented with using FolderSync to push files to Google Drive. That works well enough, but pushing the full size images over our first hotel's WiFi was just a non-starter. Instead, Google's Backup did the job just fine (I'm currently backing up high quality not original photos, which are smaller in size).

Photo Review - Every couple of nights we'd open up gallery app FStop, and browse through the photos we'd shot. One especially nice feature of FStop is the ability to tag photos. As we browsed through the hundreds of photos we took, we'd tag a handful of them as blog and they'd get used in blog preview posts described below.

Blogging - Previously, when we traveled I'd use my laptop mainly as a way to write up blog Posts. While the Note 5 offers this capability, it's not the ideal platform to edit and finalize photos (the screen is big, but not *that* big). So this trip I compromised. Nightly, I'd write up my notes about the day in spiral notepad. And then every few days I'd bust out my Bluetooth Keyboard and compose the text for a post. I like to write up travel posts as close to the event as possible, as it's easy to forget details. For now, I've saved up those posts as .html files and will post them once we've fully edited our photos.

Still, I can't resist posting *something* while on vacation, so every few days we put up a Preview Post. I used FStop's tagging feature to pick a number of photos to post, and then shared those photos with the Bloggeroid app.

Work - I usually carry a laptop to help out if any server or software issues come up. Luckily, this trip, none did (at least nothing that a few e-mails wouldn't help with). But had something come up, I've got ssh and a Bluetooth keyboard that's saved the day enough times I'm confident in it as a solution.

Staying Found - The winner this trip for helping us not get lost was the GPS Plus Test App (specifically the paid version). This oddly named app allows you to drop a waypoint and quickly see your relation to it. We'd drop waypoints as we traversed the various souks and never had to worry about getting too lost.

I'm editing this post from my home, and here's a screenshot of where GPS Test Plus puts the exit to the Marrakesh souk:

Capturing Audio - Depending on where I'm at, I often like to try to capture quick audio snippets. I've yet to find a use for these, but I have this hope one day that I'll put them together into a presentable form. In the past I'd used soundcloud.com, as it makes it very easy to record and publish your audio recordings. But I'd exceeded my paid subscription and couldn't justify paying even more per month for what accounts to a file storage service. So I installed Titanium Recorder, which seems to do an adequate job for capturing audio. I'll then store these files on Google Drive for posterity. I installed Lame in GNUroot, so converting the .wav files to .mp3 while on the go is possible. Though I never did get around to trying this in the field.

Here's a sample of an audio snippet I captured while in the souk during a call to prayer:

Staying Connected - Here's a Moroccan specific tip: purchasing a SIM Card is cheap and relatively easy. The tricky part is that only an official cell phone store (like an Inwi or Moroc Telecom) can issue you a SIM card. Like all phone transactions (yes, I'm looking at you T-mobile stores), it seems to take absolutely forever to complete the transaction (OK, like 20 minutes). But for around $3.00, your cell phone becomes functional in the country. I also purchased a data plan, which at the time it didn't occur to me to push back on. The clerk setup me up with a $10, 12 Gig plan, but that was way overkill. I should have been able to get a gig or two for a few dollars. Cell phone service is actually quite impressive in Morocco. As we climbed up and down the barren passes in the mountains, our guide made cell phone calls to coordinate both our lunch and pickup. We're lucky if we have T-mobile service 45 minutes of out town, so to 4G service in the sticks is impressive. When it was all said and done, the $13 investment gave me Google Maps, the ability to check and respond to e-mail on long car drives and a cell phone number. Definitely worth it.

Staying Entertained - I used the usual apps to stay entertained on the plane. This includes Overdrive to listen to books and Gnuroot + emacs + reddit to do a bit of coding. Nothing new or exciting here.

It's really not surprising that we were able to go the week without a laptop. Our main goal was to enjoy being on vacation, and all you need for that is the urge to explore and a healthy sense of humor.

Tuesday, December 01, 2015

Morocco Adventure - Day 8 (Preview)

Our vacation is winding down! Today we headed to Casablanca, and tomorrow we board a plane back home. Here's a few photos from the day, many more coming soon.