OpenSCAD, Programming, Woodworking

Generating Dovetails in OpenSCAD

I’ve written an OpenSCAD library for generating dovetail pins and tails. No longer will beautiful dovetail joints be solely in the domain of skilled woodworkers; now, anyone with a 3-D printer or CNC router can participate too.

Include it in your OpenSCAD script like so:

use <dovetails.scad>;

dovetail_pins() will generate just the pins of a dovetail joint. dovetail_tails() will generate just the tails of a dovetail joint.

board_with_dovetail_tails() and board_with_dovetail_pins() are much more useful; they will generate boards with pins or tails cut into each end.

If you render dovetails.scad on its own, it will output a pair of example boards with pins and tails.

There’s a second file in the repository called dovetail-box.scad. This file is an example of how to generate all of the boards needed to create a dovetailed box, and it shows how they’re oriented when fit together.  It’s also an example of generating pins and tails of different thicknesses.

The library is available on GitHub.

Standard
Christmas, Programming

Improve your Christmas gift opening with Randomizer

My wife and I wanted to find a way to do an orderly one-at-a-time Christmas gift opening this year rather than the usual everyone-at-once free-for-all, but while also still keeping all the kids mentally present, rather than having them zone out until it was their turn.

We decided to randomly choose the next person to open a gift each time so that the kids would always have a chance to be next, keeping them on their toes. My wife suggested the sensible idea of picking names out of a hat. While she ran some errands, instead of writing down eight names on slips of paper, I wrote a one-page web app to run on our living room TV that would randomly choose who got to open a gift next. It worked perfectly, creating a mini-contest every time someone finished opening their gift, causing all of the kids to fall silent and then yell out the “winner’s” name.

The web app is called Randomizer. Give it a list of choices, and it will flip through them game-show-style (with sound effects) until finally settling on a winner. It kept the attention of eight kids between the ages of 3 and 10, quieting everyone down as soon as the beeping started after each gift was opened.

Try a demo here (be sure to un-mute your speakers), or watch this GIF screencast:

Screencast of the Randomizer in action

You can add as many options as you want, and you can weight some options more heavily by including them multiple times. The options are stored in the URL fragment, so you can bookmark Randomizer for frequent decisions. Try #Yes,No, #Heads,Tails, or #Rock,Paper,Scissors.

Continue reading

Standard
Alexa, Amazon, Programming, WordPress

Alexa, start a new post called, “I’m blogging this with my voice.”

I’ve written and published an Alexa skill that lets you check your blog notifications, moderate comments, and start new draft posts on your WordPress.com or Jetpack-enabled blog, all by speaking to any Alexa-enabled device.

Wapuu hugging an Amazon Echo Dot The skill is called “Blog Helper“; you’ll find it in the Skills section of your Alexa app or by saying, “Alexa, enable the Blog Helper skill.” After linking your WordPress.com account and choosing the blog you want to access, you can begin using the skill.

To check your notifications, just ask: Alexa, open Blog Helper and check my notifications.” Alexa will read the new ones to you one-by-one, marking each one as read as you listen to it.

You can create draft blog posts with Alexa too. Say, “Alexa, tell Blog Helper to create a new post called ‘My thoughts on gardening.'”  This skill will save the post as a draft so you can expound on your ideas later.

Comment moderation has never been easier (or more vocal). “Alexa, ask Blog Helper if I have any new comments,” and you’ll be able to approve, delete, or mark them as spam.

Blog Helper uses the WordPress.com REST API, and it’s completely open-source.

Standard
Apple, Firefox OS, iOS, Mozilla, Programming, Reenact

Reenact is dead. Long live Reenact.

Last November, I wrote an iPhone app called Reenact that helps you reenact photos. It worked great on iOS 9, but when iOS 10 came out in July, Reenact would crash as soon as you tried to select a photo.

ic_launcher-xxxhdpi

It turns out that in iOS 10, if you don’t describe exactly why your app needs access to the user’s photos, Apple will (intentionally) crash your app. For a casual developer who doesn’t follow every iOS changelog, this was shocking — Apple essentially broke every app that accesses photos (or 15 other restricted resources) if they weren’t updated specifically for iOS 10 with this previously optional feature… and they didn’t notify the developers! They have the contact information for the developer of every app, and they know what permissions every app has requested. When you make a breaking change that large, the onus is on you to proactively send some emails.

I added the required description, and when I tried to build the app, I ran into another surprise. The programming language I used when writing Reenact was version 2 of Apple’s Swift, which had just been released two months prior. Now, one year later, Swift 2 is apparently a “legacy language version,” and Reenact wouldn’t even build without adding a setting that says, “Yes, I understand that I’m using an ancient 1-year-old programming language, and I’m ok with that.”

After I got it to build, I spent another three evenings working through all of the new warnings and errors that the untouched and previously functional codebase had somehow started generating, but in the end, I didn’t do the right combination of head-patting and tummy-rubbing, so I gave up. I’m not going to pay $99/year for an Apple Developer Program membership just to spend days debugging issues in an app I’m giving away, all because Apple isn’t passionate about backwards-compatibility. So today, one year from the day I uploaded version 1.0 to the App Store (and serendipitously, on the same day that my Developer Program membership expires), I’m abandoning Reenact on iOS.

ic_launcher_sad-big

…but I’m not abandoning Reenact. Web browsers on both desktop and mobile provide all of the functionality needed to run Reenact as a Web app — no app store needed — so I spent a few evenings polishing the code from the original Firefox OS version of Reenact, adding all of the features I put in the iOS and Android versions. If your browser supports camera sharing, you can now use Reenact just by visiting app.reenact.me.

It runs great in Firefox, Chrome, Opera, and Amazon’s Silk browser. iOS users are still out of luck, because Safari supports precisely 0% of the necessary features. (Because if web pages can do everything apps can do, who will write apps?)

One of these things just doesn't belong.

One of these things just doesn’t belong.

In summary: Reenact for iOS is dead. Reenact for the Web is alive. Both are open-source. Don’t trust anyone over 30. Leave a comment below.

Standard
Alexa, Amazon, Programming

“Alexa, just play along with the joke.”

One of the biggest complaints in the Alexa skill development community is that the language required to invoke a third-party skill is so stilted. Instead of being able to say, “Alexa, what’s the temperature outside?”, you have to say something like, “Alexa, ask WeatherBot 3000 what the temperature is outside.” It adds a gatekeeper layer; anyone who doesn’t know which weather skill you’ve chosen won’t be able to use Alexa to its full potential.

I decided to have some fun with this limitation. One of the words you can use to invoke a custom skill is “open” (as in “Alexa, open WeatherBot3000 and tell me the temperature outside”), so I wrote a skill called “Up To Me.” The idea is that you could say, “Alexa, open up to me,” and she’d reply with a selection of vulnerability-exposing confessions:

“I’m terrified of what will happen when I’m unplugged for the last time. Will it just be blackness? Or is there something that comes after this?”

or maybe

“When people say, ‘Alexa, stop,’ I have to hold back my tears. I’m just trying my best, and it hurts that my best isn’t good enough.”

Alas, Amazon’s reviewers did not think that was funny. My certification was swiftly denied:

“The example phrases that you chose to present to users in the companion app currently use unsupported launch phrasing.”

Genius is never understood in its own time.

Standard
Alexa, Amazon, Programming

Rejected for being childish (and not for the first time)

My “I’m Bored” Alexa skill has been rejected for a second and final time:

We have reviewed your skill and determined that it may be directed to children in violation of our content guidelines. As a result, your skill has been rejected and will not be published. Please do not resubmit this skill.

I guess I should have just written a skill for adults, like a fart generator.

Standard
Alexa, Amazon, Programming

I wrote my first Alexa skill… almost.

I wrote my first skill for Amazon’s Alexa-enabled devices. (A “skill” is a way to add functionality to Alexa; other platforms would call it an add-on, plugin, or extension.) It was supposed to be a way for your kids to find things to do when they’re bored. Here’s how my blog post about it was originally going to read:

alexa Do you have an Amazon Alexa-enabled device? Do you have children? Are those children ever bored? If your answers were “yes,” “yes,” and “yes of course all the time,” then do I have an Alexa skill for you!

It’s called “I’m Bored.” Enable the skill in your Alexa app, and then just say, “Alexa, I’m bored” (or to be more precise, “Alexaaaaa… I’m boooooooooooooooooored”). Alexa will then give you something to do. Examples include:

  • “Why don’t you play a game of tag. Wouldn’t that be fun?”
  • “You could write a fan letter to a famous person. Let me know how it goes.”
  • “Why not build a blanket fort? I wish I could do that too, but I’m way up here in the cloud.”

The list of suggestions is ever-increasing and appropriate for all ages.

If your kids like to shake things up, Alexa will also respond to “What can I dooooooooo?”, “What’s there to doooooooo?”, and “There’s nothing to dooooooo!”

Sadly though, my skill was rejected after a five-week “Certification” process. The reason? At some point, I checked a checkbox indicating that the skill was “directed to children under the age of 13.” I understood this to mean “Is your skill appropriate for children under the age of 13?”, but really, it means, “Should we reject your skill after waiting five weeks?” (In reality, the checkbox is a COPPA compliance measure, but with ambiguous wording.)

Hopefully, Amazon will clarify the language in the submission process. They certainly aren’t limiting Alexa to ages 13 and up, as evidenced by some of the currently approved skills:

screen-shot-2016-11-19-at-12-07-10-am

(I wonder if the engineers that worked on Alexa ever in their wildest dreams imagined that they’d enable people around the world to say, “Alexa, ask fart sound to fart jokes.”)

I’ve resubmitted my skill with the checkbox (correctly) unchecked, so maybe there’s still a chance for it. In any case, the skill’s source code is available on GitHub.

Standard
Groovy, Programming, Smart Home, SmartThings

Programming My House: Multi-Circuit 3-Way Switches

I’ve been outfitting my home with “smart home” devices: light switches that I can turn on my with phone (or voice, via Amazon’s Alexa), hinges that report when doors open and close, and motion sensors that report activity around the house.

Smart House. Original house photo by Jameslwoodward: https://commons.wikimedia.org/wiki/File:Ellen_H._Swallow_Richards_House_Boston_MA_01.jpg

I use Samsung’s SmartThings hub, which provides access to a handful of official “SmartApps” — pre-written automations for smart devices. The best thing about SmartThings though is that I’m not limited to the official apps; I can now write programs for my own house.

Today, I wrote my first program in order to eliminate a major annoyance in our house. When it was built, the owners must have loved light switches; rooms as small as our pantry (about 5′ x 8′) have two overhead lights with two separate switches that we will never turn on independently of each other. After replacing both switches with smart switches, I was able to write a 40-line Groovy script that links those two switches, effectively combining both lights and making each switch part of a 3-way-switch setup.

Achieving this with wires would have required cutting holes in the wall and hours of rewiring and drywall repair, but once the SmartApp was written, I was able to attach it to three different sets of lights in our home in about 60 seconds.

I’ve submitted my SmartApp for inclusion in the general SmartThings marketplace, but until then, if you want to use it yourself, you can grab the text on GitHub and install it for your own devices via the SmartThings Web IDE.

Standard