Intro to Yelp Web Scraping Using Python

Originally published June 17, 2020

Like many programmers who hold degrees that are not even relevant to computer programming, I was struggling to learn coding by myself since 2019 in the hope to succeed in the job. As a self-taught developer, I’m more practical and goal-oriented about things that I’ve learned. This is why I like web scraping particularly, not only it has a wide variety of use cases such as product monitoring, social media monitoring, content aggregation, etc, but also it’s easy to pick up.

6 Ways Big Data Analytics Change the Insurance Industry

Technology has a big impact on the way the insurance sector does business. Although big data analytics as a service is still fairly new, insurers rely on it heavily. As companies increase the number of policyholders in their databases, the need for meaningful analysis becomes more crucial. Big data analytics applications make this task feasible.

Big data services help resolve data issues that insurers face on a daily basis. A big data analytics platform can be challenging for those still getting used to the technology. However, there are many advantages to coming to terms with what big data offerings can do for your business. Learn more about how the insurance industry benefits from data analytics from the time a customer signs an application through their first claim filing.

How to Use Hyperlinks in Google Sheets

This guide explains how you can easily create and manage hyperlinks in Google Sheets. An entire cell in the sheet, or specific text inside the cell, can be linked to external web pages. A cell can also contain multiple hyperlinks.

If you type a web page address in a Google Sheet cell, it is automatically converted into a clickable hyperlink.

Text converted into hyperlink

You can add anchor text to plain hyperlinks for more accessible URLs. Hover your mouse over the hyperlink and click the Edit icon. Now add the anchor text in the Text input box and click the green Apply button.

Alternatively, you may use the built-in HYPERLINK function in Google Sheet to create web links with (optional) anchor text.

 =HYPERLINK("https://www.labnol.org", "Digital Inspiration")

Add anchor text to hyperlink

It is also possible to include multiple hyperlinks inside a single cell of the Google Sheet.

Just type any text, include URLs in plain text and when you move the cursor out of the cell, the URLs are converted into hyperlinks.

Bonus Tip: While a cell with multiple links is selected, press Alt+Enter and all the links with open at once in new tabs.

Multiple hyperlinks in Google Sheet Cell

You can use the previous technique to edit multiple hyperlinks contained in a single cell and add anchor text.

Hover your mouse over a link in the cell, click the edit icon and change the Anchor text. Repeat this for all other links in the same cell.

Format Muliple URLs

Also see Secret Google Drive URLs.

Here are some snippets that will help you manage your hyperlinks in Google Sheets using Google Script macros.

const createHyperLinkWithFormula = () => {
  const link = 'https://www.labnol.org';
  const text = 'Digital Inspiration';
  const value = `=HYPERLINK("${link}", "${text}")`;
  const sheet = SpreadsheetApp.getActiveSheet();
  const range = sheet.getRange('A1');
  range.setValue(value);
};
const createHyperLinkWithRichTextValue = () => {
  const link = 'https://www.labnol.org';
  const text = 'Digital Inspiration';
  const value = SpreadsheetApp.newRichTextValue()
    .setText(text)
    .setLinkUrl(link)
    .build();
  SpreadsheetApp.getActiveSheet().getRange('A1').setRichTextValue(value);
};
const createMultipleHyperLinks = () => {
  const value = SpreadsheetApp.newRichTextValue()
    .setText('Google acquired YouTube in 2006')
    .setLinkUrl(0, 6, 'https://www.google.com')
    .setLinkUrl(16, 23, 'https://www.youtube.com')
    .build();
  SpreadsheetApp.getActiveSheet().getRange('A1').setRichTextValue(value);
};
const extractLinkFromFormula = () => {
  const sheet = SpreadsheetApp.getActiveSheet();
  const range = sheet.getRange('A1');
  const formula = range.getFormula();
  const [, url, , text] =
    formula.match(/=HYPERLINK\("(.+?)"([;,]"(.+?)")?\)/) || [];
  Logger.log({ url, text: text || url });
};
const extractMultipleLinks = () => {
  const urls = SpreadsheetApp.getActiveSheet()
    .getRange('A1')
    .getRichTextValue()
    .getRuns()
    .map((run) => {
      return {
        url: run.getLinkUrl(),
        text: run.getText(),
      };
    })
    .filter(({ url }) => url);
  Logger.log(urls);
};

Let People Quickly Save your Events on their Calendars

You are organizing an online event - maybe a meeting on Zoom or a training session hosted on Google Meet - and you would like the attendees to add the event to their own calendars. Once added to their calendar, the event will act as an automatic reminder and attendees will get a notification when the conference is about to start.

There are two way to go about this:

  1. You can create a new meeting in your online calendar (Google, Outlook or any other calendar) and add the individual attendees as guests so the event automatically gets added to their calendar as well.

  2. You can include an “Add to Calendar” link or button in your email messages, forms and website pages. Anyone can click the link to quickly save your event on to their calendars - see live demo.

The Add to Calendar app can create links that will let people quickly save your events on to their own calendars. You can create links and event reminder buttons for Google Calendar, Outlook, Microsoft Office 365 and Yahoo! Calendar.

The app will also generate downloadable iCalendar .ics files.

Add to Calendar

To get started, add the event title and choose the default timezone of your event. Then use the built-in date and time picker to specify the event start date and end date. If the event spans the entire day, check the “All Day Event” option.

The event description field can have long text, hyperlinks and simple HTML tags for formatting. Next choose the calendar name to target and click the Generate button. The app generates plain links that you can paste in emails and HTML buttons (with inline CSS) for embedding in your web pages and email newsletters.

You can create “Add to Calendar” links on both the desktop and your mobile phone. People who click on these links can quickly save your event on their calendar, which will also remind them about your event automatically.

Packagist, GitLab, and GitHubUpdater Plugin Work to Improve Support for Alternative Default Branch Names

In response to recent events, where American police officers have been charged with murder for the deaths of George Floyd and Rayshard Brooks, along with the protests led by the Black Lives Matter movement, many repository owners are rejecting the use of the term ‘master’ for the default branch as oppressive terminology. As Git-based repository hosting platforms are moving to make it easier for users to select alternative default branch names, Packagist is working to better support Composer package owners during this transition.

Packagist.org co-founder Jordi Boggiano explained how Composer 1.x has decent support for other default branch names. It allows users to define a branch-alias to rename the default branch to anything, while ensuring that everything still works. Composer 2.x doesn’t assign specialized meaning to master/trunk/default branch names but rather normalizes to named versions. Boggiano also highlighted a few other ways Packagist is improving the transition for people who are renaming their default branches:

In the last couple of days we further improved the experience for alternative default branch names by keeping track of the default name configured in the VCS repository. If you change your default branch to main for example, then master will not have any meaning on your repository. The default branch will receive an alias internally to 9999999-dev unless you configure a branch-alias to a different version yourself.

These changes allowed us to fix a few related issues on packagist.org. The default branch is now always shown on top in the version list. There is no more special treatment for master as a branch name, everything should work no matter what you decide to call your default branch.

While it may not be very difficult for repository owners to change the ‘master’ branch to another name, there may be more required changes to established workflows, integrations, and pipelines that reference the default branch.

The GitHubUpdater plugin is one popular plugin that may be impacted by developers renaming their default branches. Andy Fragen is currently exploring a solution that would offer developers better support for having a principal branch named something other than ‘master:’ 

It is my intention to support whatever naming scheme the developer/user of this plugin desires to use. I am currently testing a branch locally to allow for a Release Branch header to accomplish this. This would require a header in your repository with Release Branch: trunk or Release Branch: main if your move from the previous default of master.

Over the weekend, the discussion around this issue heated up on our post about renaming the ‘Master’ branch of WordPress-owned Git repositories, as well as on the original proposal. Opponents contend that these types of changes in terminology are performative and do nothing to solve real problems like the lack of diversity in tech. Proponents argue that language is powerful and even small changes like this can help new contributors feel more welcome.

GitHub is also getting pushback on its initiative to discontinue using ‘master’ for the default branch. A reddit thread has more than 2,600 comments on the issue. The consensus seems to be that GitHub’s move is merely a gesture at best, and at worst a distraction from real issues and a waste of time and resources. Many see GitHub’s move as giving “the illusion of positive change” in the place of real effort on important issues, at the expense of broken scripts and integrations.

When Nat Friedman said GitHub is already working on renaming ‘master’ to ‘main,’ some users threatened to move to GitLab over it. However, GitLab is working on a similar initiative that would let users choose their own default branch name.

“GitLab is currently fairly opinionated about the default branch name, despite this diversity of preferences – in most situations, it will create a new project with a master branch, or configured for the first new branch to be master, without any user input, and without providing any choice to the user,” GitLab engineer Nick Thomas said. His proposal aims to give users a choice when creating new projects.

Gitlab still has the problem of deciding on what to set for a default branch name when one isn’t specified. Discussion on this issue is heated as well, although more GitLab users seem to be positively disposed towards the general idea proposed in the ticket. Thomas noted that whether master is an appropriate term in this context or not is “probably best taken up at the git-project-level.”

In response to Nat Friedman’s tweet about GitHub renaming the ‘master’ branch, Petr Baudis, the person who originally chose the default names for “master” and “origin,” said he regrets using these terms.

“I picked the names ‘master (and ‘origin’) in the early Git tooling back in 2005,” Baudis said. “This probably means you shouldn’t give much weight to my name preferences. I have wished many times I would have named them ‘main’ (and ‘upstream’) instead. Glad it’s happening.”

14 Best Testimonials WordPress Plugins

Best Testimonials WordPress PluginsDisplaying testimonials on your WordPress website is one of the best ways to show social proof and build trust with your website visitors. According to statistics compiled by BigCommerce, simply by using testimonials regularly, you could generate 62% more revenue per site visitor. Another data point that speaks in favor of testimonials states that the vast […]

The post 14 Best Testimonials WordPress Plugins appeared first on WPExplorer.

Why App Developers Need to Adapt CIAM Today More Than Ever

As B2C companies look to offer an elevated user experience across all touchpoints, app developers are increasingly turning to customer identity and access management (CIAM) solutions that can help protect customer data and enhance the customer experience.

Customers have become increasingly receptive to new technologies and are using a wide array of digital solutions such as smartphones, wearable devices, virtual reality (VR), and Internet of Things-enabled systems in their daily lives. These digital solutions have made the execution of tasks easier and faster, bringing about a major change in customers’ behavior – i.e. the need for instant gratification of their demands. 

An Overview of Scroll Technologies

Scroll-related animations have been used on the web for years. In recent years, they’ve started to become more common, perhaps in part due to devices being higher-performing and thus able to handle more animation. 

There are a number of scroll related technologies out there, so this article’s aim is to provide an overview of them and tools to help choose the one that’s right for you. I’d argue that these technologies can be broken down into two broad categories: ones for specific scroll-related behaviors and ones for more generic scroll-related behaviors.

Technologies for specific scroll-related behaviors

There are a few simple native CSS scroll effects that are supported by modern browsers. In some limited use cases they can be sufficient for your scroll animation needs.

position: sticky;

If all you need is for an element to stay in the same place on scroll for a portion of the page, using position: sticky is a good option. It’s straightforward and built into modern browsers. That said, a polyfill is required for IE support and some mobile browsers. For a solid overview, check out this article by Preethi.

CSS parallax

This isn’t a technology as much as a technique, but it’s pretty handy for simple parallax effects where you want different pieces of the page to move at different speeds on scroll. There’s a good write up of the technique on Alligator.io and a bunch of examples on CodePen, like this Firewatch header. The biggest downside for me is that it’s difficult to understand what values to use to set the perspective and transforms in order to get the parallax effect exactly right.

CSS scroll snap points

Scroll snap points allow the browser to snap to particular scroll positions that you set after a user is done with their normal scrolling. This can be helpful for keeping certain elements in view. However, the API is still in flux so be careful to use the most up to date API and be careful about relying on it in production. This CSS-Tricks article by Max Kohler is a good place to learn about it right now.

Smooth scrolling

Smooth scrolling is supported natively when jumping from section to section within a page using window.scrollTo() in JavaScript or even the scroll-behavior property in CSS. Generic smooth scrolling that smooths out mouse wheel actions is not supported natively in all browsers at this time. There are various JavaScript libraries that attempt to add smooth scroll support for the mousewheel action, but I’ve yet to find one that is bug-free and plays nicely with all other scroll technologies. Plus, smooth scrolling isn’t always good in the first place.

Technologies for generic scroll behaviors

Currently, there is no way to create or fire generic animations based on the scroll position using just CSS (though there is a proposal that could support some form of generic scroll based animations in CSS in the distant future) or to scrub through part of an animation. As such, if you want to animate elements on scroll, you’ll need to use at least some JavaScript to create the effect you want. There are two broad methods of using JavaScript to fire animations on scroll: using intersection observers and using the scroll event.

IntersectionObserver

Intersection observers are great if all you need for your animation is information related to whether or not and how much of an element is visible in the viewport. This makes them a good option for reveal animations. Even then, some things are difficult (though not impossible) using intersection observers, such as firing different animations depending on the direction an element enters the viewport. Intersection observers also aren’t very helpful if you want to do any scroll animations when an element is in between and not overlapping with the start and end points. 

Using the scroll event

Using the scroll event will give you the most freedom in controlling animations on scroll. It allows you to affect an element on scroll no matter where it is in terms of the viewport and set up starting and ending points exactly as you need for your project. 

With that being said, it can also be intense on performance if it isn’t throttled correctly and doesn’t have a convenient API to create particular behaviors. This is why it’s oftentimes helpful to use a good scrolling library that can handle the throttling for you and give you a more handy API to work with. Some can even handle a lot of the resizing issues for you!

Tools to create generic scroll behaviors

There are a few holistic scrolling libraries that attempt to give you full control over animations on scroll without you having to perform all of the calculations yourself. 

ScrollMagic

ScrollMagic provides a relatively simple API to create various effects on scroll and can be hooked into different animation libraries like GSAP and Velocity.js. However, it has become less maintained over the past few years, which lead to the creation of ScrollScene.

ScrollScene

ScrollScene is essentially a wrapper to try and make ScrollMagic and/or the intersection observer more usable. It uses a custom, more maintained version of ScrollMagic and adds additional features like video playback, scene init breakpoints, and scene duration breakpoints. It also makes use of GSAP

ScrollTrigger

ScrollTrigger is an official GreenSock plugin for GSAP. It has a long list of features and has the most easy to use API of any scroll library (at least to me). Using it, you can have complete control to define where your scroll animations start and end, animate anything (WebGL, canvas, SVG, DOM, whatever) on scroll, pin elements in place while the animation is running, and more. Plus it has the support of GreenSock and the GreenSock forums

Notable mention: Locomotive Scroll

While it doesn’t attempt to be as comprehensive of a scrolling library as the other libraries mentioned above, Locomotive Scroll is focused on providing custom smooth scrolling. You can also animate certain properties of DOM objects by adding data attributes or hook into the onscroll event to animate other types of objects. 

In summary

For some particular scroll animation effects, like sticky positioning and parallax, CSS technologies may be sufficient, at least when using a polyfill for browsers that don’t support those properties.

I generally recommend using GSAP’s ScrollTrigger because it can do everything that CSS properties can do, plus much more. ScrollTrigger will handle the browser support and calculations so that you can focus on animating!

Here’s a table covering which tools you can use to create particular effects:

position: stickyCSS parallaxCSS scroll snap pointsSmooth ScrollingIntersection observersScrollMagicScrollSceneLocomotive ScrollScrollTrigger
Pinning⚪️
Parallax effects
Scrubbing through animation with easing⚪️⚪️⚪️⚪️⚪️
Snaps scroll position⚪️⚪️⚪️⚪️
Dynamic Batching / Staggering
Supports horizontal scroll effects

Here’s a table comparing various other aspects of scroll technology:

position: stickyCSS parallaxCSS scroll snap pointsSmooth scrollingIntersection observersScrollMagicScrollSceneLocomotive ScrollScrollTrigger
Usable in production (good browser support)⚪️⚪️⚪️⚪️⚪️
Complete freedom in animation⚪️
Maintainedn/an/an/an/an/a
Works with DOM, Canvas, WebGl, SVG⚪️
Works easily with resizing⚪️
Restricts animation to relevant section⚪️⚪️
Directionally aware⚪️⚪️
Native technology
✅ = Yes
⚪️ = Partial support
❌ = No

The post An Overview of Scroll Technologies appeared first on CSS-Tricks.

A Developer’s Guide to CQRS Using .NET Core and MediatR

“What is CQRS?” you might ask. I hope you didn’t think you were going to get a definition because that’s what Wikipedia is for. Instead, what I’m hoping to achieve with this blog post is to help you understand CQRS through some practical examples.

I will assume you’re either a beginner or someone who is unfamiliar with this topic, so maybe you get scared whenever you run into these big programming acronyms and concepts. I myself have been there, so I’m here to help you figure it out in the easiest way possible.

The Challenges of Using Microservices in Software Development

Businesses around the world rely on various software and IT products to help them achieve their business needs. In order to facilitate the development of such products, companies use a microservices architecture which simplifies a lot of processes across the board. Not only will this expedite time to market, but it also makes it easy for companies to test their products and provide maintenance as well. Still, companies will encounter many difficulties while working on microservices architecture and we would like to tell you about some of the most common issues you might encounter. 

Managing a Complex Infrastructure

One of the big advantages of microservices is the ability to deploy small independent units. However, as you start deploying more and more microservices, the entire system becomes more complex and you will need a lot of expertise to handle such complications. Also, even though each service is now smaller, it is not necessarily less complex, it simply shifted to the communication between each individual microservice. Therefore you will need to choose the service boundaries very carefully and have the necessary tools and expertise to handle such complexity. Most importantly, there needs to be good collaboration between everybody involved in the development process, otherwise the microservices will not be set up correctly. 

Integer and String Vulnerabilities in C

Software security is a critical topic that has been the focus of attention of many researchers and professionals over the years. One of the reasons this subject does not lose relevance is the number of vulnerabilities that become known each day. According to NVD (2006), a vulnerability can be defined as "a weakness in the computational logic (e.g., code) found in software and hardware components that, when exploited, results in a negative impact on confidentiality, integrity, or availability". The numbers surrounding this type of computational issue give a more concrete panorama about its criticality. Seacord (2013) states that in a period of nine years — from 2004 to 2012 — a total of 45,135 vulnerabilities were reported and cataloged by the National Vulnerabilities Database — NVD — of the National Institute of Standards and Technology — NIST. Yet, only in the year 2019, the NVD received 18,938 new entries.

In terms of secure programming, two categories of vulnerabilities have been exploited by attackers so that to damage the correct running flow of a software. The first one is String-related vulnerabilities. Basically, failures of this category cause a kind of security threat known as buffer overflow. Another widespread category of vulnerabilities is Integer-related. The most common errors found out in this category are overflow and signed errors. All those situations can lead to unexpected behaviors and the system can end up in an unsecured state. In scenarios like those ones, mitigation strategies turned to avoid jeopardizing a program or even a whole system generally are based on a solid knowledge of the employed programming language and in an accurate manner to explore its resources.

Deep Dive Into .NET Garbage Collection

Garbage collection, and memory management in general, will be the first and last things to work on. It is the main source of the most obvious performance problems, those that are the quickest to fix but need to be constantly monitored. Many problems are actually caused by an incorrect understanding of the garbage collector’s behavior and expectations. 

You have to think about memory performance just as much as about CPU performance. This is also true for unmanaged code performance, but in .NET it is easier to deal with. Once you understand how GC works, it becomes clear how to optimize your program for its operation. It can give you better overall heap performance in many cases because it deals with allocation and fragmentation better.

Compress Your Data Within Elasticsearch

Compressing is awesome, making something smaller than the original size sounds like magic but it is possible. We know it from our WinRar, 7Zip or other tools. Even Elasticsearch has a property to compress the data which will be tossed between the nodes and the clients, this could be very useful to reduce network latency when handling huge responses from Elasticsearch. Within this article we will cover the following topics:

  1. Enable HTTP/TCP compression
  2. Handling compressed responses
    • Elasticsearch 7.7 and below
    • Elasticsearch 7.8 and upwards
    • Future Elasticsearch release 7.9 and 8.0

Most of us are already familiar with Elasticsearch from Elastic when working with application logs, but a-lot of people never heard about. Below is a short summary:

Autoscaling an Amazon Elastic Kubernetes Service cluster

In this article we are going to consider the two most common methods for Autoscaling in EKS cluster:

  • Horizontal Pod Autoscaler (HPA)
  • Cluster Autoscaler (CA)

The Horizontal Pod Autoscaler or HPA is a Kubernetes component that automatically scales your service based on metrics such as CPU utilization or others, as defined through the Kubernetes metric server. The HPA scales the pods in either a deployment or replica set, and is implemented as a Kubernetes API resource and a controller. The Controller Manager queries the resource utilization against the metrics specified in each horizontal pod autoscaler definition. It obtains the metrics from either the resource metrics API for per pod metrics or the custom metrics API for any other metrics.