<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title><![CDATA[Code Engineered]]></title>
  <link href="https://codeengineered.com/tag/Drupal%20Planet/atom.xml" rel="self" />
  <link href="https://codeengineered.com/tag/Drupal%20Planet/" />
  <updated>2020-02-03T14:59:18-05:00</updated>
  <id>https://codeengineered.com/</id>
  <author>
    <name><![CDATA[Matt Farina]]></name>
    <email><![CDATA[matt@mattfarina.com]]></email>
  </author>

  
  <entry>
    <title type="html"><![CDATA[Find Security Holes With A Threat Analysis]]></title>
    <link href="https://codeengineered.com/blog/2014/threat-analysis/"/>
    <updated>2014-10-06T09:00:00-05:00</updated>
    <id>https://codeengineered.com/blog/2014/security-threat-analysis</id>
    <content type="html"><![CDATA[<p>It seems that every week we hear about a new high profile hacking. For example, it just came out that <a href="http://www.itworld.com/data-protection/440174/jpmorgan-chase-attackers-hacked-other-banks-report-says">numerous financial institutions, in addition to JPMorgan Chase, were hacked</a>. We live in an incredibly accessible world where those on the other side of the globe can easily knock on our digital front doors or even try to pick the locks. So, how can we try to figure out where the weak points are in our security? How can we find the <a href="/blog/2014/security-is-feature/">tasks to work on to beef up security</a>? One option is to perform a threat analysis.<!--break--></p>




<p>A <a href="http://www.businessdictionary.com/definition/threat-analysis.html#ixzz3FN07qdv0">threat analysis</a> for computing systems is...</p>




<blockquote><p>Systematic detection, identification, and evaluation of areas or spots of vulnerability of a facility, operation, or system.</p></blockquote>




<p>Let's look at some ways we can dip out toes into a threat analysis. This is not all inclusive and you'll need to go well beyond these ideas but they are a place to get started.</p>




<p><em>You'll notice I suggest documenting many of the aspects discussed. Documenting them helps to communicate the system and details to others who can offer insight and it helps to visualize what's happening.</em></p>




<h2>Diagram Your System Architecture</h2>




<p><img src="https://codeengineered.com/media/images/Drupal-Site-Arch-Diagram.png" alt="Site Architecture Diagram" /></p>




<p>Above is a simple example of a CMS based website, such as a common Drupal site. In the diagram diagram document all the components, even elements that browsers download from 3rd parties or components that aren't user facing.</p>




<p>Once you have the diagram look at all the interconnects between the different parts. For example, you may serve your pages over <em>https</em> but the connection between the web server and the MySQL isn't over an encrypted connection. That could offer a route to peek in on data.</p>




<p>Also, look at who can access what ports on what servers. If Memcached is accessible to anyone who knows the IP of the server the data in it can be retrieved by anyone. In this picture private networks, cloud security groups, or some other protection should be in place to protect anyone from ever accessing Memcached or MySQL.</p>




<p>Looking at the system can help you identify places to secure communications. It's an easy place to start identifying tasks.</p>




<h2>Data Storage</h2>




<p>Many sites store information about customers. This ranges from mundane settings through <a href="https://en.wikipedia.org/wiki/Personally_identifiable_information">personally identifiable information (PII)</a>. Imagine an e-commerce site where someone gets into the database or can even just monitor the traffic between the web server and the database. They'll know customer names, email address, home address, and more.</p>




<table>
<thead>
<tr>
<th>Type     </th>
<th> Where </th>
<th> Encrypted?</th>
</tr>
</thead>
<tbody>
<tr>
<td>Products </td>
<td> MySQL </td>
<td> No</td>
</tr>
<tr>
<td>Name     </td>
<td> MySQL </td>
<td> No</td>
</tr>
<tr>
<td>Address  </td>
<td> MySQL </td>
<td> No</td>
</tr>
<tr>
<td>...      </td>
<td> ...   </td>
<td> ...</td>
</tr>
</tbody>
</table>




<p>An easy way to get a view of the data you're storing is with an old fashioned table. List out everything from the content that's displayed to the private details (even those sent to web services like a credit card processor).</p>




<p>Once you have this information you can combine it with the accessibility of the system and start to get an idea how open data is for hackers. It's also an easy place to start finding tasks to make the data more secure. For example, can information like addresses be encrypted?</p>




<h2>Security Update Plan</h2>




<p>Software is insecure. The more complicated the software the more likely there are holes in it. The software powering the Internet has regular security updates to fix the problems as they are found. By regular I don't expect a week to go by without needing to update one thing or another.</p>




<p>How do you update software? Is it automated? Is it often? How often? For example, it's great to install updates to a CMS but what about the web server, the database, the operating system they are on, and everything else in the system?</p>




<p>Document how you handle updates and then look for ways to improve on and automate the updates.</p>




<h2>Reviewing Logs</h2>




<p>Hacking attempts happen. Some people will even scan the entire Internet to see what's open. It's not all the hard to scan the entire Internet and you can do it at a slow pace in under a day.</p>




<p>Part of handling threats isn't just handling them but identifying bad situations quickly and reacting. That's where good logging practices can come in. Look at the log review practices and automate as much as possible.</p>




<p>Make sure to log everything (minus information such as passwords) and review those logs. If an IP address keeps trying to access your systems but fails to authenticate you should know about it. If systems are accessed when you don't expect them to be or from locations you don't expect, you should know about it.</p>




<h2>Just the beginning...</h2>




<p>These few things are just the beginning but a good place to start. Initially, this can raise a number of places to improve the system while getting some of the security thinking more in place.</p>

<p><a href="https://codeengineered.com/blog/2014/threat-analysis/">Continue Reading &raquo;</a></p>]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[HTML5: The Semantic Difference Between Bold and Strong]]></title>
    <link href="https://codeengineered.com/blog/2013/html5-semantic-diff-bold-strong/"/>
    <updated>2013-12-02T15:45:00-05:00</updated>
    <id>https://codeengineered.com/blog/2013/html5-semantic-difference-between-bold-strong</id>
    <content type="html"><![CDATA[<p><a href="https://en.wikipedia.org/wiki/HTML5">HTML5</a> changed the semantic meaning of some elements and there has been little talk about it. I stumbled upon the difference while reading the <a href="http://www.w3.org/TR/html5/">HTML5 specification</a> for the <a href="https://github.com/Masterminds/html5-php">PHP HTML5 parser and serializer</a>. What has changed is that there is now a difference between strong and bold along with a difference between emphasized and italics.</p>




<p>These elements have had quite a history.</p>




<h2>Bold and Italics Before HTML5</h2>




<p>Bold was a visual styling and that should be in CSS rather than tags, right? So, we have the strong tag. The same type of thing happened for the italics tag. In the <a href="http://www.w3.org/TR/html4/struct/text.html#h-9.2.1">HTML4.01 spec</a> and <a href="http://www.w3.org/TR/xhtml11/xhtml11_schema.html#a_xhtml11_schema">XHTML</a> specs there were no longer bold or italics tags.</p>




<p>But, they didn't go away. Not in use.</p>




<h2>Strong and Bold</h2>




<p>In HTML5 <code>&lt;strong&gt;</code> and <code>&lt;b&gt;</code> both exist and have a different meaning.</p>




<p>The <code>&lt;b&gt;</code> tag is for "offset text conventionally styled in bold". If you read deeper into <a href="http://dev.w3.org/html5/markup/b.html">the details</a> you'll see it adds, "without conveying any extra emphasis or importance".</p>




<p><code>&lt;strong&gt;</code> <a href="http://dev.w3.org/html5/markup/strong.html">is different</a>. It "represents a span of text with strong importance." There is semantic meaning of importance here. In fact, a <code>&lt;strong&gt;</code> tag within another <code>&lt;strong&gt;</code> tag has even more importance. There is nested importance. The <a href="http://www.w3.org/TR/html5/text-level-semantics.html#the-strong-element">html5 spec is enlightening on this</a>.</p>




<h2>Emphasized and Italics</h2>




<p>Just like <code>&lt;strong&gt;</code> and <code>&lt;b&gt;</code> we have changes to <code>&lt;em&gt;</code> and <code>&lt;i&gt;</code>. The <a href="http://dev.w3.org/html5/markup/i.html"><code>&lt;i&gt;</code></a> tag is for "text conventionally styled in italic". There is no semantic meaning. <a href="http://dev.w3.org/html5/markup/em.html"><code>&lt;em&gt;</code></a> "represents a span of text with emphatic stress". Like <code>&lt;strong&gt;</code>, <code>&lt;em&gt;</code> is <a href="http://www.w3.org/TR/html5/text-level-semantics.html#the-em-element">a tag with semantic meaning and that matters when nested</a>.</p>




<h2>Does The Spec Represent The Practice?</h2>




<p>I'm not really sure. We'd need to go to those who read the markup while caring about semantic meaning to find out. I know that many tools don't take this into account. For example, <a href="http://ckeditor.com">CK Editor</a> has buttons for italics and bold but uses the <code>&lt;em&gt;</code> and <code>&lt;strong&gt;</code> tags. This may be a part of HTML5 that just isn't widely understood or used.</p>

<p><a href="https://codeengineered.com/blog/2013/html5-semantic-diff-bold-strong/">Continue Reading &raquo;</a></p>]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[DrupalCamp MI: Secure Your Site]]></title>
    <link href="https://codeengineered.com/blog/2013/drupal-secure-your-site/"/>
    <updated>2013-10-21T09:30:00-04:00</updated>
    <id>https://codeengineered.com/blog/2013/drupal-secure-your-site</id>
    <content type="html"><![CDATA[<blockquote><p>The 2012 Data Breach Investigations Study by Verizon shows that in 855 data breaches they examined, 71 percent occurred in businesses with fewer than 100 employees.</p></blockquote>




<p>When I read <a href="http://www.forbes.com/sites/cherylsnappconner/2013/09/14/are-you-prepared-71-of-cyber-attacks-hit-small-business/">this finding</a> I was reminded of all the sites I'd seen successfully breached over the past several years. The sites of friends. The sites of non-profits. The sites I was asked to take a look at.</p>




<p>This inspired me to present at <a href="drupalcampmi.org">DrupalCamp MI</a> on the topic of security. In the 45 minute time slot I could only cover a fraction of the material I would like to have. For example, I didn't talk about social engineering types of issues. I hope someone presents on that soon.</p>




<p>The slides for this presentation are available on <a href="https://speakerdeck.com/mattfarina/secure-your-site">Speaker Deck</a> and <a href="http://www.slideshare.net/mattfarina/secure-your-site">Slideshare</a>.</p>




<script async class="speakerdeck-embed" data-id="104b433015640131bfc20a79425f9e6c" data-ratio="1.33333333333333" src="//speakerdeck.com/assets/embed.js"></script>




<p>One thing I came to realize is that I'd like to see more sessions and trainings at future DrupalCons and DrupalCamps. It's a good time to raise awareness and teach people practical methods and tools to use in this space.</p>

<p><a href="https://codeengineered.com/blog/2013/drupal-secure-your-site/">Continue Reading &raquo;</a></p>]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Drupal Developer Career Advice]]></title>
    <link href="https://codeengineered.com/blog/2013/drupal-developer-career-advice/"/>
    <updated>2013-08-29T10:20:00-04:00</updated>
    <id>https://codeengineered.com/blog/2013/drupal-developer-career-advice</id>
    <content type="html"><![CDATA[<p>Over the past few years I've been asked career advice numerous times by Drupalers. After some recent discussions I realized there are a lot of Drupal developers who may be interested in the same thing. So, without further adieu here's my advice for the moment.<!--break--></p>




<h2>Know Yourself</h2>




<p>Knowing the details about your personality, strengths, and weaknesses can really help you navigate your career. Consider using toole like <a href="http://www.strengthsfinder.com/">Strengths Finder</a> and learning your <a href="https://en.wikipedia.org/wiki/Myers-Briggs_Type_Indicator">Myers-Briggs type</a>.</p>




<p>None of these is perfect or going to tell you everything. But, they can provide you useful insights into yourself.</p>




<h2>Focus On Your Strengths</h2>




<p>When I was growing up a common piece of advice was work on your weaknesses to become more well rounded. This was bad advice.</p>




<p>Focus on your strengths. Avoid the things you are weak at. Good ways to avoid them are to outsource that work or partner with others who are strong where you are weak.</p>




<p>You can't remove doing all work you are weak at. If you can't avoid it spend as little time doing it as possible.</p>




<h2>Don't Hitch Your Horse To Just One Wagon</h2>




<p>Focusing solely on Drupal development is a bad idea. Before you jump to the comments to argue with me hear me out.</p>




<p>Few technologies stand the test of time. If you go back 5, 10, or 15 years on the web you can see how much things have changed. Good projects from the past have come and gone. Careers tend to last longer than any piece of technology.</p>




<p>Doing just Drupal work can pigeon hole you into just Drupal work. You might find yourself looking for work and people aren't interested. Or, you want to work on a project and they want someone more well rounded.</p>




<p>What does this mean practically? If you are a Drupal back-end developer write something that's not in Drupal. Maybe a PHP CLI application using <a href="http://symfony.com/">Symfony</a>. This is a good place to start and you'll learn a world of other technologies without ever leaving PHP.</p>




<p>If you focus on site building put in some time to using <a href="http://wordpress.org">Wordpress</a>, learn about information architecture, spend time learning customer experience, and so forth.</p>




<p>If you are a front-end developer learn other templating systems. PHPTemplate, the system in Drupal, is a one off solution. Learn other setups like <a href="http://twig.sensiolabs.org/">Twig</a>, <a href="https://en.wikipedia.org/wiki/Haml">haml</a>, or one of the other popular options. Use <a href="http://sass-lang.com/">SASS</a> or <a href="http://lesscss.org/">Less</a>.</p>




<p>If you're feeling really daring, pick up another programming language or learn DevOps.</p>




<h2>Learn, Learn, Learn</h2>




<p>Technology is always changing. What's important in technology is always changing. Go back 5 years. There was no focus on front-end performance. Now it a sub-industry of development.</p>




<p>Always keep learning. Put aside some time each weak for continuous learning.</p>




<h2>A 40 Hour Work Week</h2>




<p>Don't work too much. 40 hours average per week is enough. For some of us it might go up to 50 hours per week. Don't go higher than that if it's within your power. I include side development and free time contributing in this category.</p>




<p>When not working on code do other things. Spend time with family. Have hobbies. Relax. The life we live has so much more to it. People to love and be loved by. Beauty to take your breath away. Friends to have a beer with. Enjoy these things.</p>




<p>By doing this it's easier to focus when at work. Creativity is more likely to flow. There is a desire to get it done rather than <a href="http://www.merriam-webster.com/dictionary/dillydally">dillydally</a>. The focus, creativity, perspective, and added joy you have will show up in reviews, interactions with others, and your career path.</p>




<h2>Take Part In Mentoring</h2>




<p>Have a mentor. Mentors have experience they can share. The kinds of things you can't learn from Google. Well, not yet anyway.</p>




<p>They can talk to you about your career. They can help you see things in ways you don't know about. They can point you to technologies you should look at. They can introduce you to others. When jobs come up they can be references. When they know of good jobs they can point you to them.</p>




<p>Have a mentor. Pick one carefully.</p>




<h2>Stay Focused</h2>




<p>There is so much technology. So many <em>shinny things</em> to distract us. Don't let the distractions take over. Not every problem is yours to solve. Don't go down all the rabbit holes. You might end up in wonderland and have a great time. But, if you can't get your work done it's a problem.</p>




<p>I allow myself some distractions. They are fun and some turned out to be useful. But, the time is limited and the types of things are limited. Just like my backlog, I try to keep a prioritized list of the ones I'll let myself do and a time limit I can spend on them.</p>




<p>Keep the main things the main things. Don't let distractions stop that.</p>




<p>This list isn't trying to tell you where to go. We all have different paths. The idea is to go down your own path without getting stuck and have a good time doing it.</p>

<p><a href="https://codeengineered.com/blog/2013/drupal-developer-career-advice/">Continue Reading &raquo;</a></p>]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Securing Your Site: Clickjacking and X-Frame-Options]]></title>
    <link href="https://codeengineered.com/blog/2013/secure-site-clickjacking-x-frame-options/"/>
    <updated>2013-06-27T10:50:00-04:00</updated>
    <id>https://codeengineered.com/blog/2013/clickjacking-and-x-frame-options</id>
    <content type="html"><![CDATA[<p><a href="https://en.wikipedia.org/wiki/Clickjacking">Clickjacking</a> is one of the malicious attacks used against people on the web. Back in 2009 Microsoft came out with a new measure in IE8 to fight against clickjacking that's since been adopted by Firefox, Chrome, Safari, Opera, and others. This is through servers setting a http header of <em>X-Frame-Options</em> and browsers following the settings.</p>




<p>While The security conscious players like Google, Microsoft, Dropbox, Stackoverflow, Apple, and many others have all implemented this in appropriate places, many of the sites we regularly visit have not yet done so. Some sites not implementing frame protections include drupal.org, wordpress.com (though Wordpress itself has it for login and admin pages), reddit, Evernote, and many others. Since Drupal doesn't have support by default for <em>X-Frame-Options</em> I assume most Drupal sites have not yet implemented this.</p>




<p>If you are interested in learning how to implement <em>X-Frame-Options</em> keep reading as we'll dive into a few ways to do this.<!--break--></p>




<h2>The Basics</h2>




<p>A great place to learn the basics is on <a href="https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options">the Mozilla Developer page about <em>X-Frame-Options</em></a>. For the purposes here we'll only look into the options that have wide adoption. These are:</p>




<ul>
<li><strong>DENY</strong>: When the <em>X-Frame-Options</em> http header is set to this value a page can never be embedded in a frame/iframe.</li>
<li><strong>SAMEORIGIN</strong>: In this case only the originating domain can embed pages in a frame/iframe. This is specific to a domain including the subdomain. Pages on foo.example.com cannot embed pages from bar.example.com if this value is used.</li>
</ul>




<h2>Apache Setup</h2>




<p>Apache can be setup to use one of these values by default. If <em>mod_headers</em> is installed than this setting can be used:</p>




<pre><code>Header always append X-Frame-Options SAMEORIGIN
</code></pre>




<h2>Nginx Setup</h2>




<p>For nginx in the server or location configuration you can use something like:</p>




<pre><code>add_header X-Frame-Options SAMEORIGIN;
</code></pre>




<h2>In PHP</h2>




<p>In any PHP application the header can be set before page content is sent. This is done using the <a href="http://www.php.net/manual/en/function.header.php">header</a> function.</p>




<pre><code>header('X-Frame-Options: SAMEORIGIN');
</code></pre>




<h2>Drupal</h2>




<p>I want to touch on Drupal for a moment because it's the second most widely used CMS. I would talk about Wordpress, but they already covered their basis on this. Drupal has a custom way to deal with headers through the use of <a href="https://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/drupal_add_http_header/7">drupal_add_http_header</a>. Using this function you could do:</p>




<pre><code>drupal_add_http_header('X-Frame-Options', 'SAMEORIGIN');
</code></pre>




<p>This could be used for specific paths or site wide. If you are using the Overlay module you'll want to use <em>SAMEORIGIN</em> rather than <em>DENY</em> or the overlay will not work.</p>




<p>Alternately, the module <a href="https://drupal.org/project/seckit">seckit</a> provides some security options including this one. I have not used this module and make sure you thoroughly check it out before using it.</p>

<p><a href="https://codeengineered.com/blog/2013/secure-site-clickjacking-x-frame-options/">Continue Reading &raquo;</a></p>]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[How Drupal Is Like Enterprise Software]]></title>
    <link href="https://codeengineered.com/blog/2013/drupal-like-enterprise-software/"/>
    <updated>2013-05-23T09:30:00-04:00</updated>
    <id>https://codeengineered.com/blog/2013/drupal-like-enterprise-software</id>
    <content type="html"><![CDATA[<p>Drupal is a lot like enterprise software. Before you think this is a bad judgement on Drupal or a slur please hear me out. It's more a description of Drupal based on my experience with it for nearly 8 years and my last couple years dealing with enterprise software. I want to dive into some specific points that may be good, bad, and even make us unhappy with some of the things that make us happy.<!--break--></p>




<h2>Architecture</h2>




<p>One of the surprising things about enterprise applications is that I've found one architect in the application often doesn't know how the whole thing works. The software is complicated and applications can end up with numerous people who have architect in a title. Drupal has a similar experience. With all of the things going on, even the wisest of contributors and initiative leads don't know how the whole thing works.</p>




<p>Drupal is complicated like enterprise software.</p>




<h3>Monolithic</h3>




<p>It recently struck me that Drupal is a fairly monolithic application. A trend in applications is to have small parts that operate together to create a whole. For example, one application provides the user interface. That application talks to an API server. The API server schedules things to happen via a queue. Workers grab items from the queue and act on them. In this picture each of the different types of things is a different application.</p>




<p>Or, you could have a small application. I think of Wordpress as a fairly small application and it comes in around <a href="http://www.ohloh.net/p/wordpress/analyses/latest/languages_summary">200k lines of code</a>. For a small application it does a lot.</p>




<p>Drupal is nearing <a href="http://www.ohloh.net/p/drupal/analyses/latest/languages_summary">950k lines of code</a>. I won't be surprised when it passes 1 million lines of code. This is just core and no one just builds a site with core anymore.</p>




<p>Drupal also does a lot. Sites can have a message queue (using Drupal), caching (using database caching through Drupal), and so much more. It's big.</p>




<h3>Drupal Specific Terms and UI</h3>




<p>I've had the opportunity to teach people about Drupal who have had years using web applications, have worked with content and other CMS, and some who write applications. I've learned there are a lot of Drupalisms. A whole vocabulary has grown around Drupal and you have to have domain knowledge to use Drupal, build with it, or just understand conversations around it. In addition the UI isn't intuitive to outsiders. Someone needs to understand the product down to the major version to perform everyday tasks.</p>




<p>These are both elements I've found in enterprise software. In many ways these custom aspects lock users into the product because it raises the barrier to go to other products due to change. If successful it can help build an ecosystem around the product (more on that later).</p>




<h3>Major Version Update… What?!?!</h3>




<p>Have you tried to update major versions of a Drupal site? How about updating when you jump a major version? Going from Drupal 7 to 8, much less Drupal 6 to 8, is going to be a huge effort for anyone who tries to take it one. The architecture changes that happen between major versions means custom code needs to be rewritten, contributed modules need to work and have an update path, and the data needs to be migrated because it often can't just be updated.</p>




<p>This can be costly. It can end up in the hands of consultants to handle the upgrade just to keep the same base functionality. That doesn't even mean adding support more responsive design.</p>




<h2>Ecosystem - Consultants and Partners</h2>




<p>Many enterprise software applications will have an ecosystem around them. There will be partners that sell the software. There will be partners that support the software. There will be consultants who help those who implement the software do so. When you have a complicated piece of software someone new to implementing it needs the ecosystem.</p>




<p>Does this sound at all like Drupal (with the exception of selling Drupal)? Drupal has an amazing ecosystem around it with many fantastic people. And, many companies could not implement Drupal as a solution without them.</p>




<h2>I'm Not Complaining</h2>




<p>I could continue on this thread but many people won't continue to read (short attention spans). I'm not complaining but merely observing what Drupal has become.</p>

<p><a href="https://codeengineered.com/blog/2013/drupal-like-enterprise-software/">Continue Reading &raquo;</a></p>]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Designing A New Landing Page]]></title>
    <link href="https://codeengineered.com/blog/2013/designing-new-landing-page/"/>
    <updated>2013-03-29T10:00:00-04:00</updated>
    <id>https://codeengineered.com/blog/2013/designing-new-landing-page</id>
    <content type="html"><![CDATA[<p><img src="https://codeengineered.com/media/images/screen-shots/hpcloud-2013-new-homepage.png" alt="HP Cloud Homepage" /></p>




<p>At HP Cloud we just launched a new homepage design (pictured above). The process to craft this landing page is one I think is worth exploring because it can help anyone with their landing pages or even broader products.<!--break--></p>




<h2>The Process and People</h2>




<p>I recently wrote about a <a href="https://codeengineered.com/blog/simple-product-design-process/">simple product development process</a>. This is the process I applied to the creation of this new homepage. Following this process had some major benefits that really appeared late in the process. While following a process to design a landing page where design is late in the process may seem odd it actually makes the design work easy while crafting something that works.</p>




<p>Being that HP Cloud, like many organizations, has a number of <em>stakeholders</em> it was important to include the right people at each step while not bringing in everyone for all the steps. When you need to get work done only the people who will contribute to that need to be involved in the development.</p>




<h2>Figuring Out The Target Audiences</h2>




<p>HP Cloud is a web thing so aren't all web users the target audience? The answer is obviously no. The hard question is identifying who the target audience is going beyond base demographic information.</p>




<p>For example, if you are targeting a product at Drupal developers you might not be targeting content managers. Or, vice versa. Knowing who the target audience is up front is really important. At HP Cloud we aren't targeted at Drupal developers but we do know who our audience is.</p>




<p>Before moving on we had a clear and limited list of target audiences for this landing page. This was mapped to the list of personas I maintain because they are really helpful to agree on the details of these audiences.</p>




<h2>Goals Goals Goals</h2>




<p>When crafting a landing page the goal isn't to talk about yourself. Goals allow you to aim for a target, measure success, and compare as you tweak things. Once we had target audiences we gathered up the goals for the homepage. Having target audiences before goals I find to be very important. Goals aren't just goals. They are goals for a target audience.</p>




<h2>The Content</h2>




<p>Once we had gathered the audiences and goals it was time to craft the content. The fabulous folks in marketing wrote some new content that was:</p>




<ol>
<li>Written towards a target audience.</li>
<li>In prioritized order.</li>
<li>Written to meet the goals.</li>
</ol>




<p>When we shared the content, before there was ever a design, there was push back. People would ask, where is my thing on the homepage? Having the target audiences, goals, and prioritized content made it easy to talk through this. When something wasn't on the homepage (or any landing page) it's easy to ask how it helps meet a goal for a particular type of audience. If there is no easy justification it's easy to justify it not being on the page.</p>




<h2>The Design</h2>




<p>Once all of this is done the design work began. I intentionally held off design to this point so everything would be in place to make it easy. Instead of wondering, going back with lots of questions, or having to be creative on content I was able to just design. Having content in prioritized order was really nice because what you see on the page is the prioritized order. If/when we go to a responsive or mobile design we can flow things based on the priority.</p>




<h2>Building It</h2>




<p>Once the design was complete and signed off it was time to build it. This is a <a href="http://drupal.org">Drupal</a> site. <a href="https://drupal.org/user/563782">Ryan Peters</a> took the design and turned it into something editable by our content managers using the base platform we already have in place.</p>

<p><a href="https://codeengineered.com/blog/2013/designing-new-landing-page/">Continue Reading &raquo;</a></p>]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[A Simple Product Design Process]]></title>
    <link href="https://codeengineered.com/blog/simple-product-design-process"/>
    <updated>2013-01-29T12:00:00-05:00</updated>
    <id>https://codeengineered.com/blog/simple-product-design-process</id>
    <content type="html"><![CDATA[<p>For people who don't do website and web application development regularly it can become easy to get lost in the process. For example, they may want a design for a page with look and feel before they even know what content will be on that page. To help product owners, content owners, and those involved in development who aren't familiar the ins and outs I've put together a diagram and process to help walk them through what's happening and what's needed.</p>




<p><img src="https://codeengineered.com/media/images/persona-to-design-process.png" alt="Process Diagram" /></p>




<p>This process is meant to be a simplification bordering on over simplification. Let me break down each of these parts.<!--break--></p>




<h2>Persona / User</h2>




<p>Before you can build anything you need to know who you are building it for. Creating something for an open source developer is radically different than creating something for someone in the office of the CIO at an enterprise. They talk differently, have different needs, approach a situation with a different context, and so forth.</p>




<p>This all needs to begin with an understanding of who a user type is at a non-trivial and non-demographic level. The best way I've seen to do this in a manner that can be used by a UX developer, a marketer, someone in sales, and so forth is to use <a href="https://en.wikipedia.org/wiki/Persona_%28marketing%29">Personas</a>.</p>




<h2>Goals</h2>




<p>Once you know who your users are you need goals. And, "tell customers all about our stuff" is a terrible goal. The goal should be for a persona not you.</p>




<p>Some good goals could look like:</p>




<ul>
<li>A product manager signs up for our email list where they can learn about product updates.</li>
<li>A potential developer customer completes the online registration form.</li>
<li>A developer can easily navigate to service documentation.</li>
</ul>




<p>These should be specific to the personas and what they are willing to do. You don't want a goal that would be out of the nature for a Persona.</p>




<h2>Content / Experience</h2>




<p>Once you have goals and know who your users are content and an experience can be crafted. It's important to wait until this point to craft content and an experience so as to do it well. For example, content about a product written to a developer or someone in the office of the CIO at an enterprise will be different. Or, a goal of getting an individual developer to sign up for an account will be very different from that of someone in enterprise management.</p>




<h2>Design / Veneer</h2>




<p>Once you have content and an experience you can design it. You can create the pretty icons, figure out page layout, pick your fonts, and so forth. And I mean this in all the ways that go beyond veneer.</p>

<p><a href="https://codeengineered.com/blog/simple-product-design-process">Continue Reading &raquo;</a></p>]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Successfully Commenting Code]]></title>
    <link href="https://codeengineered.com/blog/successfully-commenting-code"/>
    <updated>2012-11-14T08:22:00-05:00</updated>
    <id>https://codeengineered.com/blog/successfully-commenting-code</id>
    <content type="html"><![CDATA[<p>When it comes to commenting code there are two sides that often come up in discussion. On one side I'll regularly hear that code itself is readable so there is no need to comment it. And, typically code does speak for itself. Some elements of code I like commented so I don't have to think about them each time I scan them, like crazy regular expressions.</p>




<p>On the ofter side of the argument is that all code needs to be commented. In many discussions, including many I've contributed to, what and why code needs to be commented isn't clear. And, the truth is the lines of code themselves don't usually need to be commented. But, there is a lot that does need to be commented. Here I'll touch on 3 types of code comments that have little to do with the lines of code themselves.<!--break--></p>




<h2>Why Does The Code Do What It Does?</h2>




<p>Have you ever started to work on a project that was already well developed but had few or no comments? I worked on a codebase like that in the past year. I kept asking the question, why did they do it that way? In order to figure that out I had to bug (and in some cases annoy) people to figure it out. I didn't want to change something important because of my newness and ignorance of the codebase I was working on.</p>




<p>Code comments that explain why something was done in a certain way are really helpful. That context you have in your head while writing code isn't something the next person will have who touches the code. And, you might not remember it when you work on the code a year from now. Adding that context as code comments can be really helpful.</p>




<p>For example, take a case where code works against an API and while writing it you learn a nuance about the API. Will you always remember that nuance? Will the next person know it who hasn't done the work you did? Adding a code comment explaining what's happening can be very helpful in the future.</p>




<p>Another example is to document your assumptions and business rules. Sure, there might be a ticket number in the commit message where the code was added. But, how often do people look at code that way? If details about some assumption or reason are in a code comment it makes it much more clear.</p>




<h2>References</h2>




<p>Code comments should reference relevant documents, other code, specs, etc. If someone comes along later to work on the code it would be great if they could see the reference used and go read it themselves. It's much easier and faster than trying to search the web for the right version of the right one. Or, if you go backand what it returns plus any nuance to using it. While the name of a method may tell me what it does that doesn't mean I know what the inputs are and all possible returns.</p>




<p>If I think of code as a <a href="https://en.wikipedia.org/wiki/Black_box">black box</a>, which I often do, I want to know about the inputs and outputs. This is where header comments on functions and methods come in. They explain the inputs and outputs for those who don't know or remember the internals and don't need to read the code to use it.</p>




<p>This is popular enough that IDEs and some text editors are able to use these comments to help as we code on the fly.</p>




<h2>In Practice</h2>




<p>I've worked on a lot of code in the past couple years including both overly commented and code without comments. In practice having code comments explaining these three things has made my life a lot easier. And, the absence of them has made it made more difficult to work on a codebase meaning it's taken more time as well.</p>




<p>Well commented code is just easier to work in.</p>

<p><a href="https://codeengineered.com/blog/successfully-commenting-code">Continue Reading &raquo;</a></p>]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Who Are The Drupal Target Audiences?]]></title>
    <link href="https://codeengineered.com/blog/drupal-target-audiences"/>
    <updated>2012-10-17T10:25:00-04:00</updated>
    <id>https://codeengineered.com/blog/drupal-target-audiences</id>
    <content type="html"><![CDATA[<p>Understanding who the target audiences for a product are can go a long way in understanding when and where you should use a product. It sets up questions like, what features do these target audiences need? And, how well does the implementation in a product meet that need? Or, are these the target audiences I need to satisfy?</p>




<p>On the flip side, when developing a product it is helpful to understand target audiences. You can look to see what features a target audience needs and evaluate how well multiple options meet that need for that audience.</p>




<p>I've recently started to ask these questions about <a href="http://drupal.org">Drupal</a>. As a popular CMS that is used to power a significant number of sites this is a topic I expected someone would have dove into already. And, while I've found a number of opinions on the topic I did not find much of an overview. So, after a little digging here is what I found.<!--break--></p>




<p><em>Before we dive into the target audiences I would like to note that this is an attempt to document where Drupal is at today and moving towards. This is not an attempt to cover the past and I'm trying not to give my opinion but instead document what's happening.</em></p>




<p>If you're looking for opinions on the topic of who Drupal <strong>should</strong> target you can read what <a href="http://www.disambiguity.com/designing-for-the-wrong-target-audience/" title="Designing for the wrong target audience (or why Drupal should be a developer tool and not a consumer product)">Leisa Reichelt</a> and <a href="http://www.garfieldtech.com/blog/drupal-priorities" title="Drupal's audience priorities">Larry Garfield</a> have written.</p>




<h2>Content Readers</h2>




<p>This is the largest target for Drupal and the one I think I've read the least about being targeted. When we're creating Drupal and using Drupal to build sites we have to keep this group in mind. There's no reason to publish content if you aren't trying to get people to read it, right?</p>




<p>There an easy place to see this in Drupal as a target. Look at how there is a <a href="http://groups.drupal.org/drupal-initiatives">Drupal 8 initiative</a> for mobile. This recognizes the migration of content consumers to different devices. While there are definitely parts of this that play well for other audiences it very nicely targets this audience.</p>




<h2>Content Authors and Editors</h2>




<p>Drupal is a CMS and someone has to write and manage content for readers. I think this audience has been highlighted through efforts like <a href="http://buytaert.net/starting-to-work-on-drupal-7" title="Starting to work on Drupal 7">WYSIWYG in core</a> among numerous other things. <em>Note, if you want to help with WYSIWYG in core there is <a href="http://drupal.org/node/1809702">an issue for it</a>.</em></p>




<h2>Admins</h2>




<p>I'm calling Admins the people administer the site. They handle module and core updates. They are the ones who may create the user accounts, manage mail settings, etc.</p>




<p>Drupal has long targeted this group. In Drupal 7 the built in update manager is one example. How Drupal has a pattern of settings being stored and changed through the UI making it easy for admins is another.</p>




<h2>Site Builders</h2>




<p>When I started using Drupal this target didn't appear on the radar. This target has now become one of the most significant and power that Drupal targets. Through the development of modules like CCK (now fields in core), Views, and several others Drupal has put the power to build features, data models, content displays, and more in the hands of people with ideas without requiring them to learn to program. This is a very powerful idea and one Dries has said openly Drupal is targeting.</p>




<h2>Developers</h2>




<p>Developers is an easy group to describe, right? In all seriousness developers is the most controversial group where the Drupal community has the strongest opinions in my experience. Since developers is really a mix of sub-groups I wanted to try and <em>document</em> those.</p>




<h3>Front End Developers and Themers</h3>




<p>Drupal is targeting front end developers in an interesting way. There are really two groups of these being targeted right now. The more well known of these is typically called themers. Themers are a group of people who can map a design to the Drupal theme (templating) system. They know CSS, how to create templates in the Drupal way, how to override default Drupal markup, etc.</p>




<p>Then there are front end developers from the web at large. In my past with Drupal I've not really noticed these front end developers being targeted. With some of the contrib work in Drupal 7 and some of the efforts going into Drupal 8 I see this group starting to rise up. Some of the decisions being made in the development of Drupal 8 is with this group in mind.</p>




<p>I will personally be interested to see how these slightly different groups who do the same types of things work out as target audiences through some of the changes Drupal is making right now.</p>




<h3>Professional Programmers</h3>




<p>Drupal 8 has definitely moved into the realm of professional programmers. It can be seen in how Drupal has added more complex programming concepts. This should not be a surprise since lots of core work comes from consulting companies, companies that have services built on Drupal, and so on. Lots of professional programmers are working on Drupal. Because of this the target audience of programmers is moving to people who can work with these more complex concepts.</p>




<p>Now, I'm not going to go into what a <em>professional</em> programmer has in their expectations other than to note Drupal is being driven by programmers who do it professionally.</p>




<p>Also note, I do consider there to be a difference between software engineering and programming which is not lost here. But, the difference between software engineering and programming is best left for another post.</p>




<h3>DevOps</h3>




<p>The popularity of Drupal has lead it to being used on more complex deployments and the rise of DevOps has put it on a lot of radars. Drupal has started to show it is targeting this group through things like the new core release schedule and conference tracks for DevOps.</p>




<h2>A Group Drupal Is No Longer Targeting</h2>




<p>When I first started using Drupal it was something a weekend warrior programmer could jump in and work with. I know a number of core developers who jumped in this way and eventually became professional programmers because of this. But, over time the ways Drupal is being used have changed, the people contributing to core have changed, the use cases Drupal is being applied to solve have changed, and the people who have been around driving things have themselves changed.</p>




<p>Drupal no longer targets the weekend warrior programmer. In a subtle nuance, much of what those programmers used to do (and what I did when I started using Drupal) can be accomplished through site building.</p>




<p>This doesn't mean weekend warriors are no longer a target. It doesn't mean that weekend warrior programmers are still not around. It just appears that they are no longer a target audience in practice.</p>

<p><a href="https://codeengineered.com/blog/drupal-target-audiences">Continue Reading &raquo;</a></p>]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[PHP, Anonymous Functions, Closures, and QueryPath]]></title>
    <link href="https://codeengineered.com/blog/querypath-anonymous-functions"/>
    <updated>2012-10-16T10:20:00-04:00</updated>
    <id>https://codeengineered.com/blog/querypath-anonymous-functions</id>
    <content type="html"><![CDATA[<p>When I first started using <a href="http://jquery.com">jQuery</a> I was pulled into the pattern of using <a href="https://en.wikipedia.org/wiki/Anonymous_function" title="Wikipedia: anonymous function">anonymous functions</a> and <a href="https://en.wikipedia.org/wiki/Closure_%28computer_science%29" title="Wikipedia: Closure">closures</a>. After learning how to properly use these language features (as opposed to overusing them which can lead to untestable code) I wanted to use them in <a href="http://php.net">PHP</a>. Fast forward several years and they are available in all supported PHP versions.</p>




<p><a href="http://querypath.org">QueryPath</a>, put simply, is jQuery written in PHP for server side manipulations. Now that I can easily use anonymous functions and closures I can write and read functionality that looks more like the jQuery I've been writing for years.<!--break--></p>




<h2>Anonymous Functions and QueryPath</h2>




<p>Before PHP 5.3 was around a form of anonymous (a.k.a. lambda) functions were around through the use of <a href="http://www.php.net/manual/en/function.create-function.php"><code>create_function()</code></a>. Unfortunately, this method had a number of drawbacks making it something I avoided using.</p>




<p>In PHP 5.3 <a href="http://www.php.net/manual/en/functions.anonymous.php">anonymous functions</a> were introduced in a familiar manner. I find the easiest way to look at these is by example.</p>




<pre><code>$foo = function($bar) {
  print $bar . "\n";
}

$foo('Hello World');
</code></pre>




<p>Now, let's apply this style function to QueryPath.</p>




<pre><code>$doc = qp($file);

$doc-&gt;find('.foo')
  -&gt;each(function($index, $item) {

    // $item is a DOMElement
    $bar = qp($item);

    // Do something to each item in here.
  });
</code></pre>




<p>The <code>each</code> method can accept a number of things. This can include a callback function, an anonymous function, or anything that's <a href="http://us2.php.net/manual/en/function.call-user-func.php" title="PHP Docs: call_user_func()">callable</a>.</p>




<p>In this case using an anonymous function turns out to be fast. In my case and tests it ran faster than a normal callback function.</p>




<h2>Closures and QueryPath</h2>




<p>According to <a href="https://en.wikipedia.org/wiki/Closure_%28computer_science%29" title="Wikipedia: Closure">Wikipedia</a>:</p>




<blockquote><p>A closure is a function or reference to a function together with a referencing environment</p></blockquote>




<p>The existing environment is a really important part here. Let's look at an example.</p>




<pre><code>function get_iterator($foo) {

  $bar = $foo * 2;

  return function ($index, $item) use ($bar) {
    // Do something here.

    // $bar is available from the parent environment.
  };
}

$a = get_iterator(2); // $bar is available when $a() is called as 4
$b = get_iterator(4); // $bar is available when $b() is called as 8

$doc = qp($file);
$doc-&gt;find('.foo')
  -&gt;each($a);  // $bar inside $a() is available as 4.
</code></pre>




<p>The environment from <code>get_iterator()</code> is available to the function it returns even outside the original context. It's important to note that this is the environment at the time <code>get_iterator()</code> was called to create the function.</p>




<p>There are many ways closures can be used. For example, they can help setup an environment for anonymous functions to be used and passed around.</p>




<h2>QueryPath and Drupal</h2>




<p>The context for my QueryPath code has been within <a href="http://drupal.org">Drupal</a> and there is <a href="http://drupal.org/project/querypath" title="Drupal QueryPath Module">a module for that</a>.</p>

<p><a href="https://codeengineered.com/blog/querypath-anonymous-functions">Continue Reading &raquo;</a></p>]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Does Drupal Target Developers?]]></title>
    <link href="https://codeengineered.com/blog/does-drupal-target-developers"/>
    <updated>2012-10-09T10:00:00-04:00</updated>
    <id>https://codeengineered.com/blog/does-drupal-target-developers</id>
    <content type="html"><![CDATA[<p>I've heard it said time and time again. I've even said it myself. "<em>Drupal doesn't target developers anymore.</em>" While <a href="http://drupal.org">Drupal</a> does not have a standard listing of target audiences there is talk of an informal direction that's away from developers. But, is this actually true? Or, is it something that's used in a cry of frustration rather than observable? Looking at the details I was surprised at what I found.<!--break--></p>




<h2>Looking at Drupal 7 and 8</h2>




<p>Thinking of modern Drupal development versions 7 and 8 came to mind. For Drupal 7 <a href="http://buytaert.net/starting-to-work-on-drupal-7" title="Starting to work on Drupal 7">Dries had a list of priorities</a> that read:</p>




<ul>
<li>Better media handling</li>
<li>Custom content types in core</li>
<li>WYSIWYG editor</li>
<li>Better performance</li>
<li>Better tools to structure/organize content</li>
<li>Basic Views like module</li>
<li>Automatic upgrade functionality</li>
<li>Improved node access system</li>
<li>Better internal APIs</li>
<li>Better external APIs (import/export, web services)</li>
<li>Usability</li>
</ul>




<p><em>While these were his priorities you may notice several of these did not happen.</em></p>




<p>And for Drupal 8 he has setup a number <a href="http://groups.drupal.org/drupal-initiatives">initiatives</a> that include or have included:</p>




<ul>
<li>Configuration Management</li>
<li>Web Services</li>
<li>Design</li>
<li>Multilingual</li>
<li>HTML 5</li>
<li>Mobile</li>
<li><a href="http://buytaert.net/views-in-drupal-8">Views-in-core</a></li>
<li><a href="http://buytaert.net/layouts-for-drupal-8">Layouts</a></li>
</ul>




<p>When I look through these two lists I see a lot that is developer focused. Better internal and external APIs are definitely targeted at developers and those are 2 of the 11 goals for Drupal 7. When it comes to Drupal 8 configuration management and web services are both things that have a definite impact on coders. The html 5 initiative was for front end developers. Without even digging down into these initiatives I can see a top down approach of developers as a target audience.</p>




<h2>Where Is It Going Wrong?</h2>




<p>If the top down picture shows a focus on developers than why are people complaining? I can't point a finger at Dries for not setting some form of direction around these. It's not a matter of formality because there has been formal direction in some form.</p>




<p>So, where is it going wrong? Why are developer complaining (and sometimes rightfully so)?</p>




<p>Maybe a good place to start is to ask what developers Drupal is and should target. There is quite a gap between a weekend warrior, someone who does that by themselves for small organizations, and someone who is building a service on it or doing large scale applications. That is both in their needs and their background as a developer.</p>




<p>Then we can ask questions like, is Drupal targeted at me? What can Drupal do to have better internal APIs for this or that type of developer?</p>




<h2>Two Warnings</h2>




<p>In this whole thought exercise there are two warnings.</p>




<p>First, we all need to be careful not to blame. In my time in the Drupal community I've learned there are a lot of people who care, are well meaning, and are trying. No one does the <em>best</em> or <em>right</em> thing all the time (or can even agree what that is).</p>




<p>Instead I like to think of this as an exercise in incremental improvement and looking at it from a place of observing the system to spot those opportunities. This is also a way to get a view of what's happening without coming up with an opinion based on frustration with a particular problem.</p>




<p>Second, I hear people say Drupal is for anyone. Or, at least for all developers. This is obviously not the case. For example, a Java developer is not expected to be excited about Drupal. I'm reminded that you can't please all the people all the time but you can displease all the people some of the time.</p>




<p>Coming to a picture of who Drupal is for can help to meet the needs of those people even better while diverting people trying to solve a problem that's not appropriate for Drupal to other places that meet their needs. It can even be a way to help identify others who compliment Drupal and have a better exchange with those projects.</p>

<p><a href="https://codeengineered.com/blog/does-drupal-target-developers">Continue Reading &raquo;</a></p>]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Properly Getting Field Data on Entities (Nodes)]]></title>
    <link href="https://codeengineered.com/blog/properly-getting-field-data-entities"/>
    <updated>2012-09-24T15:45:00-04:00</updated>
    <id>https://codeengineered.com/blog/properly-getting-field-data-entities</id>
    <content type="html"><![CDATA[<p>When I first started using <a href="http://drupal.org">Drupal</a> 7 I was in the habit of typing <code>$node-&gt;field_foo[0]</code> (the Drupal 6 syntax IIRC). I looked at porting this philosophy to Drupal 7 like so many others and ended up at <code>$node-&gt;field_foo[LANGUAGE CODE]</code> to get the array of field values. Isn't that ugly? Are you still doing this? If you are then it's the wrong way and using code like this should be discouraged. Yet, just last week I was talking to someone whose still doing this. It's a rather common practice. So, if you do write code like this let's explore a better way.<!--break--></p>




<p>This all starts with a new function to Drupal 7 called <a href="http://api.drupal.org/api/drupal/modules%21field%21field.module/function/field_get_items/7"><code>field_get_items()</code></a>. This function is designed to get the items while handling the language for you. It works for entities beyond just nodes as well. An example use would be:</p>




<pre><code>$items = field_get_items('node', $node, 'field_foo');
</code></pre>




<p>As an optional 4th argument you can pass in the language code if you are looking for a specific language.</p>




<p>If you look inside <a href="http://api.drupal.org/api/drupal/modules%21field%21field.module/function/field_get_items/7"><code>field_get_items()</code></a> you'll see that it handles the language for you. This function can also be used on any field of any fieldable entity.</p>




<p>Though, if what you're trying to do is style the output of the field you might be better off writing a field formatter.</p>




<p><em>Special thanks to <a href="https://twitter.com/davereid">Dave Reid</a> who was the original person to teach me about this function a lot time ago.</em></p>

<p><a href="https://codeengineered.com/blog/properly-getting-field-data-entities">Continue Reading &raquo;</a></p>]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Some Handy Backup Solutions]]></title>
    <link href="https://codeengineered.com/blog/some-handy-backup-solutions"/>
    <updated>2012-09-20T11:00:00-04:00</updated>
    <id>https://codeengineered.com/blog/some-handy-backup-solutions</id>
    <content type="html"><![CDATA[<p>In <a href="https://codeengineered.com/blog/tales-from-the-field-always-have-backup/" title="Tales From The Field: Always Have A Backup">my previous post I shared some horror stories about about lost data like websites and family photos</a>. Reflecting on these stories lead me to want to share some backup solutions I use or am familiar with. That's what this post is about. If you have some great backup solutions that are sharable please blog about them and post about it in the comments. Or, just post them in the comments. Without further banter, here we go.<!--break--></p>




<h2>Backup and Migrate + HP Cloud</h2>




<p>An easy way to regularly backup sites in <a href="https://drupal.org">Drupal</a> is to use the <a href="http://drupal.org/project/backup_migrate" title="Backup and Migrate Drupal module">Backup and Migrate module</a>. Being an HP Cloud user I use the <a href="http://drupal.org/project/hpcloud" title="HP Cloud Drupal module">HP Cloud module</a> enabling Backup and Migrate to put my backups in object storage. Using Backup and Migrate I don't just want to backup my database but my public and private files as well. To do that there is the <a href="http://drupal.org/project/backup_migrate_files" title="Backup and Migrate Files Drupal module">Backup and Migrate Files module</a>.</p>




<p><em>Note: I'm a fan of having backups in multiple locations. Don't just store your backups with one provider but maybe also have them in a second provider or copy them locally. I've seen it where a backup goes bad and you need it.</em></p>




<h2>Store It In Git + Bitbucket</h2>




<p>Part of backups is the codebase to our sites. If there are custom themes, custom code, or something else with the site that isn't just a straight project (like Wordpress or Drupal) you can have a problem if you think you can reconstruct it.</p>




<p>My solution is to store all my sites in git repositories. I'd first thought of using Github for all of these but the basic (free) accounts don't allow you to have private repos. While I like sharing as much code as makes sense there are things I want to keep in private git repos. For this there is <a href="https://bitbucket.org/">Bitbucket</a>. You can have a lot of private repos.</p>




<p>For anyone familiar with the past for Bitbucket you might not know that it is now owned by <a href="http://atlassian.com">Atlassian</a> who is quite successful with their products. They appear to be a strong parent company who has grown to be strong <a href="http://techcrunch.com/2012/01/16/atlassian-2011-revenues-102-million/">without shady sales people (or even good ones)</a>.</p>




<p><em>Note: there are lots of other good git repo management solutions. For enterprise there is <a href="https://enterprise.github.com/">Github Enterprise</a>, there are open source solutions you can install on your own server, and other competitors to Bitbucket and Github. I've chosen Bitbucket for personal things because it was the most cost effective solution for my case that I found.</em></p>




<h2>Backing Up Personal Computer Files</h2>




<p>I'm a Mac and Linux user which means I can't just use time machine on the Mac to do backups. But, that is where I start. I do use time machine to create backups for some of the Mac computers in my home. In addition one some computers I use <a href="http://www.bombich.com/index.html">Carbon Copy Cloner</a> to make duplicate images of my hard drives. This is great for the case that a hard drive goes bad and I can literally remove the bad one and swap in the cloned drive to be back up and running.</p>




<p>For personal files suck as markdown documents (I only use word documents when I have to) I keep them backed up and shared between computers with <a href="https://www.dropbox.com">Dropbox</a>. This comes in handy beyond backups.</p>




<p>The scripter in me has come up with several scripts that use <a href="https://en.wikipedia.org/wiki/Rsync" title="Wikipedia: Rsync">rsync</a> to keep backups of files in other locations as backups.</p>




<p>There are also a number of services that do backups. Of them the most highly recommended one shared with me is <a href="http://www.crashplan.com/">Crash Plan</a>. It does cross system as a reasonable price.</p>




<h2>What Do You Use?</h2>




<p>These are the solutions in my arsenal. What do you use and how well does it work?</p>




<p><em>Disclaimer: I work for HP on HP Cloud and work on the Drupal module providing the integration.</em></p>

<p><a href="https://codeengineered.com/blog/some-handy-backup-solutions">Continue Reading &raquo;</a></p>]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Tales From The Field: Always Have A Backup]]></title>
    <link href="https://codeengineered.com/blog/tales-from-the-field-always-have-backup"/>
    <updated>2012-09-19T10:35:00-04:00</updated>
    <id>https://codeengineered.com/blog/tales-from-the-field-always-have-backup</id>
    <content type="html"><![CDATA[<p>I've had a lot of people tell me they have backups but have never really needed them. That they thought backups were unnecessary. Some have said they were going to discontinue them. When I think about this I first find it amazing that they have not needed their backups and hope they are someday thankful of that. I think on some horror stories I know where years of good content were lost because of no backups or even cases where backup corruption attacks. If you're on the fence about backups consider a story like this could happen to you.<!--break--></p>




<p>For the record I'm going to keep these stories anonymous. While I think these stories are useful to help us see why we would want backups I'm not going to name my friends and cohorts for the bad or painful things that have happened to them.</p>




<h2>Years of Blog Posts Lost</h2>




<p>A friend of mine used to host his blog with a shared hosting provider. The hosting provider listed on their site that they did backups of the content and it was included in a package. After being with the hosting provider for a couple years they had a catastrophic outage. The codebase and the database were lost. You'd think the codebase (an open source project) would be simple to reconstruct and the host had backups of the database - which wasn't just marketing BS. But, this outage also corrupted the backups. <em>It was all lost.</em></p>




<p>This was a lesson for me in having backups separate from your service provider.</p>




<h2>A Config Glitch Corrupts A Database</h2>




<p>Imagine a site that uses multiple servers and is hosted in a cluster. Deployment management is all nicely scripted. One day a server config update is deployed and it all goes wrong. A regular running script does something that corrupts a database. It was a race condition that would only show up in an outage. Now the site is down. To make matters worse a recent update to the backup scripts caused the compression of the backups to generate corrupt files and no one was the wiser. <strong>The content is corrupt.</strong></p>




<p>This case didn't turn out entirely bad. There was a second set of backups that fired just at deployments and updates in an automated manner. These were used to bring the site back up and visitors were basically unaffected.</p>




<p>The lessons I took away from this story are to test your backups semi-regularly and to create backups right before any kind of update that you test before doing the update.</p>




<h2>Bye bye Family Photos</h2>




<p>Backing up web stuff isn't the only smart thing to do. For example, I know someone who only had their family photos on their laptop. It was a computer used everyday and it didn't seem to have any problems. In fact, no computer this person had owned for the past couple decades had ever had a problem. Then one day part of the hard drive started to go corrupt. It went bad before they realized what happened. Loosing your music and documents is annoying. Loosing photos of your kids is something different all together. I know several people something like this has happened to.</p>




<p>What I took away from this was to make sure my personal stuff was backed up.</p>




<h2>Next Steps</h2>




<p>After writing this I realized it might be useful to share some of the backup strategies I've used or am aware of. Look for a follow-up post with some simple actions people can take to start backing up their stuff.</p>




<p><strong>Update: <a href="https://codeengineered.com/blog/some-handy-backup-solutions/">The post with backup solutions is up</a>.</strong></p>

<p><a href="https://codeengineered.com/blog/tales-from-the-field-always-have-backup">Continue Reading &raquo;</a></p>]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[10 Famous and Good Design Principles]]></title>
    <link href="https://codeengineered.com/blog/ten-design-principles"/>
    <updated>2012-09-14T11:45:00+00:00</updated>
    <id>https://codeengineered.com/blog/ten-design-principles</id>
    <content type="html"><![CDATA[<p>With the announcement of the iPhone 5 my social media has been filled with design opinions. Unfortunately, most of them have been poor in quality and not thought out well. Now, I don't mean just in visual and ascetic design. I mean in product design. When I started to wonder what made a design good I ended up falling back to what the award winning designer Dieter Rams had to say about it.<!--break--></p>




<p><a href="https://en.wikipedia.org/wiki/Dieter_Rams">Dieter Rams</a>, for those of you who don't know, is an award winning designer from decades ago. Even though the advice is decades old it still applies to web and physical products today. The design of Dieter Rams is still influencing designs today. What he did is long lasting.</p>




<h2>The 10 Principles of Good Design</h2>




<p>Without further adieu…</p>




<ul>
<li>Good design is innovative.</li>
<li>Good design makes a product useful.</li>
<li>Good design is aesthetic.</li>
<li>Good design makes a product understandable.</li>
<li>Good design is unobtrusive.</li>
<li>Good design is honest.</li>
<li>Good design is long-lasting.</li>
<li>Good design is thorough down to the last detail.</li>
<li>Good design is environmentally friendly.</li>
<li>Good design is as little design as possible.</li>
</ul>



<p><a href="https://codeengineered.com/blog/ten-design-principles">Continue Reading &raquo;</a></p>]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Understanding How The jQuery Constructor Creates Lots of Extra jQuery Objects]]></title>
    <link href="https://codeengineered.com/blog/understanding-how-jquery-creates-extra-jquery-objects"/>
    <updated>2012-09-04T09:50:00+00:00</updated>
    <id>https://codeengineered.com/blog/understanding-how-jquery-creates-extra-jquery-objects</id>
    <content type="html"><![CDATA[<p>The <a href="http://jquery.com">jQuery</a> constructor, which is what creates the jQuery objects we're used to working with, creates lots of extra throw away jQuery objects. For anyone concerned with performance it's useful to know what's going on so we can take advantage of any performance optimizations. Let me show you what I mean with a simple example. In both <a href="http://code.jquery.com/jquery-1.4.4.js" title="jQuery 1.4.4 source code">jQuery 1.4.4</a> (used in <a href="http://drupal.org">Drupal</a> and still popular) and <a href="http://code.jquery.com/jquery-1.8.1.js" title="jQuery 1.8.1 source code">jQuery 1.8.1</a> (the latest release as of this writing) the following example creates 3 jQuery objects. One of these is returned to be used in chaining or other code.</p>




<pre><code>$('#foo', document);
</code></pre>




<p>If you iterate over a set of 100 items and create a new jQuery object from each of these you end up creating 300 jQuery objects with this method. Let's take a look at what's happening.<!--break--></p>




<p><em>Note: If your jQuery is in <a href="http://api.jquery.com/jQuery.noConflict/">noConflict</a> mode you will need to use jQuery instead of the alias $.</em></p>




<h2>The Constructor: jQuery and jQuery.fn.init</h2>




<p>The source code to look at is for the call jQuery which creates a new object using jQuery.fn.init. In 1.8.1 it looks like (the difference to 1.4.4 is rootjQuery):</p>




<pre><code>jQuery = function( selector, context ) {
  // The jQuery object is actually just the init constructor 'enhanced'
  return new jQuery.fn.init( selector, context, rootjQuery );
}
</code></pre>




<p><code>jQuery.fn.init</code> is a function that deals with all kinds of special cases that might get passed into the jQuery constructor. <em>Knowing how these special cases work can help us create fewer jQuery objects making our JavaScript perform faster.</em></p>




<h2>The Standard Case</h2>




<p>Most of the time if you use jQuery the <em>right</em> way you'll end up creating two objects every time you construct something new with jQuery. One of them is thrown away and eventually caught by garbage collection. But, it's good to know about these throw away objects because they do take time and resources for a JavaScript engine to handle.</p>




<h2>jQuery('#foo')</h2>




<p>Creating a new jQuery object only using a single id creates just one jQuery object. This is a special case jQuery has been optimized for. This is different from the case <code>jQuery('#foo', document)</code> which creates 2 jQuery objects. The case where there is only the id assumes <code>document</code> is the context (for in browser uses).</p>




<h2>jQuery(context).find('.bar')</h2>




<p>If you have a case where you looking for a selector on something other than <code>document</code> than you can create one less object by using <code>jQuery(context).find('.bar')</code> than <code>jQuery('.bar', context)</code>. The reason for this is quite simple. When you call <code>jQuery('.bar', context)</code> the special case is to do <code>jQuery(context).find('.bar')</code>. In addition to one fewer object you also avoid some internal jQuery logic.</p>




<p>Even if you are searching on <code>document</code> and you pass that in as the second parameter you should use the optimization here. <code>$('.bar', document)</code> creates 3 jQuery objects and this optimization works to speed it up and create one less object.</p>




<h2>Element names and 1.4.4</h2>




<p>In jQuery 1.4.4 there is an optimization no longer in the latest jQuery release. If you make a call like <code>$('div')</code>, where you are searching by the name of an element type, it creates just one jQuery object. This is a special case. In jQuery 1.8.1 two objects are created like almost all cases in jQuery.</p>




<h2>Understanding vs. Writing Good Code</h2>




<p>Understanding the jQuery constructor and writing elegant high performance code are two different things. If you want to write high performance jQuery it's useful to know much more of the jQuery source than this, how to take advantage of it, and to know plain JavaScript which, being native code, is faster than user space code.</p>




<p>For anyone who wants to really understand jQuery I recommend reading <a href="http://bit.ly/jqsource">the source</a>.</p>

<p><a href="https://codeengineered.com/blog/understanding-how-jquery-creates-extra-jquery-objects">Continue Reading &raquo;</a></p>]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[A Production / Development Toggle For Drupal 7 With Speedy]]></title>
    <link href="https://codeengineered.com/blog/production-development-toggle-for-drupal"/>
    <updated>2012-08-29T09:24:00+00:00</updated>
    <id>https://codeengineered.com/blog/production-development-toggle-for-drupal</id>
    <content type="html"><![CDATA[<p>When we're developing websites and web applications it's useful to have a separation between a development mode and a production mode. For example, in development mode we may way to do some extra logging, disable caching, display error messages to users, and want the full source of JavaScript sent to the browser. When the site goes into production we want all the caching enabled, minified JavaScript sent to the browser, and extra logging disabled.</p>




<p>This idea of a development mode vs a production mode can be seen all over. If you visit the <a href="http://jquery.com/">jQuery website</a> you'll see the download has a toggle for the development or the production version. In <a href="http://symfony.com/">Symfony</a>, the frameworks whose components are making their way into Drupal 8, it has the difference between app.php (the front controller) and app_dev.php in <a href="https://github.com/symfony/symfony-standard">symfony standard</a>. A production and development version of the app. These are just two examples.</p>




<p>Lets take a look at how we can use the <a href="http://drupal.org/project/speedy">Speedy module</a> to bring some of this concept to <a href="http://drupal.org">Drupal</a> 7.<!--break--></p>




<h2>What Is Speedy?</h2>




<p><a href="http://drupal.org/project/speedy">Speedy</a> is a module that supplies minified JavaScript for Drupal core. Minified JavaScript for Drupal core files is not something that works out of the box. To turn minified JavaScript on and off Speedy adds a toggle to the performance page inside Drupal. This is the feature we are looking to take advantage of.</p>




<p><em>Not sure why why minified JavaScript helps with performance? You can read more at "<a href="https://codeengineered.com/blog/why-minify-javascript/">Why Minify JavaScript?</a>"</em></p>




<h2>Using Speedy for a Dev/Prod Toggle</h2>




<p>Speedy stores the value of the dev/prod toggle in the Drupal variable <code>speedy_js_production</code> with the default value of <code>TRUE</code>. By default we assume the site is in production mode. To take advantage of it you just need to use <code>variable_get('speedy_js_production', TRUE)</code>.</p>




<p>Let's look at an example for inserting a minified or original JavaScript file.</p>




<pre><code>if (variable_get('speedy_js_production', TRUE)) {
  drupal_add_js('path/to/foo.min.js'); // The minified file
}
else {
  drupal_add_js('path/to/foo.js'); // The larger non-minified file
}
</code></pre>




<p>This will work even if the Speedy module is not installed because of the default value of <code>TRUE</code>. If the Speedy module is installed someone will be able to toggle to the non-minified script for testing and development.</p>




<p><em>Note: I realize there are more optimal ways to write this than to use an if/else setup. It's used here to make the example clear.</em></p>




<h2>Drupal 8</h2>




<p>There is an issue to "<a href="http://drupal.org/node/1537198">Add a Production/Development Toggle To Core</a>" for Drupal 8. Whether this will go into Drupal 8 or not is still undecided. It will take some work. If you'd like to help out that issue is where to go.</p>

<p><a href="https://codeengineered.com/blog/production-development-toggle-for-drupal">Continue Reading &raquo;</a></p>]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[Volunteer For Charity at GiveCamp]]></title>
    <link href="https://codeengineered.com/blog/volunteer-for-charity-givecamp"/>
    <updated>2012-08-24T11:05:00+00:00</updated>
    <id>https://codeengineered.com/blog/volunteer-for-charity-givecamp</id>
    <content type="html"><![CDATA[<p>I've heard developers say they want to help non-profits with their technical skills. I know I'm this way. Often times the problem that has scared me away is when I volunteer with an organization they'll think I can be an IT guy for them. I really don't want to do this. What I always wanted was a way to sit down in a focused sprint and do some good for a non-profit. This is where <a href="http://givecamp.org/" title="Coding For Charity">GiveCamp</a> comes in.<!--break--></p>




<p><a href="http://givecamp.org/" title="Coding For Charity">GiveCamp</a> is a series of camps where technical people connect with a non-profit for a focused sprint and hand off a product at the end. For example, a team of 6 might spend a weekend building a website for a non-profit and hand it off to them at the end of the weekend.</p>




<p>Are you a developer, Drupal site builder, designer, DevOps, organizer, sponsor type, or someone else in this arena who wants to help? If so consider volunteering at a GiveCamp or helping to organize one.</p>




<p>I for one will be volunteering at the <a href="http://annarborgivecamp.org/">Ann Arbor GiveCamp</a> coming up in September.</p>

<p><a href="https://codeengineered.com/blog/volunteer-for-charity-givecamp">Continue Reading &raquo;</a></p>]]></content>
  </entry>
  
  <entry>
    <title type="html"><![CDATA[HP Cloud PHP Library and Drupal Module Release]]></title>
    <link href="https://codeengineered.com/blog/hp-cloud-php-library-drupal-module-release"/>
    <updated>2012-08-13T15:45:00+00:00</updated>
    <id>https://codeengineered.com/blog/hp-cloud-php-library-drupal-module-release</id>
    <content type="html"><![CDATA[<p>At <a href="https://www.hpcloud.com">HP Cloud</a> we use <a href="http://php.net">PHP</a> and <a href="http://drupal.org">Drupal</a> to build some of our experience. <a href="https://blog.hpcloud.com/floating-cloud-inside-our-blog-architecture" title="Floating on a Cloud: Inside Our Blog Architecture">Matt Butcher recently wrote about how our Drupal based blog runs on the cloud</a> giving an example of what we're doing. The code that powers our PHP effort lives in a <a href="http://hpcloud.github.com/HPCloud-PHP/">HP Cloud PHP libray</a> and a <a href="http://drupal.org/project/hpcloud">Drupal module</a> that takes advantage of this library. Both of these now have a release.<!--break--></p>




<h2>HP Cloud PHP Library</h2>




<p>The foundation for all of this is a PHP library that currently supports identity services, object storage, CDN, and DBaaS. Our versioning philosophy is that generally available services, like object storage, are <a href="http://semver.org/">semantically versioned</a>. Service still in beta, like DBaaS, may have change but only if absolutely necessairy.</p>




<p>This library is being developed as we need it for our services. So, not every service is covered in the <a href="https://github.com/hpcloud/HPCloud-PHP/tags">1.0.0 release</a>. But, we are using our own cloud so expect more services added to it. If you want to contribute please feel free. This project is on github and we look forward to pull requests and issues.</p>




<p>If you want are interested in an introduction to these services I wrote a 5 part series for the HP Cloud blog.</p>




<h2>The Drupal Module</h2>




<p>To make Drupal play nicely with HP Cloud we released a Drupal module that ties the PHP library into Drupal. For example, you can set public or private files to be served out of object storage rather than the file system. This works for image styles, automatically generated js and css files, and normal uploads. If a container is CDN enabled all these files will be served over CDN as well.</p>




<p>Feel free to dive in and take a look.</p>




<h2>Moving Forward</h2>




<p>Our goal is to share what we can and grow these codebases over time. As more people pick them up and use them we look forward to incorperating even more improvements.</p>




<p>If you have any questions about these please feel free to ask.</p>

<p><a href="https://codeengineered.com/blog/hp-cloud-php-library-drupal-module-release">Continue Reading &raquo;</a></p>]]></content>
  </entry>
  
</feed>