Articles

The NonNullable type is a utility type in TypeScript that creates a new type, whilst removing all null or undefined elements. It lets us take existing types, and modify them so they are more suitable in certain situations. Let’s look at how it works.

Custom Types

This article covers custom types. To learn more about custom types, read my guide about it here.

Source de l’article sur DZONE

It’s common for websites to have a subscription button, where you can pass along your email address, and you’ll receive emails every week, month, or day. Sometimes, these are automated emails, and sometimes they are custom posts written by an editor.

It’s also common to pay for this service, sometimes extortionately. In this article, I’ll show you it’s pretty easy to create your own, although you will obviously still have to pay for hosting. Let’s look at how to create an email subscription service with MongoDB and Node.JS.

Source de l’article sur DZONE

Ever since the Python programming language was born, its core philosophy has always been to maximize the readability and simplicity of code. In fact, the reach for readability and simplicity is so deep within Python’s root that, if you type import this in a Python console, it will recite a little poem:

    Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. The complex is better than complicated. The flat is better than nested. Sparse is better than dense. Readability counts…

Simple is better than complex. Readability counts. No doubt, Python has indeed been quite successful at achieving these goals: it is by far the most friendly language to learn, and an average Python program is often 5 to 10 times shorter than equivalent C++ code. Unfortunately, there is a catch: Python’s simplicity comes at the cost of reduced performance. In fact, it is almost never surprising for a Python program to be 10 to 100 times slower than its C++ counterpart. It thus appears that there is a perpetual trade-off between speed and simplicity, and no programming language shall ever possess both.
But, don’t you worry, all hope is not lost.

Taichi: Best of Both Worlds

The Taichi Programming Language is an attempt to extend the Python programming language with constructs that enable general-purpose, high-performance computing. It is seamlessly embedded in Python, yet can summon every ounce of computing power in a machine — the multi-core CPU, and more importantly, the GPU.
We’ll show an example program written using taichi. The program uses the GPU to run a real-time physical simulation of a piece of cloth falling onto a sphere and simultaneously renders the result.
Writing a real-time GPU physics simulator is rarely an easy task, but the Taichi source code behind this program is surprisingly simple. The remainder of this article will walk you through the entire implementation, so you can get a taste of the functionalities that taichi provides, and just how powerful and friendly they are.
Before we begin, take a guess of how many lines of code this program consists of. You will find the answer at the end of the article.

Algorithmic Overview

Our program will model the piece of cloth as a mass-spring system. More specifically, we will represent the piece of cloth as an N by N grid of point-masses, where adjacent points are linked by springs. The following image, provided by Matthew Fisher, illustrates this structure:
The motion of this mass-spring system is affected by 4 factors:
  • Gravity
  • Internal forces of the springs
  • Damping
  • Collision with the red ball in the middle
For the simplicity of this blog, we ignore the self-collisions of the cloth. Our program begins at the time t = 0. Then, at each step of the simulation, it advances time by a small constant dt. The program estimates what happens to the system in this small period of time by evaluating the effect of each of the 4 factors above, and updates the position and velocity of each mass point at the end of the timestep. The updated positions of mass points are then used to update the image rendered on the screen.

Getting Started

Although Taichi is a programming language in its own right, it exists in the form of a Python package and can be installed by simply running pip install taichi.
To start using Taichi in a python program, import it under the alias ti:
import taichi as ti
The performance of a Taichi program is maximized if your machine has a CUDA-enabled Nvidia GPU. If this is the case, add the following line of code after the import: ti.init(arch=ti.cuda)

If you don’t have a CUDA GPU, Taichi can still interact with your GPU via other graphics APIs, such as ti.metal, ti.vulkan, and ti.opengl. However, Taichi’s support for these APIs is not as complete as its CUDA support, so, for now, use the CPU backend: ti.init(arch=ti.cpu)And don’t worry, Taichi is blazing fast even if it only runs on the CPU. Having initialized Taichi, we can start declaring the data structures used to describe the mass-spring cloth. We add the following lines of code:

Python

 

 N = 128 x = ti.Vector.field(3, float, (N, N)) v = ti.Vector.field(3, float, (N, N))

Source de l’article sur DZONE

AngularJS is one of the most trusted frontend frameworks by enterprises. The frontend framework has multiple features that work the best for developers. In this section, we will learn about the use of expressions in AngularJS.

Definition:

Expressions in AngularJS are used to bind data with HTML. The AngularJS expressions are code snippets like that in JavaScript, which are usually placed in the interpolation bindings. However, you can directly make use of expressions in directive attributes.

Source de l’article sur DZONE

When planning the creation of a website or web app, underestimating the time needed to deliver can sink a project. The longer the project is in development the more money, time, and other resources are required to see it to delivery. Also, the longer it is developed, the more that excitement for the project wanes and it might just be cast to the rubbish heap of other discarded projects.

Fortunately, over the years with advancements in tech stacks and the development of best practices, development times can be significantly reduced. This article looks at 10 easy-to-adopt practices that will reduce development time.

Source de l’article sur DZONE

Both Angular 2 and AngularJS are great for e-commerce, but which one you use for e-commerce depends on your needs. AngularJS is good for building small-scale e-commerce applications fast while Angular 2 is good for complex, scalable solutions that are high-performing and mobile-ready. 

Today, over a quarter of developers use AngularJS and Angular 2. Thirty-two percent use them for user interfaces, according to StackOverflow, and many of the respondents in that study worked in e-commerce development.

Source de l’article sur DZONE

With Flutter 2.0, you can build apps on mobile, web and desktop.  Graphics performance is fantastic and the development tools are great. The main barrier to learning Flutter is an understanding of state management.  This tutorial covers the Provider package, one of the most popular and easiest tools to manage state in Flutter.

A video version of this tutorial is available. Code and image files are on GitHub. 

Source de l’article sur DZONE


Overview

The formula is the heart of an Excel file. And of course, we all want to do correct calculations and deliver accurate results. When there is something wrong, we want to trace back to those referenced cells to find the root cause. Excel natively has a built-in convenient formula dependent/precedent trace feature, it highlights the dependent/precedent cells and displays arrows to indicate the relationships. This helps users to trace back and find any error formulas easily.

Now, when bringing the spreadsheet online, we can do more. We can display the relationships in a custom way that is most useful according to the application context, or bring them to a different service or application for doing the validation programmatically.

Source de l’article sur DZONE