fixing macbook after cat falls asleep on keyboard, it overheats, and fan won’t turn off

haha this keeps happening to me so posting here so i can find the solution easier when i need it ^_^

System Management Controller (SMC), responsible forcontrolling the fans, has become confused

on left hand side of the keyboard press Control-Shift-Option and on the top right of the keyboard, the power key at the same time. press power to turn laptop back on

https://discussions.apple.com/thread/3856779?start=0&tstart=0

fire skull app!

needing a decoration for halloween i decided to port my old fire skull flash experiment to the iPad.  since i've been doing a lot of iOS coding recently it was just a couple hours to get it up an running nicely.  then i wanted to spice it up a bit!

the first thing was a fancy new skull mesh.  in the old flash experiment the skull was software rendered in ActionScript (doing vertex projection to 2d in script then using polygon bitmap fill to rasterize) so the mesh had to be pretty simple and was only 1,321 triangles.  since the iOS version renders with 3d hardware it can handle something much more complicated so i dropped a 46,960 triangle mesh in for the skull.

the flash version had a glow effect (using BitmapData with ColorTransform and BlurFilter) so i added post processing for the iOS version as well, but also included some desaturation and added contrast in the shader.

after the app was running super smooth on iPad 2 and i was happy with the result i kicked it over to Apple for approval and went to bed.  unfortunately the next day i remembered i hadn't even run it on the iPad 1 so i tried that... and it ran at 12 fps... ouch!

to optimize i ran with the OpenGL ES Performance Detective which looked really cool and gave some good though rather generic advice.  i thought it was actually being pretty smart but later realized as i shifted the bottleneck around to different stages while testing that it was just always giving me the same generic advice... kinda weak.

anyhow, i did experiments like rendering without the skull, rendering with 1k tri version of the skull, using 16x16 render targets, short circuiting postproc, changing texture sizes and the like to find out which things were most tripping up the iPad 1.

the biggest thing was post processing effects.  a fullscreen shader pass is quite expensive for the iPad 1's SGX 535. i was able to filter the fire and skull textures offline to get the look i was going for and then just killed the runtime post processing entirely.

the other big thing was the expense of the fire shader.  i added a runtime check with glGetString(GL_RENDERER) to detect if the app is running on a SGX 535 and if so use a 256x256 render target for the fire instead of 512x512 to cut down more on shader processing and memory bandwidth.

there were some smaller changes as well like optimizing the mesh more by nuking some tris that would never be visible.  in the end i got the iPad 1 up from the 12 fps to 35 fps, the iPhone 4 at 37 fps, and the iPad 2 still running nicely over 60 fps.

so if you need a flaming skull decoration or just a fiery buddy to keep in your pocket you can grab him for free from the app store! be sure to leave a review about how it changed your life and brought you incredible good fortune haha

setting cache metadata on files in s3

i use Amazon’s AWS Console for uploading files to S3 and i always have to remember to manually add in the Cache-Control metadata so that i don’t get boned on bandwidth fees. i wish they would put in a nice default for that but oh well. i searched around for a better tool to use that would let me also recursively update the metadata on all my S3 files but the only one that seemed to have that feature and run on OSX cost $70! youch!

well it turns out to be easy to code up a script to do this in python using the boto library so to save you all some time (and money!!) here’s what i ended up writing :) this recursively runs through all the objects in all the buckets on an S3 account and sets the Cache-Control for JPG and PNG files.

from boto.s3.connection import S3Connection
connection = S3Connection('aws access key', 'aws secret key')
buckets = connection.get_all_buckets()
for bucket in buckets:
    for key in bucket.list():
        print('%s' % key)
        if key.name.endswith('.jpg'):
            contentType = 'image/jpeg'
        elif key.name.endswith('.png'):
            contentType = 'image/png'
        else:
            continue
        key.metadata.update({
            'Content-Type': contentType,
            'Cache-Control': 'max-age=864000'
        })
        key.copy(
            key.bucket.name,
            key.name,
            key.metadata,
            preserve_acl=True
        )

one month of Sketch Club!!

it's been a month now since Sketch Club hit the app store! it's been so much fun seeing what people create and upload to the gallery! i'm really inspired and awed by what people are able to pull from their minds and share. i've hoped to spend a lot more time sketching myself but when i do i just find more things to do or fix in the app or on the site and wind up coding haha. :P

along with the online gallery i've made somewhat of an offline gallery for Sketch Club as well. on the wall behind my desk at work i've been putting up 4x6" prints of some of the best sketches. it's quickly grown from just a shmattering to nearly the whole wall! i've had to move my big NIN poster out of the way and soon my generative art and tech prints will have to find new homes as well. here you can see a bit of the progression... :)

Sketch Club wall 0 Sketch Club wall 1 Sketch Club wall 3

sketch club!

yay apple approved my new app Sketch Club and it's now in the app store!! (here's a direct link to it in the store)

what is Sketch Club??? it's a super rad drawing / sketching / painting app for ipads, pods, and phones. :) it's got sweet procedural brushes like sketchy and fur (based on trace aka mr. doob's epic html5 sketching experiment harmony and zefrank's scribbler). it's also got smooth (which is my own take on the connect to nearest points action) and side lines (umm great for fuzzy caterpillars?!). along with that procedural madness there are regular brushes like you'd find in photoshop but pared down to the most useful functionality and a vector brush for simplified smooth or polygonal drawing. also there are foreground and background layers to draw in, a photo layer for background or tracing, and canvas color.

that's all pretty sweet, but wait there's more! :) sketch club provides not just the means of creating cool images but also the motivation! integrated with the app is an online gallery where you can upload what you make and enter it into fun competitions! the online bit is very much inspired by the wonderful demoscene portal pouet.net. you can view all the sketches people upload and rate them (rules, piggy, sucks) and as you do you earn glops and after accumulating enough glops you get hearts. it takes a lot to earn hearts so you give them to only your most favorite sketches. one departure from pouet is that while you can give sketches piggy and sucks votes (and they do factor into rankings) they are never displayed to anyone else. this way you don't have to worry about hurting someone's feelings and people won't get discouraged.

you'll notice there's already some pretty amazing sketches in the gallery! while i was working on the app and it was still littered with horrible bugs and missing features some very brave friends tested it out and helped drive its features. omg i lurve you guys, thank you!!!!! :) there are still of course some smaller bugs and tooons of features i didn't get to yet so expect plenty of updates!

okay so even if you don't have an ipod or ipad you can still participate by going to sketchclub.com and logging in with your facebook account. you'll be a guest so you can rate and comment but won't be able to earn hearts or upload sketches. if you do get a device later you can go in the app and link to your facebook account and that will upgrade you to a full member!

so yeah get sketch club and try it out, it's pretty sweet! :)