Friday, October 31, 2014

Why Doesn't this App Exist?

Surely this app exists, but for the life of me I can't find it on Google Play:

I'm after a simple messaging app that allows one phone to trigger an arbitrary set of vibrations on another phone. The setup would work like so:
  • Phone A: the receiver opens up the app, where it displays the device's unique ID
  • Phone B: the sender, plugs in this ID into his app
  • Phone B: the sender, identifies a series of buttons he'd like to see on the app. Each button has a label as well as a vibration pattern (see also: here) associated with it
Now, anytime a button is pressed on Phone B, Phone A would vibrate to said pattern.

Why do I need such an app? So many reasons. But essentially it allows for quick, silent and long distance communication where the receiver doesn't even need to look at their phone.

Thinking about it, it's basically a digital telegraph, though using vibration instead of sound.

Approximating this app is quite simple in Tasker AutoRemote, so I may just end up doing that as a prototype. Though, that does mean buying Tasker and AutoRemote for the client phone, which all things considered isn't too expensive.

Still, how can this app not exist?

I'll give this a few days, if I'm still craving the app, maybe I'll just write it.

The Time an Accordion Saved a Girl's Life

I'm doing some research on one of the member's of our shul and I came across this breathtaking story:

In 1941, German armed forces overran Bosnia, and stormtroopers quickly started rounding up Jews. The seriousness of the situation became dramatically apparent when Jagoda's father rushed into the family's home and said they had to flee for their lives.

"My father came home all pale and scared to death," Jagoda recalled. "He said the Germans were gathering all the Jews and we had to run away.

"He said it would be too dangerous for all three of us to go together, and that I should go first. He took me to the train station, but he wasn't able to buy me a ticket to a town where his friend would meet me.

"He told me to get on the train, sit down in the compartment and play my accordion. So, for hours, I played all the songs I have ever played."

Passengers were attracted to the music, and soon the compartment was filled with people. When the conductor came in, instead of checking tickets, he sat down to listen.

"The conductor loved music and the accordion and never did ask me for my ticket," Jagoda said. "The accordion was my survival; otherwise, I would have gone in a very bad way.

"My memory of that train trip is fear, fear, fear. Just fear. The music saved my life, because this was a time when they were picking up Jews and sending them to concentration camps.

"Imagine — an accordion, of all things, saving one's life."

Such quick thinking. Such courage. Absolutely amazing. I shudder to think of what my fate would have been if I had been in the same situation.

Recently, I was reminded of the power of music but this takes it to a whole new level.

I'll never listen the accordion the same way again.

Perhaps Aurthur Ashe said it best:

Start where you are. Use what you have. Do what you can.

Here's a short video that captures this story and includes photos of the actual accordion.

Thursday, October 30, 2014

Need a quick mobile prototype? Tasker to the Rescue!

A couple of weeks ago I was browsing the Tasker ChangeLog when I noticed this entry:

event: Steps Taken (Android API 19+)

Interesting. I checked, and sure enough the pedometer on my Galaxy S5 is now wired into Tasker. Specifically, you can have Tasker perform some action when you hit a particular step count (at which point, the step count resets, and you start approaching it again).

I found this functionality terrifically cool, but for the life of me I couldn't think of a practical use for it. After much brainstorming, a half baked project came to mind. What if I plotted my location every 1000 steps. Would results be of interest? (Either as useful personal metrics or maybe just as art).

The more I thought it about it, the more I became curious: would the trail of digital breadcrumbs I left over the weeks and months be of value?

Now that I had my idea I had a new problem: when the heck was I going to find time to implement this bad boy? Probably never.

So I've decided to punt. Yesterday, I setup this new Tasker task:

Profile: Step Loc (41)
Event: Steps Taken [ Number:1000 ]
Enter: Anon (42)
  A1: Get Location [
    Source:GPS Timeout (Seconds):100
    Continue Task Immediately:Off
    Keep Tracking:Off
  ]

  A2: Write File [
   File:Documents/steploc.txt
   Text:%TIMES,%LOC
   Append:On
   Add Newline:On
  ]

Now, every 1,000 steps a two line task is triggered. First the GPS location is calculated, and secondly, this value (%LOC) and the current Unix time (%TIMES) is appended to a data file.

This allows me to start collecting the location and time data now, and if I choose, I can play with it at a later date. If there's a trend there, I can make a more formalized app.

While it's not a slick, real-time visual based solution, it did have the benefit of taking me all of two minutes to write.

Will this little project, if you excuse the pun, lead me down a useful path? I don't know. But I know that I love Tasker for it's ability to quickly prototype concepts just like this one.

Wednesday, October 29, 2014

Praise for Siri and a quick (and surprisingly satisfying) mobile version of Eliza

My friend (and famous author!) Christian Cantrell posted a touching story on Google Plus: To Siri, With Love: How One Boy With Autism Became BFF With Apple’s Siri. It's more than worth your time to read. However, a quick take on it is it that Siri has a number of attributes that make it an excellent companion for the author's Autistic Son(for example: Siri doesn't mind talking minutia for hours, and her gentle corrections help teach important social skills).

Besides this being another see, technology can be a force for good in people's lives! article, it got me thinking about chat bots in general. And no discussion of chat bots is complete without a mention of Eliza, Siri's great-great-great-great-great grandmother. Eliza was a "doctor" who could psychoanalyze you using little more than a set of text matching rules. Still, it managed to give the impression of true intelligence.

With Eliza on the brain, I started wondering how tricky it would be to implement an Eliza clone for my phone. Turns out, not tricky at all. Here's what I did.

First, I cheated and grabbed this implementation of Eliza in Scheme. Yes, I should have written my own. Heck one day, I probably will.

Next, I wrote some wrapper functions around that code to make it accept arbitrary string input:

(define random random-integer)

(define (eliza-scrub text)
 (define (valid-char? c)
  (let ((v (char->integer c)))
   (or (equal? c #\space)
       (and (>= v 97) (<= v 122)))))
 (let* ((chars (string->list text))
        (lower (map char-downcase chars))
        (valid (filter valid-char? lower)))
  (apply string valid)))
  
  
(define (eliza-it text)
 (let ((input (map string->symbol (explode " " (eliza-scrub text)))))
  (implode " "
           (apply-rule ELIZA-RULES input))))

I then busted out my web-apply framework, and attached this function to the local URL: http://localhost:9000/doc:

 (tcp-service-register!
   (list server-address: "*"
    port-number: 9000
    eol-encoding: 'cr-lf)
  (web-fn-dispatcher `(("/doc" . (,eliza-it #t)))))

At this point, I could visit the URL in my browser and have a crude discussion with Eliza. But it's hardly the feel I was after. Next up, I turned to Tasker and created this quick Task:

Eliza (40)
A1: Get Voice [ Title:Talk to the Doctor Language ]
A2: If [ %VOICE eq bye ]
  A3: Say [ Text:Good bye ]
A4: Else
  A5: HTTP Get [ Server:Port:http://localhost:9000
                 Path:/doc
                 Attributes:p0=%VOICE output=display ]
  A6: Say [ Text:%HTTPD ]
  A7: Goto [ Type:Action Number Number:1 ]

The magic is in the Tasker action Get Voice. This prompts a user to say something which is then turned into text and stored in %VOICE. The action Say does the reverse, taking arbitrary text and speaking it aloud. Finally, there's the web invocation of http://localhost:9000/doc which actually executes the above Eliza code.

While the above code is more fragile than I'd like (you need to explicitly bind the the eliza-it function to a port and path), it's also surprisingly effective. The whole experience is voice driven and feels remarkably powerful. It definitely brings back the magic of Eliza that had secretaries and staff confiding in it so long ago.

Tuesday, October 28, 2014

web-apply - Turn your Android Phone into an itty bitty Scheme app server

Checkout screenshots of my latest "web app" :

Pretty lame, right? Perhaps not, allow to me to explain.

What you're looking at are some interactions with web-apply, a crude framework for binding arbitrary Scheme functions to a web page. Here's how it works. First, you start with any old functions. Here's three toy ones:

(define (string-reverse x)
 (apply string
        (reverse (string->list x)))) 

(define (tip-calc amt)
 (map (lambda (percent)
       (cons percent (exact->inexact (+ amt (* (/ percent 100) amt)))))
      '(10 15 20)))

(define (random-within x y)
 (+ x (random-integer (- y x)))) 

Then you bind these functions to a particular port and path:

 (tcp-service-register!
   (list server-address: "*"
    port-number: 9000
    eol-encoding: 'cr-lf)
  (web-fn-dispatcher `(("/rev" . (,string-reverse #t))
                       ("/tip" . (,tip-calc number))
                       ("/rand" . (,random-within number number)))))

tcp-service-register! is built into Gambit Scheme and takes care of accepting TCP connections. web-fn-dispatcher implements trivial HTTP handling and allows for interaction with a browser. The framework has one more trick up it's sleeve: you can pass an output parameter to declare how you want the output rendered. By default, a basic HTML page is generated, though you can pass in display or write to output the content using the aptly named Scheme function.

And here's the cool part: this framework was built in, and explicitly runs on Gambit Scheme on Android. So the above bindings effectively turn my cell phone into a resource an arbitrary user can browse to and interact with.

So why bother writing web-apply? I'm glad you asked. Here are three reasons:

  1. web-apply demonstrates just how powerful Gambit Scheme is on Android. Threads and sockets Just Work, including the ability to debug at the REPL. Combined with Droid Edit, you can really get creative and program dang near anything.
  2. If I try hard enough, I can imagine a circumstance where a team of individuals would want quick and dirty access to interact with some code, and web-apply gives you exactly this.
  3. web-apply should play nice with Tasker, as Tasker allows for easy execution of HTTP requests. This should allow you to code a task mainly using Tasker's standard environment, but jump into the Scheme world when it's convenient.

Of course, this should be considered alpha level code. But it's fun alpha level code, so feel free to play around with it.

Monday, October 27, 2014

Got a little time, Make a little art

While waiting for Disney on Ice: Frozen to being, I captured these pictures of our friend's 3 year old playing with her new light-nunchuks. Surprisingly, they are among my most successful attempts to paint with light. I guess that's what I get for not over-thinking the process.

Disney on Ice: Frozen - So that's what the fuss is all about

This past weekend we took our friend's 3 year old to Disney on Ice: Frozen. Before I talk about the show, let's talk about Frozen itself. Shira wisely suggested we watch the movie before the show, so that's what we did on Friday night (the show being on Sunday). I'm fairly comfortable with sharing spoilers below because we have to be the last people on the planet to have watched the movie.

My first thought, upon finishing the movie, was nu? this is what's taking our culture by storm? But, after thinking about it a bit more, I did appreciate that it was a story of family love and dedication, and not just the usual prince/princess theme. To that end, I was totally fooled by Prince Hans and assumed that Disney was going to give us a happily ever after there. I was less than impressed with story resolution.I appreciate the whole Wizard of Oz you've got the magic within you already. But really, she just realizes "Oh Love?!" and then all her problems are solved? And don't even get me started on the parent's behavior or the troll's bad advice. OK, I suppose I'm being a little too hard on a kid's movie. But still.

After watching the ice version of the story (which more or less follows the movie) I was struck by another important twist: Princess Anna is a self rescuing princess. Well played Disney, well played.

Shira pointed out that it's ridiculous that both princess characters in the movie are beyond-waif thin. If you're going to make characters you're counting on little girls to emulate, it's practically criminal to have this extreme of a body image. Surely some of the billion plus dollars made on the film could have been used to figure out a way to make both attractive and more realistic looking characters.

I suppose it all comes down to the power of music. The story is good enough, the characters lovable (oh Olaf, you're my favorite!) and sure there's some positive lessons in there. But add in catchy songs, and people can't help but love the movie.

If we had daughters in our home, would I want them dressing up like Anna and Elsa? Well, I'd prefer they dress up like, say, Jane Goodall, you could do far worse then a set of sister's who love and support each like the movie suggests.

As for the ice show, it was solid. The costuming, choreography and ice dance were good enough to keep an adult (mostly) entertained. But it was the kid's reactions that made it all worth it. Every child I saw seemed to be loving the experience. From the older ones who were pointing out plot mismatches with the movie and questioning how'd they do that? to the little ones who just loved singing along; everyone was happy. The three year old we brought to the show, watched it with rapt attention. When appropriate, she delicately clapped for the performers. But most of the show was spent spellbound. It was so precious to see.

Sure, the souvenirs and food were overpriced, but there was magic in the air, and for a couple of hours there were many, many happy kids and parents. Who could ask for more?

Gotcha of the Day: Adding an audio stream to a video which Handbrake refuses to process

I'm using handbrake to convert flv videos to various formats on the fly. It's been working exceedingly well, that is until I tried to process a video and hit this error:

$ /usr/local/bin/HandBrakeCLI -i special.flv  -o blank.m4v --preset 'iPhone & iPod Touch'
[11:12:31] hb_init: starting libhb thread
HandBrake svn4582 (2012040901) - Linux i686 - http://handbrake.fr
2 CPUs detected
Opening blank.flv...
[11:12:31] hb_scan: path=blank.flv, title_index=1
libbluray/bdnav/index_parse.c:157: indx_parse(): error opening blank.flv/BDMV/index.bdmv
libbluray/bluray.c:1471: nav_get_title_list(blank.flv) failed (0xb6300490)
[11:12:31] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 4.1.3
libdvdread: Encrypted DVD support unavailable.
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.IFO.
libdvdnav: vm: failed to read VIDEO_TS.IFO
[11:12:31] dvd: not a dvd - trying as a stream/file instead
Input #0, flv, from 'blank.flv':
  Metadata:
    canSeekToEnd    : true
    creationdate    : Thu Oct 23 11:12:12 2014
    Encoded_By      : Sorenson Squeeze
    Encoded_With    : Sorenson Squeeze
  Duration: 00:00:04.03, start: 0.000000, bitrate: 839 kb/s
    Stream #0.0: Video: vp6f, yuv420p, 480x360, 839 kb/s, 29 tbr, 1k tbn, 1k tbc
[11:12:31] scan: decoding previews for title 1
[11:12:31] scan: 10 previews, 480x360, 29.000 fps, autocrop = 0/0/0/0, aspect 1.33:1, PAR 1:1
[11:12:31] scan: title (0) job->width:480, job->height:352
[11:12:31] libhb: scan thread found 1 valid title(s)
+ title 1:
  + stream: blank.flv
  + duration: 00:00:04
  + size: 480x360, pixel aspect: 1/1, display aspect: 1.33, 29.000 fps
  + autocrop: 0/0/0/0
  + chapters:
    + 1: cells 0->0, 0 blocks, duration 00:00:04
  + audio tracks:
  + subtitle tracks:
+ Using preset: iPhone & iPod Touch
<b>ERROR: Invalid audio input track '1', exiting.</b>

The error message is pretty clear - something is up with the audio track of the video. Running flvcheck -v showed that special.flv contained only video frames. Apparently that throws handbrake for a loop (Sorry, Charlie).

The solution turned out to be pretty straight forward. I just needed to turn to my friends stackoverflow and ffmpeg for the answer.

In the end, I used this recipe:

ffmpeg -ar 48000 -ac 2 -f s16le -i /dev/zero \
       -i special.flv -shortest -c:v copy    \
       -c:a aac -strict experimental \
       special_with_audio.flv

This ffmpeg command copies the video stream (without losing any quality) and injects an audio stream built from /dev/zero - which is a stream of null bytes.

This gives you in a glimpse into the power of ffmpeg. One can easily imagine dropping the video stream and keeping the audio; or merging the video of one file with the audio of another. Yeah, if you're going to touch video you need to learn ffmpeg.

Sunday, October 26, 2014

It's a Drive and It's Worth It -- Morven Park

Last night we attended our friends' son's wedding at Morven Park out in Leesburg. The wedding, food and festivities were exquisite (note to self: the idea of having 20+ varieties of cookies for dessert is an absolute winner! Yum!). And the venue, wow, what a place.

Morven Park is definitely worth the schlep (which, without traffic was about 45 minutes away; though the scenery and ambiance is a world away). The changing foliage made the place look like it was out of a storybook. Add to it the three museums on the grounds (where else can you see General Tom Thumb's personal coach or the Museum of Hounds and Hunting) and gardens, it's an absolute winner.

When we arrived fairly close to sunset, the place was crawling with photographers, snapping family pics.

Finally, the park hosts various experimental agriculture projects and is the home of the Presidentially Pardoned Turkeys! Though, there's no mention on the website of whether you can actually run into said turkeys.

Here's one picture of us from the evening. I'd love to go back and shoot many, many more.

Special thanks to our friend Leah for snapping the above photo - nice composition!

Thursday, October 23, 2014

Art Between a Rock and a Hard Place

Next time you're visiting Bluemont Park in Arlington (perhaps to take in a round of Disc Golf, or maybe you're in search of a healthy vending machine snack), take some time to track down J.W. Mahoney's Named Stones art project. When you find it, you'll see a sign with this description:

Arlington artist J.W. Mahoney was one of four sculptors to participate in Onsite: '89: Bluemont Park Sculpture Project, a temporary outdoor sculpture exhibition. Although intended to be temporary, Mahoney’s work, Named Stones, which consists of eight rocks into which words are engraved, endures.

For a temporary art project, choosing to carve in stone was certainly an intriguing choice. Fortunately, most of the rocks are still there and in quite good condition. I ran by Amor and Psyche yesterday and grabbed a few pictures.

I love the relatively camouflaged nature of the project and how it leads to a sense of discovery when you realize what you thought were random rocks are in fact anything but.

Go, track them down. Here's Amor to whet your whistle.

LinkWithin

Related Posts with Thumbnails