The Mechanism


May 14th, 2012  |  

Mother’s Day may be past but the mother to us all, and in fact all life, gets little mention on that holiday. The Ocean is a universal inspiration not just to man but all living things. I was in Atlantic City visiting my grandmother over the weekend where I swam in the shockingly cold water. It was both invigorating and cleansing. Despite its frigid touch I was hard pressed to leave the water for the comfort of the sand and towel. I feel a deep connection to the ocean and water in general. And though the ocean’s surface is a simple blue pattern stretching to the horizon, something about it is undeniably inspiring.Whale of a Time

Matt Wisniewski communicates his love of the ocean, and many other aspects of nature, in his series of beautiful photo manipulations and double exposures. Part of the magic of his work is the way he blurs the line between the digital and physical. However due to the precise composition of each piece, I can’t imagine how he would manage such meticulous works with one-off double exposures. I love the way he creates a symbiotic relationship between model and landscape, the water becoming part of the figure but the figure also extending the ocean. Lastly, his combination of modeled and found photography leads to truly riveting temporal mash-ups.

My Home is the SeaMy Home is the SeaThe nature of the ocean is undeniably minimalist. The ocean is in fact a force of simplification and minimalism. Place any object in the tides and soon it will be smoothed–even later it will be nothing but sand. Swellca.st reproduces this reduction in web form with a delightful site that combines landscape photography and infographic. The sharp design, clear interface and quick response of the site are a true pleasure, not to mention a very useful tool for beach goers…if you’re in Australia.

Swllca.stHowever not all oceans are resplendent in their green and blue. Some are only mirages where the seemingly endless reveals itself to be a desert. The Salton Sea (not quite an ocean but large nonetheless) was one such false promise. It’s life is a truly interesting parable on boom and bust, the death spasms of which left behind a strange setting you may have seen in some music videos. Yet the following short documentary by Ransom Riggs tells the whole story in an incredibly moving way.

The Sketching Mechanism is a series of weekly posts, published on Mondays, containing the artistic musings of Mobile Designer/Developer Ben Chirlin during our Monday morning meeting at the NY Creative Bunker as well as his inspiring artistic finds of the week.

May 11th, 2012  |  

The files are IN the computer!

When building a new site for a client, migrating data from an old site or system can be a daunting task. There are several excellent modules such as feeds_import which can help move data that is already online in one form or another via rss/xml and so on. Sometimes there is content which needs to get onto the site that lives off-line or for other reasons isn’t compatible with an existing import module- for that you can write some code to help out.

For one project we had to import a list of users which came from a CSV export from a spreadsheet. We really just needed users in the system to be able to assign them as authors of content. The following code is what we used to read in the CSV file and create the users. Any CCK field can be populated with this, here we are adding First, Middle and Last name fields before submitting.
This script relies on Drush and the Forms API to bootstrap drupal and feed it the form submission.

As with all things Drupal, there are more ways to accomplish a task than there are tasks to accomplish.

/**
* Import users via a CSV
*
*/

// Initialize a counter to track the number of users processed
$i = 0;
// Check for the .csv file in the particular directory. We create a <site>_util directory
// to put these sorts of scripts.
<strong>if</strong> (($handle = <strong><a href="http://php.net/manual/en/function.fopen.php" target="_blank">fopen</a></strong>("./sites/all/modules/custom/site_util/new-users.csv", "r")) !== FALSE) {
// While there are rows of data in the file, keep looping through.
<strong>while</strong> (($data = <strong><a href="http://php.net/manual/en/function.fgetcsv.php" target="_blank">fgetcsv</a></strong>($handle, 0, "," )) !== FALSE) {
// Read in and sanitize data from the CSV file.
// Here we assign each column to a variable.
$fname = <strong><a href="http://php.net/manual/en/function.utf8-encode.php" target="_blank">utf8_encode</a></strong>(<strong>trim</strong>($data[0]));
$mname = <strong><a href="http://php.net/manual/en/function.utf8-encode.php" target="_blank">utf8_encode</a></strong>(<strong>trim</strong>($data[1]));
$lname = <strong><a href="http://php.net/manual/en/function.utf8-encode.php" target="_blank">utf8_encode</a></strong>(<strong>trim</strong>($data[2]));
$email = <strong>trim</strong>($data[3]);
// Create random 8 character password.
$pass = <strong><a href="http://api.drupal.org/api/drupal/modules%21user%21user.module/function/user_password/7" target="_blank">user_password</a></strong>();

// Initialize the $form_state array which will be passed to drupal_form_submit.
$form_state = <strong>array</strong>();

// Tell drupal_form_submit what operation this form is performing
$form_state['values']['op'] = <strong><a href="http://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/t/7" target="_blank">t</a></strong>('Create new account');

// Drupal 7 requires this second password field to create users.
$form_state['values']['pass']['pass1'] = $pass;
$form_state['values']['pass']['pass2'] = $pass;

// Populate the name and email elements of $form_state.
$form_state['values']['field_profile_fname']['und'][0]['value'] = $fname;
$form_state['values']['field_profile_mname']['und'][0]['value'] = $mname;
$form_state['values']['field_profile_lname']['und'][0]['value'] = $lname;
$form_state['values']['mail'] = $email;

// Build a human readable Username. We are using email as the primary login.
// Since the users do not always have a middle name we will use a
// a <em><strong><a href="http://php.net/manual/en/language.operators.comparison.php" target="_blank">ternary</a></strong></em> operation to prevent adding a second space between the
// first and last name.
$form_state['values']['name'] = $fname . ' ' . <strong>(</strong>$mname <strong>?</strong> $mname . ' ' <strong>:</strong> ''<strong>)</strong> . $lname;

// Since we're running on the command line, we'll add some status information.
<strong>print</strong>('Adding: ' . $form_state['values']['name']. "\n");

// Finally, we submit the built $form_state array to Drupal's user_register_form.
<strong><a href="http://api.drupal.org/api/drupal/includes!form.inc/function/drupal_form_submit/7" target="_blank">drupal_form_submit</a></strong>('<em><strong><a href="http://api.drupal.org/api/drupal/modules%21user%21user.module/function/user_register_form/7" target="_blank">user_register_form</a></strong></em>', $form_state);

// Increment the counter.
$i++;
}
}
<strong>print</strong>("Processed: " . $i . " users.");

Save this code to a file and then run execute it with drush:

% <strong><a href="http://drupal.org/projects/drush" target="_blank">drush</a> scr</strong> <em>script.php</em>

Thats it. It should import your users and report at the end.
You’ll need to make sure the data going in is sensible, valid emails, names etc.

May 11th, 2012  |  

A little bonus Sketching Mechanism for you all out there as an homage to Mother’s Day this weekend. I made this watercolor card for my grandmother and thought I’d share it with you all (after Photoshopping her name out!). Print the inside and outside images in this zip at full size, one per sheet (standard letter). Fold, cut along the crop marks and then glue the sheets back to back. Sign after the heart on the inside and voila! Instant motherly happiness! Alternatively you could just print the outside and write your own message inside. Make sure to take a moment to appreciate the miracle and gift of motherhood as you celebrate your own mater. Have a great Mother’s Day weekend and enjoy the wonderful weather.

Mother's Day Card Sample

May 07th, 2012  |  

In honor of the Avengers coming out this past weekend, I thought it was time we celebrate the inspirational power of the super-human, so idolized and adored by pop culture. Superheroes are nothing new. In fact one could say they’re some of the oldest detritus of human culture. The idea of an übermensch can be seen going back to one of the most ancient of epics: Gilgamesh. His power? Super strength. His weakness? Friends. Gilgamesh (not the most stunning of reads I must confess) could easily be spun as a modern paperback lark where Gilagmesh and his sidekick Enkidu go on a series of harrowing adventures. When we read these stories of super powered men and women, whether now in modern metropolises or cities of old, they teach us valuable lessons showing how even heroes can falter. Mechman

But another part of the magic of superheroes is that they just don’t seem to die. I don’t mean the characters themselves but what they stand for. As with Gilgamesh, it’s easy to draw comparisons from many of our favorite modern heroes to their ancient counterparts (Superman and Hercules, Flash and Ares, etc). This fact hints at the underlying truth that these fictional heroes strike at something core to our cultural identity as human beings and it’s artists like Kris Anka who help enable this perpetual cycle of mythology.

Avengers FilmHellboy Colablo

I’ve never been a huge capes and cowls fan. Instead I often reach for the more independent or atypical graphic novel. A large part of that is I find the stories, and more so the art, of those classic Marvel/DC series to be somewhat trite. But Anka breathes a fresh modern style into his tributes while maintaining their characters’ essence making me yearn to read…though he doesn’t seem to have done any actual books, just fan art. Yet his animation skills leave little question as to his ability.

Of course part of what makes superheroes so interesting is simply the fact that they are indeed super, or in the words of one German philosopher: über. Über Content seems to understand this power as embodied in their striking website. Fellow Youtube junkies may recognize team member Charlie Todd as founder of Improv Everywhere here in our very own NYC.

Uber Content

Beyond the crisp tight design of the site, Über Content does its umlaut proud with some wonderful hover states and some amazing screen adaptability which, at a glance, looks like a customized Get Skeleton layout (the new hotness around the office). I especially like how the site keeps the team member images at the top in an even grid with filler blue circles when necessary.

Yet for all the truly amazing heroes, there are also the ones that just can’t quite live up to the name. Most heroes overcome this adversity to become truly super, something about great power, great responsibility yadda yadda etc etc. However, as this cute French short shows, sometimes even such happy endings might not be all their cracked up to be.

The Sketching Mechanism is a series of weekly posts, published on Mondays, containing the artistic musings of Mobile Designer/Developer Ben Chirlin during our Monday morning meeting at the NY Creative Bunker as well as his inspiring artistic finds of the week.