ITP Glitch: Editing Civilization Save Files

So far in my Glitch class, we’ve experimented with databending and transcoding images, audio, and video, using a variety of different techniques, but mainly trying to de-abstract how software handles file formats so that we can edit the actual bytes of files to alter the expected output — e.g. shifting the bytes by one in order to cause the image’s dimensions to warp or change color.

Here is our homework assignment for this week:

  • Find and write about a file format / specification. For example, ISO/IEC 10918 (JPEG),  ISO/IEC 1172-3 (MP3), ISO/IEC 14496-3 (AAC) GIF89a, ZIP, MIDI, etc. See List of Codecs for more. You should provide an analysis of any features of the format that may be interesting to glitch artists working with it, or provide a history that explains the various biases that are reified by the format, and the advantages and disadvantages of those biases in actual use.
  • Create your own file format / specification. A complete specification will allow someone else to both encode media into an intermediate representation, and then decode it back to an approximation (lossy) or exact replica (lossless) of the original. As far as “types” of media: audio, images and video are popular; dance, haptic sensations, taste, legal requirements, written language, etc. all count as media. You must run at least one piece of media through your encoding / decoding process, but you may do this by hand — it does not need to be executed by a computer.


The second assignment seems pretty difficult at this point.  I looked into making “extrafiles” and found this OS X app, extrafile, which introduces a series of unique file formats such as one called “Block Ascii” which is only 1bit color:

So you can save a file into one of those formats using the app.

Coming up with my own file format specification would take a while, and I’m not sure how I would transpose data through media processing without losing everything in a jumble of noise.  However, I did do an assignment last semester dealing with genetic inheritance which involved passing a database record of peoples’ stats (1-10 sliding scales of peoples’ stats, like creativity or strength or determination) into a Wolfram cellular automata algorithm, via a node.js server passing JSON, so that the output looked like this:

But that’s not really a file format per se.  It might be interesting to be able to encode someone’s physical and life characteristics into a photo file of them, so that in, say, 50 years, someone could open up the photo image and see what the person’s biometrics and other statistics were at the time the photo was taken.  Hmm, possible idea!

So in terms of describing another existing file format, it made me think about when I first played Civilization as a kid.  Back then, there was no real internet to speak of, and I was using Prodigy* via a dialup modem so that I could (slowly) browse the Civ forums there.  Some people who knew their shit were hex editing their save files so that they could test the limits of the game (e.g. I think cities couldn’t get any higher than 99 population or something, because of memory issues from going to 3 digits) and cheat to win.  That stuff was over my head so I never played with it, but I remember it to my day as a way that some people were able to change settings for games, registration verification, etc.

Anyway, even though it’s hard to look up info on the first couple Civ games (because most Google results now are for Civ 4 and 5), I did find pages with a pretty good write-up of the Civilization 2 savefile format and of the Civilization 3 BIC file format.

On data types:

"...there are three data types: The null-terminated string is a variable length type for text. It always ends with a byte value of zero, meaning a string of 9 bytes only has place for at most 8 characters. The signedshort integer is a numeric data type taking up 2 bytes. It can take values from -32768 to +32767. The unsigned byteshould be self-explanatory. It takes values from 0 to 255."

For handling states of engineer units:

An engineer in CIV II generates 2 points per turn. A settler generates 1 point. These numbers remain constant when the “Base time for engineers to transform terrain (x2)” is changed in the Rules file. With the “Base time…….” set to 20 (vanilla CIV II), twenty points are needed to transform Grassland to Hills.
Consequently, if the Grassland to Hills transformation command is entered on turn 1, a single Engineer will complete the transformation on turn 10. Its byte 15 is changed to 2 on turn 1, is incremented by 2 on each of the following 9 turns, and reaches 20 on turn 10.
If 2 engineers (E1 and E2) are assigned to the task, their byte 15’s change as follows:
UNIT -- E1 E2
 TURN 1 04 00
 TURN 2 08 00
 TURN 3 12 00
 TURN 4 16 00
 TURN 5 00 00 Task completed

Some culture variables in the savefile:

  4	char		"CULT"
  4	long		??? (33)
  4	long		??? (5)
  4	long		number of culture opinions
  For each culture opinion:
    4	long		length of culture data (88)
    64	string		culture opinion name
    4	long		chance of successful propaganda
    4	long		culture ratio percentage (3:1 = 300, 3:4 = 75)
    4	long		culture ratio denominator (e.g. the 1 in 3:1)
    4	long		culture ratio numerator (e.g. the 3 in 3:1)
    4	long		initial resistance chance
    4	long		continued resistance chance

It might be interesting, given the exact formats and memory sizes of the variables, to make a random savefile generator, and then open it up within the game to see what you get.  Would the game be playable, or does it require a certain logic within the savefile where, say, you couldn’t have some variables if other variables were of a certain value?

Tool-assisted speedruns have become big as a result of savefiles.  Basically, if you can save the exact state of a game in a file, you can restore from that point without limit.  I played through Zelda: Ocarina of Time via an emulator on my computer back when I was in college, so it was easy to quickly restore at difficult points in the game.  Apparently all this is called save scumming.  This is how you get those weird videos every once in a while that show some Japanese player doing a perfect speedrun through a custom-made annoying-as-holy-fuck Mario Brothers-family game, e.g.:

That video introduces some followup questions.  Why do people subject themselves to such torture?  How did that person not kill everyone in his building?  Is there a good reason he never uploaded past part 3 since 2007?  Did he go on a murderous rampage?

In terms of savefile formats, I know that later Civ games used XML for settings files and maybe savefile formats?  What if you could translate the format of one game’s savefiles to that of another, so you could play your character in a different world?  More importantly, what if there were a standardized player file format that you could re-use between different games through a secure authenticator? (say, you used it on Steam)  This has been done with some games and some networks (such as Mass Effect on Xbox Live), but how about an open player file format?  And how about if it included your real-world characteristics and history?

Understanding Genomes: Extracting DNA from Strawberries

This semester I’m taking Yasser Ansari’s Understanding Genomes class.  Professor Ansari is a co-founder of Project Noah, which lets mobile users become urban citizen scientists, taking photos of flora and fauna to post online for identification, unlocking badges, helping kids learn in class, etc.

We’re already reading the biopunk manifesto and James D. Watson’s book The Double Helix, about his and Crick’s Nobel-winning discovery of DNA’s helical pattern.  We’re also getting to use Lore, which has emerged as a more ajaxy user-friendly, minimalistic-looking alternative to Blackboard and its competitors.

Last week we made online dating profiles using different model organisms to learn about why they’re used, how many base pairs they have, etc.  My model organism was the fruit fly (Drosophila melanogaster); here’s the Okcupid profile.

So this week, we had to use a recipe for extracting DNA (nucleic acid extraction, includes RNA as well as DNA) from strawberries.  Here are the instructions:

DNA Extraction at Home

In this exercise, you will extract DNA from strawberries. Below is a list of materials along with a protocol courtesy of Genspace. Document the process and pay attention to the procedure so we can discuss your experience in class. Feel free to work in groups and share materials. Read through the materials and protocol before you start the experiment. Contact me if you have any questions or concerns.


  • Strawberries (at least 2 juicy ones)
  • Quarter teaspoon of Table salt/NaCl (don’t use too much of this)
  • A teaspoon of dishwashing detergent (any brand will do)
  • Meat Tenderizer (any brand should work)
  • Half a glass of water
  • Ziplock baggie (1 quart volume)
  • A disposable coffee filter
  • A plastic funnel (to hold the coffee filter in place. Feel free to ditch it if you have a better method)
  • Rubbing alcohol (91% isopropanol works better than the 70% strength)
  • Ice or a fridge to cool the rubbing alcohol prior to using
  • A tall glass (Note: don’t drink this stuff.)
  • A thin wooden stick or skewer (to pull out the DNA)


  • Step 1: Place the strawberries into a ziplock baggie.
  • Step 2: Add the detergent, meat tenderizer and salt (again, don’t use too much salt).
  • Step 3: Seal the baggie and “mechanically disrupt the cells”. This “science speak” for you to start squishing the strawberries in the baggie with your hands. Squish and mix them really well with all of the ingredients. Knead the bag for about 5 minutes until you have the consistency of a smoothie. (Note: again, don’t drink this crap)
  • Step 4: Open the baggie and add a little bit of water. Shake it up a little.
  • Step 5: Place your filter in the funnel and place this in the glass. Now pour the contents of the baggie (the strawberry mixture) into the filter.
  • Step 6: Let the contents drip through the filter into the glass. It should look milky pink. Be patient! If the filter is working too slowly, you can gently squeeze it, but not too hard or it may break.
  • Step 7: Holding the glass at an angle, very slowly pour the chilled rubbing alcohol down the side into the strawberry mixture. You want to pour it slow enough so that a layer of the clear alcohol forms on top of the pink layer underneath, since the alcohol is less dense than the water layer containing the strawberries. If you pour too quickly you won’t see this layer form, so remember to do it slowly. Pour enough alcohol so that you have at least a 2 inch layer on top.
  • Step 8. Now set your glass down. You should start to see a wispy white layer start to form between the bottom pink layer and the clear alcohol on top (like the photo shown in class). It should take about a minute or more to develop. It will start to look like a small ball of cotton. Sometimes it looks like many small pieces of cotton. Give it some more time and it will gently rise to the surface. This is the strawberry’s DNA starting to precipitate!
  • Step 9: Using your thin wooden stick, you can now fish out the DNA. It will be rather “stringy” since DNA molecules form long chains. These types of molecules are known as “polymers”.

Some questions to think about:

Why use strawberries?

Strawberries have far more DNA than other readily-available materials, and their cell membranes are delicate, which means they’re easy to remove for access to the DNA. [possible citation]

What’s the table salt for?

Salt helps the DNA precipitate when the rubbing alcohol is added. It ensures that proteins in the cell are not released from the rest of the solution with the DNA. [citation #1, #2]

What about the detergent?

The detergent breaks apart the cell membranes in the strawberries. [citation #1#2]

Meat tenderizer, what’s that for?

Meat tenderizer contains bromelain and papein, which break apart proteins, allowing us to get at the DNA. [citation #1#2]

And the rubbing alcohol?

DNA is insoluble in alcohol, so it will precipitate for us to see with the naked eye, and for us to extract it in clumps. [citation #1#2]


Phil, who dropped the class, wanted to do this homework with me anyway (we’re such a good pair) so we worked on it Monday night.

Me, as Phil tests the camera

Prepping the strawberries with salt, meat tenderizer, and detergent.

Mashing up the materials.

The materials turn dark purplish

Phil crushing the materials like a pro

Pouring the contents into the filter

Filtering the materials through a coffee filter plus funnel

Phil macgyvers together a pretty awesome pipette technique using a straw to drop in rubbing alcohol slowly

Rubbing alcohol separating the DNA

Separated DNA

DNA tendrils


[N.B.: I wrote this in early  April.  Kept it close for a while but it’ll help to get it off my chest.  Ugh.]

So there I was last night, running along the East River at half past midnight, a long run much needed to burn off my excess energy in the last couple weeks.  I run and exercise not to get stronger, but to get rid of anxiety and restlessness.  It forces me to relax.

But that night, running, being cathartic for me, brought emotions boiling over out of me: suddenly I started getting angry, upset, focused.  What was I doing?  Why was I running, alone, as usual, in the middle of the night?  What am I doing in life, do I even have a future career in anything, and why can’t she see me as a treasure worth fighting to keep?

The creeping suspicion that fills my mind and heart is that everything I’ve been trying to do has been a colossal waste of time.  It’s a creeping suspicion that, in fact, all my life’s decisions have set me back, have destroyed any semblance of stability or happiness, which I badly crave and which others sense and shy away from.  The worst part is that I know I can’t help it.  I had to do it.  I knew it would hurt and I did it anyway.

This makes conversations with others about the subject extremely difficult for them to identify with.  By most accounts, I’ve lived a fairly interesting life with a nice story.  Joined the Army after 9/11 and some time daytrading the dotcom bubble, then deploying to Iraq as an Arabic linguist, as a bloody paratrooper for God’s sake, as intel support to actual Green Beret teams.  Got out, moved to DC, studied foreign policy at Georgetown, worked at USAID and a contractor for Homeland Security.  Even converted to Catholicism almost entirely on my own.  Then up and moved to NYC to study art and technology.

But all that — all that! — was not a happy story for me.  Most none of it was happy.  It was done out of a sense of clawing and biting for survival, for trying to find the life for myself and a future family that would make me happy and successful, for trying not to be obsolete in a swiftly-evolving world.

It has isolated me, made me not be able to relate with others.  It’s made me more of a trinket for conversation, a funny-looking animal in a cage at a zoo.  I’m a token veteran in employers’ and programs’ statistics.

I don’t think people understand that there’s such a saddening backstory behind it all.  I have nothing to show for all that, in the end.  Has it been such a waste?

Here’s the real story behind all that.  The story where all of those things happened because I was willing to sacrifice a lot of time and money and stability and love, because I believed in something bigger.  All those things — country, religion, education — they won’t let you know it but they actually need you more than you need them.  They take all comers now, and they even let you join for free, as long as you sacrifice a part of yourself to them.  It’s true there are a lot of people who joined the military or a church or got through school without trying and without caring.  This doesn’t invalidate them as institutions, but one should be skeptical in evaluating people solely on whether they got through these initial tests or not.

It’s good for you to believe in something, yes, but the cold, hard calculus in life is that things like money and love in many ways are very reliable indicators of whether you are worth more to someone else than they are to you.  Are you paying your way to go to school?  Did you sign your life over to the Army for 5 years?  Or does someone else in the world wake up and think before anything else how much she misses you not being there, about how she would do anything for you?  Does some company or backer happily invest hundreds of thousands of dollars into you because he suspects it will come back ten-fold?

Does someone make irrational decisions because she loves you?  Does a company risk its money in taking a chance on you?  Just because they believe in you?  THAT is true value.

I do not believe in only love and money.  I believe in country, religion, education, happiness, free time, et al.  I believe (perhaps falsely, as I am discovering) that hard work earns you respect in these things.  In my world, those hours spent at Mass, those hours spent in the gym pumping iron (blocking everything else out) or out doing push-ups in front of the Atlantic World War 2 memorial or Lincoln Memorial or miles ran — always alone (save for when two people I trust so much in this world, Dina and Dan, trained with me for our marathon together), those hours spent scouring the internet and reading books, those tens of thousands dollars spent on enriching my mind, those should all mean something.

The tragedy is that I fear I might have been better off — a happier, richer person — if I’d not been this mangled creature that I am, if I’d not followed what I believed would make me more useful to myself and to others.

Here’s more of the ugly backstory.  I left the Army right before I could have been eligible for promotion, before I would have settled into a pretty nice leadership position where I’d have more responsibility to train and lead other soldiers, something I genuinely loved.  But I was so disgusted with not just the Bush Doctrine and my hand in it, but also with the treatment I received from a senior officer who never even looked me in the eyes before or after removing me from my team in the middle of a deployment (for blogging and photographing my experiences in Iraq, which later 1) was found to be non-punishable in my case but also 2) became effectively outlawed military-wide).  It was such a slap in the face for the case of leadership and role model behavior, and of course now he is a higher-up at the Pentagon, while other officers I know and love have since retired.

I left a fairly decent job in DC where people respected me; I had a fairly nice life and I definitely had a lot of very close friends.  I even found a lovely woman.  But she came right after I had decided to leave it all, go to NYC, and attend school.  She later dumped me after I’d moved to NYC, as a result.  Though I suspect she also knew she would never love me.  I left DC, a city I love, after I reached a dead end in my job.  After my neighbor’s apartment caught fire, leaving me without any possessions for four and a half months except what I brought to work that day and for what I spent my hard-earned savings on afterwards to resume my life.  In the process, a very kind woman that I had just started dating took me in, and that all ended too when my move to NYC began to loom.

I moved to NYC to learn how to code, to fight in the most competitive city in the world so that I might have a chance at making a lot of money, doing something massive, important, and wonderful.  I did it because I felt like I had to, but not because I wanted to.  I feel like every decision I’ve made has taken me further from where I’d be happiest, because I’d hoped that somewhere on the other side, I’d find what it was that I needed.  You know Paulo Coelho’s The Alchemist?  Some people love the book, some think it’s simplistic and cheesy.  But it chilled me to the bone.  Its lesson — that you can travel far and wide, but really where you should be is where you were to begin with — scared me.  Have I wasted my time, always trying to be so hard-working and diligent and explorative?

I’m restless.  Extremely restless.  Tired.  And frustrated.  I want to be happy, to be loved, to be in love.

Cut to last week.  I’m on the stoop of some row house with a beautiful woman I’d been dating.  A woman who so defied all the stereotypes of my past relationships and of my expectations that I was mystified and enchanted by her.  I would have never expected her and then all the sudden she one day was being introduced to me while I was coding as someone I MUST talk to, and I was mesmerized.  The arc of the relationship was magical and uncontrollable.  It hurtled through the vacuum of that time you spend in school where reality and non-reality blur because you’re everywhere and nowhere while you study.  I knew I didn’t want to date or get involved while in school, but my God, she was irresistible.  Projects got in the way of “letting go”, but I presumed we had more time…

I’m on the stoop with her.  And on the surface it looks great.  We’re enjoying a fairly warm winter evening, right?  But really what I’m doing is trying to convince her not to leave me.  Her stated reasons are because she’s about to graduate and doesn’t want to have large decisions in her life affected by our relationship, which hasn’t had time to develop enough yet.  But I suspect, once again, that she knows she doesn’t love me and never will, and this is a good time for her to end it.  I wonder to myself how she can be so controlled, so calculating about it, unless she’s either highly rational or just wants out.

One of those guys who goes around selling roses stops by, but I turn him away, saying I’m busy talking to her, and that if I play my cards right, then maybe I’ll need the rose later.  But I kind of already know I have no chance.  I’m drowning.  It’s the coldest thing to see, when you see someone close off her heart to you.  You feel as far away from human as possible, like a discarded toy.

The saddest part, I think, was that then this massive burly guy comes up to me and interrupts, asking, “Were you in Special Forces?”  He saw the tattoo on my arm, the unit patch for Special Forces.  Yeah, I was an Arabic linguist for Group, I responded.  The man shakes my hand, says his father was in Group, and he’ll buy me a beer in the bar inside once me and the gorgeous woman beside me head in.  I thank him.  He ends up being, as I found out over a shot and a beer, a Brooklyn firefighter who’s lost good friends too.

It’s sad because this is the stuff that great stories are made of.  I’m trying to convince this woman that I’m worth it, even if the timing isn’t perfect, even if the stars haven’t aligned, even if she’s worried about her own life, that wow, this guy gets the respect of random strangers, particularly big threatening strangers.  She mentions that it’s pretty good timing for my cause, but it seems an afterthought.

I still know I have no chance.  And that is the tragedy.  The great stories people tell about how they got the girl, the stories you only see in movies.  Or, the stories you only hear from those cheerful old men you listen to who lived through World War 2 and ended up being married to that same woman for 50 years just because he said the right thing at the right time, back in the days when these magical stories had power, when men could sweep women off their feet and then they’d be happily married the rest of their lives.

As far as I can tell, stories hold no power anymore, and particularly not in my life.  I have remarked to friends that I’m a horrible storyteller, and that I don’t even have great stories to tell.  They are in somewhat of disbelief, but I know a great storyteller when I see one, like my friend Chris for example.  He tells the most amazing stories.  While I have interesting stories, the problem is that they are like my story from the stoop — they have less-than-noble endings.  The setup is there, the execution is there, but The Prestige, the punchline, whatever you want to call it, fails.  I’m an intern at The Colbert Report, and perhaps the most valuable thing I’ve learned there, besides all the coding/server administration stuff I’ve learned, is how you absolutely MUST complete the joke.  THAT is the difference between a comedian and anyone else.  THAT is the difference between a storyteller and anyone else.  None of my stories have The Prestige.

“Every great magic trick consists of three parts or acts. The first part is called “The Pledge”. The magician shows you something ordinary: a deck of cards, a bird or a man. He shows you this object. Perhaps he asks you to inspect it to see if it is indeed real, unaltered, normal. But of course… it probably isn’t. The second act is called “The Turn”. The magician takes the ordinary something and makes it do something extraordinary. Now you’re looking for the secret… but you won’t find it, because of course you’re not really looking. You don’t really want to know. You want to be fooled. But you wouldn’t clap yet. Because making something disappear isn’t enough; you have to bring it back. That’s why every magic trick has a third act, the hardest part, the part we call “The Prestige”.” –”The Prestige”

You see, so the only way my story pans out to be a happy one is if the ending is absolutely amazing.  It can’t fall flat.  It can’t fail.

But, my dear reader, it’s looking awfully bad.  This woman, this one particularly smarts.  My friends could pretty much define my taste in women, but this one, she is so utterly different.  And she is also so far away from me that I once again feel inhuman, feel cold.  This story of reality starts off shimmeringly brilliant, radiates, and then burns out, dull.  That magic I thought was there, wasn’t there.  Was it there at all?  It wasn’t enough?

What am I going to do?  I run in the dark, I read tons, I write things that are never read, I slavishly throw myself at a woman who would rather I forget her, I relocate and smash the stability I build up.  It’s destructive.  I have nothing to show for it all.  I have just a few very close friends — the kind who will actually go out of their way to do something for you.  But I have even more acquaintances who probably would have been great friends if I’d invested the time they needed from me.  If I’d stayed in one place, got really good at one thing, planted roots, then maybe women I fall for wouldn’t be pushed away by my ephemeral presence.  I’d have become expert, earned a better salary, had more responsibility to lead.  But I don’t have any of that.  I’m a student, pursuing (now) a more technical developer’s life, competing against kids a decade younger who are expert coders.

I often think back to my time in the Army.  The thing about the Army was that it made me a man, and it introduced me with people I will always love, will always make time for, will always feel human for.  I’ve been to three weddings in my life, and all of them were for military friends.  The people who came back afterwards and made a point to help me out, or to tell me how much they loved me — almost all of them were military.  People who believe in something bigger, who believe in acknowledging others, who do great things even though they know they will get nothing in exchange.  I got a reference from a man who defended me when no one else did when I got in trouble, and I got a note from another senior officer who said he would have pushed me for warrant officer if I’d stayed in.  Why did I leave again?

I admit that I have people who say they trust me, who say they respect me.  But this just makes me feel more inhuman.  It does not make me feel loved.  In my world, trust is intimately entwined with love.  I could not love someone anymore unless she showed me that I would never need to distrust her.  This is what love is built on.  Not the insecure, uncertain morass that relationships are now.  When people say they trust me, they respect me, what they are essentially saying is that they understand I am not trying to take away anything from them, that I am not a threat to them.  The opposite of love is not hate, it is indifference.

The other dimension of people saying they trust and respect you is that you are essentially boring.  That they know you’ll be there, so why put forth the time?  The key determinant is asking whether someone will either 1) spend time on you or 2) make a sacrifice for you.  Instead of empty words of deference and respect, which most don’t live up to, spending time with someone is a true measure of care because it shows that the time spent with you is worth more than time spent working on other things, like one’s career or whatever.  This lady who runs the laundromat around the corner from me, she asked what my ancient Greek tattoo meant.  I told her that it meant happiness, something I’m searching for in life.  She asked me, do I know how to find happiness?  The secret is to make someone else happy.  I said I’ve been trying, but people did not want it.  She said to keep smiling, and that I’d find someone, for I’m a handsome man.  It was a needed compliment.

Think how I feel when I give the slightest nudge to others for them to give me some of their time, only to have them recoil and not just say no, but draw away completely?  How secure do you think I feel when even someone close to me leaves me when I ask for the smallest thing?

I guess the conclusion that I’ve come to is, why would I keep doing the same thing, knowing it’s pulling me further and further away from happiness?  I’m tired of moving or traveling alone.  I’m tired of starting over in a new career.  I’m definitely upset at being told by a woman that we’re moving in different directions, and she won’t go on the same journey with me.

My decisions have pulled me further and further away from having a home, from having love, from having happiness.  My parents’ home is no longer home to me.  I can never go back there, there is nothing for me there.  People cutely mention that they don’t have a home anymore, for they can travel wherever they want.  But I want so badly to have a home.  It doesn’t have to be physical, it can be emotional.  The closest I had to a home was in DC, and then an apartment fire pushed me out.  I’m now so far adrift, so far out on my own.  As Axl Rose wrote, I’ve jumped into the river too many times to make it home.

I have to change things up.  What I’m doing is not working.  How many people have I actually helped in the course of my life?  I like to think I managed to train quite a few new Army kids for war before they deployed.  I’m proud of that.  I feel like I’ve been a fairly loyal friend here and there.  Perhaps overly loyal to exes., a fantasy of being my life’s work, has been loyal to me when I’ve been abandoned so frequently in the last few years.  She’s a loyal lover.  But I don’t know if will ever work out.  I want to have a stable, devoted relationship.  I don’t think I’ve been in one since I was a pretty young twenty-something.  And even that had an asterisk — it was long-distance.  But without that base, something to build upon, something to use as a springboard to try risky things, I am always on shaky ground, always unsure.  That relationship is the stability I think I need to get through to the next level.  A partnership for the journey, not a partnership as a reward for completing the journey.  It’s emotional support for building one’s life, and so far I’ve had to rely on gritty determination as my “emotional support”.

I’m wracked with insecurity.  I always have been.  I’m a big guy, and intimidating to many, particularly if they know the Army background, but I lived my childhood as a goofily thin tall kid with no muscle, with bad skin and glasses and braces.  I loved to play baseball but a coach who treated me like a sympathy bench player while his son and his favorite non-son player were chosen to play first base, which I showed any real talent at.  I struggled through math pretty early on, as most of the other Asian kids excelled and eventually became engineers.  That’s when I was struck in the face with how different I was from them.

Now, I’ve made use of all that insecurity.  Much of it is now gone, through testing myself and seeing what I’m capable of.  I don’t get anywhere near as nervous anymore.  What insecurity I had I can now recognize in others, and walk and talk them through it (but most people won’t listen — they have to experience it themselves and go through the same pain).

Luck is one of the key determinants in success.  Certainly people who make it big have been working on their talents for ages, and they’ve slowly accrued enough expertise to break through.  But in the end it’s luck.  Luck that you meet someone at the right time, luck that you’re mentally ready to fully take it.  You have to be ready when it comes because it swiftly moves on.  I had an ex who, despite her being so toxic otherwise, was rather complimentary when she told me that she admired and was attracted to me because I was so willing to “fall hard”, when almost everyone else can be such a coward.

What’s funny about that is that I know I am falling hard for things that I have no chance at.  It’s almost futile.  But I have to care.  I have to believe, have to hope.  I’m so bad at most things, and am aware at how bad I am at them, that the only thing I know for sure is that I’m good at never giving up, pushing when no one else is watching, being the last man standing, just because I believe.  You have no idea how isolating that is.

I’ve never had a lot of luck.  What I’ve gotten has come either through sheer determination, pursuing things that needed me more than I needed them, or because I was willing to sacrifice a lot to get it.  When my only chance at something is through wishing it to happen, it never occurs.  What this has meant is that any opportunity I get, I take it and then treasure it, am loyal to it in full.

Here’s what I don’t get about just about all the people I know.  They are almost paralyzed by choice.  They live enchanted lives, and forego perfectly good choices because they expect to have even better choices later.  Should they go into law or medicine?  Georgetown or Johns Hopkins?  China or Italy?  They wring their hands, avoid making a decision, and end up doing nothing at all.

When I think about a Fitzgeraldian Jazz Age, it reminds me of these people I know.  People who dress up for champagne balls at venues with gilded banisters to talk about equities and finance and trips to the Caribbean and skiing, away from the war-twisted, broken families I saw in Iraq, the lost poor black communities in Columbus, GA, or Washington, DC, the shattered injured veterans of foreign wars, the scores of people just trying to cling onto any sense of normalcy in their lives.

I talked to a good friend about relationships once and he said that he was talking with a family member about how he was afraid to get into a relationship because he wasn’t sure where he was going to be, and she castigated him; she, being much older, upbraided him for being so stupid.  Why turn away happiness?  Why treat a connection with another person so casually, so disposingly?

In the end, I’ve felt like I’ve built myself a prison where there’s nothing I can do but keep continuing to do what I’m doing, pushing my way through.  There is no place to return to.  I work out hard to cure this restlessness I have, I push harder and read and study and explore to get smarter, I keep setting up my heart for disappointment because I believe you have to be in it to win it.  I know it’s destructive.

And it feels like a waste.  I remember two guys from my unit who died in Iraq while we were deployed together.  Daniel Winegeart and Dustin Adkins.  They died because of stupid shit.  It wasn’t valiant, like being in a firefight like in the movies.  Stupid shit entirely.  But I went to their memorials.  You think you can control yourself, because you’re a fucking man and because you’re a soldier.  But then you see the families come in, and the bagpipes start playing, and you hear the uncontrollable, heart-wrenching bawling and moaning from the parents left behind, and in the case of Adkins, his wife and two children.  It was one of the most dreadful things I’d ever experienced.  And to think that these two men (boys really) would now be 6 years older, building productive families and lives for themselves, while I’m still fucking around trying to figure out what to do and how I’m going to make it?  This is just?

I think it’s time to scale it back.  It’s time to try something else.  Maybe I need to focus on just being happy.  I have no clue where to start.  I shouldn’t be starting many new things in the position I’m in.  I’m tired.  I’m exhausted.  Anyhow, the last few relationships have taken a lot out of my spirit and my heart.  Puzzling, I suppose, that it didn’t affect the women so deeply?  What does that say about me?

I’ve had the pleasure of being good friends with several people who have shown me what a good friend can be, and how powerful it can be to have that good friend supporting you and you supporting him.  Thank you Slavek, Chris, Luke, Itzbeth.  There are others who have been nothing but supportive and nurturing as well, even when it wasn’t easy for them to be that way with me.  I can only hope that one day, sooner rather than fucking later, I’ll find some career that finds me valuable, some woman who finds me valuable, some community and life that finds me valuable, where I can help those who need helping.  But I believe in things, and that makes things pretty damn difficult for me to be happy, especially when it’s so hard to find others who feel the same way, who will risk their hearts on someone or something just because they know it might be the only way out from a life that’s terminal halfway before it’s all over.  Guess I’ll just keep pushing.  It’s the only thing I’m good at.

[N.B. It has not escaped my notice (to use a Watson and Crick litotes) that what I describe above is basically what my grandfather Victor studied.  “Turner noted that in liminality, the transitional state between two phases, individuals were “betwixt and between”: they did not belong to the society that they previously were a part of and they were not yet reincorporated into that society. Liminality is a limbo, an ambiguous period characterized by humility, seclusion, tests, sexual ambiguity, and communitas.”]

Fall 2012 Classes

Summer’s just starting but my schedule for next semester is confirmed.  You can see how these classes very specifically support my plans for researching and building out

Basic Analog Circuits – Eric Rosenthal (Syllabus)

Today’s mostly digital world also requires a basic knowledge of analog circuits. In this course students learn about the basic principles of analog circuits design and operation. Students learn about discrete components such as resistors, capacitors, diodes and transistors as well as integrated components such as operational amplifiers. In addition, students become familiar with the operation of basic electronic test equipment such as digital multimeters, oscilloscopes, function generators. The instructor lectures on, and demonstrates, basic analog concepts so that students can form a basic rule of thumb understanding of analog circuits, concepts and components. In the lab, students can integrate analog solutions into their project work.

Data Without Borders: Data Science in the Service of Humanity – Jake Porway

We are living in the dawn of the big data era, a time in which the vast digitization of our world has created incalculable amounts of information that is now being used to drive our every decision, from what movie we decide to watch this weekend to how we navigate the globe next year. Though data can be immensely transformative, much of the efforts in data science are still focused on first-world gains, such as optimizing ad networks or recommending restaurants. As designers, developers, and scientists, it is not only incumbent upon us to understand how to analyze, understand, and tell stories with data, but also to think about its use in meaningful and socially conscious ways. This class will train students in the basic tools and trade of data science through exploration of a socially conscious data project. Students will learn to scrape, merge, and clean data with Python, perform statistical analysis and use machine learning algorithms in R, and visualize and explore data with R and D3. In addition to training students as junior data scientists, we will discuss the important social issues around data provenance, privacy, and the responsibility that comes with making claims from data.

Glitch – Kyle McDonald / Jeremiah Johnson

“…our control of technology is an illusion, and … digital tools [are] only as perfect, precise, and efficient as the humans who build them.” – Kim Cascone

“If it works, it’s obsolete.” – Marshall McLuhan

How do the tools and media we use affect the work we create? What biases are embedded in the software and data formats we take for granted? In this class we will reverse, invert, and deconstruct prescribed workflows. We’ll empower ourselves by digging into the intricacies of different formats. We’ll explore the limitations of our tools, and exploit the strange behavior at those limits. We’ll also spend a significant amount of time understand the history and theory behind glitch and noise, through enlightening readings, discussion, and exercises.

While this class will cover a variety of low level, technical topics, there are no prerequisites, and there is no single tool, environment, or language that we will focus on. We will instead aim for a more process-oriented approach, and students will be challenged at every level of technical expertise.

This two-credit will meet the first seven weeks of the semester.

PAC I – Evan Korth (Syllabus)

An accelerated introduction to the fundamental concepts of computer science for students who lack a formal background in the field. Topics include algorithm design and program development; data types; control structures; subroutines and parameter passing; recursion; data structures; searching and sorting; dynamic storage allocation; abstract data types, such as stacks, queues, lists, and tree structures; and an introduction to the principles of object-oriented programming. The primary programming language used in the course will be Java.

Understanding Genomes: An Introduction to Biohacking – Yasser Ansari (Syllabus)

This class will expose the tools and fundamental principles underlying the emerging biohacking and DIY Bio movements, providing students with practical knowledge and awareness of specific techniques. Beginning with the discovery of the three-dimensional structure of DNA and building up to genes, genomes, and genome sequencing, we will uncover the biological mechanisms at play and the specialized equipment and protocols being used in today’s laboratories, studios, and garages. Along the way, we will study scientific breakthroughs like the generation of the first recombinant DNA molecules, deconstruct infamous bioart pieces like “Alba” the bioluminescent bunny, and examine interesting amateur projects like homebrewed insulin. The first phase of the class will be focused on introducing core concepts through investigation and discussion. Continuing on, the second phase of the class will allow students to apply what they’ve learned through the design and development of their own projects. Class assignments will range from individual exercises and readings to group presentations and projects. Guest lecturers and visits to local laboratories will help provide additional context and insight during the semester. The ultimate goal of this class is to equip students with enough knowledge and skill to explore biologically driven concepts and projects with confidence. Although topics from molecular biology will be covered, no previous knowledge is required.

Filed Under: ITP

Redial Final Project: Hermes Ordering System

In my Redial class, we learned about the dark arts of telephony in an age of digital, packets, and VOIP.  Once we learned the basics of operating in an Asterisk telephony server environment, we moved on to how to write scripts in Ruby, bash, whatever to interact with Asterisk during a phonecall.  We set up our own Rackspace servers loaded up with Asterisk and used our professor’s script to install needed software on its Ubuntu instance.  I’ve saved that script to add extra stuff when I’m setting up a new Ubuntu server from scratch.  Ubuntu basic literacy is now attained.

That part was fun enough, but it started to get interesting when our badass professor, Chris Kairalla, published some code to Github for interacting with a web front-end in JavaScript by using, node.js, and a Ruby-Asterisk Gateway Interface script interfacing with calls placed to Asterisk. That’s when the realm of ideas greatly opened up.  Real-time interaction with the phone dialpad to control a screen, an Arduino, robots, electric switches, whatever.  And with the explosion of JavaScript and Node.js, it couldn’t have come at a better time.

Here are the class notes:

And the Github repo:

I set out with confidence, knowing I could use Professor Kairalla’s brilliant tinyphone code, which provided the framework to facilitate an incoming call into a caller object that one could manipulate in the web page DOM.

My idea was to build a bar or restaurant menu displayed on screens around a bar which would let customers place orders by just pressing digits on their phone, instead of waiting on waitstaff or having a gimmicky touchscreen or table screen.  The orders would be tied to someone’s phone number so paying for bills wouldn’t require the awkward splitting up of the bill, and customers would be able to use a very personal device to them, their own cellphone, to control interaction in the bar/restaurant.  Orders could be processed quickly, verified afterwards, and immediately incorporated into a database which could provide business intelligence in the form of statistics on food orders, frequencies, favorites for each customer, etc. All in a scalable, modular framework such as Node.js + Express.

Previous blog documentation: post #1.

Demo video:

Screenshots of some functionality:

Initially I figured I’d follow advice and build out the API first.  For that, I’d need an admin dashboard to perform CRUD operations to build up the menu.  I’m pretty tired of having to build out AJAX and menus to add, remove, edit, etc. so I’ve started building a Node.js app with all that stuff built-in, including JSON operations and other common usage events so I don’t have to keep testing it.  Anyway, I got my menu add functions working so I quickly started adding all my favorite Stellas, Dark & Stormies, Mojitos, etc.

Then I spent most of my development time building an interface that could only use the dialpad numbers 1-9, 0, *, and #.  Because I was fairly ill-versed with JavaScript still, I actually ended up refactoring my interface about three or four times, each time becoming more and more modular, using JavaScript objects which contained each “menu” (i.e. a beer menu that would point to each individual beer’s screen, which would pass to another object that would fill out a screen to let you order the beer) pushed into an interface that had no more than 8-9 choices.  Then the screen would have to have text displayed large enough to read, yet still accomodate perhaps 3-4 simultaneous callers at once.

var menuFoodObj = {
	name : "Food/Drinks Menu",
	upMenu : "Main",
	currentMenu : "Food",
	id : "",
	p : ["", "Beer", "Wine", "Liquor", "Non-Alcoholic Drinks", "Water", "Burger", "Specials", "Chips & Salsa"],
	pClick : ["", "Beer", "Wine", "Liquor", "Other", "Water", "Burger", "Specials", "Chips"]

By the end of the refactoring though, I had a really nice (but still a little soupy) interface of JavaScript objects being pushed into the DOM by jQuery.  I learned OO JavaScript pretty well although I didn’t understand fully how to create new objects and then properly make methods for objects (I was declaring new functions within objects).  Since I did most of the development and testing just using the web browser and mouseclicks, I was happy when all my refactoring allowed me to easily map a phone’s keypresses to the interface interactions using jQuery’s .triggerHandler event.  My code is still quite soupy though, and I think I’m about ready to learn backbone.js for injecting data from models into a static template — it would have been perfect for this type of project where the layout remains mostly the same but the data changes frequently.  I’m happy, though, that it was easy for me to instantiate new user objects (e.g. user[1] = new User();) for the 4 users that Hermes currently supports.

I actually ran into a weird problem after I’d hooked in caller keypresses, which I thought at first was within the DOM.  Keypresses from my softphone (I used Zoiper to connect via SIP) were happening twice and I thought the click event handler was being called twice in the DOM.  This did not occur on normal phone calls over, say, a cellphone.  Further inspection saw two keypresses coming across in Asterisk:

 <SIP/general_sip-000000ae>AGI Rx << WAIT FOR DIGIT -1
 <SIP/general_sip-000000ae>AGI Tx >> 200 result=50
 <SIP/general_sip-000000ae>AGI Tx >> 200 result=50

Prof. Kairalla found that we were actually picking up feedback on my laptop from the call being made over the software.  Once we muted my laptop, the audio wasn’t being sent to the Asterisk server, which had been detecting the extra audio as what it assumed was an extra keypress.

I added an option to check news headlines from Google News’ API, which has been deprecated so will probably disappear soon?  The other bad thing about this was that you can’t really link to the body of an article since 1) Google News just provides the link and the source’s weak abstract and 2) news sources are so proprietary about people stealing their content.  APIs always leave a bad taste in my mouth because they’re hamstrung from the outset.  Anyway, there’s a definite art to creating headlines, as I learned in my previous job covering the news cycle, and most headlines are expertly packed with relevant info, enough for you to get an idea of things just at a glance.

I also added features for sending drinks/orders to another table, to facilitate social interaction within the bar.  Trivia can be played as well, though it wasn’t built into a central system where scores are kept.  Right now it just tests a user’s response against the correct answer and then generates a random question.  Another feature added was to flirt with other tables and send them messages.

I used Flowroute, which was super easy to set up in my sip.conf and extensions.conf for Asterisk, using Flowroute’s web-based cheatsheets for config settings unique to my account.  Very nice set-up screens there.

emailjs and Twilio

To process orders (when someone wishes to buy a beer, but he hasn’t received it yet) and tabs (for delivered food/drinks), I took advantage of node.js’s awesome modules and found emailjs, which lets you package up a JS object and send it as an email via SMTP to, say, gmail.  So when a customer places an order in Hermes, the order is sent via email to the company for later verification.  Easy, piece of cake.  Can be used with any SMTP server you have an account on and that has permissions.

Then Prof. Kairalla mentioned that it would be great if a customer received a text message thanking them after they close their tab.  So I bought a phone number on Twilio ($1/mo) and used the Twilio SMS API to package up another JS object with the tab details, and then have it again email the company but also text msg the caller with his closed tab details.  I actually had some problems with this and didn’t like the available Node.js modules (because they didn’t include examples for SMS), but luckily I found Dustin McQuay’s godsend blog post in which he posts some easy node.js code as a sendSMS() function, which I used to get my Twilio SMSs working.  I then had further problems but I found out I had pasted in the wrong Twilio auth token, so once I re-checked that, it then worked!  I feel as though the auth token changed because I funded my Twilio account, changing it from a free account to a paid one, and changing the token.  I assume?  Anyway, too much time wasted on that…

I also got a fraud alert from my credit card after trying to fund my Twilio.  Apparently they get a lot of fraudulent credit card funds, which makes sense since I’m pretty sure telephony and stuff related to it are havens for people trying to commit fraud, fake identities, and game systems.  But my credit card company cleared my purchase and I was fine within minutes.  Just thought it was worth mentioning.


I demo’d this in class and had 4 people call in.  They quickly broke it, but it was mostly the display of each person’s menu on the page.  That’s an easy UI fix.  I also found that I would need to make each person’s number more clearly visible so he’d know which interface he’d be working on.  But I felt like people were very quickly navigating through the menus and would learn it fairly quickly once they figured out it was just using a phone dialpad.  One thing that broke the demo was that the bottom bar (telling you how to use ‘*’, ‘0’, and ‘#’) got pushed down so people couldn’t see it.  Big problem there!

This app works hand in hand, I think, with my other app, Karaoke Flow.  I would love to create products to make the bar/restaurant/club/concert/dance party/rave/big gathering experience more enjoyable for people looking to have a kickass time and more profitable for the businesses providing it to them.

And I’m blown away with what is possible now with and Node.js.  All these projects I’ve wanted to do, like a web-based MUD to hook into, real-time chat, real-time flowing data, it’s now possible.  Love it.  And Redial…what a great class.  It’s recaptured the mystique of phones before they went smartphone, the weirdness and coolness of the phonebooth which has become a portal in pop culture (Doctor Who, The Matrix, Danger Mouse), and the fun of messing with somewhat quirky and buggy technology after it’s fallen out of vogue.  And to see how easy it is to set up a Vonage-like system!

Nature of Code Final: Genetic Crossings

Professor Daniel Shiffman’s Nature of Code is outstanding.  Just check out the syllabus. And play with the Nature of Code repo Processing sketches hosted on Github. And be sure to get his book when it comes out! We covered some basic algorithms for simulating inside the Processing environment vectors and forces/repellers, genetical algorithms, Wolfram cellular automata, neural networks, autonomous agents, flocking behavior, particle systems.


For me, the pull towards genetic algorithms, heredity, fitness, evolution, Punnett squares, etc. was great, so my project for my first intro to computational media class turned into my Nature of Code final.


My Genetic Crossings project attempts to create a simulated environment where people exist within a world connected to God, the peoples’ religions, their nationalities, and each other.  They produce offspring based on characteristic attraction rules (for my demo I only used “appearance”, “money”, and “religion”, but only to demonstrate what was possible –I would like to create a more fully-formed algorithm for my personal reputation/identity ecosystem to approximate and adjust to the infinite ways that people become attracted to each other and become married or have children or devote themselves to the other), and they can die.  Their well-being or happiness (what in will be eudaimonia) is dependent on their quality of living within their religions and nations.

Map View

A video from an older version:

See previous documentation on this project:


Here are the initial characteristics I created for each person.  There are so many more yet to add! Strength, intelligence, wisdom, charisma, stamina, wit, humor, education, creativity, responsibility, discipline, honesty, religiosity, entrepreneurialism, appearance, money, gracefulness, stress, health, luck, talent_math, talent_art, talent_sports.

Initial nationalities/regions: USA, China, EU, Africa, South America.  Characteristics of security, innovation, job opportunity, immigration policy, life expectancy, education, sanitation, standard of living, pollution, biodiversity, crime, political freedom, and nutrition.  By no means comprehensive.

Initial religions/spiritualities: Christianity, Judaism, Islam, Taoism, Confucianism, Hinduism, Buddhism.  With characteristics of commercialism, morality, hierarchy, portability.  Obviously these need some tightening up/additions/discarding.

Final Project

So in my midterm I managed to add Verlet 2D physics to the sketch so that people, nations, and religions have connections to each other which make them bounce around like they’re on springs, relative to their attractions and strength of ties to each other.

In my final proposal, I sought to add the following:

  1. Wolfram cellular automata
  2. Connect to external database
  3. A selection algorithm to choose certain parts from parents based on mutation rate and fitness to pass along to new offspring
  4. Interaction sliders to change variables
  5. Macro events that affect well-being of all objects in the world, such as earthquakes or war
  6. Micro events that affect individual well-being, like rites of passage
  7. Discrete clusters of people, mostly based on familial strength of ties, instead of one big clump of people in the middle like in my midterm


I managed to get most of this done.

I enjoyed adding Wolfram CA.  I wrote a node.js app for express which would act as a JSON middleman between my main genetic crossings sketch and a wolfram sketch.  Basically, when viewing the chromosomal stainings (genotypes), you can click on the CA button to the left of a person’s staining, and this will pass a JSON object (using Prof. John Schimmel’s Processing-Nodejs code) to the node server, which is detected within 5 seconds by a polling timer within the wolfram sketch.  The wolfram sketch then uses the JSON object as its data to apply rules to to construct a pattern unique to the selected person’s genetic characteristic code.

1) I added a third parameter to the rules which would display as either black or aqua, depending on the CA rules.  Prof. Shiffman’s code used base-2 groups of 3, which had 2^3, or 8 total possible combinations (using only the digits 0 and 1), but I used base-3 (0 = white, 1 = black, 2 = aqua), so it became 3^3, or 27 possible combinations.  For this ruleset, I duplicated Wolfram rule 90 three times, then added a few extra codes.  The triangular look seemed the most visually interesting for what I was doing.  Anyway, what was cool about Prof. Shiffman’s code was that it keeps streaming the pattern from bottom to top.  So when a new person is clicked on, that person’s signature is integrated into the flow seamlessly once the sketch loads the JSON off the node server.  I don’t know that any of this actually is useful except that it looks cool and uses principles from class and maybe, just maybe, shows someone’s digital characteristic “signature”.

Streaming Wolfram CA on top of Processing sketch code. Console of Processing shows a passed JSON object.

2) I’m happy I was able to set up a MongoDB to be accessed via node as well as by my Processing sketches.  When I build out, I’ll be able to pump out JSON objects of actual users into these sketches for data visualization.  I’d been wanting to do this since my first semester and now it’s done.  Most credit goes to John Schimmel though for writing the hook into node though!

node.js instance output including passed JSON object

3) I realized that I already had some mutation within my function, once the two parents’ characteristics were passed to a matingDance.punnettSquare() function.  Before, the function would just average the two parents’ characteristic values together and then add or subtract a random amount from them for mutation.  What I changed was making the function choose randomly from either parent’s base characteristic.  So if one parent had 10, and the other had 1, the result would not be 5 (rough average) but either 1 or 10.  Then I would offset a random amount (hardcoded as 4) if mutation kicked in (if a random number between 0 and 50 was less than 2, for approximately a 1 in 25 chance of mutation per characteristic).  What this ended up doing was increase the diversity within the genepool and more accurately reflect reproduction.  I still need to tweak these numbers to get more consistent levels of variety but the algorithm is mostly there.

Here’s a view of the chromosomal stainings before I changed the algorithm — here it averaged the parents’ traits, which, in the case of this sketch’s iteration’s octomom, created many extremely similar offspring:


And here’s the view after picking from either parent and allowing for a slim chance of mutation:


I feel as though the end result has a more diversified population with more variability between generations and individuals.  I need to tweak this so that if the value from a parent is at 1 or 10, it may mutate in only one direction, but here’s the matingDance.punnettSquare() function:

int punnettSquare(int comp1, int comp2) {
    int mutation = (int)random(0, 50);
    int dominance = floor(random(0, 1.99));
    int crossover = 0;
    if (dominance == 0) {
      crossover = comp1;
    else {
      crossover = comp2;
    if (mutation < 2) {
      crossover += (int)random(-4, 4);
    // don't want it to be out of bounds
    // TODO: fix so it can mutate only one way if parent is 1 or 10
    if (crossover < 1) { crossover = 1; } else if (crossover > 10) { crossover = 10; }
    return crossover;

4) I didn’t add sliders to change variables mid-sketch — at this point I can use variables pre-set in the main class but I’d like to make the interface more user-friendly and interactive later.

5 and 6) I didn’t do macro and micro events because I figured they’d just require making a button that, when pressed, would cause particles’ values to change.  What would be interesting would be to have random events happen based on their likelihood to occur and then some events would have permanent effects (damage to peoples’ personalities) or temporary effects (nationalities’ well-being that would later recover).  This kind of introduces the possibility for individual peoples’ health and whether they have injuries/disabilities/diseases/gifts/talents.

I did add a Ritual class though, which only includes right now a funeral function.  When funerals are recognized by a culture (by pressing ‘f’), the dead are removed from view on the map and their attraction springs are removed as well.  What this is supposed to represent is that funerals are a way for the living to remember the dead and then put them to rest so that the living can move on and create new ties with the living.  I do like the idea that we retain our ties to the past, which can sometimes become weaker in death and sometimes become even stronger.  I didn’t model that yet.

public class Rituals {

  Rituals() {

  void funeral(boolean funeralsRecognized) {
    for (int i=0; i<numPeople; i++) {
      if (person[i].parent1 != -1 && person[i].parent2 != -1 && person[i].alive == false) {
        if (funeralsRecognized == true) {
        else { // TODO: re-reference spring after it's recreated?
          parentSpringArray.add(new VerletConstrainedSpring2D(person[i], person[person[i].parent1], person[i].parent1RL, random(parentGravity1, parentGravity2)));
          person[i].parent1Spring = parentSpringArray.size()-1;
          parentSpringArray.add(new VerletConstrainedSpring2D(person[i], person[person[i].parent2], person[i].parent2RL, random(parentGravity1, parentGravity2)));
          person[i].parent2Spring = parentSpringArray.size()-1;
          parentMinDistanceSpringArray.add(new VerletMinDistanceSpring2D(person[i], person[person[i].parent1], random(parentMinDistanceRL1, parentMinDistanceRL2), random(parentGravity1, parentGravity2)));
          parentMinDistanceSpringArray.add(new VerletMinDistanceSpring2D(person[i], person[person[i].parent2], random(parentMinDistanceRL1, parentMinDistanceRL2), random(parentGravity1, parentGravity2)));

7) Discrete clusters.  I ended up adding relationships between people and their parents from just constrained springs to a combination of constrained springs and minimum distance springs.  What this would change is that a person’s distance from his parents is both constrained to no more than a certain length but also more than a minimum length, so that they can both be more visible instead of overlapping visually, and also be more clustered together.  I found that this makes certain groups on the map appear more clustered instead of forming a big ball in the middle.  I still need to do more work on this though because as there are more people in the sketch, the big clusterfuck returns (because there are too many connections between everything and I can’t zoom in closer to see the gaps and relative spacing between different networks).

I converted a lot of my arrays of spring connections over to one large ArrayList, which I think was easier to deal with in the end in terms of manipulating them after they were initiated into the environment.  I did find, however, that I had to pass a reference to the spring’s number (since it was just an ArrayList entry) to the person’s class instance so it could refer to it later.  A problem with this though, as I realize just now, is that if I remove springs (as I do in the funeral ritual), I’ll lose the correct references.  So I have to make sure that when the springs are added again, when funerals are disabled, that a pass a new reference to the ArrayList.

I also found that there tends to be super-breeders every time I run the sketch, with certain people tending to produce tons of offspring while others produce none.  I’m talking like 1 or 2 people will produce 10 kids, which tends to make the sketch appear too tightly clustered because everyone is closely linked.  Perhaps this is a feature, rather than a bug, of reproduction?


You can download the code from Github.  You’ll probably want to start up a node instance and then start the genetic crossings sketch, then finally the wolfram sketch.  Instructions are in the



And this leads me to some closing notes. I shied away from adding fitness yet again to my reproduction algorithms because I felt like “fitness” in the short-term was too much like large-scale evolution theory and autonomous agent simulation.  In my sketch there wasn’t really an ideal fitness state, with no limitations or rules imposed on the larger scale.  What I wanted was to break into modeling some culture into the simulation, so that choices were made between sexual partners based on cultural norms and not as much on randomized reproduction. Obviously modeling culture would work best if it were overlaid on top of basic biological reproductive theory such as choosing the fittest partner and whatnot, but I felt that was too much for the scope of this simulation, which I wanted mainly to focus on social networks.

JavaScript has come a long way.  It’s now the same on the backend and the frontend.  Processing can be exported to JavaScript in some capacity, and dataviz libraries such as D3 are taking off.  Soon we will be able to introduce more fluid, data, physics, and particle system simulations within a browser.  It’s too early for my sketch yet (ToxicLibs takes some finagling) but this is a glimpse of the web to come.

As I begin to do more serious work on the internal mechanics of, it’s stuff like this Processing project that makes me appreciate how careful I’ll have to be with positioning different factors against each other so that people can create their own formulae/evolutions to weight different priorities how they deem fit.

Looks like this book out of the Harvard Berkman Center, “Interop: The Promise and Perils of Highly Interconnected Systems”, by John Palfrey and Urs Gasser, is a must-read.

What I do feel is that current online social networks have not really tried to map out the complex interweaving, competing, variable connections and attractions we have between ourselves and others, between the different identities we all have, between the things we care about more or less at different times in our lives, etc.  To facilitate something like this, I can’t help but feel there needs to be a massive API that allows people to access all this data (if privacy settings allow it) so that we can take advantage of the multi-dimensional nature of our species.

You can think of someone’s identity as a meshed web that is being pulled apart by the external world and people and ideas and being pulled together by muscle and ligament and cartilage and sense of self and personality and such.  You can think of a community as a bunch of these springy people pulling on and apart from each other constantly, but at a stronger tension than from other communities.  Communities form religions and nations and cultures, again with that same network of relationships and competing identities. I hope that’s the dynamic I was able to capture in doing this project.


Special thanks to:

  • Prof. Dan Shiffman for all his documentation and code from Nature of Code, particularly his chapters on forces, genetic algorithms, ToxicLibs, and cellular automata
  • Prof. John Schimmel for his Processing-Nodejs code

Dynamic Web Dev Final: Karaoke Flow

My NYU-ITP Dynamic Web Dev class ended up being fantastic.  We moved to Node.js Express, incorporated AJAX, MongoDB, Heroku, and Amazon S3, built a JSONic API, and toyed with and even some Processing + HTTP POST.  You can read the class notes and fork/view the github class code from Professor John Schimmel’s repositories online.

Karaoke Flow

My final project ended up being a party game.  People hit the site, probably best with a keyboard, and start creating “rhymes” based on a prompt of two topics, such as “yo momma” and “swag”, or “basketball” and “Maybach music”.

You start off with three choices: 1) start a new “flow” (an individual song) which 2) you can join into with the second choice (using autocomplete JavaScript to parse a list of open flows from the database), and 3) skip all the rhyme creation part and go right to performing a randomized flow.

If you work on an open flow, all the participants have five minutes (using a JavaScript countdown script) to come up with as many rhymes as you can.  When five minutes is up, everyone can submit one more rhyme before they’re sent to the performance page.

On the performance page, the next person up will (eventually) be able to grab a mic, start the random beat (so far I have random beats from Wiz Khalifa’s “Star of the Show”, Three Six Mafia’s “Hard Out Here for a Pimp”, and Drake’s “I’m on One”), and move up and down through the lyrics using the ‘j’ and ‘k’ keys.




I’m hoping eventually it can be recorded and people can vote on the best rendition of the performance.  People are judged (though this isn’t captured through the site yet) on how well they deliver their spontaneous flow.

I wanted to do a project related to music and parties, hence the project; hopefully at some point in my life, I’ll get to work on projects that make parties more kickass through technological integration with human party impulses.

Karaoke Flow was also my entrée into Node.js and Express, which I now love and will rewrite into it over the summer in preparation for my thesis next spring.

Online Presence

A demo of the site is up at Heroku:

I have instructions on how to clone the code and install it so you can run a node.js instance at github:

Previous documentation from my blog: post #1, post #2.

Things Learned for the Future

I think what I got most out of this was an appreciation for JavaScript objects.  To be able to package up variables and containers and clone objects or pass them along into JSON, it was like what I was missing in web sites.  I’m still on the road down to something more like Backbone.js, which will allow for even more use of objects and static templating filled in with data.  Definitely enjoying being able to JSONify data into something that I can use throughout the site or offer to others.  I’m sold.

Our professor showed us passport, which is a brilliant module for handling users and security.  I was missing something similar when I was using Ruby + Sinatra.


If anyone’s interested in taking this further with me, let me know.  I definitely think some combination of karaoke, rhyme-writing, parties, and randomness would be a huge hit.

Final Proposal for Redial: Hermes

My Redial class is awesome.  We’ve set up Rackspace servers with Asterisk telephony software and now we’re executing shell/ruby/php scripts through phonecalls which are now interacting with node.js servers to execute web site interfaces, Arduino RC car controls, etc.

I really want to focus on using node.js and with Asterisk/phonecalls for my final project.  So here’s what I propose:


Hermes is an ordering interface for bars and restaurants.  When you sit down and order food, or when you’re standing at the bar trying to get a drink, you dial in with your phone to the establishment’s screen/s to place an order.

Say you sit down at a table and the table either has a built-in screen (like those old Pizza Hut arcade games where you could play Pac-Man using a joystick and buttons underneath the table surface), or it has a monitor or projection on the wall.  It will have a phone number for you to dial.  When you call in, it begins to interact in real-time with you both by voice and with on-screen instructions.  By pressing phone keys, you can place simple orders from simplified menus displayed on-screen.

Multiple people can dial in to the same line at the same table.  The screen will split depending on the number of people, allowing people to tie their orders to their phone number and to order independently of each other.

At the bar, when it’s packed, a projection above the bartender area will have a number to place calls.  The bartender can then cue drinks in the order they’re received in a fair way.  People can auto-order favorites or have drinks set to order every x minutes.  Complex group orders are handled digitally.

Multiple screens can be installed around the establishment so people don’t have to wander too far to place an order.

The screens can also be used for entertainment, as people could play phone trivia or mini-games via their phones, browse the news, change TV/music stations (handled via weak FM signal?), etc.

Why Hermes?

Hermes was recognized as the God of commerce and social interaction, and patron god to diplomats, messengers, and heralds:

Due to his constant mobility, he was considered the god of commerce and social intercourse, the wealth brought in business, especially sudden or unexpected enrichment, travel, roads and crossroads, borders and boundary conditions or transient, the changes from the threshold, agreements and contracts, friendship, hospitality, sexual intercourse, games, data, the draw, good luck, the sacrifices and the sacrificial animals, flocks and shepherds and the fertility of land and cattle. [Wikipedia]

Problems of a Hermes-Less World

  • Ordering food and drink is still a primitive process.  McDonalds has figured out how to move a lot of customers through quickly and efficiently with minimal job training.  But most restaurants and bars suffer from bad image and service because overworked waiters, waitresses, and bartenders can’t keep up with everyone’s needs 100% of the time, particularly when customers are fickle, intentionally hard to please at times, etc.  Streamlining the ordering process so that people can order as much food and drink as they would like, without inconveniencing themselves or waiting for some attention from an employee would increase business and increase consumer satisfaction.  There’s a problem when people discuss strategies to elbow their way into a bar just to maybe get a drink in 15 minutes, 15 minutes spent away from the party they came to attend.

Problems of a Hermes World

Hermes is not without its limitations.

  • Screen readability is limited by the size of the monitor, the customer’s ability to see clearly, the design of the interface, and how much text can be displayed at once.
  • There is also a problem linking orders to phones.  While something like Google Wallet, where one could pay via phone, would be preferable, at this point the phone number would only be an identity link to the customer and his order, and for reaching the customer afterwards for non-payment.  There are most likely large security/spoofing vulnerabilities in this approach unless a credit card number is somehow associated with the phone number.
  • Why would one find that dialing on a phone is a superior interface to asking a person, or using a touchscreen, or even using a custom web-app or mobile site to order?


  • Tests with digital ordering systems seem to indicate people will order more food and drink if they can do it quickly, digitally, and without pause.  The systems seem to increase efficiency and overcome social shyness.
  • People strongly and affectionately associate with any actions involving their own phones, so using their phones as an ordering device empowers them.  It also is a potential bridge to have “preferences” that people can set and save with their “account”, linked through their phone number as identity.
  • Digital ordering produces a digital record, which is better for book-keeping and for validation of records in the event of disagreement between employees, customers, and management later.
  • Projections could be expanded upon — when people aren’t ordering food, they could be consuming news, shows, art installations, using Kinect-ish hands-free interfaces, messaging other tables, etc.  There is an exciting potential for linking different tables and screens with each other, via competition, flirting, or just networking or social lubrication.
  • Client interface consists of normal 1-0/*/# phone pad, can work with installed phones or smartphones or even simple cellphones, while all the customized, complex work can be handled server-side


  • Flowroute number linked to an Asterisk server installed on Rackspace
  • Asterisk dialplan forwarding to a ruby-agi script that sends data to a node.js instance
  • Node.js instance that takes incoming phone commands and passes instructions via (real-time, no polling) to the client that is installed on the projection/screen
  • jQuery/UI/AJAX/node.js client interface that handles order entry and routing, and can run multiple instances via the node.js cluster module, and can also forward to other instances for video, news, chat, etc. while keeping order entry instance CPU/memory load available just for order entry/processing


  • Tie-in to payment system/gateway?
  • Data saved into MongoDB
  • Employee and management interfaces to see stats on sales, database analysis, modify orders on the fly

Research Links

Nature of Code: Final Proposal

For my Nature of Code final, I plan to continue the Genetic Crossings Processing sketch project and incorporate some of the concepts from the second half of the course.

Previous documentation for this project: Nature of Code & Intro to Computational Media

Specifically, I want to do the following:

  • Use each person’s characteristics (rated from 1-10, and numbering a total of about 20 characteristics per person) as a ruleset for the Wolfram Cellular Automata structures.  I will have to adapt the code by remapping the 1-10 scale either to a binary state or by making more complex rules (perhaps using color instead of white/black or on/off).  I don’t know that there’s any benefit to the overall project from implementing Wolfram CA here, but perhaps it might give each person within the sketch a unique signature or fractal pattern.

  • Of the three characteristics of genetic algorithms — heredity, variation, and selection — I have implemented my own versions for heredity and variation, but have not really introduced much selection.  The only selection that seems to take place is that, because I have more heavily weighted religion, appearance, and money in the sex() algorithm, those with high stats in those areas will probably reproduce easier.  But this is not equivalent to having an actual fitness algorithm that determines “ideal” environmental success.  As Professor Shiffman writes in his notes, “There must be a mechanism by which some members of a population have the opportunity to be parents and pass down their genetic information and some do not. This is typically referred to as “survival of the fittest.””  I might also try to implement a mutate() function as used in example code, since all I do at the moment is take the average of the parents’ characteristics and then randomize an offset to come up with “mutation”.  Very hacky.
  • System variables and sliders: I liked the Processing sketch “flocking_sliders.pde” from the Shiffman’s chapter 6, “Autonomous Agents” because it let you play with variables on the fly to see how it would affect the simulation: how would you get boids to fly together, but not too close together, and could you enforce more solo or flocking behavior easily?  So I think I would like to use the God person or perhaps a fake country or religion to simulate how wild changes in traits or characteristics of a larger group-level entity could markedly affect individual persons linked to them.  Could I even have individuals leave group-level entities in search of more favorable ones?  What I picture is the person objects bouncing around the environment as the strengths of their relationships change between others, their parents, religions, and countries.  This also introduces the idea of migration patterns.
  • Similarly, I would like to be able to introduce world-level events such as earthquakes, global warming, war, Renaissance, etc. which add or subtract from multiple entities all at once, or even over iterations/time.
  • On an individual level, I wonder if I could implement rites of passage, liminal events in persons’ lives such as turning 21, getting married, having children, etc. that affect their relationships to their communities and increase/decrease their stats.  Would this necessitate perception of stats as opposed to actual stats?  In my project, I’m trying to study the multi-dimensional nature of our presence in the world — what we think of ourselves, what we actually are (objective truth/science?), and what others think about us. Reputation within a community is not often of one mind — one can hold various degrees of influence and respect among different components of the same community.  How does one code this?
  • Visually, I am hoping to make the networks a little more discrete.  For my midterm, the sketch ended up looking mostly like a hub (God) and spokes as more persons were introduced.  What it should be, though, are clusters of parents and offspring, dispersed between different group-level clusters.


Other influences:

  •  Joshua Epstein’s “Growing Artificial Societies: Social Science from the Bottom Up”, loaned to me by my classmate James Borda.
  • Prof. Shiffman posted this video of a talk by Bret Victor, which argues for real-time feedback for coding, so we can visualize the results of our code and experiment with unintended changes or extremes testing or rapid prototyping for artistic-based projects such as building animations.  Blew my mind.  Seriously, I don’t watch many long lecture vids anymore, but this was awesome:

Mobile Web Final: StreetEyes

Phil Groman and I presented our mobile web app, StreetEyes, for our NYU-ITP mobile web class.  StreetEyes is intended to be a way for a web viewer to look at a map of broadcasters and ask them to collect information on a desired event, protest, or location.  The app allows a web user to view a map of broadcasters, select one, and make a view request to him to start collecting data from the ground and reporting it to the news “stream” that the viewer made from the web.  The viewer and broadcaster (or multiple viewers) could chat in real-time to assign tasks for info collection or to take more photos or to get more descriptive updates.

We feel a good application of this would be for documenting a quick-moving protest, or for getting eyes on a line at a supermarket or at the DMV.  Traditionally, news is collected by sifting through peoples’ random Twitter updates, or more crafted news stories that come later.  If some investigative curator or someone who knows which details are pertinent in an emergency (say, a first-responder), then there is not much way to contact people on the ground to gather data.  We rely on people on the ground to be knowledgable enough to get the right data, but this is the wrong way to go about things.

Why not have curators direct people to breaking news or emergencies?



  • Make the camera work, submit photo to a stream.
  • Fix display bugs in Google Map dynamic view.
  • Much better styling for the stream page.
  • Video-streaming?
  • User authentication and multi-user potential.


Final note.  We feel as though video-streaming apps are stuck on just getting the video up.  Ustream has a nice Android app that very quickly allows you to view a full-screen stream, or start your own.  But it does not function well in disseminating information, particularly on a directed topic.  We would like to be able to embed the video into a stream so that the end result is like a curated Reuters news feed, which differentiates between admins, editors, and random commenters.  Those last commenters are very important though, as they may actually be on-site and have a lot of info to share.  It is a curator’s role to promote that info and demote the chaff.

Another thing.  We found prezi very useful for our presentation, as well as the app Droid@Screen, which is a Java file that goes in your Android SDK folder containing adb.  That app allows you to display what’s going on on your phone’s display onto the monitor, which can then be projected onto a wall or large screen.