search
Thursday, 2016 June 16, 00:20 — eye-candy, neep-neep

fun with colors

Here, have a couple of Python scripts. Each creates an image file, 2^12 pixels square, each pixel of a different color.

colorshuffle.py puts the coordinates of each pixel in Gray code, assigns each bit to one of the color channels, and converts each channel back from Gray code to choose a color. The assignment is chosen at random from 141926400 possibilities.

colorfold.py is my attempt to re-create and extend this: it folds the square eight times to make a cube fitting the color space. The interesting part was maintaining continuity through multiple folds. This one has only 107520 possible outcomes; again they’re chosen at random. I don’t like the result nearly as much as the other, but you might!

You’ll need Python Imaging Library.

On my machine each takes less than two minutes, so with a simple shell script you can whip up hundreds overnight.

( . . more . . )

Tuesday, 2016 May 31, 13:12 — bitterness, technology

hilarious title

On a private mailing list, a novelist asks for suggestions: what technological hobbies might a bright teenager have, in Oakland circa 1975? Chemistry sets were mentioned, among other things.

I may have had a chemistry set at age 8 or so; memory is spotty. A few years later we got an electronics kit, consisting of a collection of elements in Lego-like blocks. There was a booklet, starting with easy things like a light switch and an electromagnetic telegraph relay. (Maybe I thought the latter was easy because Dad and I had made one, about the same time as the possible chem kit).

Then on the next page was an oscillator or something. No explanation of why it was an oscillator. I thought, well, if I can’t see for myself why it’s an oscillator, evidently I’m not cut out for this stuff; so I quietly abandoned it.

My adolescence in a nutshell.

Of course it never occurred to me that perhaps there was no explanation because I was not expected to understand an explanation; I was expected to treat the oscillator as a black box. (Not that I had the concept of “black box”, either!)

Oh well.

Monday, 2016 January 4, 11:01 — cartoons, technology

I’ve seen such changes

How old do you need to be to understand this gag from 1978?

Monday, 2015 August 17, 23:44 — music+verse, technology

ringy-dingy

My new telephone has dozens of ringtones and I hate them all: Newagey lo-fi orchestral crap, mostly laden with snare drums for some reason.

My last phone played the sound of an old-fashioned mechanical bell; the one before that, a pizzicato passage from a Ravel string quartet; before that, the quick part of Pachelbel’s Canon – in frankly electronic timbres that did not pretend to be an orchestra.

I want a ringtone that says “a digital device seeks your attention,” not one that sounds like something overheard on a cheap radio belonging to someone with no taste.

Saturday, 2014 October 11, 21:43 — neep-neep

Mavwrecks

I’ve noticed some changes in jumping from MacOS 10.6.x to 10.9:

The keystroke Command Option Eject no longer puts the computer to sleep.

On the Dock, the active app indicator is much less visible. (later improved)

Scroll bars no longer have arrow buttons, so I can’t click to scroll slowly.

When I charge my telephone on USB, it’s no longer recognized as a volume. (I’ve since got an Android phone, with a tolerable interface.)

Saturday, 2014 May 10, 16:30 — curve-fitting, neep-neep

naming is hard

I often have trouble giving meaningful concise names to variables in the programs I write, perhaps because, until I reach for the keyboard, my thinking is largely nonverbal. I suspect that it would be less of a problem for someone more exposed to the accumulated lore of programmer culture; though perhaps not in this case:

I’m thinking of breaking up this process into multiple rounds, to obtain increasing degrees of geometric continuity. The initial nodes would coincide with the input dots but have no defined theta (tangent angle) or kappa (curvature); the first round of replacements determines theta for G¹ continuity, the next round determines kappa (the first derivative of theta) for G² continuity — and subsequent rounds may seek higher degrees of continuity by matching further derivatives.

This means that the node object, instead of exactly two fields called theta and kappa, should have a list of theta and its known derivatives (one more than the current replacement-round needs), and I’m at a loss for a good name for this list.

Saturday, 2014 February 1, 18:32 — mathematics, neep-neep

FCC cube generator

I could have used this a week ago.

def fccstack():
	newlimit = 0
	while True:
		oldlimit = newlimit
		newlimit += 1
		# extend z
		for x in xrange(oldlimit):
			for y in xrange((x+oldlimit)&1, oldlimit, 2):
				yield (x,y,oldlimit)

		# extend y
		for x in xrange(oldlimit):
			for z in xrange((x+oldlimit)&1, newlimit, 2):
				yield (x,oldlimit,z)

		# extend x
		for y in xrange(newlimit):
			for z in xrange((y+oldlimit)&1, newlimit, 2):
				yield (oldlimit,y,z)

g = fccstack()
for dummy in xrange(512):
	p,q,r = g.next()
	print "%d %d %d\t%d" % (p,q,r, p+q+r)

This lists coordinates of sites in a face-centred cubic lattice, filling the smallest cube that contains the number of sites required.

« Previous PageNext Page »