A collection of tech notes, personal reflections, and evolving thoughts about whatever’s caught my curiosity.

notes

Module in JS

12 January 2023

A module is just a file. One script is one module. As simple as that.

  • To make import/export work, browsers need <script type="module">.
  • Modules have several differences:
    • Deferred by default.
    • Async works on inline scripts.
    • To load external scripts from another origin (domain/protocol/port), CORS headers are needed.
    • Duplicate external scripts are ignored.
  • Modules have their own, local top-level scope and interchange functionality via import/export.
  • Modules always use strict.
  • Module code is executed only once. Exports are created once and shared between importers.

When we use modules, each module implements the functionality and exports it. Then we use import to directly import it where it’s needed. The browser loads and evaluates the scripts automatically.

In production, people often use bundlers such as Webpack to bundle modules together for performance and other reasons.

References

javascript info

essay

Why I am writing in the time of Reels?

1 January 2023
Is it worth it? Does anybody ever read this? Before this blog, these are the few questions...
notes

Oracle Timestamp

21 December 2022

The TIMESTAMP datatype is an extension on the DATE datatype. In addition to the datetime elements of the DATE datatype, the TIMESTAMP datatype holds fractions of a second to a precision between zero and nine decimal places, the default being six. There are also two variants called TIMESTAMP WITH TIME ZONE and TIMESTAMP WITH LOCAL TIME ZONE. As their names imply, these timestamps also store time zone offset information.

create table table_name (
    column_name number,
    column_name2 timestamp default systimestamp);

References

dba-oracle
dba-oracle 2

notes

Material UI and Emotion

14 December 2022

Material UI uses Emotion as its default styling engine.

Run the following commands to add Material UI to your project:

npm install @mui/material @emotion/react @emotion/styled

Emotion Emotion is a library designed for writing css styles with JavaScript. It provides powerful and predictable style composition in addition to a great developer experience with features such as source maps, labels, and testing utilities. Both string and object styles are supported.

There are two primary methods of using Emotion. The first is framework agnostic and the second is for use with React.

Styled Components

styled is a way to create React components that have styles attached to them. It’s available from @emotion/styled. styled was heavily inspired by styled-components and glamorous.

import styled from '@emotion/styled'

const Button = styled.button`
  padding: 32px;
  background-color: hotpink;
  font-size: 24px;
  border-radius: 4px;
  color: black;
  font-weight: bold;
  &:hover {
    color: white;
  }
`

render(<Button>This my button component.</Button>)
References

Emotion website

notes

Differenet types of errors in JS

13 December 2022

Syntax error
The error occurs when you use a predefined syntax incorrectly.

Reference Error
In a case where a variable reference can’t be found or hasn’t been declared, then a Reference error occurs.

Type Error
An error occurs when a value is used outside the scope of its data type.

RangeError
There is an error when a range of expected values is required

URI Error
When the wrong character(s) are used in a URI function, the error is called.

InternalError
This error occurs internally in the JS engine, especially when it has too much data to handle and the stack grows way over its critical limit.

Evaluation Error
Current JavaScript engines and EcmaScript specifications do not throw this error. However, it is still available for backward compatibility. The error is called when the eval() backward function is used.

References

scaler

essay

let and const Keywords Hoisting

5 December 2022
JavaScript declarations are hoisted Variables defined with `let` and `const` are hoisted to the top of the block, but not initialized...
essay

Scope, Scope chain and Lexical Environment in JS

2 December 2022
Scope is the place where you can access the values of your variables or functions in our code.
essay

ക്രിസ്തുമസ് കരോള്‍ ഗാനങ്ങള്‍

1 December 2022
വിവിധ കാലങ്ങളിൽ ഞങ്ങളുടെ പള്ളിയിൽ പാടിയിരുന്ന ക്രിസ്തുമസ് കരോൾ ഗാനങ്ങൾ വരും തലമുറയ്ക്ക് പകർന്ന് നൽകുവാനായി ഇവിടെ സമാഹരിച്ചിരിക്കുന്നു...
notes

Peace - that was the other name for home.

25 November 2022

Botteled life.