One way to unemerge lots of unneeded packages on Gentoo Linux

As part of a recent project, I had installed a lot of packages on a separate machine to test my configuration. As is common, with Gentoo, you want to run the following before you actually emerge anything:
emerge -p <package_name>
In this particular case, I noticed the dependency list was pretty long (50 packages to be exact). Instead of going ahead with the emerge, I first recorded the package list to a file for later reference:
emerge -p <package_name> --nospinner > dep.list
Now that I’m done with the project, I can clean up the packages I no longer need like this:
emerge -aC `cat dep.list | grep 'ebuild N' | cut -d ' ' -f 8`
Notice the grep. That is because a couple of the packages were simply upgraded and I don’t know that they aren’t needed. After a quick scan of the resulting list to see what is going to be uninstalled, I let emerge do the rest of the work.

Walla, no more 50 extra packages on that machine.

The Pix xlate command

I’ve recently had cause to change a couple static routings on our Pix 501 Firewall. I’ve done this in the past, but each time, it has resulted in a period of time where the new static mapping doesn’t take effect. Thanks to Jake on the PLUG Mailing list for pointing out to me the xlate command and usage here.

All you need to do is:
clear xlate

EDIT: Derek (same mailing list) suggests the following in order to only clear the one address, so that all the other existing customers are not interrupted.
clear xlate local <e.f.g.h>

Using Linux-HA for High Availability with Gentoo and Linux-VServer

In my production setup, I don’t have a load balancer. This may be changed at some point, assuming that we can find one we like for the price we want to purchase it for, but in the mean time, I’ve been inspired to set up a virtual IP address across two machines that each can load balance between my real servers. Inspiration for this project came from this article. I’ll be using Linux-HA to manage the virtual ip address with heartbeat.

Continue reading “Using Linux-HA for High Availability with Gentoo and Linux-VServer”

My New Bookmark Widget

Ok, I found a widget that could replace the bookmark widget by simply allowing a customizable interface to the wp_list_bookmarks function. This is a highly customizable function that not only lets you grab all the bookmarks, but allows customization of how they are displayed. The widget gives you an interface that lets you change parameters to the function without having to modify the template.

My 1st attempt at using the widget didn’t work. After examining the HTML, I realized that there were a few tags I needed to not leave at the default. I got the links to work how I want making the following modification in my functions file of the theme I’m using.

function widget_mytheme_blogroll() {
?>
-<h3>Blogroll</h3>
- <ul>
- <?php get_links(-1, '<li>', '</li>', ' - '); ?>
- <?php
+ wp_list_bookmarks('title_before=<h3>&title_after=</h3>&category_before=&category_after=');
- </ul>
-<? php
} ?>

This gave me the category tree and also changed the titles of the categories to be in the same format that the rest of the template was in.

Now that I’d figured out which parameters were of importance to me, I gave the link widget another go. I found that the reason I was having problems is that the category_before and category_after parameters are always displaying <li>,</li> respectively instead of my desired blank setting. I tried spaces, &nbsp; and even random strings. Nothing seemed to work so I went back to my hacked template function instead. Oh well, I guess I can hack additional themes not that I’ve got the basics of what I want down. It’d be nice to get that working in the widget though.

WordPress and Caching

I just installed the plugin wp-cache. I’m not sure why more WordPress users don’t enable this. From the Wp-Cache description:

WP-Cache is an extremely efficient WordPress page caching system to make you site much faster and responsive. It works by caching Worpress pages and storing them in a static file for serving future requests directly from the file rather than loading and compiling the whole PHP code and the building the page from the database. WP-Cache allows to serve hundred of times more pages per second, and to reduce the response time from several tenths of seconds to less than a millisecond.

I don’t know how many times I’ve gone to a link on Digg.com and found an unusable site with mysql database connect errors, or simply a crashed web server. The comments always say “Another WordPress Blog”.

The problem isn’t WordPress specifically. Any site with a database backend for storage could have the same issues. The problem is that WordPress doesn’t cache pages by default. Any site serving static content with Apache as a front end should be able to handle digg traffic for a while assuming that they enough memory, bandwidth, and the apache directive “MaxClients” set high enough. Well, WP-Cache turns your dynamic WordPress installation into static pages and only regenerates them when they change.

We were marveling at the efficiency of this all when Scott’s Site was dugg twice on the same day.

Categories vs Tags

I found a couple plugins that make the tag and category features function the way I’d like.

  • Simple Tagging
    This plugin allows each post to have an associated set of tags. This enables a clean category system while still being able to show the subjects that each post talks about.
  • Simple Tagging Widget
    This widget Enables a cloud view of the tags in the sidebar.