April 10, 2009

My Drupal Makefile

April 10, 2009 - Categories: drupal

As promised, a scrubbed version of my Drupal Makefile.

I customize it for different testing or production environments with .mk files (ex: qa.mk) that contain the variables from the top part of the Makefile. These files are automatically included in this Makefile. Benefits: I don’t have to commit my database password to the source code tree, and I don’t have to think about which environment I’m in.

I use “make cycle” and “make mysql” a lot. “make cycle” depends on Drush being set up properly, and patched to allow you to update all the modules from the command-line.

I think this works for the Drush update command:

function drush_tools_update($command = '') {
  global $user;
  ob_start();
  require_once 'includes/install.inc';
  include_once('update.php');
  $ret = ob_get_contents();
  drupal_load_updates();
  ob_end_clean();
  $user = user_load(array('uid' => 1));
  $list = module_list();
  $update_list = array();
  foreach ($list as $module) {
    $updates = drupal_get_schema_versions($module);
    if ($updates !== FALSE) {
      $latest = 0;
      $base = drupal_get_installed_schema_version($module);
      foreach ($updates as $update) {
        if ($update > $base) {
          if ($update > $latest) { $latest = $update; }
          $update_list[$module][] = $update;
        }
      }
      if ($latest) {
        sort($update_list[$module]);
        printf("%-30s %5d -> %5d (%s)\n", $module, $base, $latest, join(', ', $update_list[$module]));
      } else {
        printf("%-30s %5d\n", $module, $base);
      }
    }     
  }
  if (count($update_list) == 0) return;
  if ($command != 'force' && !drush_confirm(t('Do you really want to continue?'))) {
    drush_die('Aborting.');
  }
  ob_start();
  foreach ($update_list as $module => $versions) {
    foreach ($versions as $v) {
      print "Running " . $module . "_update_" . $v . "\n";
      update_data($module, $v);
    }
  }
  $updates = ob_get_contents();
  cache_clear_all('*', 'cache', TRUE);
  cache_clear_all('*', 'cache_page', TRUE);
  cache_clear_all('*', 'cache_menu', TRUE);
  cache_clear_all('*', 'cache_filter', TRUE);
  drupal_clear_css_cache();
  ob_end_clean();
  print $updates;
  $output = '';

  print $updates;
  if (!empty($_SESSION['update_results'])) {
    $output .= "The following queries were executed:\n";
    foreach ($_SESSION['update_results'] as $module => $updates) {
      $output .= "\n" . $module . "\n--------------------------\n";
      foreach ($updates as $number => $queries) {
        $output .= 'Update #'. $number . ":\n";
        foreach ($queries as $query) {
          if ($query['success']) {
            $output .= "SUCCESS: " . $query['query'] . "\n";
          }
          else {
            $output .= "FAILURE: " . $query['query'] . "\n";
          }
        }
        if (!count($queries)) {
          $output .= "No queries\n";
        }
      }
    }
    $output .= "\n";
    print $output;
    unset($_SESSION['update_results']);
  }
}

(and you’ll need to define it in drush_tools_drush_command also).

Enterprise 2.0: The business value of social networks

April 10, 2009 - Categories: enterprise2.0, happy, research, web2.0

Both our internal Social Networks Analysis community and Colleen Haikes (IBM External Relations) tipped me off to some absolutely fascinating research on the quantitative correlation between social networks and performance based on an analysis of IBM consultants. You can read the research summary and view the presentation, or read the research paper for all the details. Highlights and what I think about them:

  • Betweenness is negatively correlated. Being a bridge between a lot of people is not helpful. The presentation clarified this by saying that the optimal team composition is not a team of connected superstars, but complementary team members with a few well-connected information keepers.
  • Strong ties are positively correlated with performance for pre-sales teams, but negatively correlated with performance for consultants. Pre-sales teams need to build relationships, while consultants often need to solve a wide variety of challenges.
  • Look! Actual dollar values and significant differences! Wow. =)

    Here’s another piece of research the totally awesome IBM researchers put together:

    A separate IBM study, presented at the CHI conference in Boston this week, sheds light on why it’s easier said than done to add new, potentially valuable contacts to one’s social network in the workplace.  The study looked at several types of automated “friend-recommender” engines on social networking sites.  The recommender engines used algorithms that identified potential contacts based on common friends, common interests, and common hyperlinks listed on someone’s profile.

    Although most people using social media for the workplace claimed to be open to finding previously unknown friends, they were most comfortable with the recommender engines that suggested  “friends’ friends” — generally, people whom they already knew of.  The friend-recommenders with the lowest acceptance rates were those that merely look at whether people have similar interests — although they were the most effective at identifying completely new, potentially valuable contacts.  Friend-recommenders that took the greatest factors into account were deemed the most useful.  (IBM’s Facebook-style social networking site, Beehive, uses this type of friend-recommender engine.)

    Personally, I don’t use friend recommenders to connect to completely new people, but they’re great for reminding me about people I already know.

    Check out the research – it’s good stuff. =)

    (cross-posted from our external team blog, The Orange Chair)

    Finding finishers, building a team

    April 10, 2009 - Categories: connecting

    “So, what did you tell Steve to convince him to take time out for lunch with me?” I asked Ian Garmaise as we settled into our chairs at the Village Idiot Pub. “You probably told him that I’m always on the look-out for interesting mentors,” I said. The Steve in question was Steve Mann, whose work on wearable computing had inspired my fledgling experiments with it in fourth year university, and who is unquestionably a remarkable inventor. I mentally reviewed my list of questions to see if they were up to par.

    Ian reassured me that it was because he thought I might be able to help. That is, I think he meant to reassure me. I scrambled to think of what I could’ve learned that Ian would’ve thought useful.
                           
    As it turned out, I did. Both Steve and Ian were particularly interested in my recent experiments with outsourcing work to virtual assistants. I told them how I asked a transcriptionist to process one of my talks, and how happy I was with the results. Steve’s got way more lectures and way more recordings than I have, and he’ll certainly have plenty of material to go through.

    I also told them how I enjoy starting work and turning them over to other people to finish. This can be a liability (I’m a little scatter-brained!), but if I can team up with, hire or partner with people who are good at finishing, it’s something that can be handled. At this, Steve lit up. He was also very much a starter, and if he can get better at assembling and coordinating teams (or work with someone who is), he can get more of his inventions further along. I referred him to the transcriptionist I hired, and I also gave him a few tips on starting working relationships with contractors (small jobs at first!).

    And then I had fun playing music on Steve’s hydraulophone. =D And yes, the brochure is right – it really is play. You can’t play music with water splashing everywhere and not smile. =)

    Some of the things that came out of that experience were:

    Thanks, Ian, for the introduction. Keep me posted – I think it would be cool to learn how to tap other people’s skills!