This file contains hidden or 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
/** | |
sudo mysql -u root | |
> CREATE USER 'sammy'@'localhost' IDENTIFIED BY 'password'; | |
> ALTER USER 'sammy'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; | |
> GRANT ALL PRIVILEGES ON dbTest.* To 'user'@'hostname' IDENTIFIED BY 'password'; | |
> FLUSH PRIVILEGES; | |
> mysql://deepanshu:deepanshu@localhost:3306/my_db | |
**/ |
This file contains hidden or 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
console.log("chart called"); | |
const plu = { | |
htmlLegend: { | |
// ID of the container to put the legend in | |
containerID: 'legend-container', | |
}, | |
legend: { | |
display: true, |
This file contains hidden or 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 wixdata from 'wix-data'; | |
import wixWindowFrontend from 'wix-window-frontend'; | |
let collection = ""; | |
let x_axis_field = null; | |
let y_axis_field = null; | |
let animationDuration = 1000; | |
let chartData = {}; | |
let chartClass = ".LCNC-Charts" | |
let toggleGrid = { |
This file contains hidden or 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
3 steps: | |
1. create custom errors and sxtend from `RuntimeException` | |
2. create a global Exception Handler | |
3. directly throw the exception from anywhere | |
................................................................................................................. | |
@ResponseStatus(HttpStatus.BAD_REQUEST) | |
public class BadReq extends RuntimeException { |
This file contains hidden or 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 com.fasterxml.jackson.annotation.JsonIgnoreProperties; | |
import com.fasterxml.jackson.annotation.JsonIgnore; | |
import com.fasterxml.jackson.annotation.JsonProperty; | |
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | |
import com.fasterxml.jackson.databind.DeserializationContext; | |
import com.fasterxml.jackson.databind.annotation.JsonSerialize; | |
import com.fasterxml.jackson.databind.annotation.JsonNaming; | |
import com.fasterxml.jackson.databind.json.JsonMapper; |
This file contains hidden or 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
spring.application.name=springPractice0 | |
server.port=8083 | |
jwt.secret=mySecretKey123 | |
# import org.springframework.beans.factory.annotation.Value; | |
# @Value("${jwt.secret}") | |
# private String jwtSecret; | |
# [email protected]@ |
This file contains hidden or 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 org.example.ApiC; | |
import java.io.IOException; | |
import java.util.HashMap; | |
import java.util.Map; | |
//import org.slf4j.Logger; | |
import java.util.Objects; | |
import okhttp3.MediaType; |
This file contains hidden or 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
# uvicorn main:app --reload | |
# venv\Scripts\activate | |
from fastapi import FastAPI, Body | |
from pydantic import BaseModel | |
app = FastAPI() | |
@app.get("/") |
This file contains hidden or 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
InputStreamReader.............................................................................. | |
- InputStream: class that reads binary data in the form of bytes from a source. | |
- InputStreamReader: It reads bytes using the given InputStream and then converts them into chars | |
based on a certain Charset (UTF-8, UTF-16). | |
- has a read() method that reads a single character (bytes --> characters) | |
remember: | |
InputStreamReader.read() != InputStream.read() | |
1. InputStreamReader reader = new InputStreamReader(new FileInputStream(filePath), StandardCharsets.UTF_8) |
This file contains hidden or 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
Self-Join: | |
1. https://leetcode.com/problems/rising-temperature/ | |
ANS: | |
SELECT w1.id | |
FROM Weather w1 | |
JOIN Weather w2 | |
ON DATEDIFF(w1.recordDate, w2.recordDate) = 1 | |
WHERE w1.temperature > w2.temperature; |