Friday, April 29, 2011

Punishment

Day 1 Friend: "Could you do me a favor? I need someone trustable and unswayable such as yourself to change my minecraft account password and not give it back to me until after finals. If I try to convince you to give it back to me before the semester is over, just tell me to work on my homework or to do something productive."
Me: "Sure. Done."

Day 2 Friend: "The new minecraft update is out! Let me have the password, just to check it out. Pls?"
Me: "No."

Day 3 Friend: "Man, giving my minecraft password to you was both the best and worst decision, depending on how I'm feeling about it. I know you'll never give it back, and so I'll have to stay on task... but then I know I'll never be able to convince you to give it to me either. Well now, you should try the game out yourself. heh heh"
Me: "And turn into an addict like you? Nuh uh."
Friend: "I'm not an addict! I like wasting time by assembling virtual blocks in fun shapes."

Day 4 Me: "I'm changing your profile picture to a picture of Sean Hannity." (Okay, maybe I baited him a little.)
Friend: "Curses! You'll ruin my reputation!"
Me: "Well...I can make it Glenn Beck if you'd prefer."

Day 5 Friend: "Can I minecraft for a bit? I want to check out the new features."
Me: "No."
Friend: "Dreeeeeek!"
Later Friend: "I'm dying of productivity, I've already gotten 2 assignments done early. Just a little minecraft wouldn't hurt..."

Day 6 Friend: "Can I have my password? I have nothing to do this weekend."
Me: "Except study?"
Friend: "Study? I'm done with homework!"
Me: "I would have thought you'd have forgotten about minecraft by now."
Friend: "Well I've given up trying to guess the thing you changed the password to."
Later Friend: Offensive emoticons
Later Friend: "I'll buy you your own account, just give me the password"
Friend: "I thought I could trust you"
Friend: "WHY THE HECK DID I DO THIS!"

Day 7 Friend: Suspicious silence
Day 8 Friend: Suspicious silence
Day 9 Friend: Suspicious silence
Day 10 Friend: Suspicious silence
Day 11 Friend: Suspicious silence
Me: Checks minecraft account. Can't log in.  Friend must have reset password.
Me: "Can you look me in the eyes and say you haven't played minecraft in the last week?"
Friend: "A person needs balance in their life..."

Right-handed rotation matrix for roll/pitch/yaw

Specifically, an three-dimensional orthogonal matrix corresponding to a counter-clockwise/right-handed rotation where roll is the rotation about the x-axis, pitch is the rotation about the y-axis, and yaw is the rotation about the z-axis.

You wouldn't think this would be hard to find online, but go figure.

Thanks to Phaedrus for his explanations and...well, doing most of the work.

Note: this matrix effectively yaws first, then pitches, then rolls.  For the opposite order (and the one I ended up using), look below.

[ cos(pitch)*cos(yaw) -sin(yaw)*cos(pitch) sin(pitch) ]
cos(yaw)*sin(pitch)*sin(roll)
    + sin(yaw)*cos(roll)
-sin(yaw)*sin(pitch)*sin(roll)
    + cos(yaw)*cos(roll)
-cos(pitch)*sin(roll)
-cos(yaw)*sin(pitch)*cos(roll)
    + sin(yaw)*sin(roll)
sin(yaw)*sin(pitch)*cos(roll)
    + cos(yaw)*sin(roll)
cos(pitch)*cos(roll)


 And to put it another way:

//Top row
rotation[0][0] = cos(pitch)*cos(yaw);
rotation[0][1] = -sin(yaw)*cos(pitch);
rotation[0][2] = sin(pitch);

//Middle row
rotation[1][0] = cos(yaw)*sin(pitch)*sin(roll) + sin(yaw)*cos(roll);
rotation[1][1] = -sin(yaw)*sin(pitch)*sin(roll) + cos(yaw)*cos(roll);
rotation[1][2] = -cos(pitch)*sin(roll);

//Bottom row
rotation[2][0] = -cos(yaw)*sin(pitch)*cos(roll) + sin(yaw)*sin(roll);
rotation[2][1] = sin(yaw)*sin(pitch)*cos(roll) + cos(yaw)*sin(roll);
rotation[2][2] = cos(pitch)*cos(roll);

Note: this matrix effectively rolls first, then pitches, then yaws.  This turned out to be the one I used for my system.

[ cos(pitch)*cos(yaw) -sin(yaw)*cos(roll)
    + cos(yaw)*sin(pitch)*sin(roll)
sin(roll)*sin(yaw)
    + cos(yaw)*sin(pitch)*cos(roll)
]
cos(pitch)*sin(yaw) cos(yaw)*cos(roll)
    + sin(pitch)*sin(yaw)*sin(roll)
-sin(roll)*cos(yaw)
    + sin(pitch)*sin(yaw)*cos(roll)
-sin(pitch) cos(pitch)*sin(roll) cos(pitch)*cos(roll)


//Top row
rotation[0][0] = cos(pitch)*cos(yaw);
rotation[0][1] = -sin(yaw)*cos(roll) + cos(yaw)*sin(pitch)*sin(roll);
rotation[0][2] = sin(roll)*sin(yaw) + cos(yaw)*sin(pitch)*cos(roll);

//Middle row
rotation[1][0] = cos(pitch)*sin(yaw);
rotation[1][1] = cos(yaw)*cos(roll) + sin(pitch)*sin(yaw)*sin(roll);
rotation[1][2] = -sin(roll)*cos(yaw) + sin(pitch)*sin(yaw)*cos(roll);

//Bottom row
rotation[2][0] = -sin(pitch);
rotation[2][1] = cos(pitch)*sin(roll);
rotation[2][2] = cos(pitch)*cos(roll);

Thursday, April 28, 2011

Nudist Beach

Sunday, April 17, 2011

Equations

Am I the only one who finds it amusing that recreational drug proponents clamor for the "freedom to choose" to do something that removes their freedom to choose?

And does anyone else find it laughable that one of their primary arguments is that it "doesn't affect anyone else"?

Foot in...pot?

Yesterday we had an early Easter celebration, since Child is going to be in Utah over Easter while I remain here in CA and work.  While we were outside hunting eggs, I noticed our back-fence neighbor out watering his ducks and chickens.  I went over to say hello.

Mr. Chicken seemed a nice gentleman, although it quickly became apparent that he didn't have a very high opinion of the previous residents of our home.

"Apparently the low opinion is universal," I said.  "A few days ago I met Mr. RV, our next-door neighbor, and one of the first things he asked me was if I was growing pot!  Ha ha!"

Mr. Chicken didn't blink.  "I'm growing pot," he said.

Mr. Chicken clearly wasn't joking.  "Just two or three plants," he added.  "I have a lot of neurological problems and it's medicinal.  I grow it legal."

Oh.  Okay.  Note to self: you live in California now.

(Edit: I should add that Mr. Duck called me up this morning and asked that I meet him by our back fence.  There, he presented us with the nicest flat of 18 eggs from his chickens, as well as bacon, hash browns, and a jar of raspberry jam.  He's a very nice neighbor.)

Friday, April 15, 2011

Low Expectations

I met one of my neighbors today. He was climbing out of his RV as I left for work, so I jumped out of my car to say hello.

ME: "Hello! My name is Drek. I just moved in next door."
HIM: "That's nice. Are you growing pot over there?"

Apparently the previous few occupants have greatly lowered his neighborly expectations.

Of course, some of his initial assessment of me may have had to do with the fact that our plumbing is broken so we haven't had running water, much less hot water for shaving, showering, and washing wrinkled work clothes, for over two days now.

He also suggested I fix the gopher holes in our yard. Apparently whenever it rains, the water pools in our yard, then drains out through the holes into his yard, which is at a lower elevation.  That didn't make a very convincing case for fixing the holes--in fact, it suggested that putting out gopher treats might be a great idea from a landscaping perspective. 

Overall, he seemed like a pleasant, friendly gentleman, at least once he understood that I was not, in fact, growing pot in my new house.

Thursday, April 14, 2011

Port Forwarding

The post is more for my own remembering than anything else, although I'm posting it here just in case someone stumbles across it and finds it useful

The goal: allow a remote computer to view a website hosted on my local computer.
Steps:
  1. Set up an account with dyndns.org
  2. Install ddclient on my Ubuntu machine to periodically notify dyndns.org what my IP address is
    1. Don't prepend "http://" to your domain name in the ddclient setup!
  3. On my router, assign my computer a static IP address
  4. On my router, forward incoming traffic on port 8080 to the new static IP address
  5. On my computer, port-forward port 8080 to port 80, where my apache webserver is listening
    1. sudo iptables -t nat -A PREROUTING -p tcp --dport 8080 -j REDIRECT --to-port 80 (add the port forwarding rule)
    2. sudo iptables -F (flush the rule)
    3. sudo iptables -t nat --list (view the rule)
    4. sudo bash -c "iptables-save < /etc/iptables.rules" (save the rule to a file)
    5. sudo echo -e '#!/bin/sh\niptables-restore < /etc/iptables.rules\nexit 0' > /etc/network/if-pre-up.d/iptablesload (to create a script to restore the iptable rules every time the network interface comes up)
    6. sudo chmod +x /etc/network/if-pre-up.d/iptablesload (to make the script executable)
  6. Visit my site in a browser at http://subdomain.dyndns.org:8080
iptables: https://help.ubuntu.com/community/IptablesHowTo

Sunday, April 10, 2011

First Impressions

My plan was simple, really: trick the Lord into giving me a prime job at church.  We finally moved into our very first house last Monday, so today was our first Sunday in our new ward.  The idea is simple: wear a really nice suit the first day at church, and make sure you shave and comb your hair.  The Lord thinks you've turned a new leaf and inspires the Bishop of your new ward to give you a calling commesurate with your new duds, like...well, anything but nursery worker.  The Bishop wouldn't dream of sending you to a room where little grubby paws would wipe boogers and animal cracker crumbs all over your sparkly suit, right?

I think I may have blogged about doing this when we moved into our previous ward and it actually worked out pretty well.  I got called to be the Elder's Quorum secretary, where the worst thing I had to deal with was no one turning in their home teaching reports on time.

Apparently the Lord got wise to me.  Maybe I shouldn't have blogged about it.

So this morning I shaved and combed my hair for the first time in--well, however long it's been since the first Sunday in our previous ward.  I pulled my dusty, unused-since-the-first-day-of-church-in-our-previous-ward suit from the closet and put it on.  Church time rolled around and I put Ash in her car seat, blissfully unaware that as I gave her a bottle, I was setting in motion events that would result in my doom.

We arrived at church, made a good first impression as we strolled confidently into sacrament meeting, and found our seats near the front where everyone could admire the back of my combed head and the Bishop and his counselors could get a good look at my shave and slightly-wrinkled suit.  We sang the opening song, said the opening prayer, conducted a little ward business...then the Lord pulled the trigger.

Ash peed on me.

Child was apparently in on the plot.  Before I could move, she whisked Ash and the diaper bag away and was gone up the aisle.  I was left completely exposed, with nothing to hide a giant wet spot in the middle of my lap.  Disaster!  Ash had hidden my scriptures as we were rushing out the door that morning so I didn't even have those.  They were all in on it!

The boy carrying the sacrament tray was coming from the left!  The man who counted attendance was coming from the right!  The person in front would turn around to introduce himself at any moment!

I thought fast, grabbing a hymnal and opening it on my lap as if I were deeply absorbed in the lyrics to "I Believe In Christ."  Three ice ages later, Child returned with Ash and I was able to snatch her back and make a hasty, damp exit from the chapel.

So the Bishop's only impression of me was what he got from the all of five minutes I spent in sacrament meeting.  "Must be a less-active member," he probably thought.  "Maybe not a member at all.  Probably just came because his wife nagged him to be supportive on her first day in a new church.  Wonder why he was reading that hymnal?  Bit of an odd fish.  Nice hairdo, though."

So...yeah.  Nursery for me for sure.  No way the Bishop is going to trust me with a calling that deals with anything above the most rudimentary gospel principles.  So much for that plan.