Thursday, May 4, 2017

Bigger on the inside

Daughter: I want a superhero party.
Dad: So, like Superman.
Dad: Superman uses a phone booth
Dad: Dr. Who has a cool phone booth.
Dad: I'll build a Tardis.
Daughter: Who is Dr. Who and what does it have to do with superheroes?
Dad: Shhhh. Let daddy work.

I really had no good reason to build a Tardis, except, well, to have a Tardis in the house. The kids did need some place to suit up into their superhero costume, which included a mask and a cape we made. In all honestly, I know they could have just gone behind a curtain, but who passes up an opportunity to build a Tardis?

Having a huge refrigerator box really helped as a skeleton for the project. I wish I could say that I planned the whole thing, but I really just started slapping scrap wood onto the box until it started to look like something. The wood strapping was the cheapest thing I could find at Home Depot, I always keep some around, though in this case I had to stock up again.

I knew from the beginning that I'd have to assemble it in the garage and move it into the house at some time. So, I took some extra steps to make sure two corners could open and the other two could collapse, which let me then fold the box flat-ish to get it through doorways. It was like having a bigger space fit into a smaller size, i.e. it was bigger on the inside than the outside...

Getting cheap paint was much easier than I thought. I was able to talk to the guy working at the paint counter to mix in some blue into a "clearance/returned" can. I wasn't able to guarantee a "Dr. Who blue", but for only a few bucks I was able to get a high quality paint that did turn out pretty close to perfect.

Side story: While I was working on the Tardis, the wife was off sewing capes, creating a bunting banner made out of old comics and creating a city backdrop to stand in front of for pictures. I was very impressed and it made for a great themed birthday.

Stick 'em up

After every birthday party for my kids, we say, "Wow, we did too much and we'll never do that again." That's not from the typical craziness that exist at every kid birthday party, it's from whatever we ended up making. We always seem to make something for each party. In this case, the kid in question was getting old enough that we didn't need a "theme" and the kids were going to have lots of energy. We had been to the MakerFaire earlier in the year and picked up some marshmallow shooters. We knew other kids would have fun using them, and we liked the idea of the kid making something themselves. 

We had a bit of a moral dilemma sending home kids with what are essentially guns. We've avoided them in our house otherwise up to this point, but we realize that most kids, especially little boys, already have some toy gun. In this case, they'll have made it themselves and end product is yummy. Would parents potentially hate us? ¯\_(ツ)_/¯

I essentially copied the design from what we got at MakerFaire and made an assembly line. Stops clamped on the saw really helped cranking out cuts.

It took me much longer than I would have thought to cut all the pieces. The mess from cutting that much PVC with a chop saw was very annoying. I was covered in little electro-statically charged pieces of plastic for what felt like days. (This was my motivation to get a Shop-Vac to hook up to the saw for future projects.)

We packaged them up in little baggies. It was then up to each attendee to assemble them. We didn't provide any directions except for an example model. Most kids got it, and it was great seeing them help each other.

I had the birthday girl assemble the baggies and make targets for target practice. It was pointless though, because the kids (obvious in retrospect) just shot at each other.

We also had the kids personalize their shooters.

Wednesday, May 3, 2017

Halloween and Chill

If there ever was a Maker's holiday, it'd be Halloween. It's the one holiday where making something is preferred over buying from the store. There's also a wealth of items that can be made, from costumes to decorations and even candies. 

As a family, we try to make one new thing each Halloween. Something we can re-use year to year. In 2014, we wanted to add some atmosphere and smoke sounded fun. The making of smoke is a solved problem, and most easily done by buying a smoke machine on Amazon. The problem is that the smoke (or fog if you want to call it that) goes everywhere. It looked more like a 1st Alarm fire and I expected the fire department to show up any moment the first time I tried it. A little googling and I was able to learn that this was a solvable problem but expensive. Makers to the rescue!

TL;DR Here's what the final product produced:

Luckily the basic idea of thickening smoke is well documented, and the basic idea is to make it cold. Duh. Passing the fog over ice (or dry ice if you're being fancy) is the simplest solution. I'm not sure I'm being economical or efficient or just plain cheap, but it made sense to use what I had around, and in this case I had a cooler from an old roommate. Here are the materials I used:

The plan was to create a two holes and hope that the pressure from the smoke machine would push the smoke through the cooler. I hadn't actually made a hole this big before so I had to buy an Arbor and Hole Saw. This in the category of "things that are hard to google for until you know what it's called."

Another "known unknown" was what would happen as the ice settles. My worry was that the ice would move around and prevent the flow of smoke. I was pretty quick to think that I needed something to prop up the ice away from the inlets, but it wasn't obvious how I would do it until I roamed Home Depot for a little while. The answer was paint tray screens. They have plenty of air flow, are structurally reinforced and are cheap. Even better was that they were coincidentally exactly the same width of my cooler. To prevent them from slipping around and to make good contact, I had to bend them. Putting a board down where I wanted the bend produced really clean bends.

Clearly smoke is mean to take up a lot of volume, but I can't exactly use a foot wide tube. My compromise was to use standard 4" PVC tubing. One obscure blog hinted that for the smoke machine to work, it needed air near the nozzle. The idea of opening up the area around the nozzle was completely contrary to what I was trying to accomplish. I took a gamble and put some screening near the nozzle that I could constrict the airflow later if I had to. It can't actually guide the smoke, but luckily the smoke shot out with enough pressure that I never got back-pressure out this screening.

Everything came together really easily and I didn't use any PVC glue for the pipes or anything to attach the paint screens, it just all fit tightly. Though some smoke did leak out the lid of the cooler, but it was an acceptable amount. The smoke was definitely thicker and contained, but it was concentrated in a specific area. I did what anyone would do when they have 10 feet of 4" PVC tube laying around and a 4" Hole. With a few outlet holes, it distributed the smoke really well.

I was pretty happy with the final product, and we've used it for last few Halloweens. 

Thursday, May 19, 2016

SSD Sneakernet

Never underestimate the bandwidth of a station wagon full of tapes hurtling down the highway.
-Andrew S. Tanenbaum, Computer Networks, 4th ed., p. 91
Twenty years ago the standard of measure of a high-throughput Sneakernet was a station wagon full of tapes. In 2016, we can do a little better. Let's see what we can do with a station wagon and modern storage. First, let's start with a fancy Volvo XC90. It has 85.7 cu.ft. of cargo space and a maximum load of 1521 lbs (148089.6 and 24336 ounces, respectively). (For those nostalgia Volkswagen fans, you can mentally think of 1982 Vanagon which has similar cargo capacity of 93 cu.ft.)

You might jump to a large HDD, like a WD Blue 6TB HDD. It has the dimensions of 5.8 x 4 x 1 inches and a hefty weight of 15.8 ounces. Those dimensions give us 23.2, meaning we could fit 6383 drives into the XC90. When you look at the weight of all those drives, adds up to 100851.4 ounces (6303lbs), which is way more than the car can handle. So, we can look at it the other way, how many can we fit by weight. The answer is 1540 drives, providing 9240 TB (9.24 PB) of bandwidth.

If we were to consider the edge cases of loading the data on to and off the disks (left to the reader to add to the calculations), we have to take into consideration the transfer speeds of the drives. In which case we should also consider SSD's, since they do offer significantly superior transfer speeds. For example, the highly rated Samsung 850 PRO 2 TB SSD. It has the dimensions of 3.9 x 2.8 x 0.3 inches (3.276 and a feather-weight of 1.9 ounces. I almost can't believe it, but that means the XC90 could fit 45204 drives. Though we run into the weight issue again and have to limit ourselves to 12808 drives. That provides for 25616 TB (25.62 PB) of bandwidth. So, clearly SSDs are the way to go.

One angle I don't see discussed often is the units for this kind of transfer. We can't just take the total bandwidth and say "per second". The same data is transferring in half a second and over an hour. We all know that cars are driven in miles per hour. So the units we have available are TB * miles / hour. We can make the simple conversion to seconds to make it feel more like a fiber OC192 link, but we eventually have to deal with the distance aspect of the units, which for us is miles.

Let's compare transferring the data from the car (travelling at 80mph) versus a Gigabit ethernet, a 10 Gig and a 100 Gig connection:

The larger scales make it hard to see, so here are the numbers:

The times are in seconds, so 4.50E+02 is 450 seconds, which is 7.5 minutes. So, this is saying over the course ten miles, it'll take the car 7.5 minutes to transfer the 25.62 PB while the 100 Gig Ethernet will take 569 hours (2,049,280 seconds divided by 60 seconds in a minute and divided again by 60 minutes in an hour). The station wagon wins! Only until about 45,000 mile mark does the 100 Gig Ethernet catch up. Logically, the 10 Gig Ethernet catches up around 450,000 miles and the 1 Gig Ethernet catches up at 4,500,000 miles.

A quarter million miles is an interesting number because it's the distance to the moon. So.... an XC90 could drive to the moon with 25.62 PB of SSD drives and still be twice as fast as a direct 10 Gig Ethernet connection to the moon. Sneakernet FTW!

(Apologies to every country except the USA for use of the Imperial system.)

Tuesday, May 21, 2013

Cord cutter

What do you buy a tech geek, who just buys gift-priced items throughout the year, for their Birthday? I just had a birthday, and I have no idea how my wife can find something that I don't already have.  It's not like I'm going to wait 2 months to buy a Roku or Shoes just because its temporally near my birthday. In contrast, a big gift wouldn't be a big surprise since everyone should coordinate something big (I've been burned by that, but that's another post).

This years gift was most fortunately by-chance. At a yard sale for some kids clothes, I stumbled upon a pair of Sennheiser HD-280 PRO Headphones. I had forgotten that I was on the lookout for new headphones, but seeing them there reminded me. The model number sounded really familiar too from my research. My mom taught me how to conduct myself at a yard sale, and jumping onto your phone to do research should be avoided (we wouldn't want to show our interest too much). A little flippant negotiation and I walked away with them for $3. They retailed for $150 when I was looking, but they seem to be down to $99 now.

Just getting a deal like that is like a present, but also getting nice replacement cans was the cherry on top. I used them for a little while in Neverwinter and with some FLAC files, then I quickly realized that I couldn't go back. They're great. There was one problem, the 1/8" plug was flakey. I tried putting a 1/4" collar around it, a complex set of rubber bands, and a few other things, but it was really sensitive to any movement. The solution was to replace the cord. The first option was to buy the replacement cord directly from Sennheiser for $30. That's not cheap, but given how little I paid for them, it's very reasonable. But what about when the cat chews on the cord? Or my daughter practices her scissor skills? I had just gone to Maker Faire, and wasn't going to let this opportunity to permanently fix them slip me by.

I modded them with a 1/8" jack, so that I could replace the cable in the future really easily. The Dr Dre Beats Headphones takes this approach and consequently has made a market for 1/8" to 1/8" cords just for headphones. I was little scared of taking them apart, doing some gutting out with a Dremil and performing some soldering. But, what the hell, they were only $3. Luckily the Sennheiser cord actually can detach and uses standard headers that I had laying around.

I had planned on ordering from Amazon and crossing my fingers that the jack would fit, but it occurred to me to check Radioshack and amazingly they had the part and it was in stock. That meant I could pick one up on my way home and get started right away. It came together really fast and I had it done just before 9pm. I used a closed-circuit panel mount plug, which sat really nicely after some plastics was drilled out and looked like it was originally there. I think they turned out really well. Future replacement cords can now just be bought from monoprice for a few bucks. I now also have the possibility of buying a cord with control buttons that I can use it with my phone.

I highly recommend attending Maker Faire, if there's one in your area. I left with some motivation and eventually granted some satisfaction from "making" something.

Call all the things!

At Gradle's core is a really nice set of Collection classes, which I wish were exposed on their own. The central feature is the idea around the all(Closure action) method, which says "run this Closure on every object", including ones added later. This is defined in DomainObjectCollection and it's leveraged by a few other methods. Specifically withType(Class<S> type, Closure configureClosure)and it's generalization matching(Closure spec). While they're very similar to Groovy's (and other languages) findAll or each, the extra temporal dimension makes it much more power for an API designer. Typically an API would provide a Collection which delegates to another collection while putting some triggers in place when something is added. With DomainObjectCollection, the user could create the collection and even prep it before passing it into an API call. It also allows multiple people to essentially register listeners, sorta like a property listener. In the following example, I configure other parts of the model based on what they all, for any value added or which will be added.

Loading ....
Another useful generic Collection is NamedDomainObjectCollection<T> (with its supporting implementations). These allow a collection to be built up with the assumption that each has a unique name, and it's really not too far from a Map with the key being the name. The magic comes from being able to build up an instance with methodMissing calls. The resulting calls look really slick and screams "DSL", I wish I had it for every Groovy DSL I write. As you can see in the next sample is a minimal way to create a list, which also has the ability to be configured for each item.
Loading ....

Tuesday, May 7, 2013

Another soul lost to Ubuntu sound issues

People have very selective memory (remembering the good things and forgetting the bad things). This is very true for the first few years of being a parent. It's also true for sound support in Ubuntu. Every time I upgrade my desktop's version of Ubuntu, I seem to be effected by some odd unknown problem with my Intel HDA sound. I say "seem" since I have selective memory about having trouble with it. But the last few days have brought all the horrible memories of scouring forums and bug tracking sites from years ago. Each of which gives "advice" that potential only cripples a system in other ways. For example, installing some PPA that hasn't been updated, or using OSS instead of ALSA, or ALSA instead of pulseaudio. Let me immediately say that I don't fall for them, I only browse them hoping that someone has commented on them with some real help. I found the best summary of this problem in an article titled "Top five wrong ways to fix your audio." The problems stem from Canonical having two audio troubleshooting pages. The first one, "SoundTroubleshooting" is outdated and downright dangerous, then it says to the use the second page. The second page, "DebuggingSoundProblems", has no more than "is the speaker plugged in."

My most recent upgrade to 13.04 manifested itself as ALSA being fine and pulseaudio silently coming up with no devices. This was good since it eliminated a slew of problems with the kernel, which is where 90% of ALSA really lives and consequently problems with how the modules are loaded. The way I knew this was running "aplay -L" to see which devices ALSA knew about. You can also run "alsamixer", but it won't give you device names. The best diagnostic tool I found for ALSA was speaker-test, which can target any of the multitude of drivers available. I quickly learned that some process has taken over the default sound device, via a "Resource is busy" message. I'm still not sure why "lsof /dev/snd/*" did tell me which process was grabbing the device, but a quick scan of "ps aux" showed the culprit as Pulseaudio. Odd, since Pulseaudio was exactly what I was trying to get working.

The breakthrough was realizing that the owner of that Pulseaudio was a user called speechd, which I assumed was some sound daemon, but proved to an artifact of the speech-dispatcher package. It turns out that this package starts up early on, starts its own Pulseaudio and never gives it up. It didn't take long to know that I didn't need a speech library for Lisp. Uninstalling the package did fail, but a manual userdel and it was cleanly gone. A nice side effect of uninstalling speech-dispatcher is that Ubuntu starts up twice as fast, and now safely shutdown (which it couldn't before).

I'd like to believe that my diagnostics process was this clean. Not even close. There were hours of trying new kernels, snd_intel_hda settings, and pulseaudio configurations. At this point I'm expecting to have another sound problem come November, but hopefully there's one less way it can fail without me knowing how to fix it.