17 August 2020

Deepfake video app Reface is just getting started on shapeshifting selfie culture


A bearded Rihanna gyrates and sings about shining bright like a diamond. A female Jack Sparrow looks like she’d be a right laugh over a pint. The cartoon contours of The Incredible Hulk lend envious tint to Donald Trump’s awfully familiar cheek bumps.

Selfie culture has a fancy new digital looking glass: Reface (previously Doublicat) is an app that uses AI-powered deepfake technology to let users try on another face/form for size. Aka “face swap videos”, in its marketing parlance.

Deepfake technology — or synthesized media, to give it its less pejorative label — is just getting into its creative stride, according to Roman Mogylnyi, CEO and co-founder of RefaceAI, which makes the eponymous app whose creepily lifelike output you may have noticed bubbling up in your social streams in recent months.

The startup has Ukrainian founders — as well as Mogylnyi, there’s Oles Petriv, Yaroslav Boiko, Dima Shvets, Denis Dmitrenko, Ivan Altsybieiev and Kyle Sygyda — but the business is incorporated in the US. Doubtless it helps to be nearer to Hollywood studios whose video clips power many of the available face swaps. (Want to see Titanic‘s Rose Hall recast with Trump’s visage staring out of Kate Winslet’s body? No we didn’t either — but once you’ve hit the button it’s horribly hard to unsee… 😷)

TechCrunch noticed a bunch of male friends WhatsApp-group-sharing video clips of themselves as scantily clad female singers and figured the developers must be onto something — a la Face App, or the earlier selfie trend of style transfer (a craze that was sparked by Prisma and cloned mercilessly by tech giants).

Reface’s deepfake effects are powered by a class of machine learning frameworks known as GANs (generative adversarial network) which is how it’s able to get such relatively slick results, per Mogylnyi. In a nutshell it’s generating a new animated face using the twin inputs (the selfie and the target video), rather than trying to mask one on top of the other.

Deepface technology has of course been around for a number of years, at this point, but the Reface team’s focus is on making the tech accessible and easy to use — serving it up as a push-button smartphone app with no need for more powerful hardware and near instant transformation from a single selfie snap. (It says it turns selfies into face vectors representing distinguishing user’s facial features — and pledges that uploaded photos are removed from its Google Cloud platform “within an hour”.)

No need for tech expertise nor lots of effort to achieve a lifelike effect. The inexorable social shares flowing from such a user friendly tech application then work to chalk off product marketing.

It was a similar story with the AI tech underpinning Prisma — which left that app open to merciless cloning, though it was initially only transforming photos. But Mogylnyi believes the team behind the video face swaps has enough of a head (ha!) start to avoid a similar fate.

He says usage of Reface has been growing “really fast” since it added high res videos this June — having initially launched with only far grainier GIF face swaps on offer.  In terms of metrics the startup us not disclosing active monthly users but says it’s had around 20 million downloads at this point across 100 countries. (On Google Play the app has almost a full five star rating, off of approaching 150k reviews.)

“I understand that an interest from huge companies might come. And it’s obvious. They see that it’s a great thing — personalization is the next trend, and they are all moving in the same direction, with Bitmoji, Memoji, all that stuff — but we see personalized, hyperrealistic face swapping as the next big thing,” Mogylnyi tells TechCrunch.

“Even for [tech giants] it takes time to create such a technology. Even speaking about our team we have a brilliant team, brilliant minds, and it took us a long time to get here. Even if you spawn many teams to work on the same problems surely you will get somewhere… but currently we’re ahead and we’re doing our best to work on new technologies to keep in pace,” he adds.

Reface’s app is certainly having a moment right now, bagging top download slots on the iOS App Store and Google Play in 100 countries — helped, along the way, by its reflective effects catching the eye of the likes of Elon Musk and Britney Spears (who Mogylnyi says have retweeted examples of its content).

But he sees this bump as just the beginning — predicting much bigger things coming down the sythensized pipe as more powerful features are switched on. The influx of bitesized celebrity face swaps signals an incoming era of personalized media, which could have a profoundly transformative effect on culture.

Mogylnyi’s hope is that wide access to synthensized media tools will increase humanity’s empathy and creativity — providing those who engage with the tech limitless chances to (auto)vicariously experience things they maybe otherwise couldn’t ever (or haven’t yet) — and so imagine themselves into new possibilities and lifestyles.

He reckons the tech will also open up opportunities for richly personalized content communities to grow up around stars and influencers — extending how their fans can interact with them.

“Right now the way influencers exist is only one way; they’re just giving their audience the content. In my understanding in our case we’ll let influencers have the possibility to give their audience access to the content and to feel themselves in it. It’s one of the really cool things we’re working on — so it will be a part of the platform,” he says.

“What’s interesting about new-gen social networks [like TikTok] is that people can both be like consumers and providers at the same time… So in our case people will also be able to be providers and consumers but on the next level because they will have the technology to allow themselves to feel themselves in the content.”

“I used to play basketball in school years but I had an injury and I was dreaming about a pro career but I had to stop playing really hard. I’ll never know how my life would have gone if I was a pro basketball player so I have to be a startup entrepreneur right now instead… So in the case with our platform I actually will have a chance to see how my pro basketball career would look like. Feel myself in the content and life this life,” he adds.

This vision is really the mirror opposite of the concerns that are typically attached to deepfakes, around the risk of people being taken in, tricked, shamed or otherwise manipulated by intentionally false imagery.

So it’s noteworthy that Reface is not letting users loose on their technology in a way that could risk an outpouring of problem content. For example, you can’t yet upload your own video to make into a deepfake — although the ability to do so is coming. For now, you have to pick from a selection of preloaded celebrity clips and GIFs which no one would mistake for the real-deal.

User generated video and a lot more — full body swaps are touted, next year — are coming, per Mogylnyi. But before they turn on more powerful content generation functionality they’re working on a counter tech to reliably detect such generated content. Mogylnyi says it will only open up usage once they’re confident of being able to spot their own fakes.

“It will be this autumn, actually,” he says of launching UGC video (plus the deepfake detection capability). “We’ll launch it with our Face Studio… which will be a tool for content creators, for small studios, for small post production studios, maybe some music video makers.”

“We also have five different technologies in our pipeline which we’ll show in the upcoming half a year,” he adds. “There are also other technologies and features based on current tech [stack] that we’ll be launching… We’ll allow users to swap faces in pictures with the new stack and also a couple of mechanics based on face swapping as well, and also separate technologies as well we’re aiming to put into the app.”

He says higher quality video swapping is another focus, alongside building out more technologies for post production studios. “Face Studio will be like an overall tool for people who want full access to our technologies,” he notes, saying the pro tool will launch later this year.

The Ukrainian team behind the app has been honing their deep tech chops for years — starting working together back in 2011 straight out of university and going on to set up a machine learning dev shop in 2013.

Work with post production studios followed, as they were asked to build face swapping technology to help budget-strapped film production studios do more while having to move their actors move around less.

By 2018, with plenty of expertise under their belt, they saw the potential for making deepface technology more accessible and user friendly — launching the GIF version of the app late last year, and going on to add video this summer when they also rebranded the app to Reface. The rest looks like it could be viral face swapping tech history…

So where does all this digital shapeshifting end up? “In our dreams and in our vision we see the app as a personalization platform where people will be able to live different lives during their one lifetime. So everyone can be anyone,” says Mogylnyi. “What’s the overall problem right now? People are scrolling content, not looking deep into it. And when I see people just using our app they always try to look inside — to look deeply into the picture. And that’s what really inspires us. So we understand that we can take the way people are browsing and the way they are consuming content to the next level.”


Read Full Article

How you can help map the world's most vulnerable places | Rebecca Firth

How you can help map the world's most vulnerable places | Rebecca Firth

Want to help map the world? Community builder Rebecca Firth explains how the Humanitarian OpenStreetMap Team (HOT) is using open-source software powered by volunteers to put one billion people on the map in the next five years. (This ambitious plan is a part of the Audacious Project, TED's initiative to inspire and fund global change.)

https://ift.tt/3145MHR

Click this link to view the TED Talk

Google Maps Formulas for Google Sheets


You can bring the power of Google Maps to your Google Sheets using simple formulas with no coding. You don’t need to sign-up for the Google Maps API and all results from Google Maps are cached in the sheet so you are unlikely to hit any quota limits.

To give you a quick example, if you have the starting address in column A and the destination address in column B, a formula like =GOOGLEMAPS_DISTANCE(A1, B1, "driving") will quickly calculate the distance between the two points.

Or modify the formula slightly =GOOGLEMAPS_TIME(A1, B1, "walking") to know how long it will take for a person to walk from one point to another.

If you would like to try the Google Maps formulas without getting into the technical details, just make a copy of this Google Sheet and you are all set.

Google Maps in Google Sheets

Using Google Maps inside Google Sheets

This tutorial explains how you can easily write custom Google Maps functions inside Google Sheets that will help you:

  1. Calculate distances between two cities or any addresses.
  2. Calculate the travel time (walking, driving or biking) between two points.
  3. Get the latitude and longitude co-ordinates of any address on Google Maps.
  4. Use reverse geocoding to find the postal address from GPS co-ordinates.
  5. Print driving directions between any points on earth.
  6. Get the address from the zip code itself.

1. Calculate Distances in Google Sheets

Specify the origin, the destination, the travel mode (walking or driving) and the function will return the distance between the two points in miles.

=GOOGLEMAPS_DISTANCE("NY 10005", "Hoboken NJ", "walking")

/**
 * Calculate the distance between two
 * locations on Google Maps.
 *
 * =GOOGLEMAPS_DISTANCE("NY 10005", "Hoboken NJ", "walking")
 *
 * @param {String} origin The address of starting point
 * @param {String} destination The address of destination
 * @param {String} mode The mode of travel (driving, walking, bicycling or transit)
 * @return {String} The distance in miles
 * @customFunction
 */
const GOOGLEMAPS_DISTANCE = (origin, destination, mode) => {
  const { routes: [data] = [] } = Maps.newDirectionFinder()
    .setOrigin(origin)
    .setDestination(destination)
    .setMode(mode)
    .getDirections();

  if (!data) {
    throw new Error('No route found!');
  }

  const { legs: [{ distance: { text: distance } } = {}] = [] } = data;
  return distance;
};

2. Reverse Geocoding in Google Sheets

Specify the latitude and longitude and get the full address of the point through reverse geocoding of coordinates.

=GOOGLEMAPS_DISTANCE("NY 10005", "Hoboken NJ", "walking")

/**
 * Use Reverse Geocoding to get the address of
 * a point location (latitude, longitude) on Google Maps.
 *
 * =GOOGLEMAPS_REVERSEGEOCODE(latitude, longitude)
 *
 * @param {String} latitude The latitude to lookup.
 * @param {String} longitude The longitude to lookup.
 * @return {String} The postal address of the point.
 * @customFunction
 */

const GOOGLEMAPS_REVERSEGEOCODE = (latitude, longitude) => {
  const { results: [data = {}] = [] } = Maps.newGeocoder().reverseGeocode(
    latitude,
    longitude
  );
  return data.formatted_address;
};

3. Get the GPS coordinates of an address

Get the latitude and longitude of any address on Google Maps.

=GOOGLEMAPS_LATLONG("10 Hanover Square, NY")

/**
 * Get the latitude and longitude of any
 * address on Google Maps.
 *
 * =GOOGLEMAPS_LATLONG("10 Hanover Square, NY")
 *
 * @param {String} address The address to lookup.
 * @return {String} The latitude and longitude of the address.
 * @customFunction
 */
const GOOGLEMAPS_LATLONG = (address) => {
  const { results: [data = null] = [] } = Maps.newGeocoder().geocode(address);
  if (data === null) {
    throw new Error('Address not found!');
  }
  const { geometry: { location: { lat, lng } } = {} } = data;
  return `${lat}, ${lng}`;
};

4. Print the driving directions between addresses

Specify the origin address, the destination address, the travel mode and the function will use the Google Maps API to print step-by-step driving directions.

=GOOGLEMAPS_DIRECTIONS("NY 10005", "Hoboken NJ", "walking")

/**
 * Find the driving direction between two
 * locations on Google Maps.
 *
 * =GOOGLEMAPS_DIRECTIONS("NY 10005", "Hoboken NJ", "walking")
 *
 * @param {String} origin The address of starting point
 * @param {String} destination The address of destination
 * @param {String} mode The mode of travel (driving, walking, bicycling or transit)
 * @return {String} The driving direction
 * @customFunction
 */
const GOOGLEMAPS_DIRECTIONS = (origin, destination, mode = 'driving') => {
  const { routes = [] } = Maps.newDirectionFinder()
    .setOrigin(origin)
    .setDestination(destination)
    .setMode(mode)
    .getDirections();
  if (!routes.length) {
    throw new Error('No route found!');
  }
  return routes
    .map(({ legs }) => {
      return legs.map(({ steps }) => {
        return steps.map((step) => {
          return step.html_instructions.replace(/<[^>]+>/g, '');
        });
      });
    })
    .join(', ');
};

5. Measure the trip time with Google Maps

Specify the origin address, the destination address, the travel mode and the function will measure your approximate trip time between the specified addresses, provided a route exists.

=GOOGLEMAPS_DURATION("NY 10005", "Hoboken NJ", "walking")

/**
 * Calculate the travel time between two locations
 * on Google Maps.
 *
 * =GOOGLEMAPS_DURATION("NY 10005", "Hoboken NJ", "walking")
 *
 * @param {String} origin The address of starting point
 * @param {String} destination The address of destination
 * @param {String} mode The mode of travel (driving, walking, bicycling or transit)
 * @return {String} The time in minutes
 * @customFunction
 */
const GOOGLEMAPS_DURATION = (origin, destination, mode = 'driving') => {
  const { routes: [data] = [] } = Maps.newDirectionFinder()
    .setOrigin(origin)
    .setDestination(destination)
    .setMode(mode)
    .getDirections();
  if (!data) {
    throw new Error('No route found!');
  }
  const { legs: [{ duration: { text: time } } = {}] = [] } = data;
  return time;
};

Google Maps Functions in Sheets

Tip: Improve Performance by Caching Results

All the above Google Sheets functions internally use the Google Maps API to calculate routes, distances and travel time. Google offers a limited quota for Maps operations and if your sheet performs too many queries in a short duration, you are likely to see errors like ""Service invoked too many times for one day” or something similar.

To get around this problem, it is recommended that you use Apps Script’s built-in cache to store results and, if the results of a function already exist in the case, you’ll make one less request to Google Maps The Maps functions inside this Google Sheet also use caching and here’s how you can implement it.

// The cache key for "New York" and "new york  " should be same
const md5 = (key = '') => {
  const code = key.toLowerCase().replace(/\s/g, '');
  return Utilities.computeDigest(Utilities.DigestAlgorithm.MD5, key)
    .map((char) => (char + 256).toString(16).slice(-2))
    .join('');
};

const getCache = (key) => {
  return CacheService.getDocumentCache().get(md5(key));
};

// Store the results for 6 hours
const setCache = (key, value) => {
  const expirationInSeconds = 6 * 60 * 60;
  CacheService.getDocumentCache().put(md5(key), value, expirationInSeconds);
};

/**
 * Calculate the travel time between two locations
 * on Google Maps.
 *
 * =GOOGLEMAPS_DURATION("NY 10005", "Hoboken NJ", "walking")
 *
 * @param {String} origin The address of starting point
 * @param {String} destination The address of destination
 * @param {String} mode The mode of travel (driving, walking, bicycling or transit)
 * @return {String} The time in minutes
 * @customFunction
 */
const GOOGLEMAPS_DURATION = (origin, destination, mode = 'driving') => {
  const key = ['duration', origin, destination, mode].join(',');
  // Is result in the internal cache?
  const value = getCache(key);
  // If yes, serve the cached result
  if (value !== null) return value;
  const { routes: [data] = [] } = Maps.newDirectionFinder()
    .setOrigin(origin)
    .setDestination(destination)
    .setMode(mode)
    .getDirections();
  if (!data) {
    throw new Error('No route found!');
  }
  const { legs: [{ duration: { text: time } } = {}] = [] } = data;
  // Store the result in internal cache for future
  setCache(key, time);
  return time;
};

Also see: Embed Google Maps in Emails and Documents


TikTok announces a deal with UnitedMasters, its first music distribution partnership


Though TikTok’s future in the U.S. remains uncertain, the company announced this morning its first music distribution partnership, with indie music distributor UnitedMasters. The deal will allow artists on TikTok to tap into the platform’s ability to make their music go viral, then distribute their songs directly to other music streaming services, like Spotify, Apple Music/iTunes, SoundCloud, and YouTube.

The deal allows indie artists to effectively circumvent traditional record labels by reaching young music fans on the social video app, then translate that to charting success.

Already, TikTok has proven its capabilities in this area, having helped push little known or undiscovered artists to further growth, including Lil Nas X, Ambjaay, StaySolidRocky, Powfu, BENEE, Y2K, bbno$, and others, the company noted in an announcement about the new deal. Meanwhile, artists like Curtis Roach, Curtis Waters, Breland, Tai Verdes, BMW Kenny and others have used TikTok to promote their music. Some, like ppcocaine and Avenue Beat, preview original music directly on the platform. Several emerging artists, like Shuba, Blu DeTiger, and Kid Sistr, have even used TikTok as a platform for creative performances.

UnitedMasters, meanwhile, has helped launched the careers of artists like platinum-selling rapper NLE Choppa, plus Lil Tecca, Tobe Nwigwe, Lil XXEL, and others. In the past 18 months, it has grown its lineup to over 400,000 artists who have a combined 5 billion streams and over a half million distributed tracks.

UnitedMasters takes a 10% share of revenue for music it distributes, and allows artists to retain their rights. It also works to facilitate relationships between artists and brands. According to the company’s website, UnitedMasters currently works with brands like the NBA, Bose, AT&T, the NFL and others.

TikTok says its new agreement with UnitedMasters will also involve promoting their artists on its video platform. That means artists will have more opportunities to reach new fans who could then, in turn, use the artists’ music in their videos. TikTok will also add the music from UnitedMasters’ artists, with their permission, to its Commercial Music Library. This catalog gives verified businesses access to royalty-free music for use with their promotional content.

“TikTok artists who are creating music in their bedrooms today will be featured in the Billboard charts tomorrow,” said Ole Obermann, Global Head of Music at TikTok, in a statement. “Our mission is to help those artists achieve their creative potential and success. This partnership with UnitedMasters gives us a turn-key solution to help artists who are born on TikTok to reach their fans on every music service.”

Trying to work around the labels is a tricky prospect, other music services have found. Spotify, for example, tried offering a tool that would have allowed indie artists to upload their own music directly to its streaming service. But the tool was shut down in less than a year’s time, after beta testing, as its existence complicated Spotify’s label negotiations.

TikTok, however, has different sorts of licensing deals with the major labels because it’s not a streaming service for music, nor a platform for watching official music videos, like YouTube and now, Facebook. Instead, its music deals are reportedly shorter-term agreements than those the labels strike with other tech companies, a Billboard report said. The deals give the video platform the right to use 30-second clips of the record labels’ songs, not full tracks. To date, many of TikTok’s music deals are separate from those its parent company ByteDance inked for its streaming music service, Resso. (A deal with Merlin was a recent exception, however).

Because of the complicated nature of these sorts of negotiations, it’s unclear how the major labels will react to what appears to be a way for TikTok to eventually route around their cut. By promoting indie artists to help them achieve viral success without a traditional label’s involvement, TikTok could become a launching pad for artists who don’t want a label deal. Instead, TikTok artists would gain access to fans and, eventually, the resulting revenue potential that comes with having a large audience.

This likely won’t go down well with labels, who have already been pushing TikTok to find more ways to generate revenue for music rights holders, as Billboard’s report had noted.

“If you are a musical artist, TikTok is the best place for your music to go viral and UnitedMasters is the best place to sustain it while retaining full ownership of your work,” said Steve Stoute, CEO and Founder of UnitedMasters, in a statement about the TikTok partnership. “By combining the two, we create the platform for tomorrow’s stars who will be famous, fiercely independent and wealthy.”


Read Full Article

Google Maps Formulas for Google Sheets


You can bring the power of Google Maps to your Google Sheets using simple formulas with no coding. You don’t need to sign-up for the Google Maps API and all results from Google Maps are cached in the sheet so you are unlikely to hit any quota limits.

To give you a quick example, if you have the starting address in column A and the destination address in column B, a formula like =GOOGLEMAPS_DISTANCE(A1, B1, "driving") will quickly calculate the distance between the two points.

Or modify the formula slightly =GOOGLEMAPS_TIME(A1, B1, "walking") to know how long it will take for a person to walk from one point to another.

If you would like to try the Google Maps formulas without getting into the technical details, just make a copy of this Google Sheet and you are all set.

Google Maps in Google Sheets

Using Google Maps inside Google Sheets

This tutorial explains how you can easily write custom Google Maps functions inside Google Sheets that will help you:

  1. Calculate distances between two cities or any addresses.
  2. Calculate the travel time (walking, driving or biking) between two points.
  3. Get the latitude and longitude co-ordinates of any address on Google Maps.
  4. Use reverse geocoding to find the postal address from GPS co-ordinates.
  5. Print driving directions between any points on earth.
  6. Get the address from the zip code itself.

1. Calculate Distances in Google Sheets

Specify the origin, the destination, the travel mode (walking or driving) and the function will return the distance between the two points in miles.

=GOOGLEMAPS_DISTANCE("NY 10005", "Hoboken NJ", "walking")

/**
 * Calculate the distance between two
 * locations on Google Maps.
 *
 * =GOOGLEMAPS_DISTANCE("NY 10005", "Hoboken NJ", "walking")
 *
 * @param {String} origin The address of starting point
 * @param {String} destination The address of destination
 * @param {String} mode The mode of travel (driving, walking, bicycling or transit)
 * @return {String} The distance in miles
 * @customFunction
 */
const GOOGLEMAPS_DISTANCE = (origin, destination, mode) => {
  const { routes: [data] = [] } = Maps.newDirectionFinder()
    .setOrigin(origin)
    .setDestination(destination)
    .setMode(mode)
    .getDirections();

  if (!data) {
    throw new Error('No route found!');
  }

  const { legs: [{ distance: { text: distance } } = {}] = [] } = data;
  return distance;
};

2. Reverse Geocoding in Google Sheets

Specify the latitude and longitude and get the full address of the point through reverse geocoding of coordinates.

=GOOGLEMAPS_DISTANCE("NY 10005", "Hoboken NJ", "walking")

/**
 * Use Reverse Geocoding to get the address of
 * a point location (latitude, longitude) on Google Maps.
 *
 * =GOOGLEMAPS_REVERSEGEOCODE(latitude, longitude)
 *
 * @param {String} latitude The latitude to lookup.
 * @param {String} longitude The longitude to lookup.
 * @return {String} The postal address of the point.
 * @customFunction
 */

const GOOGLEMAPS_REVERSEGEOCODE = (latitude, longitude) => {
  const { results: [data = {}] = [] } = Maps.newGeocoder().reverseGeocode(
    latitude,
    longitude
  );
  return data.formatted_address;
};

3. Get the GPS coordinates of an address

Get the latitude and longitude of any address on Google Maps.

=GOOGLEMAPS_LATLONG("10 Hanover Square, NY")

/**
 * Get the latitude and longitude of any
 * address on Google Maps.
 *
 * =GOOGLEMAPS_LATLONG("10 Hanover Square, NY")
 *
 * @param {String} address The address to lookup.
 * @return {String} The latitude and longitude of the address.
 * @customFunction
 */
const GOOGLEMAPS_LATLONG = (address) => {
  const { results: [data = null] = [] } = Maps.newGeocoder().geocode(address);
  if (data === null) {
    throw new Error('Address not found!');
  }
  const { geometry: { location: { lat, lng } } = {} } = data;
  return `${lat}, ${lng}`;
};

4. Print the driving directions between addresses

Specify the origin address, the destination address, the travel mode and the function will use the Google Maps API to print step-by-step driving directions.

=GOOGLEMAPS_DIRECTIONS("NY 10005", "Hoboken NJ", "walking")

/**
 * Find the driving direction between two
 * locations on Google Maps.
 *
 * =GOOGLEMAPS_DIRECTIONS("NY 10005", "Hoboken NJ", "walking")
 *
 * @param {String} origin The address of starting point
 * @param {String} destination The address of destination
 * @param {String} mode The mode of travel (driving, walking, bicycling or transit)
 * @return {String} The driving direction
 * @customFunction
 */
const GOOGLEMAPS_DIRECTIONS = (origin, destination, mode = 'driving') => {
  const { routes = [] } = Maps.newDirectionFinder()
    .setOrigin(origin)
    .setDestination(destination)
    .setMode(mode)
    .getDirections();
  if (!routes.length) {
    throw new Error('No route found!');
  }
  return routes
    .map(({ legs }) => {
      return legs.map(({ steps }) => {
        return steps.map((step) => {
          return step.html_instructions.replace(/<[^>]+>/g, '');
        });
      });
    })
    .join(', ');
};

5. Measure the trip time with Google Maps

Specify the origin address, the destination address, the travel mode and the function will measure your approximate trip time between the specified addresses, provided a route exists.

=GOOGLEMAPS_DURATION("NY 10005", "Hoboken NJ", "walking")

/**
 * Calculate the travel time between two locations
 * on Google Maps.
 *
 * =GOOGLEMAPS_DURATION("NY 10005", "Hoboken NJ", "walking")
 *
 * @param {String} origin The address of starting point
 * @param {String} destination The address of destination
 * @param {String} mode The mode of travel (driving, walking, bicycling or transit)
 * @return {String} The time in minutes
 * @customFunction
 */
const GOOGLEMAPS_DURATION = (origin, destination, mode = 'driving') => {
  const { routes: [data] = [] } = Maps.newDirectionFinder()
    .setOrigin(origin)
    .setDestination(destination)
    .setMode(mode)
    .getDirections();
  if (!data) {
    throw new Error('No route found!');
  }
  const { legs: [{ duration: { text: time } } = {}] = [] } = data;
  return time;
};

Google Maps Functions in Sheets

Tip: Improve Performance by Caching Results

All the above Google Sheets functions internally use the Google Maps API to calculate routes, distances and travel time. Google offers a limited quota for Maps operations and if your sheet performs too many queries in a short duration, you are likely to see errors like ""Service invoked too many times for one day” or something similar.

To get around this problem, it is recommended that you use Apps Script’s built-in cache to store results and, if the results of a function already exist in the case, you’ll make one less request to Google Maps The Maps functions inside this Google Sheet also use caching and here’s how you can implement it.

// The cache key for "New York" and "new york  " should be same
const md5 = (key = '') => {
  const code = key.toLowerCase().replace(/\s/g, '');
  return Utilities.computeDigest(Utilities.DigestAlgorithm.MD5, key)
    .map((char) => (char + 256).toString(16).slice(-2))
    .join('');
};

const getCache = (key) => {
  return CacheService.getDocumentCache().get(md5(key));
};

// Store the results for 6 hours
const setCache = (key, value) => {
  const expirationInSeconds = 6 * 60 * 60;
  CacheService.getDocumentCache().put(md5(key), value, expirationInSeconds);
};

/**
 * Calculate the travel time between two locations
 * on Google Maps.
 *
 * =GOOGLEMAPS_DURATION("NY 10005", "Hoboken NJ", "walking")
 *
 * @param {String} origin The address of starting point
 * @param {String} destination The address of destination
 * @param {String} mode The mode of travel (driving, walking, bicycling or transit)
 * @return {String} The time in minutes
 * @customFunction
 */
const GOOGLEMAPS_DURATION = (origin, destination, mode = 'driving') => {
  const key = ['duration', origin, destination, mode].join(',');
  // Is result in the internal cache?
  const value = getCache(key);
  // If yes, serve the cached result
  if (value !== null) return value;
  const { routes: [data] = [] } = Maps.newDirectionFinder()
    .setOrigin(origin)
    .setDestination(destination)
    .setMode(mode)
    .getDirections();
  if (!data) {
    throw new Error('No route found!');
  }
  const { legs: [{ duration: { text: time } } = {}] = [] } = data;
  // Store the result in internal cache for future
  setCache(key, time);
  return time;
};

Also see: Embed Google Maps in Emails and Documents


How To Prevent Alt + Tab From Showing Edge Tabs


CLICK HERE TO SEE FULL POST

Up until now, the Alt + Tab function allowed users to quickly switch between running programs and apps. This will change soon with the upcoming Windows 10 feature update. In Windows 10 version 2009, Windows 10 displays all Microsoft Edge tabs in the Alt + Tab. That is, tabs or webpages that are open in […]

The post How To Prevent Alt + Tab From Showing Edge Tabs appeared first on Into Windows. Content from IntoWindows website.


Google warns users in Australia free services are at risk if it’s forced to share ad revenue with “big media”


Google has fired a lobbying pot-shot at a looming change to the law in Australia that will force it to share ad revenue with local media businesses whose content its platforms monetize — seeking to mobilize its users against “big media”.

Last month Australia’s Competition and Consumer Commission (ACCC) published a draft of a mandatory code that seeks to address what it described as “acute bargaining power imbalances” between local news media and tech giants, Facebook and Google,  by engaging in good faith negotiations and via a binding “final offer” arbitration process.

Back in April the country’s government announced it would adopt a mandatory code requiring the two tech giants to share ad revenue with media business after an attempt to negotiate a voluntary arrangement with the companies failed to make progress.

In an open letter addressing users in Australia, which is attributed to Mel Silva, MD for Google Australia, the tech giant warns that their experience of its products will suffer and their data could be at risk as a consequence of the regulation. It also suggests it may no longer be able to offer free services in the country.

The letter is being pushed at users of Google search in the country via a pop-up that warns “the way Aussies use Google is at risk”, according to the Guardian.

“This law wouldn’t just impact the way Google and YouTube work with news media businesses — it would impact all of our Australian users, so we wanted to let you know,” Google writes, adding that it’s “going to do everything we possibly can to get this proposal changed”.

In the blog post, it deploys three scare tactics to try to recruit users to lobby the government on its behalf — claiming the regulation will result in:

  1. a “dramatically worse Google Search and YouTube”: Google says the content users see will be less relevant and “helpful” as it will be forced to give news businesses information that will help them “artificially” inflate their ranking “over everyone else”
  2. risks to users’ search data because Google will have to tell news media businesses “how they can gain access” to data about their use of its products. “There’s no way of knowing if any data handed over would be protected, or how it might be used by news media businesses,” adds the data-mining tech giant
  3. overarching risks to free Google services; Giving “big media companies” special treatment will encourage them to make “enormous and unreasonable demands that would put our free services at risk”, is the claim

Google’s open letter instructs users to expect to hear more from it in the coming days — without offering further detail — so it remains to be seen what additional scare tactics the company cooks up.

Consultation on the draft code closes on August 28, with the ACCC saying last month that it intends for it to be finalized “shortly”, so Google’s window to lobby for changes is fast closing.

It’s not the first tech giant to try to repurpose the reach and scale of its platform to mobilize its own users to drum up helpful opposition to government action that threatens its corporate interests.

Over the last half decade or so, similar tactics have been deployed by a variety of gig economy platforms, including Airbnb, Lyft and Uber, to try to politize and overturn regulations which present a barrier to their continued growth.

Such efforts have, it must be said, only had very fleeting successes vs the scale of the platforms’ regulatory ‘reform’ ambitions. (Gig giants Uber and Lyft are facing a huge fight in their own backyard on key issues like worker reclassification, for example, so in fact regulators and courts have successfully pushed back against BS.)

But it’s interesting to see the tactic moving onto the front page of Google — perhaps signalling the scale of alarm the company feels over the prospect of being forced to share ad revenue with publishers whose content it monetizes, creating a model that other countries and regions might seek to follow.

In a statement responding to Google’s open letter, the ACCC went on the attack — accusing the tech giant of publishing “misinformation” about the draft code.

“Google will not be required to share any additional user data with Australian news businesses unless it chooses to do so,” the regulator writes, further asserting that any move to charge for free Google services like YouTube and search would be the company’s own decision.

“The draft code will allow Australian news businesses to negotiate for fair payment for their journalists’ work that is included on Google services. This will address a significant bargaining power imbalance between Australian news media businesses and Google and Facebook,” it goes on, adding: “A healthy news media sector is essential to a well-functioning democracy.”

Google’s parent entity, Alphabet, reported full year revenue of $161.8BN in 2019 — up from $136.8BN in 2018.


Read Full Article