March 25, 2009

Bulk view

Drupal in the Trenches: Fighting with Views

The other developers have bought into the idea that all behavior-related changes should be in the source code. It’s the only thing keeping us sane with four developers and three environments: local, testing, and production. It has its own challenges, though, like this one:

Problem: Blocks based on views with dependencies on custom tables sometimes don’t show up when we refreshed from the database dump, although things work if we update the database one revision at a time.

After far too much pain and suffering, I figured out that _views_get_default_views was caching the results. When it checked our newly-enabled modules for default views, it found some views whose dependencies hadn’t gotten enabled yet, so it didn’t cache those. The next time _views_get_default_views was called, it used the values it had stored in a static variable available only in that function.

_views_get_default_views did not provide a way to reset that static variable, so once it was called, the data was practically written in stone.

_views_get_tables is similarly evil. (ARGH!)

This might’ve been fixed in a Views update (and we’re still using Drupal 5, in any case), but I’m not going to suggest updating the module this close to external acceptance testing.

So our options were:

  • Make sure _block_rehash and similar functions never get called before the update function that enables the module. Problems: Not only do we need to untangle the order of update functions that get called and be hyper-aware of what other modules do, but we’ll also need to change old update functions if we ever need to do this for another view in the future.
  • Hack _views_get_default_views and _views_get_tables to accept an optional parameter that resets the static variable.

When there are no clean alternatives, you just gotta get your fingers dirty and hack code.

Was that really only one hour of my life? It felt so much longer.

Drupal gotchas: Never ever ever use anything less than module AND delta to specify blocks

One of the common mistakes I run into is people not specifying enough information when deleting or updating entries in the {blocks} table. You should always use module AND delta to identify the block you’re working with. Delta by itself is not enough, and title is right out.

I learned this the hard way when my blocks suddenly started failing. I jumped back to the last known-good revision, and then stepped forward. All the update functions ran okay, one after the other. When I ran all the update functions after a database refresh, though, things failed. It turned out that another developer had changed the title of a block to a blank string, but left a db_query(“DELETE FROM {blocks} WHERE title=’%s’, $title”); in the function. And since it was called fairly early in our update cycle, it didn’t turn up during the incremental updates from my known-good database.

That took me about 45 minutes to find and fix. Thank goodness for tests and version control!

LESSON: Never ever ever use anything less than module AND delta to specify blocks.

Upcoming Web 2.0 Conferences

Web 2.0 Expo – SF
March 31 to April 3, 2009 (Schedule)
San Francisco, CA
Conference plus workshops: $1745 before March 30, $1945 on site
Conference only: $1445 before March 30, $1645 on site
Workshops only: $845 before March 30, $1045 on site
Expo hall plus: $350 before March 30, $395 on site (includes two sessions, sponsored sessions, and all keynotes)
Expo hall only: $100 before March 30, $100 on site

Mesh Conference
April 7 to 8, 2009 (Schedule)
Registration: CAD 492.50

Enterprise 2.0 Conf
June 22 to 25, 2009 (Schedule)
Boston, MA

Early Rate
Reg Open to 5/22
Standard Rate
5/23 – 6/21
Onsite Rate
6/22-6/25
Full Conference Pass
$1,995.00 $2,195.00 $2,395.00
3-Day Conference Pass
$1,695.00 $1,895.00 $2,095.00
Workshops Package
$595.00 $595.00 $595.00
Pavilion Pass
$100.00 $100.00 $100.00
Pavilion Pass + Evening in the Cloud
$195.00 $195.00 $195.00

Web 2.0 Summit
October 20 to 22, 2009
San Francisco, CA
By invitation only


I’ll be moderating a panel on education at Mesh, and probably skipping the other conferences. I’m all for virtual conferences and blog interactions, though!

Ada Lovelace Day linkfest and wrapup

Here’s a quick wrap-up of some posts from Ada Lovelace Day:

Linda Rodriguez wrote about how Ada Lovelace Day came to be, and paradox1x suggested some good reads.

Mellystu wrote about her 4-year-old daughter (who’s using UNIX!), David Parmet wrote about his two daughters. Jennifer Hanen wrote about her mom’s cousin working for NASA.

Speaking of classified work: Zach Copley wrote about Women Accepted for Volunteer Emergency Service (WAVES).

Sharon celebrated Terri’s contribution at linux.conf.au, and Peter wrote about a Sydney IT evangelist. Lisa Damast listed six women shaping the Israeli technology industry. Red Bean wrote about a cryptographic researcher in China.

Leah Culver wrote about Valerie Aurora (among others), who wrote about being encouraged by the fact that there are female kernel programmers like Pauline Middlelink. Karen Quinn Fung (one of my inspirations!) wrote about Leigh Honeywell (also one of my inspirations!), who salutes the Ubuntu Women.

Julia Roy listed a number of social media geeks who have touched her life, and Jasmin Tragas wrote about a nonprofit social media consultant. Gabe Wachob wrote about a lawyer who focuses on the public interest. Jerry wrote about a number of thought leaders he admires.

SusanT wrote about the teachers in her personal learning network, and Janet Clarey lists a number of edubloggers.

And a shout-out goes to Tania Samsonova who included me in her list, along with lots of inspiring people including her mother-in-law (who keeps trying to teach Tania’s boys assembler… over the phone… in Russian…), Joey de Villa who included me in his list of Toronto tech women, RTFVerterra who likes my Drupal posts, and Clair Ching (another one of my friends! =) ), who shared some tidbits from our adventures. (Remember the random Japanese cat phrase? ;) )

… and if you want a huge list, check out The Ada Lovelace Day Collection – 1091 posts and counting!

Helping my parents learn more about Internet and business; any tips?

Last Sunday, my mom and I were talking about other businesses that she and my dad could explore. She’d recently attended a talk by a 15-year-old who said that the best product to sell these days is information.

My mom knows a lot of things. She knows a lot about building and managing a successful photography business. She knows a lot about gifted education and parenting. She knows a lot about making big dreams happen, because she’s helped my dad with so many adventures. She knows about personal finance, success, entrepreneurship, and many other topics.

My mom occasionally gives talks, and she’s planning to teach the business of photography as a course at a local university. If she could package some of her insights, experiences, and stories into e-books and blog posts, I think she can create a lot of value for people. And maybe my dad will get into the act too, with photographs and anecdotes and advice.

The 4-Hour Work Week and other books that mention selling products or information online suggest using a tool like Google Adwords Keywords to study the market before investing time and effort into developing products. While looking into more information that could help my mom learn more about e-books, I thought I might do some preliminary market research. Out of hundreds of phrases suggested by the tool, I picked 19 that looked relevant, and 2 phrases that stood out because they combined okay search volume (a few thousand searches last month) with low advertiser competition. I sent the spreadsheet to my mom.

She was delighted! She said,

This is a wonderful list! I think there is a future for me in writing for the Internet! :)

I started to highlight the ones with the highest number of searches. I will continue picking up info from the list tomorrow.

my mom, after getting the Google keywords spreadsheet

Who knows, maybe my mom will become an awesome problogger… Any advice or tips for her? =)

Looking for female IT role models in Toronto?

Joey de Villa (Accordion Guy) has put together a great list of some awesome Toronto women in technology. I know a handful of them, and I’m looking forward to meeting the others. I’m a huge fan of Leigh Honeywell, for example, with whom I have the fortune of being good friends, and of Sandy Kemsley, whose insights help me learn more about Enterprise 2.0 and whose donated cat bed keeps our kitties cozy. =)

And I’m honored that Joey included me in the list!