Home

Latest on TechBootstrap

iterate through java map

How to iterate any Map in Java

There are three main ways that you can iterate through a java map Use entrySet() function public void iterateByEntrySet(Map map) { for (Map.Entry entry : map.entrySet()) { System.out.println(entry.getKey() + “:” + entry.getValue()); } } 2. Use ketSet() function public void iterateByKeySetAndForeach(Map map) { for (String key : map.keySet()) { System.out.println(key + “:” + map.get(key)); } } 3. Use Values() function

NestJs Framework

What is NestJs

NestJS is a server-side framework for building scalable, efficient, and maintainable Node.js applications. It is built on top of Express.js and provides a modular and intuitive structure for developing complex web applications. Some key features of NestJS include: Dependency Injection: NestJS provides a powerful dependency injection system, which makes it easy to manage dependencies and write testable code. Modular Architecture:

MS Azure is Down

Sharepoint API – Nodejs

SharePoint API is a set of RESTful web services in Microsoft SharePoint that provides programmatic access to content, metadata, and functionality stored in a SharePoint site. The API enables developers to interact with SharePoint sites and data in a variety of ways, such as reading, creating, and updating data, managing permissions and access to content, and performing searches. With the

copy directory from one server to anotehr in linux

How to Copy a Directory from One Server to Another in Ubuntu/Linux

You can use the below scp command to copy an entire directory or a specific file from one linux based server to another: scp -i {keyfile} -r {origin} {destination} Example:1 scp -i yourpem.pem -r username@ip_address_of_remote_server:/remote_directory_path destination_direction_path Example:2 scp -i yourpem.pem -r root@111.111.111.111:/home/abc /home/efg

java enum to array list

Java Enum to List

EnumType.values() Method public class YourEnumClass { public enum YourEnums{ CREATE, EVERY_UPDATE, FIRST_UPDATE, DELETE } } List yourEnumList=Arrays.asList(YourEnumClass.YourEnums.values()); EnumSet.allOf() Method public class YourEnumClass { public enum YourEnums{ CREATE, EVERY_UPDATE, FIRST_UPDATE, DELETE } } List yourEnumList=EnumSet.allOf(YourEnumClass.YourEnums.class);

list to sring with comma

How to convert a String List to Comma Seprated String

Stream Collectors.joining import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; //———————— public class YourClass { public static void main(String[] args) { List list = Arrays.asList(“a”, “b”, “c”); String result = list.stream().collect(Collectors.joining(“,”)); System.out.println(result); } } Output: a,b,c String.join import java.util.Arrays; import java.util.List; public class MyClass { public static void main(String[] args) { List list = Arrays.asList(“a”,”b”,”c”); String result = String.join(“,”, list); System.out.println(result); }

update nodejs version on linux

Update Node.js to Latest Version on Linux | Ubuntu

Update Node.js with NVM (Node Version Manager) There are many ways that can be used to update the node version on a linux system. Bu the best and the recomended would be using the Node Version Manager. 1. Update the package repository sudo apt update 2. Install NVM using either curl or wget command . (use eitehr one from below)

Access Javascript Nested objects or Attributes safely

Access Javascript Nested objects or Attributes safely

Access Javascript Nested objects or Attributes safely It is very likely to get run time exceptions on trying to read value of undefined or null objects in Javascript. There are two ways we can solve this common development issue. The optional chaining operator, also known as the safe navigation operator, is a feature of ECMAScript 2020 and Node v14 that

Open AI - ChatGPT

What is ChatGPT

ChatGPT is a language model, which was created and trained by OpenAI . ChatGPT uses a type of neural network called a transformer model. This type of model is designed to process sequential data, such as natural language text, and generate output that resembles human-generated text. It does this by learning to predict the next word in a sequence based

enable http on nodejs

Setting SSL HTTPS on Nodejs

There are many ways that we can use to setup SSL/TLS to our Nodejs app. In this post we will forcus on tow of the main methods. Setting SSL using Private key and Full Chain pem Certificate files Mostly if you are using Linux based OS on your server , you will be mostly familier with private key pem and

ascii table

ASCII Table

American Standard Code for Information Interchange is referred to as ASCII. An ASCII code is the numerical representation of a character, such as “a” or “@,” or an action of some kind because computers can only interpret numbers. Since ASCII was created so long ago, non-printing characters are now seldom ever utilized for what they were intended for. The first

How Does RSA Encryption Work

How Does RSA Encryption Work

A popular public-key cryptosystem for secure data transfer is RSA (Rivest-Shamir-Adleman). In addition, it is among the oldest. The surnames of Ron Rivest, Adi Shamir, and Leonard Adleman, who first publicly published the algorithm in 1977, are the origin of the abbreviation “RSA.” The English mathematician Clifford Cocks created a comparable method in secret at GCHQ (the British signals intelligence

How To Create a New User and Grant Permissions in MySQL

MySQL How To Create a New User and Grant Permissions

Creating a New User SSH to your Ubuntu system and login to MYSQL instance using root user mysql -u root -p Once you have gained access to the MYSQL, add your user using CREATE USER command CREATE USER ‘username’@’host’ IDENTIFIED WITH authentication_plugin BY ‘password’; Run the following command to create a user that authenticates with caching_sha2_password. Be sure to change

Spring Boot 3.0.0-RC1 available now

Whats New in Spring Boot 3.0.0-RC1

This release includes 135 enhancements, documentation improvements, dependency upgrades, and bug fixes. Now, without requiring any particular settings, you can convert your Spring Boot applications to native executables using the regular Spring Boot Maven or Gradle plugins. This release also provides a new section in the reference documentation that explains the concepts behind ahead-of-time processing and how you can get

list all users in mysq database

List All Users in MySQL Database

Login to the database as root user mysql -u root -p Once you have logged in as root user, run the following command to list the user, host and encrypted password SELECT User, Host, Password FROM mysql.user; output : MariaDB [(none)]> SELECT User, Host, Password FROM mysql.user; +———-+———–+——————————————-+ | User | Host | Password | +———-+———–+——————————————-+ | root | localhost

how to list forign key of a table

How to List all Forign Keys of a SQL Table

List Forign keys of a table SELECT TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_SCHEMA = ‘<database>’ AND REFERENCED_TABLE_NAME = ‘<table>’; List Forign keys of a table column SELECT TABLE_NAME,COLUMN_NAME,CONSTRAINT_NAME, REFERENCED_TABLE_NAME,REFERENCED_COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_SCHEMA = ‘<database>’ AND REFERENCED_TABLE_NAME = ‘<table>’ AND REFERENCED_COLUMN_NAME = ‘<column>’; Drop a Forign Key from a Table MySQL: ALTER TABLE Orders DROP FOREIGN KEY FK_PersonOrder; SQL Server

how to install pm2 on ubuntu

Install PM2 on Ubuntu

Using yarn:   yarn global add pm2 Using npm npm install pm2 -g Using debian apt update && apt install sudo curl && curl -sL https://raw.githubusercontent.com/Unitech/pm2/master/packager/setup.deb.sh | sudo -E bash –

nodejs

How to Completely Uninstall Nodejs, npm and node in Ubuntu

sudo apt-get remove nodejs sudo apt-get remove npm Then go to /etc/apt/sources.list.d and remove any node list if you have. Then do a sudo apt-get update Check for any .npm or .node folder in your home folder and delete those.

java bubble sort

Bubble Sort in Java

In bubble sort ,an  array is traversed from first element to last element. Then, current element is compared with the next element. If current element is greater than the next element, it is swapped. public class BubbleSortExample { static void bubbleSort(int[] arr) { int n = arr.length; int temp = 0; for(int i=0; i < n; i++){ for(int j=1; j

Scroll to top