In Which I Suddenly Find Myself a JPMorgan Chase Member

Call it the ultimate NCAA March Madness Bracket. Although it isn’t March, it’s not run by the NCAA, and there’s more at stake than the $20 you threw in your friends pool.

Last week, I suddenly found myself a member of JPMorgan Chase…Washington Mutual having been sold to them for $1.9 billion.

Looks like I lost my bracket.

via TechCrunch

Using add_meta_box()

Note: Updated to be compatible with WP2.7.

Note: Technical content to follow.

In the WordPress 2.5 upgrade, Automattic completely revamped the administration interface – including the way that boxes were created for plugins (well, really the entire administration back end; however I will be focusing on plugins). Previously, you had to create the boxes manually, hard coding something to the effect of:

<div class="dbx-b-ox-wrapper">
<fieldset id="myplugin_fieldsetid" class="dbx-box">
<div class="dbx-handle-wrapper"><h3 class="dbx-handle"><?php _e( 'My Post Section Title', 'myplugin_textdomain' ); ?></h3></div>
<div class="dbx-content-wrapper">
<div class="dbx-content">
Your plugin box content here
</div>
</div>
</fieldset>
</div>

Source: http://codex.wordpress.org/Function_Reference/add_meta_box

But how do you get those slick looking boxes seen in WordPress 2.5 and WordPress 2.6 and WordPress 2.7? I looked online and I found plenty of sites detailing how to add meta boxes to the post page. However, I didn’t find anything describing how to implement the add_meta_box() function for your own plugin page.

I spent a bit of time time and reverse engineered the process. Once you have it figured out, it’s really quite simple. At the very least, it’s a lot more intuitive.

First, you’ll want to wrap your content you want to display in a function that echos it out. You’ll need a separate function for every box you want to add. After the function has been declared, you’ll want to add it using the add_meta_box() call. The usage for add_meta_box is:

<?php add_meta_box('id', 'title', 'callback', 'page', 'context', 'priority'); ?>

Here’s the PHPDoc data:
string $id String for use in the ‘id’ attribute of tags.
string $title Title of the meta box
string $callback Function that fills the box with the desired content. The function should echo its output.
string $page The type of edit page on which to show the box (post, page, link)
string $context The context within the page where the boxes should show (‘normal’, ‘advanced’)
string $priority The priority within the context where the boxes should show (‘high’, ‘low’)

add_meta_box simply adds the box to a queue. It doesn’t actually spit out any code. Thus, after you’ve created all the content callback functions and added them to the meta box queue with add_meta_box, you’ll need to execute do_meta_boxes().

<?php do_meta_boxes('page', 'context', 'object'); ?>

string $page The edit page which you want to display; this will be the same as $page specified in add_meta_box.
string $context The context within the page where the boxes should show (‘normal’, ‘advanced’).
? $object I don’t know, I just have it set to null.

All together, the code might look something like:

<?php
function yourplugin_helloworld_meta_box(){
?>
Hello, world!
<?php
}
add_meta_box("yourplugin_helloworld", __('Say Hello', 'yourplugin'), "yourplugin_helloworld_meta_box", "yourplugin");
do_meta_boxes('yourplugin','advanced',null);
?>

One weird/interesting thing I discovered is that ‘yourplugin’ can only consist of lowercase letters a-z and the hyphen “-” symbol. For all you programmers, it must return true when matched against /^[a-z-]+$/

I don’t know what, but that’s the check run on line 620 of /wp-admin/admin-ajax.php from WordPress 2.6.2.

That’s the most basic level of creating your own meta boxes. However, there’s more. Do you notice how sometime the meta boxes are closed on the posts (or pages, or links) page? The open/closed position is remembered using some AJAX. The actual data is stored per user in the wp_usermeta table with a meta_key of ‘closedpostboxes_yourplugin’. The data is a serialized array that lists just the closed the boxes.

To get this functionality, you’ll need to perform a couple more steps. First, you’ll need to add some javascript. This code does two things, on load it closes boxes that should be closed (because they were previously closed) and it allows the boxes to be toggled open and closed.

jQuery(document).ready( function($) {
	// close postboxes that should be closed
	jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
		
	// postboxes
	<?php
	global $wp_version;
	if(version_compare($wp_version,"2.7-alpha", "<")){
		echo "add_postbox_toggles('yourpluging');"; //For WP2.6 and below
	}
	else{
		echo "postboxes.add_postbox_toggles('yourplugin');"; //For WP2.7 and above
	}
	?>
			
});

You’ll also need to add this PHP code:

<?php
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
?>

This code registers a new nonce that your plugin will use to send authorized AJAX requests.

And that’s it. Give a holler in the comments if you have questions and I’ll try my best to answer them.

See also: http://xref.fergcorp.com/

The Workout Plan

I’ve been wanting to work out for a couple of months now, but A) I’ve been to lazy to actually go to the gym and B) even if I did go to the gym, I wouldn’t know what to do.

I was talking with Bob over the weekend and he mentioned that he was going to start working out again. I asked him how he works out and he told me about a program called CrossFit that he’s been following. CrossFit is a core strength and conditioning program whose specialty is not specializing. [1] Everyday, CrossFit posts the Workout of the Day (WOD) on their website and you can go do it.

This is pretty much exactly what I was looking for!

I’m tweaking the program a bit to fit my schedule better. So here are my rules:

  1. Do the CrossFit WOD from either CrossFit or FrontRangeCrossFit, I can pick after looking at each work out. If one of the sites has a “rest” day, I can do the previous days workout provided I didn’t already do it yesterday.
  2. I will take three days off a week: Saturday, Sunday, and Tuesday.

Usually there are two rest days in a week. However, I’m not usually on campus on the weekends and I usually try to not be in Golden. Also, Tuesday’s completely suck for me in general.

It’s also nice that they have some video of the different workouts and all the workouts are scalable and substitutable. I started today with:
Complete as many rounds in 20 minutes as you can of:
Run 400 meters
Max rep Pull-ups

We’ll see how this works…

[1] http://www.crossfit.com/cf-info/what-crossfit.html

Fall 2008 Portfolio Inductions

My portfolio contains some of my best (and favorite) photos I’ve taken over the years and around the world.

I’ve revamped my portfolio (read as: removed some photos) to focus less on my favorites and more on my best. It’s my hope and desire that the two intersect, but this is not always the case.

My goal is make sure that each photo here “really redefine[s] the image or genre.”

Out of 10244 photos, only 0.72% make it. The latest inductions are:

DSC_1572
Nikkor @ 70mm || 1/500 || f/4.5 || ISO200 || tripod || flash || commander

DSC_2177
Nikkor @ 18mm || 1/60 || f/4 || ISO200 || handheld || flash

DSC_2586
Nikkor 10.5mm Fisheye || 1/200 || f/9 || ISO200 || handheld

DSC_2750
Nikkor 10.5mm Fisheye || 1/30 || f/18 || ISO1600 || handheld

DSC_3081
Nikkor 10.5mm Fisheye || 1/1000 || f/6.3 || ISO200 || handheld

That Deep Blue Color
Nikkor @ 18mm || 1/2500 || f/3.5 || ISO200 || handheld

Charles at the Helm
Nikkor @ 18mm || 1/6400 || f/3.5 || ISO320 || handheld

Jeff on the Stanchion
Nikkor @ 44mm || 1/6400 || f/4.5 || ISO320 || handheld

DSC_4134
Nikkor @ 18mm || 1/6400 || f/3.5 || ISO320 || handheld

A Glance at Jen
Nikkor @ 35mm || 1/200 || f/4.2 || ISO320 || handheld

DSC_4590
Nikkor @ 24mm || 1/200 || f/25 || ISO250 || handheld || studio flashes || pocket wizard

DSC_4641
Nikkor @ 31mm || 1/125 || f/6.3 || ISO200 || handheld || studio flashes || pocket wizard

A very special thanks to Jeff, Auntie Wendy, and especially James, each of whom left comments (or sent an email). I’ll figure out prizes and such soon and let you know what the deal is.

A Really Short Review of Avenue Q

First, a little bit of background: Some time ago, I was shown a video of World of Warcraft players “lipsyncing” to a song called “The Internet is For Porn.” Pretty much ever since, I’ve wanted to see the show. I was hoping to see it a few years ago when I was in Las Vegas, however I never got around to it. Fast forward to now, school is selling discounted tickets and I manage to snag the last two.

Wow, what an amazing musical. I would describe Avenue Q as Sesame Street rated R. And I think that’s a pretty accurate statement. The puppets are all designed by Rick Lyon, who has over 25 years of experience and used to work with the late Jim Henson. There are also several interludes which are highly comical…trust me.

In short, Avenue Q is what you get when people who watched Sesame Street as a kid grow up and are allowed to produce musicals; which is not a bad thing, mind you, it’s a great thing.

Having said how great it is, though, I must remind you that it is a rated “R” show. And despite the fact that show is about puppets, the kiddies should not be in attendance. Really.

But you should go and see it and I highly recommend it.

Photo credit: http://blog.dispatch.com/mgrossberg/musicals/

Barack Obama

I’m about a week late in blogging this, but such is the case when more important things arise. In any event, Obama was at the Colorado School of Mines last Tuesday. I managed to get four hours of sleep before I arose at the crack of 6am. I was on campus just before 7 and then proceeded to wait another hour and a half before we (the working press) were able to get in.

Kind of ridiculous if you ask me.

We finally did get in. I got setup and the waiting started. Several times, people would stand up and share some reason why they were going to vote for Obama and everyone would cheer and applaud. A woman, who I was told was part of the Avenue Q cast, also sang a beautiful rendition of the Star Spangled Banner.

The program finally got underway:
DSC_5270
Kyle Caskey, president of the CSM Young Democrats, lead the audience in the Pledge of Allegiance.

DSC_5285
Jacob Smith, Mayor of Golden.

DSC_5305
John Hickenlooper, Mayor of Denver.

DSC_5320
Bill Ritter, Governor of Colorado.

And then there was some waiting. We were running a little bit a head of schedule and Obama was running a little bit (well, 30 minutes actually) late.

DSC_5339
Federico Peña, former Mayor of Denver, filling the time.

Finally, the program got started:
DSC_5349
Peggy Roach, a local woman from Lakewood, has the pleasure of sharing her story and then introducing Senator Obama.

DSC_5373
Senator Barack Obama quites the crowd.

DSC_5411
Senator Barack Obama.

Don’t forget, there are always more pictures (and video) over at Flickr: Barack Obama at the Colorado School of Mines

Best guess is around 2300 spectators in attendence. Not terrible traffic. I had two classes canceled because of Obama and two more canceled because a professor missed his connection at JFK. Surprisingly, there were very few protesters.

See also: The Oredigger: Barack Obama at Mines

Ticket #9540124 is a Winner!

While the Colorado School of Mines isn’t sponsoring the event (as the Obama campaign paid for the use of the facility), Student Activities was able to get a hold of and raffle off 140 tickets to students this morning. On a whim, I put my name in the hat. And I won.

Ticket #9540124 is a winner!

But wait, didn’t you just write a scathing letter to the CSM president despising him for allowing this event to happen? you might ask.

I did. And I stand by that letter. However, when life gives me lemons, I try my damnedest to make lemonade. It’s an old cliché, but usually true. Tomorrow morning, I will be putting on my photography/press hat and taking pictures for the Oredigger, making the best of the circumstances.

It’s also worth nothing that a large part of my decision and ability to do this is the fact that my first class was canceled, which will help to alleviate some of the stress and anxiety of tomorrows hoopla. It’s still going to be crazy though.

An Open Letter to President Scoggins

Bill Scoggins, the President of the Colorado School of Mines, sent out the following email today:

Dear Mines Community:

I am pleased to report that Barack Obama’s campaign staff has rented Lockridge Arena in the Student Recreation Center for a community gathering, free and open to the public, on Tuesday, September 16. Doors will open at 7 a.m., and the program will begin at 9:30 a.m. We were in talks with the campaign for two days, and an agreement was reached Friday evening.

Since many national media representatives will cover the event, this is a tremendous opportunity to showcase our campus, students, faculty and staff–and the exciting work we’re doing here at Mines.

I am proud we were selected as the venue for this event, as it reflects our growing recognition as a leading, world-class research university. Tuesday’s event will increase our visibility even more. I am also proud that we were contacted by Senator McCain’s campaign staff earlier this summer. Although they chose another location for their event at that time, we welcome further inquiries from them about renting a facility at Mines. We should all be proud that our campus is a place where national policies are discussed.

Of course, an event such as this will cause some inconvenience to our Mines community. I feel it’s worth it and think you will agree. We expect 2,000 guests, plus media and VIPs, on Tuesday morning–with everything back to normal by noon. For those morning hours, however, you can expect parking to be a challenge. Please plan to walk, bike, carpool, and get an early start to campus that day. And plan to be patient.

I know many of you will want to attend the program. We have been given a limited number of tickets. This is not a Mines event–the Barack Obama campaign has rented space on our campus to host a public event. Information about the limited tickets provided to Mines will be announced via email later today or early tomorrow morning.

Together we will make this a positive, memorable event.

Thanks for your support,

Bill Scoggins

Initially, I was rather ecstatic to have a major political candidate on our campus. However, after reading Mr. Scoggins email and finally letting the reality of the situation set in, I realized this was bad. This was very bad. I’m going to vent in this open letter, because frankly, I don’t know what else to do.

Dear President Scoggins,

I do not agree with you. I think this event will cause quite a bit more than “some inconvenience to our Mines community.” And I do not feel it is worth it.

And lest you think that the rest of this letter is a rant from some Republican who just doesn’t want to see Mr. Obama on our campus, I can assure that this letter is not that (nor am I a Republican). My political standpoint has nothing to do with my frustration with your decision, nor should it.

I believe you showed an incredible lack of good judgment in bringing the Obama campaign to campus.

While you believe that this is “a tremendous opportunity to showcase our campus, students, faculty and staff – and the exciting work we’re doing here at Mines” and to tout us to the “many national media representatives [that] will cover the event,” I cannot fathom the horribleness that awaits me and my fellow students on Tuesday.

Are you completely blind to the amount of pressure and stress we’re under already? I have 19 credit hours with 10.5 hours of class on Tuesday, I’m going to have a freaking aneurysm.

We do not need the added stress of having to deal with the logistical issues associated with bringing the next potential President of the United States of America to our campus with less then two months until the election in a swing state. Secret Service, national media, local media, VIPs, the 2000+ people that will be flooding our campus. Need I continue?

Let me give you a picture of what I see: CSM is a school of about 3300 undergraduates. Now, for about 5 hours on a Tuesday morning, we’re going to instantaneously increase the number of people on campus by almost 60%. That’s 60% more cars, which we don’t have parking for and cannot handle. That’s 60% more people walking around campus. That’s 60% more commotion while I’m trying to freaking study!

Our school cannot simply absorb that many people and still function as a school!

Please tell me again how this is a good idea?

And then there’s the fact that all of this went down on a late Friday evening and not an official word about it until Sunday morning? Why was there such pisspoor communication? Why was the student body not consulted before hand? Should we expect more disruptions like this in the future?

I fear that making amends will be tough on this one. Yes, the ideal thing to do would be to cancel Tuesday’s event. But we both know that probably won’t happen. I honestly think the next best thing to do is cancel school for at least Tuesday morning and have classes resume around 1pm. While I’m not a fan of this solution, I believe it is the one that will cause the least amount of stress and disruption for all parties involved.

Cordially,

Andrew Ferguson