Friday, October 28, 2016

Corentin Portfolio

My name is Corentin Fardeau, I’m a french creative developer based in Los Angeles currently interning at watson/DG. I’m a fifth year student at HETIC in Paris.
by via Awwwards - Sites of the day

DividebyFour

Dividebyfour

Long scrolling One Pager for DividebyFour digital agency from Belgium. The full screen scrolling sections are achieved with the awesome fullPage.js plugin. Nice little touch how the off-canvas navigation icon switches between a division sign and an X.

by Rob Hope via One Page Love

Thursday, October 27, 2016

4 Crucial Elements of a Successful Web Design Business

4 Crucial Elements of a Successful Web Design Business

Today, more than one in four small businesses does not have a website. However, many of those small businesses that do not currently have a website plan to create a site in the future.

With startups launching every day, the web design business is in high demand. However, if you want to make your own startup succeed when 75 percent fail, you need to make your web design business shine. Below are four crucial elements of a successful web design business.

by Guest Author via Digital Information World

How to Create an Android Chat App Using Firebase

Effective Domain Model Validation with Hibernate Validator

Let’s face it, domain model validation has always been a pretty untamable beast (and most likely this won’t change anytime soon) because the validation process itself is strongly bound to the context where it takes place. It’s feasible, however, to encapsulate the mechanics of validation by using some external class libraries, rather than messing up our lives doing it ourselves from scratch. This is exactly where Hibernate Validator comes into play, the reference implementation of Java Beans Validation 1.0 / 1.1 (JSR 303), a robust validation model based on annotations that ships with Java EE 6 and higher.

This article will walk you through using Hibernate Validator in a pragmatic way.

The Contextual Nature of Domain Model Validation

Independent of your language of choice, building a rich domain model is one of the most challenging tasks you can tackle as a developer. And on top of that you’ll have to make sure that the data that hydrates the model is valid, thus assuring that its integrity is properly maintained. Unfortunately, in many cases making domain objects valid in the context of the containing application is far from trivial, due to the intrinsic contextual nature of the validation process per se.

To put it in another way: If the arguments taken by a domain object are supplied by the application’s environment (for instance by using plain Dependency Injection, Factories, Builders and so on) rather than by an external upper tier, then validating the object should be straightforward and constrained to a very limited scope.

Conversely, if the arguments in question are injected from an outer layer (a user interface layer is a good example of this), the validation process can be cumbersome and tedious, in most cases leading to having chunks of boilerplate code scattered across multiple application layers.

In the end, everything boils down to this simple yet fundamental question: What makes a domain object valid? Should its state be validated before being persisted or updated in a database, or when passed around to other layer(s)? The logical answer is: It depends. Remember that validation is always contextual! So no matter what approach you use to decide whether your domain objects are valid, Java Beans Validation will make the process easier.

[author_more]

Introducing Java Bean Validation with JSR 303

Prior to Java EE 6, Java didn’t provide a standard way of validating the fields of a domain class by mean of a centralized mechanism. But things have changed for the better since then. The Java Beans Validation specification makes it fairly easy to selectively validate class fields (and even entire classes) by using constraints declared with a few intuitive annotations.

At the time of this writing, JSR 303 has only two compliant implementations that you can pick up out there, Apache BVal and Hibernate Validator. The latter is the reference implementation, which can be consumed as a standalone library, completely decoupled from the popular ORM framework.

With that said, let’s see now how to get started using the Java Beans Validation / Hibernate Validator tandem for performing effective domain model validation in the real world.

Defining a Basic Domain Model

As usual, a nice way to show how to utilize Java Beans Validation for validating a domain model is with a concrete example. Considering that the standard implements an annotation-based validation schema, the classes that are part of the domain model must always be constrained with annotations.

In this case, for clarity’s sake, the domain model I want to validate will be composed of only one naive, anemic class, which will be the blueprint for user objects:

public class User {

    private int id;

    @NotEmpty(message = "Name is mandatory")
    @Size(min = 2, max = 32,
            message = "Name must be between 2 and 32 characters long")
    private String name;

    @NotEmpty(message = "Email is mandatory")
    @Email(message = "Email must be a well-formed address")
    private String email;

    @NotEmpty(message = "Biography is mandatory")
    @Size(min = 10, max = 140,
            message = "Biography must be between 10 and 140 characters long")
    private String biography;

    public User(String name, String email, String biography) {
        this.name = name;
        this.email = email;
        this.biography = biography;
    }

    // Setters and Getters for name, email and biography

}

There is nothing worth discussing except for the constraints declared on top of each field. For instance, the @NotEmpty(message = "Name is mandatory") annotation states that the name field must be, yes, a non-empty string. Even though it’s pretty self-explanatory, the message attribute is used for defining the message that will be displayed if the constrained field raises a violation when being validated. Even better it’s possible to customize many constraints with parameters in order to express more refined criteria. Consider the @Size(min = 2, max = 32, message = "...") annotation. It expresses, well, exactly what the message says. Not rocket science, right?

The specification provides a few more, handy annotations. For the full list, feel free to check them here.

Validating Constraints

At this point, we’ve managed to define a constrained model class by using Java Beans Validation, which is all well and fine. But you might be wondering what are the practical benefits of doing this? The laconic answer is: none - so far. The class is ready to be validated, sure, but the missing piece here is having a mechanism, capable of scanning the annotations, checking the values assigned to the constrained fields, and returning the validation errors (or in JSR 303 terminology, the constraint violations). And that’s exactly how Hibernate Validator works under the hood.

But let’s be frank: The above explanation would be just technical gibberish if we don’t see at least a contrived example that shows how to use HIbernate Validator for validating the User class:

Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
User user = new User("John Doe", "no-mail", "");
validator
    .validate(user).stream()
    .forEach(violation -> System.out.println(violation.getMessage()));

That was really easy, wasn’t it? The snippet first grabs an instance of Hibernate Validator through the static buildDefaultValidatorFactory() and getValidator() methods that are part of the Bean Validation API, and uses the validate() method for validating a potentially invalid user object. In this case, the constraint violations are displayed in the console by using streams and lambdas altogether. It’s possible, however, to get the same result by using a standard for loop rather than the newer forEach.

Encapsulating Validation Logic in a Service Component

Of course, it’s ridiculously simple (and very, very tempting, to be frank) to start dropping Validator instances here and there, and validate the constrained classes in multiple places, even in the wrong ones! But that would be a flagrant violation of the DRY Principle (aka a WET solution) that would lead to duplicated code across several layers. Yes, definitely bad design.

Continue reading %Effective Domain Model Validation with Hibernate Validator%


by Alejandro Gervasio via SitePoint

This week's JavaScript news, issue 307

This week's JavaScript newsRead this e-mail on the Web
JavaScript Weekly
Issue 307 — October 27, 2016
Async functions allow you to write promise-based code as if it were synchronous but without blocking the main thread.
Jake Archibald

A to-the-point guide to setting up ES6, Babel, Gulp, ESLint, React, Redux, Webpack, Immutable, Mocha, Chai, Sinon, and Flow.
Jonathan Verrecchia

Based around V8 5.4 which has 98% coverage of ES6 features. 7.x will get the latest features first, with 6.9 being the new LTS version. Note that there are breaking features, such as unhandled promise rejections emitting process warnings. See this week's Node Weekly for more.
Node.js Foundation

Progress
Kendo UI delivers everything you need to build modern web applications under tight deadlines - from the must-haves Data Grids & DropDowns to Spreadsheet & Scheduler. Choose from 70+ UI components and combine them to create beautiful, responsive apps.
Progress   Sponsor

Moritz Kröger discusses his experiences of using Redux without React — the problems faced, the solutions attempted and lessons learned along the way.
Sitepoint

A new series of five crowdfunded books exploring Modular JavaScript. A draft of the first book, Practical ES6, is available to check out now.
Nicolás Bevacqua

A fun, easily accessible tutorial walking through the bare basics of building a DBN (a design markup language) to SVG compiler.
Mariko Kosaka

Jobs

In brief

Google’s Dart Programming Language Returns to The Spotlight news
TechCrunch

npm 4.0 Released news

New Course: React Native (feat. Redux) ...Build Mobile Apps in JS course
Use the same skills you use on the web to build cross-platform, native applications in JavaScript.
Frontend Masters  Sponsor

Exploring Typed Arrays in JavaScript tutorial
Valerii Iatsko

Building D3 Components with React tutorial
Alan B Smith

3 Cases Where JavaScript Generators Rock tutorial
Gosha Arinich

Stateful and Stateless Components, The Missing Manual tutorial
An in-depth look at what stateful and stateless components are.
Todd Motto

Data Hiding in ES6 tutorial
Lance Ball

Angular 2 Form Fundamentals: Template-Driven Forms tutorial
Todd Motto

Easy Creation of HTML with JavaScript’s Template Strings tutorial
Wes Bos

Playing with Genetic Algorithms in JavaScript video
Building a simple AI tool to find solutions to hard problems. 24 minutes
Nikolay Nemshilov

How to Push a React.js App to Production and Sleep Better at Night video
Testing and monitoring techniques to deliver and maintain a React + Redux app while being able to sleep without fear of everything breaking in the night. 29 minutes.
Emanuele Rampichini

Why GitLab Chose Vue.js opinion
GitLab

HyperDev - Developer playground for building full-stack web apps, fast tools
Combining automated deployment, instant hosting and collaborative editing to get you coding with no setup.
Fog Creek Software  Sponsor

PurpleJS: An Alternative to Node.js for Java Projects tools
A JS app framework that runs on the JVM (Java Virtual Machine).
Enonic

JS Ipsum: Generate Your Own JS Gibberish Text tools
Lunar Logic

Shave: Truncate Text To Fit Within an HTML Element code
Dollar Shave Club

JsonLogic: Serialize and Share Complex Rules as JSON code
Jeremy Wadhams

Swip: A Library to Create Multi Device Experiments code
Expand canvases or active Web page space across multiple devices placed next to each other.
Paul Sonnentag

flv.js: An HTML5 FLV Player code
Bilibili

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

Improving WordPress with These Newly Released Plugins

Whether you're a plugin geek or not, you’ve got to admit there is almost nothing as fascinating as WordPress plugins. From setting up a full featured ecommerce website to adding different minor elements to your website, WordPress plugins are extremely useful for website owners.

As WordPress continues to grow in popularity, new plugins are developed and launched every day. Keeping up to date with these latest releases can be difficult. In this post, I've compiled a list of newly released plugins that can really skyrocket your website traffic and sales.

Duplicate Page

Duplicate Page

Are you looking for a way to cut down on the time required to create similar pages and posts? Unfortunately, cloning or duplicating a page or post is not a part of WordPress core. In order to create the same page, you have to manually create a new page and then copy the content from the original page and then configure its formatting and other settings accordingly.

Well, the Duplicate Page WordPress Plugin has come to the rescue. It has made a really huge splash in the WordPress plugin directory after it’s first launch. This easy to use and super-fast plugin enables you to duplicate your site pages and posts with a single click.

The plugin is designed to do one thing perfectly – duplicating a page, post or portfolio item. A new 'duplicate this' feature is added below the post/page editing options upon installing and activating the plugin. Not only can you duplicate the content but also the settings and formatting of the page.

Continue reading %Improving WordPress with These Newly Released Plugins%


by Jason Daszkewicz via SitePoint