Posts

About Seedr

Seedr is a cloud-based torrent client that allows users to download torrents and store them in a virtual drive, eliminating the need for a local storage device. With Seedr, users can access their torrents anytime and anywhere, as long as they have an internet connection. One of the key benefits of Seedr is its ease of use. To start downloading torrents, all you need to do is sign up for an account and paste the torrent link into the platform. Seedr will take care of the rest, downloading the torrent in the background and saving it to your virtual drive. This makes it a great option for people who don't have the space or technical know-how to set up their own torrent client. Another advantage of Seedr is its speed. The platform uses a high-speed server network to download torrents, meaning you can get your files faster than with traditional torrent clients. Seedr also offers a premium service that provides users with even faster download speeds and additional storage space. One of t

MongoDB & Mongoose - A Refresher

 1. What is MongoDB? MongoDB is a no SQL database, which stores Documents in Collections instead of Records in Tables as in SQL It is used to store application data Stored data doesn't enforce a specific data schema or any relations MongoDB can also be easily connected to Node and Express, but we do not connect it directly to our front end (React) MongoDB is a powerful database and it can be easily integrated into a node express environment 2. SQL vs NoSQL NoSQL(e.g MongoDB) do not enforce a strict data schema(collections can contain documents with different schemas),  have less focus on relations, works with independent documents SQL(e.g MySQL) enforce a strict data schema(define the tables and the corresponding records, normally don't deviate from that structure ), relations are a core feature the records are related 3. Connecting React to a Database? Connecting react to the database is a bad idea It is a highly insecure approach, secure authentication is not really possible

Node.js & Express.js - A Refresher

 1. What is Node.js? Like Browser is one host environment of that Javascript of frontend, Node.js is a host environment for Javascript of backend Chrome's Javascript engines V8  has all been cloned and is now maintained as a standalone project working without a browser and enriched with some extra APIs that is basically Node.js, it allows us to run Javascript outside of the browser Compare to V8, Node.js dropped some APIs(e.g. DOM API), and added some APIs(e.g. Filesystem) 2. A Simple Node.js Code Node.js code are just normal javascript code with extra node  api In Node.js runtime environment, there are a few globally function (e.g., require) Between different Node.js module (javascript file), we can transfer object through require and export A simple Node.js Code: const fs = require("fs"); const userName = "Light"; fs.writeFile("./user-data.txt", "Name: " + userName, (error) => { if (error) { console.log(error); return; }

React.js - A Refresher

 1. What is React? It's a Javascript library for building user interfaces that are shown in the browser It's a browser side Javascript library running in browser It started a huge ecosystem with other third-party packages forming a framwork We use it to build the frontend of web applications React does not run on a server, React does not communicate with databases React build highly reactive modern user interfaces and do so by following a declarative approach(you define the results, not the steps that lead to the result) React using components which are UI building blocks we can define, then we compose our user interface from these components Every component also define what it should render, under which circumstance 2. React Component React component can be one of two things, it can be a Javascript function which returns jsx or it can be a Javascript class that has a render method Custom components can be used as jsx( JavaScript XML ) as well,  they should start with a capital

What is MERN?

1. Introduction MERN stands for MongoDB, Express, React, and Node. 2. Big Picture for the MERN Architecture Client (Browser) : ReactJS : Responsible for presentation and the user interface. NodeJS & Express : Server-side responsible for business logic and file storage. The server side and client side communicate with requests and responses in JSON format. Database : MongoDB : Responsible for persistent data storage. NodeJS & Express communicate with MongoDB through database queries using the MongoDB SDK. 3. Diving into Client Side React single-page application is served from the server to the browser. React handles rendering everything in the browser. React manages frontend or client-side routing with an extra library, react-router-dom . react-router-dom helps render different React components based on the path the user enters into the URL bar of the browser. The React application typically handles some front-end state that influences what is shown on t

Javascript Currying

Transform a function with multiple parameters into calling a nesting function multiple times with one parameter; the functionality of the two situations is not changed. For example, the following functions have the same functionality but different formats: // original format function add(a, b) { return a + b; } // currying format function curryingAddFirst(a) { return function (b) { return a + b; }; } // currying format with arrow function const curryingAddSecond = (a) => (b) => a + b;

Smart contract

A smart contract is a computer program or a transaction protocol that is intended to automatically execute, control or document events and actions according to the terms of a contract or an agreement. This is a smart contract: // SPDX-License-Identifier: MIT pragma solidity ^0.8.13; contract Counter { uint public count; // Function to get the current count function get() public view returns (uint) { return count; } // Function to increment count by 1 function inc() public { count += 1; } // Function to decrement count by 1 function dec() public { // This function will fail if count = 0 count -= 1; } }