WordPress Logo

I wrote this plugin because there was no easy way to define a first and last class to the list of pages generated in WordPress with wp_list_pages. These classes are useful for tweaking the visual formatting of the page list with CSS.

I’ve tested this with WordPress 2.2 and it should behave nicely with other plugins as well as earlier versions. Though let me know if you find something buggy.

As always, I am not responsible if this plugin blows up your computer.

WHY WOULD I WANT THIS?

Let’s say you want to create a horizontal list of your pages in the footer of your page with pipes separating the page links.

The css might look something like this:

#footer ul {
	list-style-type: none; 
	margin-left: 0px;
	padding-left: 0px;
}
#footer li {
	float: left;
	padding: 0px;
	margin: 0px;
}
#footer li a
{
	border-right: 1px solid #CCC;
	display: block;
	padding-top: 0px;
	padding-left: 10px;
	padding-right: 10px;
	text-align: center;
}

The border-right applied to the link css sets a gray ‘pipe’ that separates out the page links.

The code in your WordPress theme file ‘footer.php’ might look like this:

<div id="footer">
	<ul>
		<?php wp_list_pages('sort_column=menu_order&title_li='); ?>
	</ul>
</div>

So right now this would output in the browser as:

List Pages Plugin Before

See that last pipe following “Contact”? We don’t want that.

But since we now have a separate class for that last list item, we can add this to the css, which will remove that last ‘pipe’:

#footer .last_item a
{	
	border-right: none;
}

And now our list of pages in the footer will look like this:

List pages with correct css applied

HOW DO I INSTALL IT?

View/Download the plugin file and place it in your /wordpress/wp-content/plugins/ folder. Then activate the plugin from your WordPress control panel.

HOW DO I USE THE PLUGIN?

When activated, the plugin will automatically apply the class “first_item” to the first li (for the first page) as well as the class “last_item” to the last li (for the last page) in the list that is generated with wp_list_pages.

Recently an OKPublic server was experiencing fairly sporadic bouts of extreme CPU loads (upwards of 80!) every 6 to 12 hours or so. It was severely limiting the web server. As I was monitoring the running processes, I witnessed several of these bouts and noticed that MySQL processes were spawned repeatedly and in great number; about 3-5 new processes per second.

So I initially thought that these processes were the result of a popular account on the server, but digging through Apache domain logs, there didn’t seem to be any that corresponded with the timing of these events.

Also, looking at the time that processes had been alived, I noticed that the new processes weren’t knew at all as some were 30 minutes to 3 hours old, so they were actually just coming out of sleeping.

Reading guides about MySQL optimization on the web, the wait_timeout variable stood out to me as it represents the amount of time that MySQL will wait before killing an idle connection. What really shocked me was that the default wait_timeout variable is 28800 seconds, of 8 hours. Why would anyone want to keep idle MySQL connections alive for 8 hours?

So I changed the setting to 300 seconds (which is still probably more than necessary) and we haven’t experienced the problem since.

The only reason a wait_timeout as high as the default (28800) may make sense would be if there are lot of reoccurring visitors (or connections to the database through other means) and that the applications handling the connections are optimized for persistent connections, which most aren’t.

So the wait_timeout being set so high doesn’t act as a cache, but more of a pool of dead connections. And when MySQL goes into kill mode to wipe the idle connections clean (I’m not sure about the technicalities of this), it seems that the pool can become so large that it takes a lot of CPU usage and RAM to do it all at the same time.

It seems that a better way to save resources through MySQL configuration is to setup a thread_cache and/or query_cache.

Chrysler TC by Maserati

This is a rare 1989 Chrysler TC convertible by Maserati in Royal Cabernet that runs good. Running, registered, and insured. Good tires. Only 7,301 were built between 1989 and 1991 Model Years. This two-seater has a Chrysler drivetrain with a body and interior by Maserati. It has an economical 2.2 liter Turbo II engine with automatic transmission and front wheel drive. This car features a removable hard top and manual soft top. I have a brand new, in-the-box, A.A. Best soft top with a glass rear window which goes with the car (approximately a $500 value). The breaks work but the ABS doesn’t. The odometer stopped at 53,083 miles so true mileage unknown *. Window molding on passenger door could be replaced (shown in photo below). Sold as is.The car is currently in CT but would be able to deliver it to the Greater Boston area for fair fee.Please call Joe at (860) 707-4970 for more information.Recent Mechanical Work:

  • Replaced the fuel lines.
  • Repaired power seat switches.
  • Added thick plastic headlight protectors.
  • AC was converted to EPA acceptable “Freeze 12″ refrigerant on 3/25/2003

Vehicle History (according to AutoCheck.com)
There are no accidents or any kind of negative occurences in this vehicle’s history report. As described in the vehicle report, this TC was a former Texas car and is shown in the report to be registered in Texas from 1994 to 2004. The registration was renewed and the vehicle passed emissions inspections in Texas every year from 1997-2004. The car was driven only 3,478 miles between 4/16/1994 and 3/22/2003. I aquired the vehicle in August, 2005. The vehicle passed the Connecticut Emissions on 9/21/2005 and is good through 9/21/2007. The car has been driven occasionally since I obtained it, putting on no more than a couple thousand miles in my estimation.

*Regarding the Odometer
The vehicle report shows that the odometer reading from 3/22/2003 was 52,998 miles. Then, for it’s successful emissions inspection on 4/21/2004, the odometer reading was 53,083. So the odometer probably stopped functioning sometime between 2003 and 2004.

Included Accessories:

  • Leatherique Leather Care Products.
  • Dashmart dash protector (shown in photos below).
  • A.A. Best soft top with a glass rear window.

Please click on the images below to view larger versions.

Chrysler TC by Maserati
Chrysler TC by Maserati
Chrysler TC by Maserati
Chrysler TC by Maserati
Chrysler TC by Maserati Chrysler TC by Maserati
   

Here is a good resource to learn more about the background of the TC car.

OK Robot

August 14th, 2006

Robo Ebay

A neat tin Robot toy from the 50’s I found on Ebay.

C and I spent this sunny sunday (well, about an hour an half) today at Franklin Park Zoo in Dorchester. Bangos and pygmy falcons and tree kangaroos oh my!

We stopped at 7-11 and the Taco Bell/KFC hybrid joint for a kryponite-flavored slurpy, 2 taco patty pockets and a jumbo helping of steak fries for energy following our Saturday night of intensive and semi-delusional scrabble playing and we were off to the zoo!

Here are some photos from the zoo:

Catfaced Christina
C looking much like our cat Munchkin.

Eliot at Franklin Park Zoo
Me on the lookout for tigers (I had all these Jurassic Park-type paranoias starting in the Tiger Tales sector).

Franklin Park Zoo Lion
The King of the Jungle as seen through 2 inches of reinforced plexiglass.

Warthogs Franklin Park Zoo
Ah, warthogs on a lazy Sunday.

Franklin Park Zoo Pygmy Falcon
Pygmy Falcon - The smallest bird of prey (about the saze of a parakeet).

Franklin Park Zoo Lemur
The Ring-Tailed Lemur exhibit was closed, but we snapped this pic for Art (I wonder what the zoo did with the Lemurs when they closed the exhibit…).

franklin-park-cande.JPG
C and I pose with the Kaola.

Franklin Park Zoo Gorilla
The alpha male of the gorillas.

Gorilla Franklin Park Zoo
Neworn gorilla. The gorillas was definitely the #1 motivating factor for bringing us to the zoo.

Franklin Park Zoo Gorilla
Here’s the last gorilla we saw before leaving the tropical sanctuary at the zoo. Shortly after C snapped this photo, she yelled out to the gorilla, “Hi there monkeyface!” I was a bit miffed as I thought it was somewhat disrespectful to our close evolutionary relatives and ordered her to call him by his name if she was going to shout out to him. In retrospect, I think that she had to yell out in that manner in order to mark the absurdity of the situation: Standing among shouting human munchkins and pseudo nature buffs (and of course some people that were probably thinking the same thing as we were), thinking that we could connect to these particular caged animals because of our similarities rather than a necessary and carefully grown relationship. Reminded me of the Grizzly Man.

Eliot and Dippin Dots
Me after getting a cup of Banana Split-flavored Dippin’ Dots Ice Cream - the Ice Cream of the Future. The best part of it was the woman who served it to me - she had this big smile and she sang along with the radio as she scooped. The ice cream was aiight.

Currently Reading:

Linked - The New Science of NetworksLinked: The New Science of Networks

Information, disease, knowledge and just about everything else is disseminated through a complex series of networks made up of interconnected hubs, argues University of Notre Dame physics professor Barabasi. These networks are replicated in every facet of human life: “There is a path between any two neurons in our brain, between any two companies in the world, between any two chemicals in our body. Nothing is excluded from this highly interconnected web of life.” In accessible prose, Barabasi guides readers through the mathematical foundation of these networks. He shows how they operate on the Power Law, the notion that “a few large events carry most of the action.” The Web, for example, is “dominated by a few very highly connected nodes, or hubs… such as Yahoo! or Amazon.com.” Barabasi notes that “the fittest node will inevitably grow to become the biggest hub.” The elegance and efficiency of these structures also makes them easy to infiltrate and sabotage; Barabasi looks at modern society’s vulnerability to terrorism, and at the networks formed by terrorist groups themselves. The book also gives readers a historical overview on the study of networks, which goes back to 18th-century Swiss mathematician Leonhard Euler and includes the well-known “six degrees phenomenon” developed in 1967 by sociology professor Stanley Milgram. The book may remind readers of Steven Johnson’s Emergence and with its emphasis on the mathematical underpinnings of social behavior Malcolm Gladwell’s The Tipping Point (which Barabasi discusses); those who haven’t yet had their fill of this new subgenre should be interested in Barabasi’s lively and ambitious account.

I was rummaging through a massive stack of unlabeled CD’s a couple nights ago and came across an audio track of a song that my friend Chris Wetzel and I had wrote and recorded circa 1999.

Chris did the music and I was mixmaster, which involved an analog casette 4-track. We both helped with the lyrics (funny and sweet in retrospect).

How Tysabri Works

June 25th, 2006

I came across a description of how the new Multiple Sclerosis drug Tysabri works while reading Debra Niehoff’s book The Language of Life. Niehoff uses a very well-composed description of Tysabri to exemplify the process of biochemical communication as well as a real-world consequence of manipulating our cellular social world. Here it is in full:

Axons, like wires, conduct electricity more effectively if they’re surrounded with a layer of insulation. To that end, many nerves are enveloped by supporting cells known as Schwann cells (in the peripheral nervous system) or oligodendrocytes (in the central nervous system), which wrap themselves around the nerve to create a layer of insulating material called myelin. Myelin contains both lipids and proteins, the best known of which are myelin proteolipid protein, mylein-oligodendrocyte gylcoprotein, and a complex of seven closely related proteins known collectively as myelin basic protein.

Read the rest of this entry »

Mom Dad and Choco

I was googling around looking for info about changing the default image upload directory as well as the reason why the WordPress developers removed this once inherit feature. I didn’t find much.

I just hacked the config file (wp-config.php) to define the uploads directory by adding this line of code:

define('UPLOADS','images');

Th admin function that executes the upload looks for this definition at line 840 of the wp-includes/functions-post.php file.

You can insert whatever directory you’d like to use for images in place of ‘images’ in the code above starting of course from the root directory where WordPress is displayed.

I also stumbled upon this plugin that restores the WordPress 1.5+ upload options in the admin area:

Seems like it would have been beneficial to keep those options in tact since many many WP users are going to be upgrading. I’m sure that in a good number of cases, users will have setup a different images directory because of the use of WYSIWYG plugins or otherwise.

I’m definately loving the ability to resize the editing box, though.

Crunching and Launching

December 20th, 2005

Oooieee. I’m psyched to wrap something up, and something that I’ve been excited to work on (with the typical downtime in this particularly dark era of the year).

Loving the progress and completion that’s been happening recently - C gave 120% so kindly and generously to the seasonal cause of good will toward all. And got a 5 spot in return. But that’s what makes her so awesome.

Ars so generously cured me of my automotive woes for the time being, donating her downtime to my uptime.

Art and I laid down a girthy amount of audio as well as a sound way to go head-to-head with time.

Mas sent up a shipment of warm and soft goods. I can’t thank her enough for everything.

Off to Market Basket for Talapia and such.