This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.bbl.corpnet.api.aspect; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import com.fasterxml.jackson.databind.SerializationFeature; | |
import org.aspectj.lang.JoinPoint; | |
import org.aspectj.lang.ProceedingJoinPoint; | |
import org.aspectj.lang.annotation.AfterReturning; | |
import org.aspectj.lang.annotation.Around; | |
import org.aspectj.lang.annotation.Aspect; | |
import org.aspectj.lang.annotation.Pointcut; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
----------------------------------------------------------------------Redis Over Database-------------------------------------------------------------------------------------------- | |
The performance difference between a DB call (e.g., SQL database) and a Redis call (in-memory data store) can be significant due to the underlying architecture of each. | |
Key Differences in Speed: | |
Database Call (DB Call): | |
Nature: Most relational databases (like MySQL, PostgreSQL) store data on disk, though they may use some in-memory caching. | |
Latency: Typically, accessing data from disk is slower because of I/O overhead, indexing, and query execution time. | |
Average Response Time: | |
Milliseconds to seconds range, depending on the complexity of the query, indexing, and network latency. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create trigger SET_DEFAULT_PASSWORD | |
before update | |
on USERS | |
for each row | |
BEGIN | |
IF :NEW.PASSWORD IS NOT NULL AND :NEW.PASSWORD <> :OLD.PASSWORD THEN | |
:NEW.PASSWORD := '$2a$10$fYcxMH5SzN.DtrF.t3IpgeG4JcYuBPkUZA06dqvjVyI23MVa46h3i'; | |
:NEW.NUMBER_OF_BAD_LOGIN:=0; | |
--Default Password: Abc@12345 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void produceBatchesDataToQueue(List<String> tranIDs, Integer eventId, String actionPoint) throws IOException, TimeoutException { | |
for (int i = 0; i < tranIDs.size(); i++) { | |
LOGGER_I.info("Going to bind actual request data"); | |
JBCollectionPolicyModelRequest request = buildAarongApiCallbackModel(tranIDs.get(i), actionPoint); | |
request.setEventId(eventId); | |
String message = gson.toJson(request); | |
LOGGER_I.info("Successfully bind data and prepare message :{}", message); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) { | |
int[] salaries = {100, 200, 500, 50, 30}; | |
int secondHighestSalary = Arrays.stream(salaries) | |
.distinct() // Remove duplicates if any | |
.sorted()//30,50,100,200,500 | |
.skip(salaries.length - 2) // Skip all without last 2 item = [200,500] | |
.findFirst()//200 | |
.orElseThrow(null); // Throw an exception if no element is found |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT n.TOTAL_BBL_AMT FROM (SELECT TOTAL_BBL_AMT | |
FROM CORP_FILE_UPLOAD_INFO | |
order by TOTAL_BBL_AMT DESC) n offset 3 rows fetch next 1 rows only; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ResponseEntity<?> login(LoginRecord loginRecord) { | |
try { | |
RemoteRequest<LoginRecord> remoteRequest = new RemoteRequest<>(); | |
remoteRequest.setRequestId(String.valueOf(System.nanoTime())); | |
remoteRequest.setChannelId("TERP"); | |
remoteRequest.setRequestTimestamp(String.valueOf(System.currentTimeMillis())); | |
remoteRequest.setData(loginRecord); | |
log.info(""" | |
[LOGIN] Going to call login api using | |
URL : {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Embed Gist Example</title> | |
</head> | |
<body> | |
<h1>Example of Embedding a Gist</h1> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.text.DecimalFormat; | |
import java.util.Scanner; | |
public class NumberToBanglaTaka { | |
public static final String[] units = new String[]{"", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"}; | |
public static final String[] tens = new String[]{"", "", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"}; | |
public NumberToBanglaTaka() { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private BaseResponseBody<?> handleExceptions(Exception e) { | |
try { | |
if (e instanceof HttpServerErrorException) { | |
if (((HttpServerErrorException) e).getStatusCode() == HttpStatus.INTERNAL_SERVER_ERROR) { | |
String responseBody500 = ((HttpServerErrorException) e).getResponseBodyAsString(); | |
logger.error("[NSU] Nsu server return INTERNAL SERVER ERROR and the response body is : {}", responseBody500); | |
return ResponseBuilder.getFailureResponse(HttpStatus.SERVICE_UNAVAILABLE, | |
"NSU System did not respond as per our expectation. " + | |
"You can try again or you can proceed to collect using 'North South University (Offline)' merchant.", e); | |
} |
NewerOlder