Categories
Notes
Sometimes you need to keep values stored locally, for example:
- to prevent data loss due to network failures.
- to keep unfinished editing for a long time (example, this editor)
- to exchange data between different pages without sending it to the server(implementing a shopping cart)
Original post
https://javascript.plainenglish.io/how-to-do-multithreading-with-node-js-207aabdaddfb
Features
Each thread has separate v8 engines.
Child threads could communicate with each other.
Child threads could share the same memory.
An initial value could be passed as an option while starting the new thread.
Here you will can find some references to secure coding practices and how to test for security
There is the XP guide “Do the simplest thing that could possible work”, but how to tell apart simple from easy? Sometimes simple is easy, actually as a guide for me I say “Simple is easy to understand”, but sometime easy leads to complex, and most of the time getting something simple requires hard work. So, are there rules that help us get to simple design?
Not dealing with errors properly makes difficult to get readable code. These are a few guidelines on how to properly deal with them.
Use case, we want to know how much time an element has been visible. For example, an ad before refresh.
Adding an extra level of security is increasingly important to avoid our data from being stolen. Using two factor authentication is a simple yet effective way to accomplish this goal.
Easy Understanding
Easy of Change
Easy of Debugging
Flexibility
- policy
- location
Properly hashing is difficult. Some popular hashing algorithms have been probed vulnerable (MD5)
So, here are a couple of options that allow to hash in a cryptographically safe way.
Requiring a schema to validate JSON data is a common task.
Usually, you start by simply sending the data to the service. As more data is added, one day dealing with data complexity turns out to be difficult.
So, validating that the data is as expected turns out mandatory.
The simplest way to come up with a first schema to be used for validation is to generate it based on json data.
In this post I present two tools that helps pull off this task very easly.
The web-vitals library is a tiny (~1K), modular library for measuring all the Web Vitals metrics on real users, in a way that accurately matches how they’re measured by Chrome and reported to other Google tools (e.g. Chrome User Experience Report, Page Speed Insights, Search Console’s Speed Report).
The library supports all of the Core Web Vitals as well as all of the other Web Vitals that can be measured in the field:
UI Frameworks like bootstrap, material design, tailwindcss come with a lot of CSS helper classes to enable you with flexibility in the design of which you end up using only a small fraction. At the time of creating the production file you end up with big files that slow down your pages loading and degrade the user experience.
Getting rid of all css classes that are not used is a simple way to optimize your pages performance.
Keeping your javascripts light is something pressured by UX requirements. Pages with big javascripts tend to load slowly, on the other hand for a provider is difficult to know in advance what tools to include because they are known only when the script is run.
Sometimes when you are editing a resource, if someone else edits it at the same time you could end up overriding the other person changes.
In order to avoid this, implementing an Etag could solve the issue.
If you want to load again and again a resource that is heavy, you could implement a kind of cache. This can be done implementing Etag in https.
Sometimes you need to implement a download link in a web page.
Having unique ids is a frequent need. Sometimes using a database can help on this but at the cost of speed. Here are a few faster alternatives.
An alternative to SOLID when the problem is not clear enough to get to a sound design.
Technical debt are decisions we make during development that we know are not optimal because they require more work to get optimal but we decide to deal with the consequences because we see more value in delivering at that time.
Some examples of solving problem using functional programming style.
Different ways of implementing Core Web Vitals
Creating a Multidimensional array in javascript.
Really excellent video on how to replace inheritance with composition in javascript.