Tuesday, January 31, 2017

7 Quick Tips for Redesigning Your Company Logo

When it comes to redesigning logos, graphic designers tend to take one of two views. Some think logo redesigns are easy because the logo already exists—everything's there, so they barely make any changes to it. Others think logo redesigns are a great time to toss the old design out like dirty...

[ This is a content summary only. Visit our website http://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Irfan Ahmad via Digital Information World

MyGreekGames

The company My Greek Games is the \\\’child\\\’ two people with a huge passion and respect for the arts, museums, the history of our country, and with great love for children and their proper upbringing. In light of the above, the idea was b


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

Reverse Agency

PPC agency working with global brands, bringing the same fantastic service to more modest budgets.


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

Alex Zane – Photo/Portfolio WordPre

Alex Zane is a powerful, flexible, and clean photography portfolio theme for WordPress. We designed it with his focus on functionality and ease of use for both the visitor and the WordPress administrator. Simple, intuitive and responsive design looks


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

BrandIn

BrandIn is a Creative Digital Marketing Agency, Formed with the intention of creating entirely new products that harness the power of the web, and in turn, change how people interact with it in the real world.


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

Kerry Ellis Shares Her Passion for Book Cover Design

[special]This post was previously published on the 99designs blog [/special]

It’s not every day we tell you to judge a book by its cover, but in the case of Kerry Ellis (aka Llywellyn) we encourage you to.

Kerry has been a prolific book cover designer on 99designs for more than six years. While she may be modest, her portfolio is vast with inspired covers ranging in style from Saul Bass to Celtic classicism.

We recently chatted with Kerry to learn more about what makes her tick creatively, where she finds inspiration for each cover and who she’s reading right now.

Llywellyn

Name: Kerry Ellis
99designs handle: Llywellyn
Location: United States
Specialty: Book covers

Tell us a little about yourself.

My childhood was spent moving around the States until high school, which gave me a nomadic travel bug at a young age. That led to a study-abroad program in Ireland during my university days, which connected me to a professor who unknowingly set me on my path to become an editor by hiring me for the Writing Center when we got back to campus. I’ve spent more than a decade in various publishing fields as an editor, and I love it.

You’ve been a member of 99designs for a long time (six years!). Can you talk a little about your experience?

Gosh, has it really been that long? I started like most folks with a passing knowledge of Illustrator: thinking I could easily make some extra money by creating logos. I mean, how hard could a logo be, right?

I was horrible at it. Probably better than some, but my first contests on 99designs showed me how much learning I had to do. So there was a long hiatus where I wasn’t very active at all.

After more hands-on experience with layout design at NASA, I returned to the 99designs platform and discovered the book cover category. As an avid reader and full-time editor, I was smitten with this category. That’s when I really found my niche and started to make good progress on the platform.

book-covers

What do you enjoy most about freelancing?

The freedom to choose what I’d like to work on. Since I have a full-time day job, I have incredible freedom in selecting what I’d like to work on during my evenings and weekends. Since it’s work on top of a day of working, it has to be work I’m really going to love doing. Freelancing allows me to do that.

You’re clearly a bibliophile. What do you love most about designing book covers?

The stories! There’s such an endless supply of stories, and I love discovering new worlds and characters through them, then trying to bring them to life.

What do you think is the greatest challenge when a designing book cover?

Condensing what took the author several hundred pages to tell into a single image. This is even more challenging when you don’t have the entire manuscript to read. Given only a short brief, you have to rely on the author to identify what’s truly most important about their work.

Often, they’ve spent so long in the company of their own words, they can lose sight of some of the subtle themes and imagery a designer with fresh eyes might pick up on and run with. Doing all that writing justice is so challenging and incredibly rewarding when you get it right.

busker's holiday

Your style changes for each cover you work on. How do you decide on each specific “look”?

Does it? Funny, because I feel like I’m always doing the same thing: minimalism and grids!

Sometimes the author has a specific style in mind, which will set me down one path of image mining. Other times, a particular word or phrase will create a picture in my mind, and I set about looking for stock photos or old paintings that fit that image but also spark a gut reaction when viewed. Whatever I find that creates that spark ends up driving the style for that cover.

Of course, I do this all with the genre in mind. Each genre has its own look and feel, but I don’t always like to play by those rules (which is probably why I do so poorly in some genres). For example, if a book is a hard-hitting thriller/mystery, I’m not likely to use a frilly script font on the cover.

However, I also don’t want to use the cliché dark-blue-tones-with-big-serif-font style if I can avoid it (I can’t always avoid it, but I’ll start in left field until the author kicks me out of it!).

Man with one of those faces

Has there been an author you loved working with? Or a certain project you’re especially proud of?

Quite a few! But I’ll keep it to a couple of big personal milestones.

The first was a contest for a trilogy. The books were mystery with Celtic mythology as a theme throughout. If you couldn’t tell from my incredibly Welsh username, a quick look at my bookshelves would tell you just how obsessed I am with mythology and all things Celtic. So that contest was personally thrilling for me.

Even if I lost, I had to try because the subject matter was so near and dear to my heart. It ended up being the first big cover prize I won! I was absolutely elated and kept stalking the books’ publication because I honestly wanted to read them. (The first book is finally out!)

the-gondola-maker-1

The next was the contest that gave me enough courage to ask for Platinum promotion: The Gondola Maker. That was an intimidating contest—tons of great talent and entries. I personally love reading historical fiction, which is what first drew me to it, but I had also recently been to Venice and had tons of photos from there (what I feel is my best photographic work to date).

I noticed that none of the entries actually had a gondola maker represented. Now, a lot of times going for the obvious thing is also the dumbest thing for book covers, but I still wanted to give the author something different than pages of gondolas and no makers.

That composite ended up being the largest I’ve cobbled together to date (that’s won): the hands and wood file from one photo, the apron from another, the rolled sleeves from yet another, and the gondola itself from one of my own photos. Then the wax seal, the winged lion, the prow fork—all of which I turned to public domain images for because the required stock purchases were starting to add up.

It turned out better than I could have imagined. The author loved it. And she sent me a few copies, all of which I gave to friends and family except one—my own keepsake. That’s the cover that made me think I was actually good at this and should keep going.

dontbelieveeverythingyoueat

Where do you typically draw your inspiration from?

Art and photography, which are a big part of my background. I love modern art museums and the old masters with their classic portraiture. Art history was one of those university classes that I never, ever missed, and started me on a path of visiting art museums in every city I visit across the globe.

About 8 years ago I started delving into photography and immediately fell in love with the likes of Alfred Stieglitz and George Hurrell (probably didn’t hurt that I’m a classic movie buff). Old tintypes and cyanotypes give me butterflies.

And vintage posters. Alphonse Mucha was the first to draw me into that world, and I simply adore it.

Those are my go-tos when I’m in a rut and need reminding how much great art is out there waiting to be rediscovered and repurposed and introduced to a whole new audience.

blackcrowwhitelie

What are you reading right now? Do you have an all-time favorite book?

I’m in the middle of several books at the moment: The Long Mars, Station Eleven, The Brothers Karamazov, Remembrance of Things Past (which I swear I will someday finish…). I also just bought 6 Thomas Hardy books because I somehow missed reading him entirely during all my years studying literature.

All-time favorite book is tougher. I have many, and each for different reasons. The Lord of the Rings trilogy, because it was my introduction to fantasy fiction courtesy of my father (he gave me his leather-bound copy of The Hobbit, and after I finished it, he surprised me by buying the trilogy for me that week).

Grania, by Morgan Llywelyn, because she blended my loves of Celtic mythology and historical fiction into a powerful woman who I would never had known existed otherwise. So enamored was I that I wrote to Morgan Llywelyn when I went to study abroad in Ireland to ask if I could meet her. To my surprise, she replied and agreed. Unfortunately, her schedule didn’t end up allowing it, but I called her from Dublin right after seeing the real Tara Brooch and had the most wonderful conversation with her.

And The Color of Magic by Terry Pratchett. Because it introduced me to his writing and the Discworld. A journey I’m so sad has ended but I’m forever grateful to have experienced and read.

See more of Kerry Ellis’s work in her portfolio here.

Continue reading %Kerry Ellis Shares Her Passion for Book Cover Design%


by Kelsey Bryant via SitePoint

How to Import Data and Export Results in R

Importing and Exporting data with R

With the craze for "big" data, analytics tools have gained popularity. One of these tools is the programming language R.

In this post, I'll show how to extract data from text files, CSV files, and databases. Then I'll show how to send that data to a web server.

You may be wondering, Do I need to learn a new language all over again? The answer is no! All you need to know is a few commands.

Programmers from diverse backgrounds who work on web applications in a variety of programming languages can import the data into R and, after processing, export it in the format they require.

Note: If you're not familiar with R, I recommend SitePoint's article on how to install R and RStudio. It provides basic commands in R and a general introduction to the language. This post covers commands that can be run on the R terminal without the use of the RStudio IDE. However, handling large datasets on a terminal could turn out to be difficult for beginners, so I'd suggest using RStudio for an enriched experience. In RStudio, you can run the same commands in the Console box.

Handling Text Files

A text file present on your local machine can be read using a slightly modified read.table command. Because it's designed for reading tables, you can set the separator to an empty string ("") to read a text file line by line:

file_contents = read.table("<path_to_file>", sep = "")

Note: where you see angled brackets such as in <path_to_file>, insert the necessary number, identifier, etc. without the brackets.

The path to the file may also be the relative path to the file. If your rows have unequal length, you have to set fill = TRUE as well. The output of this command is a data frame in R.

If your file is too large to be read in one go, you can try reading it in steps using the skip and nrow options. For instance, to read the lines 6–10 in your file, run the following commands:

connection <- file("<path_to_file>")
lines6_10 = read.table(connection, skip=5, nrow=5) # 6-10 lines

Continue reading %How to Import Data and Export Results in R%


by Shaumik Daityari via SitePoint

A Beginner’s Guide to JavaScript Variables and Datatypes

A set of dominoes with symbols representing JavaScript variables and datatypes

So you've decided to learn JavaScript, the programming language of the web. If it seems like a daunting journey ahead and you don't know where to start, here's a little secret: it doesn't take any special skill to learn how to program, and everyone starts at zero. Take it one step at a time, and you'll get there.

Is This Guide For Me?

If any of these apply to you, you'll benefit from reading this guide:

  • You've never used a programming language before.
  • You've never used JavaScript before.
  • You've tried learning JavaScript before but found the resources lacking or hard to follow.
  • You know a bit of JavaScript, but want to brush up on the basics.

In this article, we're going to focus on the fundamentals: syntax, variables, comments, and datatypes. The beauty is that you can apply the concepts you learn about JavaScript here to learning another programming language in the future.

Disclaimer: This guide is intended for complete beginners to JavaScript and programming. As such, many concepts will be presented in a simplified manner, and strict ES5 syntax will be used.

Ready? Let's get started!

What is JavaScript?

JavaScript is the programming language used to make websites dynamic and interactive. It's a client-side programming language, which means the code gets executed in the user's web browser. With the advent of Node.js and other technologies, it can also be used as a server-side language, making it extremely versatile. JavaScript is used primarily for front-end web development and works closely with HTML and CSS.

Note: Java is not JavaScript. It's a different language with a confusingly similar name.

Requirements

You already have the prerequisites to start writing and using JavaScript. All you need is a web browser to view the code, and a text editor to write it. The browser you're currently using is perfect (Chrome, Firefox, Safari, Edge, etc). Your computer comes preinstalled with Notepad (Windows) or TextEdit (Mac), but I would recommend installing Atom or Brackets, which are free programs specifically designed for coding.

CodePen is a website that allows you to write code and make live demos, and it will be the easiest way to start following along and practicing.

Basic Terminology

A programmer writes programs, just as an author writes a book.

A program is just a set of instructions that a computer can read and use to perform a task. Each individual instruction is a line of code known as a statement, which is similar to a sentence in a book. While a sentence in English ends with a period, a JavaScript statement usually ends with a semicolon. Syntax refers to the symbols and rules that define the structure of the language, similar to grammar and punctuation, and the semicolon that ends a JavaScript statement is part of the syntax.

Comments

A comment is a human-readable note written in the code.

Comments are written in plain English with the purpose of explaining the code. Although comments don't technically perform any function in the program, it's crucial to get into the habit of proper documentation to help you or future collaborators understand the intent of your code.

There are two types of comment in JavaScript:

  • A single line comment, written as two forward slashes // followed by the comment.
// This is a single line comment.

  • A multi-line comment, which is sandwiched between /* and */ and can span many lines.
/* This is a comment.
It's a multi-line comment.
Also a haiku. */

Variables

A variable is a container that stores data values.

You know a variable as something that can change. In basic algebra, it's a letter that represents a number. x is a common variable name, but it can just as easily be represented by y, z, or another name.

Initially x has no value or meaning, but you can apply a value to it.

x = 5

Now, x represents 5. You can think of x as a container that's storing 5, which is a number.

In JavaScript, variables work the same, except they can contain more than just numbers as a value - they can contain all sorts of data values, which we'll learn by the end of this article.

Variables are created and declared using the var keyword. We can use our algebra example above to create a JavaScript statement.

var x = 5; // the variable x contains the numeric value of 5.

Building on what we've learned so far, you can see that we have a JavaScript statement that declares a variable (x), assigns the number data type (5) with a single equals sign (=), and explains it in plain English with a comment (//). The statement ends with a semi-colon (;).

Variables only need to be declared with var the first time they're used, and as the name suggests, a variable can change.

Continue reading %A Beginner’s Guide to JavaScript Variables and Datatypes%


by Tania Rascia via SitePoint

enquire.js – Awesome Media Queries in JavaScript

enquire.js is a lightweight, pure javascript library for programmatically responding to media queries.


by via jQuery-Plugins.net RSS Feed

20+ Docs and Guides for Front-end Developers (No. 11)

It’s that time again to get learning! As before, I’ve collected a number of different learning resources, including guides, docs, and other useful websites to help you get up to speed in different areas of front-end development.

So please enjoy the eleventh installment of our Docs and Guides series and don’t forget to let me know in the comments of any others that I haven’t yet included.

1. HTML Canvas Cheatsheet

An HTML Canvas syntax cheatsheet, available in regular web format or as a downloadable PDF or PNG. This cheatsheet has a good overview starting with the basics (shapes, text, colors, etc.) and moving on to more advanced features (images, transformations, animations).

HTML Canvas Cheatsheet

2. ARIA Landmarks Example

An extensive W3C guide providing details for authoring accessible pages using ARIA Landmarks and headings. In addition to the info in the various pages (which cover everything from banner roles regions), the pages have interactive buttons at the top of the page that allow you to view the landmarks and headings visually, which is useful for identifying the organization and structure of a web page.

ARIA Landmarks Example

3. Clean Code JavaScript

Developer Ryan McDermott has put together a comprehensive repository of software engineering principles, from Robert C. Martin’s book Clean Code, adapted for JavaScript. It’s a guide to producing readable, reusable, and refactorable software in JavaScript.

Clean Code JavaScript

4. Know it all

Not so much a guide in itself, but a tool to help you decide which guides, tutorials, etc., to look for. It’s basically a web app in the style of a to-do list that lets you indicate which web platform and Node.js technologies you know or don’t know. The list starts off very broadly and lets you drill down to more specific features under each category.

Know it all

5. Mostly Adequate Guide to Functional Programming

It seems like every week there’s a new resource on functional programming, but this one looks like a good option for experienced programmers and those not yet familiar with functional programming concepts. Written for JavaScript developers, this seems to be a work in progress. The first nine chapters are done and I think that’s plenty to for anyone just getting started with this subject.

Mostly Adequate Guide to Functional Programming

6. Fetch Living Standard on WHATWG

In case you haven’t noticed, the Fetch standard, which is a modern replacement for XMLHttpRequest, now has pretty strong browser support. If you’re looking into making the transition from older techniques to this new API, the official spec might be a decent place to start.

Fetch Living Standard on WHATWG

7. JavaScript Stack from Scratch

This “minimalistic and straight-to-the-point guide to assembling a JavaScript stack” by Jonathan Verrecchia might help developers overcome the complexities of the current JavaScript ecosystem. The guide does not go into details about the individual technologies, but only demonstrates how you can get these up and running.

JavaScript Stack from Scratch

Continue reading %20+ Docs and Guides for Front-end Developers (No. 11)%


by Louis Lazaris via SitePoint

Understanding iOS Proactive Suggestions

With the introduction of the “Proactive” feature in iOS 9, Apple is trying to proactively assist you. The system learns from your actions and attempts to anticipate them. It starts showing suggestions, recommendations, apps you frequently use, etc.

The Handoff feature hasn’t changed but the space usually reserved for it in the lock screen is used for suggested apps. Apps shown in the bottom-left corner of the lock screen and in the app switcher are based on your location or habits. The following screenshots show quick access to the Music app when I plug in my headphones.

iOS has noticed that when I plug in my headphones, I immediately go to the Music app, so it now gives me quicker access to it. The same will happen for an app that uses location. It will appear when you are near your favorite restaurant, for instance.

Spotlight search can be reached from the home menu; by swiping down or by swiping all the way left. The first thing to notice are the Siri suggestions below the search bar. By default, you’ll see the 4 apps you are likely to use at that given time (of the day or night), but it can be expanded up to 8 apps. It also depends on your location, or on whether your headphones are plugged in. So Siri suggests apps depending on your previous behavior or on the time of the day.

In the screenshot below on the left, Siri has suggested messaging apps and a game I currently play. Notice that in the screenshot on the right, the suggestions change as I plugged in my headphones. Just as in the previous example, the system is trying to help access the Music app quicker.

Continue reading %Understanding iOS Proactive Suggestions%


by Deivi Taka via SitePoint

The Cupping Room

The Cupping Room

Beautiful One Page website for 'The Cupping Room' located in Canberra, Australia. The Single Page site features a gorgeous (horizontal) parallax scrolling effect with quality food imagery (pulled from Instagram) in the foreground and shapes in the back. The site was built by ED. who are no strangers to our "Most Loved" award category. Awesome to see this built on WordPress too.

by Rob Hope via One Page Love

How to Migrate to Amazon In-App Purchasing From Google's

Horizon One

Horizon One Page WordPress Theme

'Horizon One' is a One Page WordPress theme suited for a freelancer or digital agency portfolio. It starts a beautiful fullscreen header image and continues with all the sections needed to impress clients. Sections include about, AJAX-loading portfolio, process/device carousal, team, client logos, blog feed and a contact form.

by Rob Hope via One Page Love

Understanding Nested Routing in React

untitled.tiff

untitled.tiff

Experimental One Pager that curates interesting penis illustrations from artists around the globe.

by Rob Hope via One Page Love

Rocco Barbaro

Rocco Barbaro

Minimal personal page for Rocco Barbaro featuring a neat discover function that switches between color schemes and gorgeous little animations.

by Rob Hope via One Page Love

Reaching Millennials With Social Media: New Research

Are Millennials part of your customer base? Wondering how best to reach them on social media? In this article, you’ll discover insights from new research you can use to get your social media messages in front of Millennials. #1: Millennials Are Digital Shoppers Millennials, those individuals born between 1980 and 2000, make up 25% of [...]

This post Reaching Millennials With Social Media: New Research first appeared on .
- Your Guide to the Social Media Jungle


by Michelle Krasniak via

north2

An unusual bunch of creatives who share one vision - making websites that stand out of the many.
by via Awwwards - Sites of the day

Monday, January 30, 2017

Share It While It's Hot: 7 Secrets to Shareable Content

In order online content to be shareable, it must meet countless requirements. Interesting to viewers, usefulness, calls-to-action, and so on. Sometimes, it seems like making the content viral requires magic because it is difficult to surprise people. While it is completely true that viral content...

[ This is a content summary only. Visit our website http://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Guest Author via Digital Information World

Using CDI/Weld to Inject JPA/Hibernate Entity Managers

In this post we'll learn how easy it is to leverage the power of CDI (Contexts and Dependency Injection) / Weld in the development of a full-blow JPA / Hibernate application. The inherently permissive nature of CDI allows to turn literally any class into an injectable component, thus making the injection of Java EE resources as easy as injecting POJOs. This means that, for example, entity managers and even datasources objects can be injected anywhere by using just a few custom qualifiers.

This is a very powerful - yet pretty underrated - feature, quite often overlooked by CDI newcomers, who just don't know that the standard provides this functionality out of the box. Let's see now how to make an entity manager an injectable resource and build a simple JPA application from the ground up!

In a recent article I covered the basics of the CDI / Weld tandem, ranging from using the @Default, @Alternative and @Producesannotations, to working with a few more distilled features, such as polymorphic injection points and custom qualifiers. I used them to develop a naive standalone application, which showed how to inject different implementers of a simple interface into a client object at run time to parse a string entered in the console. We will use these skills now, so if you're not entirely sure how to do those things, read up on it - I'll wait.

Considering that we'll be working extensively with JPA / Hibernate in this walkthrough, I assume that you have at least a minimal background on them - otherwise check this Hibernate tutorial.

Creating an Injectable Entity Manager

The crux of the matter of any CDI-based JPA application is the creation of an injectable entity manager. It's worth noting that regardless of the approach that we use to get the manager, once it becomes an injectable Java EE resource, the entirety of the examples shown in the rest of the post are equally valid. From that point onward, creating and injecting all sort of objects across different layers is quite simple.

So the first task that we need to tackle is exactly that one: making the entity manager an injectable resource. In doing so, we can bind JPA to Hibernate (the reference JPA implementation) and run CRUD operations on some naive JPA entities without hassle.

In fact, there are a few straightforward approaches that we can pick from to accomplish this.

Using the @PersistentContext Annotation

The most painless way, which only works with a Java EE application server, such as Apache TomEE, JBoss Widlfly or Jetty, is the @PersistenceContext annotation. As we might expect, this methodology binds a persistence context (and a persistence unit, of course) to an entity manager, and the manager's lifecycle is entirely managed by the container (aka a container-managed entity manager).

At a broadly generic level, this approach can be implemented by using a custom qualifier like this:

@Qualifier
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD,
        ElementType.TYPE, ElementType.PARAMETER})
public @interface MySQLDatabase {}

public class EntityManagerProducer {

    @Produces
    @PersistenceContext(unitName = "my-persistence-unit")
    @MySQLDatabase
    private EntityManager entityManager;

}

In this case, the unitName attribute specifies the name of a sample persistence unit associated with the corresponding persistence context. So, if you're going to use this approach, make sure the name matches the one specified in Hibernate's persistence.xml file.

With that code in place, a simple DAO class that takes the entity manager in the constructor can be defined as follows:

public class MyDao {

    private EntityManager entityManager;

    @Inject
    public MyDao(@MySQLDatabase EntityManager entityManager) {
        this.entityManager = entityManager;
    }

}

While this will work with a fully-qualified Java EE container (feel free to give it a try if you already have one installed on your system), we don't want to rely on that particular method, since we won't be using a Java EE container for running the JPA application presented in this article.

Using a Producer Method

Just plain Java, CDI, and Weld should get the job done for us. How do we do the injection of the manager in this environment? Well, we can encapsulate the creation of a non-managed entity manager inside a producer method and bind to it a custom qualifier, as follows:

@Qualifier
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD,
        ElementType.TYPE, ElementType.PARAMETER})
public @interface MySQLDatabase {}

public class EntityManagerProducer {

    @Produces
    @MySQLDatabase
    public EntityManager createEntityManager() {
        return Persistence
                .createEntityManagerFactory("my-persistence-unit")
                .createEntityManager();
    }

    public void close(
            @Disposes @MySQLDatabase EntityManager entityManager) {
        entityManager.close();
    }

}

In this case, the createEntityManager() method is responsible for creating the non-managed entity manager through an entity manager factory. As with the first approach, the name of the persistence unit passed to the createEntityManagerFactory() method must be the same as the one defined in Hibernate's configuration file. Make sure to do that, before you pull out your hair trying to figure out why Hibernate can't find a persistence unit to work with.

This is JPA at its most elemental level, so the only point worth stressing here is the use of the @Disposes annotation. It informs the CDI container that this method closes the entity manager, which makes the container call it before releasing the manager.

At this stage, we've managed to create a fully injectable entity manager with a simple producer method. But let's think through this: Why should we bother ourselves with the twist and turns of this process, if we're not going to use the manager in a productive way? Yikes!

As we saw earlier, a typical use case is to inject the manager into a DAO class, something that would allow us to perform CRUD operations on some JPA entities through an easily consumable API, and, best of all, without having to unnecessarily expose from top to bottom the manager's API to client code. The most effective way to design this distilled, abstract API is by implementing a simple data access layer (DAL). CDI makes building this layer a breeze, but as usual, an example would help us understand the inner workings of this process much more easily.

[caption id="attachment_146280" align="aligncenter" width="1024"]Published by Sean Michael Ragan under CC-BY 2.0 Published by Sean Michael Ragan under CC-BY 2.0[/caption]

Abstracting Data Access with a Basic Data Access Layer (DAL)

Continue reading %Using CDI/Weld to Inject JPA/Hibernate Entity Managers%


by Alejandro Gervasio via SitePoint

New Course: Start Coding With ASP.NET Core

A Beginners Guide to Webpack 2 and Module Bundling

A squeezing machine that compresses all web elements

Webpack is a module bundler

Webpack has become one of the most important tools for modern web development. Primarily it's a module bundler for your JavaScript but it can be taught to transform all of your front-end assets like HTML and CSS, even images. It can give you more control over the number of HTTP requests your app is making and allows you to use other flavors of those assets (Jade, Sass & ES6 for example). Webpack also allows you to easily consume packages from npm.

This article is aimed at those who are new to webpack and will cover initial setup and configuration, modules, loaders, plugins, code splitting and hot module replacement. If you find video tutorials helpful I can highly recommend Glen Maddern's Webpack from First Principles as a starting point to understand what it is that makes webpack special.

To follow along at home you'll need to have Node.js installed. You can also download the demo app from our Github repo.

Setup

Let's initialize a new project with npm and install webpack:

mkdir webpack-demo
cd webpack-demo
npm init -y
npm install webpack@beta --save-dev
mkdir src
touch index.html src/app.js webpack.config.js

Edit these files:

<!-- index.html -->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Hello webpack</title>
  </head>
  <body>
    <div id="root"></div>
    <script src="dist/bundle.js"></script>
  </body>
</html>

// src/app.js
const root = document.querySelector('#root')
root.innerHTML = `<p>Hello webpack.</p>`

// webpack.config.js
const config = {
  context: __dirname + '/src',
  entry: './app.js',
  output: {
    path: __dirname + '/dist',
    filename: 'bundle.js'
  },
  module: {
    rules: [{
      test: /\.js$/,
      include: __dirname + '/src',
      use: [{
        loader: 'babel-loader',
        options: {
          presets: [
            ['es2015', { modules: false }]
          ]
        }
      }]
    }]
  }
}

module.exports = config

The config above is a common starting point, it instructs webpack to compile our entry point src/app.js into our output /dist/bundle.js and all .js files will be transpiled from ES2015 to ES5 with Babel.

To get this running we're going to need to install three packages, babel-core, the webpack loader babel-loader and the preset babel-preset-es2015 for the flavor of JavaScript we want to write. { modules: false } enables Tree Shaking to remove unused exports from your bundle to bring down the file size.

npm install babel-core babel-loader babel-preset-es2015 --save-dev

Lastly, replace the scripts section of package.json with the following:

"scripts": {
  "start": "webpack --watch",
  "build": "webpack -p"
},

Running npm start from the command line will start webpack in watch mode which will recompile our bundle whenever a .js file is changed in our src directory. The output in the console tells us about the bundles being being created, it's important to keep an eye on the number of bundles and the size.

Console output of running webpack in watch mode

You should now be able to load index.html in your browser and be greeted with "Hello webpack.".

open index.html

Open up dist/bundle.js to see what webpack has done, at the top is webpack's module bootstrapping code and right at the bottom is our module. You may not be colored impressed just yet but if you've come this far you can now start authoring ES6 modules and webpack will be able to produce a bundle for production that will work in all browsers.

Stop webpack with Ctrl + C and run npm run build to compile our bundle in production mode.

Notice that the bundle size has come down from 2.61 kB to 585 bytes.
Take another look at dist/bundle.js and you'll see a big ugly mess of code, our bundle has been minified with UglifyJS, the code will run exactly the same but it's done with the fewest characters needed.

Modules

Out of the box webpack knows how to consume JavaScript modules in a variety of formats, the most notable two are:

  • ES2015 import statements
  • CommonJS require() statements

We can test this out by installing lodash and importing it from app.js

npm install lodash --save

// src/app.js
import {groupBy} from 'lodash/collection'

const people = [{
  manager: 'Jen',
  name: 'Bob'
}, {
  manager: 'Jen',
  name: 'Sue'
}, {
  manager: 'Bob',
  name: 'Shirley'
}, {
  manager: 'Bob',
  name: 'Terrence'
}]
const managerGroups = groupBy(people, 'manager')

const root = document.querySelector('#root')
root.innerHTML = `<pre>${JSON.stringify(managerGroups, null, 2)}</pre>`

Run npm start to start webpack and refresh index.html, you should see an array of people grouped by manager.

Let's move the array of people into its own module people.js

// src/people.js
const people = [{
  manager: 'Jen',
  name: 'Bob'
}, {
  manager: 'Jen',
  name: 'Sue'
}, {
  manager: 'Bob',
  name: 'Shirley'
}, {
  manager: 'Bob',
  name: 'Terrence'
}]

export default people

We can simply import it from app.js with a relative path.

// src/app.js
import {groupBy} from 'lodash/collection'
import people from './people'

const managerGroups = groupBy(people, 'manager')

const root = document.querySelector('#root')
root.innerHTML = `<pre>${JSON.stringify(managerGroups, null, 2)}</pre>`

Note: Imports without a relative path like 'lodash/collection' are modules from npm installed to /node_modules, your own modules will always need a relative path like './people', this is how you can tell them apart.

Loaders

We've already been introduced to babel-loader, one of many loaders that you can configure to tell webpack what to do when it encounters imports for different file types. You can chain loaders together into a series of transforms, a good way to see how this works is by importing Sass from our JavaScript.

Continue reading %A Beginners Guide to Webpack 2 and Module Bundling%


by Mark Brown via SitePoint

Web Design Weekly #265

Headlines

Understanding the Critical Rendering Path

Ire Aderinokun explains in a clear and concise manner why having knowledge of the critical rendering path for web pages is useful for understanding how a site’s performance can be improved. (bitsofco.de)

Opinions of Leaders Considered Harmful (cssmojo.com)

Sponsor Web Design Weekly and reach over 22,000 passionate designers and developers

Articles

Design like a Developer

Some great tips on how to go about designing as if you were building UI components in a development environment. (medium.com)

Crash Course – UI Design

A pretty epic article by Jeff Wang that revisits the design process he took on a recent project from the UI angle. (medium.com)

A Simple Use of CSS Grid

A nice little primer to get your feet wet with CSS Grid. (theboldreport.net)

The Infrastructure Behind Twitter – Scale (blog.twitter.com)

Tools / Resources

A Quick Intro to Styled Components

Sacha Greif gives us a small glimpse into Styled Components so we can decide if it’s worth checking out. (freecodecamp.com)

Practical Redux, Part 8

Another awesome deep dive into the inner workings of Redux by Mark Erikson. If you happen to be working with Redux, Mark’s series is a must read. (blog.isquaredsoftware.com)

An Introduction to Observables for Angular Developers

Jen Looper looks into the concept of the Observable; what they are, why she prefers them to other methods for handling data and some real world examples. (developer.telerik.com)

Awesome Case Studies

A curated list of technical case studies, mostly around front-end/creative development. (github.com)

Running Express, Koa And Hapi On HTTP/2 (ivanjov.com)

Inspiration

Smashing Magazine Case Study (sarasoueidan.com)

Developer Tea with Wes Bos (spec.fm)

New Mozilla Branding (subtraction.com)

Jobs

Designer at Help Scout

Designers at Help Scout are responsible for the brand, and for creating an exceptional product experience. Everything customer-facing passes through the design team in some way. You’ll be making things that are seen and/or used by several hundred thousand people every month. (helpscout.net)

Product Designer at Pusher

We’re going to do this by creating even more great products which are beautiful, simple to use, reliable and built with developers in mind. Now we’re looking for a Designer to help us get there. (pusher.com)

Need to find passionate developers or designers? Why not advertise in the next newsletter

Last but not least…

JavaScript Rising Stars (risingstars2016.js.org)

The post Web Design Weekly #265 appeared first on Web Design Weekly.


by Jake Bresnehan via Web Design Weekly

9 WordPress Plugins to Help Get More Social Shares

If you run a blog or publish any kind of content regularly, you know that you have to create awesome content to get noticed.

But creating the content is only half the battle. You’ve got to get people to share it. That’s where the real power of content marketing lies.

However, getting your content shared can be downright tough. Even if you’ve successfully driven traffic to your site, how do you get those people to share your content?

Thankfully, there are several WordPress plugins that are about to make your life a whole lot easier. These 9 plugins will help you leverage the power of social media to get your content shared over and over again.

Whether you post information packed blog posts or lighthearted videos, we’ve got a plugin for you. Let’s get started!

Continue reading %9 WordPress Plugins to Help Get More Social Shares%


by Ian Chandler via SitePoint

Multi.js – Replacement for Select Boxes with Multiple Attribute

multi.js is a user-friendly replacement for select boxes with the multiple attribute. It is mobile-friendly, easy to use, and provides search functionality. multi.js is also easy to customize and style with CSS.


by via jQuery-Plugins.net RSS Feed

Take Opportunities to Beat Imposter Syndrome

For the last 6+ years, I've been managing the SitePoint Ruby channel. I was given the job by desperate, over-tasked folks trying to save a fledgling Ruby resource. I swallowed my Imposter Syndrome and took up the cause. It was an opportunity and decision that changed my life and career. The people at SitePoint are wonderfully intelligent and a joy with which to work. It is my sincerest belief that SitePoint wants to create content that makes people in software better.

With that being said, allow me to shift the focus of this post from "Hey, look what I did for 6 years!" to "Take opportunities that make you uncomfortable."

In 2011, I was a competent .NET resource. I had ridden the wave of ASP to ASP.NET and could ably write C#. However, I was frustrated. I found .NET and the software around it (like IIS) to be limiting and frustrating. At the time, there were projects like Castle Windsor that included excellent Dependency Injection Frameworks, a .NET port of Rails called Monorail, and some other frameworks that felt good to use. In fact, Monorail predated ASP.NET MVC and was, unfortunately, killed by Microsoft inventing it's own MVC platform instead of using the existing (and superior, IMO) framework. While ASP.NET MVC was a step in the right direction and a fine framework in its own right, I wanted to make Ruby my everyday.

Continue reading %Take Opportunities to Beat Imposter Syndrome%


by Glenn Goodrich via SitePoint

Lorem Ipsum Generator

Lorem Ipsum Generator

Single Serving One Pager hosting a useful Lorem Ipsum Generator. We've recently featured another but this one includes additional functionality for words, bytes, lists and even HTML output.

by Rob Hope via One Page Love

Testing Frenzy – Can We BDD Test the Units?

I'll be honest, I don't do much testing. When it's really necessary and I'm working on big enterprise projects, I do, but in general, my personal projects are usually one-man-army proofs of concept, or fixes on already tested apps.

[author_more]

We've done our share of testing posts here at SitePoint, with more coming soon, but I wanted to show you a relatively new testing tool I found that caught my attention because of how unconventional it seemed.

Peridot Logo

Peridot

Peridot is a BDD testing framework (so behavior driven testing) but for your units of code - not your business logic.

Wait, what?

Yes.

If you're familiar with Behat, you'll recognize this syntax (it should be fairly readable even if you're not familiar with it):

Feature: adding a todo

As a user
I want my todos to be persisted
So I don't have to retype them

Scenario: adding a todo
  Given I am on "/"
  When I fill in "todo" with "Get groceries"
  And I press "add"
  And I reload the page
  Then I should see "Get groceries"

Scenario: adding a duplicate todo
  Given I have a done todo "Pick up dinner"
  And I am on "/"
  When I fill in "todo" with "Pick up dinner"
  And I press "add"
  Then I should see "Todo already exists" after waiting
  And I should see 1 "#todos li" elements

The individual phrases are defined in FeatureContext classes like so:

    /**
     * @Then I should see :arg1 after waiting
     */
    public function iShouldSeeAfterWaiting($text)
    {
        $this->getSession()->wait(10000, "document.documentElement.innerHTML.indexOf('$text') > -1");
        $this->assertPageContainsText($text);
    }
    /**
     * @Given I have a todo :arg1
     */
    public function iHaveATodo($todoText)
    {
        $collection = self::getTodoCollection();
        $collection->insert(['label' => $todoText, 'done' => false]);
    }

The framework recognizes them, substitutes the arguments for their values, and tests the conditions.

Continue reading %Testing Frenzy – Can We BDD Test the Units?%


by Bruno Skvorc via SitePoint

Proto.io 2016 Year in Review

Proto.io 2016 - A Year of Prototyping in Review

Annual Report One Pager set in outer space for Protio.io. The long scrolling Single Page website shares insight from the 2016 activity on their prototype service.

by Rob Hope via One Page Love

Authentication in Rails Using Clearance

Clearance is a simple authentication system with email and password built by the team at Thoughtbot. It has opinionated defaults but is intended to be easy to override. The system is actively maintained, and you can follow up on GitHub.

In this tutorial, you will see how to integrate Clearance into a Rails application. We will make use of a miniature application. Let's begin!

Getting Started

You'll start by generating your Rails application. For the purpose of this tutorial, I'll name mine tutsplus-clearance.

That will do the magic.

You'll need bootstrap to make your application look good. Add the Bootstrap gem to your Gemfile.

Install the gem by running bundle install.

Now modify application.scss  to look like this:

Clearance Setup

Open your Gemfile to add the Clearance gem.

Now install the gem.

bundle install

At this point, run the generator command to install clearance.

rails generate clearance:install

This will generate some outputs on your terminal, which look like what I have below:

When you ran the command, a couple of files were generated in your application. One such file is clearance.rb, which you can find in the config/initializers directory. A User model was also generated, and along with that you also have a migration file that looks like this:

According to the output, the first thing you want to do is edit your config environment. To do that, navigate to config/environments/development.rb and add the line below, just above the end delimiter.

Next, navigate to config/initializers/clearance.rb to edit it, and when you're there, change the sender email address from the default to any of your choosing. This is what you will see when you open the file.

You can override the default configuration by pasting in the following code snippet and configuring it to your requirements.

Run the command to migrate your database.

rake db:migrate

Open your PagesController and add an index action.

Next, create a view for the index action you just created.

Add the code snippet below:

Edit your routes to:

Create a partial named _navigation.html.erb inside the layouts directory. This will be used to handle everything that has to do with navigation on your application.

Paste the following code and save.

Restricted Access 

With Clearance, you can be able to create restricted access to specific pages of your choice in your application. Let's see how it is done.

Create a view for a new action in app/views/pages, the name of the file should be new.html.erb. Paste in the code below.

Now you need to add the line below to config/routes.rb.

Finally, go to your PagesController make it like what I have below.

In the above code, we are making use of the Clearance helper, require_login, to restrict access to the new action. To see how it works, start up your rails server by running rails server from your terminal. Point your browser to http://locahost:3000/pages/new and it should redirect you to the sign in page.

Clearance also provides routing constraints that can be used to control access.

In the code above, a different route has been created for authenticated users.

Overriding Clearance Defaults

A lot of things happen behind the scenes when you start using Clearance, things you cannot see. There might come a time when you want to customize things differently, depending on the specification of your application. Clearance allows you to override the default configuration it comes with.

To override (or generate) Clearance routes, run this command from your terminal.

rails generate clearance:routes

Your routes file should now look like this:

The command will also set the config.routes setting to false in your config/initializers/clearance.rb file. This means that the custom file which has just been generated will be used.

To generate views for modification, run:

rails generate clearance:views

Some of the files that will be generated include:

You will see a prompt in your terminal asking to overwrite your app/views/layouts/application.html.erb file. Choose the option you want.

Layouts

By default, Clearance uses your application's default layout. If you would like to change the layout that Clearance uses when rendering its views, simply specify the layout in an initializer.

Helper Methods

Clearance provides you with helper methods that can be used in your controllers, views, and helpers. These methods include signed_in?, signed_out?, and current_user. For example:

Conclusion

Clearance has a lot to offer you when it comes to authentication, so be sure to try it out in your next project. You can learn more by checking out the GitHub page.


by Kingsley Silas Chijioke via Envato Tuts+ Code