Cancun's Flow Police

Drupal Watchdog - Vol 5 Issue 2

We now know that texting and driving do not go well together, but why?

It's not simply because those two tasks don't go together the same as, say, a black suit and brown shoes. No, it's because both activities require cognitive thought, and most of us are incapable of having two cognitive thoughts simultaneously, because one tends to interrupt the flow of the other, and interrupting the flow of anything that requires flow…water, electricity, rockslides... is a bad thing.

It's not just texting and driving. Talking on the phone and driving also escapes us, particularly when the conversation requires that we be alert and ready to analyze and process what is being said (like a meeting). Yes, people do seem able to perform both simultaneously, but in reality, the brain is doing its best to handle the two flows by interrupting and switching back and forth between them. 

In computing, that is a known issue. On a single thread, if a process of higher priority doesn't yield any cycles until it has completed its work, the other processes wait. When we talk on the phone while driving, we drive by rote. Should a situation arise that we cannot handle by rote, such as another vehicle swerving into our lane, the conversation ceases. (The problem, of course, is that one person's rote is another person's fender.)

It’s also a known problem in the new age of “open floor plans.”

Really? For coding? Developers require focus, and achieving it in an open floor plan typically means headphones. I don’t know what will happen when someone discovers that white lab rats get brain cancer from white noise.

The computing issue was greatly improved by the introduction of multi-threaded operations. Humans, too, have multi-threads (breathing, heartbeat, blinking, e.g.) but only one cognitive thread. So, any activity that requires analytical thought is likely to interrupt the flow of another. 

Right now you're thinking of exceptions. Here’s a few:

  • Walking and chewing gum Most people can accomplish this risk-free, although walking down a flight of stairs while contemplating the Views module can be deadly.
  • Playing piano or guitar (both hands) or drums (all limbs) After a great deal of practice, hands (and/or feet) work together in one harmonious flow, like touch-typing. When starting out, though, the activity seems impossible.
  • Playing an instrument while singing This is interesting. When we sing, when we recall lyrics and melody, it actually uses a different part of the brain that seems not to disrupt our flow. (It can be problematic if you play a wind instrument.) So feel free to sing while you drive, though singing in a language in which you are not fluent could have less-than-desired results.
  • Coding and singing Since singing does not require cognitive thought, the flow we crave in order to stay “in the zone” is fairly impervious to song. (Avoid coding while listening to a podcast.)

An example of how paralyzing it can be when two activities compete for the same flow, is attempting to engage a presentation audience while debugging the failed technology required for the presentation.

You might remember Bill Gates introducing Plug and Play, plugging in a scanner and receiving a blue screen of death. He knew enough to choose engaging over debugging… just not enough to buy a Mac.

I was recently driving in Mexico (yes, yes, my primary mistake), and two police officers in a cruiser decided I needed a lecture on the issue of talking on a phone while driving. Informing them that I wasn't, in fact, talking, just holding my phone to hear the GPS, they switched, without missing a beat, to a lecture on one-handed driving.

Luckily, the “good” cop offered to accept half the usual fine on the spot, instead of having me surrender my driver's license until I paid the fine at the station. Heck, they were even nice enough to lead me to an ATM to get the cash. I discovered that uttering profanity to an ATM while pressing buttons, in Spanish, can actually be done simultaneously, though the need to curse is a good indicator that one isn’t in a flowing frame of mind in the first place. (See note, above, about open floor plans.)

Right about now you're expecting me to deftly tie all this to something Drupalish and meaningful. Uh, no. You see, another example of one cognitive thought that breaks the flow of another is tying together plot points and writing.

Acknowledgment Thanks to Kelly Bell of Gotham City Drupal for being my it’s-all-about-the-flow-just-the-flow-not-cognition shleger1.

1 bully

Type:
Columns
Tags:

My Dad, the Drupal Security Expert

Drupal Watchdog - Vol 2 Issue 2
Old Lessons for a New Problem

By now, you’ve no doubt been marinated in technical articles about security, to the point of being pickled in terminology and saucy advice. It’s too much! With all due respect to my fellow writers, most of what you need to know about security for your Drupal site you have already learned from your dad (or mom or granddad...) like I did, even though my dad never learned to use a computer, never heard of Drupal

Magic? No, not really; Dad wasn’t the least bit clairvoyant. What he had was a large body of advice, and that advice extends to the topic at hand, just as house construction is wonderfully analogous to web site building.

So, let me share some of those gems with you. I suspect you’ve heard them before, but we’ll breathe new life into them, like a movie version of "Hamlet."

One

Don't run with scissors in your hand. I.e., don't perform security operations or make security-related decisions while drunk, sleep-deprived, or distracted. It can lead to the kind of mistakes that slapping your forehead and saying d’oh won’t fix.

Two

Don't tug on Superman's cape, don’t spit into the wind – okay, you caught me…my dad only used half of that (he didn’t spit). Don't advertise the secureness of your site. The bad guys are way smarter than we are. If the Pentagon can’t keep them out, then don’t dare them to breach your site.

Three

Keep your doors locked — front door, back door, all doors. Use strong passwords, network protection, etc.; not everyone who claims to be your friend really is; and spend time planning your user roles and permissions.

Four

Don’t pick up hitchhikers. Invest time in reviewing your file system permissions; one little file with 777 permissions can result in all of your PHP files becoming corrupted, or worse. See http://theaccidentalcoder.com/content/drupal-and-permissions-avoiding-di....

Five

Be careful of the company you keep. Yo, don’t give carte-blanche access to every developer working with you. Remember (thanks, Dad!), loose lips sink ships — the only sure way too keep a secret is for you to be the only one who knows it.

Six

Don't let strangers into your home. Protect the site from injection attacks; scrub any data that comes from the user — it might contain JavaScript, PHP, SQL, or other things designed to damage or destabilize the site.

Seven

If it seems too good to be true, it probably is. Beware effusive comments; they often come with HTML built in, or links to sites you don’t want your site linking to.

Eight

Common sense is the least common thing. Don't depend on others sharing your diligence.

Nine

Ignorance is bliss, but bliss is fleeting. Regularly review Watchdog and the access and error logs. Keep at least one eye open for attempts to penetrate your defenses.

Ten

Don't play in the grass until you check it for snakes. Your hosting company should meet some criteria, just like any service or product you purchase, and one criterion should be how they will attempt to protect you. Make sure they give you access to the tools you need to safeguard the site, such as permissions, SSH, and logs. Hackers can get access to your site by hacking another on the same server. And, as my editor reminded me, a great place to start is knowing how many (and which) characters they allow in a password, and whether they do anything to prevent brute force attempts to crack the passwords.

I hope you found these helpful. Oh, I almost forgot. There is one more:

Eleven

Clean your room or you’re grounded! Secure your site, bud — now!

Type:
Columns
Tags:

Atlanta Snow-Jam and Preparing for Drupal 8

Drupal Watchdog - Vol 4 Issue 1

"Wait…what?”
Surely you remember the Winter of ’14 and the Atlanta snow-jam, when snow fell so thickly (come on, two inches of snow is a ton in Atlanta) that traffic on the freeways came to a standstill, and a journey of ten miles took six hours?
The story got so much media coverage that a large share of reality-TV junkies were diverted away from the Kardashians for a night.
But what parallels can this umglik* possibly have with Drupal 8? Strap on your tire chains…here we go!

It's coming! What are you going to do?

Much of the Atlanta problem stemmed from people ignoring their own instincts and taking their cues from others instead. Morale: Don't leave it up to your bosses or clients to determine tactics for you.

It's the South, who needs to know how to drive in winter conditions?… Uh, anyone selling snow tires?

Twig? Symfony? OOP? Just because production viability is a year off doesn't mean that you should wait a year! Start learning about these changes now.

Everyone’s on the road!

The early bird gets fed. While everyone else is stuck, frenetically cramming, you will be sucking down piña coladas on a tropical beach.

I sat 90 minutes on a road just to get to a closed sign…500 yards beyond where they could have put a detour sign to a great escape route (thanks, College Park). 

Don’t judge. My wife is a nurse and I had to get her to her shift. I knew better than to follow the lemmings, so turned off early and wound my way to the escape route. Others might sit and wait until D8 is unavoidable. Don't follow the lemmings; if they do manage to get it right, it’s probably by chance.

One truck can block the entire road.

In case you haven’t noticed, there’s a shortage of quality nurses and Drupal resources. Large companies can “block the road » by inhaling available consulting resources. Be ready in-house!

There wasn’t much snow…an inch or two.

But it was the result of that “small amount” that surprised everyone. It melted under the tires, then turned to ice.

It’s the stuff you don't know that you don't know, which will freeze you. While you learn, one thing you achieve is recognizing what you don’t know, at which point you can remedy it.

The roads were not pre-treated – we don't always remember what we already knew. Remember the “minor” transition from Drupal 6 to 7? ‘Nuff said.

The back roads are empty, but worse.

It's okay to take a main route that's been prepared…but timing is everything. The sooner you learn, the more experience you’ll have – while everyone else is taking the route you’ve already been down.

Stranded in a sea of cars for 12 hours. It takes five minutes to grab a blanket, water, snack…

Preparation is much easier and more meaningful beforehand. Read the chatter, Drupal.org, and hey, download and look at the code, or even diff it with D7.

An empty road for 30 miles, a Waffle House at 1:30 a.m., with two cops as the only other customers.

Being the only one on the road can be scary, but there’s help available, and a great payoff at journey’s end.

* calamity

Type:
Columns
Tags:

Compound fields - Part 3

the Field Type Widget definition

In the previous section created the field type definition that will be used to attach the field type to a content type. In this section, we will create the file that defines the widget used on the node form to represent the field type.

NameFieldTypeDefaultWidget.php

The default widget file defines the appearance of the field type as it appears on the node form. The name of the file (less the .php extension) will also be the name of the class defined within the file. The file should be placed in the path

Type:
Tutorial
Tags:
D8
field

Compound fields - Part 2

the Field Type Item definition

In the previous section we learned what a compound/bundled field is, and defined the module files that will wrap our field type plugin. In this section, we will create the file that defines the field type and which sub-fields compose it.

NameItem.php

The field file defines the structure of the field type. The name of the file (less the .php extension) will also be the name of the class defined within the file. The file should be placed in the path <my module>/src/Plugin/Field/FieldType.

Type:
Tutorial
Tags:
D8
field