Friday, June 16, 2017

#339: V8 6.0, Building an Android App with Vue, and ESLint v4

This week's JavaScript newsRead this e-mail on the Web
JavaScript Weekly
Issue 339 — June 16, 2017
Most JS developers debug with console.log so why not learn more about what the console can do for you?
Darryl Pargeter

It’s coming to Chrome 60, has SharedArrayBuffer support, and brings rest/spread properties on objects.
Seth Thompson

Rather than learn Android development from scratch, put your JavaScript skills to use with Cordova and Vue.js to build a basic ‘to do’ app.
Viraj Khatavkar

ForwardJS
Attend full-day hands-on React workshops and dozens of talks at ForwardJS San Francisco this July.
ForwardJS   Sponsor

A great three part series covering why memory management is important, using ArrayBuffers and SharedArrayBuffers in JS, and avoiding race conditions with Atomics.
Lin Clark

A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Here’s a migration guide.
ESLint

If you haven’t dug into the new goodies yet, this is a good roundup of the latest developments on the Node ecosystem’s most important tools.
Prosper Otemuyiwa

A 12-part video course that starts with lessons on how to setup an app with Webpack and Babel and how to configure these tools for use with Preact.
Shane Osbourne

Jobs Supported by Hired.com

Can't find the right job? Want companies to apply to you? Try Hired.com.

In Brief

Kyle Simpson's 'Deep Foundations of JS' Course in London news
We’ve got Kyle back in London in four weeks’ time.
White October Events

Angular 1.0 Turns Five Years Old news
Chris Brandrick

EmberCamp London: A Full Day of Ember Talks (July 11) news

Angular 4.2 Now Available news
Stephen Fluin

Announcing TypeScript 2.4 RC news
Support for ES import() calls and string enums are key features.
Microsoft

JSConf Belgium 2017 Is In 2 Weeks (June 29) news
Great speakers and tickets are still available.
JSConf Belgium

Using Source Maps to Debug Errors tutorial
Let's talk JavaScript Source Maps. What are they? How to enable source mapping? Why aren't they working?
ROLLBAR  Sponsor

19 JavaScript Shorthand Coding Techniques tutorial
Michael Wanyoike

Using a C Library in JavaScript tutorial
How a team compiled LibreOffice’s hunspell for use on the client side.
Teamemo

A Curated List of 68 React and Redux Tutorials, Walkthroughs and Courses tutorial
Mark Erikson

Introducing FilterBubbler: A WebExtension Built using React/Redux story
A text analysis toolkit using the new WebExtensions API.
Mozilla Hacks

Test-Driven Development for JavaScript tutorial
In this eBook we will explore the idea of practicing Test-Driven Development (TDD) for client-side JavaScript.
Codeship  Sponsor

What's Coming After ES6: The Future of JavaScript video
Brian Holt

Will Vue.js Become a Giant Like Angular or React? opinion
Bartosz Bilejczyk

Bonsai: An Open Source Webpack Analyzer tools
Ryan Albrecht

Amplitude.js: A Modern HTML5 Audio Player with No Dependencies code
521 Dimensions

ZangoDB: A MongoDB-Like Interface for HTML5 IndexedDB code
Erik Olson

Dutier: A Small (1KB) Centralized State Management Solution code
Luis Vinicius

Collect.js: 76 Convenience Methods for Arrays and Objects code
A similar API to Laravel Collections: chunk, flatten, shuffle, etc.
Daniel Eckermann

js-joda: Immutable Date and Time Library code

Building a REST API Using Express.js tutorial
MONGODB  Sponsor

Curated by Peter Cooper and published by Cooperpress.

Like this? You may also enjoy: FrontEnd Focus : Node Weekly : React Status

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

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


by via JavaScript Weekly

Which JavaScript Framework for WordPress Core?

If you keep up on WordPress news at all, you may be aware that WordPress Core will soon include a JavaScript framework, in addition to Backbone.js (which will remain and continue to be maintained). But the hunt for the correct JavaScript framework for WordPress Core has been an interesting one. Choosing a JavaScript Framework for […]

Continue reading %Which JavaScript Framework for WordPress Core?%


by Jeff Smith via SitePoint

5 Ways to Use WordPress to Provide Exceptional Customer Support

This article is part of a series created in partnership with SiteGround. Thank you for supporting the partners who make SitePoint possible.

Whether you develop web apps, sell WordPress plugins and themes, or run an online store, offering great customer support is essential for success. Do it well, and you’ll have happy customers and set yourself apart from your competitors. Do it badly, and it will come back to bite you.

Make support easy. Develop a comprehensive system, give your users multiple ways to contact you, and respond to support requests in an acceptable time frame. Aim to surpass their expectations.

How do you achieve that?

WordPress makes a great platform for your support system. There are over 10,000 support-related plugins that enable you to set up ticketing systems, live chat, support forums, frequently asked questions, and more. Some plugins just about do the lot.

But 10,000 plugins is a lot to wade through. In this article we bring you the best-in-class plugins in five categories—plugins we recommend that are widely used and highly rated by their users.

You may not want to implement all five categories in your support system. As you read through this article, think through which make the most sense for your business.

1. All-in-One Support Plugins

Here’s one way to simplify your support system. Rather than choosing a different plugin for each strategy, install one plugin that covers all the bases.

Awesome Support - WordPress Helpdesk & Support Plugin

  • Cost: Basic plugin free, extensions available individually or in bundles (from $199)
  • Active Installs: 5,000+
  • Rating: 4.5 out of 5 stars (81 reviews)

This comprehensive plugin will do just about everything you need for support, except chat. The basic functionality is free, but some of the features you may want cost.

Awesome Support is the most versatile and feature-rich support plugin for WordPress. It’s the result of three+ years of work, research, and improvement. The features are an answer to user requests for a solid, WordPress-based help desk, and that’s what makes it the best!

Features of the free plugin include:

  • Ticketing: Users can submit tickets from the front-end, and your agents respond to them from the WordPress back-end.
  • E-mail notifications: Parties are notified of certain actions by customisable e-mails.
  • File upload: You control when files can be uploaded, how many files, and how large they are.
  • Multiple products: Provide support for as many products as you want.
  • Multiple departments: Provide support for multiple departments.
  • Terms & conditions: Ask users to agree to your your terms and conditions before they open a ticket
  • Old tickets: Identify old tickets quickly with tags
  • Sorting And Filtering: Includes an amazing flexible sorting, filtering and tagging system for your tickets
  • Prioritize your way: Create your own priority scheme – you don’t have to get locked into a 1-5 priority scheme!
  • Time Tracking: Basic time tracking is included! Admins can even adjust time and all time changes are logged directly in the ticket.

Popular premium extensions:

  • E-Mail Piping: Reply to tickets and collaborate using just e-mail.
  • WooCommerce: Bridge between your WooCommerce store and Awesome Support.
  • Canned Responses: Preconfigure replies to common questions.
  • Gravity Forms: Create custom ticket forms.
  • Satisfaction Survey: Automatically collect survey responses that rate your agent’s performance on a ticket.
  • FAQs: Powerful FAQ management make your agents more productive.
  • Notifications: Get notified of important events in slack and via pushbullet. Notify third parties of important ticket events via email.

Other popular support plugins include Zendesk Support for WordPress and WP MUDEV Support System Plugin.

Continue reading %5 Ways to Use WordPress to Provide Exceptional Customer Support%


by Adrian Try via SitePoint

Being a Full Stack Developer

Jack of all trades

A full stack developer who can get from a prototype to full MVP (minimum viable product) is often considered a jack of all trades, master of none, and with good reason. To define the modern full stack developer, we first need to focus on what the full stack developer used to be.

Full Stack Developers Then

Long ago, circa 2000 (in Internet-time, 17 years is a very long time ago), a full stack developer was someone who could:

  • whip up a web page in some Adobe tools like Photoshop or Fireworks
  • turn this design into HTML, CSS, and hotspots on images (aw, remember those?)
  • write some basic PHP 4.0 scripts (no object oriented PHP was on the horizon back then) to handle the server-side of the logic
  • store all dynamic data into MySQL, maybe do a bit of optimizing
  • upload it all to a server via FTP and collect the paycheck

Note that we're talking about PHP here - a full stack Flash or Coldfusion developer had a different (but only slightly different) workflow.

Those were simple times, life was good. One-man agencies were a dime a dozen, and people still had time to spend with their family after work.

What about now?

What Does a Full Stack Developer Need to Know Now?

These days, we have horrors like these happening - how did it come to this?

App developer doesn't see his kids due to schedule

To succeed in a now-saturated market, we developers - who are often perfectionists - hesitate to delegate and often live by the "if you want something done right" motto. This forces us into a corner where we have to learn everything, so that being a full stack developer often ends up encompassing the following.

Server Admin / Devops

A developer must know how to do basic server management. This includes but is not limited to:

  • connecting to remote servers through the terminal, in non-GUI environments
  • basic shell scripting
  • managing users and groups on a server
  • managing server programs like Apache and Nginx for serving apps
  • managing firewalls and permissions
  • installing new software and updating the distribution

via GIPHY

Apart from these basics, a developer should know how to create good, healthy, isolated development environments, in either Docker or virtual machines like with Vagrant. If all of the above is something you're unfamiliar with, we have an excellent book about it for sale here.

The developer should also be intimately familiar with version control systems in order to be able to reliably produce backups and shareable, collaborative collections of code, tracked for changes across time. No modern developer workflow is complete without version control these days. We have a fantastic video course about this for purchase here.

Cloud

Apart from actual managed or virtualized servers, a developer might need to know about the cloud - hosting on platforms like Heroku, Google Cloud, Azure, AWS, and others.

via GIPHY

There's a fair bit to be said about platforms and tools that are more hype than immediately useful, but being familiar with the services everyone is talking about can come in handy in the long run - a client could demand a switch of providers any day now, and it pays to be ready. Luckily, we have the ultimate guide to deploying to all these cloud hosts.

Back End

On the back end, apart from knowing the language of choice - in our case PHP and its multitude of frameworks and CMSes - a developer needs to be familiar with:

  • web servers like Nginx and Apache which ties into Devops above
  • unfortunately, NodeJS for compiling JS, CSS, and other assets into statically hostable ones. Fortunately, there are ways to avoid NodeJS by using PHP.
  • tools like Composer for package and dependency management in PHP itself - no modern developer's environment is complete without it
  • good API design, since most new websites today are API-based and merely talk to a detached front-end (more on that below).
  • search engines like ElasticSearch (introduction here) are really important for performance
  • cronjobs and background jobs with tools like Gearman or libraries like Crunz
  • knowing about caching with Varnish, Redis, and similar powerful tools that slice hosting costs into the single digits will often make or break a project

Continue reading %Being a Full Stack Developer%


by Bruno Skvorc via SitePoint

Chameleon.js – Easy Get and Use Colors From Image

Chameleon.js is a lightweight jQuery plugin for automatic content colorization.

Features:

  • Colorize the content with image
  • Get colors from an image
  • Sort colors by various parameters (hue, saturation, value, chroma, alpha)
  • Some color manipulations (format, luminance, transparency, readable)
  • Wrap the color in the jQuery element

by via jQuery-Plugins.net RSS Feed

How to Handle Exceptions in Python

It is very common to encounter errors during the execution of a program. Two common kinds of errors that you may have to deal with are syntax errors and exceptions. Syntax errors occur when you type the code incorrectly. In such cases, the erroneous line is repeated by the parser with an arrow pointing to the earliest location where the error was detected.

Exceptions are different from syntax errors. They occur during the execution of a program when something unexpected happens. For example, let's say you are asking the user to input a number in order to perform a division. Now, if the user enters a string instead of a number and you try to divide a number by the given input, the program will output a TypeError

When you are not properly handling exceptions, the program will abruptly quit as it won't know what to do in such cases. The following code is such an example:

As long as you are entering an integral input value, the program will work correctly. However, as soon as you enter a string or even a decimal number as input, you will get a ValueError exception.

In this tutorial, you will learn how to properly handle and raise exceptions in Python.

Some Common Exceptions

Here are some basic exceptions that you might encounter when writing programs. You can read about many more built-in exceptions on the official website.

  • NameError: This exception is raised when the program cannot find a local or global name. The name that could not be found is included in the error message.
  • TypeError: This exception is raised when a function is passed an object of the inappropriate type as its argument. More details about the wrong type are provided in the error message.
  • ValueError: This exception occurs when a function argument has the right type but an inappropriate value. 
  • NotImplementedError: This exception is raised when an object is supposed to support an operation but it has not been implemented yet. You should not use this error when the given function is not meant to support the type of input argument. In those situations, raising a TypeError exception is more appropriate.
  • ZeroDivisionError: This exception is raised when you provide the second argument for a division or modulo operation as zero.
  • FileNotFoundError: This exception is raised when the file or directory that the program requested does not exist.

Just like the names above, most exceptions have self-explanatory names.

Handling an Exception

The code at the beginning of the article asked users to enter an integer as input. If the user did not provide an integer input, the program stopped execution and raised a value error exception. In this section, we will write some code to tell the user that their input is not a valid integer value.

The first step of the process is to include the code that you think might raise an exception inside the try clause. The next step is to use the except keyword to handle the exception that occurred in the above code. The modified code for the user input will look like this:

What happens here is that the program tries to execute the code inside the try clause. If no exception was raised, the program skips the except clause and the rest of the code executes normally. If an exception is raised, the program skips the remaining code inside the try clause and the type of the exception is matched with the name of the exception after the except keyword. In case of a match, the code inside the except clause is executed first, and then the rest of the code after the try clause is executed normally.

When you enter an integer as an input, the program gives you the final result of the division. When a non-integral value is provided, the program prints a message asking you to try and enter an integer again. Note that this time, the program does not abruptly quit when you provide some invalid input.

You can have multiple except clauses to handle different exceptions. Please keep in mind that these handlers will only deal with exceptions that occurred in the corresponding try clause. They will not handle any exceptions raised within other exception handlers.

You can also handle multiple exceptions using a single except clause by passing these exceptions to the clause as a tuple.

Finally, you can also leave out the name of the exception after the except keyword. This is generally not recommended as the code will now be catching all the exceptions and handling them in the same way. This is not optimal as you will be handling a TypeError exception the same way as you would have handled a ZeroDivisionError exception. When handling exceptions, it is better to be as specific as possible and only catch what you can handle.

One possible use of catching all exceptions is to properly print out the exception error on screen like the following code:

Using the Else Clause

You can also use an else clause in a try ... except statement. The else clause is meant to contain code that needs to be executed if the try clause did not raise any exceptions. This can be useful to make sure that you don't add any code to the try block whose exceptions you don't intend to catch. One thing worth mentioning is that if you decide to use an else clause, you should include it after all the except clauses but before the finally block.

In our case, we could move the line that prints the result of our division inside the else block.

Cleaning Up Using the Finally Clause

Let's say you have written some code inside the try block that is supposed to perform a task by utilizing a large amount of resources. It is important to release those resources back when you are done using them. This can be easily achieved by using the finally clause. 

The code inside the finally clause is always executed irrespective of whether the try block raised an exception. You can verify this by running the following code:

If any of the except clauses that you specified do not handle the raised exception, the same exception is raised again after the execution of code inside the finally block.

A More Complex Example

In this section, we will write a program to deal with multiple exceptions. Just like the previous examples, we will be performing some mathematical operations. However, this time we will take the input from a list.

The following code checks for two exceptions, TypeError and ValueError. The else block is used to print the factorial. You can see in the output that this code is executed only when no exception is raised.

The above code produces the following output:

Another thing worth noticing is that the code inside the finally clause is executed for each item in the list.

Final Thoughts

I hope this tutorial helped you understand exception handling in Python. Additionally, don’t hesitate to see what we have available for sale and for study in the marketplace, and don't hesitate to ask any questions and provide your valuable feedback using the feed below.

Properly handling exceptions can be very helpful in situations where exiting a program after it receives an unexpected input is not viable. If you have any questions related to exception handling in Python, please let me know in the comments. 


by Monty Shokeen via Envato Tuts+ Code

Chris Biron

Freelance Digital Designer based in London. I collaborate with inspiring brands, businesses & start-ups to shape their digital projects.
by via Awwwards - Sites of the day