Today is my first time to push the file successfully to Github.
After several hours for researching.
Created ssh-key, checked the environment, saw OhMyZsh been updated with pic
which inspires me to keep going. 😄
I edit code in Atom, type command line in terminal, learn how to use MARKDOWN to edit README.
Finally, I know how to update file on Github through git config.
Thanks my mentor @jerome1210
📔 I'll continuously update README to record down my learning...
Python: Django
- start to learning Django
- MVT structure
Project
- STYLiSH : E-Commerce website with recommendation and bidding system.
- GoodJob : Analyzed engineering job market trends with web scraping from multiple job search websites.
NGINX (NGINX Guide)
- check port
sudo lsof -i tcp:8080
can find "PID" in the list- if run nginx and show issue: Address already in use, can use
sudo kill <PID>
to stop nginx
- if run nginx and show issue: Address already in use, can use
- To start:
nginx
/ To reload:nginx -s reload
(hard reload: ⌘⇧R) / To stop:nginx -s quit
- The NGINX Crash Course
Config
-
How to save config to another file?
Config data also can save into another file (ex. config.py).
In that file, create the config class and save secret key as a class instance.
Then secret key can be accessed by -> app.config.from_object(Class_Name)
-
How to get value of secret key?
1 > load_dotenv(): SECRET_KEY valid after load_dotenv() = True
load_dotenv()
app.config['SECRET_KEY'] = os.getenv('SECRET_KEY')
2 > config = dotenv_values(".env"): assign all data to config (data is OrderedDict) from .env file
config = dotenv_values(".env")
app.config['SECRET_KEY'] = os.getenv('SECRET_KEY')
mySQL/mysqldump
Callbacks, Promises, Async Await
- Callbacks, Promises, Async Await | JavaScript Fetch API Explained
- Python Website Full Tutorial
- Flash Message
- dotenv
DataBase
- mySQL
- Querying Relational Databases
Python
- Multiple Thread
- Queue
Algorithms
- Introduction to Algorithms
-
Time complexity
Constant Time: O(1)
Logarithmic Time(Binary): O(log n)
Linear Time: O(n)
Quadratic Time: O(n^2)
Quasilinear Time(Merge Sort): O(n log n)
Polynomial runtimes: O(n ^ k), ex:O(n^2) or O(n^3)
Exponential runtime(Brute force): O(k^n), ex:O(10^n) password
Combinatorial or factorial runtime: O(n!)
-
Python
- Cookie
Python
- Using Databases in Python
- A Social Network with Flask
- Flask with SQLAlchemy Basics
LeetCode
- 1.Two Sum
Python-Flask / JSON / Cookie / API
- layout HTML
- make_response()
- set_cookie()
- request.cookies()
- POST request => parse => JSON.loads()
- GET response => toString => JSON.dumps()
Python-OOP
Install Flack
Install Anaconda
Terminal(Treehouse)
- Introduction to the Terminal
LeetCode
- 657.Robot Return to Origin
Python-OOP
- construsticons (@classmethod / @property)
Python-OOP
- setattr() / getattr()
- Inheritance
- Parent (Super) class: the class that a class inherits from.
- Child (Sub) class: get all of the attributes and methods of their parents and grandparents and so on.
javascript
LeetCode
- GCD: Greatest Common Divisor
- 914.X of a Kind in a Deck of Cards
Python-OOP
- Dunder Main
- Object-Oriented Programming (a way of structuring your code into groups of properties and behaviors)
- Dates and Times in Python
- Write Better Python (PEP8/PEP20)
AW School assignment
Python
- Packing/Unpacking of Tuple and Dict
AW School assignment
- Create Week-2 folders and files
- Completed Assignment 1,3,4
CSS(Treehouse)
- CSS Flexbox Layout
- align-items
- align-self
- justify-content
AW School assignment
- Creating Assignment-2
CSS(Treehouse)
- CSS Layout
-
Padding use in '%' unit -> base on Parent element's width
-
Display Value:
none: often use in hide/show (Read Less/More)
block: display each content in a single line
inline: display all content in the same line
inline-block: display in a single line with other contents With adjustable width/padding/border
-
CSS/Javascript/DOM (Treehouse)
-
CSS: Pseudo-classes (:link/:visited/:hover/:focus/:nth-child)
-
CSS: length units (px / % / em / rem)
px an absolute CSS measurement
% adjust an element relative to the size of the element's parent
Em considers parent elements when calculating font size.
Rem is only relative to the root html font-size.
-
CSS: Inheritance / Combinators
-
JavaScript and the DOM
-
HTMLCollection and NodeList
-
textContent and innerHTML
Review HTML/CSS/Git Basic(Treehouse)
- HTML: Structuring Your Content
- HTML: Images, Text and Links / Link to Email
- Git: Managing Committed Files / Remote Repositories
AW School assignment
- Create new repo: remote-assignments
- Create GitHub Page
Python (Treehouse)
- Python: List Iteration
- Python: Split (String -> List) and Join (List -> String)
- Python: Multidimensional Lists
HTML/Python (Treehouse)
- HTML: Creating Lists/Links
- Python: Types and Branching
- Python: Expecting Exceptions / Raising Exceptions
- Python: While Loops / For Loops / project
- Python: List
HTML/Python (Treehouse)
- Python: Meet Python
- HTML: Getting Started with HTML
Python (freeCodeCamp)
- Python Dictionaries
- Dictionaries: Common Applications
LeetCode
- 1.Two Sum
- 412.Fizz Buzz
Python
- while loop
- for loop
- recursion
Python
- set (practice in exercism)
Python
- regex (practice in exercism)
Python
- Dictionary (practice in exercism)
LeetCode
- 500.Keyboard Row
- 67.Add Binary
- set
LeetCode
- 383.Ransom Note
Python
- Tuple (practice in exercism)
- Python for Everybody: function / loop / string (Video in freeCodeCamp)
Python
- Loops (practice in exercism)
Python
- List methods
- Format Strings: {} / format()
Python
- Lists (practice in exercism)
- List methods
Python
Python
- python indentation error example: "IndentationError: expected an indented block" / "IndentationError: unexpected indent"
Python
- Basic: Variable / number / Bools
- Set {} : & | -
- List [] / Tuple ()
- Dictionary { 1: a, 2: b, 3: c}
Python
- Conditionals (practice in exercism)
Python
- Bools (practice in exercism)
Python
- Number (practice in exercism)
Python (freeCodeCamp)
- Variables, Expressions, and Statements
- power(**) ex. 2**3 = 8 / 3**3 = 27
- Intermediate Expressions: Parenthesis(Power > Multiplication > Addition > Left to Right)
- Conditional Execution (if...else / elif)
- More Conditional Structures (try/except)
Python
- install/add Python to zsh
- variable / input / print
- converting type: int() / float() / bool() / str()
- atom switch to VS Code
javascript (freeCodeCamp)
- instanceof (Boolean: check the variable is created from Constructor or not)
- Use Prototype Properties to Reduce Duplicate Code
javascript (freeCodeCamp)
- completed Basic Algorithm Scripting
- OOP: Object-Oriented Programming
- Create Object and Method/ Use Dot Notation to Access the Properties of an Object
- Define a Constructor Function and Create Objects
javascript (freeCodeCamp)
- Basic Algorithm Scripting
- Confirm the Ending
- Repeat a String Repeat a String
- Truncate a String
- Finders Keepers (indexOf() => find the FIRST index of element in array)
- Title Case a Sentence (substring())
javascript (freeCodeCamp)
- Basic Algorithm Scripting
- Convert Celsius to Fahrenheit
- Reverse a String
- Factorialize a Number
- Find the Longest Word in a String
- Return Largest Numbers in Arrays
LeetCode
- 283.Move Zeroes
javascript (freeCodeCamp)
- diff from for...in and for...of
- for...in => return key
- for...of => return value
Project: MoneyList
LeetCode - LeetCode 75: Day 7 Linked List
- 409.Longest Palindrome
- 704.Binary Search
- 278.First Bad Version
- 412.Fizz Buzz
LeetCode - LeetCode 75: Day 3.4 Linked List
- 21.Merge Two Sorted Lists
- 206.Reverse Linked List
- 876.Middle of the Linked List
- 142.Linked List Cycle II
LeetCode - LeetCode 75: Day 2 String
- 205.Isomorphic Strings
- 392.Is Subsequence
LeetCode - LeetCode 75: Day 1 Prefix Sum
- 1480.Running Sum of 1d Array
- 724.Find Pivot Index
Project: MoneyList
- add specify userId in the route after login or signin
- add userName in title
- show specify user data after login successfully
- insert data with userId key:value
- delete data when user selected
Project: MoneyList
- use node sent email
- check email by using regular expression
Project: MoneyList
- create login and signup page
- create mongoDB collection: user
- completed signup function
- completed login function
Project: MoneyList
-
still stock in unable connect to mongoDB after deploying (Heroku continuously restart to access database and close...)
-
solution 1: use another application "fly.io" to deploy my code, still failed
-
solution 2: create client.connect() function to connect with MongoDB
-
solution 3: update IP address to allow access from anywhere (0.0.0.0/0) in MongoDB -> Network Access
-
🎉 deploy success on Heroku! 🎉 MoneyList
Project: MoneyList
- change server to Heroku:
const port = process.env.PORT || 8080
- stock in TypeError: Cannot read properties of undefined (reading 'startsWith')at new ConnectionString
- solution: the key:value pair connection string in ".env" file should manually input in Config Vars on Heroku
- unable connect to mongoDB after deploying (Heroku continuously restart to access database and close...and then shows the restart action timeout)
Project: MoneyList
- completed CSS design
- stock in deploy my project on GitHub page
- I found GitHub page can only host static html files
- sign in HEROKU website, try to use HEROKU to host my project
- fail to deploy due to TypeError: Cannot read properties of undefined (reading 'startsWith')
Project: MoneyList
- copy js and html to income page
LeetCode - Algorithm I
- 977.Squares of a Sorted Array
- 189.Rotate Array
Project: MoneyList
- completed deleteMany function and delete data from mongoDB successfully
javascript (freeCodeCamp)
- Debugging
- Basic Data Structures
Project: MoneyList
- create .env file to hide MongoDB password
Project: MoneyList
*TO DO LIST: Delete function
- send delete request to server
- delete data from mongoDB
- response the updated data to endpoint
* javascript
- to get value from input tag when click checkbox
- always get the first
<%= expList._id %>
value in every checkbox- use
querySelectorAll
to save different value from tag-id
- use
- identify the checkbox is checked or unchecked
*HTML
- put
<%= expList._id %>
in checkboxe - unable to read
<%= expList._id %>
in HTML id Tag- should insert
<%= expList._id %>
as "value" of tag
- should insert
LeetCode - Algorithm I
- 704.Binary Search
- 278.First Bad Version
- 35.Search Insert Position
javascript (freeCodeCamp)
- export / import
- promise (resolve/ reject) (then: result/catch: error)
const myPromise = new Promise((resolve, reject) => {
if (responseFromServer){
resolve("We got the data");
} else {
reject("Data not received");
}
})
* // if "responseFromServer" = true *
makeServerRequest.then(result => {
console.log(result); //=> "We got the data"
});
* // if "responseFromServer" = false *
makeServerRequest.catch(error => {
console.log(error); //=> "Data not received"
});
- regular expressions : .match() / .test()
"Hello, World!".match(/Hello/);
/Hello/.test("Hello, World!");
- greedy matched (regex patterns default to greedy) and lazy matched with "?"
- \w = [a-zA-Z0-9_] ; \W = [^a-zA-Z0-9_]
javascript (freeCodeCamp)
- ES6-Spread Operator:
Math.max.apply(null, arr)
=Math.max(...arr)
- Destructuring Assignment
- class: getters and setters
Project: MoneyList
*TO DO LIST: Delete function
- identify selected data
- send delete request to server
- delete data from mongoDB
- response the updated data to endpoint
*HTML
- create history list table
- problem: all data show in one line, unable to separate it by <br>
- solution: combine tag <tr> into javascript code, so the table will break to the next line.
- add link to css file
- add label for delete
* javascript
- addEventListener: retrieve history data from mongoDB when data updated
- express.static with css file
*CSS
- add Bootstrap CDN link
Project: MoneyList * mongoDB- server connect with database
- server receive history data from mongoDB (use
find({})
)- problem: received
{"_events":{},"_eventsCount":0}
- solution: add
toArray()
afterfind({})
- solution: add
- problem: received
- sort data by date
- display history data exclude id
*HTML
- show history data on website page
- problem: server received data but unable to show on page
- solution: transform html file type to ejs, import ejs npm package and set the path to access file
- input data into html table
- problem: there're too many data that I'm unable to handle each item be placed into correct table position.
- work-around: Just list down every expense object {date, time, tag, amount} instead insert each data into each column of table. Delete table and create new list by <span> tag.
* javascript- deal with object of an array (data received at server)
- query each element(object) as one expense list
- query value of an each element(object) and send value to html file
Project: MoneyList
* javascript- request for insert data (POST)
- learn about fetch data
* javascript- request for history data (GET)
- learn about get and render
Project: MoneyList
* mongoDB- server connect with database
- auto insert data into database by click on save button
- problem : insert data into mongoDB successfully, but the server console:
Promise { <pending> }
and endpoint unable to get the response.- solution: use
async
andawait
function (Note: await is only valid in async functions and the top level bodies of modules)
- solution: use
- problem : insert data into mongoDB successfully, but the server console:
Project: MoneyList
*HTML
- get data from input button
- create table: expense list
- send data to table
- problem : can not see data show in table, it seems the "id" in getElementById doesn't work in <td> tag
- solution: create <span> and add "id" into this tag
* javascript- server connect with API
- deploy html on GitHub page (display website online)
- receive data endpoint
- problem : server unable to get request from endpoint, shows "undefined".
- solution : need to parse the data as JSON, so the server can identify data coming from endpoint. In order to give the server an ability to parse data as JSON, use express.json function :
app.use(express.json({limit: '1mb'}));
* mongoDB- server connect with database
- create new database : clusterML
- connect with mongodb successfully
- insert data into database manually with javascript code
mongoDB
- lookup: left join
- send Data API request with mongosh
- connect to mongoDB with Node.js driver
Project: MoneyList
- create new repo and connect local branch to GitHub
- problem : clone by HTTPS but need to input id and password every time when push.
- solution: clone by ssh-key (make sure ssh-key should matched with the github setting, if not matched, generate it by typing
ssh-keygen -t ed25519 -C "[email protected]"
in terminal -> open the file and copy new ssh-key -> paste into github setting)
- solution: clone by ssh-key (make sure ssh-key should matched with the github setting, if not matched, generate it by typing
- problem : unable to push at local branch
- solution: set the remote to upstream, use
git push --set-upstream origin <branch Name>
- solution: set the remote to upstream, use
mongoDB
- Query Operators
- Aggregation Pipelines
mongoDB
- connect to the database with mongoDB shell
- Insert Documents
- Query Documents
- Update Documents
- Delete Documents
AJAX and JSON
-
JSON names require double quotes
-
JSON string =>
'{"id": 1, "name": "Ruby"}'
-
JSON object literal =>
{"id": 1, "name": "Ruby"}
JSON object literal inside the string -
object =>
{id: 1, name; "Ruby"}
-
[server only process string] JSON.parse() / JSON.stringify()
-
Web Storage API: localStorage.setItem("keyName", "keyValue") / localStorage.getItem("keyName")
mongoDB
- get start and install (document / collections)
javascript (freeCodeCamp)
- ES6: added many powerful new features, includes Let and Const、Modules、Destructuring Assignment、Arrow Functions、Template Literals、Promise、Class…
- Object.freeze(objectName): prevent data mutation
- Arrow Functions
javascript (freeCodeCamp)
- while loop / do...while loop (ensures that the code inside the loop will run at least once because of the condition fails on the first check)
- for loop
- Math.floor() / Math.random()
- Generate Random Whole Numbers within a Range
Math.floor(Math.random() * (max - min + 1)) + min
- Recursion()
- Recursion is the concept that a function can be expressed in terms of itself.
LeetCode 509. Fibonacci Number
LeetCode 21. Merge Two Sorted Lists
javascript (freeCodeCamp)
- switch function (case / break)
- object (JavaScript will automatically typecast "non-string properties" as strings.)
-
Example of accessing Object Properties with Variables:
const team1 = {
12: "Alice",
16: "Betty",
19: "Cathy"
};
const playerNumber = 16;
const player = team1[playerNumber]; //=> "Betty"
- .hasOwnProperty(propname) => return true or false
- object Record Collection
javascript (freeCodeCamp)
- Number, String, Array, if...else
- Variable
- var: can easily overwrite variable declarations
- let: a variable with the same name can only be declared once
- const: read-only,once a variable is assigned with const, it cannot be reassigned
- Note: uppercase variable identifiers for immutable values (ex. const MY_NAME)/ lowercase or camelCase for mutable values like objects and arrays (ex. const firstLine)
mySQL
- Executing SQL Statements Read from a File
$ mysql -u 'user_name' -p 'database' < 'file-name.sql'
The "<" symbol tells MySQL to read the SQL statements from the file named "file_name.sql".
- stuck in connection of database and server -unsolved
- stuck in recover database which deleted by the mistake of executing SQL Statements from a File - solved
working with data and API with javaScript
- create database: NeDB
- fetch() get data from databases
working with data and API with javaScript
- server-side: server received data from routing(the end point of the API)
serverReceived.mp4
- HTTP post request with fetch()
- JSON parsing: to let the server understand the data by JSON file
- fs.appendFile and fs.readFile to save the data received by server
working with data and API with javaScript
- client-side: graph the CSV file into chart by using chart.js
- client-side: fetch JSON data from API
- Geolocate : 2.2 Geolocation Web API - Working with Data and APIs in JavaScript
working with data and API with javaScript
- client-side: fetch image from API/ promises/ async/ await
- client-side: fetch CSV file from API and parse it into text
mySQL/Node
- Node.js MySQL basic : insert / select / where / order by / drop
- prevent injection: escape / ? / @
- combine tables : Join
javaScript
LeetCode
- 27.Remove Element
mySQL
- SQL Database : create / drop / backup
- SQL table : create / drop / alter
- SQL Constraint:
- NOT NULL - Ensures that a column cannot have a NULL value
- UNIQUE - Ensures that all values in a column are different
- PRIMARY KEY - A combination of a NOT NULL and UNIQUE. Uniquely identifies each row in a table
- FOREIGN KEY - Prevents actions that would destroy links between tables
- CHECK - Ensures that the values in a column satisfies a specific condition
- DEFAULT - Sets a default value for a column if no value is specified
- CREATE INDEX - Used to create and retrieve data from the database very quickly
mySQL
mySQL/Node
- install mySQL
- Node.js tutorial : using Node to connect / creatDB / creatTable
reading (MySQL Cookbook, 4th Edition)
HTML/javaScript/CSS
-
combination in ProjectMoney: three files (HTML/JS/CSS) interact on web page
javascript file: "tableAct.js" two functions demo as below:
a. function setTimeout()
title.mp4
b. function sum()
table.mp4
HTML
Node
- Node.js Upload Files
- ProjectProfile: html/css opened success on localhost by node (http://localhost:8080/home.html)
- Sending Email using Node.js
Git
Node
- HTTP module
- File system
- URL module1 / URL module2
- NPM - Node.js package mamager
- Events
CSS
Node
CSS
LeetCode
- 14.Longest Common Prefix
HTML
javaScript
- Sets (practice in exercism)
javaScript
- Regular Expression(practice in exercism)
- Array Loops (practice in exercism)
javaScript
- Errors and Inheritance (practice in exercism)
- prototype chain
LeetCode
- 136.Single Number
javaScript
- Prototypes and Classes(practice in exercism)
reading (JavaScript: The Definitive Guide, 7th Edition)
- Chapter 1.Introduction to JavaScript
- Chapter 2.Lexical Structure
LeetCode
- 7.Reverse Integer
javaScript
- Array Transformations(practice in exercism)
javaScript
- Type Conversion (practice in exercism)
- Template Strings/Ternary Operator (practice in exercism)
- Array Destructuring/Rest and Spread (practice in exercism)
- Array Analysis/Arrow Functions (practice in exercism)
javaScript
Git
- merge vs rebase
- alias
- gitNote
javaScript
Git
- MARKDOWN
- branch
- push / pull
- fetch
- merge
- rebase / reset / amend