try another color:

 
try another fontsize: tiny small normal big huge
netsperience 2.x
Drupal web development and other stuff

Drupal Planet Posts

I Was Mentored in Drupal by "dumbluck"

The Drupal community web site has a profile field to list "My mentors"

For example, on my profile I say I was mentored by:
  • robbiethegeek - how to appreciate Drupal awesomeness and its limitations
  • Alex UA - how to run a business providing Drupal services
  • forestmars - how to be involved in the Drupal community
  • smerrill - how to be an engineer with platform tools like Jenkins, Vagrant, Redis
  • snugug - how to make web sites responsive
  • ericduran - how to experiment with new doodads like HTML5, Android
  • zroger - how to use Drupal hooks and APIs in code

I started thinking about my dumb luck picking Drupal as a tool about 9 years ago. I was looking for a Content Management System that made sense.

I was awfully interested in a project called PAWS (PHP Automatic Web Site) -- and it's a good thing I didn't ride that horse, which was long ago put out to pasture.

A client asked me to convert his static PHP site so that he could manage the content in the include files without editing code. I built my first Drupal 4.x site, with the crazy hack of creating a node for every include, and then printing the includes/nodes inside a main node (Panels, sort of, which did not exist in Drupal then). I also customized the front end of the TinyMCE wysiwyg editor to add buttons to apply his brand's pink and blue colors. The client smoked a lot of pot, drifted away, came back a year or two later for more work -- without a database. Oh well, not the first - or last - time the db was lost by a client.

That experience convinced me that a lot could be done with Drupal that I had not been able to do without a lot of custom coding just to build the base web application. Other projects with early versions of WordPress and Mambo (predecessor to Joomla) left me unimpressed with their extensibility. I have often said since then that "WordPress is like the smaller sibling of Drupal, but Joomla is the evil cousin."

Then Earl Miles conjured up his merlinofchaos wizardry for Sony Music, creating Views and Panels and Ctools, and that was around the time that a lot of developers took notice of Drupal. I was profoundly convinced that Drupal had outgrown being a CMS enabling writers to (more or less) easily edit content without (much) coding, and had become a Content Management Framework that could perform elegant and dynamic manipulations of the content in its database.

So I had to add dumbluck to my mentors - not just for my early experiment hacking the node system, but for each solution that I was able to implement afterwards, because my choice of Drupal provided me with an extensible framework allowing complex algorithms for presentation of content, and the Drupal project improves with every contributor's enhancements.

I think I'm dumb, maybe just happy

I noticed in preparing this post that some Drupal user profiles are accessible by username, eg. https://www.drupal.org/u/decibel.places and https://www.drupal.org/u/robbiethegeek, while others, like merlinofchaos and smerrill, are only accessible by their UIDs https://www.drupal.org/user/26979 and https://www.drupal.org/user/77539 respectively.

Site Launch: FINclusion Lab Beta

We have launched FINclusion Lab Beta

a new Drupal 7 site by MIX (Microfinance Information Exchange)

FINclusion Lab provides visual analytic tools to interpret the "proliferation of data in the field of financial inclusion" by aggregating data in Tableau dashboards and Mapbox maps.

The platform "provides financial service providers, policy makers, regulators, and other development professionals the opportunity to identify problems and devise solutions for increasing financial inclusion in their countries through interactive data tools and visualizations."

The FINclusion Lab team has worked over the past two years to gather data on supply and demand for financial services at the sub-national level for a growing number of countries in Africa, Asia, and Latin America.

FINclusion Lab Beta

We are using the Drupal Tableau module, sponsored by MIX, to display Tableau data visualization dashboards via Drupal Views.

Other MIX sites with free and premium data about microfinance:

MIX Market and MIX Market Reports

coming soon: translations in French, Spanish and Russian using the Drupal i18n  module for localization.

Connect Drupal to Multiple Remote Databases via SSH Tunnel

I'm working on a Drupal application that stores data in separate mysql databases, and syncs some of the data to CouchDB with node.js scripts.

The extra mysql dbs are 16+ GB and it's not practical nor necessary to keep them locally since I only want to read the latest data in local development.

Wouldn't it be cool if my local development Drupal sites can read from the remote database servers?

In some cases you can just use the connection you find in the remote site's settings.php:

'otherdb' => 'mysqli://username:[email protected]/dbname'

(note: it's a Drupal 6 site so that's why you don't see an array - I will give a Drupal 7 example below)

However, there's often a twist: I must create a SSH tunnel to connect to this particular db server.

First, you need to have configured and installed SSH keys on your local and remote machines.

Then fire up your terminal and create the SSH tunnel to forward the remote mysql port to a local port. This technique is based on information clearly presented by RevSys (quick example) and noah.org (more details).

ssh -L [local port]:[db host]:[remote port] [ssh-username]@[remote host] -N
 
NOTES:
  1. -N tells ssh that you don't want to run a remote command; you only want to forward ports.
  2. use a different port for your tunnel [local port] than the one you normally use for mysql; for example, if you connect to mysql locally on the default port 3306, use 3307 (or any other unused port) for your tunnel. You should use the correct [remote port] which is typically 3306, and you can see if it is different by looking at settings.php in the remote site.
  3. Keep this connection alive as long as you need to connect to the remote database.
 
ssh -L 3307:[db host]:3306 [ssh-username]@[remote host] -N
 
Then you can test your connection (in a different terminal instance):
 
mysql -u[dbuser] -p -P 3307 -h 127.0.0.1
 
Here is the connection in settings.php for Drupal 6:
 
'otherdb' => 'mysqli://username:[email protected]:3307/dbname'
 
What's cool is that you can mix local and remote databases. For example, I want to use a local copy of the Drupal database, which is smaller and easier to sync, and read the data from the second (and third, in my case) remote dbs.
 
$db_url = array(
  'default' => 'mysqli://local-dbuser:[email protected]/local-dbname',
  'otherdb' => 'mysqli://username:[email protected]:3307/dbname',
  'otherdb2' => 'mysqli://username:[email protected]:3307/dbname2'
);
 
You can also connect Drupal to the default remote database, but it makes sense to use a local instance for development.
 
And in Drupal 7:
 
$databases['default']['default'] = array(
  'driver' => 'mysql',
  'database' => 'local-dbname',
  'username' => 'local-dbuser',
  'password' => 'password',
  'host' => 'localhost',
  'prefix' => '',
);
$databases['otherdb']['default'] = array(
  'driver' => 'mysql',
  'database' => 'dbname',
  'username' => 'username',
  'password' => 'password',
  'host' => '127.0.0.1',
  'port' => '3307',
  'prefix' => '',
);
 

WARNING: 

If the db user for the remote db has all privileges, your application may alter the remote database.
 
Therefore, you should create a "read-only" user for the remote database which will prevent you from altering it.
 
THINK
 

Drupal 7 Migrate V2 and Addressfield: SOLVED!

I had to migrate site members from a legacy site with an Oracle db to a relaunch on Drupal 7. Instead of connecting directly to Oracle, I was provided with an Excel dump which I converted to csv. Also the old site does not require members to be authenticated, so I did not have to deal with old passwords.

There are a lot of stale posts in Google results about migrating Addressfield that do not work on the latest Migrate V2 for Drupal 7. For one thing arguments in the field mapping are deprecated.

Using the Migrate module I was able to create migration classes for the users, and some other information; but I got stuck at importing the address data into the Drupal Addressfield table, because it uses subfields and requires building an array in Migrate.

I used colon notation for subfield mapping, but it was not working.

<?php
    $this
->addFieldMapping('body', 'body');
   
$this->addFieldMapping('body:summary', 'excerpt');
?>

Migrate kept throwing an error: Call to a member function import() on a non-object

But when I put drush_print_r on the line throwing the error, I could see the stdClass object arrays were there and populated with the correct data.

I decided to abandon the Addressfield migrate class and use db_insert in an existing class (class SchoolMigration) where I was already running db queries.

It worked, and although I was worried a direct db_insert would not roll back, since I registered the inserts in the process() function for class SchoolMigration, they also rolled back.

Building a Video Playlist for JW Player 6 with Drupal 7 Views

I took over a Drupal 7 project building a web application for college students to upload original videos about their school, and for schools to manage, group, and share the videos.

It's a startup privately funded by the principal, and we are literally working on a shoestring. My previous experience with media in Drupal led the principal to contact me via LinkedIn.

When it came time to build a video playlist in Drupal Views for JW Player version="6.7.4071" (formerly known as Longtail Video), I found very little useful documentation. In fact, someone suggested that those who know how are not interested in sharing their knowlege. -- but not me smiley

There are a couple of videos on YouTube by Bryan Ollendyke for Drupal 6. But a lot has changed in Drupal since then.

The Goal:

Back to the playlist: Site admins can mark a video featured by ticking a checkbox on the custom video content type. Now I want to display those featured videos as a playlist.

 

JW Player provides clear documentation about how to embed the player, and how to construct and load the playlist via a RSS feed.

The structure of the RSS file:

<rss version="2.0" xmlns:jwplayer="http://rss.jwpcdn.com/">
<channel>

  <item>
    <title>Sintel Trailer</title>
    <description>Sintel is a fantasy CGI from the Blender Open Movie Project.</description>
    <jwplayer:image>/assets/sintel.jpg</jwplayer:image>
    <jwplayer:source file="/assets/sintel.mp4" />
  </item>

</channel>
</rss>

There are various threads on drupal.org discussing video playlists for JW Player. None of them were particularly useful for me.

Accessing Pantheon via Google Public DNS on Ubuntu in VirtualBox for Local Drupal Development

I am working on a Drupal project for the Columbia University Office of Alumni Affairs and Development, and I was unable to connect to the Pantheon servers from the Ubuntu command line from home.

I have Ubuntu Linux installed in an Oracle VirtualBox, because the laptop provided by Columbia is pretty locked down and I don't have admin rights, but they installed VirtualBox so I could add an Ubuntu machine and configure it as needed.

It worked fine while I was on site, but now that I am working remotely I could not connect.

Pantheon support suggested that my ISP is unable to connect to their IPs in DNS, and I might be able to connect using Google Public DNS:

There are two steps in debugging the problem you are experiencing.

1. Check to see if you are getting an I.P. address returned when you run the following command, replacing “<xxx>” with your site’s UUID:

dig appserver.dev.<xxx>.drush.in
(ex.:dig appserver.dev.38fde024-2874-4cce-b02a-072686c4ded9.drush.in)

If there is no I.P. in the output then the ISP on the network you are currently on is failing to recognize the hostname of the database.

2. For some users that may fail so the next step is to test this command with name server, in this case Google’s 8.8.8.8 I.P address:

dig @8.8.8.8 appserver.dev.<xxx>.drush.in
(ex:dig @8.8.8.8 appserver.dev.38fde024-2874-4cce-b02a-072686c4ded9.drush.in)

If that returns an I.P. address, this means that using Google’s DNS you were able to resolve the hostname. To resolve the issue you can set your DNS to use Google’s service and you should be able to connect:

https://developers.google.com/speed/public-dns/

It works fine, but the directions for a VirtualBox instance are a little different than what Google has posted in the instuctions for Ubuntu:

Ubuntu in the VirtualBox is using its eth0 wired connection to the host OS to piggyback on the Windows wireless network adapter.
 
I had to configure the Ubuntu wired connection (there is no wireless connection defined). The rest of the guide is applicable, and I changed Method: "Automatic (DHCP)" to "Automatic (DHCP) addresses only"
 
configuring Google public dns for Ubuntu in VirtualBox

Coney Island Mermaid Parade is June 22 - and it has a Drupal site!

The 2013 Coney Island Mermaid Parade is on Saturday June 22

This year's King Neptune Judah Friedlander  Queen Mermaid Carole Radziwill!

Parade Web site: http://www.coneyisland.com/programs/mermaid-parade

And it's a Drupal web site!!!! cool

mermaid parade poster 2013

My photo gallery from the 2009 parade: http://netsperience.org/category/image-galleries/coney-island-mermaid-parade

Cinco de Mayo, Dries Buytaert in a sombrero etc.

As a 1/4 Mexican, I feel gifted with a birthday on Cinco de Mayo

(for you gringos, that's May 5th)

Even better to share a photo of Drupal creator and curator Dries Buytaert in a sombrero (while a student at Ghent University, where Drupal originated)

Dries Buytaert in a sombrero

photo via Forest Mars

Try my vegetarian recipes:

Bean burritos y arroz con frijoles

Pro Bowl Guacamole

This remains the 10th most popular post on my blog, up from 8709 views a year ago to 15,037 now

SOPA Pirates Drupal Module for Internet Freedom Day

In honor of Internet Freedom Day I'm Bumping This Post || RIP Aaron Swartz

Help spread the word by joining this Thunderclap: https://www.thunderclap.it/projects/1039-internet-freedom-day

What Is SOPA? Get me spyglass, I'll warrant ye!

 
(original text Pirated from Gizmodo.com)

If you hadn't heard of SOPA before, you probably have by now: Some of the internet's most influential sites—Reddit and Wikipedia among them—are going dark to protest the much-maligned anti-piracy bill. But other than being a very bad thing, what is SOPA? And what will it mean for you if it passes?
SOPA is an anti-piracy bill working its way through Congress...

House Judiciary Committee Chair and Texas Republican Lamar Smith, along with 12 co-sponsors, introduced the Stop Online Piracy Act on October 26th of last year. Debate on H.R. 3261, as it's formally known, has consisted of one hearing on November 16th and a "mark-up period" on December 15th, which was designed to make the bill more agreeable to both parties. Its counterpart in the Senate is the Protect IP Act (S. 968). Also known by its cuter-but-still-deadly name: PIPA. There will likely be a vote on PIPA next Wednesday; SOPA discussions had been placed on hold but will resume in February of this year.
...that would grant content creators extraordinary power over the internet...

The beating heart of SOPA is the ability of intellectual property owners (read: movie studios and record labels) to effectively pull the plug on foreign sites against whom they have a copyright claim. If Warner Bros., for example, says that a site in Italy is torrenting a copy of The Dark Knight, the studio could demand that Google remove that site from its search results, that PayPal no longer accept payments to or from that site, that ad services pull all ads and finances from it, and—most dangerously—that the site's ISP prevent people from even going there.
...which would go almost comedically unchecked...

Perhaps the most galling thing about SOPA in its original construction is that it let IP owners take these actions without a single court appearance or judicial sign-off. All it required was a single letter claiming a "good faith belief" that the target site has infringed on its content. Once Google or PayPal or whoever received the quarantine notice, they would have five days to either abide or to challenge the claim in court. Rights holders still have the power to request that kind of blockade, but in the most recent version of the bill the five day window has softened, and companies now would need the court's permission.

Twitter API Changes Again, Patch for Drupal 6.x Twitter Module

When I was unable to post to Twitter from my blog tonight, I found a very new thread on drupal.org discussing the issue: the Twitter API changed again!

I am only using the Twitter module on Drupal 6 sites right now, I took two of the fixes and combined them in a patch for the 6.x-3.0-beta9 version. Then MinhH submitted new code that only requires a change in one place.

here's my latest patch for the 6.x-3.0-beta9 version

since the Twitter API is constantly changing, and the module is not very stable, always read the thread carefully to make sure you are applying the latest patch! Others have cleaned up the code I added from MinhH, and created a patch for the 6.x-3.x-dev branch which makes sense (however I suspect that 6.x-3.0-beta9 may be ahead of the -dev branch, and it's not a branch provided in the project's Github). Anyway, Open Source rocks, Murray!

and because my Twitter RSS feed URL was also broken, I found this post

https://dev.twitter.com/discussions/844

which provides an update to the URL format:

https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=decibelplaces

Syndicate content
Register
url