Wednesday, December 5, 2018

Microsoft Beefs Up Skype with AI Powered Auto Captions

It has been a while since anyone has taken Skype seriously, especially since WhatsApp started allowing you to video call people. However, it seems that Microsoft has not entirely given up on their video calling platform. Rather, they are adding new features to it, probably in the hopes that one of...

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

by Zia Zaidi via Digital Information World

Roundup Of 2018: The Biggest Tech Failures Of The Year

Just like every passing year, the year 2018 also saw an array of products, trends, and personalities in the tech sector. While some products and trends managed to become ‘hit’ with both – the users and tech analysts, there were many that ‘missed’ the landing. Unfortunately, this year was quite...

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

by Saima Salim via Digital Information World

How to Debug Python Errors

This article was originally published on Sentry. Thank you for supporting the partners who make SitePoint possible.

One of Sentry’s more powerful features comes with languages like Python. In Python, PHP, and the JVM, we’re able to introspect more deeply into the runtime and give you additional data about each frame in your call stack. At a high level, this lets you know things like calling arguments to your functions, allowing you to more easily reproduce and understand an error. Let’s dive into what this looks like, and how it works under the hood.

We’ll start with what a Python error might typically look like in your terminal, or in a standard logging system:

TypeError: expected string or buffer
  File "sentry/stacktraces.py", line 309, in process_single_stacktrace
    processable_frame, processing_task)
  File "sentry/lang/native/plugin.py", line 196, in process_frame
    in_app = (in_app and not self.sym.is_internal_function(raw_frame.get('function')))
  File "sentry/lang/native/symbolizer.py", line 278, in is_internal_function
    return _internal_function_re.search(function) is not None

While this gives us an idea of the type and location of the error, it unfortunately doesn’t help us understand what is truly causing it. It’s possible that it’s passing an integer or a NoneType, but, realistically, it could be any number of things. Guessing at it will only get us so far, and we really need to know what function actually is.

An easy and often very accessible option to do this would be to add some logging. There’s a few different entry points where we could put logging, which makes it easier to implement. It also lets us ensure we specifically get the answer we want. For example, we want to figure out what the type of function is:

import logging
# ...
logging.debug("function is of type %s", type(function))

Another benefit of logging like this is that it could carry over to production. The consequence is generally you’re not recording DEBUG level log statements in production as the volume can be significant and not very useful. It also often requires you to plan ahead to ensure you’re logging the various failure cases that could happen and the appropriate context with each.

For the sake of this tutorial, let’s assume we can’t do this in production, didn’t plan ahead for it, and, instead, are trying to debug and reproduce this in development.

The Python Debugger

The Python Debugger (PDB) is a tool that allows you to step through your callstack using breakpoints. The tool itself is inspired by GNU’s Debugger (GDB) and, while powerful, often can be overwhelming if you’re not familiar with it. It’s definitely an experience that will get easier with repetition, and we’re only going to go into a few high level concepts with it for our example.

So the first thing we’d want to do is instrument our code to add a breakpoint. In our example above, we could actually instrument symbolizer.py ourselves. That’s not always the case, as sometimes the exception happens in third party code. No matter where you instrument it, you’ll still be able to jump up and down the stack. Let’s start by changing that code:

def is_internal_function(self, function):
    # add a breakpoint for PDB
    try:
        return _internal_function_re.search(function) is not None
    except Exception:
        import pdb; pdb.set_trace()
        raise

We’re limiting this to the exception, as it’s common you’ll have code that runs successfully most of the time, sometimes in a loop, and you wouldn’t want to pause execution on every single iteration.

Once we’ve hit this breakpoint (which is what set_trace() is registering), we’ll be dropped into a special shell-like environment:

# ...
(Pdb)

This is the PDB console, and it works similar to the Python shell. In addition to being able to run most Python code, we’re also executing under a specific context within our call stack. That location is the entry point. Rather, it’s where you called set_trace(). In the above example, we’re right where we need to be, so we can easily grab the type of function:

(Pdb) type(function)
<type 'NoneType'>

Of course, we could also simply grab all locally scoped variables using one of Python’s builtins:

(Pdb) locals()
{..., 'function': None, ...}

In some cases we may have to navigate up and down the stack to get to the frame where the function is executing. For example, if our set_trace() instrumentation had dropped us higher up in the stack, potentially at the top frame, we would use down to jump into the inner frames until we hit a location that had the information needed:

(Pdb) down
-> in_app = (in_app and not self.sym.is_internal_function(raw_frame.get('function')))
(Pdb) down
-> return _internal_function_re.search(function) is not None
(Pdb) type(function)
<type 'NoneType'>

So we’ve identified the problem: function is a NoneType. While that doesn’t really tell us why it’s that way, it at least gives us valuable information to speed up our test cases.

Debugging in Production

So PDB works great in development, but what about production? Let’s look a bit more deeply at what Python gives us to answer that question.

The great thing about the CPython runtime — that’s the standard runtime most people use — is it allows easy access to the current call stack. While some other runtimes (like PyPy) will provide similar information, it’s not guaranteed. When you hit an exception the stack is exposed via sys.exc_info(). Let’s look at what that gives us for a typical exception:

>>> try:
...   1 / 0
... except:
...   import sys; sys.exc_info()
...
(<type 'exceptions.ZeroDivisionError'>,
    ZeroDivisionError('integer division or modulo by zero',),
    <traceback object at 0x105da1a28>)

We’re going to avoid going too deep into this, but we’ve got a tuple of three pieces of information: the class of the exception, the actual instance of the exception, and a traceback object. The bit we care about here is the traceback object. Of note, you can also grab this information outside of exceptions using the traceback module. There’s some documentation on using these structures, but let’s just dive in ourselves to try and understand them. Within the traceback object we’ve got a bunch of information available to us, though it’s going to take a bit of work — and magic — to access:

>>> exc_type, exc_value, tb = exc_info
>>> tb.tb_frame
<frame object at 0x105dc0e10>

Once we’ve got a frame, CPython exposes ways to get stack locals — that is all scoped variables to that executing frame. For example, look at the following code:

The post How to Debug Python Errors appeared first on SitePoint.


by David Cramer via SitePoint

New Facebook Feature Lets You Share Saved Posts With Friends

'Saved posts' is a useful tool that Facebook has had for some time now. It seems that the social media giant has been carefully looking into how people use the feature. One of the ways in which people use it is that they tend to save posts that they want to show to other friends. This is in a lot...

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

by Zia Zaidi via Digital Information World

Is Instagram About to Change its User Interface?

Instagram has not changed drastically since it was first launched. After buying it, Facebook seemed to want to keep things the way they were because it seemed pretty obvious that there were a lot of things that were working perfectly about the platform. However, Instagram was seen testing a new...

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

by Zia Zaidi via Digital Information World

Mysterious Mass-logging out issue: Has Facebook Been Hacked?

Recently, Quora suffered from an enormous cyber attack, one that resulted in the data of a whopping hundred million users being compromised. Although most of the data that was stolen was already in the public domain, it shows the scale at which these attacks are often conducted. It seems like...

[ 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

Is Microsoft scrapping EdgeHTML?

#369 — December 5, 2018

Read on the Web

Frontend Focus

A Look At CSS Resets in 2018 — A review of CSS reset options (to cancel out the default styles browsers apply to HTML) and how they try to strike a balance between correcting user-agent styling ‘errors’, removing opinionated styling, and staying as consistent as possible.

Ire Aderinokun

Is Microsoft Building a Chromium-Powered Browser To Replace Edge? — This week the Web has been abuzz with the idea that Microsoft is going to divert attention away from working on its EdgeHTML engine and start to use Blink/Chromium instead. But with the news based on ‘anonymous sources’ and no official confirmation, we’ll need to keep an eye on this story.

Zac Bowden

Planning an Angular Application: Whitepaper — Angular devs—take a look at this checklist of things to consider when planning your next Angular app. Make an informed decision about tooling choices during development all the way through deployment. Get your free copy today.

Progress Kendo UI sponsor

Should We Use JavaScript to Load Our Web Fonts? — Browser support for new and safer CSS-only font loading strategies have left some devs wondering: are JS methods to load web fonts now necessary/useful?

Zach Leatherman

Bridging the Gap Between CSS and JavaScript: CSS-in-JS — As front-end components continue to be built with lashings of JavaScript, the idea of writing CSS within that JavaScript to style things at the component level has become more popular.

Matija Marohnic

Preventing Content Reflow From Lazy-Loaded Images — Lazily loading images is a good performance practice but what happens when those images load and change dimensions within the existing page layout? Reflow. But here’s how to avoid it.

James Steinbach

💻 Jobs

Frontend Developer at X-Team (Remote) — We help our developers keep learning and growing every day. Unleash your potential. Work from anywhere. Join X-Team.

x-team

Join Our Career Marketplace & Get Matched With A Job You Love — Through Hired, software engineers have transparency into salary offers, competing opportunities, and job details.

Hired

📘 Tutorials

Mistletoe Offline: Building A Custom Offline Page — Advice for building an offline page, for when a visitor can’t reach your site.

Jeremy Keith

Creating My First Chrome Extension — Bills itself as a ‘generous measure of know-how’ on the subject of creating extensions for Chrome.

Jennifer Wong

Get Festive with Manifold’s 12 Days of Cloud Services 🦌🎅❄️ — A blog post each day featuring a new service for you to learn about.

Manifold sponsor

Create Scalable and Lightweight Web Screenshots with SVG — How to generate SVG webpage screenshots that are infinitely scalable while being over 10 times smaller in file size than a detailed PNG screenshot.

Checkbot

'Can I Use' Now Tracking 'Picture-in-Picture' SupportPicture-in-Picture support is a new, and still experimental, idea for the Web where videos can be watched in a floating window while interacting with other pages.

Can I Use

▶  Making Future Interfaces: Unusual Shapes — A neat 6 minute video covering the ideas behind breaking away from boring rectangles and using things in the CSS Shapes spec to create different shapes and wrap other elements around them. Support isn’t too bad, though there’s nothing on Edge yet.

Heydon Pickering

The Ecological Impact of Browser Diversity — Following reports that Microsoft may kill off EdgeHTML, this article on browser diversity from earlier this year is worth revisiting.

Rachel Nabors

Too Much (Web) Accessibility?“if you’re really fretting about screen readers misinterpreting the nuanced usage of your semantic emphasis… you can relax on that one.”

Chris Coyier

Front-End Developers Have to Manage the Loading Experience

Chris Coyier

🔧 Code and Tools

DevTools for Designers — Links to a variety of posts and videos about Web developer tools aimed more at designers.

Chris Coyier

Screenshoteer: Make Web Page Screenshots from the Command Line — Controls headless Chrome with Puppeteer behind the scenes.

Vladimir Carrer

⚒ Retool — The New Way to Build Web Frontends

Retool sponsor

CSS Animation 101: How to Bring Animation to Your Web Projects — A free ebook on how, and why to use CSS animation on your web pages. Available on the web, and as a PDF or ePUB.

Donovan Hutchinson

Displaceable: Smooth Element Displacement on Mouse Move — A tiny JavaScript library that handles ‘super smooth’ element displacement on mouse move. Demo here.

Dino Hamzić

NES.css: A NES-Style CSS Framework — A retro 8-bit style CSS framework, inspired by the Nintendo Entertainment System. Repo here.

B.C.Rikko

A Complete Wedding Web Site — A happily married couple have open sourced the elegant wedding site (complete with RSVP feature) and encourage you to use it for your own.

Ram Patra

Transactional Email SaaS for Busy Developers

Emailwizard sponsor

3D Animated Bar Chart — Makes use of React, WebGL and 3D CSS - complete with mouseover hover effects.

Nick Matantsev

Dynamically Generated Alt Text with Azure's Computer Vision — A neat, practical demonstration of the Computer Vision API.

Sarah Drasner


by via Frontend Focus