Monday, November 30, 2015

Morocco Adventure - Day 6 & 7 (Preview)

Here's a few more photos from our adventures in Morocco. They include snapshots from a day hiking and one visiting a port town. Lots of stories to come, stay tuned.

Saturday, November 28, 2015

Morocco Adventure - Day 4 & 5 (Preview)

We're still having a blast in Morocco! We've made it from Rabat to Marrakesh, and survived the day walking the maze-like Marrakesh Souk (Shira didn't get lost once!). Here's yet another preview of our adventure.

Wednesday, November 25, 2015

Morocco Adventure: Day 1 & Day 2 (Preview)

Greetings from Rabat, Morocco! We're having an awesome time. Stay tuned for a full blog post and photo set. In the mean time, here's a preview of what's to come.

Monday, November 23, 2015

Flaming Festivities!

Shira knows I'm no big fan of Hibachi. But who can resist celebrating a birthday in style? Happy 11th dude, we're so proud of you!

Reading Racket Documentation on Android, No Internet Needed

I've got emacs and racket running nicely on my Android phone (thanks to the awesome Gnuroot). But that left me with a new wrinkle: what's the best way to access Racket Documentation while programming on my phone? Obviously, I can open up a browser to but what if I'm a context where I don't have access to the Net?

By default, apt-get appears to install racket documentation in /usr/share/doc/racket, which means that my phone had the documentation, I just needed a way of viewing it.

Method 1: w3m. A quick and easy way to view the documentation is to run apt-get install w3m, and install w3m. w3m is an extremely handy tool as it lets you view html files from the command line. For example:

Method 2: launch a local web server. While w3m is a fast and functional solution, I wanted to be able to view the documentation in a standard browser, too. I figured I could accomplish this if I kicked off a local webserver. I could then point my regular Android browser to this server and I'd be all set. While I'm sure I could have installed apache or another full featured server, I found an easier and lighter weight solution: wbox. wbox is a testing tool that happens to offer the capability of being a stand alone, zero configuration, web server. Installing wbox is as easy as running apt-get install wbox. And here it is in action:

(Note the URL is: http://localhost:8081)

wbox worked perfectly, and I should be able to leverage this same approach to hosting any local documentation.

Combine this local web browser approach with Android Multi Window, and you've got a remarkably functional environment.

I'm one step closer to a full self contained, no-Internet-needed, development environment.

Friday, November 20, 2015

First Impressions: Software Defined Radio - Cheap and Remarkably Powerful

For some time, I've been meaning to add a radio to my Jr. Go Bag. I figure it would be helpful for entertainment purposes and emergencies. There are a number of low cost, compact, high quality'ish FM/AM options out there, but none of them were every low-cost, compact or high quality enough for me to pull the trigger on them.

On a whim one day, I Googled for Android USB Radio and discovered the world of Software Defined Radio. Sounds expensive and complex, right? Actually, it's just the opposite. For less than $10, you can buy a USB stick which works with SDR Touch, an Android app that uses the stick to pull in radio signals.

I did some more research and finally splurged on this little dongle, here: Mini DVB-T RTL-SDR Realtek RTL2832U + R820T Tuner Receiver. Last night it arrived and this morning I plugged it into my phone and fired up SDR Touch. It took a few minutes to get orientied, but check it out:

That's my phone listening to two different frequencies: the first being a local Rock station, the second being air traffic control at National Airport. And here's a shot of the radio dongle itself:

My original goals of cheap and compact have been met*. It's hard to say about the quality compared to other radios, but there capability definitely exceeds expectations. Being able to pull in seemingly random signals (like the the Air Traffic Control) is just too cool. And SDR Touch offers some impressive features, including the ability to record incoming audio.

I've still got a lot to learn about Software Defined Radio. But I've got to say, it's not often you stumble on technology that's so inexpensive and yet so very powerful.

* OK, mostly met. I still need to optimize the antenna, which is a bit bulkier than I'd like.

Thursday, November 19, 2015

Thermaroid: Android + a Thermal Printer = Super Cheap, Super Low Quality Photos on the Fly

Thermaroid lives! Today I finished smooshing together my Camera API progress with my past success printing to a Bluetooth Thermal Printer. The result is a drop dead simple app. The app starts up with absolutely no UI, it's just a live camera preview. Short press on the screen and the camera focuses. Long press the image is captured and sent to the Bluetooth printer. Here's an action shot:

(Yes, that's a screenshot of me using Thermaroid to take a picture of a picture that I just printed out with Thermaroid. Got that?)

The app needs quite a bit of polishing before it's ready for prime time, including: some indication that your photo is being printed and proper code for backgrouding the printing process. But functionality wise, it works.

I think I'm finally getting the hang of using Kawa Scheme to build apps. Apparently I needed to let go of this notion that I could somehow write Java code using Scheme's terse conventions. Kawa lets you do this a bit, but at the end of the day, things seem to work better (or compile with fewer complaints) when you annotate your code with types. I'm definitely interested in seeing if I can do some refactoring to eek out a bit more elegance than purely translating Java to Scheme. We'll see.

Check out the code here. And happy photo'ing!

Wednesday, November 18, 2015

A DC Anti-Monument

In a city filled with large, seemingly permanent monuments, I had to appreciate this little guy here:

Doing Battle With, and Losing To, the Android Camera2 API

I'm back to fiddling with with my Android Bluetooth Thermal Printer. Specifically, I'm building a small camera app that outputs to the printer directly, rather than saving files on your phone.

Looking at the Camera API, I realized that it was now deprecated, so I started building the app using Camera2. I'm not proud to admit it, but Camera2 beat me. I give up. That's one complete and crazy API to use. That's not a bad thing, it's just not ideal for quick little apps.

Oh, and all of this is written in Kawa Scheme. So if you're looking for Scheme Android examples, or how you might invoke the camera from a Scheme app, check out my project's repository, hopefully it'll be of some use.

For now, the app does little more than open up the camera, switch into preview mode and focus when you press the screen. But hopefully with the Camera functionality in place, hooking in my existing Thermal Printer Code shouldn't be too painful.

Two gotchas that I overcame:

1. I was getting the message: A TextureView or a subclass can only be used with hardware acceleration enabled, and of course the camera didn't work. I tried turning on Hardware Acceleration in the AndroidManifest.xml. That made no difference. Ultimately, it was this note that solved the issue:

The default value is "true" if you've set either minSdkVersion or targetSdkVersion to "14" or higher; otherwise, it's "false".

Turns out, I wasn't setting minSdkVersion at all. I did so (setting it to 22), and that fixed the issue.

2. I fired up the camera preview but the screen remained black. There were no messages in the Android monitor so I was baffled. Then it hit me: the camera is lying down on its lens, of course the screen is black. I picked it up, and the camera view showed the correct image. What the heck was I thinking?

Here's the project if you want to follow along: Thermaroid


Related Posts with Thumbnails