Thursday, February 18, 2016

5 Reasons Video MUST Be Part of Your 2016 Marketing Budget - #infographic

5 Reasons Video MUST Be Part of Your 2016 Marketing Budget [Infographic]

Did you know that consumers are 10x more likely to engage with video than other blog or social content and that online video traffic will reach 80 percent by 2019?

“There’s a tectonic shift going on across the video marketing landscape. Until recently, animated and online videos were a novel way to delight and educate customers. Using online video to set you apart proved that you were on the cutting edge, and got people talking.

But now, we’re on the verge of something different.With more and more companies incorporating high-quality, meaningful video into their marketing efforts, video is becoming less of a “gee, that’s nice” bonus and more of a necessity. Here are 5 reasons why you definitely want video as a line item in your 2016 budget.”

by Irfan Ahmad via Digital Information World

Ajax/jQuery.getJSON Simple Example

In this article we'll investigate the importance of JSON and why we should use it in our applications. We'll see that jQuery has got us covered with a very nice convenience function.

What is JSON?

[author_more]

JSON stands for JavaScript Object Notation. In simple terms JSON is a way of formatting data for, e.g., transmitting it over a network. In this article we will look at loading JSON data using an HTTP GET request (we can also use other verbs, such as POST).

Why would we choose JSON over say XML? The key advantage of using JSON is efficiency. JSON is less verbose and cluttered, resulting in fewer bytes and a faster parse process. This allows us to process more messages sent as JSON than as XML. Moreover, JSON has a very efficient and natural object representation leading to formats such as BSON, where JSON-like objects are stored in a binary format.

Now let's see how jQuery can help us load JSON-encoded data from a remote source. For the impatient among you, there's a demo towards the end of the article.

JSON jQuery Syntax

The $.getJSON() method is a handy helper for working with JSON directly if you don't require much extra configuration. Essentially, it boils down to the more general $.ajax() helper, with the right options being used implicitly. The method signature is:

$.getJSON(url, data, success);

Besides the required URL parameter we can pass in two optional parameters. One represents the data to send to the server, the other one a callback to trigger in case of a successful response.

So the three parameters correspond to:

  1. The url parameter is a string containing the URL to which the request is sent.
  2. The optional data parameter is either an object or a string that is sent to the server with the request.
  3. The optional success(data, textStatus, jqXHR) parameter is a callback function executed only if the request succeeds.

In the simplest scenario we only care about the returned object. In this case, a potential success callback would look like this:

function success(data) {
  // do something with data, which is an object
}

As mentioned, the same request can be triggered with the more verbose $.ajax() call. Here we would use:

$.ajax({
  dataType: 'json',
  url: url,
  data: data,
  success: success
});

Let's see this in practice using a little demo.

A Sample Application

We will start a local server that serves a static JSON file. The object represented by this file will be fetched and processed by our JavaScript code. For the purposes of our demo we'll use Node.js to provide the server (although any server will do). This means we'll need the following three things:

  1. A working installation of Node.js.
  2. The node package manager (npm).
  3. A global installation of the http-server package.

The first two points are platform-dependent. If you need some help getting either of them set up, you might want to check out our tutorial: A Beginner’s Guide to npm — the Node Package Manager, or Node's download page (npm comes bundled with Node).

The third point can be achieved by running the following from your terminal:

npm install http-server -g

If you find yourself needing a sudo prefix (-nix systems) or an elevated command prompt to perform this global installation, you should consider changing the location of global packages.

Once these requirements are met we can put the following three files in a new folder:

  1. example.js is the JavaScript file to request the data.
  2. example.json is the example JSON file to represent our object.
  3. index.html is the HTML page to call the JavaScript and display the data.

Download Example (Source Files)

From the command prompt we can simply invoke http-server within the new folder. Now http://localhost:8080 should be running the demo.

The Sample JavaScript

The following code is the complete client-side logic. It waits for the DOMContentLoaded loaded event before attaching an event handler to the click event of the element with the ID get-data. When this element is clicked we attempt to load the JSON from the server using $.getJSON(), before processing the response and displaying it on the screen.

Continue reading %Ajax/jQuery.getJSON Simple Example%


by Florian Rappl via SitePoint

Bricks.js – Javascript Masonry Layout Generator

Bricks.js is a blazing fast masonry layout generator for fixed width elements by using javascript.

Features:

  • No required HTML markup or CSS stylesheet
  • Minimal, powerful, and readable configuration
  • Optional resize handling
  • Optimized handling of dynamically added items

by via jQuery-Plugins.net RSS Feed

Cleaning House after Internet Explorer

The new year started great for front-end development. On January 12th, Microsoft ended support for old versions of Internet Explorer. Millions of developers worldwide rejoiced at the news. The last vestiges of the Browser Wars that defined the beginning of the new millenium were finally put to rest.

For at least the last decade, the various versions of Internet Explorer have been the bane of web designers and front-end developers everywhere. The rise of Firefox, Opera and later Chrome showed the world that the web can be so much greater, faster and more secure. Yet, in fear of breaking the web for those who didn’t (or couldn’t) move away from Internet Explorer, we were forced to jump through hoops and bend over backwards to cater to the quirks of these legacy browsers. There is a well known pie chart image (the oldest appearance I could find was in 2007 on www.dezinerfolio.com) that showcases the feelings of the community:

Time Breakdown of Modern Web Design

Fortunately things are a lot better now. We only have to deal with the last incarnation of the Trident engine, namely Internet Explorer 11, which is already a solid modern browser on par with its competition. It is thus the time to clean house and throw away the deprecated tools, processes and techniques. Out with the old…

No More Browser Hacks

The first weapon we had in our arsenal was the browser hacks. A hack is a seemingly incorrect declaration that exploits some parsing errors in the rendering engine. It is used to overwrite the standard declaration with a value that will make the layout look and function properly on that specific browser. There were hacks that targeted single versions of Internet Explorer, while others covered multiple versions. A further classification can be made depending on the format of the hack:

  • Selector hacks: These hacks usually are used to exclude old versions of IE that don’t understand the new syntax.
  • Property/value or attribute hacks: These are the original hacks — exploiting holes in the parsing engine to target specific old versions.
  • Media query hacks: They are used to target/filter various versions of browsers (not only Internet Explorer) based on the support of the syntax for @media declarations.
  • JavaScript hacks: They are used for “browser sniffing”, detecting specific versions of Internet Explorer based on various features supported by the JavaScript engine.

The use of hacks was both complicated and frustrating. Sometimes you had to cascade several hacks one after another, as some parsing errors (that allowed the existence of the hack) were fixed in following versions without removing the rendering problem that required the hack in the first place. Let’s see a few examples of such hacks, restricted to the three versions recently retired:

[code language="css"]
/*========== Selector Hacks ==========*/

/* Internet Explorer 10+ */
_:-ms-input-placeholder, :root .selector {}

/* Everything except Internet Explorer 9 and lower */
html[lang='\
en'] .selector
{}

/*========== Property/Value Hacks ==========*/

/* Internet Explorer 6-8 */
.selector { property: value\9; }
.selector { property/*\**/: value\9; }

/*========== Media Query Hacks ==========*/

/* Internet Explorer 8 */
@media \0screen {}

/* Internet Explorer 10+ */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {}

/*========== JavaScript Hacks ==========*/

/* Internet Explorer 6-10 */
var isIE = !!window.ActiveXObject;

/* Internet Explorer 8-10 */
var isIE = document.all && document.querySelector;
[/code]

For a more comprehensive list of hacks to remove from your code, visit Browserhacks.

Bye Bye Conditional Comments

As we have seen above, the use of CSS hacks is messy, prone to malfunction and (for those of you who are obsessive about their code) making the stylesheet fail validation. Things had escalated to the point where, in November 2005, the guys at Microsoft stepped in and made a call to action for the demise of CSS hacks, urging developers to use conditional comments instead.

Initially conditional comments were used to load extra stylesheets for certain versions of Internet Explorer. At that time the code differences between standard-compliant browsers and Internet Explorer were large enough to make the practice a valid one. When HTML5 became a reality, this was also used to load polyfills that provided the missing support for the new features (we’ll touch this topic later in the article). While this practice was mainly used to target code for IE6–7, you might still encounter it in some legacy code. Let’s have a look at some code samples:

Conditional Comments Used to Load Extra Stylesheets

[code language="html"]
<!--[if lte IE 8]><link rel="stylesheet" href="lte-ie-8.css"><![endif]-->
<!--[if lte IE 7]><link rel="stylesheet" href="lte-ie-7.css"><![endif]-->
<!--[if lte IE 6]><link rel="stylesheet" href="lte-ie-6.css"><![endif]-->
[/code]

Conditional Comments Used to Load JavaScript Polyfills

(code excerpt from the default Bootstrap starting template)

[code language="html"]
<!--[if lt IE 9]>
<script src="http://ift.tt/1ouFrwz;
<script src="http://ift.tt/1Wufk3o;
<![endif]-->
[/code]

The main issue with this approach was that each version of Internet Explorer targeted this way made extra HTTP requests. The developers were forced to search for approaches that offered higher performance. The result was to deploy conditional comments to add extra classes to the <html> tag. This practice was a lot more popular, being used, among others, by the HTML5 Boilerplate framework. By that time Internet Explorer 6 could either be ignored or treated using graceful degradation, while the differences between the more modern versions (IE7–9) and their competition (Firefox, Chrome, Safari and Opera) were small enough not to warrant entire extra stylesheets. The few minor tweaks could be achieved due to the extra specificity provided by classes added to the <html> tag. This is the example most likely to be encountered today, as illustrated in the examples below:

Continue reading %Cleaning House after Internet Explorer%


by Adrian Sandu via SitePoint

Watch: A Lesson on React Props, Defaults and Modules

React and ES6 seems to be on everyone's mind lately. Today I want to show you the ins and outs of React Props written with ES6.

In this video tutorial you'll be learning about properties, defaults, and modules. Why? It will help you understand the basics about the property types your components can receive. Additionally, you will learn about the importing and exporting of modules. Gain confidence and comfort with default properties, which allow your components to be used without any actual properties being passed in. Using this knowledge, you'll be ready to then move on to creating React components using the ES6 specification.

This is one lesson from my latest course React The ES6 Way, available on SitePoint Premium. If you'd like to learn more, check it out!

You can find the code samples for this lesson here: http://ift.tt/1QoC9AU

Loading the player...

Continue reading %Watch: A Lesson on React Props, Defaults and Modules%


by Darin Haener via SitePoint

Quick Tip: Set up Drupal 8 with Composer!

Drupal 8 logo

The recommended approach to getting started with Drupal 8 is now via Composer. An official project template has been created for this. We will create our project directly using the template, which is also available on Packagist.

To create a new project based on this template we can run the following Composer command:

composer create-project drupal-composer/drupal-project:8.x-dev my_project --stability dev --no-interaction

Continue reading %Quick Tip: Set up Drupal 8 with Composer!%


by Daniel Sipos via SitePoint

7 Reasons Why Your Link Building Results Are Frustrating

You've been doing a great job in backlinking but your results are disappointing. What could be wrong with your strategy? And how can you fix it?

Even novice search engine optimizers know that backlinks are a crucial factor for SEO success. Most of us also know that it's link quality, not quantity, that matters.

I assume that none of you are applying a bulk link building strategy, or worse, are paying for links. You do keep your link building act clean and don't do link schemes, but still find your rankings disappointing.

Define 'High Ranking'!

[author_more]

Rankings can be disappointing in numerous ways. Of course, if you are not the top result for your keywords, it's obvious you can always do better, but is this a reason to label your rankings as 'disappointing' or 'frustrating'?

Before we go on with the reasons why your link building results are frustrating, we need to clarify what 'frustrating' is.

First, how do you define 'high ranking'? How high can you rank? Is this always being the top result for popular keywords? If you (or your clients) expect this and won't settle for anything less, then you really have a serious problem – with judgment.

It's great when you are the top result for popular keywords, but in practice unfortunately this doesn't happen even to many top sites. Simply put, your expectations aren't realistic and no link building or any other SEO activity can help you achieve such high rankings.

After you get realistic expectations about what you can achieve in search rankings, you need to sit down and think about whether you really have what it takes to get there. Yes, you could be number one for less competitive keywords. If you are OK with this goal, this is doable, so go for it.

If you are aiming for more, sit down and analyze your chances. Only after you figure out what's realistic to expect, then proceed with the link building analysis. Think about what in your present link building strategy prevents you from reaching your goals.

There are a number of reasons why your backlinks are great (at least in your opinion) while your rankings are everything but. Here are the most common of them:

1. Links from Irrelevant Sites/Pages

The most common reason why your thousands of backlinks don't work is that they are from irrelevant sites or pages. Even if these sites are high ranking, if they are not relevant to your site, these links don't help. In the best case Google just ignores them but in the worst case these links are used against you.

It's really tricky to say what is relevant and what isn't. Since I don't know of any information straight from Google about how Google determines link relevancy, you need to use common sense in this.

For instance, if you are linking to a WordPress template page, links from any Web design/development blog should be relevant. Of course, it's best if you link from a site/page that is only about WordPress, or even better WordPress templates.

Some SEO experts speculate that Google has tightened their relevancy requirements and a link from a general Web design/development blog isn't that relevant anymore but since I don't know of anything from Google that confirms this, I suggest we don't believe it and simply disregard it.

2. Links from Low Quality Sites

Your links might be relevant to your content but if the site they come from is a low quality one (as perceived by Google and possibly common sense criteria), this again could hurt your rankings. Long gone are the days when any link counted. Now, the rankings and the trustworthiness of the source matter a lot.

Unfortunately, there is no universal definition of a low quality site. Generally a site with poor content and low rankings by Alexa, PR, and the other Web site ranking services is considered low quality for the purposes of SEO.

One of the worst places to get backlinks from are link farms. However, even if the site is not a link farm, if it has tons of outbound links, this is bad for you.

Another scenario with low quality sites is when a good site goes bad. It's quite possible that a site was good at the time they linked to you but later this changed. In such cases you might want to contact the Web master of the site and ask for the link to be removed. Alternatively, you can tell Google in your Google Webmaster tools to disavow the link from this site.

3. Low Domain Diversity

If you think that when your links are from relevant, high quality sites only, you are safe, this isn't so. If your thousands of links come from a couple of domains only -- even if they are high ranking and relevant -- this can also hurt.

The reason for this is simple. When your links come from a couple of domains only, this tells Google that you are popular with these sites only. This is why it's best to have, let's say, 5 or 10 links from a domain but have hundreds of domains link to you rather than have thousands of links coming from a couple of domains only. See our domain diversity profile to see what a good domain diversity is:

SitePoint Domain Diversity

Continue reading %7 Reasons Why Your Link Building Results Are Frustrating%


by Ada Ivanoff via SitePoint