What’s On First: The Case For Accessibility-First Programming

When you think of common programming techniques and processes, what comes to mind first? Perhaps it's test-driven development, writing an automated test to start your development cycle and putting testing at the forefront instead of the typical afterthought. Or maybe you thought of behavior-driven development with stakeholders collaborating and defining the software behavior upfront, thus mitigating the ambiguities from some requirements.

But what if I told you that while testing and behavior are important, accessibility should be one of the first development considerations?

A Key to Success: Failure with Chaos Engineering [Video]

Test in Production is back! In May we hosted the Meetup at the Microsoft Reactor in San Francisco. The focus of this event was the culture of failure. Specifically, we wanted to hear how the culture of failure (avoiding failure, recovering from failure, and learning from failure) has an impact on how we test in production.

Ana Medina, Chaos Engineer at Gremlin, spoke about how performing Chaos Engineering experiments and celebrating failure helps engineers build muscle memory, spend more time building features and build more resilient complex systems.

Disrupt Yourself or Be Disrupted, Right?

We all know and admire disruptive innovations — the printing press, the internal combustion engine, the Internet, the iPhone, the Pet Rock (ha!), etc. Not as easily recognizable are the little innovations that have an impact in our daily lives.

It is the power of focusing on and harnessing these little ideas that David Robertson (@innonavi), a senior lecturer at MIT's Sloan School of Management and author of The Power of Little Ideas: A Low-Risk, High-Reward Approach to Innovation, finds so important to talk about.

A Peek at New Methods Coming to Promises

Promises are one of the most celebrated features introduced to JavaScript. Having a native asynchronous artifact baked right into the language has opened up a new era, changing not only how we write code but also setting up the base for other freat APIs — like fetch!

Let's step back a moment to recap the features we gained when they were initially released and what new bells and whistles we’re getting next.

New to the concept of Promises? I highly recommend Jake Archibald’s article as a primer.

Features we have today

Let’s take a quick look at some of the things we can currently do with promises. When JavaScript introduced them, it gave us an API to execute asynchronous actions and react to their succesful return or failure, a way to create an association around some data or result which value we still don't know.

Here are the Promises features we have today.

Handling promises

Every time an async method returns a promise — like when we use fetch — we can pipe then() to execute actions when the promise is fulfilled, and catch() to respond to a promise being rejected.

fetch('//resource.to/some/data')
  .then(result => console.log('we got it', result.json()))
  .catch(error => console.error('something went wrong', error))

The classic use case is calling data from an API and either loading the data when it returns or displaying an error message if the data couldn’t be located.

In addition, in its initial release we got two methods to handle groups of Promises.

Resolving and rejecting collections of promises

A promise can be fulfilled when it was successfully resolved, rejected when it was resolved with an error, and pending while there’s no resolution. A promise is considered settled when it has been resolved, disregarding the result.

As such, there are two methods we have to help with the behavior of handling a group of promises depending on the combination of states we obtain.

Promise.all is one or those methods. It fulfills only if all promises were resolved successfully, returning an array with the result for each one. If one of the promises fails, Promise.all will go to catch returning the reason of the error.

Promise.all([
    fetch('//resource.to/some/data'),
    fetch('//resource.to/more/data')
  ])
  .then(results => console.log('We got an array of results', results)
  .catch(error => console.error('One of the promises failed', error)

In this case, Promise.all will short-circuit and go to catch as soon as one of the members of the collections throws an error, or settle when all promises are fulfilled.

Check out this short writing about promises states by Domenic Denicola for a more detailed explanation about the wording and concepts about them.

We also have Promise.race, which immediately resolves to the first promise it gets back, whether it was fulfilled or rejected. After the first promise gets resolved, the remaining ones are ignored.

Promise.race([
    fetch('//resource.to/some/data'),
    fetch('//resource.to/other/data')
  ])
  .then(result => console.log('The first promise was resolved', result))
  .catch(reason => console.error('One of the promises failed because', reason))

The new kids on the block

OK, we’re going to turn our attention to new promise features we can look forward to.

Promise.allSettled

The next proposed introduction to the family is Promise.allSettled which, as the name indicates, only moves on when the entire collection members in the array are no longer in a pending status, whether they were rejected or fulfilled.

Promise.allSettled([
    fetch('//resource.to/some/data'),
    fetch('//resource.to/more/data'),
    fetch('//resource.to/even/more/data')
  ])
  .then(results => {
    const fulfilled = results.filter(r => r.status === 'fulfilled')
    const rejected = results.filter(r => r.status === 'rejected')
  })

Notice how this is different from Promise.all in that we will never enter in the catch statement. This is really good if we are waiting for sets of data that will go to different parts of a web application but want to provide more specific messages or execute different actions for each outcome.

Promise.any

The next new method is Promise.any, which lets us react to any fulfilled promise in a collection, but only short-circuit when all of them failed.

Promise.any([
    fetch('//resource.to/some/data'),
    fetch('//resource.to/more/data'),
    fetch('//resource.to/even/more/data')
  ])
  .then(result => console.log('a batch of data has arrived', result))
  .catch(() => console.error('all promises failed'))

This is sort of like Promise.race except that Promise.race short-circuits on the first resolution. So, if the first promise in the set resolves with an error, Promise.race moves ahead. Promise.any will continue waiting for the rest of the items in the array to resolve before moving forward.

Demo

Some of these are much easier to understand with a visual, so I put together a little playground that shows the differences between the new and existing methods.

Wrap-up

Though they are still in proposal stage, there are community scripts that emulate the new methods we covered in this post. Things like Bluebird’s any and reflect are good polyfills while we wait for browser support to improve.

They also show how the community is already using these kind of asynchronous patterns, but having them built-in will open the possibilities for new patterns in data fetching and asynchronous resolution for web applications.

Besides then and catch you can pipe finally to a promise, Sarah Drasner wrote a detailed piece about it that you can check out.

If you want to know more about the upcoming Promise combinators, the V8 blog just published a short explanation with links to the official spec and proposals.

Finally… A Post on Finally in Promises

“When does finally fire in a JavaScript promise?” This is a question I was asked in a recent workshop and I thought I’d write up a little post to clear up any confusion.

The answer is, to quote Snape:

snape saying always

...always.

The basic structure is like this:

try {
  // I’ll try to execute some code for you
}
catch(error) {
  // I’ll handle any errors in that process
} 
finally {
  // I’ll fire either way
}

Take, for instance, this example of a Chuck Norris joke generator, complete with content populated from the Chuck Norris Database API. (Aside: I found this API from Todd Motto’s very awesome list of open APIs, which is great for demos and side projects.)

See the Pen
finally! chuck norris jokes!
by Sarah Drasner (@sdras)
on CodePen.

async function getData() {
  try {
    let chuckJokes = await fetch(`https://api.chucknorris.io/jokes/random`)
      .then(res => res.json())
    
    console.log('I got some data for you!')
    document.getElementById("quote").innerHTML = chuckJokes.value;
  } 
  catch(error) {
    console.warn(`We have an error here: ${error}`)
  
  finally {
    console.log('Finally will fire no matter what!')
  
}

In the console:

Console that says: I got some data for you! and Finally will fire no matter what!

Now, let’s introduce a typo to the API and accidentally put a bunch of r's in the URL of the API. This will result in our try statement failing, which means the catch now throws an error.

async function getData() {
  try {
    // let's mess this up a bit
    let chuckJokes = await fetch(`https://api.chucknorrrrris.io/jokes/random`)
      .then(res => res.json())
    
    console.log('I got some data for you!')
    document.getElementById("quote").innerHTML = chuckJokes.value;
  } 
  catch(error) {
    console.warn(`We have an error here: ${error}`)
  }
  finally {
    console.log('Finally will fire no matter what!')
  }
}

Console:

Console that has a failed GET request and then a warning that says We have an error here, Typeerror: failed to fetch, and then on a new line, Finally will fire no matter what!

One giant important piece that the example doesn’t illustrate is that the finally block will run even if in the try or catch block, a return or break statement stops the code.

When would you use this?

I’ve found it particularly useful in two different situations, though I’m sure there are others:

  • When I otherwise would duplicate code that’s need in the try and catch blocks. Here’s an example in a Vue cookbook recipe I wrote. I shut off the loading state in a finally block. This includes, like the example above, where I need to change the UI somehow in either case.
  • When there’s some cleanup to do. Oracle mentions this in their documentation. It’s Java, but the same premises apply.

Finally is not useful as often as try and catch, but worth noting for some use cases. Hope that clears it up!

An Introduction to Color Fonts + 16 Beautiful Examples

Are you ready to add some color to your website? Color fonts are revolutionizing web and graphic design spaces by bringing in effects that before required advanced editing to achieve.

Traditional fonts tend to be vectors; they sit on one layer and are made up of simple strokes and shapes. You can resize them, and add effects like colors and drop shadows using HTML or CSS, but that’s all. Bitmap fonts work similarly, except they can’t be resized.

Color fonts, also known as chromatic or OpenType-SVG fonts, are breaking those barriers. These fonts can contain shading, textures, bitmap images, and of course colors – even more than one color!

The results are a wide diversity of new typefaces, ranging from highly-detailed brush stroke fonts to multi-colored or gradient text to fonts that look metallic and shiny.

What’s the Big Deal?

Adding effects to text is nothing new for designers. Overlaying textures, images, or adding shading can be done in Photoshop. But what if you could just download a color font, type, and all those effects were right there in the first place?

The problem with simply adding effects to text in Photoshop is that the result must be displayed as an image online. That means that it can’t be highlighted, searched for, or indexed by search engines.

With OpenType-SVG fonts, it looks as fancy as anything you can make in an image editor, but it’s actual text on the page – not a PNG image. It can be resized if it’s a vector font, interacted with, and edited with HTML and CSS. This has huge implications for web designers and developers.

It also saves time. Instead of taking a normal font and adding effects to it, you can just find a color font that fits your needs.

While support for color fonts is currently spotty, most of these typefaces do come with fallback fonts. These are black and white versions of the font that will work on almost any browser or program.

Currently, color fonts are supported on Edge, Safari, and Firefox with Windows-only support for Opera and Internet Explorer. They’re also supported by most major image editors and design tools, except for Adobe XD, Premiere Pro, and After Effects.

The lack of Chrome support might make you wary, but it should be safe to use color fonts with fallbacks on your website.

Color Font Examples

Ready to add some color to your sites or graphic designs? We’ve compiled sixteen gorgeous color fonts here for you. All of these make full use of OpenType-SVG technology to create artistic type. See for yourself!

Bixa Color

Example of Bixa Color

Trend by Latinotype

Example of Trend by Latinotype

Pure Heart by Greg Nicholls

Example of Pure Heart by Greg Nicholls

Bungee

Example of Bungee

Dog Eared by Andy Babb

Example of Dog Eared by Andy Babb

Night Neon by Andrey Yaroslavtsev

Example of Night Neon by Andrey Yaroslavtsev

Pickley by Lef

Example of Pickley by Lef

Core Paint by S-Core

Example of Core Paint by S-Core

Yeah by Simon Stratford

Example of Yeah by Simon Stratford

Buckwheat

Example of Buckwheat

DeLittle Chromatic by Wood Type Revival

Example of DeLittle Chromatic by Wood Type Revival

Sansterdam Color Font by NREY

Example of Sansterdam Color Font by NREY

Macbeth by Pixel Surplus and Oghie Novianto

Example of Macbeth by Pixel Surplus and Oghie Novianto

Vaporfuturism by Ckybe’s Corner

Example of Vaporfuturism by Ckybe's Corner

Colortube by Neogrey

Example of Colortube by Neogrey

Timber Wolf by Greg Nicholls

Example of Timber Wolf by Greg Nicholls

Beautify Your Projects with Colorful Fonts

Technology is always bringing us forward. Now, you can do things and add features to a website that, a few years ago, seemed impossible.

All of these fonts look like they’ve been heavily edited in Photoshop, but in reality, you can type them out onto the screen and they’ll look just like they do in the preview. Not long ago, designers may never have thought directly adding effects and shading to fonts like this could be possible.

And now, font designers are revolutionizing the online world and showing off the full extent of their design skills with awesome color fonts. Though chromatic text remains unsupported in some places, with its recent popularity, the day shouldn’t be long off when all major browsers finally support color fonts.

UNLIMITED DOWNLOADS: 400,000+ Fonts & Design Assets




Accumulator 101

Motivation

GSQL is a Turing complete Graph Database query language. Compared to other graph query languages, the biggest advantage is its support of Accumulators — global or attachable to each vertex.

In addition to providing the classic pattern match syntax, which is easy to master, GSQL supports powerful run-time vertex attributes (a.k.a local accumulators) and global state variables (a.k.a global accumulators). I have seen users learning and adopting pattern match syntax within ten minutes. However, I also witnessed the uneasiness of learning and adopting accumulators for beginners.

How AI Changed the History of The Beatles

A recent study published in Harvard Data Science Review is changing the way people think about the legendary band, The Beatles. The research also opens up some exciting possibilities when it comes to artificial intelligence and how we use this technology from a developer standpoint.

At this point, business owners and developers are using AI as a way to design websites, communicate with customers via chatbots, generate leads, and send out relevant ads. It’s an extraordinarily helpful tool when it comes to breaking down data and producing results, which leads to the study. How was AI able to solve a hotly-debated conversation surrounding The Beatles? What future uses can we uncover from this breakthrough?

How Much Does a VPN Cost? And Are VPNs Safe?

How much does a VPN cost, and is it safe to use a VPN? Those are the two key questions we’re going to answer in this article. By the end, you should understand what makes a VPN safe, as well as how much you should expect to pay for a quality VPN service. We’ll also leave you with some specific service recommendations to get you started.

Comparing Native Blazor Components to Wrapped JavaScript Components

Should we rewrite native UI components or reuse existing JavaScript UI components? We compare native Blazor components to wrapped JavaScript components by understanding how Blazor works, including what native vs. interop means and more.

Blazor is a new Single Page Application (SPA) framework that utilizes WebAssembly to run .NET application code in the browser. This future-forward framework allows developers to leverage their existing .NET code and skills to create web applications that can run completely client-side without the need for browser plugins. As with any new web framework, we're presented with a challenging decision of bringing along assets from previous works into the new system.

Three Ways to Deploy a WinForms or WPF .NET Core Application

This post will help you deploy and bring your finished app to your users. .NET Core 3 gives us three ways to deploy an app, and each has its benefits.

I know that the real fun is while an app is being developed, and we as developers are focused mainly on this part of creating an application. However, the real purpose of every app is to get to its end-users. 

A Developer’s Perspective: Responding to the Call

If you feel like existing processes can keep major issues from reaching the user base, you'll want to read this article — which provides an expose on how a reported issue was not addressed for several months only after the application was deployed.

My friend Greg has been a professor for most of his career. One thing he has conveyed to me is, "to think of an IT organization as a fire department," where you drive by and notice firefighters tending to periodic tasks or simply enjoying a peaceful day. In every case, they are ready to respond to an unexpected emergency. The theory is that everyone is glad that they are there but happier when they are not fighting constant emergencies.

Microservices Architecture With Spring Boot and Spring Cloud

Did you know that some of the largest tech companies, like Amazon and Google, are using Java to develop a microservices architecture? Many companies are building a microservices architecture to scale their people, but not their systems. If you’re also looking to do so, a good way to get started is to hire more Java developers (because there are so many of them). 

Within the Java ecosystem, you’ll find some well-rooted patterns for building microservice architectures. And if you’ve developed with Spring before, then Spring Boot and Spring Cloud should feel like a nice homecoming.

Debugging Istio Control Plane With Squash [Video]

Solo.io Squash is a distributed debugger that supports multiple languages. When running in a container environment like Kubernetes, debugging applications can be difficult, especially when distributed into multiple containers with implementations in potentially different languages.

Squash can be used to set up language-native debuggers, provide all the plumbing through Kubernetes, and expose that to your native IDEs like Visual Studio Code, Eclipse or IntelliJ/GoLand.

How to Protect Dataset Privacy Using Python and Pandas

Working with datasets that contain sensitive information is risky, and as a data scientist, you should be extremely careful whenever this type of data is present in a dataset. People dealing with sensitive information are often under the misunderstanding that by removing names, ID’s, and credit card numbers that the privacy risk is eliminated. While removing direct identifiers can help, there are more information elements in a dataset that can be used to re-identify an individual. For example, Latanya Sweeney, Director of the Data Privacy Lab in the Institute of Quantitative Social Science (IQSS) at Harvard, proved that 87 percent of US population can be re-identified using zip code, gender, and date of birth.

In this post, I am going to show you how to effectively reduce the privacy risk of a dataset while maintaining its analytical value for machine learning.

Why MQTT Is Essential for Building Connected Cars

The automotive industry is embracing the idea of building a connected car. They see opportunity in using telemetry data from vehicles to create new revenue opportunities, and to build a better user experience. However, implementing a connected car service that can scale to support millions of cars can present some challenges.

For most connected car services, there is a requirement for bi-directional communication between the car and the cloud. Cars will send telemetry data to the cloud and enable apps like predictive maintenance, assisted driving, etc. Similarly, the car needs to be able to receive messages from the cloud to respond to remote commands, like remote lock/unlock door and remote activation of horn or lights.