Categories: life » story

RSS - Atom - Subscribe via email

Drupal debugging story: Rules defined in multiple Features

Posted: - Modified: | drupal, geek, story

Fatal error: Unsupported operand types in …../patched/rules/rules/rules.module on line 347

That was the error message Daniel sent me when he asked for my help in debugging. After some digging, I found out that the rules had been defined in two features, so Drupal got thoroughly confused. After I commented out one of the implementations of hook_rules_defaults and deleted the relevant rows from rules_rules in the database, the site worked again.

Daniel wanted to know how I figured out that problem, so here’s the story.

The line number told me that rules_sort_children was having problems. I added a var_dump to it so that I could find out what kind of unexpected data was causing the errors.

if (!is_numeric($element[$key]['#weight'])) { 
  var_dump($key, $element[$key]['#weight']); 
}

The output showed that the regular rules were fine, but our custom rules weren’t – weight was an array instead of an integer.

I looked at the difference between the features in code and the features in the database. The rules were being duplicated. I tried updating the features to match the information in the database, but the code looked wrong, so I used git to stash the changes. I also tried reverting the features, but that didn’t solve the problem either. Time to dig deeper.

I backed up the database, then deleted our custom rules from rules_rules. Still problematic. I commented out the rule definitions in our site_structure.features.inc. The rules administration page now successfully displayed – but mysteriously, the rule definitions were still available.

I looked at the rule tags to see where else they might be defined, and found that another feature had included the rules. Aha! I commented those out. As expected, the rules disappeared from the administration page. I’d identified the problem: the rules had been defined in more than one module, which had thoroughly confused Drupal.

Because it made more sense to define the rules in our site_structure feature than in the other feature, I uncommented the site_sitestructure_rules_defaults definitions and left the other feature’s rules commented. That worked.

I tried restoring the rule customizations from the database, but that gave the same error. The database copy had multiple definitions, and I didn’t feel up to picking my way through the data or writing a Drush script to manipulate the rows. I re-deleted the customizations to get a clean copy. Just in case the other feature had more recent definitions of the rules, I compared the two. Aside from the extra tag, they were identical, so I didn’t need to copy any information over. It meant that Daniel would have to make his changes again, though.

Features: When it’s good, it’s very very good. When it’s bad, it results in quirky bugs. Make sure you don’t define your rulesets in multiple features. Drupal Features still has some rough spots when it comes to Rules. I remember when I created this feature with the rules in it – it created duplicate rules, so I needed to delete the old ones. Still, it’s a great way to export rules and other configuration changes to code, even though it takes some getting used to (and the occasional bit of database-diving).

Anyway, that’s the story of how I identified that issue and worked around it.

When you’re faced with a fatal error involving unsupported operand types, figure out what kind of operands it expects and print out anything that doesn’t match. Then you can start figuring out the real problem, which is how that data got in there in the first place. I’ve used this to find form elements that were mistakenly defined, array elements that were unexpectedly null, and so on. Don’t be afraid to add debugging code to core or contributed modules, particularly if you can use source code control to restore a clean copy. If you use a runtime debugger like XDebug, you can easily explore the data and the call stack. If not, there’s always var_dump.

Hope that helps!

Imagine success for social media

| blogging, connecting, kaizen, story, web2.0, writing

I was talking to an independent consultant who wanted to get better at using social media to expand his network. I suggested that he put together articles and presentations that he can share with his contacts (mostly executives) that are useful and that they would probably share with the right people in their companies.

Thinking about this, I realized that imagining the ideal scenarios can help people recognize the value of investing in sharing knowledge or building a social media presence. You can say that sharing is important, or you can imagine a story that goes like this:


CEO of small business: Oh! It’s an e-mail from __. He always sends me useful information, so I’ll take a look at this one. Hmm, this whitepaper looks like something our company could learn from. Let me send it to the director in charge of that.

Director: Hmm, an e-mail from the VP, I better read it. Ah, an article that looks like it will help with one of the challenges I’m currently working on. Hey, this guy has some great tips. I wonder… Oh, he has a website with other articles and presentations! Great. I’m going to flip through the presentations that look immediately useful. I should probably bookmark this site so I can come back to it later. Hey, he’s on Twitter. Let me check out what he posts… He’s got an upcoming seminar – that looks interesting, maybe I’ll attend. I think I’ll follow him on Twitter so that I can hear about other updates. Hmm, maybe he can do some consulting for us for this project – that would save me a lot of time, help me get the results I need… (and if he’s as good as he seems to be, I’ll look like a star).

Someone else searching on the Net: Hmm, I need to learn more about ___ if I’m going to be able to deliver those results. Oh, here’s an article that might be useful. Those are good points. Let me save this. I wonder… ah, he has other articles and presentations. Those are useful too. Let me read them… I wonder if he’s available to do some consulting. Oh, look, he’s in Toronto too. That makes it easier. I should give him a call.


Think about what success looks like. Tell yourself a story about what could happen. It’s probably less about just increasing the number of your followers or posting at least one blog post a week, and more about actions and results. What’s that story? Walk through it in your head, check if it’s plausible, and identify the pieces you need to build in order to make it happen. Doesn’t investing in those pieces make more sense now that you can see how they’re related to your end goals?

That led me to think about the ideal stories I tell myself. When I write for my blog, this is what I hope will happen:


Me: “Ah! Now I understand things a little better. Let me go try that and see what happens. … Yup, that works, and here’s how I can make it even better.”

Someone: “I need to figure out something. Let me search… Hmm, that look interesting, let me try that. Hey, that works. Oh, that looks useful too. And that one! And that one! I’m going to add this to my feed reader. … Oh look, another post from Sacha. She reminds me that it’s possible to be cheerful and have fun doing awesome things. =) Hmm, I know someone who might find this useful too…”

Someone: “Can you help me with __?” Me: “I could’ve sworn I’ve written about that around here… Ah, there it is! Here’s the link.” Someone: “Awesome. Thanks!”


What are the stories you imagine, and what do those stories help you learn about what you can do to make them happen?

The story of the shoes at our wedding; also, wedding pictures

Posted: - Modified: | life, story

Here are some of the wedding pictures:

Wedding pictures

People found the shoes we wore remarkable, so let me tell the story for all the people who weren't there.

W- had formal shoes from the time we attended a wedding in the Philippines. I had cream flat shoes that went well with the dress. But J- didn't have any formal shoes that fit. She had grown size-7 feet while we weren't looking.

Time to shop for shoes. On a good day, it's hard to find a simple, flat, dressy-but-not-too-formal style. In the weeks before a wedding (and as retailers replace their summer flats with fall boots), it's even harder.

We must've checked five or six stores before we found a shoe that fit well, had a low heel, and would go well with a dress. The shoe was too dressy for school, though. W- said, “I'm not paying that much for shoes that she's only going to wear for an hour.” The man I married is as frugal as I am.

We joked about the Chuck Taylors we'd seen in Aldo. It was pink plaid. W- looked at me. “What about the Chucks? She can pull off the look,” he said. “We can wear whatever we want,” I said. “We're not optimizing just for photographs.”

J- lit up. Sold!

We headed back to Aldo's. For fun and family solidarity, W- and I picked out our own Chuck Taylors too. I chose a gray plaid, and he chose a bright red.

J- wore her Chucks to the wedding, while W- and I brought ours in a bag. After the wedding ceremony, we changed into our Chucks and had fun.

So that's the story of the shoes. They're about choosing everyday life over stereotypical expectations, the cultivation of in-jokes, and the serious fun of love.

Circuses, pots, and cathedrals: three key stories

| passion, reflection, story

There are three stories I refer to again and again: taking the first circus, making more pots, and building a cathedral. They form part of my approach to life.

Taking the first circus

My parents told the story of the first circus to us when we were growing up. On her blog, she wrote:

It came from an anecdote that my husband and I read in the Readers’ Digest about a little girl in a town soon to be visited by three circuses. Her father explained to her that the family was not financially able to take her to all three circuses and could take her only to one. The first circus would be just a small one, while the third would be the best and biggest, and presumably the most expensive. “I’ll take the first circus,” she said, and so her parents took her to the first. A few months later, when the second circus came, the family’s finances had improved and they were able to take her to the second. And finally, they found that they could afford to get tickets to the third and most expensive circus.

Harvey Chua, I’ll take the first circus

The story of taking the first circus reminds me to take opportunities when they come up. I tend to be conservative and frugal, but I’m also good at figuring out when it’s time to take that leap.

Making more pots

In a previous blog post, I wrote:

There’s a story about a pottery teacher who divided the class into two groups. A student in one group would be graded based on the quality of one pot that they turned in at the end of the semester, while a student in the other group would be graded based on the sheer number of all the pots submitted throughout the semester. At the end of the semester, students in the second group–those measured only on quantity–had produced better pots than those who had focused on quality. In the process of creating a large number of pots, the second group had learned from their mistakes, while the first group had been paralyzed by endless theorizing about what a perfect pot would be.

Me, Of sewing more dresses and making more pots

I use the pot-making story a lot. For example, when I struggled with writing, the pot-making story reminded me to just get something out there. The pot-story reminds me that even mistakes help you move towards mastery.

Building a cathedral

Several builders were on a construction site. A visitor asked the first worker what he was doing. The first builder replied, “I’m laying bricks.” The visitor asked the second, who replied, “I’m building a wall.” The visitor asked the third, who proudly answered, “I’m building a cathedral.”

The cathedral story reminds me of the power of vision. Good vision can turn any work into a joy. The lack of vision can make even the most talented lost.

The story also tells me that vision can be created by anyone. Even though I’m a recent hire, I have a strong vision for what I want to help the company and the world become, and I have a strong vision for myself and who I want to grow into.

Circuses, pots, and cathedrals – shorthand for how I live. What are your key stories?

Thanks to Paul for the nudge to write about this!

How not to propose marriage

Posted: - Modified: | life, love, story

More correctly: How to not propose marriage

During the formal meeting of the two sets of parents, my mom asked us to tell the story of the engagement. W- and I looked at each other, puzzled. Fortunately, our videoconference ran into some technical problems, and we took advantage of the break to formalize the proposal. He asked me to marry him, and I said yes. Tada!

What? No dramatic tension? No wondering about what’s next? No getting down on one knee and not knowing what the answer is?

The most Hollywood-uncertain moment we’ve had was at the start of the relationship. We had just watched Rigoletto, and we were talking about how reading the libretto with English translations had helped us recognize some words during the opera. “You can call me buffone,” he said. “Or even buffone mio.”

His last word couldn’t have been accidental, knowing the delight we take in the subtleties of words. We had been good friends for a while, and I was resolutely ignoring a crush on him. In a movie, this would have been the point at which soaring music would play, we’d kiss, and then credits would roll.

None of that happened. Instead, I blinked a few times and babbled, preoccupied with figuring things out. Later that evening, when I was alone again, I mindmapped what I wanted to say and wrote him a letter to clarify what he meant. On gridded paper, too, as that was all I had. The next day, I read his reply confirming his feelings. So that’s how our formal relationship began.

Since then, we’ve had many, many conversations, which gradually included longer-term plans. Marriage isn’t so much a big change as it is a useful formalization of our plans and a commitment to work things out together. I might have even started the process by bringing up long-term thoughts. Technically, I guess that means I proposed to him, but it was less of a “Will you marry me?” and more of an “Okay, let’s look at where we want to go with this. If we want to do B, we should probably do A first.”

No fancy engagement story. No engagement ring, either. (I think diamonds are overpriced and there are better ways to use that money, such as saving for long-term goals.)

The difference between “Will you marry me?” and “So, when do you think we should get married?” is fascinating. I love how our conversations grew into the second question rather than the first.

So that’s how it happened!

(Reflecting on it now, I remember those lessons on assuming the sale: instead of asking people if they want to buy something, ask questions like if they prefer to pay cash or use their credit card… ;) )

Twitter, Whuffie, and Amazing Connections

| story, web2.0

Thanks to Don Marti’s post about a possible business model for Twitter, I came across Tara Hunt’s post about Twitter, whuffie (reputation), and the amazing power of connection. In her blog post, she tells the story of how disappointed she was when she was waiting for UPS delivery (which didn’t come during the delivery window specified), how another friend of hers helped connect with someone in UPS, and how the ending wasn’t just happy, it was spectacular. What I like about her post is that she describes the background story and the timeline, showing how one thing leads to another.

Check it out. See, Twitter can be awesome. =)

Storytelling in presentations

| communication, presentation, speaking, story

Angelina Gan asked me if my storytelling approach is based on Peter Orton’s (wonderful!) presentation on using storytelling in business, so I thought I’d share how I started telling stories and what my favorite resources are.

I don’t know exactly why I started telling stories instead of listing bullet points. Maybe it was because of the never-ending march of bullet-ridden presentations. Maybe it was because I kept skimming through business books that were all numbers or pithy sayings without anecdotes to make those statements come alive. Maybe it was because I watched terrific presentations highlighted on the Presentation Zen blog. Maybe it was because of the books I read about telling success stories to deepen your relationships with people, influencing change through story-telling, and telling effective stories. Whatever it was, I started collecting stories and sharing my own.

I’d taken up writing flash fiction (really short stories, typically 55 words long) in 2005, and that turned out to be surprisingly useful. Reading other people’s flash fiction stories taught me that you could tell a story with conflict and character development in a paragraph or two, and that it was fun keeping an eye out for story material. I had originally gotten interested in flash fiction because it felt like a code optimization challenge, and because the stories were short enough for me to write during lunch or a subway ride, on pieces of paper or even on my cellphone. I never felt particularly literary (and in fact had gotten Ds in my English classes in university for lack of effort), but finding and telling stories (or in this case, making them up!) turned out to be a lot of fun.

So when I came across the business applications of storytelling–from social networking to influencing technology adoption–and I saw how it dovetailed with my passions, I jumped right into it. I started collecting stories. For example, I started my master’s research by collecting stories about how people used Dogear (an enterprise social bookmarking system by IBM) so that I could figure out how people were using it in their work and how they could use it even more effectively. I collected stories to help me not only convince people to try out new tools but also give them models to follow and people they could relate to. I also told stories about what I was doing and how I was doing it, and that helped me get to know a lot of people as well. Besides, I love “catching other people doing well”–telling other people’s success stories, especially when they don’t realize they’re doing well.

The results? People act on what I share. They make my stories their own. Not only that, people also tell me that they enjoy my presentations and that my enthusiasm is contagious. Giving presentations – telling stories, having conversations – has become a lot more fun.

How do I find stories? I keep an eye out for things that happen in real life, like this conversation I had with J-. There’s a seed of a story in there, and by telling part of the story, I make it easier to remember later on. I also enjoy reading people’s blogs, because they tell stories from their experiences as well. I read a lot – it certainly helps to have a public library within walking distance. Whenever I come across a particularly good story in any of these sources, I write it down, I bookmark it, I add it to my notes. When I work on presentations, I’ve got a general idea of relevant stories that I’ve come across, and then I use my notes to look up the details.

For example, I was preparing a presentation about University Relations and the Net generation. I didn’t want it to be a boring list of bullet points or advice. I could’ve rehashed the presentation I gave at the Technical Leadership Exchange, but I wanted to make the most of my opportunity to speak with a group that could really make the most of Web 2.0. I remembered that some months ago, I had come across a terrific internal blog post about how a demonstration of IBM’s internal social tools got an audience of university students really interested. I had bookmarked it as a story about Web 2.0 and recruiting, knowing that it would be useful someday. Well, that someday had come! I checked my bookmarks, went back to the blog post, refreshed my memory, and added it to my presentation. I’m sure that the story will make my point more effectively than a list of bullet points.

How can you get started with storytelling? Keep an eye out for story material. Develop a system for filing those stories so that you can find them again when you need them. Tell stories. I’ve linked to some of my favorite books in this post – check them out for more tips. Storytelling is effective and fun. Enjoy!