Handling Property Changes Using Decorator – an Alternative to ngOnChanges

Angular (2.0+)  provides a beautiful way of communicating with components using @Input and @Output decorators.   And, it also provides different lifecycle hooks to perform various tasks at different stages of the component. "ngOnChanges" is also one such lifecycle hooks that let you listen for any property changes and do custom actions or execute business logic. Below is the basic syntax of "ngOnChanges"

TypeScript
 




x


1
@Component({
2
  selector: 'app-component',
3
  template: '<div>Say Hello to {{ name }}</div>'
4
})
5
class MyComponent implements OnChanges {
6
  // TODO(issue/24571): remove '!'.
7
  @Input() name!: number;
8

          
9
  ngOnChanges(changes: SimpleChanges) {
10
    
11
  }
12
}


The problems with "ngOnChanges" are:

Impact of Deep Learning on Personalization

Machine learning-based personalization has gained traction over the years due to volume in the amount of data across sources and the velocity at which consumers and organizations generate new data. Traditional ways of personalization focused on deriving business rules using techniques like segmentation, which often did not address a customer uniquely. Recent progress in specialized hardware (read GPUs and cloud computing) and a burgeoning ML and DL toolkits enable us to develop 1:1 customer personalization which scales.

Recommender systems are beneficial to both service providers and users. They reduce transaction costs of finding and selecting items in an online shopping environment and improves customer experience. Recommendation systems have also proved to improve the decision making process and quality. In an e-commerce setting, for example, recommender systems enhance revenues, for the fact that they are effective means of selling more products. In scientific libraries, recommender systems support users by allowing them to move beyond catalog searches. Therefore, the need to use efficient and accurate recommendation techniques within a system that will provide relevant and dependable recommendations for users cannot be over-emphasized.

Quality Sense Podcast: Oren Rubin — Web Test Automation Challenges

In today’s Quality Sense episode, Federico Toledo sits down for a chat with the founder and CEO of TestimOren Rubin, an Israeli entrepreneur who has over 20 years of experience in the software industry. Testim is an innovative product in the test automation domain that seeks to alleviate the problems around flaky tests. Prior to founding Testim, he was the Director of R&D at Applitools, where they use advanced computer vision technologies to solve the challenges of UI Verification.

What to Expect?

  • In part one of the interview, the two discuss test automation challenges, particularly how to choose amongst the different test automation tools, highlighting their main differences, especially Selenium, Cypress, Playwright, Puppeteer and so on. 
  • In the second part, the two will talk about how AI helps test automation, differences between script-less testing tools and visual editors and more

Listen Here:

21 Groups and Companies Testers Should Follow on Linkedin

Getting in the Know on LinkedIn in 2020

Are you a tester on Linkedin? We all know the benefits of having a well-maintained Linkedin profile: recruiters reach out to you, you can show off skills and achievements, display personal recommendations, network, etc.

But, did you know that Linkedin is also an amazing place to find great resources to learn from? To cut out the noise and find the best software testing content, we recommend these 21 groups and companies testers should follow on Linkedin to get the most out of it.

A Review of Graph Databases

There are many ideas and considerations behind graph databases. This includes their use cases, advantages, and the trends behind this database model. There are also several real-world examples to dissect.

A Social Network Scenario

In a social network scenario, a user can post, share someone else’s post, comment on other people’s or advertiser posts, follow each other, and so on. For such a data-driven social media company, it is essential to pursue a basic CRUD (Create, Read, Update, Delete) operation to add more people, add new messages to the current database or find associated information. This helps the company figure out a certain user’s profile. For example, it might find that user Jeff has many posts relating to AI and music. Thus we may conclude him being a programmer, and so on.

Spring Cloud Stream: A Brief Guide

This article will teach you how to create a Spring Cloud Stream app that works with a messaging service (like Apache Kafka, RabbitMQ, etc.), You’ll be using functional, reactive code—leveraging Spring’s WebFlux—and Spring Cloud Stream’s functional building model,

Today, you are going to make an app that has a publisher, a processor, and a consumer. It will leverage two topics to publish a stream of integers, process the integers to calculate a running total, and consume the processed data. In the beginning, these messages will be simple (strings/integers)—but later you’ll see how Spring Cloud Stream makes mapping POJOs (Plain Old Java Objects) to messages using JSON mapping simple!

Hello World: Micronaut in the Cloud

Micronaut is an open-source, JVM-based framework for building full-stack, modular, easily testable microservice and serverless applications.

Unlike reflection-based IoC frameworks that load and cache reflection data for every single field, method, and constructor in your code, with Micronaut, your application startup time and memory consumption are not bound to the size of your codebase.

The Scene of DevOps in the Automotive Industry

The DevOps pipeline is similar to the car industry that used to have an assembly line where automotive workers used to assemble each part to make the whole vehicle ready. The point here is, the automotive industry already works on lean principles, six sigma, kaizen, etc, and the automobile of the future is no longer driven by hand. Now, artificial intelligence has taken the steering wheel in most automotive organizations where software installation and upgrades have become very necessary than ever. Digital systems provide entertainment while driving and offer services that go far beyond just transportation.

Every company is a software company these days, and we are all dependent on software in our daily lives. As a result, even legacy automotive and manufacturing companies are turning to software for various needs. IT companies are increasingly such companies in the adoption of software development methodologies that allow them gradual software releases which are both tested and robust. 

How to Overcome 6 Selenium Automation Testing Challenges

Undoubtedly, Selenium has made web testing far simpler for many QA teams and enterprises worldwide, but it has a fair share of challenges. That being said, most of such issues testers encounter have quite clear-cut solutions, which is why we have summarized some of the common Selenium automation testing challenges, along with their solution. Let’s get started!

Selenium Automation Testing Challenges & Solutions

  1. Mobile Application Testing
  2. Reporting
  3. Pop-up Windows and Alerts
  4. Page load
  5. Scalability
  6. Desktop Application Testing


1. Mobile Application Testing

When using Selenium, we can create automated test cases on any operating system and browser on desktop, however, we cannot perform mobile tests with Selenium simultaneously.

Collective #612



60 Days of Animation

The Undead Institute offers books on HTML, CSS, Responsive Design and more that marry humor, excellent teaching, and brain-lodging practice for an experience that’ll outlive the apocalypse.

Check it out




Stryve

A new community for tech enthusiasts to share, learn, and build their careers.

Check it out


The design systems between us

Ethan Marcotte shares his thoughts on why he believes that design systems haven’t brought rich, cross-functional collaboration to most organizations.

Read it









Profiled

With Profiled you can create a developer portfolio from your GitHub account.

Check it out


Is WebP really better than JPEG?

According to Google, WebP is 25 – 34% smaller than JPEG at equivalent quality. But how much of it is really true? Find out in this article by Johannes Siipola.

Read it









The post Collective #612 appeared first on Codrops.

When a Line Doesn’t Break

We expect a line to break when the text on that line reaches the parent box boundaries. We see this every time we create a paragraph, just like this one. When the parent box doesn’t have enough room for the next word in a line, it breaks it and moves down to the next line and repeats that process.

Well, that’s how it works when words are separated by spaces or other whitespace. As far as CSS goes, there are five (!) properties that can possibly affect how and when a line breaks. Let’s not get into all that again though. Let’s instead look at a situation where it seems like a line is going to break but it doesn’t as an excuse to learn a little something about line breaking.

What happens in a situation where there is no way for the browser to know when it’s OK to make a break?

Let’s get ourselves into a bad situation with a “tag list” and then get ourselves out of it. Here’s our markup:

<ul>
  <li>PHP</li>
  <li>JavaScript</li>
  <li>Rust</li>
  <!-- etc. -->
</ul>

Next, we’ll apply CSS that overwrites the default list style from its default vertical orientation to horizontal by making the list items display inline.

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}


li {
  display: inline;
  padding-right: 5px;
}

The list looks just like we want it. I added a little bit of space between one list item and another, so it doesn’t look too crowded.

Now let’s introduce a wrapper element to the mix. That’s essentially a div around the unordered list. We can give it a class, say, .tags.

<div class="tags">
  <ul>
    <li>PHP</li>
    <li>JavaScript</li>
    <li>Rust</li>
  </ul>
</div>

Let’s say we want to give the wrapper a fixed width of 200px. That’s where we should expect to see line breaks happen as the unordered list bumps into wrapper’s boundaries.

.tags {
  width: 200px;
}

Here comes the interesting part. Many people use minifiers in their build process to reduce file sizes by getting rid of unnecessary values. Some of these values are whitespaces, which includes spaces, tabs, and line breaks (such as carriage return and line feed) characters that are use for formatting purposes but considered by minifies to be irrelevant to the final result.

If we “minify” our HTML by removing new lines, then this is what we get:

<div class="tags"><ul><li>PHP</li><li>JavaScript</li><li>Rust</li></ul></div>

UH OH. As you can see, the list is not breaking at the 200px boundary anymore. Why? What is different now? Personally, I thought HTML didn’t care about whitespaces. What is so different about the minified version from the original markup?

The browser does actually care about whitespaces… but only sometimes. And this just so happens to be one of those instances. When the page is being parsed, the parser sees this list as one long word because, from its perspective, there are no characters that differentiate one from the other.

One might think having the padding is affecting things. But if we remove the padding from our list items we still get the same result… only with no spacing between items.

The browser sees the entire list as a single word.

We can get natural line breaks from special characters

Besides spaces, excluding non-breaking spaces (&nbsp;), there are some other characters that will force a line break, including:

  • After hypen (‐)
  • After en dash ()
  • Before and after em dash ()
  • After question mark (?)
  • Zero-width white space (U+200B or &#8203;)

These line breaks happen at rendering time which means the browser still sees this as one long word. Adding a new list item to the tag list with any of these characters will force a line break. Let’s add “Objective-C” to the list. Its name contains a hyphen, which we can use to see how it affects things.

For better readability purpose the code code will have indentation and new line.

<div class="tags">
  <ul>
    <li>PHP</li>
    <li>JavaScript</li>
    <li>Rust</li>
    <li>Objective-C</li>
  </ul>
</div>

That’s good. Let’s look at three solutions to our non-line-breaking list along these lines.

Solution 1: Add one of the breaking characters

We can keep forcing line breaks with those breaking characters like we just did. But remember, if you are using a minifier, adding the spaces in or after the closing tag won’t guaranteed it won’t be removed, as not all minifiers work the same way.

<div class="tags">
  <ul>
    <li>PHP </li>
    <li>JavaScript </li>
    <li>Rust </li>
    <li>Objective-C </li>
  </ul>
</div>

Solution 2: Use pseudo-elements

The breaking character can also be added using the ::before and ::after pseudo-elements in CSS. What makes this solution effective is that it’s not affected by an HTML minifier because the whitespace is added when the CSS is applied.

But, before we move on, let’s talk a moment about collapsing whitespaces.

The browser collapses whitespace before and after a character that forces a line break inside inline elements. With this in mind, there’s a little trick to using ::after and the content property with whitespacing and display: inline-block. The inline-block element adds a breaking character at the end of the text. Then the content property space comes after the breaking character created by the inline-block element, which results in the space being removed at rendering time. That is, unless the white-space property is set to pre.

Solution 3: Use inline-block instead

Perhaps you have bumped into a fight with space between inline-block elements in CSS before. We can use the inline-block value on the display  property to force a line break because the inline-block element already has the extra whitespace we need. This works similar to adding a zero-width space character, but the list items will have no visual separation.

Solution 4: Use flex or inline-flex

Another solution is to define the unordered list as a flex container, which allows us to use flex-flow to set the direction of the list and to make sure it to multiple lines when needed.

We can also turn to the display: inline-flex instead of inline-block solution. The idea here is that the entire flexible container display inline.


So, we started this post with a situation that might come up when using a minifier. That said, minifiers — and many libraries for that matter — are smart and will try to prevent this line-breaking issue from happening.

Sure, it’s not an extremely common situation to bump into. It’s really one of those things that can fly under the radar if we’re not paying attention but, if it does happen, at least we know there are ways to work around it.

The post When a Line Doesn’t Break appeared first on CSS-Tricks.

Comparing Grakn to Semantic Web Technologies — Part 2/3

This is part two of Comparing Semantic Web Technologies to Grakn. In the first part, we looked at how RDF compares to Grakn. In this part, we look specifically at SPARQL and RDFS.

SPARQL

What Is SPARQL?

SPARQL is a W3C-standardised language to query for information from databases that can be mapped to RDF. Similar to SQL, SPARQL allows to insert and query for data. Unlike SQL, queries aren’t constrained to just one database and can be federated across multiple HTTP endpoints.