Thursday, May 3, 2018

How to Easily Change 16×9 Video to Square Video on Your Phone

Want to use more square videos in your social media marketing? Concerned you filmed in the 16×9 format? In this article, you’ll discover how to change landscape video into square video using your mobile device. #1: Shoot Your Video If you already have some video you want to transform into a square format, feel free [...]

This post How to Easily Change 16×9 Video to Square Video on Your Phone first appeared on Social Media Examiner.


by Serena Ryan via

Barovier & Toso

Since 1295 the creations by Barovier & Toso have been synonymous with Distinctiveness and Perfection. A Legendary Tradition for Luxurious timeless Lighting Solutions.
by via Awwwards - Sites of the day

Wednesday, May 2, 2018

Snapchat Hits 191 Million Daily Active Users [CHART]

Snapchat's user growth failed to re-accelerate in the first quarter of 2018. The social media app, particularly popular among teenagers, counted an average of 191 daily active users between January and March, up by just 4 million compared to the last quarter of 2017. As this chart...

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

by Web Desk via Digital Information World

Capture and Report JavaScript Errors with window.onerror

This article was created in partnership with Sentry. Thank you for supporting the partners who make SitePoint possible.

onerror is a special browser event that fires whenever an uncaught JavaScript error has been thrown. It's one of the easiest ways to log client-side errors and report them to your servers. It's also one of the major mechanisms by which Sentry's client JavaScript integration (raven-js) works.

You listen to the onerror event by assigning a function to window.onerror:

window.onerror = function (msg, url, lineNo, columnNo, error) {
  // ... handle error ...

  return false;
}

When an error is thrown, the following arguments are passed to the function:

  • msg – The message associated with the error, e.g. "Uncaught ReferenceError: foo is not defined"
  • url – The URL of the script or document associated with the error, e.g. "/dist/app.js"
  • lineNo – The line number (if available)
  • columnNo – The column number (if available)
  • error – The Error object associated with this error (if available)

The first four arguments tell you in which script, line, and column the error occurred. The final argument, Error object, is perhaps the most valuable. Let's learn why.

The Error Object and error.stack

At first glance the Error object isn't very special. It contains 3 standardized properties: message, fileName, and lineNumber. Redundant values that are already provided to you via window.onerror.

The valuable part is a non-standard property: Error.prototype.stack. This stack property tells you at what source location each frame of the program was when the error occurred. The error stack trace can be a critical part of debugging. And despite being non-standard, this property is available in every modern browser.

Here's an example of the Error object's stack property in Chrome 46:

"Error: foobar\n    at new bar (<anonymous>:241:11)\n    at foo (<anonymous>:245:5)\n    at <anonymous>:250:5\n    at <anonymous>:251:3\n    at <anonymous>:267:4\n    at callFunction (<anonymous>:229:33)\n    at <anonymous>:239:23\n    at <anonymous>:240:3\n    at Object.InjectedScript._evaluateOn (<anonymous>:875:140)\n    at Object.InjectedScript._evaluateAndWrap (<anonymous>:808:34)"

Hard to read, right? The stack property is actually just an unformatted string.

Here's what it looks like formatted:

Error: foobar
    at new bar (<anonymous>:241:11)
    at foo (<anonymous>:245:5)
    at callFunction (<anonymous>:229:33)
    at Object.InjectedScript._evaluateOn (<anonymous>:875:140)
    at Object.InjectedScript._evaluateAndWrap (<anonymous>:808:34)

Once it has been formatted, it's easy to see how the stack property can be critical in helping to debug an error.

There's just one snag: the stack property is non-standard, and its implementation differs among browsers. For example, here's the same stack trace from Internet Explorer 11:

Error: foobar
   at bar (Unknown script code:2:5)
   at foo (Unknown script code:6:5)
   at Anonymous function (Unknown script code:11:5)
   at Anonymous function (Unknown script code:10:2)
   at Anonymous function (Unknown script code:1:73)

Not only is the format of each frame different, the frames also have less detail. For example, Chrome identifies that the new keyword has been used, and has greater insight into eval invocations. And this is just IE 11 vs. Chrome — other browsers similarly have varying formats and detail.

Luckily, there are tools out there that normalize stack properties so that it is consistent across browsers. For example, raven-js uses TraceKit to normalize error strings. There's also stacktrace.js and a few other projects.

Browser Compatibility

window.onerror has been available in browsers for some time — you'll find it in browsers as old as IE6 and Firefox 2.

The problem is that every browser implements window.onerror differently, particularly, in how many arguments are sent to the onerror listener and the structure of those arguments.

Here's a table of which arguments are passed to onerror in most browsers:

Browser Message URL lineNo colNo errorObj
Firefox
Chrome
Edge
IE 11
IE 10
IE 9, 8
Safari 10 and up
Safari 9
Android Browser 4.4

It's probably not a surprise that Internet Explorer 8, 9, and 10 have limited support for onerror. But you might be surprised that Safari only added support for the error object in in Safari 10 (released in 2016). Additionally, older mobile handsets that still use the stock Android browser (now replaced with Chrome Mobile), are still out there and do not pass the error object.

Without the error object, there is no stack trace property. This means that these browsers cannot retrieve valuable stack information from errors caught by onerror.

Polyfilling window.onerror with try/catch

But there is a workaround — you can wrap code in your application inside a try/catch and catch the error yourself. This error object will contain our coveted stack property in every modern browser.

Continue reading %Capture and Report JavaScript Errors with window.onerror%


by Ben Vinegar via SitePoint

Instagram Video Chat and WhatsApp Group Video Call Are Coming Soon

At its F8 conference on Tuesday, Facebook announced that it's bringing group video chats to both Instagram and WhatsApp in future updates.

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

by Irfan Ahmad via Digital Information World

Microsoft Edge gains Service Worker support

#338 — May 2, 2018

Read on the Web

Frontend Focus

A Guide to the State of Print Stylesheets in 2018 — We’re printing fewer documents than ever, but it pays to make it easy for users to print well-styled versions of documents like invoices, receipts, recipes, instructions, etc.

Rachel Andrew

What’s New in the Latest Microsoft Edge? A Lot — The foundation for full-featured PWAs is now here with Service Workers and push notifications enabled by default, there’s variable fonts support, Notification API support, improved ARIA support, support for CSS transforms on SVG elements, and more.

Kyle Pflug (Microsoft)

New Course ✨ Master CSS Grid and Flexbox — Master CSS Grid and Flexbox, the latest tools and tricks to layout beautiful, responsive web applications with less code.

Frontend Masters sponsor

Is ServiceWorker Ready? (Yes.) — The Edge news (above) means this page that analyzes cross-browser support for the Service Worker ecosystem has something to celebrate :-) All major browsers now support Service Workers.

Jake Archibald

HTML5 Boilerplate 6.1.0 Released — The popular, long standing front-end template get some updates to underlying dependencies and switches from JSHint to ESLint. Downloads here.

Rob Larsen

Pure CSS Francine: An Exquisite Portrait Created in Pure CSS — ‘Demos’ normally go at the end of the issue but this 18th-century oil painting-style portrait hand coded in HTML and CSS (4000 lines of Less, specifically) is magnificent. There’s also this one. Andy Baio noted that the image looks rather different on older browsers.

Diana Smith

Finger-Friendly Numerical Inputs with 'inputmode' — On mobile in particular, it’s very helpful if input fields that expect numerical values have a numerical UI, but there are a few ways to approach this.

Ollie Williams

Measuring Sites with Mobile-First Optimization Tools — Not sure how to remove the code debt that bloats and weighs down your site? Here are specific ways mobile performance impacts your site and page speed results.

Jon Raasch

An Update on CSS Grid Level 2 and Subgrids — A handy post for getting a feel for progress on subgrids with future versions of the CSS Grid spec.

Rachel Andrew

💻 Jobs

Front-end Developer With Strong UI/UX Focus — Help our growing team build amazing tools, games and websites used by thousands of people every day. Near Oxford and/or UK remote.

Helical Levity

Frontend Developer (m/f) #VueJS / Berlin — We are looking for an experienced & passionate developer who knows how browsers work below the surface. Join Pepper.com.

Pepper.com

Open to a New Job? Sign Up for Vettery — Top developers can get 5+ interview requests during their first week on Vettery.

Vettery

📘 Tutorials

Getting More CSS Grid Flexibility with 'minmax()'minmax lets you specify a minimum and maximum size for your grid tracks.

Michelle Barker

How to Get Started with User Timing and Custom Metrics

speedcurve sponsor

Solved With CSS: Dropdown Menus

Una Kravets

Looking at the 'line-clamp' CSS Attribute — Truncates text at a specific number of lines. Support is mixed (Chrome and Safari, but not Firefox or Edge).

Geoff Graham

Radial Gradient Recipes — A lot to enjoy here, complete with embedded CodePen examples.

Chris Coyier

Native Modals Using HTML 5.2's 'dialog' Element — Note that support is currently limited to Chrome.

Alligator

Choosing Cameras in JavaScript with the mediaDevices API

Phil Nash

The Power of 'Flex-Grow' — To get access to Flexbox’s full power, you need to venture past its most basic properties.

Ethan Jarrell

'display: contents' Is Not a CSS Reset — And using it as one could negatively affect accessibility.

Adrian Roselli

Cheat Sheet: Functional Programming with JavaScript

Progress Kendo UI sponsor

🔧 Code and Tools

Subfont: Generate Optimal, Optimized Web Font Subsets for Pages — It automatically figures out what characters are used from your Web Fonts and generates smaller versions.

Peter Brandt Müller

cssgr.id: An Interactive CSS Grid Code Tool and Generator

Dan Netherton

$20 Free On A New Linode Account — Linux cloud hosting starting at 1GB of RAM for $5/mo. Get $20 credit on a new account.

Linode Cloud Hosting sponsor

Web Audio API DSP Playground — This is a lot of fun to noodle with.

Arthur Carabott

Bootstrap 4.1.1 Released — The first patch release of Bootstrap 4.

Mark Otto, Jacob Thornton, and Bootstrap contributors

CSS Grid 12 Column Layout

Erik Monjas

CKEditor 5 v10 Released: A Powerful WYSIWYG Editor Framework — The first stable release of CKEditor 5. Now fully GPL 2+ licensed.

Piotr Koszuliński


by via Frontend Focus

Evie

‘Evie’ is a free HTML template to help quickly launch your next idea within a simple, clean Landing Page. Features include a responsive design, spacious intro copy, a fixed header as you scroll, services placeholder sections and a smart footer area focused around a download button. Great to know the documentation includes a neat style guide and the template has the awesome MIT license. Cheers unDraw for the neat freebie 🙏

Full Review | Direct Link


by Rob Hope @robhope via One Page Love