Search This Blog

Sunday, 9 June 2999

Headlines

PEARLS OF WISDOM 

Pearls of Wisdom is my youtube channel affiliated to Enlightened Thought Works, whose objective is to provide motivational booster shots, to help uplift individual morale.
These videos are 3min-5min boosters, with introspection points, that can leave you staying motivated throughout the day.
  1. The channel has uploads everyday in the form of 15sec - 45sec motivation #shorts
  2. The channel also uploads long videos which are 3min - 5min, on real success stories, motivational experiments every Monday.
We have come accross a lot of sad and sensational stories in this year of COVID-19. Let's spread joy and boost our morale to get ready for a better future!

Do support us in this initiative by subscribing to this channel, so that we can provide more of such motivational booster shots in the form of youtube videos. 
Click on the url below, to subscribe to our channel Pearls Of Wisdom.


You can also embed the Pearls of Wisdom Audio-visual Quotes widget on your website, which would increase the User Experience and user connect with your website. Just add the widget below, anywhere in your website and see the magic happen.

The widget would look something like this.








          







Wednesday, 10 January 2024

Quick Tech Tips - Attaching a Logger middleware to Redux

 To add a logger middleware to the redux application, the following steps can be followed

1. Install 'redux-logger' locally for your project


2. The file where redux store is created in your application, make the changes as follows (marked yellow)

import {configureStore, combineReducers} from '@reduxjs/toolkit'
import { purchaseReducer } from '../Reducers/Reducer';
import logger from 'redux-logger';

const rootreducer = combineReducers({purchaseReducer});
export const shop = configureStore({
                                    reducer:rootreducer,  
                                    middleware:(getDefaultMiddleware) => getDefaultMiddleware().concat(logger)}
                                 );

3. That's it. Each time you alter a state, The output should look as follows



Quick Tech Bits - React Redux Integration Using Hooks

 Steps to create and integrate Redux Application with React using @reduxjs/toolkit and Hooks

1. To create a redux aware react app, the following installations are required.

2. Create the actions, reducers, store as follows   

Actions > Action.js

 
export const BUY_ICE = 'BUY_ICE';
export const BUY_CHOC = 'BUY_CHOCOLATE'
 
//Create actions
export const buyicecream = () => {
    return {
        type: BUY_ICE
    }
}
 


Reducers > Reducer.js

import { BUY_ICE, buyicecream } from "../Actions/Actions";

const initialState = {
    ice_stock: 100
}

export const purchaseReducer = (prevState = initialState, action) => {
    switch(action.type){
        case BUY_ICE:
           return {
                    ...prevState,
                    ice_stock: prevState.ice_stock-1
                 };
        default:
            return prevState;
    }

}


Store.js

import {createStorefrom 'redux'
import {configureStore, combineReducers} from '@reduxjs/toolkit'
import { purchaseReducer } from '../Reducers/Reducer';
 
const rootreducer = combineReducers({purchaseReducer});
export const shop = configureStore({reducer:rootreducer});
//export const shop = createStore(reducer); //Deprecated...
 


3. Create a react component. In this component import the new hooks "useDispatch", "useSelector". These hooks come from the library 'react-redux'. They perform the task of mapping the redux library's dispatch function to react component, mapping redux store object to react component respectively, as shown in the code below.

In this react component, a button that updates the icecream stock of the redux's store (as created above) is done.

import {useDispatch, useSelector} from 'react-redux';
import { buyicecream } from './Actions/Actions';

export let MyShop = ()=>{

    const dispatchfn = useDispatch();   //redux built-in dispatch fn to dispatch action to redux store thru reducer
    const shopData = useSelector(store => store.purchaseReducer);   //assign redux global store (state obj) to variable
    console.log(shopData);

    return(<>
        <div className='text-primary'>
            Ice cream Stock: {shopData.ice_stock}
        </div>
        <button className='btn btn-primary' onClick= {()=>dispatchfn(buyicecream())}>BUY ICECREAM</button>

    </>);
}


4. Add this to the index js or the route configuration in your react app. This component will be wrapped inside the <Provider> which is provided by 'react-redux' package.

import {shop} from './Store/store' //comes from redux's store created above
import {Provider} from 'react-redux';
import { MyShop } from './ReduxIntegration'; //react component

let ReduxComponent = () =>{
    return (
        <Provider store={shop}>
            <MyShop/>
        </Provider>
    )
}

//In the route configuration add it as follows
export let Container = () => {
    return(
        <BrowserRouter>
            <Routes>                           
                <Route path='/redux' element={<ReduxComponent/>}/>
            </Routes>
        </BrowserRouter>
    )
}


5. Finally add it to the correct virtual DOM in index.js as shown.

Index.js


const root = ReactDOM
                    .createRoot(document
                                  .getElementById('root'));

root.render(
  <React.StrictMode>  
   <Container/>
  </React.StrictMode>
);
To execure, be sure you have navigated to your project directory from command terminal  
          






This completes the integration, using Hooks and the @reduxjs/toolkit

  

When executed, the output should look as follows

CLICK BUY ICECREAM         









Wednesday, 22 November 2023

Using Git from Visual Studio

 Working with Git in Visual Studio  (Step-By-Step)

Step 1:  Create your repository in Git. Use Visual Studio

              




THE ABOVE STEP NEEDS TO BE DONE ONLY ONCE.

Step 2:  Open your solution in Visual Studio. Open the Git Changes Window



3.  Create the repository, through Create Repository Option in Git Changes window



Step 4. The files that do not exist in the repository (remote: github.com repo) would show in Changes section. 

    i. Click '+' to Add them. 

    ii. Stage Them (Click Commit All / Commit Staged)

    iii. Add a Comment for changes made, the choose the button to Push the changes to remote repo (viz. repo on Github.com)

                       



This completes the creation of a new repository in Github using Visual Studio


5. HEREAFTER, EACH TIME YOU OPEN VISUAL STUDIO TO WORK ON YOUR PROJECT, 

a. First PULLthe changes from Github on your local machine

b. Make necessary changes. Look for the shown icon, in the Git Changes window, (beside the Push icon)

c. Once again PULL the changes from Github, to ensure nobody has added anything new to the repository

d. Follow Step 4

Wednesday, 6 September 2023

Quick Tips - Data Backup Vs Data Archival



Data Backup: When a copy of existing data for the purposes of protecting and recovery in case of loss or fatal conditions of failure is known as data backup. If there is a crash, this backup can be used for immediate recovery. 
Backup policies are usually a scheduled as recurring nightly process. Depending on the condition, either a full backup is taken or a differential backup is taken on a secondary  or passive machine

Data Archive: The intent here is to keep this data for long term and in a cold storage, away from the active storage. This is about data that is infrequently used, history data, aged data. The reasons for archival is usually reporting, predictive analysis, analytics etc.
Archival policies differ from Backup policies.

Architecture Post - Information View archival and retention

One of the infrequently analyzed aspects during the analysis of  information for a product is about retention and archival policies.

Retention and archival policies are different from backup policies

Data Backup: When a copy of existing data for the purposes of protecting and recovery in case of loss or fatal conditions of failure is known as data backup. If there is a crash, this backup can be used for immediate recovery. 
Backup policies are usually a scheduled as recurring nightly process. Depending on the condition, either a full backup is taken or a differential backup is taken on a secondary  or passive machine

Data Archive: The intent here is to keep this data for long term and in a cold storage, away from the active storage. This is about data that is infrequently used, history data, aged data. The reasons for archival is usually reporting, predictive analysis, analytics etc.
Archival policies differ from Backup policies.

USECASE: A simple management system
PHASE: Discovery
Analysis View: Information
The following diagram, models information (not data) categories and its relationships.
Consider an information relationship diagram as follows

%3CmxGraphModel%3E%3Croot%3E%3CmxCell%20id%3D%220%22%2F%3E%3CmxCell%20id%3D%221%22%20parent%3D%220%22%2F%3E%3CmxCell%20id%3D%222%22%20value%3D%22Company%22%20style%3D%22shape%3Ddocument%3BwhiteSpace%3Dwrap%3Bhtml%3D1%3BboundedLbl%3D1%3Bdashed%3D0%3BflipH%3D1%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22-580%22%20y%3D%2255%22%20width%3D%22100%22%20height%3D%2270%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3CmxCell%20id%3D%223%22%20value%3D%22Designation%22%20style%3D%22shape%3Ddocument%3BwhiteSpace%3Dwrap%3Bhtml%3D1%3BboundedLbl%3D1%3Bdashed%3D0%3BflipH%3D1%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22-790%22%20y%3D%22260%22%20width%3D%2280%22%20height%3D%2250%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3CmxCell%20id%3D%224%22%20value%3D%22Subsystems%22%20style%3D%22shape%3Ddocument%3BwhiteSpace%3Dwrap%3Bhtml%3D1%3BboundedLbl%3D1%3Bdashed%3D0%3BflipH%3D1%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22-460%22%20y%3D%22155%22%20width%3D%22100%22%20height%3D%2270%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3CmxCell%20id%3D%225%22%20value%3D%22Employee%22%20style%3D%22shape%3Ddocument%3BwhiteSpace%3Dwrap%3Bhtml%3D1%3BboundedLbl%3D1%3Bdashed%3D0%3BflipH%3D1%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22-680%22%20y%3D%22155%22%20width%3D%22100%22%20height%3D%2270%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3CmxCell%20id%3D%226%22%20value%3D%22HRMS%22%20style%3D%22label%3BwhiteSpace%3Dwrap%3Bhtml%3D1%3Bimage%3Dimg%2Fclipart%2FGear_128x128.png%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22-290%22%20y%3D%22210%22%20width%3D%22110%22%20height%3D%2240%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3CmxCell%20id%3D%227%22%20value%3D%22Payroll%22%20style%3D%22label%3BwhiteSpace%3Dwrap%3Bhtml%3D1%3Bimage%3Dimg%2Fclipart%2FGear_128x128.png%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22-300%22%20y%3D%22115%22%20width%3D%22110%22%20height%3D%2240%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3CmxCell%20id%3D%228%22%20value%3D%22Assets%22%20style%3D%22shape%3Ddocument%3BwhiteSpace%3Dwrap%3Bhtml%3D1%3BboundedLbl%3D1%3Bdashed%3D0%3BflipH%3D1%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22-670%22%20y%3D%22260%22%20width%3D%2280%22%20height%3D%2250%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3CmxCell%20id%3D%229%22%20value%3D%22Projects%22%20style%3D%22shape%3Ddocument%3BwhiteSpace%3Dwrap%3Bhtml%3D1%3BboundedLbl%3D1%3Bdashed%3D0%3BflipH%3D1%3B%22%20vertex%3D%221%22%20parent%3D%221%22%3E%3CmxGeometry%20x%3D%22-553%22%20y%3D%22265%22%20width%3D%2293%22%20height%3D%2240%22%20as%3D%22geometry%22%2F%3E%3C%2FmxCell%3E%3CmxCell%20id%3D%2210%22%20value%3D%22Has%22%20style%3D%22endArrow%3Dopen%3BendSize%3D12%3Bdashed%3D1%3Bhtml%3D1%3Brounded%3D0%3BexitX%3D0.69%3BexitY%3D0.729%3BexitDx%3D0%3BexitDy%3D0%3BexitPerimeter%3D0%3BentryX%3D0.38%3BentryY%3D0%3BentryDx%3D0%3BentryDy%3D0%3BentryPerimeter%3D0%3B%22%20edge%3D%221%22%20source%3D%222%22%20target%3D%225%22%20parent%3D%221%22%3E%3CmxGeometry%20width%3D%22160%22%20relative%3D%221%22%20as%3D%22geometry%22%3E%3CmxPoint%20x%3D%22-460%22%20y%3D%22250%22%20as%3D%22sourcePoint%22%2F%3E%3CmxPoint%20x%3D%22-300%22%20y%3D%22250%22%20as%3D%22targetPoint%22%2F%3E%3C%2FmxGeometry%3E%3C%2FmxCell%3E%3CmxCell%20id%3D%2211%22%20value%3D%22Use%22%20style%3D%22endArrow%3Dopen%3BendSize%3D12%3Bdashed%3D1%3Bhtml%3D1%3Brounded%3D0%3BexitX%3D0.22%3BexitY%3D0.971%3BexitDx%3D0%3BexitDy%3D0%3BexitPerimeter%3D0%3BentryX%3D0.83%3BentryY%3D0.014%3BentryDx%3D0%3BentryDy%3D0%3BentryPerimeter%3D0%3B%22%20edge%3D%221%22%20source%3D%222%22%20target%3D%224%22%20parent%3D%221%22%3E%3CmxGeometry%20width%3D%22160%22%20relative%3D%221%22%20as%3D%22geometry%22%3E%3CmxPoint%20x%3D%22-460%22%20y%3D%22250%22%20as%3D%22sourcePoint%22%2F%3E%3CmxPoint%20x%3D%22-300%22%20y%3D%22250%22%20as%3D%22targetPoint%22%2F%3E%3C%2FmxGeometry%3E%3C%2FmxCell%3E%3CmxCell%20id%3D%2212%22%20value%3D%22Has%22%20style%3D%22endArrow%3Dopen%3BendSize%3D12%3Bdashed%3D1%3Bhtml%3D1%3Brounded%3D0%3BexitX%3D0.55%3BexitY%3D0.871%3BexitDx%3D0%3BexitDy%3D0%3BexitPerimeter%3D0%3BentryX%3D0.75%3BentryY%3D0%3BentryDx%3D0%3BentryDy%3D0%3B%22%20edge%3D%221%22%20source%3D%225%22%20target%3D%223%22%20parent%3D%221%22%3E%3CmxGeometry%20width%3D%22160%22%20relative%3D%221%22%20as%3D%22geometry%22%3E%3CmxPoint%20x%3D%22-460%22%20y%3D%22250%22%20as%3D%22sourcePoint%22%2F%3E%3CmxPoint%20x%3D%22-300%22%20y%3D%22250%22%20as%3D%22targetPoint%22%2F%3E%3C%2FmxGeometry%3E%3C%2FmxCell%3E%3CmxCell%20id%3D%2213%22%20value%3D%22Has%22%20style%3D%22endArrow%3Dopen%3BendSize%3D12%3Bdashed%3D1%3Bhtml%3D1%3Brounded%3D0%3BexitX%3D0.46%3BexitY%3D0.957%3BexitDx%3D0%3BexitDy%3D0%3BexitPerimeter%3D0%3BentryX%3D0.413%3BentryY%3D-0.02%3BentryDx%3D0%3BentryDy%3D0%3BentryPerimeter%3D0%3B%22%20edge%3D%221%22%20source%3D%225%22%20target%3D%228%22%20parent%3D%221%22%3E%3CmxGeometry%20width%3D%22160%22%20relative%3D%221%22%20as%3D%22geometry%22%3E%3CmxPoint%20x%3D%22-460%22%20y%3D%22250%22%20as%3D%22sourcePoint%22%2F%3E%3CmxPoint%20x%3D%22-300%22%20y%3D%22250%22%20as%3D%22targetPoint%22%2F%3E%3C%2FmxGeometry%3E%3C%2FmxCell%3E%3CmxCell%20id%3D%2214%22%20value%3D%22Has%22%20style%3D%22endArrow%3Dopen%3BendSize%3D12%3Bdashed%3D1%3Bhtml%3D1%3Brounded%3D0%3BexitX%3D0.19%3BexitY%3D0.957%3BexitDx%3D0%3BexitDy%3D0%3BexitPerimeter%3D0%3BentryX%3D0.624%3BentryY%3D0.05%3BentryDx%3D0%3BentryDy%3D0%3BentryPerimeter%3D0%3B%22%20edge%3D%221%22%20source%3D%225%22%20target%3D%229%22%20parent%3D%221%22%3E%3CmxGeometry%20width%3D%22160%22%20relative%3D%221%22%20as%3D%22geometry%22%3E%3CmxPoint%20x%3D%22-460%22%20y%3D%22250%22%20as%3D%22sourcePoint%22%2F%3E%3CmxPoint%20x%3D%22-300%22%20y%3D%22250%22%20as%3D%22targetPoint%22%2F%3E%3C%2FmxGeometry%3E%3C%2FmxCell%3E%3CmxCell%20id%3D%2215%22%20value%3D%22Is-A%22%20style%3D%22html%3D1%3BverticalAlign%3Dbottom%3BendArrow%3Dblock%3Bcurved%3D0%3Brounded%3D0%3BexitX%3D0%3BexitY%3D0.5%3BexitDx%3D0%3BexitDy%3D0%3BentryX%3D0.02%3BentryY%3D0.414%3BentryDx%3D0%3BentryDy%3D0%3BentryPerimeter%3D0%3B%22%20edge%3D%221%22%20source%3D%227%22%20target%3D%224%22%20parent%3D%221%22%3E%3CmxGeometry%20width%3D%2280%22%20relative%3D%221%22%20as%3D%22geometry%22%3E%3CmxPoint%20x%3D%22-360%22%20y%3D%22180%22%20as%3D%22sourcePoint%22%2F%3E%3CmxPoint%20x%3D%22-280%22%20y%3D%22180%22%20as%3D%22targetPoint%22%2F%3E%3C%2FmxGeometry%3E%3C%2FmxCell%3E%3CmxCell%20id%3D%2216%22%20value%3D%22Is-A%22%20style%3D%22html%3D1%3BverticalAlign%3Dbottom%3BendArrow%3Dblock%3Bcurved%3D0%3Brounded%3D0%3BexitX%3D0%3BexitY%3D0.5%3BexitDx%3D0%3BexitDy%3D0%3BentryX%3D0%3BentryY%3D0.629%3BentryDx%3D0%3BentryDy%3D0%3BentryPerimeter%3D0%3B%22%20edge%3D%221%22%20source%3D%226%22%20target%3D%224%22%20parent%3D%221%22%3E%3CmxGeometry%20width%3D%2280%22%20relative%3D%221%22%20as%3D%22geometry%22%3E%3CmxPoint%20x%3D%22-420%22%20y%3D%22250%22%20as%3D%22sourcePoint%22%2F%3E%3CmxPoint%20x%3D%22-340%22%20y%3D%22250%22%20as%3D%22targetPoint%22%2F%3E%3C%2FmxGeometry%3E%3C%2FmxCell%3E%3C%2Froot%3E%3C%2FmxGraphModel%3E



After this stage, we usually convert the information categories into data producing ER-Diagrams

An important consideration that is usually ignored is, what happens when a product is up and running for a sample period Eg. 5yrs where CRUD operations especially deletions take place.

Some standard practices are unwritten principles, 
  • if ACTION = DELETE, default it to soft-deletion keeping it in active storage. 
  • Deciding to push data to cold storage for archival if primary storage has grown considerably, 
  • Elimination process of data ageing based on years of inactivity.

At the discovery phase of the Information view, if it is feasible, it is a good idea to strategize solutioning data ageing conditions whether backup Vs archival as is or differentially or transform data to suit purposes of learning or analytics.

How do we know if this analysis is feasible?
a. If the product has CRUD transactions, management of data as part of activities done, then thinking about retention and archival can be solutioned at this stage

b. If the product is has extensive realtime processing such as creation of algorithms, then the benchmarking for information that become candidates for archival, could be arrived only after a couple of pilot tests.

For the given use case, let's try to think of ways to archive
Information categories and strategies for archival for the Simple management system
1. Company: CASE ACTIVE, then in active storage
                     CASE DELETED, then soft-deleted but in active storage
                               DELETED, PERIOD > 1yr, then data required for reporting archived, without violating IP
                                                     Eg: Company Name, Company Id, Total Employees, Subsystems used, Highly used Subsystems / day / year

 

2. Employee: CASE ACTIVE, then in active storage
                      CASE DELETED, PERIOD < 1yr, move to cold storage info as is
                      CASE DELETED, PERIOD > 5yrs, then transform data to be archived for analytics purpose
                                                                     Eg: Emp name, Emp Id, Performance index, last designation, total years in employment, compliants or non-compliances etc

 

3.  Designation & Department: CASE ACTIVE, then in active storage
                                                   CASE DELETED, soft-delete but in active storage

 

4. Subsystems: CASE ACTIVE, then in active storage
                         CASE DELETED, PERIOD > 1yr, then cold storage as is

Tuesday, 22 August 2023

The eternal loop of changing trends-then-back to our roots

We see changing trends, update our way of living, term them as modernization, just to realise that we keep going back  to our roots each time to find solace.

For example, yogic poses if one observes were an integral part of a daily routine like squatting, namaskar, eating food sitting in sukhasana; to see things replaced by its sedentary counterparts in the name of modernized living.

Now decades later, yoga becomes a trend, the same activities are advised to us by trained counsellors.

Common sense became complicated, complex situation and thinking became common trend. Now one needs experts to learn things that were  once common sense.
The trend of home remedies, natural healing, mantra yoga, color and sound therapy which was followed since ages has become a movement.

Thumb impressions were the most authentic identity verification systems since ages, with modernization they got replaced with signatures, later realising that it could be copied, after which came digital signatures  and now biometric identities using fingerprints and retina checks 🙂

You  see, we keep looping and eventually come back to our roots.

Before we blindly adopt a trend in the name of modernization, let's think, analyse to see  if it is really necessary to be part of this bandwagon.

Worth giving it a thought I hope.