Friday, September 18, 2015

How Instagram Images Enrich the Email Experience - #infographic

Social media + Email marketing: How Instagram Images Enrich the Email Experience - #infographic

In 2015, more than 200 billion emails will be sent and received - daily. 57 percent of these will come from brands.

As competition for consumer attention grows, how can marketers drive action from email subscribers in a significant way? In the following infographic, Curalate and Movable Ink explore how marketers can use Instagram images to enrich the email experience and to drive a highly engaged audience to their site.

by Irfan Ahmad via Digital Information World

ContentTools – Small and Beautiful WYSIWYG Editor

ContentTools is a javascript library for building WYSIWYG editors for HTML content.


by via jQuery-Plugins.net RSS Feed

This week's JavaScript news, issue 250

This week's JavaScript news
Read this e-mail on the Web
JavaScript Weekly
Issue 250 — September 18, 2015
A three parter looking at how ‘proxy’ objects in ES6 allow you to intercept and manipulate calls to other objects using various ‘traps’. Parts two and three dig deep on 12 traps beyond the usual ‘get’ and ‘set’.
Nicolas Bevacqua

React Native was always intended to be cross platform, and now as well as iOS, it supports Android too. Facebook’s Ads Manager app is the first fully cross-platform React Native app.
Facebook

“Seeing the changes in the migration path makes me feel a lot more comfortable. It eliminates most of my fears about my existing Angular 1 projects and their future.”
Aviv Ben-Yosef

Easily deploy and manage applications on your own servers using Deis, the open source application platform. Built upon Docker and CoreOS, this lightweight PaaS can quickly deploy your applications via Dockerfile, Docker Image or Buildpack.
Engine Yard   Sponsored
Engine Yard

Looks at the 0b prefix for binary numbers, 0o for octal, Number.isNan, Number.isFinite, Number.isInteger, Number.MAX_SAFE_INTEGER, and more.
Nicolas Bevacqua

A guide to writing components using Angular 1.x directives and TypeScript to structure your application as close to Angular 2 as possible.
Igor Krivanov

If the meanings of ECMAScript vs JavaScript and ES2016 vs ES6 elude you, this is a quick primer.
Ben McCormick

Christian’s Devday.pl keynote about why he likes JS, how it’s moving forward, and things to keep in mind as you work with it.
Christian Heilmann

Cody Lindley answers common questions about what Babel is, how it lets you use ES6 and ES7 today and whether it is a good fit for your development workflow.
Telerik Developer Network

Fluent is an annual JavaScript and Web Platform conference (which I chair) based on San Francisco. We’re looking for more great speakers for 2016.
O'Reilly Media

Jobs

In brief

Curated by Peter Cooper and published by Cooper Press.

Stop getting JavaScript Weekly : Change email address : Read this issue on the Web

© Cooper Press Ltd. Office 30, Lincoln Way, Louth, LN11 0LS, UK


by via JavaScript Weekly

Build a Face Detection App Using Node.js and OpenCV

Human beings have an innate ability to detect, process and recognize faces — we’re born with it. Computers can do it, too — it just takes some clever algorithms, reams of code and some training of the algorithms.

Face detection is the process of identifying faces in digital images. It shouldn’t be confused with facial recognition — i.e., trying to work out who someone is from a photograph — but it’s the first part of the process. Facial recognition is a huge topic for another time, but face detection is the subject of this article.

To illustrate the process, here’s an example image:

NASA Astronaut Group 15 — original image before face detection

…and here’s what the face detection does:

NASA Astronaut Group 15 — faces highlighted after face detection

(Original image from Wikipedia)

Applications of Face Detection

There are numerous applications of face detection. Some modern biometrics systems detect faces and then use facial recognition to compare those faces to images in their databases, in order to try and identify someone without having to resort to good old-fashioned passwords. Some cameras use face detection for auto focussing. And like so many things, it also has applications in marketing.

For the purposes of this tutorial, we’ll replicate a feature that you may well have used yourself if you’re a Facebook user. When you upload a photo of your friends, Facebook often shows it back to you with any faces highlighted, in order to prompt you to “tag” people in it. We’re going to build something similar.

A Little Background

Before we dig into the code, let’s look at some of the tools and concepts we’re going to be using.

OpenCV and the Viola-Jones Object Detection Algorithm

OpenCV (Open Source Computer Vision) is an open-source library of hundreds of computer vision algorithms. Although OpenCV is written in C++, we can use it in Node.js applications thanks to the opencv package.

Amongst the algorithms implemented in OpenCV is the Viola-Jones object detection framework, which is used to detect features in images.

Face detection is simply a sub-set of feature (object) detection, but the algorithm is geared towards the challenges involved in detecting faces specifically.

Of course when we talk about feature detection in this context, it’s nothing to do with the sort of feature detection provided by libraries such as Modernizr and yepnope!

First presented in a 2004 article by Paul Viola and Michael J. Jones, this approach has become the de facto standard for face detection.

You’ll find some additional resources on the framework listed under Further Reading later on in this tutorial.

Cascades and Classifiers

[author_more]

An important aspect of the Viola-Jones algorithm is a cascade of classifiers, which is described as “a cascade of boosted classifiers working with haar-like features”. In practical terms, what this means is that it’s a set of visual features that OpenCV has been “trained” to look for in an image, in order to identify a particular type of object — in our case, faces. You’ll find more information about cascades and classifiers in the documentation. A cascade designed specifically for identifying faces is provided for us, as we’ll see when we look at the implementation.

Installation

Before we can start playing with face detection, we need to install a few pre-requisites.

The easiest (and recommended) way to get up-and-running is to use Vagrant. You’ll find the necessary configuration and provisioning script in the repository which accompanies this article. If you use this approach, there’s no need to go through these installation steps.

Installing OpenCV

Linux (Debian-based systems)

OpenCV has a number of pre-requisites itself, which we can install using apt-get:

sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev

There are also some optional dependencies:

sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

The easiest way to install OpenCV itself it is to use apt-get:

sudo apt-get install libopencv-dev

At time of writing, this installs version 2.4.8, although the latest 2.x version is 2.4.11 and there is currently a version 3.0.0. However, there are currently issues with the Node.js wrapper on version 3.0.0., so this version is just fine.

Building from Source

If you want to build from source, start by installing the dependencies listed above, then download and extract the files from the downloads page.

As noted above, there are currently issues with the 3.0.0. in conjunction with the Node.js module, so it’s best to download version 2.4.11.

Now we need to build it:

cd ~/opencv-2.4.11
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
make
sudo make install

Be warned, that last step might take a while!

Windows

If you’re using Windows, installation is as simple as downloading and running an executable file from the website. You’ll find a direct link to the latest version (at time of writing) right here.

Mac OSX

The easiest way to install on OSX is to use Homebrew:

brew tap homebrew/science
brew install opencv

You’ll find further instructions here.

Imagemagick

You’ll also need Imagemagick, which is a dependency of the image-processing library we’re going to be using.

Debian-based Systems

apt-get install imagemagick 

Mac OSX

brew install imagemagick 

Windows

Download and run the appropriate Windows Binary Release — which is an executable file — from this page.

Building Our Application

A reminder that all the source code for this tutorial is available on Github.

Let’s start by defining a a few dependencies:

So without further ado, here’s our package.json:

{
  "name": "sitepoint/face-detection",
  "version": "1.0.0",
  "description": "A simple application which demonstrates face detection in Node.js",
  "main": "index.js",  
  "author": "Lukas White",
  "license": "MIT",
  "dependencies": {
    "async": "^1.4.2",
    "busboy": "^0.2.9",
    "connect-busboy": "0.0.2",
    "easyimage": "^2.0.3",
    "express": "^4.13.3",
    "express-handlebars": "^2.0.1",
    "lodash": "^3.10.1",
    "multer": "^1.0.3",
    "opencv": "^3.0.0"
  }
}

Install the dependencies with npm install.

Next, create a few directories:

mkdir public
mkdir public/css
mkdir public/images
mkdir views
mkdir views/layouts
mkdir uploads

Now create a basic layout for our application (views/layouts/default.hbs):

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Face Detection Example</title>
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <link rel="stylesheet" href="/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="/css/styles.css">
  </head>
  <body>

    <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <a class="navbar-brand" href="/">Face Detection Example</a>
        </div>
      </div>
    </nav>

    <div id="main" class="container">
      {{{body}}}
    </div>
  </body>
</html>

I’m referencing the Bootstrap framework to prettify the application slightly, but this is optional. Either download the files yourself, or you’ll find them in the repository which accompanies this article.

Add some basic styles (public/css/styles.css):

#main {
  margin-top: 50px;
}

.frame {
  position: relative;  
}

.frame a {
  display: block;
  position: absolute;
  border: solid 2px #fff;
  border-radius: 50%;
}

.frame a:hover {
  background: rgba(0,0,0,0.5);
}

Continue reading %Build a Face Detection App Using Node.js and OpenCV%


by Lukas White via SitePoint

Dependency Injection on Android With RoboGuice

Introduction

RoboGuice, also called Google Guice on Android, is an easy-to-use dependency injection framework, which can make Android development more intuitive and convenient. Using this framework, you can drastically reduce the amount of code you write for performing common tasks, such as initializing various resources, accessing Android system services, and handling events.

In this tutorial, I will be showing you how to make the most of RoboGuice 3 in your Android projects.

1. Understanding Dependency Injection

Traditionally, if an object depends on something, it is its own responsibility to satisfy that dependency. In simpler terms, if an instance of class A depends on an instance of class B, then the developer is usually expected to call the constructor of class B inside the code of class A. This obviously leads to tighter coupling between the two classes.

Dependency injection is a design pattern in which objects rely on external code, which is commonly referred to as a dependency injector, to satisfy their dependencies. This means that if an object depends on other objects, it doesn’t have to know how to create or initialize those objects. This reduces the coupling between the objects and leads to code that is more modular, easier to modify, and less complex to test.

Thus, by using dependency injection, you can largely do away with constructors and factory methods in your project’s business logic.

2. How RoboGuice Works

Google Guice is a framework that makes it easy for you to create, configure, and use a dependency injector in your Java projects. RoboGuice builds on Google Guice and comes with a pre-configured dependency injector for Android. Simply put, out of the box, RoboGuice knows how to initialize various Android objects, get references to various resources of an app and more.

RoboGuice uses Java annotations, which are nothing but metadata embedded inside Java code, to determine what has to be injected where. Earlier versions of RoboGuice used to process annotations using the Java Reflection API during runtime and were often criticized for being slow. RoboGuice 3, however, comes with RoboBlender, a compile-time annotation processor that drastically improves RoboGuice’s performance.

3. Setting Up RoboGuice

Before you use RoboGuice, you must add it as a compile dependency in your app module’s build.gradle file. As it is available on Android Studio’s default repository, jcenter, doing so requires just one line of code.

To improve the performance of RoboGuice, it is recommended that you also add RoboBlender, an annotation processor, as a provided dependency.

To be able to use RoboGuice’s annotations in your Android activities, their classes must extend RoboActivity instead of Activity. Similarly, if you want to use the annotations inside an Android service, its class must extend RoboService instead of Service.

4. Associating Layouts With Activities

Normally, you would use the setContentView method and pass a layout resource to it in order to set the layout of an Activity. RoboGuice offers an alternative means to do the same thing, the @ContentView annotation.

For example, here’s how you would apply the layout defined in an XML file called activity_main.xml to a RoboActivity called MainActivity:

5. Injecting Views

If you think using the findViewById method and type casting the View object it returns is a lot of work, you can use RoboGuice’s @InjectView annotation instead.

For example, consider the following layout:

To initialize the two UI widgets defined in the XML in a RoboActivity, you could write the following:

6. Injecting Resources

Accessing the resources of your app using the Android API involves lots of different classes and functions. To fetch a Drawable, for example, you would have to use ContextCompat.getDrawable. To fetch an Animation, you would have to use AnimationUtils.loadAnimation.

RoboGuice’s @InjectResource annotation offers a more consistent way to fetch all types of resources. The following code snippet shows you how to inject a ColorStateList, a Drawable, a String, and an Animation resource:

7. Injecting System Services

To get a reference to an Android system service, such as the PowerManager or the Vibrator, you can use the @Inject annotation instead of using the getSystemService method. For example, here’s how you would get a reference to the PowerManager:

8. Injecting Extras

You can use the @InjectExtra annotation to inject the extras that were passed to a RoboActivity. The following code snippet injects an extra whose key is EMAIL_ADDRESS:

Note that @InjectExtra will cause a runtime error if the extra is not present. If the extra is optional, you should include an optional flag whose value is set to true in order to avoid the error.

9. Injecting Your Own Classes

So far we have been injecting items that were specific to the Android SDK. To inject your own classes, you should use the @Inject annotation. @Inject behaves much like Java’s new keyword and you don’t have to make any changes to a class to make it injectable, provided it has a default constructor. For example, consider the following class:

To inject an instance of the Employee class, you would use the following code:

10. Using Custom Providers

If you want finer control over what’s injected when @Inject is used, you need to create your own custom providers.

Let’s create a simple provider that returns a random number every time @Inject is used to initialize an Integer.

Step 1: Create a Provider

A provider is just a class that implements the Provider interface. Therefore, create a new class called MyRandomNumberProvider that implements Provider and override its get method.

As you might have guessed, the return value of the get method is what will be injected when @Inject is used. To return a random integer, add the following code to the get method:

Step 2: Create a Module

To be able to use your custom provider, you need to create a module for it. A module is a class that extends the AbstractModule class. Inside the module, you override the configure method and specify which class the provider should bind to using the bind and toProvider methods.

To create a module for MyRandomNumberProvider, create a new Java class called MyRandomNumberModule and add the following code to it:

Step 3: Register the Module

To let RoboGuice know about your module, you must register it in your app’s AndroidManifest.xml using a meta-data tag. The name attribute of the tag should be set to roboguice.modules and its value attribute should contain the class name of the module.

The provider is now ready. At this point, if you annotate an Integer with @Inject, it will be initialized to a random number.

11. Working With Singletons

If you are a developer who prefers using a singleton to share data between multiple activities and services, you can use the @Singleton and @Inject annotations to simplify your code.

By adding the @Singleton annotation to a class, you can let RoboGuice know that it shouldn’t create more than one instance of the class. The following code creates a singleton called MySingleton:

You can now use the @Inject annotation to inject the singleton into your classes. For example, here’s how you inject MySingleton:

12. Observing Events

By using the @Observes annotation, you can observe various events associated with an Activity. This means, you don’t have to override the onCreate, onResume, and other life cycle methods of the Activity class.

The following code shows you how the @Observes annotation can be used as an alternative to overriding the onCreate and onDestroy methods:

Conclusion

In this tutorial, you learned how to use RoboGuice to make your code more concise and readable. While doing so, you also learned how to use Java annotations and the dependency injection pattern.

To learn more about RoboGuice, I recommend browsing its wiki on GitHub.


by Ashraff Hathibelagal via Tuts+ Code

SQL vs NoSQL: The Differences

SQL (Structured Query Language) databases have been a primary data storage mechanism for more than four decades. Usage exploded in the late 1990s with the rise of web applications and open source options such as MySQL, PostgreSQL and SQLite.

NoSQL databases have existed since the 1960s but have been recently gaining traction with popular options such as MongoDB, CouchDB, Redis and Apache Cassandra.

You'll find many tutorials explaining how to use a particular flavor of SQL or NoSQL but few discuss why you should choose one in preference to the other. I hope to fill that gap. In this article we'll cover the fundamental differences. In a later follow-up article we'll look at typical scenarios and determine the optimal choice.

Most examples apply to the popular MySQL SQL and MongoDB NoSQL database systems. Other SQL/NoSQL databases are similar but there will be minor differences in features and syntax.

The SQL vs NoSQL Holy War

Before we go further, let's dispel a number of myths…

MYTH: NoSQL supersedes SQL
That would be like saying boats were superseded by cars because they're a newer technology. SQL and NoSQL do the same thing: store data. They take different approaches which may help or hinder your project. Despite feeling newer and grabbing recent headlines, NoSQL is not a replacement for SQL -- it's an alternative.

Continue reading %SQL vs NoSQL: The Differences%


by Craig Buckler via SitePoint

Eight Eight – 88 – Malta – Web, Des

88 is offering a client centered experience that incorporates web development, web design, graphic design and brand development in Malta and Libya.


by csreladm via CSSREEL | CSS Website Awards | World best websites | website design awards | CSS Gallery