Skip to main content

Posts

Uninstalling AnyDesk from Ubuntu: A Step-by-Step Guide

If you're an Ubuntu user looking to remove AnyDesk from your system and reclaim valuable space, this straightforward guide will walk you through the uninstallation process with easy-to-follow steps. Step 1: Launch the Terminal To initiate the uninstallation process, open the Terminal on your Ubuntu system by simultaneously pressing "Ctrl + Alt + T." Step 2: Verify AnyDesk Installation Confirm that AnyDesk is installed on your system by typing the following command in the Terminal and pressing "Enter": dpkg -l | grep anydesk The relevant information will be displayed if AnyDesk is installed. Step 3: Uninstall AnyDesk Remove AnyDesk from your Ubuntu system using the following command in the Terminal: sudo apt-get remove anydesk Enter your user password when prompted (characters won't be visible as you type) and press "Enter" to authorize the uninstallation. Step 4: Confirm Unins...

Distributed Caches and Data Consistency: Boosting Performance with Effective Caching Strategies

What are Distributed CACHES and how do they manage DATA CONSISTENCY? What is a Cache?  Caching is a common technique used to reduce latency and minimize the load on backend resources like databases or external services. Saves network calls Avoid repeated computations Reduce DB Load Cache Policy -> LRU -> Least Recently Used -> LRU operates on the principle that when the cache is full and a new item needs to be added, the item that hasn't been used for the longest time is the one selected for removal. Thrashing -> due to low-performing cache policy -> excessive evictions and replacements, leading to poor cache performance and inefficiency Caching Strategies ->  Write-through cache , whenever data is modified or written to the cache, the same write operation is immediately performed on the corresponding location in the main memory or backing store. This ensures that the main memory is always up-to-date with the data in the cache. Write-back cache , changes to...

HTTP and HTTPS Protocols Explained

HyperText Transfer Protocol (HTTP) is a fundamental application layer protocol used for accessing and transferring various types of data, including text, images, videos, and more, over the World Wide Web. It operates as a client-server protocol, relying on the TCP/IP family of protocols, and follows a request-response model. HTTP typically operates on port number 80, and its operation involves the following key steps: Request-Response : In HTTP, a client sends a request message to a server, specifying the desired data or resource. The server processes this request and responds accordingly. TCP Connection : After receiving the request, HTTP establishes a TCP connection between the client and the server to facilitate data transfer. Data Retrieval : The server collects and sends the requested data back to the client over the established connection. Connection Termination : Once the data exchange is complete, the connection between the client and the server is terminated. If further reques...

LeetCode Solutions | 334. Increasing Triplet Subsequence | LeetCode C++ Solution

  LeetCode Question:   334. Increasing Triplet Subsequence  ( Level :  Medium ) Note :- Scroll horizontally to see the full line of code. class Solution { public : bool increasingTriplet ( vector < int > & nums ) { int n = nums . size (); vector <int> minimum ( n ); vector <int> maximum ( n ); int minElem = INT_MAX , maxElem = INT_MIN ; for ( int i = 0 ; i < n ; i ++ ) { int frontSideElem = nums [ i ], backSideElem = nums [ n - i - 1 ]; if ( frontSideElem < minElem ) { minElem = frontSideElem ; } minimum [ i ] = minElem ; if ( backSideElem > maxElem ) { maxElem = backSideElem ; } maximum [ n - i - 1 ] = maxElem ; } for ( int i = 1 ; i < n - 1 ; i ++ ) { int p...

LeetCode Solutions | 1328. Break a Palindrome | LeetCode C++ Solution

   LeetCode Question:  1328. Break a Palindrome ( Level :  Medium ) Note :- Scroll horizontally to see the full line of code. class Solution { public : string breakPalindrome ( string palindrome ) { int n = palindrome . length (); if ( n == 1 ) { return "" ; } if ( n & 1 ) { int start = 0 , end = n - 1 ; while ( start != end ) { if ( palindrome [ start ] == ' a ' && palindrome [ end ] == ' a ' ) { start ++ ; end -- ; } else { break ; } } if ( start == end ) { palindrome [ n - 1 ] = ' b ' ; return palindrome ; } } for ( int i = 0 ; i < n ; i ++ ) ...

LeetCode Solutions | 653. Two Sum IV - Input is a BST | LeetCode C++ Solution

 LeetCode Question:  653. Two Sum IV - Input is a BST   ( Level :  Easy ) Problem Statement: Given the root of a Binary Search Tree and a target number k, return true if there exist two elements in the BST such that their sum is equal to the given target. Note :- Scroll horizontally to see the full line of code. /** *Definition for a binary tree node. *struct TreeNode { * int val; * TreeNode * left; * TreeNode * right; * TreeNode() : val(0), left(nullptr), right(nullptr) {} * TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} * TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {} *}; */ class Solution { vector <int> elements ; public : void preorder ( TreeNode * root ) { if ( root -> left ) { preorder ( root -> left ); } if ( root -> right ) { preorder ( root -> right ); } elemen...

LeetCode Solutions | 2166. Design Bitset | LeetCode C++ Solution

  LeetCode Question:  2166. Design Bitset   ( Level :  Medium ) Note :- Scroll horizontally to see the full line of code. class Bitset { int * bits ; int * flippedBits ; int size ; int countOne = 0 ; public : Bitset ( int size ) { this -> size = size ; bits = new int [ size ]; flippedBits = new int [ size ]; for ( int i = 0 ; i < size ; i ++ ) { bits [ i ] = 0 ; flippedBits [ i ] = 1 ; } } void fix ( int idx ) { if ( bits [ idx ]) { return ; } else { bits [ idx ] = 1 ; flippedBits [ idx ] = 0 ; countOne ++ ; } } void unfix ( int idx ) { if ( bits [ idx ]) { bits [ idx ] = 0 ; flippedBits [ idx ] = 1 ; countOne -- ; } else { ret...

LeetCode Solutions | 2279. Maximum Bags With Full Capacity of Rocks | LeetCode C++ Solution

 LeetCode Question:  2279. Maximum Bags With Full Capacity of Rocks ( Level :  Medium ) Note :- Scroll horizontally to see the full line of code. class Solution { public : int maximumBags ( vector < int > & capacity , vector < int > & rocks , int additionalRocks ) { vector <int> availability ; int n = capacity . size (); for ( int i = 0 ; i < n ; i ++ ) { int availableSpace = capacity [ i ] - rocks [ i ]; availability . push_back ( availableSpace ); } sort ( availability . begin (), availability . end ()); int ans = 0 ; for ( int i = 0 ; i < n ; i ++ ) { if ( availability [ i ] != 0 ) { if ( availability [ i ] <= additionalRocks ) { additionalRocks -= availability [ i ]; ans ++ ; } ...