Welcome to curated list of handpicked free online resources related to IT, cloud, Big Data, programming languages, Devops. Fresh news and community maintained list of links updated daily. Like what you see? [ Join our newsletter ]

Better error handling in JavaScript

Categories

Tags frontend-and-mobile software-engineering

An article by Iain Collins on how and why to use custom error types in JavaScript. Handling errors can be tricky. How Error() historically worked in JavaScript hasn’t made this easier, but using the Error class introduced in ES6 can be very helpful.

In JavaScript some vendors have implemented a conditional catch clause but it’s not a standard and not widely supported in browsers. As a result of not having a standard way to define errors — or to return them when throwing them from a server to a client — information about an error being returned is often lost, with projects featuring bespoke error handling.

The article dives into:

  • Comparing how Throwing errors is done in other languages
  • Defining error types in JavaScript
  • Returning Error objects from Promises
  • Serializing Error objects in JSON

JavaScript actually has a several core Error types by default, but they are quite niche and of limited usefulness for error handling in most applications.

However, with ES6 you can extend the Error class and define custom errors with their own behaviour – such as logging errors automatically – and you can choose what detail to add or include when returning an error. Good read!

[Read More]

JavaScript-Free Frontend

Categories

Tags miscellaneous software-engineering leadership-and-career frontend-and-mobile

The more code you have, the less agile you are. Code is a liability, not an asset. It’s like tar.

An article by Matt Reyer from Slimvoice – a webapp without JavaScript is a series where he documents how he rebuilt his app, Slimvoice, using as little JavaScript as possible. He’s tried to present JavaScript alternatives and encourage those who reach for a SPA for every project to give it a second thought.

Motivation: deliver an amazing user experience with a great design while drastically reducing the complexity of the code, maximizing reliability, and minimizing the cost to the end user.

The author then describes how he has put frontend together:

  • Plain old HTML and CSS
  • The Checkbox/Label trick
  • The / elements
  • Forms & Input validation

Author concludes that plain HTML inputs covered most of his needs, but he found himself wishing for more innovation in the HTML spec to cover more inputs and remove the need for JavaScript altogether.

And one advice standing out? Don’t be scared. You can build it yourself! You don’t need a framework! Great read!

[Read More]

gRPC and Protocol Buffers as an alternative to JSON REST APIs

Categories

Tags backend-development software-engineering cloud-and-infrastructure architecture-and-apis

Rafael Sales wrote this article about gRPC as alternative to REST APIs. gRPC is an open-source remote procedure call framework and Protocol Buffers is a mechanism for serializing structured data.

A remote procedure call framework is used when applications running in different processes need to exchange data. It shouldn’t matter whether these are running in the same or different machines, or one is running in the cloud and the other in a desktop/mobile client.

The article briefly introduces gRPC and explores the core features of gRPC and Protobuf, and compare to JSON REST APIs.

gRPC uses HTTP/2 as its base transport protocol. It benefits from the multiplexing feature of HTTP/2 to execute requests/responses in parallel using a single TCP connection, reducing the hardware resources usage in both client and server compared when comparing to HTTP 1.1.

It also supports bi-directional streaming, which makes it capable of handling long communication patterns such as chat and file download/upload split in chunks.

Protobuf, for short, is a language-independent mechanism for defining structured data. To learn from what pieces Protocol Buffers consist and why Google has chosen them to use wit gRPC read the rest of the article. Super useful!

[Read More]

Best practices of safe pattern matching in a Scala application

Categories

Tags backend-development software-engineering

When you start developing your first Scala projects, you may sometimes miss out to address one common problem with pattern matching, and that is error handling. This article by Eugene Krotov teaches how to do it.

In the article, author looks at a few ways to handle the MatchError runtime exception in Scala:

  • Adding a default case _ to catch all unmatched options
  • Using the keyword sealed with the base class or trait for matching options (although this is a workaround not a problem solver)
  • Changing the compiler options to stop compilation whenever there are warnings produced thanks to sealed

The article provides step by step instructions, code examples and more. It reviews the listed ways to address or mitigate the problem. Very good and to the point!

[Read More]

From 46s to 5s -- Optimizing a 350 Line Raytracer in Rust

Categories

Tags software-engineering

An interesting article by Carl Fredrik Samson about his journey with Rust. He started with porting some code from a familiar language, C# or C++ in this case. But if you just port the code you will probably miss some of the features that makes Rust special.

In this post he talks about how to port a short raytracer written in C#/C++ codebase to Rust, then applying some simple optimizations by leveraging some features in Rust.

Author then explains each line of code and how it was ported from C# to Rust (or as close as he could get). The observation?:

Rust is pretty similar to the optimized C# when we run the code ported line by line as similar as possible, but the memory usage is less than 1/4 of C#.

Then he describes:

  • Optimizing part 1. Use iterators
  • Optimizing part 2. Buffer the results if you can
  • Optimizing part 3. Using Rayon
  • Bonus: Fixing the huge increase in memory usage.

Rayon is a paralleization library for Rust, and gives us superpowers if you already have a piece of code that uses an iterator to produce a result.

Read more to learn how they slashed down render time to one ninth of original! Good read for anybody interested in systems programming languages like Rust.

[Read More]

Programming concurrency in C++

Categories

Tags frontend-and-mobile software-engineering architecture-and-apis

The first in series of articles by Mehreen Tahir about programming C++ and introduce you to the features C++ offers in order to support concurrent programming. C++ was originally designed to support only single thread programming. In every application, there is one default thread.

Concurrent programming allows for the execution of multiple threads and thus, we can write highly efficient programs by taking advantage of any parallelism available in a computer system.

C++ version 11 acknowledged the existence of multi-threaded programs and the later standards also brought some improvements.

Following this article you will learn about:

  • Concurrency and concurrent programming
  • Concurrency and parallelization
  • Why even the need for concurrency?
  • The threading library in C++
  • Different ways of creating threads
  • Considerations for computation and / or IO intensive programs

A thread is basically a lightweight sub-process. It is an independent task running inside a program that can be started, interrupted, and stopped.

The article also has figures explaining the life cycle of a thread and example of code you can use for your own experiments with concurrent programming. Nice one!

[Read More]

Structuring applications in Go

Categories

Tags backend-development frontend-and-mobile software-engineering architecture-and-apis

An article by Liam Andrew Cura about his Gog journey. For him the hardest part of learning Go was in structuring his application.

Go doesn’t prescribe any particular project layout or application structure and Go’s conventions are mostly stylistic.

Author focuses on four patterns which can be tremendously helpful in creating architecture for Go application:

  • Don’t use global variables
  • Separate your binary from your application
  • Wrap types for application-specific context
  • Don’t go crazy with sub-packages

Go only has one requirement for packages: you can’t have cyclic dependencies. Author recommends to group related types and code together in each file. Also organize the most important type at the top of the file and add types in decreasing importance towards the bottom of the file.

Well written article with code examples and links to complementary resources and reading. Excellent!

[Read More]

Fully automated zero downtime deployments with Floating IPs on DigitalOcean Droplets

Categories

Tags devops-and-ci-cd

Tutorial by Marco Ebbinghaus in which he explains how he has implemented a zero downtime deployment (blue-green like) of a small web application which is running on a DigitalOcean Droplet.

The cool thing is, that this deployment is fully automated. After pushing a code change to the web application code a CI/CD-Pipeline will be executed.

The article main parts:

  • Description of tech-stack
  • Creation of the web application (Spring Boot)
  • Adding web application in container
  • Creation of the infrastructure (as code) via Terraform
  • How to create the CI / CD pipeline

It also describes the way how to log into the docker registry. Also adding environment variables in the CI/CD-Settings in GitLab project. Detailed and exciting!

[Read More]

Managing analysis workflows in geospatial data science with GNU Make

Categories

Tags data-and-analytics ai-and-machine-learning miscellaneous backend-development

Martí Bosch wrote this guide how to go about using Jupyter Notebooks while using iterative approach to both data analysis and software development. He will also explain how to avoid some bad practices. Many issues can be settled by choosing helpful file names, good organization, documentation and source control of the code.

The article then describes an example from geospatial data science: analysis of the spatiotemporal patterns of urbanization.

It deals with:

  • Computational workflow approach
  • Automating the workflow with GNU Make
  • Detecting completed targets
  • Pattern rules and abstracting our workflow from the data
  • Detecting edited source files

All above with detailed code examples and illustrated charts and animations. Link to GitHub repository is included, too.

The main advantage of Make is its flexibility, which allows it to precisely manage any kind of computational workflow, from the compilation of source files to the example above. Nice one!

[Read More]

Understanding stabilising experience replay for deep multi-agent reinforcement learning

Categories

Tags data-and-analytics ai-and-machine-learning miscellaneous

An article by Parnian Barekatain in which she describes some basic concepts in Reinforcement Learning. She also provides you with the link to Udacity’s free course on Deep Learning with Pytorch.

The blog consists of four parts:

  • Deep Neural Network for Single-Agent: Reinforcement Review, DQN and Replay Memory
  • Overview of multi-agent Reinforcement Learning
  • Deep Neural Network for multi-agent: Independent Q Learning (IQL) and challenges combing with multi-agent Reinforcement Learning
  • FingerPrinting

In 2015, DeepMind was able to successfully combine Deep Neural Network with Reinforcement Learning for a single-agent. Combining Deep Neural Network with Reinforcement Learning enabled AI for the first-time to surpass the performance of professional human players across many game scenarios.

This worked well fora single agent. However, when we have many agents, we cannot easily combine Deep Neural Networks with Reinforcement Learning, mainly because each agent constantly changes the dynamic of the environment and makes it really hard for other agents to learn what to do.

Read the rest of the article and watch explanation videos to understand this paper. Plenty of links to other resources to get you on track! Excellent read for any aspiring data scientist.

[Read More]