React.js is one of the most popular frontend frameworks nowadays. After mastering the theory behind React, you can only improve with time behind a keyboard. At first, building a React application may seem a little bit difficult, but creating your first application doesn’t have to be so complicated.
In this article, I’m going to create a simple React.js application with fetching data from an API in five minutes, step-by-step.
The worldwide web is a treasure trove of data. The availability of big data, lightning-fast development of data analytics software, and increasingly inexpensive computing power have further heightened the importance of data-driven strategies for competitive differentiation.
According to Forrester's report, data-driven companies that harness insights across their organization and implement them to create competitive advantage, are growing at an average of more than 30 percent annually and are on track to earn $1.8 trillion by 2021.
WSO2 has announced the release of API Manager 3.0, the latest iteration of the company’s open-source API management solution. With this update, WSO2 has added a native Kubernetes Operator, which it hopes will simplify application configuration in cloud-native environments. Additionally, V3.0 includes updates to various user interfaces, a new monetization method, and a pre-defined CI/CD pipeline.
Awhile back I wrote a post about the 7 Reasons We Choose Apache Pulsar over Apache Kafka. Since then, I have been working on a detailed report comparing Kafka and Pulsar, talking to users of the open-source Pulsar project, and talking to users of our managed Pulsar service, Kafkaesque. What I’ve realized that I missed some reasons in that first post. So, I thought I’d do a follow-up post that adds to the list.
Before diving into the new reasons, let’s quickly recap the seven reasons mentioned in the previous post:
Developers and testers love using JMeter for performance testing. In this post, we go over the best JMeter tutorials that DZone has to offer. We take a look at load testing with JMeter, how to use JMeter to test your APIs (REST or otherwise), and more advanced JMeter turorials.
JMeter Tutorials for Beginners
Being Your Journey With These JMeter Tutorials for Beginners
JMeter Tutorial for Beginners by Sayantini Deb. Learn more about performance testing and why JMeter is the perfect load testing tool for measuring the performance of your apps.
CSS allows you to create dynamic layouts and interfaces on the web, but as a language, it is static: once a value is set, it cannot be changed. The idea of randomness is off the table. Generating random numbers at runtime is the territory of JavaScript, not so much CSS. Or is it? If we factor in a little user interaction, we actually can generate some degree of randomness in CSS. Let’s take a look!
Randomization from other languages
There are ways to get some "dynamic randomization" using CSS variables as Robin Rendle explains in an article on CSS-Tricks. But these solutions are not 100% CSS, as they require JavaScript to update the CSS variable with the new random value.
We can use preprocessors such as Sass or Less to generate random values, but once the CSS code is compiled and exported, the values are fixed and the randomness is lost. As Jake Albaugh explains:
random in sass is like randomly choosing the name of a main character in a story. it's only random when written. it doesn't change.
In the past, I've developed simple CSS-only apps such as a trivia game, a Simon game, and a magic trick. But I wanted to do something a little bit more complicated. I'll leave a discussion about the validity, utility, or practicality of creating these CSS-only snippets for a later time.
Based on the premise that some board games could be represented as Finite State Machines (FSM), they could be represented using HTML and CSS. So I started developing a game of Snakes and Ladders (aka Chutes and Ladders). It is a simple game. The goal is to advance a pawn from the beginning to the end of the board by avoiding the snakes and trying to go up the ladders.
The project seemed feasible, but there was something that I was missing: rolling dice!
The roll of dice (along with the flip of a coin) are universally recognized for randomization. You roll the dice or flip the coin, and you get an unknown value each time.
Simulating a random dice roll
I was going to superimpose layers with labels, and use CSS animations to "rotate" and exchange which layer was on top. Something like this:
Simulation of how the layers animate on a browser
The code to mimic this randomization is not excessively complicated and can be achieved with an animation and different animation delays:
/* The highest z-index is the numbers of sides in the dice */
@keyframes changeOrder {
from { z-index: 6; }
to { z-index: 1; }
}
/* All the labels overlap by using absolute positioning */
label {
animation: changeOrder 3s infinite linear;
background: #ddd;
cursor: pointer;
display: block;
left: 1rem;
padding: 1rem;
position: absolute;
top: 1rem;
user-select: none;
}
/* Negative delay so all parts of the animation are in motion */
label:nth-of-type(1) { animation-delay: -0.0s; }
label:nth-of-type(2) { animation-delay: -0.5s; }
label:nth-of-type(3) { animation-delay: -1.0s; }
label:nth-of-type(4) { animation-delay: -1.5s; }
label:nth-of-type(5) { animation-delay: -2.0s; }
label:nth-of-type(6) { animation-delay: -2.5s; }
The animation has been slowed down to allow easier interaction (but still fast enough to see the roadblock explained below). The pseudo-randomness is clearer, too.
But then I hit a roadblock: I was getting random numbers, but sometimes, even when I was clicking on my "dice," it was not returning any value.
I tried increasing the times in the animation, and that seemed to help a bit, but I was still having some unexpected values.
That's when I did what most developers do when they find a roadblock they cannot resolve just by searching online: I asked other developers for help in the form of a StackOverflow question.
To simplify a little, the problem was that the browser only triggers the click/press event when the element that is active on mouse down is the same element that is active on mouse up.
Because of the rotating animation, the top label on mouse down was not the top label on mouse up, unless I did it fast or slow enough for the animation to circle around. That's why increasing the animation times hid these issues.
The solution was to apply a position of "static" to break the stacking context, and use a pseudo-element like ::before or ::after with a higher z-index to occupy its place. This way, the active label would always be on top when the mouse went up.
/* The active tag will be static and moved out of the window */
label:active {
margin-left: 200%;
position: static;
}
/* A pseudo-element of the label occupies all the space with a higher z-index */
label:active::before {
content: "";
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 0;
z-index: 10;
}
Here is the code with the solution with a faster animation time:
After making this change, the one thing left was to create a small interface to draw a fake dice to click, and the CSS Snakes and Ladders was completed.
This technique has some obvious inconveniences
It requires user input: a label must be clicked to trigger the "random number generation."
It doesn't scale well: it works great with small sets of values, but it is a pain for large ranges.
It’s not really random, but pseudo-random: a computer could easily detect which value would be generated in each moment.
But on the other hand, it is 100% CSS (no need for preprocessors or other external helpers) and, for a human user, it can look 100% random.
And talking about hands... This method can be used not only for random numbers but for random anything. In this case, we used it to "randomly" pick the computer choice in a Rock-Paper-Scissors game:
Accessibility is our job. We hear it all the time. But the truth is that it often takes a back seat to competing priorities, deadlines, and decisions from above. How can we solve that?
That's where An Event Apart comes in. Making sites inclusive by design is just one of the many topics covered over three full days of sessions designed to inspire you and level up your skills while learning from 17 of today's most talented front-end professionals.
And at An Event Apart, you don’t just learn from the best, you interact with them — at lunch, between sessions, and at the famous first-night Happy Hour party. Web design is more challenging than ever. Attend An Event Apart to be ready for anything the industry throws at you.
CSS-Tricks readers save $100 off any two or three days with code AEACP.
Take advantage of the EC2 autoscaling with this tutorial.
Cloud is all about agility. Quickly creating new servers of various sizes and deploying applications on them is one of them. Let’s take the example of Netflix, hosted on AWS. Whenever there is a popular show or a movie, Netflix adds more and more EC2s using autoscaling to meet customer demand. Depending on the number of users trying to access Netflix service, the autoscaling feature can automatically add or delete EC2 instances. Let us see how to launch an EC2 instance from a custom AMI.
What Are the Different Ways of Getting the Application onto The EC2 Instance?
How is the application installed on EC2 automatically? There are multiple ways to have the application along with the settings on the EC2 instance as discussed below.
Docker has gained immense popularity in this fast-growing IT world. Organizations are continuously adopting Docker in their production environment. I take this opportunity to explain Docker in the most simple way. In this blog, the following Docker concepts will be covered:
Here's 1 and 2 of the how you can create a better CI pipeline.
Getting testing right in a Continuous Integration pipeline is a critical part of software development at web scale. For many companies, it's a challenge, particularly with automated performance testing. It's not for lack of effort. Many companies can't seem to realize the full value of their efforts. The reasons are many. Some testing efforts merely reinvent the wheel. Others are conducted randomly with no apparent intention other than just for the sake of execution. Ensuring the testing is both appropriate and aimed at meeting the business requirement(s) is a distant afterthought.
Terraform is a great tool for infrastructure as code and one of my personal favorites, but while it is very easy to apply and destroy runs via a CLI and having plenty of tools to ensure Terraform runs via git push/pull requests, applying Terraform runsvia an API command is a lot trickier.
That is why I created Terraformize to fill in that gap, the basic idea being that, by having the ability to create Terraform runs via a simple REST API, a developer can integrate a Terraform environment creation into their product code flow in an easy way.
According to predictions of the analytical platform App Annie, interest in mobile apps will enjoy stable growth over the next four years. If you’re considering bringing your app to new markets, this is the time to do it.
During my two years as the localization manager, I came to understand that localization has its own rules, and knowing them can help you adapt any product for a new market quickly and competently. These principles will be useful for anyone who wants to localize an app but doesn’t know where to start.
User interface and user experience are the roots of software products. Whether it’s a web app or mobile application, if you’re not providing a good user experience to your visitors, you might end up losing all your traffic soon.
The UI/UX of your website is the first thing that strikes the eye of your customer; it works as a ladder to reach your consumer’s heart and mind by showing them engaging visual content. But, keeping up with UI/UX trends is not that simple as it seems to be.
In part one our this building a chatbot series, we figured out how to use OpenNLP to "hear" what a user is saying and figure out both their intent and any entities they may have mentioned. Today we're going to learn how to use Neo4j to talk back...like an impudent child.
We haven't done any graph modeling yet, so let's tackle part of this. Our chatbot will be used by a team of Shadowrunners under a single account, but by different members of the team. We need Account nodes and these nodes will have Members that send us messages, and we'll have to reply to those messages. The messages will be in order, so we can chain them together in a list. It looks like this:
This is no truer statement on the goals of a query optimizer. Do less: Less memory, less CPU, less disk, less IO, fewer instructions, fewer partitions, less overflow. Less everything for the query plan it creates. This is the guiding light for SQL and NoSQL optimizer.
In Couchbase 6.5, we announced the cost-based optimizer (CBO-preview) for N1QL in query service. Here, I’ve tried to answer the questions from NoSQL users unfamiliar with the benefits of CBO.
Recently I wrote a piece for DZone and their Migrating to Microservices Report on the challenges of adopting service mesh in an enterprise organization. One of the first things we tackle in that piece is “whether or not you should go down the path of adopting a service mesh” Here’s what I said:
Start with an answer of “no”. If you’re just getting started with microservices and a handful of services, make sure you have the foundational pieces in place first. Microservices and its associated infrastructure are an optimization enabling you to make changes to your application faster. You can make a lot of strides toward going faster without a service mesh. You may even want some of the goodness that a service mesh brings without all of the complexity. Check out something like Gloo, an API Gateway built on Envoy proxy.
For some time, there has been a new competitor in the field of persistence and serialization. We are talking about Project MicroStream. What is it exactly? MicroStream claims to be a high-performance and, most importantly, developer-friendly solution for the challenges of serialization and persistence. How easy, fast and comfortable that is, we will look at in detail in a multi-part series.