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
> Subtract two months from a date, then return the new date | |
SELECT DATEADD(month, -2, '2017/08/25') AS DateAdd; | |
> https://www.w3schools.com/sql/func_sqlserver_dateadd.asp | |
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: | |
CASE | |
WHEN condition1 THEN result1 | |
WHEN condition2 THEN result2 | |
... | |
ELSE result | |
END |
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
https://console.clever-cloud.com/users/me/addons/addon_1315c43c-935c-4889-b9ab-1c64f93bcf61 | |
Database@123 | |
SQL execution: | |
FROM --> WHERE --> GROUP BY --> HAVING --> SELECT --> ORDER BY | |
1. WITH also known as a Common Table Expression (CTE): | |
> powerful tool for simplifying complex SQL queries and improving query readability. | |
WITH cte_name (column1, column2, ...) AS ( |
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
TWO Rules for writing component function in ReactJS: | |
1. should start with Upper case char | |
2. should return that could be render on the screen | |
ex: | |
""" | |
from MyComp import "./App.jsx"; | |
export default function MyReducerComp(){ | |
const [count, dispatchCount] = useReducer(reducerFunc, 0); |
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
https://chat.openai.com/share/3f1472a2-ff59-4b88-bec4-36c75421e3ed | |
""" | |
from sqlalchemy import ( | |
Column, BigInteger, Integer, String, Text, ForeignKey, Uuid, Enum, DateTime, CheckConstraint, | |
) | |
from sqlalchemy import func, select | |
from sqlalchemy.sql.expression import ( | |
case as sql_case, | |
cast as sql_cast, |
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 asyncio | |
from collections.abc import Coroutine | |
from socket import AF_INET | |
# AF_INET specifies the Internet address family for IPv4. | |
from typing import List, Optional, Any, Dict | |
import aiohttp | |
from fastapi import FastAPI | |
from fastapi.logger import logger as fastAPI_logger # convenient name |
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
Adaptable: | |
1. Responsive (Adaptable): | |
- web application is designed to adapt and respond to different screen sizes, resolutions, and orientations. | |
- CSS media queries. | |
/* Responsive styles */ | |
@media screen and (max-width: 768px) { | |
/* Adjust styles for screens up to 768px wide */ | |
.container { | |
padding: 10px; | |
} |
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
lect 0: https://colab.research.google.com/drive/1crwg2yOosVEQATTlMfPe-FdiQKZF-gFN?usp=sharing | |
lec 1: https://drive.google.com/file/d/1_H5jhUut-DPjT5U0vmgCkg30DKZCa_-G/view?usp=sharing | |
lect 2: https://colab.research.google.com/drive/1DxeRBxRaqENX-HnxqSj-fexuRxBaTp9R?usp=sharing | |
lect 3: https://colab.research.google.com/drive/1fzTxGc0ttQeUV4D4VQf0zYDSOb6gDkoH?usp=sharing | |
databrick NB: https://databricks-prod-cloudfront.cloud.databricks.com/public/4027ec902e239c93eaaa8714f173bcfc/6073444084857434/2270297475493747/7614095282524650/latest.html |
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
m2m | |
class Post(models.Model): | |
slug = models.SlugField(max_length=200, unique=True) | |
likes = models.ManyToManyField(User, related_name='blogpost_like', blank=True) | |
post = get_object_or_404(Post, slug=slug) | |
if post.likes.filter(id=request.user.id).exists(): | |
post.likes.remove(request.user) |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Welcome Page</title> | |
<style> | |
body { | |
background-color: #f0f0f0; | |
font-family: Arial, sans-serif; |
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
Bulk Insert: | |
def bulk_insert(self, sql, sql_parameters, batch_size=1000): | |
for i in range(0, len(sql_parameters), batch_size): | |
batch = sql_parameters[i:i+batch_size] | |
cursor = self.get_connection_cursor() | |
cursor.executemany(sql,batch) | |
self.connection.commit() | |