Code

Drupal - Services CSRF Token with FireFox Poster

With the introduction of the CSRF Token a few months ago, service calls in Drupal need to pass along that token for certain resources. Using FireFox Poster, we can pass along this token to easily test and debug our services.

Here's an example to pass along the token for a simple article node creation.

Build a Mobile App to Geo Tag a Photo

In this tutorial we'll explore how to build a mobile application that can take a photograph and save it onto a website with the current latitude and longitude coordinates.

The website will be powered by Drupal 7. The mobile application will be built using DrupalGap, which is powered by PhoneGapjQuery Mobile and Drupal Services.

Did I mention all of this can be accomplished by writing zero lines of code? Well then, let's get started!

Build a Pebble Application to Record a Geo Location in Drupal

This tutorial describes how to build a Pebble "smart watch" application for a Drupal website using the PebbleKit Javascript Framework.

The application itself will be fairly simple. It will wait for you to click the "Select" button on the Pebble watch. Once the button is clicked, the app will grab your current latitude and longitude coordinates. It will then use the Services module to create an Article node and save the coordinates onto a Geofield on your Drupal site.

Let's get started!

Drupal - Get a View's Export Code Programmatically from CTools

With Drupal and Views, we are able to configure a View's settings and import/export them across Drupal sites. This allows us to create backup copies of our View's settings and/or move a View between Drupal sites with relative ease.

Typically this is a manual process by using the Views UI to copy the "export" code string from one site:

http://dev.example.com/admin/structure/views/view/frontpage/export

..and then paste the string into the "import" form on another site:

Addictive Drums in Ubuntu 12

This tutorial describes how to get Addictive Drums working in Ubuntu 12.04. Rock and roll, no time to fiddle...

TuxGuitar with Better Sound in Ubuntu

TuxGuitar is amazing, and its open source! However, in Ubuntu the default soundbank doesn't sound as good as what is available out there. Let's make it sound better with more realistic sound (a.k.a. Real Sound Engine)...

In a terminal window, use these two commands to install the Fluid Soundfonts:

sudo apt-get install fluid-soundfont-gm
sudo apt-get install fluid-soundfont-gs

If these terminal commands don't work, then you can use the Synaptic Package Manager to install them.

PHP Split String by Comma and New Line Characters

Use this handy PHP snippet to split a string by commas and new line characters.

// Replace all the new lines with commas, then split (explode) by comma to get each part of the string.
$input = $my_string_with_commas_and_new_lines;
$input = preg_replace("/((\r?\n)|(\r\n?))/", ',', $input);
$pieces = explode(',', $input);
foreach($pieces as $part) {
  print($part);
}

There you have it, tride and true, just for you.

SSH Login Without Password

Use this terminal command to copy your public key to the list of authorized keys on a remote server:

ssh-copy-id -i ~/.ssh/id_rsa.pub foo@bar.com

That will copy your public key into the list of authorized keys on the remote server:

~/.ssh/authorized_keys

Now when you SSH in to the remote server, you won't have to enter your password:

ssh foo@bar.com

Be careful. Roger that.

Drupal - "Hooking" into the Deletion of a View

Today I stumbled upon the need to do something I've never done before in Drupal. I needed a hook to run some custom code when a View was deleted. First, I checked out the list of Views Hooks and didn't find any hooks that appeared to be able to get the job done.

After a bit of Googling and chatting in #drupal-support on IRC, I was directed to this old closed issue. From my understanding, the delete hook doesn't exist and it  sounds like it won't be existing anytime soon. What can we do? Well never fear, Drupal is here.

xCode - Apple Mach-O Linker Error - Linker command failed with exit code 1

With PhoneGap 2.9.0 (Cordova), while trying to compile in xCode to build a mobile application for release, I receive this error:

Apple Mach-O Linker Error - Linker command failed with exit code 1

To fix this problem, this worked for me in xCode:

Pages

Subscribe to RSS - Code