FaaS

How We Can Solve the Cryptocurrency Energy Usage Problem

Bitcoin is still the most important cryptocurrency people know about, and it serves as the entry point of the crypto space. However, every innovative project has to pay its price. For Bitcoin, it is its high carbon footprint created by mining. Bitcoin mining works by solving cryptographic puzzles, also referred to Proof of Work (PoW). The miner that’s first to find the solution receives a Bitcoin reward. However, this race towards finding the solution comes with high energy usage, as it’s a resource-intensive process requiring a lot of electricity. Currently, Bitcoin mining uses 58.93 TWh per year. An online tool by the University of Cambridge showed that Bitcoin uses as much energy as the whole of Switzerland. More important is the carbon footprint of Bitcoin. The electricity generated for powering the Bitcoin network equals 22 megatons of CO2 on a yearly basis. You can compare this carbon footprint with the footprint of a city like Kansas City (US). This article will cover the fol..

It’s Time to Start Making Your Web Apps Reactive

This article was created in partnership with Manning Publications. Thank you for supporting the partners who make SitePoint possible. You’ve heard of the principle of “survival of the fittest”, and you know that it’s especially true in web development. Your users expect split-second performance and bug-free interfaces — and if you can’t deliver them, you can be sure they’ll go straight to a competitor who can. But when it comes to survival, it’s important to remember the full principal of evolution: the best way to thrive is to be adaptable to change. That’s where reactive programming comes in. Reactive applications are created to be adaptable to their environments by design. Right from the start, you’re building something made to react to load, react to failure, and react to your users. Whatever being deployed to production throws at your application, reactive programming will mean it can handle it. How does reactive programming achieve this? It embeds sound programming principles ..

The Real Future of Remote Work is Asynchronous

I’ve been working remotely for over a decade – well before the days of tools like Slack or Zoom. In some ways, it was easier back then: you worked from wherever you were and had the space to manage your workload however you wanted. If you desired to go hardcore creative mode at night, sleep in, then leisurely read fiction over brunch, you could. Now, in the age of the “green dot” or “presence prison,” as Jason Fried calls it, working remotely can be more suffocating than in-person work. The freedom that we worked hard to create — escaping the 9-to-5 — has now turned into constant monitoring, with the expectation that we are on, accessible, productive, and communicative 24/7. I see this in job positions for remote roles. Companies frequently champion remote, proudly advertising their flexible cultures to only then list that candidates must be based within 60 minutes of Pacific Time Zone, that the hours are set, and standup is at 8:30am daily. One of the benefits of remote work is that..

7 Ways Developers Can Contribute to Climate Action

Whether you’ve just started out as a software engineer or you’ve been at it for decades, you too can play a role in helping to positively impact climate. When people first consider this, they tend to think about the impact writing efficient code will have. Of course, you should always write efficient, elegant code. But unless the code you’re creating is going to be used by millions of people, it may not be where you can have the biggest impact from a climate perspective. (Code being used by millions or billions of people is probably highly optimized anyway!) In this article, we'll look at seven other ways you can help. Choose Where You Spend Your Career Being an engineer means you have one of the most sought after, transferable occupations on the planet. In virtually any city in the world, you'll be in demand and probably well paid, so you have plenty of options. Choosing to work in a place that's at the intersection of your cares and your code is one of the easiest w..

How to Divert Traffic Using IP2Location in a Next.js Website

This article was created in partnership with IP2Location. Thank you for supporting the partners who make SitePoint possible. In a world where online commerce has become the norm, we need to build websites that are faster, user friendly and more secure than ever. In this article, you’ll learn how to set up a Node.js powered website that’s capable of directing traffic to relevant landing pages based on a visitor's country. You'll also learn how to block anonymous traffic (e.g. Tor) in order to eliminate risks coming from such networks. In order to implement these features, we'll be using the IP2Proxy web service provided by IP2Location, a Geo IP solutions provider. The web service is a REST API that accepts an IP address and responds with geolocation data in JSON format. Here are some of the fields that we'll receive: countryName cityName isProxy proxyType etc. We'll use Next.js to build a website containing the following landing pages: Home Page: API fetchi..

10 Zsh Tips & Tricks: Configuration, Customization & Usage

As web developers, the command line is becoming an ever more important part of our workflow. We use it to install packages from npm, to test API endpoints, to push commits to GitHub, and lots more besides. My shell of choice is zsh. It is a highly customizable Unix shell, that packs some very powerful features such as killer tab completion, clever history, remote file expansion, and much more. In this article I'll show you how to install zsh, then offer ten tips and tricks to make you more productive when working with it. This is a beginner-level guide which can be followed by anybody (even Windows users, thanks to Windows Subsystem for Linux). However, in light of Apple's announcement that zsh is now the standard shell on macOS Catalina, mac users might find it especially helpful. Lets get started. Installation I don't want to offer in-depth installation instructions for each operating system, rather some general guidelines instead. If you get stuck installing zs..

Building a Habit Tracker with Prisma, Chakra UI, and React

In June 2019, Prisma 2 Preview was released. Prisma 1 changed the way we interact with databases. We could access databases through plain JavaScript methods and objects without having to write the query in the database language itself. Prisma 1 acted as an abstraction in front of the database so it was easier to make CRUD (create, read, update and delete) applications. Prisma 1 architecture looked like this: Notice that there’s an additional Prisma server required for the back end to access the database. The latest version doesn’t require an additional server. It's called The Prisma Framework (formerly known as Prisma 2) which is a complete rewrite of Prisma. The original Prisma was written in Scala, so it had to be run through JVM and needed an additional server to run. It also had memory issues. The Prisma Framework is written in Rust so the memory footprint is low. Also, the additional server required while using Prisma 1 is now bundled with the back end, so you can use it j..

Building a Habit Tracker with Prisma 2, Chakra UI, and React

In June 2019, Prisma 2 Preview was released. Prisma 1 changed the way we interact with databases. We could access databases through plain JavaScript methods and objects without having to write the query in the database language itself. Prisma 1 acted as an abstraction in front of the database so it was easier to make CRUD (create, read, update and delete) applications. Prisma 1 architecture looked like this: Notice that there’s an additional Prisma server required for the back end to access the database. The latest version doesn’t require an additional server. It's called The Prisma Framework (formerly known as Prisma 2) which is a complete rewrite of Prisma. The original Prisma was written in Scala, so it had to be run through JVM and needed an additional server to run. It also had memory issues. The Prisma Framework is written in Rust so the memory footprint is low. Also, the additional server required while using Prisma 1 is now bundled with the back end, so you can use it j..

Black Friday 2019 for Designers and Developers

This article was created in partnership with Mekanism. Thank you for supporting the partners who make SitePoint possible. Black Friday is one of the best opportunities of the year to get all kinds of new stuff, including digital web tools and services. Some companies are offering huge discounts to heavily increase their sales, while others already have excellent offers for their customers and partners. In this article, you’ll find free and premium web tools and services, and also some of the best Black Friday WordPress deals. We included website builders, UI Kits, Admins themes, WordPress themes, effective logo and brand identity creators, and much more. There’s a web tool or service for everyone in this showcase of 38 excellent solutions. Let’s start. 1. Free and Premium Bootstrap 4 Admin Themes and UI Kits DashboardPack is one of the main suppliers of free and premium Bootstrap 4 admin themes and UI kits, being used by tens of thousands of people with great success. Here you’ll ..

Delay, Sleep, Pause, & Wait in JavaScript

Many programming languages have a sleep function that will delay a program's execution for a given number of seconds. This functionality is absent from JavaScript, however, owing to its asynchronous nature. In this article, we'll look briefly at why this might be, then how we can implement a sleep function ourselves. Understanding JavaScript's Execution Model Before we get going, it's important to make sure we understand JavaScript's execution model correctly. Consider the following Ruby code: require 'net/http' require 'json' url = 'https://api.github.com/users/jameshibbard' uri = URI(url) response = JSON.parse(Net::HTTP.get(uri)) puts response['public_repos'] puts "Hello!" As one might expect, this code makes a request to the GitHub API to fetch my user data. It then parses the response, outputs the number of public repos attributed to my GitHub account and finally prints "Hello!" to the screen. Execution goes from..