Bright Blogs
Duplicate menu entries in Drupal 7's admin_menu module
The Drupal 7 version of admin_menu isn't done yet, and once in a while you'll get an admin menu full of stupid duplicate links, like so:

Here's a sql query that will find and delete the offending duplicates for you (use at your own risk):
- DELETE FROM menu_links WHERE mlid IN (SELECT duped_ids.mlid FROM (SELECT max(mlid) AS mlid, menu_name, link_title, link_path, router_path, module, count(*) FROM menu_links GROUP BY menu_name, link_title, link_path, router_path HAVING count(*) > 1) AS duped_ids)
Toms Shoes needs to learn about internet security
Just ordered some shoes from Toms. Love the shoes, but was a little disconcerted to find the following email in my inbox:

I redacted what was there -- my plaintext password, sent in an email. Wat?
Especially disconcerting because I told the website to save my billing information.
Setting up email subscriptions and notifications in Drupal 7
Drupal Level: Beginner-Intermediate
Email notifications are the glitter of community sites: very few people passionately like them, but you'll never get rid of them. Probably the most typical use case on a Drupal site is to send an email notification to let a node's author know that someone's commented on their node. I just spent the good part of an afternoon setting this up on a Drupal 7 site, and thought I'd pass along some time saving tips.
Knowing Your Body and Practicing Safe CSS
This is a quick trick I picked up to guarantee that any css changes you make only affect what you want.
There are different ways to identify the page you need to change. I tend to use url as it's always unique.
Here's how:
Locate the template.php file for the theme your working on and add something like this to the page_preprocess function
- function your_theme_preprocess_page(&$vars) {
- // Add a custom body class for specifc page
- if ($_REQUEST['q'] == 'example/page/new-body-class') {
- $vars['body_classes'] .= ' custom-body-class-name ';
- }
IE Blew Up My Layout!!!
We've all experienced it, you've themed out a page and it looks fantastic in Firefox. Unfortunately the time has arrived for your IE testing... You've dreaded it the entire time and have put it off. You fire up your windows testing environment and your worst nightmare has come true. The entire layout is blown out. Divs are strewn about like your tpl.php ate a hand grenade.
Don't Repeat Yourself: Enterprise Data is Hard
I usually like what Ted Dziuba has to say but his rant, The Most Important Concept in Systems Design, missed the mark on a few points and ultimately misunderstands the problem on a fundamental level. Go read Ted's article if you haven't already, then we'll jump into some counterarguments and finally why the whole rant is misguided.
Ready?
1. Using Solr to Search a Database
db_affected_rows() is annoying
Given the following Drupal code:
and assuming that dummy_column doesn't exist in the users table, what is printed? Here's a hint from the php manual:
mysql_affected_rows()
Returns the number of affected rows on success, and -1 if the last query failed.
If you said "-1" like me, you're wrong (at least some of the time). The code above will return "1" if you have watchdog enabled.
On Taxes, Estates, and Natural Rights
This is a response I wrote on a message board that I didn't want to get lost in the ether. It describes my thoughts on estate taxes and wealth generally pretty well, I think.
First, the comment to which I'm replying:
No, your brand doesn't need an API
I just read Adam Klienberg's Mashable post, Why Every Brand Needs an Open API for Developers, and there was one good piece of advice in the whole thing: "Before you grab for that shiny object, ask yourself what you’re really trying to accomplish and how best to make that happen."
Readable emails from Outlook in Mail.app
Ever get emails from people using Outlook/Exchange and have to squint to see what it says when using mail.app? Close mail.app, hop over to the terminal and do this:
- defaults write com.apple.mail MinimumHTMLFontSize 13
Start up mail.app and boom, readable email.











