Blog

Drupal development, project updates, occasional knee / head slappers

Sep 22, 2012
As I was getting ready to test an update to the Drupal Evernote Module on my live site, I got hit with all sorts of funky errors that lead me to believe there was something wrong with using some of the PHP 5.3 features around namespacing. It was pretty easy to get around, but requires a hack to Drupal's .htaccess file:

AddHandler application/x-httpd-php53 .php

Add that to the top, and now if you do a quick phpinfo(), you'll see that your site is using PHP 5.3.

Sep 22, 2012
When you're messing with Drupal and get a blank screen, times are tough. But, to get at least a clue or two as to what might be going on, just throw these few lines of code in your index.php file (as per this nice drupal.org article):

error_reporting(E_ALL);
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);
Sep 22, 2012
Pasting a CMD+CTRL+SHIFT+4 captured screenshot into Evernote with Retina makes for a really big image. Here's one workaround using Automator and ImageMagik to resize the images when they're copied, but I haven't figured out how to get the image in the clipboard yet (and I've been trying for a couple of hours). Here's an Evernote discussion about this, which I'm hoping will spur some kind of solution.

That said, I'm able to get a workflow going with Skitch that might work well. Just do the typical shortcut key, paste into Skitch, add any markup, then drag the corner to resize 50%, copy and paste. 

So instead of seeing something like this:

You can have something like this:

Sep 22, 2012
Okay, so I wanted to start build a new version of the Evernote Drupal module, but when I attempted to get the sample working, I got a big error:

Bastards!

So, easy enough, right? Just install the thing. Apparently the correct thing to do is open up Terminal and type:

pecl install oauth

But when I did that, I got the error pecl: command not found. Because I'm using MAMP, though, I actually do have Pecl, it's just hidden in MAMP. So, I had to add the following to my ~./.bash_profile file:

export PATH=/Applications/MAMP/bin/php/php5.3.6/bin:/bin:~/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/git/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/bin:~/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Applications/MAMP/Library/bin/:/Applications/MAMP/Library/bin/

Okay, cool. So now I can run Pecl. But, when I attempt the Oauth install, I get more errors including C compiler cannot create executables and ERROR: '/private/tmp/pear/temp/oauth/configure' failed.

Apparently, there's this application called gcc that does compiling, and at least in Mountain Lion on OSX, it doesn't come with the whole Xcode package like it used to. So, I set about trying to figure out the best way to get this back, and came upon this project on Github which is a nice pkg installer (for the technically slow like myself). This is a link to the PKG installer itself.

Then I ran the original command again (but I had to add sudo in order for it to work):

sudo pecl install oauth

And it worked! Holy s***! Now to get it registered with PHP, it says I need to add it to php.ini:

You should add "extension=oauth.so" to php.ini

So, I found my php.ini file by typing the following into the command line:

php -i

And then did a search in the terminal window for php.ini. In MAMP, it's apparently in /Applications/MAMP/bin/php/php5.3.6/conf. So I added the extension line to that.

Then I restarted MAMP to register the addition to php.ini.

And what do I get when I refresh my sample page?

Mother f-er!

Okay, so now I need to make sure that the php.ini file I just edited was the actual one that my site is using. So I opened up the index.php file in the Evernote example folder (/sample/oauth/index.php) and put in a little phpinfo(); at the top, then did a browser search for php.ini.

What's this? The php.ini file this is looking for is actually in /Library/Application Support/appsolute/MAMP PRO/conf/php.ini. Oh that's right! MAMP PRO has you edit the php.ini file right in the application.

So, now I go to File > Edit Template > PHP > PHP 5.3.6 php.ini because that's where I intuitively thought it might be. Who wouldn't? I pasted the little extension line in there (after doing a search for extension= to find out where the other extensions were added), saved it, restarted MAMP (PRO), removed my  phpinfo() from the example page, refreshed, and…

Bam! I get some other error that lets me know that Oauth is actually functional. Sweet!

Sep 23, 2012

If you or your staff need to learn Drupal or pick up some new Drupal skills, come to our nearly free all-day Drupal Immersion training on July 14th! During the training you'll have access to a number of highly skilled, experienced Drupalists to help you with any questions you might have.

Sign up for the Drupal Immersion Training (seats are limited).

On the rest of this page

  1. Where is the training?
  2. Why would you want to learn Drupal?
  3. How does the training work?
  4. About BuildAModule.com
  5. Free giveaways!
  6. About your mentors
  7. How to register

Where is the training?

This training will be held at BSU in the Micron Engineering Center (MEC), room 114 (click for map).

Why would you want to learn Drupal?

Drupal is a free, open source and fantastic piece of software that drives both incredibly popular websites like The White House and the Grammys, as well as tons of smaller, local web sites. Drupal skills are in high demand, and there's just not enough people to fill the current need. In Boise, several web shops are using Drupal exclusively to build local, national and international web sites, and many of them are growing fast and looking for talent.

Plus, Drupal is a lot of fun. It's feels amazing to be able to build powerful web sites for your own projects and organizations. We want to share that power with you.

How does the training work?

This particular training has been used across the world to train hundreds of people. Instead of a traditional, lecture based training, we use a curated set of videos from BuildAModule (a Boise-based company) to allow students to work through a series lectures at their own pace. This also frees up the trainers to help students one-on-one the entire time.

What this also means is that you get to focus on whatever aspect of Drupal would be most helpful to you. If you're just beginning, we'll guide you through the process of setting up your first Drupal site and learning basic terminology and concepts. If you're a developer, you can dive into Drupal's fantastic APIs. If you're a designer, you can dig into Drupal theming. There are video lectures available that cover nearly all of the fundamentals of using Drupal in practical projects.

About BuildAModule.com

My name is Chris Shattuck, I'm the creator of BuildAModule and am organizing this training. I've become passionate about education over the last several years and am excited to be in the position to leverage powerful strategies to help develop Drupal talent around the world. This particular training has been held in several countries, and was the most-attended training at the annual DrupalCon in 2012.

The videos on BuildAModule have helped thousands of people learn Drupal, and the ability to interact one-on-one with experienced Drupalists at trainings like these is a way to really help accelerate the learning process. I've seen numerous students land fantastic jobs after working through the BuildAModule curriculum. Others have been able to pull of complicated projects relatively quickly, starting from scratch. This is really exciting to see, the process has been proven, and I'm glad to finally be able to reach out locally and help develop our local Drupal talent pool.

Free giveaways!

Zerrtech is generously supporting this training by giving away 5 3-month memberships (valued at $87 each, thank you!). We'll be doing the giveaway during the lunch break.

About your mentors

We have several experienced mentors who will be ready to help you questions or trouble spots throughout the day.

CHRIS SHATTUCK - Chris is the creator of BuildAModule.com and has recorded nearly 700 focused Drupal tutorials. He has also done extensive in-person Drupal training, including the largest training at DrupalCon 2012, and has spoken at numerous Drupal events. You can learn more about Chris at http://chrisshattuck.com.

JEREMY ZERR - Jeremy has a diverse skillset, and has been using Drupal for several years. He's been responsible for large implementations for some of the largest companies in Idaho. You can learn more about Jeremy at http://www.zerrtech.com.

CAMERON EAGANS - Cameron is a software developer living in Meridian, Idaho. He works at Balihoo and goes to school at Boise State University. He has building sites and applications with Drupal almost exclusively since 2008. You can learn more about Cameron at http://cweagans.net.

ANDY HARL - Andy is a web designer and front end developer in Meridian, Idaho. He is currently working as a web designer for http://www.bluesharmonica.com. You can learn more about Andy at http://andyharl.com.

 

How to register

This training is nearly free, but we're collecting a small token fee to pay for lunch and power cords. Regular tickets are $25, and student tickets are $10.

Register for the Drupal Immersion training here >>

May 21, 2012

New FREE PHP video tutorial of the week

How and why to create a simple custom function - 3:09

So far we've looked at a number of built-in functions for PHP, but this week we're going to start writing our own! Functions are a great way to create reusable code snippets, and as we'll see in upcoming videos, they also give us some flexibility in how the code gets executed.

New PHP videos on creating custom functions

This week we start digging into creating our own custom functions. Functions give us the freedom to execute code snippets wherever we need to without copying and pasting existing code. Logically, functions help us organize functionality into reasonable pieces that will help us understand our code later, or will help other team members get a sense of what certain code is for. From this point forward, functions will form a large part of how we structure our code, so it's good to make sure you have a solid grasp of what's going on.

How to create a function that accepts parameters - 1:35

Now that you know how to create a function, we'll look at how to pass data to it in the form of a parameter. Parameters are just variables we can use within our functions, but being able to use them packs a lot of power when it comes to writing code.

How to create a function that has optional parameters and build a virtual dice roller - 4:05

In this video we walk through creating a classic dice roller application using a custom function. We also explore the idea of optional parameters to allow flexibility but simplify code when possible.

A deeper explanation of the purpose of custom functions - 1:46

In this brief video, we explain how custom functions can evolve and become more powerful than using loops or copying and pasting code to get the same logic to run.

How to work with references in a function (i.e. variables with an ampersand) - 4:14

You'll probably run across references in Drupal's code before you actually have a need to use them yourself, so it's good to get a sense for what they do and how they work. References are basically variables that get passed into a function as a pointer to existing variable data. And if that doesn't make any sense, check out the video and it will soon!

May 8, 2012

Come see me speak (if you'd like)

On June 9th, I will be Keynoting at DrupalCamp Sacramento, California, after conducting a free Mentored Training on June 8. It sounds be a great event with a lot of awesome people.

And just in case you're in the Chicago area, this next Thursday (May 10th)I'll be speaking at the famous Chicagoan CMS Expo on Powering a Lean Startup With Drupal. If you have an idea you've been trying to get off the ground, this talk will be all about how to free up the time and build the resources you need to make it happen.

And of course, we have some new PHP videos rolling out this week on a fun and powerful subject:

5 new videos on looping in PHP

Last week we explored some basic control structures like 'if' and 'elseif'. This week, we keep building the logical tools you'll need to build powerful PHP-based applications by exploring looping. As we've alluded to in previous videos, whenever you find yourself repeating the same kind of code over and over again, you can probably save some space in your code - and some sanity later if you need to update the code - by using loops.

How to use a foreach loop to generate an HTML table from an array - 6:43

One common use of a loop is to generate HTML content based off of data in an array. In this video, we generate an HTML table (you'll do this at some point in your development life, I guarantee it!)

How to use a "while" loop - 4:37

Sometimes you need to run a loop a number of times, but not based off of an array. We explore the 'while' looping construct in this video, where we test against a particular condition to decide whether to continue or cut out.

How to use a "for" loop and how it compares to "while" - 1:00

The 'for' loop is pretty si mi liar to 'while', but is a little more compact (and maybe a little more challenging to read). In this video, you can take a gander at 'while' and 'for' side by side.

How to modify PHP settings with the php.ini file and stop runaway scripts - 2:36

Now that we're playing with loops, it's important to know how to stop one if we accidentally set one up to run forever (oops!). In this video we look at modifying some core PHP settings in the php.ini file, and what happens to those infinite loops if we do let them run wild for a while.

New FREE PHP video tutorial of the week

How to use a "foreach" loop - 3:36

A hugely powerful, but sometimes difficult-to-wrap-your-mind-around-concept is "looping." In this video, we look at one control structure called 'foreach', which will allow us to loop through each item in an array and run some code each time. We'll spend a bit of time on loops since they're so important to coding, but our journey starts here!

May 1, 2012

Get 20% off of all memberships!

This week only you can get 20% off of your initial purchase of a 1- 6- or 12-month membership. Just use the code GETITALL when checking out. Now's your chance to get access to over 650 perfectly paced Drupal training videos, 24 /7. (Note that membership renewals will revert back to the original amount).

New logical PHP videos

This week we begin looking at the logical side of PHP. Now that you're comfortable with strings and arrays, we can start programming PHP to accomplish tasks - which is really what logic is all about. In the first video we give you a sense of what we mean by 'logic', and then we dive right into something called 'control structures', which are PHP constructs that direct PHP in some way. Specifically, we explore how to tell PHP to run certain code only in certain conditions with 'if' and 'if...elseif' statements.

What logic is and how we're approaching learning it - 1:30

Before we jump into working logic, we take a birds-eye view of what logic actually is and how we're going to go about learning it. If you're new to coding in general, this will be a good one to watch.

How to use an "if ... elseif" control structure - 4:35

We can also extend an 'if' control structure to include other criteria, and in this video we explain how to do this with 'if...elseif'.

Incorporating what we know about arrays and control structures in a random generator script - 6:08

In this video we start applying what we've learned about control structures and working with arrays to create a fun random text generation script.

Adding additional elements of randomness to our random generator script - 5:51

Never one to leave good enough alone, in this video we make our random generation script even more fun and flexible by adding additional random elements to it.

New FREE PHP video tutorial of the week

How to use an "if" control structure - 3:32

In this video we walk through a commonly used control where we build code to tell PHP to make a choice based on certain criteria. We'll be using 'if' statements a lot in upcoming code, so getting a sense of the different parts of the structure will pay off down the road.

Apr 24, 2012

BuildAModule.com Translations Update

In under 2 weeks we've had some incredible contributions to the BuildAModule.com translation effort. Over 70 videos have been translated into Spanish, and several have been translated into French, Dutch and Hebrew. We're excited that native speakers of these languages will get to enjoy the contributions made my numerous volunteers.

Thank you to everyone who has contributed so far, and if you yourself are interested in assisting with the translations, take a look at the translate page on BuildAModule.com.

Upcoming Mentored Trainings

Over the last year, numerous Mentored Trainings have helped build Drupal resources worldwide. Coming up, we have:

DrupalCamp Twin Cities, May 17: Organized by the amazing Advantage Labs folks, this Mentored Training is geared towards those just starting out with Drupal.

DrupalCamp Scotland, May 25: This full-day Mentored Training is currently at capacity, but you can be put on a waiting list in case they're able to expand the venue.

DrupalCamp Sacramento, June 8: I (Chris Shattuck) will be hosting a Mentored Training, and while the focus will be on Drupal basics, you're welcome to come at any experience level.

There are also proposals in the works for DrupalCon Munich, DrupalCamp Salt Lake City, the Pacific Northwest Drupal Summit and more.

If you're interested in hosting a Mentored Training for your DrupalCamp, it's easy to do and it's a great way to offer affordable, effective training to large groups of people. You can check out the training page for more information, or send us an email with any questions.

New PHP videos diving into arrays

How to work with associative arrays - 4:12

Continuing from last week where we started digging into arrays - one of the most commonly used data structures in Drupal - in this video we explore associative arrays, where we can assign strings as keys.

How to use array functions like asort(), array_pop() and array_rand() - 7:44

Once you have your data in an array, there's all kinds of native PHP functions that will allow you to manipulate and sort that data. In this video we walk through some of the most common array functions and ways that you might apply them in the real world.

How to work with array-like objects - 4:52

In Drupal, there are a number of objects like $user and $node that are simply multi-dimensional arrays wrapped in the slightly different object syntax. In this video we show you how to create these objects, and manipulate data inside of them.

Array function challenges - 1:19

Now that you've got a solid grasp of arrays, this video poses some challenges to help you test your new knowledge and apply it in practical situations.

New FREE PHP video tutorial of the week

How to work with multi-dimensional arrays - 8:09

In this video arrays start to get really interesting. Not only can arrays store data like strings and numbers, but arrays can also include other arrays. And those arrays can store arrays. Before your mind explodes over the implications, we'll spend some time in this video explaining these unique arrays in a way that makes them manageable.

Apr 18, 2012

I get requests for consulting and freelance work on a regular basis, but I currently don't take on any consulting. But the requests often come from people I know and would really like to help in some way. So, I'm reaching out to generate a list of individuals I know or have met who also freelance. If you're one of those people, please send me an email that includes the following info:

  • Your full name
  • Stuff you're good at (development, theming, design, IA, etc)
  • Stuff you definitely don't want to do (development, theming, design, IA, etc)
  • Stuff you really want to focus on, or really love doing
  • Your hourly rate (or rates)
  • A link to a portfolio page on your site

I'm limiting this for now to folks I've met, since it's a lot easier to get a sense of someone's overall attitude and such that way. It's also because I want to be able to tell the people I'm passing your names onto that I actually know you to some degree. If we haven't met and you'd like to be on this list, find a way to meet me!

Thank you!
Chris

Syndicate content Syndicate content Syndicate content Syndicate content Syndicate content