The Apache Kafka is a great instrument for event streaming used by thousands of big and small companies for complex architectures and simple applications. As for me it’s one of “need to know” tools in modern software engineering.

And it’s good to start learning about this technology with The Apache Kafka Handbook on FreeCodeCamp.

Also subscribe to Tech Read channel. In regular posts you’ll find a lot of info about other tools, technologies, languages etc.
As usual, shares and recommendations are welcome.

#kafka
Just a List of Enterprise Integration Patterns with small description, schema and details.

Will be useful and interesting for architects and engineers.

Hope as useful and interesting a Tech Read channel.
Likes, shares and recommendations are welcome.

#patterns
This post is the selection of useful npm modules:

1. OTPAuth - One Time Password (HOTP/TOTP) library for Node.js, Deno, Bun and browsers.

HOTP (HMAC-based One-Time Password) and TOTP (Time-based One-Time Password) are two commonly used algorithms for generating one-time passwords (OTP) in two-factor authentication systems.
HOTP generates OTPs based on a counter value and a secret key using a hash-based message authentication code (HMAC) algorithm. Each time a new OTP is generated, the counter value is incremented.
TOTP, on the other hand, generates OTPs based on a combination of a secret key and the current time. A timestamp is used as the counter value, and the OTP changes every 30 seconds (default value).

2. Concurrent.js - Non-blocking Computation for JavaScript RTEs (Web Browsers, Node.js & Deno).

Non-blocking computation is a technique used to allow JavaScript runtime environments (RTEs) to perform computationally intensive tasks without blocking the main thread of execution. This is achieved by executing these tasks asynchronously, using features such as web workers or worker threads.
In JavaScript, blocking the main thread can lead to performance issues and a poor user experience, as the user interface may become unresponsive while the script is running. Non-blocking computation helps to mitigate this issue by allowing these tasks to be performed in the background, without affecting the responsiveness of the user interface.

3. Malibu - Framework-agnostic CSRF middleware for modern Node.js

CSRF (Cross-Site Request Forgery) is a type of web attack where an attacker tricks a user into performing an unintended action on a web application. The attack typically involves the attacker crafting a request to the application, and then tricking the user into submitting that request through some form of social engineering, such as by clicking on a malicious link or visiting a page with a hidden form.
One common example of a CSRF attack is when an attacker creates a malicious form on a website, which is designed to submit a request to a different website that the user is already logged in to. If the user is tricked into submitting the form, the attacker can execute a malicious action on the targeted website on behalf of the user.
To prevent CSRF attacks, developers can implement security measures such as using anti-CSRF tokens or implementing same-site cookies. These measures can help to ensure that a request is only processed if it originates from an authorized source, and can help to prevent unauthorized actions on the targeted website.

For more useful info - subscribe to Tech Read channel.
Likes, shares and recommendations are welcome.

#nodejs #deno #bun #npm #csrf
This post is the selection of short YouTube tech videos:

1. 8 Key Data Structures That Power Modern Databases

Data structures are an essential part of software engineering, providing a means of organizing and manipulating data in memory. They are used to store and manage data in an efficient and organized manner, enabling efficient access, insertion, deletion, and search operations. Choosing the appropriate data structure for a given task is an important decision for a software engineer, as it can have a significant impact on the performance and memory usage of the application. For example, a hash table may be a good choice for fast lookup operations, while a linked list may be more suitable for frequent insertions and deletions.
Understanding data structures and their properties is an important skill for software engineers, as it can help them design and implement efficient and scalable applications.

2. CAP Theorem Simplified

CAP theorem is a fundamental concept in distributed systems that states that it is impossible for a distributed system to simultaneously provide all three of the following guarantees: consistency, availability, and partition tolerance.
Consistency refers to the requirement that all nodes in a distributed system see the same data at the same time. Availability refers to the requirement that a request made to the system must receive a response, regardless of the state of the system. Partition tolerance refers to the ability of the system to continue operating in the presence of network failures or partitioning.
Understanding CAP theorem is important for software engineers designing and implementing distributed systems, as it can help them make informed trade-offs between consistency, availability, and partition tolerance based on the specific needs of their application.

3. What is OSI Model

The OSI (Open Systems Interconnection) model is a conceptual framework that describes how communication protocols interact in a networked system. It is divided into seven layers, each representing a different aspect of network communication.
The OSI model serves as a conceptual framework for understanding network communication, allowing engineers to design and implement communication protocols that are interoperable across different systems. It is a useful tool for troubleshooting network issues and understanding how different protocols work together to provide end-to-end communication.

To know more - subscribe to Tech Read channel.
Likes, shares and recommendations are welcome.

#datastructures #cap #osi
“QUIC protocol: performance features”

In this article I want to describe main features of HTTP/3 and particularly QUIC protocol:
1. Connection Migration
2. 0-RTT Connection Set-Up
3. UDP And TLS Performance
4. Head-Of-Line Blocking Removal
5. Congestion Control

Medium link

If you liked the article and want to support the author:
Clap and follow me on Medium
Follow me on Linkedin
Subscribe to Tech Read channel

#http3 #quic #network #performance
Why does the search for the shortest route on the map take so fast?

One of the “secrets” is the A* algorithm is a pathfinding algorithm used to find the shortest path between two points on a graph or map. It uses a heuristic approach that estimates the distance between a given point and the destination to guide the search for the shortest path. The algorithm is widely used in video games and robotics for navigation. To use the A* algorithm on a map, we first represent the map as a graph, divide it into nodes, and create edges between them. Then, we assign a heuristic value to each node, estimating the distance between that node and the destination. The algorithm starts at the starting point, evaluates neighboring nodes, adds them to an open list, selects the node with the lowest cost, and explores its neighboring nodes. This process continues until the algorithm reaches the destination node.

More about this algorithm in YouTube video - The hidden beauty of the A* algorithm

For more info - subscribe to Tech Read channel.
Likes, shares and recommendations are welcome.

#algorithms
NPM Security best practices from OWASP Cheat Sheet Series

Short list:
1) Avoid publishing secrets to the npm registry
2) Enforce the lockfile
3) Minimize attack surfaces by ignoring run-scripts
4) Assess npm project health
5) Audit for vulnerabilities in open source dependencies
6) Use a local npm proxy
7) Responsibly disclose security vulnerabilities
8) Enable 2FA
9) Use npm author tokens
10) Understand module naming conventions and typosquatting attacks

Also a lot of useful links you can find in Tech Read channel so subscribe and enjoy.
Likes, shares and recommendations are welcome.

#npm #security #owasp
“JS (Browser + Node.js): Broadcast Channel API - How to Reduce Server Load”

In this article I described the use case of combining Broadcast Channel API and Shared Workers (or Worker Threads in Node.js) for reducing the number of server connections.

Broadcast Channel API is a JavaScript interface that allows communication between different browsing contexts, such as tabs or frames (or between Node.js Worker Threads, but about this at the end of the article), that share the same origin. It provides a simple publish-subscribe model for sending and receiving messages between these contexts.

Shared Worker - a special type of web worker that can be accessed by multiple instances of an application. Shared workers have a single thread of execution and a shared scope between all clients, allowing for efficient communication and synchronization between tabs.

To know how to combine them - check the article.

Medium link

If you liked the article and want to support the author:
Clap and follow me on Medium
Follow me on Linkedin
Subscribe to Tech Read channel

#javascript #nodejs #broadcastchannelapi #webapi #sharedworker
When Node.js is not enough

As a developer you should understand the importance of choosing the right programming language for a particular task. Node.js is a popular platform for building server-side applications using JavaScript, but sometimes we need to use other languages to take advantage of their unique features and capabilities.

Thankfully, Node.js provides several ways to integrate other programming languages into our applications. One popular approach is to use the Child Process module to spawn a child process and communicate with it through standard input/output streams. This allows us to execute external commands written in other languages and receive their output back in our Node.js application.

Another option is to use a native Node.js add-on written in another language, such as C++ or Rust, to access low-level system resources or improve performance-critical parts of our code. Node.js provides a well-documented API for building native add-ons, and there are also several community-driven tools like neon and node-ffi that simplify the process of writing and using native add-ons.

Lastly, we can also use WebAssembly, a low-level binary format designed to run in web browsers, to execute code written in other languages like C, Rust, or Go. Node.js supports WebAssembly, which allows us to load and execute WebAssembly modules directly in our Node.js applications.

Using other programming languages in Node.js can open up new possibilities and help us build more robust, performant, and scalable applications. However, it's important to choose the right approach based on our specific needs and requirements, and to carefully consider the trade-offs involved in integrating different programming languages.

To know more - subscribe to the Tech Read channel.
Also I’ll add a few links with articles about using Rust, Python and C languages with Node.js.
Likes, shares and recommendations are welcome.

#nodejs #webassembly

Links:
https://johns.codes/blog/exposing-a-rust-library-to-node-with-napirs
https://www.alxolr.com/articles/how-to-process-a-csv-file-five-times-faster-in-node-js-with-rust-and-napi-rs
https://github.com/bitair-org/linker.js
The Hidden Danger: Malware in NPM Modules

In today's interconnected world, where software development heavily relies on third-party libraries and frameworks, we must remain vigilant about the security of our codebases. One area that often goes unnoticed is the presence of malware in npm modules, posing a significant threat to our projects.

NPM (Node Package Manager) has revolutionized the JavaScript ecosystem by providing a vast collection of reusable modules. While most npm modules are developed and maintained by trustworthy individuals and organizations, the open nature of the ecosystem leaves room for potential vulnerabilities and malicious intent.

The proliferation of malware-infected npm modules has become a growing concern. Hackers have increasingly exploited this avenue to inject harmful code into unsuspecting projects. These malware-infected modules can take various forms, including hidden backdoors, data exfiltration mechanisms, crypto-mining scripts, or even ransomware.

So, how can we protect ourselves and our projects from such threats? Here are a few essential measures to consider:

1. Regularly Update Dependencies: Keeping your project's dependencies up to date is crucial. Developers often release security patches and bug fixes to address vulnerabilities. By updating your npm modules regularly, you ensure that you are using the latest, more secure versions.

2. Scrutinize Dependency Sources: When choosing npm modules, it's vital to review the module's source, maintainers, and the overall community engagement. Opt for modules that have an active developer community, reliable maintainers, and transparent code reviews. Additionally, check if the module has undergone security audits or has a history of security-related issues.

3. Analyze Module Popularity: The popularity of an npm module can be an indicator of trustworthiness. Highly popular modules usually have a larger user base and undergo more scrutiny, reducing the likelihood of malware infiltration. However, popularity alone is not a guarantee, and additional due diligence is necessary.

4. Implement Continuous Integration and Testing: Incorporating automated security checks into your development workflow is essential. Leverage tools like vulnerability scanners, static code analyzers, and dependency checkers to identify any potential security risks. Integrate these checks as part of your continuous integration (CI) and continuous deployment (CD) pipelines for maximum effectiveness.

5. Stay Informed: Stay updated with the latest news and reports on security vulnerabilities or malware incidents related to npm modules. Follow trusted sources, security forums, and advisory lists to receive timely information about emerging threats and recommended actions.

Remember, the responsibility for securing our projects lies with us as developers. By being proactive, vigilant, and implementing the best practices outlined above, we can mitigate the risks associated with malware-infected npm modules.
Stay safe, keep your codebase secure, and happy coding!

To know more - subscribe to the Tech Read channel in Telegram.
Also I’ll add a link with the article “Five Packages And Their Evil Install Scripts”.
Likes, shares and recommendations are welcome.

#npm #security #javascript

Links:
https://blog.sandworm.dev/dissecting-npm-malware-five-packages-and-their-evil-install-scripts
Server-Sent Events (SSE)

In one of my previous articles I’ve described the usage of BroadcastChannel API with Websockets. At the same time I’ve passed over another way of Server-Client communication. I should correct the situation.

Server-Sent Events (SSE) is a powerful technology that enables real-time communication between a server and a client. It allows the server to push data to the client over a single HTTP connection, making it an ideal choice for building interactive and event-driven applications. In this post, we will explore the concept of Server-Sent Events and how they can revolutionize the way we create real-time applications.

What are Server-Sent Events?
Server-Sent Events is a web API that enables server-initiated communication with the client. Unlike traditional request-response patterns, SSE allows the server to send data to the client without the need for the client to repeatedly poll the server for updates. This one-way communication channel opens up exciting possibilities for building real-time applications where information is delivered instantly to connected clients.

How do Server-Sent Events work?
SSE works by establishing a persistent connection between the client and the server. The server sends data to the client as a stream of events, and the client handles those events as they arrive. The connection remains open as long as both the client and the server desire, facilitating ongoing communication and real-time updates.

Benefits of Server-Sent Events:
1. Real-Time Updates: SSE provides a seamless way to deliver real-time updates to clients, enabling instant data synchronization and interaction. This is particularly useful for applications such as chat systems, social media feeds, live dashboards, and collaborative tools.
2. Simplicity and Efficiency: SSE is based on standard HTTP protocols and does not require additional dependencies or complex setup. It uses a single, long-lived connection, reducing overhead and improving efficiency compared to frequent polling or WebSocket-based approaches.
3. Compatibility: SSE is supported by most modern web browsers, making it widely accessible to a broad range of users. It can be used alongside existing web technologies, and server-side implementations can be achieved with various frameworks and languages.
4. Error Handling and Reconnection: SSE handles error conditions and reconnection automatically, ensuring robust communication. If the connection is lost, SSE attempts to reconnect, minimizing data loss and providing a seamless experience for clients.

Use Cases for Server-Sent Events:
- Real-time chat and messaging applications
- Live updates and notifications
- Collaborative document editing and shared whiteboards
- Stock tickers and financial data feeds
- Sports scores and live event updates

Conclusion:
Server-Sent Events offer a straightforward and efficient approach for building real-time applications. With its ability to push data from the server to the client, SSE simplifies the development of interactive and event-driven systems. Whether you're building chat applications, live dashboards, or collaborative tools, consider leveraging Server-Sent Events to deliver real-time updates and create engaging user experiences. Embrace the power of SSE to unlock a world of real-time possibilities in your web applications.

To know more - subscribe to the Tech Read channel in Telegram.
Also I’ll add a link to the article with SSE usage examples.
Likes, shares and recommendations are welcome.

#sse #websockets #javascript

Links:
https://javascript.plainenglish.io/js-browser-node-js-broadcastchannel-api-8d4ceb408a5
https://blog.endpts.io/server-sent-events-with-nodejs
About sessionStorage

One crucial aspect of web development is managing data within the browser. In this post, let's delve into the browser's sessionStorage and understand its purpose and functionality.

What is sessionStorage?
sessionStorage is a built-in web API provided by modern browsers that allows developers to store key-value pairs locally within the user's browser session. Unlike cookies, which are sent to the server with every request, sessionStorage is purely client-side storage. It provides a temporary storage mechanism for the duration of the user's session on a particular website.

How does it work?
When you store data in sessionStorage, it is associated with the specific origin (protocol, domain, and port) from which it originates. This means that the stored data is accessible only within the same origin and cannot be accessed by other websites or origins.
sessionStorage data persists as long as the user's browsing session remains active. If the user closes the browser or navigates away from the website, the sessionStorage data is cleared, and subsequent visits to the website will start with a clean slate.

Using sessionStorage
Working with sessionStorage is straightforward. Here are a few key methods to interact with it:
- sessionStorage.setItem(key, value): Stores a key-value pair in sessionStorage.
- sessionStorage.getItem(key): Retrieves the value associated with the specified key.
- sessionStorage.removeItem(key): Removes the key-value pair with the given key from sessionStorage.
- sessionStorage.clear(): Clears all key-value pairs stored in sessionStorage.

Remember that sessionStorage values are always stored as strings. If you want to store complex objects or arrays, you need to convert them to JSON strings using JSON.stringify() before storing and parse them back using JSON.parse() when retrieving.

Use Cases
- Storing temporary data or user preferences during a session.
- Implementing client-side caching to avoid redundant network requests.
- Saving form data temporarily, ensuring it survives page refreshes.

Tip: Remember that sessionStorage is limited to a specific browser tab or window. If you need to share data across multiple tabs or windows, you should explore other techniques like localStorage or server-side storage.

Understanding and effectively utilizing the browser's sessionStorage API can enhance the user experience and provide seamless interactions within your web applications. By harnessing the power of client-side storage, you can create more responsive and personalized web experiences.
Happy coding!

To know more - subscribe to the Tech Read channel in Telegram.
Also I’ll add a link to the article with an interesting interview question.
Likes, shares and recommendations are welcome.

#javascript #sessionstorage

Links:
https://javascript.plainenglish.io/interviewer-can-sesstionstorage-share-data-between-multiple-tabs-a8d850328e89
Node.js 20 performance

As a software engineer, it is crucial to recognize the significance of periodically checking the performance and versions of Node.js applications. Node.js has gained immense popularity due to its scalability and high-performance capabilities, making it a go-to choice for developing server-side applications. However, to ensure the continued success of your Node.js applications, it is essential to stay on top of their performance and keep up with the latest versions.

***
Before you continue reading - subscribe to the Tech Read channel in Telegram.
Likes, shares and recommendations are welcome.
***

Here are a few reasons why periodic performance checks and version updates are of utmost importance:

- Optimizing Performance: By regularly monitoring the performance of your Node.js applications, you can identify bottlenecks, inefficiencies, or areas that require optimization. Performance monitoring tools, such as profiling and benchmarking frameworks, can help you pinpoint specific areas that need improvement. This proactive approach allows you to fine-tune your application, enhancing its speed, responsiveness, and overall user experience.

- Security and Bug Fixes: New vulnerabilities and bugs are discovered regularly, and the Node.js community actively addresses them by releasing patches and updates. Keeping your application up to date with the latest Node.js version ensures that you have the most robust security measures and bug fixes in place. Neglecting updates may expose your application to potential security breaches or software glitches that can impact its stability and reliability.

- Compatibility with Dependencies: Node.js applications often rely on various external dependencies, such as libraries, frameworks, or plugins. These dependencies also receive updates over time, introducing new features, bug fixes, or improved performance. By periodically checking the compatibility of your Node.js application with its dependencies, you can avoid conflicts, ensure smooth integration, and take advantage of the latest enhancements available.

- Community Support and Knowledge Sharing: Node.js benefits from a vast and active community of developers who constantly contribute to its growth and improvement. By staying updated with the latest versions and actively participating in the community, you gain access to valuable resources, best practices, and collaborative discussions. This engagement can help you overcome challenges more efficiently, discover new techniques, and remain at the forefront of Node.js development.

To conclude, as a responsible software engineer, it is crucial to perform periodic checks on the performance and versions of your Node.js applications. By doing so, you can optimize performance, ensure security and bug fixes, maintain compatibility with dependencies, and stay engaged with the vibrant Node.js community. Embracing these practices will not only help you deliver high-quality applications but also provide a solid foundation for future scalability and success.

PS. Link to the article ”State of Node.js Performance 2023” (specifically such modules as fs, events, http, misc, module, streams, url, buffers, utils) below.

#nodejs #performance

Links:
https://blog.rafaelgss.dev/state-of-nodejs-performance-2023
JS: Generators

Hey fellow developers! Today, let's dive into the fascinating world of generators in JavaScript and explore how they can level up our programming skills and enhance our code.

***
Before you continue reading - subscribe to the Tech Read channel in Telegram.
Likes, shares and recommendations are welcome.
***

Generators are a unique feature introduced in ES6 (ECMAScript 2015) that allows us to define a function that can be paused and resumed at any time, yielding multiple values over time. They provide a powerful and elegant way to work with sequences and asynchronous operations in JavaScript.

To define a generator function, we use the “function*” syntax. Within this function, we can use the “yield” keyword to pause the function and produce a value to the caller. When the generator is invoked, it returns an iterator object, which can be used to control the execution of the generator function.

One of the key benefits of generators is their ability to generate values on-demand, lazily computing them only when requested. This is in contrast to traditional functions that compute and return values immediately. This lazy evaluation enables us to work with infinite sequences or process large datasets efficiently.

Generators also excellent in handling asynchronous operations. With the help of the “yield” keyword, we can easily write code that looks synchronous but behaves asynchronously. By yielding promises, we can wait for asynchronous tasks to complete and resume the generator once the results are available.

Additionally, generators offer two-way communication between the caller and the generator function. The caller can send data back into the generator by using the “next()” function with an argument. This feature opens up possibilities for building cooperative and interactive code, making generators ideal for scenarios such as event handling or state machines.

To iterate over the values produced by a generator, we use a “for...of” loop, which automatically calls the “next()” function on the iterator until the generator is exhausted. Alternatively, we can manually control the iterator by calling “next()” explicitly and inspecting the “value” and “done” properties of the returned object.

In conclusion, generators are a valuable tool in the JavaScript developer's toolbox. Their ability to create iterable sequences, handle asynchronous operations, and facilitate two-way communication make them a powerful abstraction. By leveraging generators, we can write cleaner, more expressive code that is easier to reason about and maintain.

So, let's embrace the power of generators and unlock new possibilities in our JavaScript projects. Happy coding, everyone!

PS. Link to the article ”JavaScript’s (Secret) Superpower — No One Ever Cared to Teach You” below.

#javascript #generators

Links:
https://javascript.plainenglish.io/javascripts-secret-super-power-no-one-ever-cared-to-teach-you-1331b252acf7
Node.js: URL parsing

The release of Ada URL Parser v2.0, the latest version of the powerful URL parsing tool, is announced with great excitement. Following closely after the release of v1.0.4, this update introduces notable enhancements such as improved performance, reduced memory usage, and exciting new features. In the upcoming blog post, the advancements of Ada URL Parser v2.0 will be explored, highlighting the benefits it brings to developers in their daily tasks.

***
Before you continue reading - subscribe to the Tech Read channel in Telegram.
Likes, shares and recommendations are welcome.
***

Improved Performance and Memory Usage:
One of the standout improvements in Ada URL Parser v2.0 is its enhanced performance. In some cases, the execution speed has doubled, allowing for faster parsing of URLs. This boost in performance can greatly benefit applications that heavily rely on URL parsing operations. Additionally, the update includes optimizations that result in reduced memory usage and allocations. Developers can now handle URL parsing tasks more efficiently, enabling better resource management within their applications.

Introducing a New Feature:
Ada URL Parser v2.0 also introduces a compelling new feature that will be particularly valuable for developers working with one-time URL parsing tasks. This feature enhances the tool's versatility and empowers developers to efficiently handle specific URL parsing requirements. Whether it's extracting specific parameters or performing advanced parsing operations, this new addition expands the capabilities of Ada URL Parser and simplifies URL manipulation tasks.

Benefitting Developers in their Everyday Work:
The improvements in Ada URL Parser v2.0 provide developers with a more efficient and reliable tool for working with URLs. With enhanced performance and reduced memory usage, developers can expect faster and more optimized URL parsing operations. The new feature adds versatility and flexibility to address specific parsing needs, further streamlining the development process.

Conclusion:
Ada URL Parser v2.0 brings significant enhancements, including improved performance, reduced memory usage, and a new feature to tackle one-time URL parsing tasks. These updates make Ada URL Parser a powerful and reliable tool for developers working with URLs. By boosting performance and introducing new capabilities, Ada URL Parser v2.0 empowers developers to handle a broader range of URL parsing tasks with ease. Upgrade to the latest version and experience the enhanced capabilities of Ada URL Parser in your everyday work.

PS. Link to the article ”Reducing the cost of string serialization in Node.js core” below.

#nodejs #url #serialization

Links:
https://www.yagiz.co/reducing-the-cost-of-string-serialization-in-nodejs-core
JS: few words about regular expressions

Today, let's dive into the powerful world of regular expressions in JavaScript and unravel their potential. Regular expressions are an incredibly versatile tool for pattern matching and manipulating text data. Whether you're validating user input, parsing strings, or searching for specific patterns, regular expressions have got you covered.

***
Before you continue reading - subscribe to the Tech Read channel in Telegram.
Likes, shares and recommendations are welcome.
***

In JavaScript, regular expressions are represented by the RegExp object. You can create a regular expression pattern by enclosing it in forward slashes (/). For example, /hello/ is a simple regular expression that matches the word "hello" in a string.

Here are a few common use cases where regular expressions shine:
String Matching: Regular expressions allow you to check if a string matches a particular pattern. For instance, you can use /[A-Z]+/ to find all uppercase letters in a string or /^\d{4}$/ to validate a four-digit number.
Replacing Text: With regular expressions, you can perform powerful find-and-replace operations. By using the replace() method of a string, you can replace specific patterns with desired values. For instance, str.replace(/\s/g, "_") replaces all whitespace characters in a string with underscores.
String Splitting: Regular expressions enable you to split strings based on complex patterns. By using the split() method, you can divide a string into an array of substrings based on a given regular expression. For example, str.split(/[,.]/) splits a string at every comma or period.

Remember, regular expressions come with a rich set of syntax and metacharacters to define complex patterns. Some commonly used metacharacters include . (matches any character except newline), * (matches zero or more occurrences), + (matches one or more occurrences), ? (matches zero or one occurrence), and many more.

In addition to the basic syntax, JavaScript provides numerous built-in methods for working with regular expressions, such as test(), exec(), and match(), which further enhance their usability.

However, be cautious when working with regular expressions, as they can become quite complex and hard to read. It's always a good practice to add comments and break down complex patterns into smaller parts to improve readability and maintainability.

In conclusion, regular expressions are a valuable tool for text manipulation in JavaScript. By mastering their usage, you can unlock a whole new level of string handling capabilities in your projects. So, embrace the power of regular expressions, experiment, and explore the vast possibilities they offer!

PS. Link to the article ”Regular expressions in JavaScript” below.

#javascript #regex

Links:
https://www.honeybadger.io/blog/javascript-regular-expressions
Docker and localhost

Using localhost with Docker during development is essential for seamless and efficient software development. It allows developers to test and debug their applications in a controlled environment that closely resembles the production setup. By connecting to the host machine's localhost from within a Docker container, developers can easily access and interact with local services and APIs, enabling thorough testing and faster development iterations. It simplifies the development process by eliminating the need for complex networking configurations and enables developers to focus on building and refining their applications.

***
Before you continue reading - subscribe to the Tech Read channel in Telegram.
Likes, shares and recommendations are welcome.
***

Connecting to the machine's localhost from inside a Docker container can be addressed using various approaches:

Using the host network: By using the --network host option, the container can share the host's network stack, allowing access to the host machine's localhost and other network services. However, this reduces network isolation and may pose security risks.

Using the host IP address: The container can use the IP address of the host machine to connect to services running on the host. This maintains network isolation between the container and the host.

Using a DNS name: Configuring a DNS server to resolve a hostname to the host machine's IP address enables using the hostname from within the container to connect to host services. This is useful when IP addresses may dynamically change.

Using port mapping: Docker's port mapping feature allows specific services on the host machine to be exposed to the container. By mapping host ports to container ports, communication between them is established.

Using extra_hosts in Docker Compose: The extra_hosts parameter in Docker Compose adds hostnames and their corresponding IP addresses to the container's /etc/hosts file, enabling access to the host machine's localhost.

Each approach has its considerations regarding network isolation and security. It's important to evaluate the requirements and choose the most suitable method based on the specific use case, network configuration, and security policies.

By understanding Docker's networking capabilities and selecting the appropriate approach, you can establish effective communication between Docker containers and the host machine's localhost, facilitating smooth application development and deployment.

PS. Link to the article ”How to Connect to Localhost from Docker Container” below.

#docker #localhost

Links:
https://huzaima.io/blog/connect-localhost-docker
Hosting (even on Android phone)

Today, let's embark on a journey to explore the fascinating world of hosting. As software engineers, we understand the importance of deploying our applications and making them accessible to users. Hosting plays a pivotal role in this process, allowing us to bring our creations to life on the vast landscape of the internet.

At its core, hosting refers to the practice of storing and serving files, data, or applications on a server, making them accessible to users through the internet. This fundamental aspect of software deployment involves several key considerations that can significantly impact the performance, reliability, and scalability of our applications.

***
Before you continue reading - subscribe to the Tech Read channel in Telegram.
Likes, shares and recommendations are welcome.
***

One crucial decision we face is choosing the right hosting provider. With an abundance of options available, ranging from traditional shared hosting to cloud-based solutions, it's important to evaluate our needs and select a provider that aligns with our requirements. Factors such as server reliability, security measures, scalability options, pricing, and customer support all come into play during this selection process.

Once we have chosen a hosting provider, we need to decide on the appropriate hosting type. Shared hosting, where multiple websites reside on a single server, can be a cost-effective option for small-scale projects with moderate traffic. On the other hand, virtual private servers (VPS) offer more control, resources, and flexibility for applications with higher demands. For those seeking unparalleled scalability and availability, cloud hosting services, such as Google Cloud Platform (GCP), Amazon Web Services (AWS) or Microsoft Azure, can provide a robust infrastructure to support our growing needs.

Furthermore, we must consider the underlying technologies and tools available to us for managing our hosted applications. Many hosting providers offer user-friendly control panels, such as cPanel or Plesk, which simplify tasks like managing domains, databases, and email accounts. Additionally, technologies like Docker and Kubernetes have revolutionized containerization and orchestration, allowing us to deploy and manage applications more efficiently across various hosting environments.

While hosting providers and technologies play significant roles, we mustn't overlook the importance of security. Implementing proper security measures is essential to safeguard our applications and users' data from potential threats. This includes practices like regular software updates, strong access controls, encryption, and robust firewalls. Additionally, backup and disaster recovery plans should be in place to ensure data resilience and minimize potential downtime.

In conclusion, hosting is a critical component of successful software deployment. Choosing the right hosting provider, selecting an appropriate hosting type, and implementing robust security measures are essential steps to ensure the smooth operation of our applications. By understanding the intricacies of hosting and staying abreast of the latest trends and technologies, we can optimize our deployments, deliver exceptional user experiences, and unlock the true potential of our software creations.

PS. Link to the article ”This blog is hosted on my Android phone” below.

#hosting #gcp #aws #azure #android

Links:
https://androidblog.a.pinggy.io
Understanding the Total Cost of Ownership in Software Development

As software engineers, it is crucial for us to consider not just the upfront development costs but also the long-term expenses associated with maintaining and operating software systems. This comprehensive perspective is encapsulated by the concept of Total Cost of Ownership (TCO). In this post, we will explore what TCO means, why it is essential, and how it influences decision-making in software development projects.

***
Before you continue reading - subscribe to the Tech Read channel in Telegram.
Likes, shares and recommendations are welcome.
***

Defining Total Cost of Ownership (TCO):
TCO represents the complete financial evaluation of a software system over its lifecycle. It goes beyond the initial development expenses to include ongoing costs such as maintenance, upgrades, support, and operational overhead. TCO encompasses both direct costs (e.g., hardware, software licenses, labor) and indirect costs (e.g., training, downtime, security breaches).

Why TCO matters:

1. Informed Decision-making: Understanding TCO enables stakeholders to make more informed decisions during project planning, implementation, and procurement. It helps assess the long-term financial impact and determine the most cost-effective approach.

2. Budget Management: TCO allows organizations to allocate budgets appropriately, considering both upfront and ongoing costs. It helps prevent unexpected expenses and ensures sufficient resources for system maintenance and enhancements.

3. ROI Evaluation: TCO analysis helps assess the return on investment (ROI) for software projects. By comparing the total costs with the expected benefits, organizations can evaluate the project's viability and make data-driven choices.

4. Vendor Selection: When selecting software vendors or products, TCO analysis plays a crucial role. It helps evaluate the financial impact of different options, accounting for factors like licensing, support, customization, and integration.

Several factors contribute to the overall TCO of a software system:

- Development Effort: The time and resources required to design, develop, and test the software.
- Infrastructure Costs: Hardware, servers, networking equipment, and cloud services required to deploy and operate the software.
- Licensing and Support: Costs associated with software licenses, subscriptions, and ongoing support from vendors.
- Maintenance and Updates: Expenses related to bug fixes, feature enhancements, security patches, and compatibility updates.
- Training and Documentation: The investment in training users, administrators, and developers, along with creating comprehensive documentation.
- Downtime and Outages: Costs incurred during system downtime, including lost productivity, revenue, and potential customer dissatisfaction.

Conclusion:
Total Cost of Ownership (TCO)
is a critical aspect of software development that goes beyond the initial development phase. By considering the long-term expenses associated with a software system, organizations can make better decisions, manage budgets effectively, and evaluate the return on investment. Understanding TCO empowers software engineers to design robust and cost-efficient solutions, resulting in successful and sustainable software projects.

PS. Link to the article ”How Kubernetes And Kafka Will Get You Fired” in the first comment.

#tco #kafka #kubernetes

Links:
https://medium.com/@jankammerath/how-kubernetes-and-kafka-will-get-you-fired-a6dccbd36c77
Database Sharding

***
Before you continue reading - subscribe to the Tech Read channel in Telegram.
Likes, shares and recommendations are welcome.
***

Database sharding is the “secret sauce” for scaling your applications. By dividing a database into smaller units called shards, we distribute the workload and storage across multiple servers.

Benefits:
1. Scalability: Handle more traffic by spreading the load across multiple servers.
2. Performance Boost: Achieve higher throughput and faster response times.
3. Fault Tolerance: Increase resilience with redundant shards.
4. Cost Optimization: Utilize cost-effective infrastructure with commodity hardware.

Challenges:
- Data Integrity: Ensure consistency across shards, especially during distributed transactions.
- Shard Management: Proper tools and automation are key for efficient administration.
- Data Rebalancing: Resource-intensive process when adding or removing shards.

Database sharding isn't one-size-fits-all, but with careful planning and testing, it's a powerful technique to unlock your application's potential. Scale up, stay efficient, and keep building!

PS. Link to the article ”A 5 years+ tech lead said they shard a database to scale but then he failed to answer this question” below.

#database #sharding

Links:
https://iorilan.medium.com/a-5-years-tech-lead-said-they-shard-a-database-to-scale-but-then-he-failed-to-answer-this-question-8be39115dcb0