Archive for the ‘Uncategorized’ Category

HN has ads?

Friday, January 18th, 2013

Check it out – number 15. No up votes. No URL. No points and no comments. Just a vague ┬átitle (yet extremely alluring to my inner child) that links to a 42floors ad. And one that might be a photoshop disaster, no offense. I think they pasted at hat guy’s head on an older dude’s body. Look at the hands. Is this what I think it is?

HN

HN

Representing 2d and 3d data in 1 dimension.

Friday, November 23rd, 2012

When programming applications that operate on some spacial dimension we often work with maps. Specifically, if someone is writing an adventure game they may use a 2d array to store their world data. The programmer would then access elements on the map like so

var map = new Map2DWithDataAlreadyInIt();
var x = 3;
var y = 5;

console.log(map[x][y].someDataValue);

In C that kind of array access is syntactic sugar for

int ndx = map.width*y + x;

MapElement* el = map[ndx];

which shows us that storing two dimensional data in a one dimensional data structure is as simple as specializing the element access mechanism.

Similarly we can store three dimensional data in a one dimensional data structure using this formula for element access

int ndx = map.width*map.height*z + map.width*y + x;

MapElement* el = map[ndx];

You can see that the element access equation for two dimensions is contained inside the equation for three dimensions, which means our equation is recursive, fun huh? So you can guess that next we could use this pattern to store four dimensional data in one dimension or eleven dimensional data in one dimension – just by using a single array and a special access equation.

So – tell me what the access equation would look like for four dimensions…

and…

give me a generalized equation of element access for n-dimensional data.

Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo

Thursday, November 8th, 2012


And just to bring it back to programming, or math, or data structures, or something other than buffalo:

A tree of buffalo

Buffalo, dawg.

Praise be to DOS

Wednesday, November 7th, 2012

clicky clicky DOS

 

Measuring the speed of light using marshmallows in a microwave

Sunday, November 21st, 2010

I just saw a video here about using neon bulbs to visualize microwaves in a microwave oven.
Another great microwave oven experiment (that I learned from Lynn Cominsky at Sonoma State) is measuring the speed of light (or the frequency of the microwaves emitted) using marshmallows.

1. Cut a bunch of marshmallows in half (or use small ones) and cover a plate with them.

2. Take the rotating platter out of the microwave and place the plate inside. The rotating platter helps cook your food evenly by spinning the food in and out of the microwave’s ‘hot spots’, but for this experiment we want the marshmallows not to cook evenly. The microwaves are emitted from one side of the microwave (where the emitter is located) and bounce off the opposite side, creating standing waves. The anti-nodes (crests) of the standing waves are the ‘hot spots’ I mentioned earlier. The marshmallows will burn along these anti-nodes.

3. Measure the distance between the burn marks. This distance is the wavelength of the microwaves emitted by your microwave.

4. Use this simple wave equation to verify either the speed of light (if your microwave lists its frequency on the back panel) or to determine the frequency of your microwave (given that the speed of light is approximately 3×10^8m/s).

wave equation wavelength = velocity/frequency

Don’t forget to convert your units!

The ANI Programming Language

Friday, November 12th, 2010

Oh man, I just read about ANI on hackurls.com and it looks amazing. I can’t wait to get my hands dirty.

http://code.google.com/p/anic/

Smugmug Gallery Viewer – Javascript

Monday, November 8th, 2010

I wrote a smugmug gallery viewer in javascript. To my knowledge it’s the only js gallery specifically geared at viewing smugmug account galleries. Clone the git repo (or download a tarball) here. I’ve used two js libs that I wrote recently, go (an evented control flow based on callbacks) and heyjacks (an asyncronous jsonp request helper). Let me know what you think.

Altered States

Saturday, May 2nd, 2009

I just saw this movie called Altered States, it’s pretty interesting – a little cheesy at times, but check out these screen shots:










Man, they don’t make movies like they used to.


Follow me on GitHub
Follow me on Google+
Follow me on Twitter