Some notes on TIS-100 programming
I've become enamored with the recently-released Zachtronics game TIS-100, a game very much oriented at low-level programmers.  The conceit is that you've discovered this weird computer from your uncle's estate that comes with a few instructions and a wiped memory where different programs need to be implemented.  However, it's not a straightforward CPU, but instead a grid of micro-CPUs that communicate with each other.  As you develop your programs, you get feedback based on your friend's efforts, often showing you that it's possible to build the same app with fewer instructions or that runs quicker or takes fewer nodes.  At the same time, you're finding corrupted notes from your uncle linking to some sort of conspiracy.

I'm about 1/3rd through with it, but already have hit some very creative challenges.  I like the achievement system, as it pushes you to try alternative ways to build things.

Here's some techniques I wanted to write down:
Read more...Collapse )
Saturating math: the registers on the TIS-100 are limited to the range -999 to 999.  Unlike most modern CPUs, if you overflow, it will stay at the maximum or minimun value.  For example, -900 - 200 = -999.  You can use this to identify positive or negative values without using the IF instructions... to make the ACC register 1 when it's current value is positive means you'd write:

ADD 998 # any positive number will now be 999
SUB 998 # positive numbers will now be 1, zero or negative will be less
SUB 999 # zero or negative numbers will be -999, positive numbers will be -998
ADD 999 # transform into 0 or 1

The negative-finding form is similar.

Pushing extra copies: Sometimes you need to compare a value and then use it again, but the original comparison destroyed it's value in your ACC register.  Doing a SAV and SWP takes two instructions, but having the value pushed to you twice means you only need one instruction.  The main pitfall is sometimes this means doing a MOV to NIL because you've got to use up that node's push to unblock it.

Using a node as an extra register: since a node only has one register, ACC.  There's a saved version of it that you access with the SAV and SWP instructions, but there's no way to say something like "ADD SAV".  When you need some storage, push the value to an adjacent node, then have that node push it back one or more times.  A variation on this is a make a smart register where you push a control value that then will cause it to either accept your next push to save into it's value pool or push it's stored value back to you.

Splitting up computation: In order to reduce runtime, look for ways to split up complex tasks across nodes.  Since they all run in parallel, this will often reduce the overall runtime of your program.  It also is a good way to avoid needing to use the backup register to save state.

Set up a back channel: the natural way for you to write nodes means values go in only one direction. However, sometimes it's useful to pause an upstream node for it might also be pushing values to a neighbor. In that case, have the upstream node wait on a push from you and signal it with a value when your done.  This technique seems to be mode useful when you start working with stack nodes, as you don't want to be pushing into a stack from one spot while you're reading from the stack in another.

On Safari, URL Redirection, Instagram OAuth, and Fragments
2008 Headshot
I've been building a Pebble watch app, Phantom Camera, and I published it earlier today on the Pebble store.  A few minutes later, a fellow developer said that the configuration page wasn't working on iOS.

This led to an afternoon-long exploration.

My searching led to a WebKit bug - - which indicated that Safari didn't preserve URL fragments across a redirect.  So, if you navigate to foo/a.html#42 and foo's server redirects you to foo/b.html, you'll not have that #42 applied when the browser loads the b.html page.  However, this didn't seem to apply, as Instagram was putting the hash in the URL it sent.

My authentication with Instagram uses redirection.  I send the user to a URL on the Instagram site, they handle having the user log in and allow my app, and the server then uses a HTTP 302 redirection to return them to my page with the token in the fragment.

On Android and in Firefox and Chrome, I was seeing this working fine.  I'd get the token, JavaScript in the page would read it from the window.location, and all would be fine.  On iOS Safari, the user would see the "authorize" button again.  When I tested manually, I'd see the page load with no token in the URL.

After lots of testing various things, I found myself looking in the network monitor tab in Firefox again, and I noticed an extra 302 redirect.  It turns out that my page was hosted at, but I'd specified in the URLs for Instagram.  My web host did a 302 redirect to, and that second redirect was losing the hash with the authentication token.

Chaning my redirect URL to use directly fixed it, and now its working on all the platforms.
Tags: ,

Notes on Austin's Solar Policy
2008 Headshot
(This is from a talk I gave to the Trinity Social Justice class in May)

Austin's Solar Policy

- Austin Energy has committment to buying solar energy
- aiming for 35% renewable by 2020, 55% by 2025
- City of Austin wants to move to renewables
- Latitude means solar is fairly effective here in central Texas

How Does Solar Power Work

- solar cells are made of silicon with dopants that make them semiconductors
- photos from sunlight push electrons out of the cell, making a constant pressure or voltage
- this power is direct current -- it flows in one direction, and the current flow is dependent on
 how much sunlight hits the cells and the angle of the sunlight, and the temperature of the cells (hotter is worse)
- the power grid is alternating current with a constant voltage
- to adapt the energy, you use a device called an inverter that connects to the grid and the solar system,
  and transforms the solar power into grid power
- you often see the opposite form of these (in small) with power adapters that convert AC to DC for running digital devices like computers and cell phones
- Tesla just announced an inexpensive home-battery system that would let a homeowner save the solar power in DC form instead of feeding it into the grid

Cost of Solar

- Equipment and Installation
- Need sufficient unshaded roof or yard space to make it viable
- On my house, I have 14 200W panels, for a total system size of 2.8kW
- in practice, I never generate 2.8kW of power.  I've seen the system hit 2.6kW on really perfect days.
- On an awesome day, I'll generate around 18kWH of electricity.  For April, this generation really starts around 10am and goes through 6:30pm.  So, that's 8 1/2 hours of generation

- System cost about $15K to install
- 30% of those costs were returned in the form of Federal tax credits
- They estimate system costs as being 2.2K to 4.5K per kW
- I used to do my initial estimates

Austin Energy has two incentive programs for homeowners
- solar PV
  - Austin Energy rebates $1100/kW installed
  - they pay $0.113 / kWh, so I get a credit of about $2/day for my system at peak performance
  - max credit of $700ish year, but I've actually gotten more like $350 of credit a year
  - residental customers tend to pay $0.087 per kWH for first 500, then $0.134 for next 500
  - you still pay AE for the energy you use --
  - on a good month, it covers half to 2/3rds of our usage

Veggie Lunch Places, North Austin, June 2015
2008 Headshot
More for my reference than anything, I wanted to post a list of the places I go on occasion for lunch now that I'm working at Roku in the Arboretum area of Austin.

East Asian

  • Fire Bowl Cafe at Arbor

  • Hai Ky Cafe on Spicewood is the former location of Triumph Cafe and has pretty good kung pao tofu and tofu bun (vermicelli)

  • Coco's Cafe on 183 has tasty soup and tofu dishes and bubble tea


  • Masala Wok at Arbor Walk (Mopac) has really yummy soup and pretty good Indo-Chinese dishes

  • Tarka on Anderson has good palak paneer


  • Conan's Pizza on Anderson - go on Tuesday for "Don't Choke Art" or Thursday for Mushroom & Spinach on the buffet

  • Doubledave's Pizza on Mesa - just opened in May, usually has veggie pizza and spinach stromboli on the buffet

  • Mangia on Mesa - stuffed spinach pizza


  • Jersey Mike's on 183 is a common lunch destination for my co-workers, I like the cold veggie sub with lots of peppers and light mayo

  • Texadelphia at Arbor has grilled veggie "cheesesteaks" with waffle fries and yummy mustard sauce, plus my card gives me a free meal at birthday time

  • Big Daddy's at Burnet & 183 has pretty good veggie burgers and fries, including the Chris Chronic with ghost pepper aoili

  • Which Wich on Anderson lets you custom build sandwiches with lots of veggie options

  • Jimmy John's at Braker has an OK veggie sandwich, and they very frequently deliver to the office

  • Black Star Co-op has a great grilled cheese and fries, get it with the fresh jalepenos


  • Bullritos at Arbor is passable burritos and nachos, but mainly included because it's close

  • Dos Batos on Anderson has a tasty torta with wood-grilled veggies and very nice bread

  • Chuy's at 183 & Duval usually has outdoor spots and a great veggie combo


  • Zoe's Kitchen at Arbor has hummus plates and Greek salads

  • Newk's Eatery at Arbor has pizzas and salads with huge glasses of tea and lots of free peppers

  • Trader Joe's at Arbor has good stuff in the cold case to bring back to the office

  • North by Northwest has good pizzas and sandwiches

  • Salata at Arbor Walk has build-along salad bowls

Random Shotbottery
2008 Headshot
I had my second one-on-one session with TechShop's ShopBot Alpha tonight, and I hit a few obstacles. My first time was using 3/4" MDF and it worked out very well. This time, I was using 3/4" pine, and I had a bit of unevenness with the depth of cutting.

My first problem was setting the wrong Z dimension in my original file. I had Z=0 at the bottom of the part, not the top. This caused a lot of confusion with setting the zero point on the table, and I ended up using an offset to get things right. However, I was guessing at it, and may have been off in my calculations a little.

My second problem was not tightening my collet enough to hold my endmill. I thought it was adequate, but my depth kept changing during my second cut, and when I stopped the tool and checked the tightness, it had loosened a lot.

My third problem was holding the wood to the table. I'd used the composite nails to good effect, but with a couple of false starts, my final work was far enough down on the wood to be beyond my last nail. I think this was responsible for the exterior cut gouging the surface a little. Fortunately, it was a small cut and the TechShop DC gave me a pass, but I really want to avoid this problem in the future.

My last problem was using too high of a plunge depth. I had to adjust VCarve Pro's tooling database to add the 1/8" endmill I was using, and while I correctly updated the diameter, I forgot to update the depth, and I think that let to too deep of an initial cut which then led to having the uneven bottom surface.

My final part was OK, but it will need a bit of manual work to clean up parts, and I already had some chipping from the pine in part of a relatively thin interior wall.

Lessons learned:

1) remember to run VCarve with Z=0 set to the top of the part.
2) when adjusting your endmill settings, make sure you adjust all of the parameters
3) when using natural boards, it's probably a good idea to plane them first to ensure a uniform thickness
4) when affixing the board to the surface, go a little overboard with the composite nails. Why use four when six or eight would work?

Moving On from LG
2008 Headshot
(originally posted to the enyo-development mailing list)

Hello, Enyo developers.

Friday was my last day with LG Electronics; I've left to pursue a new opportunity with Roku working on new product development here in Austin, TX.

I consider Enyo to be a great product, a result of excellent architecture work by the original developers and a very thoughtful and innovative evolution of features. I'm really proud of what we did in the last year under LG, and I'm looking forward to the Enyo and webOS-powered LG SmartTVs hitting the US market soon.

The good news is that LG is still fielding a great Enyo team with a bunch of great developers that are keeping the work going, including Gray Norton, Kevin Schaaf, Cole Davis, Blake Stephens, Aaron Tam, Jim Tang, and Lex Podgorny, as well as the LG teams from TV Lab in Korea. Look for their input here as part of our public Enyo conversation; I expect great things to come.

I'd also like to recognize all the wonderful input from the community; your pull requests and questions have made Enyo development much more enjoyable, and I'll miss working with you.

I'm still going to follow this email list and check up on things from time to time, but I'm no longer speaking in my role as project lead, just as team member emeritus. My day-to-day work is going to involve firmware development for embedded hardware, so I won't be spending too much time in the web development world.

Thanks, and best wishes to you all!

More Trotec Laser Cutting Tips
2008 Headshot
One good way to get horizontal symmetry is to set your document width to match the exact size of the material you're using, then select all of your objects, group, and center horizontally in the document.

If you're doing a double sided design where symmetry is important, be sure to do a horizontal flip before printing in Corel Draw to make sure things line up. I learned this the hard way working on the Enyo ornaments.

When you do your test run, look for overdraws and edit those out using the Corel object editor. Auto-trace can often leave these in, and they just end up causing longer jobs and scorching.

When you're mixing engraving and cutting, make the engraved bitmap the black color. For some reason, Trotec's software just wasn't seeing non-grayscale as something that could be etched, even though Job Control allows setting that up. It's OK to use lots of colors for all your cutting layers.

When possible, use multiple colors for your vectors to order cuts. This is important if you're cutting small features out of larger shapes and using plywood that has a tendency to be uneven, so if you cut the larger features first, you may be out of focus for the interior ones if the work material has dropped.

Always use the job estimation feature in Job Control. Not only does it show about how long the laser will take, but it lets you know quickly if the software isn't understanding your layers.

Some Laser Cutting Settings for the Trotec Speedy 300
2008 Headshot
I've been spending more time at Austin's TechShop lately working on projects... my creativity has been desperately needing some outlets. One project involves making molds out of plywood for vacuum forming, and I'm using layers of laser-cut plywood for this, since I need some pretty precise heights.

The standard TechShop laser here in Austin is the AWESOME Trotec Speedy 300, far more powerful than the Epilog 40W laser that we had at Resistor. However, that's meant having to adjust my settings for various materials with a lot of trial and error.

Here's some values that worked pretty well:

5.2mm birch plywood: for cutting, use one pass 100% power, 0.70 velocity, and 1000 PPI. For relief engraving, use 60% power, 20 velocity, and 1000 PPI.

1/4" MDF board: this took a lot of tries, as it's very dense with lots of layers to cut through and also tends to smoke and flare up. I would end up having to do run after run which would scorch the material. No fun. What ultimately worked for cutting was 100% power at 2.0 velocity for five passes, each one adjusting the Z-axis offset 0.05". That was fast enough to not flare up as badly, and adjusting the height kept the laser cutting the bottom layers of material instead of just burning the sides.

A Few Skills Needed to Maintain a Modern JS Framework
2008 Headshot

While working on my talk at this year's OSCON, I brainstormed a list of skills that I used in my day-to-day job of keeping the Enyo JS framework going. It got to be a lot larger than I thought:

  • know JavaScript front and back
  • track evolving work in the JS standards world
  • follow interesting techniques from other libraries and tools
  • watch interesting language work that can build on JS (CoffeeScript, TypeScript)
  • plan future direction of your own library
  • understand web browser implementation
  • be aware of quirks and differences between common web browsers and versions
  • understand CSS
  • follow interesting work in CSS standards
  • follow new developments in applications of CSS
  • watch development of tools to enhance styles
  • understand algorithmic complexity
  • understand memory allocation systems
  • be an expert of profiling systems for CPU and memory usage
  • develop your own tools
  • have a working knowledge of front-end build systems
  • understand language minification
  • understand node.js for its use in building tools
  • understand HTTP and follow future HTTP work
  • understand XmlHttpRequest, its various versions
  • understand cross-domain issues and be able to specify how to handle them from client & server
  • understand WebSockets and follow its work
  • understand web security issues and be able to audit your code for problems
  • understand code coverage tools
  • understand test frameworks and testing strategies
  • understand and use continuous integration systems
  • have a good working knowledge of current GPU hardware and its capabilities
  • have a knowledge of Linux systems and how to measure whole-system performance
  • understand the DOM rendering, layout, and painting loop for WebKit
  • have good personal skills
  • be interested in helping other developers with their problems
  • have knowledge of social software systems (forums)
  • have expertise on version control software
  • have expertise on using GitHub to manage a software project
  • have expertise on usign JIRA to manage issue management
  • understand compilers and the limits of what a JIT system in your JS engine can do
  • have working knowledge of various coding standards and defendable opinions
No wonder I feel like I don't have much free time!

TechShop project ideas
As I've been taking classes at TechShop and getting trained on the various tools, I've been trying to catalog some project ideas. Rather than keeping them all in my mind or on scraps of paper, I'm going to post them here. If you like something, let me know and I might move it up my list.

Laser-cut chess board

I've started design files on this, making a 8" by 8" chess board surface. This was inspired by noticing a feature of Corel Draw called "Postscript Fills", which are procedurally-drawn patterns that can fill a curve. Unfortunately, so far I can only get those to raster, so I might need to do some coding to have the same kind of line patterns turned into hairline curves that will cut nicely into the wood. I'm thinking of something like a nice space-filling curve or spiral will go into the dark squares, with the light ones being left uncut. Then, you'll finish the surface using sanding on the edges and some sort of wood oil.

Metal ball-bearing labyrinth

This is inspired by the kinds of cuts that are easy to make on the milling machine.  The original class project was making a business card holder out of aluminum, which involved cutting a half-inch notch horizontally across the surface, then deepening it by making more passes at different z-heights.  This project would involve a small aluminum blank where you'd surface the sides, then mark out a maze pattern on the surface.  The mill would then cut into the aluminum about 3/8th of an inch and you'd use the X and Y controls to cut out the maze pattern.  You'd then match this up with an appropriately sized ball bearing and have a little puzzle.  I've not yet figured out the best way to get a rounded track, but there may be end-mills that curve at the end that could be used.

Urban Patchwork vinyl car stickers

I've already tried out making some vinyl stickers for a office door sign.  This involves taking the Urban Patchwork logo (a chicken on a shovel head), prepping it as a cutting curve, then using Corel Draw to run the vinyl cutter.

Baby room letter stickers

Another vinyl cutter idea: Letters for the wall in both the Latin and Cyrillic alphabets.  I need to find some cute fonts that will look nice as wall decorations.  This might also work better with some wallpaper so we don't have to do layout directly on the wall, but instead can make borders and then put them up as one group.

Metal trash can handle

We have a steel trash can in our kitchen that has a floor pedal to open the lid.  However, usually I just pull the top up manually.  I've though about making a magnetic handle that will stick to the top providing an easier way to open it.  I can do this with rare-earth magnets, but I need a way to embed those magnets into the handle so they won't escape but will hold things together.  This feels like something that already exists as a product I can buy, but I've just not seen it yet.

AC-Sensitive Radio Remote Control

Off the wall idea.  Our AC is run by our Nest thermostat which sends information about its current state to the website.  Have a client on the Chumby go and pull down current status, and when it sees the AC fan turn on or off, use that to adjust the volume on our clock radio up or down a few clicks via a IR transmitter.  I could use some other device, but the Chumby has the advantage of having wifi, a Linux shell, programming via Perl, and a free USB port.


Log in