Jeff Thompson | Blog

Archive for the ‘code’ tag

Human Chromosome #1

The entire human chromosome #1, with A, C, T, and G color coded and rendered as individual pixels. Created with Processing using data via Project Gutenberg.

April 3rd, 2013 at 8:58 pm

MS Cave Paint

Spent far too much of the weekend making this version of MS Paint in Processing.js where you are thrown back 17,000 years to Lascaux Cave.

Try MS Cave Paint for yourself!

March 23rd, 2013 at 3:37 pm

Haptic Games Resources

I’ve added a few resources for the haptic and non-visual games research:

Please note that both of these are messy, working “sketchbooks” during the project’s development. As the tests are revised and finalized for release, the code and other files will be tidied.

March 21st, 2013 at 8:58 am

How Many Lines of Code Did I Write This Year: 2013

My annual tally of my code-writing for the year:

[table “5” not found /]

Perhaps not perfect (I think too much PHP, not enough HTML or Python), but a pretty good indication!

January 22nd, 2013 at 8:22 pm

Tagged with , ,

Harbor Freight Email

An email from Harbor Freight -> forwarded -> replied.

November 5th, 2012 at 6:03 pm

Tagged with , , ,

Some Kind of Adobe Error

Found in, printed via some odd process and left in the printer:

ERROR: ioerror        (COMMAND TYPE: operatortype)
OFFENDING COMMAND: readstring "readstring"

OPERAND STACK: (4 total entries)
===top of stack===

{
-filestream-
-mark-
-savelevel-

DICTIONARY STACK: (11 total entries)
===top of stack===
<unknown>
Adobe_AGM_Image
SharedFontDirectory
Adobe_CoolType_LVMFonts
Adobe_CoolType_GVMFonts
Adobe_CoolType_Core
Adobe_AGM_Core
Adobe_AGM_Utils
userdict
globaldict
systemict

EXECUTION STACK: (17 total entries)
===top of stack (top 10 entries shown)===
{ pop }
---@exec---

{
{ --cleartomark-- --restore-- }
{ --currentdict-- /_Filters --known-- { _Filters AGMING_flushfilters } --if-- --end-- }
-filestream-
{ --disableinterrupt-- }
--@aborted--
{ --clearinterrupt-- --disableinterrupt-- { } --exch-- 0 --exch-- --put-- --clear-- }
--@aborted--

NEXT 320 CHARACTERS AFTER ERROR:

-- No More Data Available --

October 17th, 2012 at 5:47 pm

How Many Lines of Code Did You Write This Year?

Filling out my pre-tenure paperwork (blech) I started to wonder.  I sure wasn’t going to count them by hand, so I wrote a Processig sketch bash script to find out.  Result: 208 sketches for a total of 20,944 lines or 590,670 characters!  (2010: 232 sketches, 19,786 lines, 563,083 characters; 2012 so far: 9 sketches, 879 lines, 27,533 characters)

UPDATE:
The previous version used a Processing sketch to find the information, which seemed poetic.  However, it seems that Java doesn’t do file handling very cleanly (curse you File variable).  As I went to bed, it seemed a bash script would be much cleaner and likely faster, so I got up today and wrote one.  Sorry Windows users, this is likely Mac/Linux only.  You can still download the Processing sketch and try it yourself.

#!/bin/bash
# Jeff Thompson | www.jeffreythompson.org

# enter the year you're looking for and the path to your Processing sketchbook
lookFor="pde"											# file extension to look (period optional)
yearCreated="2011"										# year to look at
pathToCheck="/Users/jeffthompson/Documents/Processing"	# where to look
# pathToCheck=$HOME										# alternatively, look everywhere (may be VERY slow)
dateRange="01-Jan-$yearCreated"							# set date to the first of the year we're looking for

echo ""
echo "HOW MANY LINES OF CODE DID YOU WRITE THIS YEAR?"
echo -e "Path:\t\t$pathToCheck"
echo -e "Extension:\t$lookFor"
echo -e "Year:\t\t$yearCreated"

# note: we don't need the . in front of the extension since * will match all preceeding characters
find $pathToCheck -type f -name \*$lookFor -newermt "$dateRange" -and -not -newermt "$dateRange +12 month"> "$lookFor_files.txt"
fileCount=$(wc -l < "$lookFor_files.txt")

lineCount=0
charCount=0
while read line; do
	lines=$(wc -l < $line)		# count lines in the file
	let "lineCount += lines"	
	chars=$(wc -c < $line)		# count characters
	let "charCount += chars"
done < "$lookFor_files.txt"

rm "$lookFor_files.txt"			 # be nice and delete the working file (optional)
echo -e "Result:\t   ${fileCount} files, ${lineCount} lines, ${charCount} characters"
exit

Sorting Hexadecimal Colors

I’m currently working on a poster/catalog for an upcoming curatorial project at the Bemis Underground and was thinking of using an image of sorted white noise on a television set.  Grayscale white noise is actually pretty boring (so long as it’s actually close to random, the values will fall along a Gaussian curve), so I tried some other experiments.

Using hexadecimal color yielded some pretty interesting results.  The above image is 1,296,000 random values that range from #000000-FFFFFF (0 - 16,777,215).  A Processing sketch sorts those values numerically and fills the pixels of the image in order.

Click here, or on the image, for full-resolution.

Also of interest were Photoshop’s histograms of the color – I’ve not really looked at histograms much in the past, but these were really strange.  Luminosity was, as I suspected, a Gaussian curve and RGB values were each close to a flat line.  But overall “color” resulted in the above images.  The top is the raw image, the one below after “Auto Color” correction: 8-bit fortress meets birthday cake.

December 27th, 2011 at 9:34 pm

Tagged with , , ,

Forest Fire Simulation

December 3rd, 2011 at 1:37 pm

Satan’s Gray

Satan’s gray – #666 in hexidecimal.

August 21st, 2011 at 8:31 pm

Tagged with , ,