12 Apr 2026

AI tools use can be better than just for basic tasks -

  • Use AI for Decision-Making Support
  • Automate Complex Workflows
  • Idea / Creativity Generation
  • Designing systems & Writing the code
  • Building project faster
  • Learning new development skills
  • Code Review / PR Review
  • Generating test cases
  • Automating the repeatative task
  • Generate the boilate plate for new project etc

19 Feb 2023

A Javascript Program to find the count of unique string {a: 13, b: 12, c:13}

A Javascript Program to find the count of unique string -

Example:

var str = 'aaabbcccabcbcacbaabcbcabbccaaaabcbc';


Program: 

Part A:  Program to find the unique character in the given String -

var uniqLetter = [];

str.split('').map((item) =>{

    if(!uniqLetter.includes(item)){

        uniqLetter.push(item);

    }

});

Part B:  Now iterate on unique String & find the total count of the characetr in the given String & form the object -

var temp = {};

uniqLetter.map((i) => {

         temp = {...temp,

           ...{[i]: str.split(i).length}

           };

});

console.log(temp);

5 Feb 2023

Java SpringBoot Configuration Examples -

 Java SpringBoot Configuration Example -

File - application.properties

server.port=1010

+------------------------------------------------------------------------+

logging.level.org.springframework.web: DEBUG

logging.level.org.hibernate: ERROR

+------------------------------------------------------------------------+

spring.application.name=login-service

spring.datasource.url=jdbc:mysql://localhost:3306/microservices

spring.datasource.username=root

spring.datasource.password=root@12345

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

spring.jpa.database-platform = org.hibernate.dialect.MySQLDialect

spring.jpa.generate-ddl=true

spring.jpa.hibernate.ddl-auto = update

spring.jpa.properties.hibernate.globally_quoted_identifiers=true

+------------------------------------------------------------------------+

spring.security.user.name=admin

spring.security.user.password=admin

spring.security.user.roles=manager

Difference between Javascript Map & Filter Method -

Difference between Javascript Map & Filter Method  -

Program I: 

var arr = [4, 24, 65, 13, 98];

var newArray = arr.map((i) => i + 20);

console.log(newArray);

Output:

(5) [24, 44, 85, 33, 118]


Program II: 

var arr = [4, 24, 65, 13, 98];

var newFilter = arr.filter((i) => i + 20);

console.log(newFilter );

Output:

(5) [4, 24, 65, 13, 98]


Finally, Ouput indicates that the main difference in using the map & filter is that filter doesn't change the value of array element while map can have the updated values for the elements. 

Map & Filter both method return the new array.

Map methos keeps all the indexes in the new Array while Filter keep only the true case index in new array.

 

29 Jan 2023

Thunk vs Saga (React Redux middlewares)

Useful Links

https://blog.devgenius.io/react-redux-middlewares-thunk-vs-saga-e346a25319b3

5 Dec 2022

UI Lead Interview Questions - Protek Consulting

Q.1  Given an array of numbers as an input, write a function that returns a list of only fibonacci numbers.

Here are a few values in the fibonacci sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, …

The Fibonacci number at the N-th position is 

F(N) = F(N-1) + F(N-2)

F(0) = 0; F(1) = 1

Ex: Input => [1, 13, 4, 5, 34, 23, 99, 55] ,

Output => [1, 5, 13, 34, 55]


Solution:

 var inputArr = [1, 13, 4, 5, 34, 23, 99, 55];

  inputArr.sort((a, b) => a < b)

var genFab = (inputArr) =>{

     var finalArr = [];

     tempArr = [];

     var i = 0;

     var j = 1;

     var sum = 0;

     var maxVal = inputArr.sort((a, b) => b - a)[0];

     while( sum <= maxVal){

         sum =  i + j;

         i =  j;

         j =  sum;

         tempArr.push(sum);  

         if(inputArr.includes(sum)){

              finalArr.push(sum)

         }

     }   

    return  finalArr;

}

var inputArr = [1, 13, 4, 5, 34, 23, 99, 55];

inputArr.sort((a, b) => a < b)

genFab(inputArr);


Q2.  Output of the below given Program -

Program 1: 

console.log('a')

console.log('b')

setTimeout(() => {

console.log('c')

}, 1)

console.log('d')

setTimeout(() => {

console.log('e')

}, 0)

console.log('f') 

Solution 1:

a

b

d

 f

 e

​ c


Program 2: 

console.log('a')

console.log('b')

setTimeout(() => {

console.log('c')

}, 2)

console.log('d')

setTimeout(() => {

console.log('e')

}, 1)

console.log('f') 

Solution 2:

a

b

d

 f

 e

​ c










11 Sept 2022

Useful Javascript Methods | Javascript method to count the specific char in string

Program:

//method definition

function countString(str, chr){

     var count = 0;

     for(var k=0; k < str.length; k++){

         if(str.charAt(k) === chr){

             count++;

         }

    }

    return count;

}

//method call

countString("Hello World", "l");

Output:

3