Friday, August 14, 2015

Spa Bench-Style Hall Table

One sign of someone who keeps clean floors in their house is a requirement to take shoes off at the door.  This at least keeps all the mess consolidated to one carefully or piled in one singular spot.  Others don't mind, get giddy when watching floors become clean like vacuum commercials, or have had irreparable damage done by paint when cleaning up the last piece of newspaper used as drop cloth during their first craft project in a brand new apartment.


To help struggling guests with their shoes, I found the incredibly awesome website of the woman-who-pretty-much-makes-my-life-literally-and-figuratively Ana White.  You pick a room/life setting + skill type, and she will have something for you.  Not only that, it'll be incredibly well documented so even if you have no idea what you're doing to start with, you will be able to create a piece of furniture.  I would totally serve up a celebratory round for her any time.
BFF

I built and painted the Spa Bench with well-placed built in shoe storage.
Apparently the bench doesn't actually make it a spa.
Of course, now that visitors have somewhere to put their shoes, they need somewhere to put random other little things.  (Jackets?  psh, way too seasonal.)  Instead, I created this small hall table to complement the bench.  It follows the same design elements of the bench, but was built to try to use up as many pieces of scrap material I have laying around my workshop.  I've also included measurements for those who don't want to try pouring outside the recipe.
<spa hall table>


Materials
3 - 1"x3"x8' boards
2 - 1"x10"x11" boards
1 - 1"x12"x13" board
wood glue
nails - optional.  (since there's not a lot of pressure on the sides, they'll hold on fine with glue)
paint or stain

Cut the 1"x10" and the 1"x12" boards down to 2 boards of 9 1/4"x 9 1/4" (shelves) and one board of 11"x11 1/4" (the top).  I used scrap for these pieces as they are often sold in much larger pieces.

Using dimensional lumber results in this having a sliiiiiiightly rectangular shape which was perfect for the space.  It also fits with the rectangular bench.  If you'd like a true square, adjust your cuts to be the width of the boards, but you'll have to change the cuts of the smaller trim sides.

From the 1"x3", cut 8, 30" boards.  These are the legs.  Pair them so you end up with groups

With each group, place the width (~3" side) of one board against the long side face (~1" side) of another making sure to line up the long edges of each together.  Essentially we want to make large "L"s with the legs.  This does mean that one part of the L will be longer than the other; that's perfect.  Glue and let dry.


Glue one of the shelves to the very top part of the legs.  Make sure that the long side of the "L"s are on the same side.
This is the long side face
Place the second shelf 3" up from the ground, and make sure this board is level.  Glue and clamp to the legs like the previous step





Now you need to make all the decorative side rails.  Measure each of the gaps between the legs, and cut the remaining 1"x3"x8" to the various widths.  I waited to cut these pieces just so they would fit the most snug and have the fewest lines.




Glue all in place!  Lots of clamping, and lots of glue.  You can see how the sides are laid out a lot clearer here.

Last piece!  We'll sand/plane the top flat after glue.

Cover the top (previously shown) with glue and set the top.  Weigh it down while drying for the best set.  I placed some heavy bags.


You're done!  Just paint and set free on the world.

</sidebar>

Wednesday, February 18, 2015

Developing NodeRed Nodes: Some Extra-Hidden Stuff

While I'm just getting into the glamorous world of webapps (middleware for life!), the adjoining planet of the Internet of Things (IoT) is starting to also gain more satellites.  If you don't know about this wonderful place, it's the name for a system of interconnected devices over a network.  Since most of these devices previously were non-network enabled, like your thermostat or your personal drone, now you can have a lot more control over how things interact and operate.  For example, when you arrive home, the temperature of your house automatically goes up to help with saving energy.  Check out this article series from Make for some more detail.

"Alright, cool, the IoT is pretty nifty," you're saying, "and I can see where it'd be useful.  Where can I get in on this action?"  Good thing you asked because.... IBM has this pretty awesome framework specifically built for the IoT called NodeRed.  Basically you can virtually wire different endpoints from a variety of different sources to create a "flow" of information leading to action.  Some people have done some pretty amazing stuff with NodeRed like weather prediction linked to lights, and live-tweeting a marathon.  There's a huge community out there with a ton of different flows, nodes, helpful hints, and tutorials.  Pretty much the only thing holding you back is getting it on your computer.  Or spinning an app up on IBM BlueMix!

It even works with Raspberry Pi.  Normally, I'm fixing you an actual pie, but just like a different citrus fruit + vodka makes a different drink, we're going the tech route today.  Mix one up and follow along.

Digging into NodeRed - httpAdmin & httpNode

Armed with some knowledge and a drink of any variety (Coffee + Developers = Code), you're ready to go off and innovate!  Before long you might find you want to create your own nodes to supplement what's currently available.  There is so much extra customization you can do before a message could ever touch your node.  One of the most powerful things is running custom scripts when you open and close the node in the html editor.  NodeRed's own documentation has some good descriptions on how to make a custom node.  Highly highly suggest checking checking that out.

However!  As I definitely learned from dojo, source code reveals a bunch of other fun features that can 100% improve your custom node.  The above doc covers details from the javascript and html files.  Since pretty much everything in the .html file is enclosed in a script tag, you could use straight up javascript for custom behavior, but why would you want to miss out on all the node.js support packages sitting right over in the .js file?

Digging through the inner bowels of NodeRed, you'll find the only real thing linking the 2 source files is registering them through the NodeRed main service.  Sidebar: hand tracing NodeRed's startup flow is actually really interesting, if you're willing to peer down the rabbit hole.  However, the main NodeRed process runs 2 express servers under the covers: one for admin work (httpAdmin) and the other for general use (httpNode).  A common use for httpAdmin is validation when signing into an external server.  Check out the twitter or mqtt node for a great use of this in action.
From twitter.html, using jquery:
 $.getJSON('credentials/twitter-credentials/'+twitterConfigNodeId,function(data) {
...
});
From twitter.js, using httpAdmin:
RED.httpAdmin.get('/twitter-credentials/:id/auth/callback', function(req, res, next){
...
});
Cool, but you just want to access all the powers of Node, you can use httpNode to create urls that you can access from your html file.  I use ajax for synchronous connections.  You define the urls just as you would in express.  My use case required me to prepopulate a drop down menu with information I could only get from a remote CouchDB server.  Now, Node has some pretty awesome packages for CouchDB, so I want to do the work there and display the returned info  You can pretty much do the same thing!
Using ajax:
$.ajax({
            url: "/kafka/getTypes",
            type: 'get',
            async: false,
            success: function(data) {
                availTopics = data;
            }
         });
So in my .js file (surpise surprise I'm working on something with Kafka!) I defined a route through the node. 
Using js:
RED.httpNode.get('/kafka/getTypes', function(req, res, next){
... //add node goodness through here
//send the information out through the response!
res.send(allStreams);
});
Only 1 place refers to the httpAdmin and httpNode that I can find.  Note: they might release something soon; crossing fingers it's more detailed than what I've provided here!  Go forth and develop!

</sidebar>