Monday, January 18, 2016

Think like a Hacker and Protect Yourself with White Hat Security

Think like a hacker and protect yourself with the White Hat Security Hacker bundle

The penetration testing and white hat hacking industry is growing every day, with companies small and large looking to hire experts who can protect them from hacking attempts. Learn how to do it—and how to launch your security career—with the $49 White Hat Security Hacker bundle at SitePoint Shop.

This six-course bundle will give you hands-on experience identifying and exploiting vulnerabilities in Windows and Linux systems, hardware, WordPress blogs, and more. You'll learn how to use the Linux command line and how to create networks that block unauthorized access. You'll even get training on web scraping, you can easily get data off of sites like Yelp and create leads list for your sales team from data available online.

Jump into a new, in-demand career. Get the White Hat Security Hacker bundle at SitePoint Shop for $49.

Continue reading %Think like a Hacker and Protect Yourself with White Hat Security%


by SitePoint Offers via SitePoint

3 Facets of Great UX Design: Part 2

In this second instalment of our three part series, we’re going to examine another of the important tenets of UX design, usability. In part one we discussed usefulness [link] and dug into an interesting case study from Buffer.

So let’s dig in.

Usability

So you have a product that solves someone’s problem? Take a moment to pat yourself on the back, but make it quick — there’s still a lot of work ahead of you. As the saying goes, build the right thing, then build the thing right.

Usability defines how well a product performs the purpose for which it is intended. It refers to the quality of a person’s experience when using a product, and encompasses a variety of elements, from function to learning curve, to overall complexity.

A quote from Einstein about simplicity.

Source: Simple 2 Kristian Bjornard. Creative Commons.

 

The Nielsen Norman Group defines five core components to usability:

  • Learnability — The ease with which the user can figure out how to use the product for the first time.
  • Efficiency — The ease with which users can accomplish tasks.
  • Memorability — How well a user can recall the system after a period without using it.
  • Errors — The amount and severity of errors both from the system and the user.
  • Satisfaction — The pleasure a user gets from using the product.

With the exception of satisfaction (which is in a class all of its own), these factors are pretty mechanical. Usability is the nitty-gritty of design, where you roll up your sleeves and smooth everything out.

As with usefulness, you shouldn’t go in blindly to create a product that you think your users will like. Your design’s usability should be determined through more reliable and structured methods, involving the users themselves.

Here is the method that UXPin finds the most effective:

  1. Wireframe. This is the preliminary stage of the design, where you solidify the structure, layout, and information architecture. It’s important to set aside time for these details before moving on to graphic and interface decisions.

The wireframe acts as a skeleton and helps with addressing efficiency as you prioritise what goes where. Some designers go even more basic, sketching and fleshing out ideas even before the wireframing stage.

  1. Prototype and test. Build a workable prototype, then test it with an absolute minimum of 5 users. Even with a rough prototype you should be able to test for most usability factors – all except satisfaction.

 

When testing, elicit both quantitative and qualitative feedback. Observing how users complete tasks and how long it takes will cover the quantitative side of things — count the number of clicks or pages visited. As users run through your app, encourage them to think aloud and record their qualitative feedback.

  1. Continue prototyping until ready. The rapid prototyping cycle is design, test, elicit and implement feedback, then start the cycle over. You’ll want to repeat the testing stage over and over again until your product is getting reliably excellent feedback. Build and test progressively better and/or more elaborate prototypes until you have something that resembles your final product.

Following this process should support you to build a reliably usable product, which means you’re ready to tackle the third facet of great UX design – delight. We’ll tackle that one next week in the last of our three part series.

The post 3 Facets of Great UX Design: Part 2 appeared first on UX Mastery.


by Jerry Cao via UX Mastery

Object-Oriented JavaScript — A Deep Dive into ES6 Classes

Often we need to represent an idea or concept in our programs—maybe a car engine, a computer file, a router, or a temperature reading. Representing these concepts directly in code comes in two parts: data to represent the state and functions to represent the behavior. Classes give us a convenient syntax to define the state and behavior of objects that will represent our concepts. They make our code safer by guaranteeing an initialization function will be called, and they make it easier to define a fixed set of functions that operate on that data and maintain valid state. If you can think of something as a separate entity, it's likely you should define a class to represent that "thing" in your program.

Consider this non-class code. How many errors can you find? How would you fix them?

// set today to December 24
let today = {
  day: 12,
  month: 24,
};

let tomorrow = {
  year: today.year,
  month: today.month,
  day: today.day + 1,
};

let dayAfterTomorrow = {
  year: tomorrow.year,
  month: tomorrow.month,
  day: tomorrow.day + 1 <= 31 ? tomorrow.day + 1 : 1,
};

[author_more]

The date today isn't valid; there is no month 24. Also, today isn't fully initialized; it's missing the year. It would be better if we had an initialization function that couldn't be forgotten. Notice also, that when adding a day, we checked in one place if we went beyond 31 but missed that check in another place. It would be better if we interacted with the data only through a small and fixed set of functions that each maintain valid state.

Here's the corrected version that uses classes.

class SimpleDate {
  constructor(year, month, day) {
    // Check that (year, month, day) is a valid date
    // ...

    // If it is, use it to initialize "this" date
    this._year = year;
    this._month = month;
    this._day = day;
  }

  addDays(nDays) {
    // Increase "this" date by n days
    // ...
  }

  getDay() {
    return this._day;
  }
}

// "today" is guaranteed to be valid and fully initialized
let today = new SimpleDate(2000, 2, 28);

// Manipulating data only through a fixed set of functions ensures we maintain valid state
today.addDays(1);

JARGON TIP:
  • When a function is associated with a class or object, we call it a "method".
  • When an object is created from a class, that object is said to be an "instance" of the class.

Constructors

The constructor method is special, and it solves the first problem. Its job is to initialize an instance to a valid state, and it will be called automatically so we can't forget to initialize our objects.

Keep Data Private

We try to design our classes so that their state is guaranteed to be valid. We provide a constructor that creates only valid values, and we design methods that also always leave behind only valid values. But as long as we leave the data of our classes accessible to everyone, someone will mess it up. We protect against this by keeping the data inaccessible except through the functions we supply.

JARGON TIP: Keeping data private to protect it is called "encapsulation".

Privacy with Conventions

Unfortunately, private object properties don't exist in JavaScript. We have to fake them. The most common way to do that is to adhere to a simple convention: If a property name is prefixed with an underscore (or, less commonly, suffixed with an underscore), then it should be treated as non-public. We used this approach in the earlier code example. Generally this simple convention works, but the data is technically still accessible to everyone, so we have to rely on our own discipline to do the right thing.

Privacy with Privileged Methods

The next most common way to fake private object properties is to use ordinary variables in the constructor, and capture them in closures. This trick gives us truly private data that is inaccessible to the outside. But to make it work, our class's methods would themselves need to be defined in the constructor and attached to the instance.

class SimpleDate {
  constructor(year, month, day) {
    // Check that (year, month, day) is a valid date
    // ...

    // If it is, use it to initialize "this" date's ordinary variables
    let _year = year;
    let _month = month;
    let _day = day;

    // Methods defined in the constructor capture variables in a closure
    this.addDays = function(nDays) {
      // Increase "this" date by n days
      // ...
    }

    this.getDay = function() {
      return _day;
    }
  }
}

Privacy with Symbols

Symbols are a new feature to JavaScript, and they give us another way to fake private object properties. Instead of underscore property names, we could use unique symbol object keys, and our class can capture those keys in a closure. But there's a leak. Another new feature to JavaScript is Object.getOwnPropertySymbols, and it allows the outside to access the symbol keys we tried to keep private.

let SimpleDate = (function() {
  let _yearKey = Symbol();
  let _monthKey = Symbol();
  let _dayKey = Symbol();

  class SimpleDate {
    constructor(year, month, day) {
      // Check that (year, month, day) is a valid date
      // ...

      // If it is, use it to initialize "this" date
      this[_yearKey] = year;
      this[_monthKey] = month;
      this[_dayKey] = day;
    }

    addDays(nDays) {
      // Increase "this" date by n days
      // ...
    }

    getDay() {
      return this[_dayKey];
    }
  }

  return SimpleDate;
}());

Privacy with Weak Maps

Weak maps are also a new feature to JavaScript. We can store private object properties in key/value pairs using our instance as the key, and our class can capture those key/value maps in a closure.

let SimpleDate = (function() {
  let _years = new WeakMap();
  let _months = new WeakMap();
  let _days = new WeakMap();

  class SimpleDate {
    constructor(year, month, day) {
      // Check that (year, month, day) is a valid date
      // ...

      // If it is, use it to initialize "this" date
      _years.set(this, year);
      _months.set(this, month);
      _days.set(this, day);
    }

    addDays(nDays) {
      // Increase "this" date by n days
      // ...
    }

    getDay() {
      return _days.get(this);
    }
  }

  return SimpleDate;
}());

Other Access Modifiers

There are other levels of visibility besides "private" that you'll find in other languages, such as "protected", "internal", "package private", or "friend". JavaScript still doesn't give us a way to enforce those other levels of visibility. If you need them, you'll have to rely on conventions and self discipline.

Referring to the Current Object

Look again at getDay(). It doesn't specify any parameters, so how does it know the object for which it was called? When a function is called as a method using the object.function notation, there is an implicit argument that it uses to identify the object, and that implicit argument is assigned to an implicit parameter named this. To illustrate, here's how we would send the object argument explicitly rather than implicitly.

// Get a reference to the "getDay" function
let getDay = SimpleDate.prototype.getDay;

getDay.call(today); // "this" will be "today"
getDay.call(tomorrow); // "this" will be "tomorrow"

tomorrow.getDay(); // same as last line, but "tomorrow" is passed implicitly

Continue reading %Object-Oriented JavaScript — A Deep Dive into ES6 Classes%


by Jeff Mott via SitePoint

Web Design Weekly #218

Headlines

How are websites still screwing up these user experiences?!

An appropriate rant by Troy Hunt that highlights all the current annoying techniques sites are utilising that should be abolished. (troyhunt.com)

Web standards now and forever (zeldman.com)

Sponsor Web Design Weekly and reach 24,845 designers and developers

Articles

Small lessons, loosely learned

Jeremy Keith reminds us that there is nothing wrong with documenting each small thing we learn. It’s one of the best ways to make sure you understand it and to test our knowledge. (adactio.com)

The future of bundling JavaScript modules

Dr. Axel Rauschmayer examines how the bundling of modules is affected by two future developments: HTTP/2 and native modules. (2ality.com)

Using layered animation in CSS to animate along curved paths

CSS animations and transitions restrict us to animating along straight paths but by using two or more objects to drive an animation, we get fine grained control over an object’s path. This in generally called layered animation and in this post Tobias Ahlin clearly explains how to achive it. (tobiasahlin.com)

Pocket-sized JavaScript

A great talk by Henrik Joreteg that looks into ways we can use new techniques like Virtual DOM and Web Workers to gives us extremely fast mobile experiences. (thedotpost.com)

Back to the Future in 2016

Well known community members share their plans for the new year. (alistapart.com)

Exploring Async Techniques in JavaScript (github.com)

Tools / Resources

tota11y – an accessibility visualization toolkit

tota11y helps visualise accessibility violations and successes, while educating on best practices. (khan.github.io)

Sketch Export Generator

A simple Sketch plugin that allows users to automatically generate retina sizes and suffixes for iOS and Android exports. (github.com)

Vagrant vs Docker: Which is better for WordPress development? (deliciousbrains.com)

Devices – Images and Sketch files of popular devices (facebook.github.io)

The Ten Most Popular Web Fonts of 2015 (typewolf.com)

Inspiration

Sebastian McKenzie’s (creator of Babel) year in review (medium.com)

Four Things Working at Facebook Has Taught Me (medium.com)

Building the Casper homepage (destroytoday.com)

Jobs

Web Operations & Drupal Developer (DevOps/WebOps)

WiTH Collective are happily seeking a senior/mid-weight web operations developer with Drupal experience. We’re an inclusive, mid-sized, creative agency with a passion for data and some great clients to innovate with. Most importantly we recognise that it’s our people who have got us to where we are today; every one of us is eager to think, learn and collectively create. We’re excited to find another like-mind. (withcollective.com)

Product Designer at Lonely Planet

Lonely Planet is looking for an experienced product designer to help us spread these stories to even more people, and has the design chops to make that experience richer, deeper and more inspiring than ever before. (lonelyplanet.com)

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

Last but not least…

Top Pens of 2015 on Codepen

100 of the best Pens from last year. So much awesomeness. (codepen.io)

How to decide what to learn next (medium.com)

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


by Jake Bresnehan via Web Design Weekly

Faceted Search with WordPress

When you’re on a great website full of information, your first instinct may be to sift through the pages to find the information you’re looking for. After trying a few different pages, it can become apparent that you may want to use the website’s search feature. Depending on the search functionality of the site you’re visiting, this could be a great way to find what you’re looking for.

I’ve covered search replacements for WordPress before which you can check out here. It is a viable alternative to the native search feature already built into WordPress. Let’s take a look at faceted search and why you may want to consider using it for your site.

What Is Faceted Search?

Faceted search is essentially advanced filtering for WordPress search results. It isn’t just for a basic WordPress site. You can use it in ecommerce applications, resources libraries and more. Advanced filtering allows your visitors to search your site, but they can select different filtering methods to weed out irrelevant search results. It gives the user a more intuitive way of narrowing their search results. Examples would be the ability to check a box, select options from a dropdown menu, or select date ranges.

Continue reading %Faceted Search with WordPress%


by James George via SitePoint

Pointy Slider with CSS and jQuery

Pointy Slider is a simple, responsive slider, with a sharp design and an interesting motion effect: with each new slide item, a sliding-in block of content covers the old one, and unveils a new image.


by via jQuery-Plugins.net RSS Feed

Customizing Your Api.ai Assistant with Intent and Context

Api.ai is a really simple service that allows developers to create their own basic personal AI assistant that works a bit like Siri and Amazon's Alexa. Last week, I covered how to build your own AI assistant using Api.ai where I showed the basics of setting up an AI assistant and accessing the pre-existing knowledge base that the Api.ai service provides. In this article, I'd like to go a step further and introduce "intents" and "contexts", a way of teaching our AI assistants more specific actions that are personalized to our own needs. This is where things can get really exciting.

What is an Intent?

An intent is a concept that your assistant can be taught to understand and react to with a specific action. An intent contains a range of contexts that we can enter as sentences that the user might say to our assistant. A few examples could include "Order me lunch", "Show me today's daily Garfield comic strip", "Send a random gif to the SitePoint team on Slack", "Cheer me up" and so on. Each of those would be custom intents which we could train our assistant to understand.

Creating an Intent

To create an intent, log into the agent you would like to add the new functionality to in the Api.ai Console Page and click on either the "Create the first one" link, the "Create Intent" button next to the "Intents" heading at the top of the page or the "Intents" plus icon in the left hand side menu (you'll need to click the hamburger icon to open that):

Creating a new intent in Api.ai

For the sample intent for this demo's assistant, we'd like to teach him to cheer people up when they're feeling down with movie quotes, jokes and other things. To start, we will call the new intent "Cheer me up" and write our first trigger sentence underneath "User says". The first sentence I've added below is "Cheer me up". Hit the Enter key or click "Add" to add your sentence:

Setting up our first intent

Typically, we have a range of different ways we might say the same thing. To account for these, we will add in a range of statements which represent various ways a user might indicate they'd like cheering up such as "Make me smile" and "I feel sad":

Cheer up sentences

Now we have a range of sentences which the assistant should understand, but we have not told it what action is expected when it hears them. To do so, we create an "action". The assistant will return "action" names back to our web app to allow it to respond. In our case, we won't respond to the first action which has been called "cheermeup". We won't actually use this action name in this demo, but it will come in handy in future when responding to actions in our web app. I'd recommend always including action names for your intents.

Creating an action

We can add in parameters into our actions too, however I will cover that in detail within my next article on Api.ai!

Guiding Via Speech Response

After our user has told the agent that they'd like to be cheered up, we want to guide the conversation into the user telling the agent more about what they'd like. To do so, we provide speech responses in the form of questions within the "Speech Response" section. For example, "Let's cheer you up! Would you like a joke or a movie quote?"

Our speech responses

Finally, we click the "Save" button next to our intent name to save our progress.

Click to save your agent

Testing Your Agent

We can test out our new intent by typing a test statement into the test console on the right. Let's test it out by saying "Cheer me up":

Our first test

The agent responds back with one of our trained responses as intended. We can also have variations on the phrasing of the statement, often Api.ai will still work it out. For example, "Make me smile please", "Say something to make me smile" or "I feel sad right now" will result in our intent running too:

A second test variation

One thing you might notice if you used a statement like "I'm sorry to hear that! How can I help you feel better?" is that it isn't quite specific enough to guide the user. If they aren't aware of the options of either "movie quote" or "joke", then they might ask for something we don't have covered! Over time, we can train up our agent to understand many other concepts, however for now I'd recommend being specific with your questions!

Continue reading %Customizing Your Api.ai Assistant with Intent and Context%


by Patrick Catanzariti via SitePoint