what can you do

L and I have been working on a crash bug in a flash game.  He was finally able to fix it.  Here is what he said.
L: so you know what the problem was?
  the composition

me: the
  as in, how the movie clips were grouped?
L: yeah!
  i just went into the fla
me: Nice.
L: went thru most of the symbols, and ungrouped, broke apart, and flattened stuff

me: once again I find myself flabbergasted.

L: it was pretty crazy... the art was imported from illustrator, but sometimes, there were 10+ layers of groupings inside of groupings, and some symbols had 100+ groups inside of groups
me: huh, yeah.
  I guess I'll try to keep an eye on that in the future.
Forget everything you know, or think you know.  All that you require is your intuition.  Or, when a person works with a complex system long enough, they develop an intuition about how the system behaves, that is parallel to and sometimes contradictory to how they know system is supposed to behave.  This intuition can be valuable, but it's not the kind of thing you can talk about in polite* company.  See: mysticism.  

*where by polite I mean rigorous.  Reading Neal Stephenson's Anathem has been been good and bad for me.

also, a blast from the past

Babies everywhere.

Congratulations to everyone I know who just had a baby, or is just about to.  :-D

on Flash

My friend Jared sometimes links these articles:

It’s not a secret: I don’t like Flash.

I don’t like Flash because it is responsible for the overwhelming majority of my browser crashes. I don’t like it because it consumes memory and (especially) CPU resources on my computer for almost the sole purpose of showing me advertisements, which also translates directly to reduced battery life on my laptop.

Furthermore, I resent the way that Flash rose to new heights of popularity by providing a terrible video playback mechanism that (although it largely solved the problem of video codec ubiquity) can’t reliably perform the most basic of media playback functions, such as accurately seeking within the stream, even after it’s fully downloaded.

You might think that I feel conflicted here, because I earn my living by working with Adobe products.  The fact is though, that I hate flash as much as the next guy.  Well, unless the next guy is Steven Frank, in which case I hate it slightly less.  But I wanted to offer my perspective on why Flash is so ubiquitous.

In my view, Flash beat out its main competitor, Java, by racing to the bottom.  What I mean is, while Java was busy trying to teach content creators the beauty of strongly typed object-oriented programming, Flash was busy letting them put shapes on a timeline and tween them around.  

The calling card of Flash is that it fails silently.  Unless you have a debug version of flash player installed, you will never see a Flash error box pop up in your browser.  In its early years, it was pretty stable, too.  Java on the other hand likes to tell you about its problems.  Now, a programmer might tell you, of course I want to know when I've made a mistake, that forces me to fix it.  But we're talking about racing to the bottom right now: Flash never concerned itself with pleasing programmers, in the early days.  It wasn't for us.  

When you're a performer, a singer say, and you're on stage in front of a real audience, the worst thing you can do is show weakness.  If you sing the wrong note, if you start singing the wrong song, you just roll with it, and you never admit it to your audience.  Performers and artists know this.  Now, shouldn't the public face of your website be the same way?  The genius of failing silently is that no-one will ever now how incompetent you are, they will just think they don't know how to use your website, or that there's not much interesting going on.  They will never figure out that you tried to access a null pointer.  As a brand manager, which would you pick?

So, in the same way that HTML flourished by allowing anyone to make a website, Flash flourished by dramatically lowering the barrier to creating dynamic content.  In the process it became an engine for commerce.  That is a legacy that I support, either because I am a big soft-headed populist, or because I am a big hard-headed pragmatist.

What really steams my beans lately, is that Adboe seems to have changed course with Flash, and is steering hard, away from designer-land and towards programmer-land--which is fine--but now they're stuck in the middle in a bad way.

Their designer-oriented tool (Flash CS4) is not fully inter-operable with their programmer-oriented tool (Flex).  Designers feel betrayed by the shift away from their specialty, and programmers are not yet satisfied, because of the bad performance and outmoded language. The flash player crashes.  A lot, for no good reason.  So they've lost the never-let-them-see-you-bleed mystique.

I know why Flash became popular, and I can see the logic behind where it's gone since, and yet I hate it, and Adobe, for 

A, not having the vision to lead the industry they've built
B, not having the technical acumen or leadership to do a good job with any of the tools they make
C, shoving it down our throats and making us pay for it, anyway

As a game designer for browser games, I almost literally don't have a choice, I am forced to use flash.  And I resent the hell out of it.

Let me be clear:  All of the tools Adobe ships for working with its flagship web technology are crap.  Utter crap.  The virtual machine itself fails at what should be its main goal: invisibility.  The Flash empire is Goliath waiting to meet David, but David never shows up.

In this day and age we have an expectation of positive progress, and when we're opressed by bad technology it seems every bit as urgent as if a foreign army were living off our land.  When it doesn't get better over the course of 5 years, it feels like the gods have abandonded us.  Where's your messiah now, Moses*?  Oh Adobe, who will play the Google to your Microsoft?

*Uh, you don't have to actually listen to it, I just wanted to find it for my own edification.

Flash As3 2d physics engines

I'm poking around trying to find a good physics engine to use.  Here are some resources I've found useful.

A possibly biased comparison chart.
blog post on the subject.
See also: *drawlogic for pretty comprehensive coverage of the field.

The gist of it seems to be that, if you want a fully featured engine, go with something derived from box2d, which is the fully featrured open source 2d physics engine for c++.  You have a few choices here.  Box2DAS3 is the official port, which stays very close to the c++ API and implementation. Motor2 and Physaxe are both forks which are optimized for AS3 performance.  But Physaxe is acutally written in HaXe, which is interoperable with AS3.  APE is an older, action-script only alternative, but active development seems to have died some time ago.

Hm.  My main requirements are that it have a community of users, and be under active development*.  For this game in particular I'm less concerned about raw performance, since I don't anticipate handling more than 10-20 items at a time.  So I will go with Box2dAS3.  Perhaps for my own (speculative) titles I'll move towards Physaxe, though.

*This is the best quality filter I know of for open source projects.


Annie is selling shirts. The designs are from her blog. Mostly just awesome/cute drawings, with few words.

open source +1

I'm not sure what I expected, but I'm pretty sure I didn't expect to be able to download source code and compile it straight away with no errors. So good work, Scintilla and SciTE guys.

actually pretty simple

code editor feature:

In programming, {braces}, [brackets], (parentheses), "quotes", etc., are always only created and destroyed in pairs.

In the same way that a word processor would not create a <b> tag without creating a matching </b> tag, a code editor should not allow blocks to be unbalanced.  So, in the same way that you make text bold by pressing ctrl-B, you should make code into a block by typing {.  And when you delete one bracket, it's the same as deleting them both, because it doesn't make sense to have one without the other.

Making the editor smart enough to do this correctly when you don't have anything selected is a bit of a trick, but I think it should be solvable.

So, perhaps my short term personal goal shall be to download scintilla and SciTE source code, and to see if I can hack it up to act this way.  Eventually the goal is to take the job of managing blocks and whitespace away from the programmer entirely.*

*Currently there are lots of editors that will tell you, "hey, your blocks are unbalanced here", but I think that's lazy and insufficient.  Software tools should never be lazy, they should let their users be lazy.  Whenever a program tells me that I have a problem and how I should fix it, I look for the button on the dialog that reads "fix it yourself if you're so smart."  I never find it.

a programmer's nomadic life

I don't have a home language; I hate them all.  I'll use whichever one is least annoying for the task at hand.

Is there a better option than C++ for writing a performance oriented text editor with no extraneous requirements?

learning from debuggers and word processors

Continuing on the subject of a code editor.  I'm calling it "ned," for Nate Edit.  What?

When debugging code in a modern debugger, there's a window called a watch window that shows you the state of various relevant variables.  You can use this to visually inspect the state of the program as it runs.  Is there a place in the Ned UI for a similar collection of symbols?  In many editors this information is exposed through autocomplete, and I think that's a good feature, but is it quitting early?

  • Maybe things that are in tooltips or autocomplete windows now, should have permanent real-estate in ned.

On the topic of debuggers, and what we can learn from them: many editors, notably eclipse (which I hate for unrelated reasons), continually compile your code as you work, so that it's ready to run at a moment's notice, and so that errors are highlighted on the fly.  Is this quitting early?  

  • Maybe instead of just constantly compiling the code, we should be constantly executing it in a sandbox, and putting breakpoints at the cursor so that you can see the state of execution as you code.*

I don't like managing white space, brackets, and navigation; I hate getting lost in a project.  The editor should do as much of this as possible by itself.  Many editors have automatic beautification, white-space removal, and browser controls, but the programmer is still in charge of managing the tags, the text, the markup.  This is quitting early.

  • Maybe we can apply some of the lessons of WYSIWYG html editors to writing code; the markup that creates the logical structure is not important; visualising the logical structure is.

*OK so, this sounds totally implausible at first, but hear me out... what if when the program is executed in the debugger, we capture and remember the most recent program state and parameters that were passed in to each function.  Then, when I'm coding that function, we automatically compile and run just that function, in the context of the saved state.  It might not always work, but I think most of the time it would give you more insight into what's going on as you work on the code.

a code editor that isn't

We had a discussion at work today about the process of programming, and programming tools. Mike made the observation that many times instead of coding you end up typing. That is, just spending time entering text. We agreed that the ideal code editor would eliminate the task of typing, and would allow you to work at a level of abstraction higher than the literal lines of code that make up your program. We want a code editor that is not simply a smart text editor.

See, today we look back at the state of programming 40 years ago and say, how could they use punchcards.  40 years from now we will say, how could they use text files?

So I've got a bug in me now to write (or at least design (or at least talk about)) the next generation of programming tools.  A lot of it won't be groundbreaking things; a lot of this stuff exists today in various different programs, but what I've never seen, and I'm convinced doesn't yet exist, is a unifying vision that is strong and grand enough to sweep up our collective imaginations and change the way we think about how we work.

great news everyone

We have a name for the house now, it's Frontier Town.

It fits, I like it.  All this talk about the economy has got me thinking about the mindset of the people that grew up in the Great Depression.  They had different virtues.  Thrift and self-reliance were emphasized.  In many ways those virtues became obstacles when times were better, but I think they're interesting, if we're to be heading into a rough few years.

Will we see another generation that never throws anything away, that plants gardens and repairs their own cars, and complains about the wasteful attitude of their children?  People are funny, and I mean that in the best way.




I'm really relieved to be done with all of the Christmas gift stuff, at long last.  It got hectic, and I felt like I wasn't able to give everyone the attention they deserved... but I guess that's just how it goes.  I blame my Meyers-Briggs  type.  Looking forward, I'm excited about putting some of my gifts to work; the crock pot, the skillet, and the miter saw specifically!  I can't think of a project that uses all three though.  Maybe an outdoor kitchen*.

I'm working on some self improvement things; getting more exercise, feeling less rushed or hurried, thinking ahead more, that kind of boring stuff.  Ouch, am I really that disinterested?  Apparently.  Actually, I'm writing a time-management game at work now, which gives me a good opportunity to meditate on a lot of these issues.

It occurred to me the other day that I have a lot of hobbies that take up less than 1 percent of my time, even less than 1 percent of my free time.  Things like welding, sewing, woodworking, making jigsaw puzzles, baking bread, making candles, selling tshirts, etc..  Lately even programming (for fun) is under 1%.  This seems weird to me, but maybe it isn't...?  I bounce around a lot, but I like to think that there's an over-arching theme to it.  (The theme is awesomeness ;-)  

I guess what *actually* ties it together is the concept of the castle.   The castle is really just an environment that enables a lot of these dumb hobbies, because in my conception of the castle I can participate vicariously in everyone else's crazy hobbies.  It's an environment for shared exploration of active creative lifestyles.  If that makes any sense.  The shape doesn't really matter, but the shape of a castle seems to inspire the kind of people I'd like to attract.

ok back to work.

*This is what you get today on my blog: stream of consciousness.