System Design resourcesSystem design is a crucial skill for software engineers, especially in high-scale, production-level applications. Here are some of the best resources for learning system design, ranging from books to online courses and websitesWebsites & BlogsKey Topics to Focus On As you explore these resources, here are some essential topics to focus on when learning...
Table of ContentGetting this simple problem while importing Xgboost on Jupyter notebookIssue: Cannot import xgboost in Jupyter notebookError: Following error seen in Jupyter notebookSolutionInstall libompSummaryGetting this simple problem while importing Xgboost on Jupyter notebookSometimes when we try to import xgboost in Jupyter notebook it does not work and throws error....
Table of Contentnpm and npx npmnpm Commandsnpxnpx CommandsExample ScenarioIf you want to start a new React project, you could use:If you wanted to install create-react-app globally for repeated use, you would use:Summarynpm and npx Both npm and npx are tools that come with Node.js, but they serve different purposes.npmFull Form: Node Package Manager Purpose: npm is used for...
Table of ContentHow to find hamming weight in JavaUsing Simple divide and reminderhammingWeight.javaUsing Bit markinghammingWeightIIFull ExampleHow to find hamming weight in Javahamming weight for a number is the count of bits that are non zero. For instance for 1001 hamming weight is 2. For 100001111 hamming weight is 5. In this article we will see how to find hamming weight...
Table of ContentJava OptionalInt exampleOptionalIntExampleSummaryJava OptionalInt exampleOptionalInt allows us to create an object which may or may not contain a int value. If a value is present, isPresent() will return true and getAsInt() will return the value. Additional methods that depend on the presence or absence of a contained value are provided, such as orElse(). Other...
Table of ContentBucket Sort in JavaWhat is Bucket sortPseudocodeBucketSortExample.javaComplexitySummaryBucket Sort in JavaIn this article we will go though a simple implementation of Bucket sort in JavaWhat is Bucket sortBucket sort is a sorting algorithm that divides the inputs into several buckets. Once the buckets are populated with input data, then all these buckets are...
IntSummaryStatisticsIntSummaryStatistics provides different statistical data like max, min, average. This class is desinged to work with Java streams but can work with with out streams also.ExampleFollowing class shows an example of IntSummaryStatistics used with stream. It is used to print interesting information like max, min, average, sum and count. And then the accept method...
How to convert Java Stream to ListConvert Java Stream to ListFollowing code show how to convert the stream intStream to list using collect. // Converting Streams to Collection Stream<Integer> intStream = Stream.of(1, 2, 3, 4, 5); List<Integer> list = intStream.collect(Collectors.toList()); System.out.println(list); // prints [1, 2, 3, 4, 5] ...

Arduino Humadity

January 31, 2024
#include #include dht DHT; #define DHT11_PIN 7 void setup(){ Serial.begin(9600); } void loop(){ int chk = DHT.read11(DHT11_PIN); Serial.print("Temperature = "); Serial.println(DHT.temperature); Serial.print("Humidity = "); Serial.println(DHT.humidity); delay(1000); }...

Ardino Gas Sensors

January 31, 2024
  //#include #define MQ2pin (0) //https://robu.in/mq2-sensor-interfacing-with-arduino-gas-and-smoke-detection/ float sensorValue; //variable to store sensor value void setup() { Serial.begin(9600); // sets the serial port to 9600 Serial.println("Gas sensor warming up!"); Serial.println("I can detect 300 - 10000ppm"); delay(20000); // allow the MQ-2 to warm up } void...
Extract content of .war fileA WAR file (Web Application Resource or Web application Archive) is a file used to distribute a collection of files and folders associated with web application. Sometimes we want to look inside the war file to know what files or folders are inside the...
HashMap computeIfPresent() method in Java with ExamplesThe computeIfPresent(Key, BiFunction) method of HashMap class is used to update value in a key-value pair in the map. If key does not exist then it does not do any thing. SyntaxundefinedV computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) ExampleFollowing is an example...
HashMap computeIfAbsent() method in Java with ExamplesThe computeIfAbsent(Key, Function) method of HashMap class is used to enter a new key-value pair to map if the key does not exist. If key exists then it does not do any thing. Syntaxundefinedpublic V computeIfAbsent(K key, Function<? super K, ? extends V> remappingFunction)ExampleFollowing is an example of computeIfAbsent...
Remove all entries in map by valueJava Map is a data structure that holds key->value pairs. In this article we will see how to delete all entries in the map by map values. Using removeAllremoveAll() takes one argument a collection. And entries matching the passed collection will be removed from the original mapUsing removeAllMap<Integer, String> map = new HashMap<Integer,...
Remove all entries from java mapJava Map is a data structure that holds key->value pairs. In this article we will see how to delete all entries in the map in java easily and efficetively.Method clear()clear() method is method that does not return any thing (void return type) and is part of the Map interface. Each implementation subclasses provides an implementation. clear...