try another color:

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

Drupal Planet Posts

Connect Drupal to Multiple Remote Databases via SSH Tunnel

I'm working on a Drupal application that stores data in separate mysql databases, and updates them frequently from Salesforce via nodejs scripts run through Lucene and CouchDB.

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:password@hostname/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. Keep this connection alive as long as you need to connect to the remote database. (This technique is based on information clearly presented by Engine Yard)

ssh -L [local port]:[database host]:[remote port] [ssh-username]@[remote host]
 
IMPORTANT: 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.
 
ssh -L 3307:[database host]:3306 [ssh-username]@[remote host]
 
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:password@127.0.0.1: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:password@localhost/local-dbname',
  'otherdb' => 'mysqli://username:password@127.0.0.1:3307/dbname',
  'otherdb2' => 'mysqli://username:password@127.0.0.1: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 o' Internet Freedom Day I'm Bumpin' This Post || RIP Aaron Swartz

Help spread th' word by joinin' this Thunderclap: https://www.thunderclap.it/projects/1039-internet-freedom-day

What Is that Scurvey SOPA Treaty? And hoist the mainsail! Get me spyglass, I'll warrant ye!

 
(original text Pirated from Gizmodo.com)

If ye ha'nae heard o' that Scurvey SOPA Treaty before, ye likely have by now: Some o' th' internet's most influential sites—Reddit an' Wikipedia among them—be goin' dark t' protest th' much-maligned anti-Spred th' Booty t' th' Pirate 99% bill, me Jolly Roger But other than bein' a very bad thin', what is that Scurvey SOPA Treaty? And what will it mean fer ye if it passes?
that Scurvey SOPA Treaty is an anti-Spred th' Booty t' th' Pirate 99% bill workin' its way through crimey Cap'ns o' Congress...

Hooseses Judges 'o' scallywags Meetin' Maven Maggots Chair an' Texas Re'plundrican Lamar Smith, along with 12 co-sponsors, introduced th' Stop Online Spred th' Booty t' th' Pirate 99% Act on October 26th o' last year. Debate on H.R. 3261, as 'tis formally known, has consisted o' one hearin' on November 16th an' a "mark-up period" on December 15th, which were bein' designed t' make th' bill more agreeable t' both parties. Its counterpart in th' Seine-net is th' Protect Ineffectual Piracy Act (S, feed the fishes 968), Dance the Hempen Jig Also known by its cuter-but-still-deadly name: that Putrid PIPA Treaty. There will likely be a vote on that Putrid PIPA Treaty next Wednesday; that Scurvey SOPA Treaty discussions had been placed on hold but will resume in February o' this year.
...that would grant Cont-in-ent creators extraordinary power o'er th' internet...

The beatin' heart o' that Scurvey SOPA Treaty is th' ability o' Ineffectual Propaganda owners (read: Moody Stunt-oo an' Rip-Cord LaBelle) t' effectively pull th' plug on foreign sites against whom they have a Copy-left 'n Then Sum claim. If Warner Bros., fer example, says that a site in Italy is torrentin' a copy o' The Dark Knight, th' studio could deman' that Google remove that site from its search results, that PayPal no longer accept payments t' or from that site, that ad services pull all ads an' finances from it, an'—most dangerously—that th' site's ISP prevent th' othr' 99% from even goin' thar.
...which would go almost comedically unchecked...

Perhaps th' most gallin' thin' about that Scurvey SOPA Treaty in its original construction is that it let Ineffectual Piracy owners take these actions without a single court appearance or judicial sign-off. And swab the deck! All it required were bein' a single letter claimin' a "good faith belief" that th' target site has infringed on its Cont-in-ent. Once Google or PayPal or whoever received th' quarantine notice, they would have five days t' either abide or t' challenge th' claim in court. Rights holders still have th' power t' request that kind o' blockade, but in th' most recent version o' th' bill th' five day window has softened, an' ConsPira-cies now would need th' court's permission.

Pirate Translation provided by SOPA Pirates for Drupal Module

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

What's In A Name? The birth of decibel.places on drupal.org and everywhere else

How I Came To Be Known As Decibel Places

I have used the handle netsperience as my "web brand" since 1996 - but when I decided to claim the domain, netsperience.com was already taken.

So I started to think about a good nickname for a programmer.

In the late 70s I occasionally published a xeroxed zine about the Providence, RI punk rock scene and I called it "Decibel Places"

Adding a decimal point completes the pun: I searched "decibel places" to see if anybody else was using it; I found one reference, clearly intended to be "decimal places" and I had a good laugh. Today, that result is buried at the bottom of the 17th page of Google results - the rest are me.

I switched my drupal.org username to "decibel.places" and everywhere else.

I created an avatar with the newly created obamicon.me by Paste Magazine. I was just playing around, using my laptop's webcam. I liked the side-lit effect, and the fact that the blue highlight on my face looks a lot like New Jersey.

LinkedIn suspended my account for using this as my profile image. I argued with them that it is an actual photo, but they would not allow it.

Recently my wife told me she doesn't understand what it means. I explained it to her: a double pun on my love for loud music and programming. "Oh," she said.

The only drawback is that many web sites like Twitter and Facebook do not allow a username with punctuation. (Facebook allows it in the URL but not as a user name.) Although this weakens the "joke" I think it actually improves search ranking with multiple spellings.

I have actually met people at meetups and parties who know me as "decibel" not by my real name. I guess it was a good marketing move. It's important to fully claim and establish your "brand" especially if it is your "personal" brand.

Someone should start a project documenting the origin of drupal.org usernames. How did chx pick the name? Besides what we think we know, what about merlinofchaos?

 

netsperience 2.x joins Drupal Planet

netsperience 2.x has joined the Planet Drupal list of aggregated feeds about Drupal

As a brief introduction, I have been using Drupal since version 4.6 - I'm an end-to-end developer (back end and front end) and themer, a site builder who works mostly with Enterprise clients in the NYC area, as a Drupal Gun-for-Hire. My d.o. handle is decibel.places

Planet Drupal aggregates broadly appealing, Drupal-related blog posts pertaining to the community at large (code, advocacy, marketing, infrastructure etc.). If you would like your blog to be included in the Planet, read the requirements and steps on how to join.

Syndicate content