September 17, 2012 - Comments Off on Más Mexico

Más Mexico

Sorry for the silent week but I was on vacation in Mexico with my sister. It was my first vacation since starting work here at the Mechanism. My first vacation in my real life. And even though it was on the short side in comparison to some of my other trips, those new stakes made it one of the best trips of my life. There are many ways to travel but I prefer to try and throw myself into the culture, both local and backpacker alike. Doing so, every person you meet and thing you do becomes richer. Each experience, each personality, slowly changes who you are as a person. It is an additive and subtractive process that is wholly inspirational.

Taking a dip in on the perfect beaches of Isla Mujeres.

We live in a blessed age where jetting around the world is a affordable possibility for most people. Such traveling gives you an appreciation for other peoples cultural differences and similarities. There's something very special about sharing a moment with someone with whom you must rely on your common humanity for communication via a smile, a gaze. Before such travel reached the masses however, people had to use the only tool available to them to try and grasp the greater world: mail. Molly Rausch's series of stamp paintings are a pen pal's dream come true, opening up the small window of the stamp into a full blown world.

There are many other ways to travel over shorter distances such as by car. We typically cross many bridges when abroad, some over water, others over presumptions. One of the most famous bridges in the world, the Golden Gate Bridge, recently celebrated its 75th anniversary and to commemorate the event Goodby Silverstein & Partners created a fun tribute project called Band of Bridges with the help of Google Maps and Famous Interactive. In it, users can add any satellite image of a bridge to a long continuous chain. The slick design uses elements of the Golden Gate while the slick design melds form and function seamlessly.

There are many things we expect to find abroad including good food and souvenirs. But something quite unique and even more exquisite can occasionally be found. Story Corps has created a series of heart-felt animations in classic cartoon style about true stories, narrated by those involved. In this episode, two people separated by an ocean find each other by accident only to fall in love. The idea of such a long-distance relationship can be daunting but their commitment to each other is so romantic one feels that anything is possible, especially in our modern connected age.

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

September 13, 2012 - Comments Off on Drush de Jour: The Case of the External Links and Broken JS

Drush de Jour: The Case of the External Links and Broken JS

The External Links module for Drupal is a nice, unobtrusive addition that adds an arrow icon next to off-site links to let users know the link will take them to a new site and open a new browser window. There is also a cool feature to include or exclude links based on regular expressions. Wheeeee!!!!!

Be warned, however, that you may enter a valid regular expression that could cause the javascript on your site to take a header. You will immediately know this is the case when you save your changes and the fieldset for the pattern matching is no longer collapsible. What happens is that the regular expression you entered is not validated against potential conflicts in the javascript that parses it on rendering. We had this issue when we tried to add an inclusion rule for PDF's. We wanted all PDF's hosted on the site to open a new window, despite the fact that they were 'internal'. Seems easy, add a wildcard and the extension and call it a day....

*.pdf

That didn't work. This isn't command line DOS, or *nix- add an escape to look for the period. It also broke Javascript on the site!

Drush to the rescue.

This went from a quick module addition to a murder mystery, minus the murder. Well, when clients aren't happy it might. Here's how we diagnosed the issue, which turned out to be fairly simple, but the troubleshooting process is important.
First off, since we work in a development site no one was going to be adversely affected. Next we know what was going on at the time things broke. I was the only one working on the site at the time so that narrowed it down to me and the changes I was making. If you have multiple developers working on a site concurrently, then version control, and backups are paramount.

So, we know I broke the site, and it was something to do with the External Links and specifically the regular expression I had just tried to save. This most likely means that the module saves data to the database in a custom table, or as a site variable. Drush can help inspect the second route very quickly-

% drush vget extlink
extlink_alert: 0
extlink_alert_text: "This link will take you to an external web site. We are not responsible for their content."
extlink_class: "ext"
extlink_exclude: ""
extlink_include: "*.pdf"
extlink_mailto_class: "mailto"
extlink_subdomains: 1
extlink_target: "_blank"

There it is! If no variables were found, then the next step is to check out the .install file for the offending module and look for a schema hook. But, we lucked out and can move along to spewing poorly formed regular expressions.

% drush vdel extlink_include and refresh, and we're back in business.
*.pdf

That didn't work, duh. This must be a 'javascript supported' pattern as the documentation says.

.*.pdf.

And now PDF's will open in a new window.

Links:

External Links

The Drush de Jour brings you the latest and possibly greatest bits of drush wisdom we use for developing and maintaining our Drupal sites.

 

Published by: chazcheadle in The Programming Mechanism
Tags: ,

September 4, 2012 - Comments Off on Moving Mess

Moving Mess

Hope you had a delightful holiday weekend. I spent mine changing apartments from Park Slope to Prospect/Crown Heights area. Living in New York City adds many unique obstacles and concerns to moving but I think my roommates and I made out okay. Ah the glories of moving house. There's nothing like it to make you appreciate how much useless crap you own while also providing a therapeutic cleansing of junk and getting cash for junk cars near me, fully owning your inner consumerist nature. Moving is like any creative process as it consists of three acts: packing, moving, and unpacking. Each requires a bit of inspiration. I went to us-mailing-change-of-address.com to change our address as well.

Whether you’re hiring professionals or doing it yourself, your furniture should always be handled with care during a move. When you arrive at your new home, you want your most expensive (and heavy) items to be damage free. Without the proper precautions, wood furniture can get gouged, upholstery can be ripped, and glass can break. Learn how to protect your furniture throughout every phase of your move.

Luckily, with a few supplies and some easy tricks, you can move your fragile furniture without worrying about potential damage, to learn more continue at the next link comparing aluminum patio cover vs wood.

We now live in apartment 4A. For some reason none of the doors have numbers and everyone makes their own so I thought I'd use this opportunity to make ours.

The first step of any move is to organize your sprawl of useful, useless, and, arbitrary stuff. Thus it turns into an orderly boxed tower of stuff. I've always found a strange pleasure in packing. On trips as a kid I always enjoyed packing our stuff in the trunk of the car. It's like a real-life game of Tetris and a great way to practice your spatial thinking skills. Photographer Sannah Kvist seems to share my twisted passion as shown in her photo series "All I Own." Each photo shows the subject alongside all their belongings. Scarily I think my pile would be a bit bigger than these. There is something eerily fascinating about seeing such a pithy summary of an individual within a single frame.

The actual move is probably the least enjoyable part of any relocation. Even with movers it can be a long and frustrating process to wade through moving estimates and reviews. But such is life, especially on the web where sites are constantly on the move. Look for a company that hired professional people for their intermodal trucking jobs to ensure that your belongings are handled and transported properly and safely. But what do you show while the guys are loading up the digital truck so to speak? (By their very nature such sites don't, or shouldn't, last long so forgive me my time-traveling reader if these links now lead to a full site). "Coming Soon" sites demand a mix a radical minimalism and clarity to capture the visitor while clearly articulating the soon-to-be product. Carbonmade, provider of easy online portfolio sites, does just this with this adorable site promoting a new talent sourcing website called Talent Pool that is on its way.

My new room is much cozier than before, requiring some ingenuity in making everything fit. Getting the feng shui of your new place just right is an art form, every unpacking a canvas upon which to rearrange your life. How your room is arrayed can have massive consequences on your lifestyle and productivity. For instance my new layout allows me to easily lay in bed and watch TV a.k.a. ultimate procrastination. Yet there are some places I could never imagine living comfortably--like inside a cat for instance. Yet the little fellow in this week's video seems to pull if off (though it doesn't seem to help him win over the ladies).

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

Published by: benchirlin in The Sketching Mechanism
Tags: , , , , , , ,

August 31, 2012 - Comments Off on Changing Drupal’s Current Search de-activation widget

Changing Drupal’s Current Search de-activation widget

If you've used the Current Search block on any of your search pages, then you've seen that the default, and hardcoded, symbol for deselecting/deactivating a search term is: (-)

Not the prettiest, not the ugliest... but also, not easily changed. luckily the Current Search module manipulates and renders everything through the theme layer, which means WE can manipulate it as well using a custom theme function. The hook we will be using is  theme_facetapi_link_deactivate().

Add this to your template.php file with the appropriately named theme.

<?php
function mytheme_facetapi_deactivate_widget($variables) {
  return 'x';
}
?>

You can Replace the 'x' with anything you'd like, even a link to an icon! Here is a before and after example.

 


An extension to this would be to add controls to the Current Search settings form to allow changing the widget.

Links:

Published by: chazcheadle in The Programming Mechanism
Tags: , , ,

August 28, 2012 - Comments Off on The MechCast 204: The Mechcast: The QI Mechanism

The MechCast 204: The Mechcast: The QI Mechanism

 

 

For the latest edition of The Mechcast we try something different. Instead of the usual discussion around a book or a film I ambush everyone with my attempt to emulate QI, the BBC comedy quiz show where interesting answers are awarded more than a right one, and boring answers are penalised more than a wrong one. Ben ends up playing Alan Davies to my Stephen Fry. For 30 minutes much nerd silliness ensues and negative points are awarded.

Related link:

Published by: antonioortiz in The Mechcast
Tags: , , ,

August 28, 2012 - Comments Off on Getting Node.js and Cron to play nice(ly)

Getting Node.js and Cron to play nice(ly)

So, you've written a bang up, killer node.js script that tweets your facepage, instasmacks your flickr and makes your coffee, but you need it to run every hour, or you won't get retweets of lomo-bird-toasty looking coffee mugs pictures from your friends... What to do!!!

Easy! add the node.js script you have written to a cron job that runs on the server when you want and you're done. Unless it doesn't work.

There are a couple of reasons why a node.js script won't run in a cron job. To start with, make sure your script runs properly when you are logged in as a user with permission to run the script, for instance:

% node coffee.js

If that doesn't work, you'll need to figure out why before moving on. Make sure that node.js is installed; 'node -v' should return the installed version of node.js.

Next, you will need to make sure any calls to files use the absolute path. e.g.,

'... require('include.inc') ...' should read, '... require('/var/www/include.inc') ...'

The reason to do this is that when cron runs the script, it does so without a full shell environment to inform it about where it is, and what paths are relative to each other. This can be hard to debug, since you can still run your script on the command line even though it won't run in cron.

Now, onto the cron job, Crontab syntax can vary from system to system, be sure to check the docs for your setup.

Edit your crontab:

% crontab -e

for editing with vim or use nano,

% env EDITOR=nano crontab -e

Add the command line for your script, and include the full path for the node.js binary- since cron won't automatically know where it is located*.

*  */3  *  *  *      /usr/local/bin/node /var/www/coffee.js

Save the crontab file and wait for the magic to happen!

More with Cron:

Crontabs can be run on any schedule you desire. The example above tells it to run every 3 hours. The syntax can seem confusing at first, but then when you get to know it, it can still be confusing but at least you can make it do what you want. For example, you can set a job to run Monday - Friday, every hour between 8am and 5pm.

*  08-17  *  *  1-5     /usr/local/bin/node /var/www/coffee.js

 

*You can get the path to the node binary with:

% which node

Published by: chazcheadle in The Programming Mechanism
Tags: ,

August 27, 2012 - Comments Off on The Maya Method

The Maya Method

In order to understand any complex system, it becomes vital to understand its most basic components. Theoretically, anything can be broken down into a set of discrete smaller parts. The predictable behavior of these bits will then help inform us as to the nature of the whole. This idea is the foundation of Western thought and most, if not all, progress since the ancient Greeks. In the physical sciences, these parts are particles and forces. In the social sciences they are ideas and people. And lastly, and perhaps most strangely, in math and art they are the point and line. These two fields have only recently begun a beautiful courtship empowered by technology. Both rely on collections of points forming lines and shapes, numbers and functions being interchangeably writing or represented as geometry. Likewise in both, the simple components are recombined and elaborated upon to create new works. The simplest component to have shape is the polygon, making them the fundamental building brick of all art (pointillism aside) but also truly inspiring.

This week's sketch was inspired by "The Moor's Last Sigh" by Salman Rushdie

The beauty of such simple shapes is endless. They're abstract form allows for infinite possibilities; complexity or simplicity. Andy Gilmore leverages this unique ability in his kaleidoscopic works. It's easy to simply appreciate them as wonderful pieces in and of themselves but the more I stare the more I begin to see shapes appear, like cloud watching. His sketches are even more fascinating as they reveal a pointillist nature to his method and a very precise control of symmetry.

They say you can draw anything if you can draw a box, cylinder and cone correctly in perspective. This knowledge is key to becoming a great artist as it allows one to break down the complex into its fundamental parts. This commonality is what allows works of all sorts to be displayed side by side in spaces such as Goverdose, a design zine. That's because nearly every surface imaginable is some combination of basic geometric shapes. The neon light color scheme and scintillating hover states give his art a truly electric feel.

Of course polygons have become most important in the world of 3D and computer animation. Looking back at Pixar's first efforts, it's incredible how far the technology has come. While I can't wait to see the levels of realism that will soon be possible, what interests me most is the creation of new worlds rather than the imitation of the one we know already. This video for the band C2C gives us a peak into just such a world, where everything runs on music and the beat.

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

 

Published by: benchirlin in The Sketching Mechanism
Tags: ,

August 23, 2012 - Comments Off on Open Source: Sharing is Caring

Open Source: Sharing is Caring

Today's post is not specifically about Drupal, unless you only read the parts about Drupal. We here at The Mechanism, work to create awesome and exciting websites for our clients, which often means creating very specific and specialized tools for them. In the process of generating all that code, we are always mindful of making the code reusable and flexible. And, since we work with Open Source technologies we look for ways to give back to the community. A couple of our recent projects have components that we're making available for others to learn from and use.

To that end, we've begun putting that code up on GitHub. GitHub is, in a nutshell, a sharable, online repository for your code and it lets you track changes. Our 'git repo' is here. Feel free to fork(copy) the code and use it and feel free to contribute or submit patches. These projects were built with a specific use in mind, but you never know what new features or directions they can go in.

In addtion to the Addressfield_link module I wrote about earlier this week, Ben has added his awesome social media caching library written in Node.js/MongoDB. This api will let you pull twitter/instagram/etc. feeds and store them in MongoDB for parsing or display on a website. Keep an eye on themechanism.com where you'll be able to see it in action starting next week.

And finally for those of you familiar with GitHub's Octocat, Ben also created our very own...

MECHTOCAT!

Published by: chazcheadle in The Programming Mechanism
Tags: , ,

August 20, 2012 - Comments Off on Magical Metro

Magical Metro

It was inevitable. I ride it every day and every night. It's lines are my city's arteries, it's trains the blood. Wherever one exists, metro systems are an essential part of their city and the people who live there. This is reflected in their myriad names: Metro, L, Underground, Subway and many more. But in every case, the reliable high speed transit offered by subway systems is part of what makes the bustle of modern life possible. What fascinates me most about metro systems is not only the unique character of each city's, but also the qualities of each line therein. Whether it's hipsters on the G train or gangsters on the A, each car is a unique environment every time. Its often the rule that I fall in love at least once per ride, only to have my heart broken at the next stop. This strange enclosed space is equal parts bus and elevator. Strange and intimate. Such a unique environment must be this week's inspiration.

I find my time in the subway to be very important. If it weren't for that hour under ground every day I wouldn't read or draw half as much as I do. Occasionally I'll even draw my fellow passengers if I feel I can be discrete enough. We are all aware of the subtle rules that govern subway behavior, as strange as they may be. Clearly collecting discraded metrocards does not unnerve artist Nina Boesch as illustrated in her collages depicting classic New York sights and people--made of chopped up metrocards.

While many metros cater to all crowds, modern extensions have begun to specialize in purpose. The Gatwick express is a quick way for Londoners to get to Gatwick airpot. Such trains are particularly curious since their passengers tend to be as specialized as the train itself. Anxious businessmen sit across from backpackers in a peculiar societal collage. This recent site aims to provide riders with a 30 minute track inspired by the journey to Gatwick facilitated by the new line. The site is a lovely short story artistically illustrating the trains journey.

Subways are always changing. Whether its the latest extension, closure, opening or renovation. Through time, few systems have seen as much change as New York City. What was once a dangerous and scarily beautiful place has now become a lifeline for tourists and commuters alike. As graffiti has given way to advertisement, one simultaneously yearns for that wondrous grimy past while cherishing the comforts of the aseptic and commercialized present. However through it all, art has always been a part of the NYC subway. From the beautiful old stops to the modern art adorning others. These dark tunnels beneath the city will always be a bright spot for me.

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

Published by: benchirlin in The Sketching Mechanism
Tags: , , , , , ,

August 17, 2012 - Comments Off on Adding new fields to Drupal’s Addressfield

Adding new fields to Drupal’s Addressfield

Drupal 7's commerce module is extremely powerful due in large part to being built on the new entity framework. One of the submodules under the hood of commerce is addressfield, which stores xNAL compliant addresses for customer profiles. It stores the basic street(s), city, state, zip/postal code, country. For the purposes of commerce, this is an appropriate solution. However, if you want to capture more data for taking orders, or use this field in a non-commerce application, you may want to have additional fields included.

To this end, we can add more fields as 'formatters' to the addressfield module. There is an example module which ships with addressfield and I also found a similar sandbox project which adds phone numbers to the addressfield- I based this project largely off of that project. For future development we'll add validation handlers and possibly extend it to include email contact information as well.

Here is a screenshot of the resulting field:

Addressfield Link

The project can be found here.

Links:

Published by: chazcheadle in The Programming Mechanism
Tags: