Monday, January 2, 2012

how to open a port on osx leopard

(7) Enable Port-Forwarding

- Add a rule to do port-forwarding from port 80 to Tomcat's default port 8080. Type this in the Terminal:

sudo ipfw add 100 fwd 127.0.0.1,8080 tcp from any to any 80 in

Friday, December 30, 2011

find that class - jar

for i in *.jar; do /cygdrive/c/jdk.../bin/jar.exe -tvf "$i" | grep ClassYouWantToFind && echo "$i"; done;

Saturday, August 27, 2011

using glfw on os x xcode

download it

make cocoa
sudo make cocoa-install

In Xcode, you just need to specify where the user library and user include folders are. Go to Project -> Edit Active Target. In there, you should see a number of fields under search paths. Under the 'Header Search Path' add '/usr/local/include/' without quotes. Under the Library Search Path, add '/usr/local/lib'.

Under Linking, go to Other Linker Flags and add the flag -lglfw .

Under architectures, change architectures to 64-bit intel

add libglfw.dylib to the project by dragging the file into XCode

for some reason had to copy libglfw.dylib to /build/Debug/. to get it to run under the debugger. wtf?

Wednesday, September 1, 2010

Apple's New Datacenter

Apple's new billion dollar datacenter in Maiden, North Carolina has killed everything within 100 feet of its walls and leaks some sort of goo.

Tuesday, August 31, 2010

redis 2.0 + node.js

This is how I made a node.js web server that pulls an integer off a redis server, displays a hello world page, then increments that value.

What I did:

Downloaded redis 2.0 source from google code to a folder just off my desktop called redis. unzip, untar, cd redis-2.0.0-rc4, make. Ran ./redis-server and let it sit - listening for connections. (this uses the standard config, nothing special. I did nothing but run it.)

Made a folder inside the Desktop/redis folder called node-redis-client. did a git clone for node-redis-client then get checkout redis-2.0 to get the branch that works with redis 2.0. This puts a lib folder there with a script called redis-client.js

A while ago I downloaded node.js to a folder just off my desktop called node. Not sure what I had to do to get it running. Probably not much. For this, I simply cd'ed into that folder and ran ./node. It worked.


In the node folder I wrote the following program, called it hello-node-redis.js, and ran ./node hello-node-redis.js, then hit http://127.0.0.1:8008 with firefox, hit reload a few times. it worked.


var sys = require("sys"),
http = require("http"),
client = require("../redis/redis-node-client/lib/redis-client").createClient();


http.createServer(function(request, response) {

client.get('mycounter', function(err, data){

var headers = { "Content-Type": "text/plain" };
response.writeHead(200, headers);
response.write("Hello, World!\n");
if( !data ){
response.write('does not exist');
sys.puts("mycounter does not exist");
return;
}
sys.puts("doing a responsewrite for mycounter");

response.write(data.toString());
response.end();
});

client.incr('mycounter',
function (err, reply) {
sys.puts("incr mycounter " +
(reply == 0? "no one" : (reply + ".")));
}
);
client.publish("channel-1", "ohhai",
function (err, reply) {
sys.puts("Published message to channel-1 " +
(reply == 0? "no one" : (reply + " subscriber(s).")));
});

}).listen(8008);
sys.puts("> Running at http://127.0.0.1:8008/");




special thanks to:
http://howtonode.org/node-redis-fun

http://www.pgrs.net/2010/2/28/node-js-redis-and-resque

Wednesday, June 23, 2010

html mass update

Another post just here for future reference*

I wanted to update the footer on every HTML file on trickykegstands.com. Thanks to the advice here I simply had to run one command:

find . -name '*.html' -exec sed -ir 's/Copyright \©\; 2008/Copyright \©\; 2010 Jordan Woerndle/g' {} \;

and that was it.

* - by the way, besides random notes, I'm done with this blog. I'm back to putting everything I write on armp.it or trickykegstands.com.

Wednesday, April 14, 2010

for my notes

Back to hacking some C on the Mac. Ran into a bug that seems to be osx or xcode related. No time to track it down now. So, i'm putting it here so I can find it when I need it:

bug:

mind(16331) malloc: *** error for object 0x74: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

solution:

http://discussions.apple.com/thread.jspa?messageID=10244508

unrelated - using the "Curiously Recurring Template Pattern" which lets us use virtual functions without the cost of dynamic polymorphism:

http://www.gamedev.net/reference/articles/article2015.asp


okthx

Tuesday, March 30, 2010

Woerndle Conjecture

Humans will never contact other intelligent life because every time a culture gets significantly advanced it winds up erasing itself by playing with particle physics. So it goes...

Monday, March 29, 2010

shoney's stomach

Inspired by a drunken FB status update I posted Saturday night while being driven home, I was thinking about "shoney's stomach." That disgusting feeling you get after you eat a ton of crap food at a shitty chain buffet restaurant. My friend, JB coined that gem along with: Speed - When you spill something on yourself and it looks like pee.

I just want to point out that neither one of those terms return any real results with a google search. That's +10,000 for JB's originality. However, I'm very much hoping the shoney's stomach doesn't return any results because they sick corporate ninjas on anyone who publishes that term. Interestingly, I tried to steal and upload a photo of the shoney's bear to this post, but it kept mysteriously disappearing.

If I disappear, you know why.

Wednesday, March 17, 2010

aaaaand... done

A day after I returned from SXSW someone asked if I'd go back. Exhausted, I distinctly remember saying I had a lot of fun but probably wouldn't go back unless I was playing. (Yes, I really said that... douchey, no?) Two weeks later I realized it was the best thing I've done in years and planned to go back every year. (not going this year. sad.)

I finished Infinite Jest late last night. It was as good as everyone says. It was as hard to stick to as everyone says. It was as much work (8 1/2 months for me) as everyone says. I'm exhausted and afraid what I say about the book today will sound horribly wrong to me next week. I need time to kind of figure it all out, develop.

I'm confident this will be my favorite passage forever, though:


That most Substance-addicted people are also addicted to thinking, meaning they have a compulsive and unhealthy relationship with their own thinking. That the cute Boston AA term for addictive-type thinking is: Analysis-Paralysis. That cats will in fact get violent diarrhea if you feed them milk, contrary to the popular image of cats and milk. That it is simply more pleasant to be happy than to be pissed off. That 99% of compulsive thinkers' thinking is about themselves; that 99% of this self-directed thinking consists of imagining and then getting ready for things that are going to happen to them; and then, weirdly, that if they stop to think about it, that 100% of the things they spend 99% of their time and energy imagining and trying to prepare for all the contingencies and consequences of are never good. Then that this connects interesting with the early-sobriety urge to pray for the literal loss of one's mind. In short that 99% of the head’s thinking activity consists of trying to scare the everliving shit out of itself.

Sunday, March 14, 2010

some maths

The video for Lady Gaga's telephone was released on March 11 at 11:30pm ET.

When I watched it at 1:49am (ET) Sunday, March 14, youtube says it has been viewed 12,443,126 times.

9:32 play time = 9.53333 minutes

(12,443,126 * 9.5333333) / 60

Lady Gaga = 1,977,074.47 hours of attention in 3 days.

I'm not really sure what that means so I looked it up:

Habitat for Humanity's houses each take 1,600 man hours to build.

A Boeing 747 takes 2,160 man hours to build from scratch.

huh.

Monday, March 1, 2010

MyGraine

You're at the sink doing dishes or getting some water when you notice something doesn't look right. Look at the clock, it takes a while to read. It is 12:06. Look at the floor, look at your hands - something is definitely wrong with your optic chiasm or lateral geniculate nucleus (LGN) or visual cortex, in general. Driving suddenly sounds like an awful idea. Plans for errands, lunch at Bread Co and a quick run are out. You’re hungry - maybe that’s it. Throw together a quick ham sandwich and have a glass of water. Eat quickly to get some energy. You sit at your computer to pass some time, to digest and breathe (maybe you forgot to), but it’s impossible to read through what looks like a broken camera lens, shattered across the upper 90, blurry, with bright points of pastel running along the cracks - the whole right of your visual field distorted and nauseating.

You close your right eye, but nothing changes. It is some sort of error beyond the optic nerve. There’s nothing to do now but wait. Quickly, you put the ham and mayo back in the fridge, scoop up the dog and head to the bedroom, stopping on the way (experience) to lift the seat of the toilet. Your right shoulder bangs against the door frame. You’re clumsy now, be careful with the dog. Set the dog on the bed. Change into pajamas, awkwardly. Close blinds, pull the curtains, slam the doors. You lay, pillow over head, dog nuzzled in your side, with blankets. You Wait.

Within minutes a small point of pain develops in what feels like the lower, middle part of your brain. It is just left of center. A concentrated, shooting pain. As if your LGN is calling out to explain the problem with the right side of your visual field. A sequence of pain, numb, pain, and numb. Then it shrieks.

This isn’t the worst migraine. It isn’t one that consumes your entire head, but it is far from pleasant. You writhe. You wish for sleep. You try little tricks to soothe. You masticate (maybe the old TMJ triggered it?) you hum loudly, hoping to vibrate the small part of your brain that is screaming - Nothing. Different pitches – Nothing. Your dog wakes up, confused. You stop. It is time to lay still and wait with whatever will block out the most light over your head. Thank God it is quiet.

Thank God you’re at home.

You wait for the nausea. Maybe this time will be different. Maybe this time you won’t vomit. That ham sandwich was delicious. You didn’t eat White Castle for years after that One Time. It would be a shame for a pesky migraine and uncontrollable vomit to ruin future ham sandwiches.

You wait for what seems longer than usual. Maybe you won’t vomit (mental high five). The dog changes position which seems like a good enough idea so you, too, roll onto your side. The liquid in your stomach shifts. Instant mouth watering, denial. Pillow off head, denial. More saliva, blankets off. Acceptance. Four long strides to the bathroom...

(This paragraph left as an exercise for the reader)

Rinse. Wash face. Towel off. Back to bed.

(Repeat previous 2 paragraphs 4 times)

You sleep, finally. You wake up and feel, off. Not much pain, but there is an aura, almost. At the least it is Just Not Right. You imagine this is what it feels like right before a seizure. Should you call someone? No. Just try to sleep.

Sleep.

For the next few days you feel like a small part of your brain has a tremendous hangover while the rest of your brain is saying, “WTF?” You order a ham sandwich from the deli and it is delicious.

Whew.

Sunday, February 14, 2010

Unpacking the Metaphor

Sometimes I say, "hey self, how about you get real good at writing?" Occasionally, I will give it a go. I'll spend a few minutes on one of my novels or type a quick story to add to my site. The problem is, I am a lazy writer. I will come up with something that, to me, is profound and amazing, but when I put it in letters it becomes trite and obvious. Writing is hard. I know this, but I give up. Hell, sometimes I will just make a list. I don't know who I am trying to kid. Lists are for groceries and errands... what's more boring than that?

My last post was a photo of my lunch. I thought eating cold chili directly out of a can with a used plastic spoon alone in my office while washing it down with a $4.23 8 pump 140 degree decaf mocha was some sort of symbol for my day (or life, really.) I thought it was interesting the label said both "chili" and "chilli" But, I let the photo sit there on its own. I didn't take the time to unpack the metaphor. Maybe I am afraid of admitting what it means, but more likely I'm just lazy. At some level I know this because I deleted the caption - "explanation left as an exercise for the reader" - just before I hit publish.

Last night someone said, "oh, wow, a picture of your lunch. How profound."

That's when it hit me. I'm wasting my reader's time by asking them to do my job for me. I got into the habit of scribbling down thoughts with words i do not care about. If I don't care about my words, how can I ask you to?

Will I change? I'll try.

Thursday, February 11, 2010

Thursday, January 28, 2010

Infinite Read

I borrowed Infinite Jest from the library on July 20, 2009. About 50 pages into it I knew I was ready to commit. Weighing in at 1079 pages (and nearly 4 lbs,) and with the due-date looming closer, I bought my own copy exactly one week later. I know this because I'm still using both receipts as book marks. Yep, Infinite Jest requires two bookmarks to read. And, yes. I'm only half way through it after 6 months.

My copy of the book has been rained on, covered in coffee, ketchup, and Jamaican sand, torn, dog-eared, and cut in half. I did that last week to make it slightly more portable. In fact, taking a scissors to it felt really good. At this point I kind of want to rip each page into 42 pieces and feed it to the gigantic raccoon that lives under our porch. I won't, though, because I want to read it again.

Honestly, I can't really say why I like it. I can say David Foster Wallace did something really special here. I recommend giving it a shot.

I got interested in DFW after reading the transcript of his 2005 Kenyon College commencement speech. Have a look*. Maybe it will make you want to read IJ, too. I'll be happy to lend you my copy when I'm finished but, be warned, it kind of smells like sushi.

* The much better, un-adapted version can be found here but that site is weird. The transcript is copyrighted so when that site gets taken down you can always buy the book, borrow it from the library, or get the audio version on iTunes.

Friday, January 22, 2010

how i back up my macbook

I use USB drives with a combination of TimeMachine and a bootable disk clone for backup and disaster recovery. The bootable clone is there for when the disk drive crashes hard and I need to do work. The TimeMachine backup is there for when I say, "what ever happened to that file I deleted 2 months ago?" I use 2 identical external drives to safeguard against those "oh shit, my house blew up" moments.

I have a 200 GB drive in the macbook. I bought 2 500 GB drives and put them in USB enclosures. I partitioned both backup drives identically:

My 200 GB drive shows up as 186.3 GB in disk utility so I created one partition on the external that was 186.3 GB as GUID (not apple partition map). I immediately did a "Get Info", went to "Ownership and Permissions", and unchecked "Ignore ownership on this drive." This makes it bootable (GUID) and it maintains perms giving you a good, bootable clone of your internal drive.

Create a second partition that fills up the rest of the disk. This is where you will save your TimeMachine backups. My partition is 279 GB.

Configure TimeMachine to backup to the larger partition. Let it complete the first backup. (btw, I have TimeMachine set to OFF all the time. I only do backups when I want them... This is up to you.)

Open Terminal and cd to /Volumes to see how your external drive is mounted. Figure out which volume is the TimeMachine partition and which is your disk clone partition. My disk clone partition is called macBack500GB (not the best name, i should have called it macClone or something)

Anyway, once you figure it out, go ahead and clone your drive by running the following command.

sudo rsync -vaxE --delete --ignore-errors --progress / /Volumes/macBack500GB/

Beware of the slashes and be sure to change macBack500GB to whatever you called your clone partition. Make sure you don't accidentally type something wrong. this could destroy all your data and your TimeMachine backup if you screw up...

To test the clone, wait till the rsync is complete and reboot your machine. Hold the option key down as it starts and select the external drive. You will boot into your external drive and everything will look exactly like your main drive. great! shut down, unplug the drive. You're done.

Repeat the steps using the second backup drive. Take that drive to work and lock it in a drawer. You now have the offsite backup.

The next time you want to back up (sooner rather than later) simply plug in the drive and tell TimeMachine to do its magic. It should just work. When it finishes run the rsync command.

NOTE: If you're low on space the command might fail on large files. It does this because rsync makes sure the large file is completely copied before it deletes the original. In other words, you wind up with 2 copies of a large file for a second.

Mine fails on /var/vm/sleepimage and a 32 GB parallels VM file. Before I run rsync, i browse to my external partition and delete those files. I'm sure there are flags in rsync to fix this behavior, but I haven't bothered to figure them out.


tl;dr;

plug in the drive.

Tell TimeMachine to "Back Up Now."

delete the parallels VM from the external drive
delete var/vm/sleepimage from the external drive

sudo rsync -vaxE --delete --ignore-errors --progress / /Volumes/macBack500GB/

repeat for the second drive.


Special thanks to http://jwz.livejournal.com/801607.html for the tips on the rsync part.

UPDATE 20100707: after my laptop got stolen, i bought a new one with snow leopard. restoring it with Time Machine worked great. the next time I tried backing up the drive with rsync it hung. First on /private/var/vm/sleepimage then on others. After an hour or two of fighting with it I did a sudo port install rsync and everything works again. Apparently there's a problem with snow leopard's rsync.

Thursday, January 14, 2010

Sunday, January 10, 2010

twenty years of riding

In late 1988 I decided that I needed to be a snowboarder. Sure, snowboarding wasn't the most practical sport for a kid in the midwest with no means for getting to a mountain (or snow.) But, what's fun about being practical? I begged and begged for a snowboard. My first board was a birthday present in 1989, shown here on the right:



Yes, I learned to ride in combat boots. That board was a "Black Snow" Legend solid resin board purchased at Venture. At the time it was the only board with metal edges that we could afford. It started out black with silk-screened green and pink graphics. It eventually sported a hot, custom paint job by yours truly circa 1991. The boots were hand me downs from my oldest brother. They were standard issue air force steel toed combat boots. I had to wear 3 or 4 pairs of socks because they were too big.

That board has been to art hill, Hidden Valley, Arapahoe Basin, Copper, and Breckenridge. It would have gone to Keystone, but that was before they allowed boards. I learned to ski just so I wouldn't have to sit alone at the condo while everyone else when to Keystone for night runs.

I bought the Burton Air 55 and Airwalk Advantage boots at a consignment sale while I was in college. I finally had a real board. However, I never realized the boots simply didn't fit. They were so worn out when I got them I'd end up cranking down my bindings until my feet turned blue. Somehow I didn't think that was a problem.

My wife gave me a the Burton Clash (left) and boots for my birthday exactly 20 years after I got my first board. I haven't ridden it yet, but I can tell it is going to be amazing.

Best. Gift. Ever.

Thanks boo.

(more photos)

dry spell

I am particularly proud of a reply I made to a Porsche technical forum thread this week because it is the funniest thing I've written in months.

You really have to understand what tifosiman is doing in his reply before it makes any sense. That means that only about 3 people in the world will find it funny. To me, that makes it even better.

I am jdgunn.

link to thread

Thursday, December 17, 2009

Do One Thing Every Day That Scares You

I washed a cheese grater with my bare hands.