Make Freelance Programming Great Again

From the desk of a brilliant weirdo #1:

Thanks for deciding to take a look at this article. I genuinely hope you enjoy it.

In summary, here’s what you’re going to learn in this article about freelance programming:

Configuring Bare Metal Vultr Servers With Cloud-init

Introduction

Oftentimes there will be cases where you will want to automate the provisioning and configuration of your Vultr cloud infrastructure. There are a plethora of tools out there, however, cloud-init is an industry-standard that is used to initialize and configure VM instances with user-data.

What Is Terraform?

Terraform is an Infrastructure-as-code tool that allows users to build, change, and version your infrastructure safely and efficiently. It uses a high-level syntax to declaratively provision and manages infrastructure, allowing the ability to break down the configuration into smaller chunks for better organization, re-use, and maintainability. Information on installing and running Terraform can be found here. By passing the user_data parameter into a Terraform.yaml file, you can use automation to configure your Vultr instance at boot time. More on that below.

How JPAstreamer Can Help You Write Type-Safe Hibernate Code Without Unnecessary Complexity

For the past 10 or so years, JPA has been one of the most popular ways of accessing a database within the Java ecosystem. Even if you haven't heard of JPA directly, there is a high likelihood that you've heard of or even used one of the most popular implementations of the JPA API - Hibernate.

The reason why JPA is so popular is no secret - most of the inconveniences are abstracted from the user, making the API very intuitive to use. Let's say that in some random database exists a table called person with the following structure:

5 Common Myths Debunked: Hybrid Vs Native

Mobile applications are now what consumer software was in the early 90s and what websites were in the 1st decade of the 21st century. Every company has a mobile application out there; well, almost every company. And though some mobile applications directly impact a business by generating leads and enabling sales like apps that facilitate ticket booking or the ones which support eCommerce, there are other kinds of apps that help increase brand awareness.

So whether you are selling tickets to your motivational seminar (event application), want to sell your real estate (property listing apps with virtual tour), or want to connect local businesses with end customers (service listing app) there is an app for all your business need. And if you are considering whether or not to invest in a mobile application, here is one important piece of information which you should consider – YOUR COMPETITION ALREADY HAS A MOBILE APPLICATION OUT IN THE MARKET, AND PEOPLE ARE USING AND LOVING IT.

Don’t Give Up Yet… Keep-Alive!

We founded StormForger Load and Performance Testing SaaS in 2014 and while much has changed since then, one thing hasn't. 

HTTP is with its 24 years a well-aged fellow among the web protocols.¹ Today we are mostly using HTTP/1.1² or HTTP/2 and if you have fully embraced the new HTTP/2 world in your entire system this article is mostly an anecdote of past issues. But HTTP/1.1 is still alive and kicking for many systems. And even given its age, people are still forgetting about a very important feature that previous versions did not provide: keep-alive.³

A Full Stack Dev’s First Impressions of the Salesforce Platform, Part 2

Introduction

In Part 1, I completed an overview of Salesforce, the Salesforce platform, and its no/low-code options. Now, let’s get to the meaty part (at least for developers) – developing with code! After that, I’ll share some overall impressions of the platform.

What Does It Look Like to Develop With Code?

There are quite a lot of Salesforce-related packages and frameworks, but the first two trailheads introduce you primarily to the fundamentals: the Lightning Component framework, Apex, and Visualforce.

Video Encryption Types, Security Level, and Compatibility

Have you noticed how in recent years there has been a rapid increase in the number of OTT platforms such as Netflix, Amazon Prime, Disney plus and so much more? Almost everyone relies on these platforms to view content and for these platforms as well their content is the source of their income. But then again all these videos on these platforms were easily downloadable in the past and it is still now up to an extent.  

Every year organizations lose billions of dollars in piracy. Almost all the content is freely available in different sources. Users can access video content for free without having to spend much money on it.

The “Mic Drop” On Fast File Migration Speed

How Long Does a File Migration Last Anyways?

Fast Cloud File Migration and Throughput

I have been manning conference booths and speaking at technical conferences for over a decade, usually covering the topic of migration in some shape or form. Recently, I attended a technical conference in Las Vegas, for instance. Typical stuff: giant marketing cloths behind me making wild claims of ridiculously fast cloud file migration – a file migration speed of up to 60TB per day.

Surely this is the work of some funny-math executed by a sales VP and then begrudgingly incorporated into a booth banner by some young, inexperienced marketing person. Except that it’s not, and we don’t do inexperienced!

Animating Number Counters

Number animation, as in, imagine a number changing from 1 to 2, then 2 to 3, then 3 to 4, etc. over a specified time. Like a counter, except controlled by the same kind of animation that we use for other design animation on the web. This could be useful when designing something like a dashboard, to bring a little pizazz to the numbers. Amazingly, this can now be done in CSS without much trickery. You can jump right to the new solution if you like, but first let’s look at how we used to do it.

One fairly logical way to do number animation is by changing the number in JavaScript. We could do a rather simple setInterval, but here’s a fancier answer with a function that accepts a start, end, and duration, so you can treat it more like an animation:

Keeping it to CSS, we could use CSS counters to animate a number by adjusting the count at different keyframes:

Another way would be to line up all the numbers in a row and animate the position of them only showing one at a time:

Some of the repetitive code in these examples could use a preprocessor like Pug for HTML or SCSS for CSS that offer loops to make them perhaps easier to manage, but use vanilla on purpose so you can see the fundamental ideas.

The New School CSS Solution

With recent support for CSS.registerProperty and @property, we can animate CSS variables. The trick is to declare the CSS custom property as an integer; that way it can be interpolated (like within a transition) just like any other integer.

@property --num {
  syntax: '<integer>';
  initial-value: 0;
  inherits: false;
}

div {
  transition: --num 1s;
  counter-reset: num var(--num);
}
div:hover {
  --num: 10000;
}
div::after {
  content: counter(num);
}

Important Note: At the time of this writing, this @property syntax is only supported in Chrome ( and other Chromium core browsers like Edge and Opera), so this isn’t cross-browser friendly. If you’re building something Chrome-only (e.g. an Electron app) it’s useful right away, if not, wait. The demos from above are more widely supported.

The CSS content property can be used to display the number, but we still need to use counter to convert the number to a string because content can only output <string> values.

See how we can ease the animations just like any other animation? Super cool! 

Typed CSS variables can also be used in @keyframes

One downside? Counters only support integers. That means decimals and fractions are out of the question. We’d have to display the integer part and fractional part separately somehow.

Can we animate decimals?

It’s possible to convert a decimal (e.g. --number) to an integer. Here’s how it works:

  1. Register an <integer> CSS variable ( e.g. --integer ), with the initial-value specified
  2. Then use calc() to round the value: --integer: calc(var(--number))

In this case, --number will be rounded to the nearest integer and store the result into --integer.

@property --integer {
  syntax: "<integer>";
  initial-value: 0;
  inherits: false;
}
--number: 1234.5678;
--integer: calc(var(--number)); /* 1235 */

Sometimes we just need the integer part. There is a tricky way to do it: --integer: max(var(--number) - 0.5, 0). This works for positive numbers. calc() isn’t even required this way.

/* @property --integer */
--number: 1234.5678;
--integer: max(var(--number) - 0.5, 0); /* 1234 */

We can extract the fractional part in a similar way, then convert it into string with counter (but remember that content values must be strings). To display concatenated strings, use following syntax:

content: "string1" var(--string2) counter(--integer) ...

Here’s a full example that animates percentages with decimals:

Other tips

Because we’re using CSS counters, the format of those counters can be in other formats besides numbers. Here’s an example of animating the letters “CSS” to “YES”!

Oh and here’s another tip: we can debug the values grabbing the computed value of the custom property with JavaScript:

getComputedStyle(element).getPropertyValue('--variable')

That’s it! It’s amazing what CSS can do these days.


The post Animating Number Counters appeared first on CSS-Tricks.

You can support CSS-Tricks by being an MVP Supporter.

Vulnerability Assessment and Penetration Testing

Introduction

In these days of widespread Internet usage, security is of prime importance. The almost universal use of mobile and Web applications makes systems vulnerable to cyber-attacks. Vulnerability assessment can help identify the loopholes in a system while penetration testing is a proof-of-concept approach to actually explore and exploit a vulnerability.

Cyber-attacks are increasing every day with the increased use of mobile and Web applications. Globally, statistics show that more than 70 percent of the applications either have vulnerabilities that could potentially be exploited by a hacker or worse, they have already been exploited. The data losses due to this are typical of two types. Either the data is confidential to the organization or it is private to an individual. Regardless of the category, data losses result in the loss of money or reputation. This article explores a technical process that can be adopted by industries and organizations to protect their intellectual property, and if implemented correctly, will result in better risk management.

How to Refactor Big Alloy Controllers

At first, you got a nicely structured Alloy controller, but as you go on, new features keep getting added, and slowly but surely you end up with a monster. Your XML file might still look okay, but your controller file starts getting hundreds of lines and the end is not in sight. Sound familiar?

How do you restructure such a mess into a well-structured file again without rewriting the entire thing? It is easier than you might think.

Use Both JWT and Opaque Access Tokens With Spring Boot

How can one validate OAuth 2.0 access tokens? This question frequently comes up — along with the topic of validating JSON Web Tokens (JWT) based access tokens— however, this is NOT part of the OAuth 2.0 specification. JWTs are used so commonly that Spring Security supported them before adding support for remotely validating tokens. 

This article will introduce how to build a simple application that utilizes both types of validation.

5 Kibana Visualizations To Spice Up Your Dashboard

If you work in any way that is adjacent to data, insight, and analytics, there’s a good chance you will at least have heard of Kibana. If you haven’t then there’s no better time to be jumping on the bandwagon.

An open-source app, Kibana caters perfectly to any enterprise that needs to incorporate data discovery, navigation, and visualization. So long is the list of features and benefits that it’s impossible to cover them all in a single article. Tools like Kibana Lens showcase this beautifully.