Computer Science and Programming
156K subscribers
448 photos
32 videos
37 files
742 links
Channel specialized for advanced topics of:
* Artificial intelligence,
* Machine Learning,
* Deep Learning,
* Computer Vision,
* Data Science
* Python

Admin: @otchebuch

Memes: @memes_programming

Ads: @Source_Ads,
https://telega.io/c/computer_science
Download Telegram
This media is not supported in your browser
VIEW IN TELEGRAM
18 Most common used Java List methods

1. add(E element) - Adds the specified element to the end of the list.
2. addAll(Collection<? extends E> c) - Adds all elements of the specified collection to the end of the list.
3. remove(Object o) - Removes the first occurrence of the specified element from the list.
4. remove(int index) - Removes the element at the specified position in the list.
5. get(int index) - Returns the element at the specified position in the list.
6. set(int index, E element) - Replaces the element at the specified position in the list with the specified element.
7. indexOf(Object o) - Returns the index of the first occurrence of the specified element in the list.
8. contains(Object o) - Returns true if the list contains the specified element.
9. size() - Returns the number of elements in the list.
10. isEmpty() - Returns true if the list contains no elements.
11. clear() - Removes all elements from the list.
12. toArray() - Returns an array containing all the elements in the list.
13. subList(int fromIndex, int toIndex) - Returns a view of the portion of the list between the specified fromIndex, inclusive, and toIndex, exclusive.
14. addAll(int index, Collection<? extends E> c) - Inserts all elements of the specified collection into the list, starting at the specified position.
15. iterator() - Returns an iterator over the elements in the list.
16. sort(Comparator<? super E> c) - Sorts the elements of the list according to the specified comparator.
17. replaceAll(UnaryOperator<E> operator) - Replaces each element of the list with the result of applying the given operator.
18. forEach(Consumer<? super E> action) - Performs the given action for each element of the list until all elements have been processed or the action throws an exception.
๐Ÿ‘126โค3
This media is not supported in your browser
VIEW IN TELEGRAM
DevOps is a set of practices that combines software development and IT operations. It aims to shorten the software development life cycle and provide continuous delivery with high software quality. ๐Ÿš€

DevOps has several phases

Plan: This phase involves defining the goals, scope, and requirements of the software project. It also includes identifying the stakeholders, risks, and resources needed. ๐Ÿ“

Build: This phase involves writing, compiling, and packaging the code into executable units. It also includes using version control, code review, and configuration management tools. ๐Ÿ”ง

Test: This phase involves verifying that the software meets the quality standards and functional specifications. It also includes using automated testing, performance testing, and security testing tools. ๐Ÿงช

Deploy: This phase involves releasing the software to the production environment or to the end-users. It also includes using deployment automation, orchestration, and monitoring tools. ๐Ÿšš

Operate: This phase involves running and maintaining the software in the production environment. It also includes using incident management, problem management, and change management tools. ๐Ÿ› 

Observe: This phase involves collecting and analyzing data from the software and the production environment. It also includes using logging, tracing, and metrics tools. ๐Ÿ”Ž

Continuous Feedback and Discovery: This phase involves gathering feedback from the stakeholders, users, and customers. It also includes using feedback loops, surveys, and analytics tools. It also involves discovering new opportunities, challenges, and trends. ๐Ÿ“Š

DevOps is a culture that promotes collaboration, communication, and continuous improvement. It helps to deliver software faster, better, and safer. ๐Ÿ˜Š
๐Ÿ‘75
This media is not supported in your browser
VIEW IN TELEGRAM
Computer Memory Explained

Computer memory is like a workspace for your computer. It stores data and instructions that the computer needs to access quickly.

Internal Memory:

1. ROM (Read-Only Memory):
- PROM (Programmable ROM): Programmable once by the user post-manufacturing. ๐Ÿ–Š
- EPROM (Erasable Programmable ROM): Can be erased with ultraviolet light and reprogrammed. โ˜€๏ธ๐Ÿ”
- EEPROM (Electrically Erasable Programmable ROM): Can be erased and reprogrammed electrically, multiple times. โšก๏ธ

2. RAM (Random Access Memory):
- SRAM (Static RAM): Retains data as long as power is supplied, no need to refresh, faster than DRAM. โšก๏ธ๐Ÿ’จ
- DRAM (Dynamic RAM): Stores data in capacitors that must be refreshed periodically, widely used. ๐Ÿ”„
- SDRAM (Synchronous DRAM): Syncs with CPU clock speed for improved performance. โฑ
- RDRAM (Rambus DRAM): High bandwidth memory with Rambus technology. ๐Ÿš€
- DDR SDRAM (Double Data Rate SDRAM): Transfers data on both rising and falling clock edges.
- DDR1: First generation, higher speed and bandwidth than SDRAM. ๐Ÿ†•
- DDR2: Improved version of DDR1 with lower power consumption and higher speeds. ๐Ÿ”‹๐Ÿ’จ
- DDR3: Higher speeds and reduced power consumption over DDR2. ๐Ÿ”‹โž•๐Ÿ’จ
- DDR4: Higher module density and increased performance with reduced voltage. ๐Ÿ”‹๐Ÿ†™๐ŸŽ›

External Memory:

1. HDD (Hard Disk Drive): Uses spinning disks to read/write data, traditional storage device. ๐Ÿ”„๐Ÿ’พ
2. SSD (Solid State Drive): Non-volatile flash memory for faster speed than HDDs. ๐Ÿš€๐Ÿ’พ
3. CD (Compact Disc): Optical disc for storing digital data, used for music and software
๐Ÿ‘168โค2
How Git Works - From Working Directory to Remote Repository

[1]. Working Directory:
Your project starts here. The working directory is where you actively make changes to your files.
[2]. Staging Area (Index):
After modifying files, use git add to stage changes. This prepares them for the next commit, acting as a checkpoint.
[3]. Local Repository:
Upon staging, execute git commit to record changes in the local repository. Commits create snapshots of your project at specific points.
[4]. Stash (Optional):
If needed, use git stash to temporarily save changes without committing. Useful when switching branches or performing other tasks.
[5]. Remote Repository:
The remote repository, hosted on platforms like GitHub, is a version of your project accessible to others. Use git push to send local commits and git pull to fetch remote changes.
[6]. Remote Branch Tracking:
Local branches can be set to track corresponding branches on the remote. This eases synchronization with git pull or git push.
๐Ÿ‘81โค1๐Ÿ‘Ž1
This media is not supported in your browser
VIEW IN TELEGRAM
DevOps Explained!

Plan:
- Defines project goals, scope, and requirements, identifying stakeholders and resources. ๐Ÿ“
Build:
- Involves coding, compiling, and packaging, emphasizing version control and code management. ๐Ÿ”ง
Test:
- Ensures software aligns with quality and functional standards, utilizing automated and security testing. ๐Ÿงช
Deploy:
- Releases software precisely using deployment automation and monitoring tools. ๐Ÿšš
Operate:
- Ensures operational stability, promptly addressing issues with management tools. ๐Ÿ› 
Observe:
- Analyzes data from software and production using logging, tracing, and metrics tools. ๐Ÿ”Ž
Continuous Feedback:
- Gathers ongoing feedback, utilizing loops, surveys, and analytics for improvement. ๐Ÿ“Š
DevOps:
- Cultivates a culture of collaboration, communication, and continuous improvement for faster, better, and safer software delivery.
๐Ÿ‘82โค2
This media is not supported in your browser
VIEW IN TELEGRAM
UNTANGLE Spring Security Architecture ๐Ÿ”’

Authentication and Authorization:
- Validates user identity and orchestrates controlled resource access.
- Empowers comprehensive user authentication and nuanced authorization.

Security Filters:
- Intercepts incoming requests, meticulously enforcing security measures.
- Offers a flexible, layered security filter chain for diverse protection strategies.

Custom Authentication Providers:
- N Authentication Provider: Extends authentication capabilities beyond default configurations. Facilitates tailored authentication strategies and seamless integration.
- DaoAuthentication Provider: Adopts a database-backed approach for user authentication. Scrutinizes user credentials against stored records, heightening security.

Authentication Manager:
- Orchestrates the authentication process, coordinating various authentication providers.
- Serves as a pivotal component in managing user identity verification.

Token-based Security (JWT):
- Implements advanced token-based authentication for stateless communication.
- Facilitates secure interaction without the need for server-side storage.

Session Management:
- Efficiently manages user sessions, mitigating session-related risks.
- Provides adaptability for session creation, tracking, and invalidation.

Authentication Tokens:
- Username Password Authentication Token:Represents user credentials for authentication purposes.
- Leverages usernames and passwords for robust user verification.

Add/Remove Authentication Token:
- Dynamically enables the addition and removal of authentication tokens.
- Ensures real-time control over user authentication, promoting flexibility.
๐Ÿ‘50โค1
๐—Ÿ๐—ฒ๐—ฎ๐—ฟ๐—ป ๐—ณ๐˜‚๐—ป๐—ฑ๐—ฎ๐—บ๐—ฒ๐—ป๐˜๐—ฎ๐—น๐˜€, ๐—ป๐—ผ๐˜ ๐—ณ๐—ฟ๐—ฎ๐—บ๐—ฒ๐˜„๐—ผ๐—ฟ๐—ธ๐˜€

Have you ever wondered why some technologies are still with us, and some disappeared? Here is ๐˜๐—ต๐—ฒ ๐—Ÿ๐—ถ๐—ป๐—ฑ๐˜† ๐—˜๐—ณ๐—ณ๐—ฒ๐—ฐ๐˜ to explain it. This effect tells me that ๐—ฏ๐˜† ๐˜๐—ต๐—ฒ ๐˜๐—ถ๐—บ๐—ฒ ๐—œ ๐—ฟ๐—ฒ๐˜๐—ถ๐—ฟ๐—ฒ, ๐—ฑ๐—ฒ๐˜ƒ๐—ฒ๐—น๐—ผ๐—ฝ๐—ฒ๐—ฟ๐˜€ ๐˜„๐—ถ๐—น๐—น ๐˜€๐˜๐—ถ๐—น๐—น ๐—ฏ๐—ฒ ๐˜‚๐˜€๐—ถ๐—ป๐—ด ๐—–# ๐—ฎ๐—ป๐—ฑ ๐—ฆ๐—ค๐—Ÿ. It is a concept in technology and innovation that suggests that the future life expectancy of a non-perishable item is proportional to its current age. In other words, the longer an item has been in use, the longer it is likely to continue to be used.

The concept was named after Lindy's Deli in New York City, where Nassim Nicholas Taleb popularized it in his book "๐—ง๐—ต๐—ฒ ๐—•๐—น๐—ฎ๐—ฐ๐—ธ ๐—ฆ๐˜„๐—ฎ๐—ป." According to Taleb, the Lindy effect applies to many things, including technologies, ideas, and cultures, and evaluates their potential longevity.

In software development, we see that ๐—ณ๐—ฟ๐—ฎ๐—บ๐—ฒ๐˜„๐—ผ๐—ฟ๐—ธ๐˜€ ๐—ฐ๐—ผ๐—บ๐—ฒ ๐—ฎ๐—ป๐—ฑ ๐—ด๐—ผ, ๐—ฏ๐˜‚๐˜ ๐—น๐—ฎ๐—ป๐—ด๐˜‚๐—ฎ๐—ด๐—ฒ๐˜€ ๐˜€๐˜‚๐—ฐ๐—ต ๐—ฎ๐˜€ ๐—ฆ๐—ค๐—Ÿ ๐—ผ๐—ฟ ๐—–# ๐—ฎ๐—ป๐—ฑ ๐—ฐ๐—ผ๐—ป๐—ฐ๐—ฒ๐—ฝ๐˜๐˜€ ๐˜€๐˜‚๐—ฐ๐—ต ๐—ฎ๐˜€ ๐—ข๐—ฏ๐—ท๐—ฒ๐—ฐ๐˜-๐—ผ๐—ฟ๐—ถ๐—ฒ๐—ป๐˜๐—ฒ๐—ฑ ๐—ฝ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ด ๐—ผ๐—ฟ ๐—ฆ๐—ข๐—Ÿ๐—œ๐—— ๐—ฝ๐—ฟ๐—ถ๐—ป๐—ฐ๐—ถ๐—ฝ๐—น๐—ฒ๐˜€ ๐˜€๐˜๐—ฎ๐˜†. All the energy I put into learning those technologies 10-15 years ago continues to support my work today. Some things changed, but the fundamentals stayed and even got better.

So, try to ๐—น๐—ฒ๐—ฎ๐—ฟ๐—ป ๐˜๐—ต๐—ถ๐—ป๐—ด๐˜€ ๐˜๐—ต๐—ฎ๐˜ ๐—ฑ๐—ผ๐—ป'๐˜ ๐—ฐ๐—ต๐—ฎ๐—ป๐—ด๐—ฒ (quote from Jeff Bezos). Focus on foundations, not frameworks. I've been doing this for two decades now.
๐Ÿ‘170๐Ÿ‘Ž1
๐——๐—ผ ๐˜†๐—ผ๐˜‚ ๐˜€๐˜‚๐—ณ๐—ณ๐—ฒ๐—ฟ ๐—ณ๐—ฟ๐—ผ๐—บ ๐—œ๐—บ๐—ฝ๐—ผ๐˜€๐˜๐—ฒ๐—ฟ ๐—ฆ๐˜†๐—ป๐—ฑ๐—ฟ๐—ผ๐—บ๐—ฒ?

Always believing that you must know everything before doing?

Adjust your viewpoint.

Be a smart learner!
๐Ÿ‘167๐Ÿ‘Ž3
๐—š๐—ถ๐˜ ๐— ๐—ฒ๐—ฟ๐—ด๐—ฒ ๐˜ƒ๐˜€ ๐—ฅ๐—ฒ๐—ฏ๐—ฎ๐˜€๐—ฒ

One of the most powerful Git features is branching. Yet, while working with it, we must integrate changes from one branch into another. The way how to do this can be different.

We have two ways to do it:

๐Ÿญ. ๐— ๐—ฒ๐—ฟ๐—ด๐—ฒ

When you merge Branch A into Branch B (with ๐š๐š’๐š ๐š–๐šŽ๐š›๐š๐šŽ), Git creates a new merge commit. This commit has two parents, one from each branch, symbolizing the confluence of histories. It's a non-destructive operation, preserving the exact history of your project, warts, and all. Merges are particularly useful in collaborative environments where maintaining the integrity and chronological order of changes is essential. Yet, merge commits can clutter the history, making it harder to follow specific lines of development.

๐Ÿฎ. ๐—ฅ๐—ฒ๐—ฏ๐—ฎ๐˜€๐—ฒ

When you rebase Branch A onto Branch B (with ๐š๐š’๐š ๐š›๐šŽ๐š‹๐šŠ๐šœ๐šŽ), you're essentially saying, "Let's pretend these changes from Branch A were made on top of the latest changes in Branch B." Rebase rewrites the project history by creating new commits for each commit in the original branch. This results in a much cleaner, straight-line history. Yet, it could be problematic if multiple people work on the same branch, as rebasing rewrites history, which can be challenging if others have pulled or pushed the original branch.

So, when to use them:

๐Ÿ”น ๐—จ๐˜€๐—ฒ ๐—บ๐—ฒ๐—ฟ๐—ด๐—ถ๐—ป๐—ด ๐˜๐—ผ ๐—ฝ๐—ฟ๐—ฒ๐˜€๐—ฒ๐—ฟ๐˜ƒ๐—ฒ ๐˜๐—ต๐—ฒ ๐—ฐ๐—ผ๐—บ๐—ฝ๐—น๐—ฒ๐˜๐—ฒ ๐—ต๐—ถ๐˜€๐˜๐—ผ๐—ฟ๐˜†, especially on shared branches or for collaborative work. It's ideal for feature branches to merge into a main or develop branch.

๐Ÿ”น ๐—จ๐˜€๐—ฒ ๐—ฟ๐—ฒ๐—ฏ๐—ฎ๐˜€๐—ถ๐—ป๐—ด ๐—ณ๐—ผ๐—ฟ ๐—ฝ๐—ฒ๐—ฟ๐˜€๐—ผ๐—ป๐—ฎ๐—น ๐—ฏ๐—ฟ๐—ฎ๐—ป๐—ฐ๐—ต๐—ฒ๐˜€ or when you want a clean, linear history for easier tracking of changes. Remember to rebase locally and avoid pushing rebased branches to shared repositories. Also, be aware ๐—ป๐—ผ๐˜ ๐˜๐—ผ ๐—ฟ๐—ฒ๐—ฏ๐—ฎ๐˜€๐—ฒ ๐—ฝ๐˜‚๐—ฏ๐—น๐—ถ๐—ฐ ๐—ต๐—ถ๐˜€๐˜๐—ผ๐—ฟ๐˜†. If your branch is shared with others, rebasing can rewrite history in a way that is disruptive and confusing to your collaborators.
๐Ÿ‘103
๐—ง๐—ต๐—ฒ ๐—•๐—ฒ๐˜€๐˜ ๐—ฆ๐—ผ๐—ณ๐˜๐˜„๐—ฎ๐—ฟ๐—ฒ ๐—”๐—ฟ๐—ฐ๐—ต๐—ถ๐˜๐—ฒ๐—ฐ๐˜๐˜‚๐—ฟ๐—ฒ ๐—•๐—ผ๐—ผ๐—ธ๐˜€ ๐—œ๐—ป ๐—˜๐˜ƒ๐—ฒ๐—ฟ๐˜† ๐—–๐—ฎ๐˜๐—ฒ๐—ด๐—ผ๐—ฟ๐˜†

Check out this list of all books tagged with software architecture. They are ranked based on Goodreads score with applied simple algorithmic rules (relevant to software architecture, content is not obsolete, it must be tech agnostic, and average rating > 3.5). Rating is based on the number of written reviews, including the average rating, the number of ratings, and the publishing date.

๐Ÿ’ป https://github.com/mhadidg/software-architecture-books
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ‘74๐Ÿ‘Ž7
This media is not supported in your browser
VIEW IN TELEGRAM
๐—›๐—ผ๐˜„ ๐˜๐—ผ ๐˜‚๐˜€๐—ฒ ๐˜‚๐—ป๐—ฑ๐—ผ๐—ฐ๐˜‚๐—บ๐—ฒ๐—ป๐˜๐—ฒ๐—ฑ ๐—ช๐—ฒ๐—ฏ ๐—”๐—ฃ๐—œ๐˜€?

There are several methods to tackle this issue, primarily involving intercepting traffic originating from a web API. If the goal is to intercept HTTP/HTTPS traffic from various sources, one approach involves manually constructing a custom sniffer. However, this method can be burdensome as it requires tailoring the solution for each API individually.

Now, Postman offers a solution to sniff traffic from any API with the HTTP/HTTP protocol. What is good about this feature is that traffic capture enables you to generate a Postman collection, which you can then use to test, evaluate, and document captured APIs.

Check more at the following link:

๐Ÿ”—https://blog.postman.com/introducing-postman-new-improved-system-proxy/.
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ‘38
๐——๐—ถ๐—ฑ ๐—œ ๐—ด๐—ถ๐˜ƒ๐—ฒ ๐—บ๐˜† ๐—ฏ๐—ฒ๐˜€๐˜ ๐—น๐—ฎ๐˜€๐˜ ๐˜„๐—ฒ๐—ฒ๐—ธ?

There are no two same days nor two same weeks

The "best" can mean different on "different" days

This is why we need to have weekly and monthly goals

And the results are that matters, not the effort

I wish you a great week ahead ๐Ÿ‘‹
๐Ÿ‘87
๐—›๐—ผ๐˜„ ๐˜๐—ผ ๐—ฑ๐—ผ ๐—ฐ๐—ผ๐—ฑ๐—ฒ ๐—ฟ๐—ฒ๐˜ƒ๐—ถ๐—ฒ๐˜„๐˜€ ๐—ฝ๐—ฟ๐—ผ๐—ฝ๐—ฒ๐—ฟ๐—น๐˜†

An essential step in the software development lifecycle is code review. It enables developers to enhance code quality significantly. It resembles the authoring of a book. The author writes the story, which is then edited to ensure no mistakes like mixing up "you're" with "yours." Code review in this context refers to examining and assessing other people's code.

There are different ๐—ฏ๐—ฒ๐—ป๐—ฒ๐—ณ๐—ถ๐˜๐˜€ ๐—ผ๐—ณ ๐—ฎ ๐—ฐ๐—ผ๐—ฑ๐—ฒ ๐—ฟ๐—ฒ๐˜ƒ๐—ถ๐—ฒ๐˜„: it ensures consistency in design and implementation, optimizes code for better performance, is an opportunity to learn, and knowledge sharing and mentoring, as well as promotes team cohesion.

What should you look for in a code review? Try to look for things such as:

๐Ÿ”น ๐——๐—ฒ๐˜€๐—ถ๐—ด๐—ป (does this integrate well with the rest of the system, and are interactions of different components make sense)
๐Ÿ”น F๐˜‚๐—ป๐—ฐ๐˜๐—ถ๐—ผ๐—ป๐—ฎ๐—น๐—ถ๐˜๐˜† (does this change is what the developer intended)
๐Ÿ”น C๐—ผ๐—บ๐—ฝ๐—น๐—ฒ๐˜…๐—ถ๐˜๐˜† (is this code more complex than it should be)
๐Ÿ”น ๐—ก๐—ฎ๐—บ๐—ถ๐—ป๐—ด (is naming good?)
๐Ÿ”น ๐—˜๐—ป๐—ด. ๐—ฝ๐—ฟ๐—ถ๐—ป๐—ฐ๐—ถ๐—ฝ๐—น๐—ฒ๐˜€ (solid, kiss, dry)
๐Ÿ”น ๐—ง๐—ฒ๐˜€๐˜๐˜€ (are different kinds of tests used appropriately, code coverage),
๐Ÿ”น ๐—ฆ๐˜๐˜†๐—น๐—ฒ (does it follow style guidelines),
๐Ÿ”น ๐——๐—ผ๐—ฐ๐˜‚๐—บ๐—ฒ๐—ป๐˜๐—ฎ๐˜๐—ถ๐—ผ๐—ป, etc.
๐Ÿ‘72โค2
Encryption and Decryption using Linear Algebra with C++

This project implements a text encryption and decryption system using a matrix-based encryption technique. This project serves as an educational and practical exploration of matrix-based encryption techniques, demonstrating the fundamental concepts of encryption and decryption in a user-friendly manner.

๐Ÿ’ปhttps://github.com/farukalpay/TextEncryptionWithLinearAlgebra
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ‘47
๐—›๐—ผ๐˜„ ๐—ง๐—ผ ๐—˜๐—ป๐—ฎ๐—ฏ๐—น๐—ฒ ๐—–๐—ผ๐—ป๐˜๐—ถ๐—ป๐˜‚๐—ผ๐˜‚๐˜€ ๐—œ๐—ป๐˜๐—ฒ๐—ด๐—ฟ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐˜„๐—ถ๐˜๐—ต ๐—ฃ๐˜‚๐—น๐—น ๐—ฅ๐—ฒ๐—พ๐˜‚๐—ฒ๐˜€๐˜๐˜€?

With Pull Requests, we lost the ability to have a proper Continuous Integration (CI) process in a way that delayed integration due to code reviews. So here comes a โ€œShip/Show/Askโ€ branching strategy. The thing is that not all pull requests need code reviews.

So, whenever we make a change, we have three options:

๐Ÿ”น ๐—ฆ๐—ต๐—ถ๐—ฝ - Small changes that donโ€™t need peopleโ€™s review can be pushed directly to the main branch. We have some build pipelines running on the main brunch, which run tests and other checks, so it is a safety net for our changes. Some examples are: fixing a typo, increasing the minor dependency version, updated documentation.

๐Ÿ”น ๐—ฆ๐—ต๐—ผ๐˜„ - Here, we want to show what has been done. When you have a branch, you open a Pull Request and merge it without a review. Yet, you still want people to be notified of the change (to review it later), but donโ€™t expect essential discussions. Some examples are: a local refactoring, fixing a bug, added a test case.

๐Ÿ”น ๐—”๐˜€๐—ธ - Here, we make our changes and open a Pull Request while waiting for feedback. We do this because we want a proper review in case we need clarification on our approach. This is a classical way of making Pull Requests. Some examples are: Adding a new feature, major refactoring, and proof of concept.
๐Ÿ‘63๐Ÿ‘Ž1
๐—ฆ๐˜๐—ฎ๐—ฐ๐—ธ ๐—ข๐˜ƒ๐—ฒ๐—ฟ๐—ณ๐—น๐—ผ๐˜„ ๐—”๐—ฟ๐—ฐ๐—ต๐—ถ๐˜๐—ฒ๐—ฐ๐˜๐˜‚๐—ฟ๐—ฒ ๐—œ๐˜€ ๐—ก๐—ผ๐˜ ๐—ช๐—ต๐—ฎ๐˜ ๐—ฌ๐—ผ๐˜‚ ๐— ๐—ฒ๐—ฎ๐—ป ๐—œ๐˜ ๐—œ๐˜€

In the recent interview with Scott Hanselman, ๐—ฅ๐—ผ๐—ฏ๐—ฒ๐—ฟ๐˜๐—ฎ ๐—”๐—ฟ๐—ฐ๐—ผ๐˜ƒ๐—ฒ๐—ฟ๐—ฑ๐—ฒ, ๐—›๐—ฒ๐—ฎ๐—ฑ ๐—ข๐—ณ ๐—˜๐—ป๐—ด๐—ถ๐—ป๐—ฒ๐—ฒ๐—ฟ๐—ถ๐—ป๐—ด ๐—ฎ๐˜ ๐—ฆ๐˜๐—ฎ๐—ฐ๐—ธ ๐—ข๐˜ƒ๐—ฒ๐—ฟ๐—ณ๐—น๐—ผ๐˜„, revealed the story about the architecture of Stack Overflow. They handle more than 6000 requests per second, 2 billion page views per month, and they manage to render a page in about 12 milliseconds. If we think about it a bit, we could imagine they use some kind of ๐—บ๐—ถ๐—ฐ๐—ฟ๐—ผ๐˜€๐—ฒ๐—ฟ๐˜ƒ๐—ถ๐—ฐ๐—ฒ ๐˜€๐—ผ๐—น๐˜‚๐˜๐—ถ๐—ผ๐—ป ๐˜๐—ต๐—ฎ๐˜ ๐—ฟ๐˜‚๐—ป๐˜€ ๐—ถ๐—ป ๐˜๐—ต๐—ฒ ๐—–๐—น๐—ผ๐˜‚๐—ฑ ๐˜„๐—ถ๐˜๐—ต ๐—ž๐˜‚๐—ฏ๐—ฒ๐—ฟ๐—ป๐—ฒ๐˜๐—ฒ๐˜€.

But the story is a bit different. Their solution is 15 years old, and it is a ๐—ฏ๐—ถ๐—ด ๐—บ๐—ผ๐—ป๐—ผ๐—น๐—ถ๐˜๐—ต๐—ถ๐—ฐ ๐—ฎ๐—ฝ๐—ฝ๐—น๐—ถ๐—ฐ๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐—ฟ๐˜‚๐—ป๐—ป๐—ถ๐—ป๐—ด ๐—ผ๐—ป-๐—ฝ๐—ฟ๐—ฒ๐—บ๐—ถ๐˜€๐—ฒ๐˜€. It is actually ๐—ฎ ๐˜€๐—ถ๐—ป๐—ด๐—น๐—ฒ ๐—ฎ๐—ฝ๐—ฝ on IIS, which runs 200 sites. This single app is running on nine web servers and a single SQL Server (with the addition of one hot standby).

They also use ๐˜๐˜„๐—ผ ๐—น๐—ฒ๐˜ƒ๐—ฒ๐—น๐˜€ ๐—ผ๐—ณ ๐—ฐ๐—ฎ๐—ฐ๐—ต๐—ฒ, one on SQL Server with large RAM (1.5TB), where they have 30% of DB access in RAM and also they use two Redis servers (master and replica). Besides this, they have 3 tag engine servers and 3 Elastic search servers, which are used for 34 million daily searches.

All this is handled by a ๐˜๐—ฒ๐—ฎ๐—บ ๐—ผ๐—ณ ๐Ÿฑ๐Ÿฌ ๐—ฒ๐—ป๐—ด๐—ถ๐—ป๐—ฒ๐—ฒ๐—ฟ๐˜€, who manage to ๐—ฑ๐—ฒ๐—ฝ๐—น๐—ผ๐˜† ๐˜๐—ผ ๐—ฝ๐—ฟ๐—ผ๐—ฑ๐˜‚๐—ฐ๐˜๐—ถ๐—ผ๐—ป ๐—ถ๐—ป ๐Ÿฐ ๐—บ๐—ถ๐—ป๐˜€ several times daily.

Their ๐—ณ๐˜‚๐—น๐—น ๐˜๐—ฒ๐—ฐ๐—ต ๐˜€๐˜๐—ฎ๐—ฐ๐—ธ is:

๐Ÿ”น C# + ASP. NET MVC
๐Ÿ”น Dapper ORM
๐Ÿ”น StaeckExchange Redis
๐Ÿ”น MiniProfiler
๐Ÿ”น Jil JSON Deseliazier
๐Ÿ”น Exceptional logger for SQL
๐Ÿ”น Sigil, a .Net CIL generation helper (for when C# isnโ€™t fast enough)
๐Ÿ”น NetGain, a high-performance web socket server
๐Ÿ”น Opserver, monitoring dashboard polling most systems and feeding from Orion, Bosun, or WMI.
๐Ÿ”น Bosun, backend monitoring system, written in Go
๐Ÿ‘85
๐Ÿฎ๐Ÿฌ ๐—ฆ๐—ค๐—Ÿ ๐—พ๐˜‚๐—ฒ๐—ฟ๐˜† ๐—ผ๐—ฝ๐˜๐—ถ๐—บ๐—ถ๐˜‡๐—ฎ๐˜๐—ถ๐—ผ๐—ป ๐˜๐—ฒ๐—ฐ๐—ต๐—ป๐—ถ๐—พ๐˜‚๐—ฒ๐˜€

Below are the SQL query optimization techniques that I found to be significant, listed in the top 20:

1. Create an index on huge tables (>1.000.000) rows
2. Use EXIST() instead of COUNT() to find an element in the table
3. SELECT fields instead of using SELECT *
4. Avoid Subqueries in WHERE Clause
5. Avoid SELECT DISTINCT where possible
6. Use WHERE Clause instead of HAVING
7. Create joins with INNER JOIN (not WHERE)
8. Use LIMIT to sample query results
9. Use UNION ALL instead of UNION wherever possible
10. Use UNION where instead of WHERE ... or ... query.
11. Run your query during off-peak hours
12. Avoid using OR in join queries
14. Choose GROUP BY over window functions
15. Use derived and temporary tables
16. Drop the index before loading bulk data
16. Use materialized views instead of views
17. Avoid != or <> (not equal) operator
18. Minimize the number of subqueries
19. Use INNER join as little as possible when you can get the same output using LEFT/RIGHT join.
20. Frequently try to use temporary sources to retrieve the same dataset.
๐Ÿ‘103
๐—›๐—ผ๐˜„ ๐—ฑ๐—ผ๐—ฒ๐˜€ ๐——๐—ถ๐˜€๐—ฐ๐—ผ๐—ฟ๐—ฑ ๐—ต๐—ฎ๐—ป๐—ฑ๐—น๐—ฒ ๐—ฎ ๐—บ๐—ถ๐—น๐—น๐—ถ๐—ผ๐—ป ๐—ผ๐—ป๐—น๐—ถ๐—ป๐—ฒ ๐˜‚๐˜€๐—ฒ๐—ฟ๐˜€ ๐—ถ๐—ป ๐—ฎ ๐˜€๐—ถ๐—ป๐—ด๐—น๐—ฒ ๐˜€๐—ฒ๐—ฟ๐˜ƒ๐—ฒ๐—ฟ?

As time passed, the overall size of Discord's user base, including its most prominent communities, has grown massively. This affected servers that started to slow down and hit their throughput limits. So, they needed to scale individual Discord servers from tens of thousands to millions of concurrent users.

Whenever someone sends a message on Discord or joins a channel, they need to update the date UI of everyone online on that server. They call that server a "๐—ด๐˜‚๐—ถ๐—น๐—ฑ," which runs in a ๐˜€๐—ถ๐—ป๐—ด๐—น๐—ฒ ๐—˜๐—น๐—ถ๐˜…๐—ถ๐—ฟ ๐—ฝ๐—ฟ๐—ผ๐—ฐ๐—ฒ๐˜€๐˜€, while there is another process (a "๐˜€๐—ฒ๐˜€๐˜€๐—ถ๐—ผ๐—ป") for each connected client. The guild process tracks sessions of users who are members of that guild and are responsible for actions to those sessions. When sessions get updates, forward them to the web socket socket to the client.

The main issue is that ๐—ฎ ๐˜€๐—ถ๐—ป๐—ด๐—น๐—ฒ ๐—บ๐—ฒ๐˜€๐˜€๐—ฎ๐—ด๐—ฒ ๐—ป๐—ฒ๐—ฒ๐—ฑ๐˜€ ๐˜๐—ผ ๐—ด๐—ผ ๐˜๐—ผ ๐˜๐—ต๐—ฒ ๐—ป๐˜‚๐—บ๐—ฏ๐—ฒ๐—ฟ ๐—ผ๐—ณ ๐—ฝ๐—ฒ๐—ผ๐—ฝ๐—น๐—ฒ ๐—ผ๐—ป๐—น๐—ถ๐—ป๐—ฒ on that server, which means if a server has 1000 people online and they all send a message once, that's 1 million notifications.
๐Ÿ‘51โค1๐Ÿ‘Ž1
So, how they solved it? ๐—ง๐—ต๐—ฒ๐˜† ๐—ณ๐—ถ๐—ฟ๐˜€๐˜ ๐˜๐—ฟ๐—ถ๐—ฒ๐—ฑ ๐˜๐—ผ ๐˜‚๐—ป๐—ฑ๐—ฒ๐—ฟ๐˜€๐˜๐—ฎ๐—ป๐—ฑ ๐—ต๐—ผ๐˜„ ๐˜๐—ต๐—ฒ ๐˜€๐˜†๐˜€๐˜๐—ฒ๐—บ ๐—ฝ๐—ฒ๐—ฟ๐—ณ๐—ผ๐—ฟ๐—บ๐˜€. They tracked what Elixir processes were doing, if they were stuck waiting on something, etc. They recorded the event types, how many of each kind of message they received, and their processing times. In addition, they tried to understand how much memory they use, the performances of garbage collectors, etc.

After the analysis, they ๐—ฐ๐—ฟ๐—ฒ๐—ฎ๐˜๐—ฒ๐—ฑ ๐˜๐—ต๐—ฒ ๐—ณ๐—ผ๐—น๐—น๐—ผ๐˜„๐—ถ๐—ป๐—ด ๐˜€๐˜๐—ฟ๐—ฎ๐˜๐—ฒ๐—ด๐˜†:

๐Ÿญ. ๐—ฃ๐—ฎ๐˜€๐˜€๐—ถ๐˜ƒ๐—ฒ ๐˜€๐—ฒ๐˜€๐˜€๐—ถ๐—ผ๐—ป๐˜€: Discord significantly reduced the amount of data processed and sent by differentiating between active and passive user connections, cutting the fanout work by 90% for large servers.

๐Ÿฎ. ๐—ฅ๐—ฒ๐—น๐—ฎ๐˜†๐˜€: Implementing a relay system (read - multithreading) allowed Discord to split the fanout process across multiple machines, enabling a single guild to utilize more resources and support more prominent communities. Relays maintain connections to the sessions instead of the guild and are responsible for doing fanout with permission checks.

๐Ÿฏ. ๐—ช๐—ผ๐—ฟ๐—ธ๐—ฒ๐—ฟ ๐—ฝ๐—ฟ๐—ผ๐—ฐ๐—ฒ๐˜€๐˜€๐—ฒ๐˜€ ๐—ฎ๐—ป๐—ฑ ๐—˜๐—ง๐—ฆ: To maintain server responsiveness, Discord employed worker processes and Erlang Term Storage (ETS) for operations requiring iteration over large sets of members, thus avoiding bottlenecks in the guild process. ETS is an in-memory database that supports the ability of multiple Elixir processes to access it safely. This enables the creation of a new worker process and passes the ETS table so this process can run expensive operations and offload the central guild server.

๐Ÿ”—https://discord.com/blog/maxjourney-pushing-discords-limits-with-a-million-plus-online-users-in-a-single-server
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ‘47โค1
๐—›๐—ผ๐˜„ ๐˜๐—ผ ๐—ฐ๐—ผ๐—ฑ๐—ฒ ๐˜„๐—ถ๐˜๐—ต ๐—š๐—ถ๐˜๐—›๐˜‚๐—ฏ ๐—–๐—ผ๐—ฝ๐—ถ๐—น๐—ผ๐˜?

A recent study by GitHub and Microsoft discovered that AI now authors 46% of new code. They also found that overall developer productivity surged by 55%, leading to more efficient coding processes. When we talk about AI-powered coding, we mainly talk about GitHub Copilot.

But ๐—ต๐—ผ๐˜„ ๐—š๐—ถ๐˜๐—›๐˜‚๐—ฏ ๐—–๐—ผ๐—ฝ๐—ถ๐—น๐—ผ๐˜ ๐˜„๐—ผ๐—ฟ๐—ธ๐˜€?

The process goes in the following steps:

๐Ÿญ. ๐—ฆ๐—ฒ๐—ฐ๐˜‚๐—ฟ๐—ฒ ๐—ฝ๐—ฟ๐—ผ๐—บ๐—ฝ๐˜ ๐˜๐—ฟ๐—ฎ๐—ป๐˜€๐—บ๐—ถ๐˜€๐˜€๐—ถ๐—ผ๐—ป: Your prompts are securely sent to Copilot, ensuring data privacy.

๐Ÿฎ. ๐—–๐—ผ๐—ป๐˜๐—ฒ๐˜…๐˜๐˜‚๐—ฎ๐—น ๐˜‚๐—ป๐—ฑ๐—ฒ๐—ฟ๐˜€๐˜๐—ฎ๐—ป๐—ฑ๐—ถ๐—ป๐—ด: Copilot analyzes the code around your cursor, the file type, and other open files to offer relevant suggestions.

๐Ÿฏ. ๐—–๐—ผ๐—ป๐˜๐—ฒ๐—ป๐˜ ๐—ณ๐—ถ๐—น๐˜๐—ฒ๐—ฟ๐—ถ๐—ป๐—ด: It filters out personal data and inappropriate content, focusing solely on generating helpful code.

๐Ÿฐ. ๐—–๐—ผ๐—ฑ๐—ฒ ๐—ด๐—ฒ๐—ป๐—ฒ๐—ฟ๐—ฎ๐˜๐—ถ๐—ผ๐—ป: Based on the intent identified in your prompts, Copilot crafts code suggestions that align with your coding style and project standards.

๐Ÿฑ. ๐—จ๐˜€๐—ฒ๐—ฟ ๐—ถ๐—ป๐˜๐—ฒ๐—ฟ๐—ฎ๐—ฐ๐˜๐—ถ๐—ผ๐—ป: Here, we can decide whether to use, tweak, or reject Copilot's suggestions.

๐Ÿฒ. ๐—™๐—ฒ๐—ฒ๐—ฑ๐—ฏ๐—ฎ๐—ฐ๐—ธ ๐—น๐—ผ๐—ผ๐—ฝ: Copilot learns from your interactions, improving its suggestions. Every time you tweak or reject its ideas, he knows from it. It employs techniques like zero-shot (asking without examples), one-shot (asking with an example), and few-shot learning (providing multiple examples) to adapt to our instructions, whether you provide examples or not.

๐Ÿณ. ๐—ฃ๐—ฟ๐—ผ๐—บ๐—ฝ๐˜ ๐—ต๐—ถ๐˜€๐˜๐—ผ๐—ฟ๐˜† ๐—ฟ๐—ฒ๐˜๐—ฒ๐—ป๐˜๐—ถ๐—ผ๐—ป: It remembers past prompts and interactions, making future suggestions more accurate.
๐Ÿ‘74๐Ÿ‘Ž10โค1