Wednesday, August 30, 2023

Non Technical- MF SIP Advice

small cap 


Nippon India small cap direct growth 

SBI small cap  500

kotak small cap 1000

hdfc small cap  500

quant small cap 1000

icici small cap  500


4000


balanced funds 

*hdfc balanced advantage 1500

icici pru balanced advantage 500

nippon 500

kotak 500


3000



FoF

Kotak multi assest allocator FoF dynamic 2500

icici pru asset allocator 1000


3500


ICICI


icici pru value discovery fund  500

icici pru equity and debt fund  500

icici pru multi asset fund      500

icici pru blue chip fund        500

2000


bank nifty   (could not be done)

hdfc bank nifty       500

kotak nifty bank etf  500


1000

Saturday, July 8, 2023

Difference between axios and fetch - a detailed article

 https://codilime.com/blog/axios-vs-fetch/#:~:text=Different%20properties%20are%20used%20for,API%20using%20the%20POST%20method.


35 mins read! here

Saturday, June 24, 2023

CSS border shadow for input box taken from https://stackoverflow.com/questions/14820952/change-bootstrap-input-focus-blue-glow

<!DOCTYPE html>
<html>
<head>
<style> 
input[type=text] {
  width: 100%;
  padding: 12px 20px;
  margin: 8px 0;
  box-sizing: border-box;
  border: 1px solid #555;
  outline: none;
  border-radius: 5px;
}

input[type=text]:focus {
  border-color: #28a745;
  box-shadow: 0 0 0 0.1rem rgba(40, 167, 69, 0.25);
}
</style>
</head>
<body>

<h2>Input fields with color on :focus</h2>

<p>Here, the input field gets a color when it gets focus (clicked on):</p>

<form>
  <label for="fname">First Name</label>
  <input type="text" id="fname" name="fname" value="John">
  <label for="lname">Last Name</label>
  <input type="text" id="lname" name="lname" value="Doe">
</form>

</body>
</html>


Monday, January 16, 2023

WORKING Promise and Then for Angular APP_INITIALIZER

 //const appInitializerFn = (infoService: InfoService) => {

//  return () => {

//    return infoService.loadInfo().then( (promise) => {alert("tete"); return promise } ).then(_ => Promise.resolve(true)).then(_ => alert("tetete"));

//  };

//};




//WORKING APPINITIALIZER FUNCTION

const appInitializerFn = (infoService: InfoService,  httpClient : HttpClient) => { 


return () => {

    //return infoService.loadInfo()

return Promise.resolve(true)

.then( (promise) => {alert("tete"); return promise } )

.then(_ => infoService.setConfig(new AppInfo("aaaa")))

.then(_ => alert("tetete"));

  };


}






INFO SERVICE
import { Injectable } from '@angular/core';
import { HttpBackend, HttpClient } from '@angular/common/http';
import { AppInfo } from './app-info';

@Injectable()
export class InfoService {

  info: any;

  constructor(private httpBackend: HttpBackend) {}

  loadInfo(): Promise<boolean> {
    // bypass HTTP interceptors by using HttpBackend
    const http = new HttpClient(this.httpBackend);

    return (
      http
        .get<AppInfo>('/assets/info')
        // convert to Promise per Angular's `useFactory` requirement (not officially documented)
        .toPromise()
        .then(response => {
          // using a class factory to keep AppInfo class getters in place
alert("1");
          this.info = response;
        })
        // returning `true` to satisfy `useFactory` contract (not officially documented)
        .then(_ => {  return Promise.resolve(true); } )
        .catch(error => {
          console.error('Error loading info', error);
          return Promise.resolve(false);
        })
    );
  }

setConfig(inInfo : any)
{
alert("hi"); console.log("fri service");console.log(inInfo);
this.info =  inInfo;
console.log(this.info);
}

}

APP-INFO.TS
export class AppInfo {
  clientId: string;
  constructor(cli: string) 
{
this.clientId = cli;
}
}

Saturday, December 10, 2022

Difference between TAG hierarchies of BOOTSTRAP NAV and NAVBAR components

  --NAVBAR--                 --NAV--

NAVBAR                  ----------

NAVBAR-NAV                         NAV

NAV-ITEM                 NAV-ITEM

NAV-LINK                 NAV-LINK

Browser autocomplete behaviors

 Found the following strange autocomplete behaviors on both Google and Edge. 

Consider the following html for input : 


  <div class="form-group">

    <label for="emailid">Email Id :</label>

    <input type="email" class="form-control" placeholder="Enter User" id="emailid">

  </div>


In this code, note the following "HOTSPOTS" :

  <div class="form-group">

    <label for="emailid">Email Id :</label>

    <input type="email" class="form-control" placeholder="Enter User" id="emailid">

  </div> 


If you ever set these two hotspots to values like "email" , "emailaddress" , "user" , "password", the browser is likely to autofill this field. (tested with chrome and edge). 

To avoid this, just change the name slightly. e.g. from "email" to "emailid" . You will have to test which name is working by trial and error. But you have to make changes in these two places mostly, plus may be in the <label for="XXXX"> place. 


If you google on autocomplete behavior, most of the links will tell you to set autocomplete to "off" or some junk value "dsf" or some different value "differentname" or set name to some different value that id of the control. But practically none of these tricks work. 

I also found this SO https://stackoverflow.com/questions/55591018/autocomplete-off-in-html5 

which tells to include autocomplete="off" in form tag and then include a hidden input in the form with autocomplete="false". But this also did not work. 

<form autocomplete="off" >
    <input autocomplete="false" name="hidden" type="text" style="display:none;">

Wednesday, November 2, 2022

Surreal DB

 


Surreal DB does not start on alpine container, 

use ubuntu container instead 


1. Create an Ubuntu container 


docker run -d -p 17000:8000 --name ub_surreal ubuntu tail -f /dev/null


2. Exec the container  in it mode


docker exec -it -u 0 ub_surreal sh


3. Update apt  ( this is required to install curl)


apt update


This will take some time may be 2-3 mins because apt coming with container is bare minimum


4. Install curl

 

apt install curl


Press 'Y' when prompted 


5. 


curl -sSf https://install.surrealdb.com | sh


This will install surreal db. 


6. Start surreal db


surreal start --log debug --user root --pass root memory


This will start surreal and keep it started. 


7. Open another command prompt and again open the same container with EXEC command: 


docker exec -it -u 0 ub_surreal sh


8. Now you can give the command and use surrealdb. 

For example you can give the following command: 


curl --request POST --header "Accept: application/json"    --header "NS: test" --header "DB:test" --user "root:root"  --data "INFO FOR DB;"  http://localhost:8000/sql


you should get a response like 

[{"time" : "47.432ms" , "status" : "OK" , "result" : { "d1" : {} , "dt" : {}, "sc" : {} , "tb" : {}}}]









https://www.freecodecamp.org/news/how-to-use-surrealdb-with-fresh-framework/



========================================================================

Start Surreal using dockerfile


1. Execute the following dockerfile:

========================================================================

Dockerfile

========================================================================

FROM ubuntu

RUN apt update 

RUN apt-get install -y  curl 

RUN curl -sSf https://install.surrealdb.com | sh

CMD surreal start --log debug --user root --pass root memory

========================================================================



NOTE the use of  apt and apt-get : apt-get has more features than apt, 

i.e. apt is a stripped down vesrion of apt-get



2. Build the above docker file:


docker build  -t surreal-image . 


NOTE : image name must be all smalls.


3. Run it: 

docker run -p 17000:8000 -d --name surrealdb surreal-image


4. Execute it: 

docker exec -it -u 0 surrealdb sh


5. Execute the following command on shell: 

surreal sql -c http://localhost:8000


You will be presented with surreal sql prompt. ( >) 


>info for db <Enter>

[{"time" : "23.728ms" , "status" : "ERR" , "detail" : "Specify a namespace to use"}]



6. Now exit sql shell by pressing ctrl + C and enter the following command: 

surreal sql -c http://localhost:8000 --ns test --db test

>info for db


[{"time" : "50.292ms" , "status" : "OK" , "result" : { "d1" : {} , "dt" : {}, "sc" : {} , "tb" : {}}}]


> create account set name = 'test' , created_at = time::now()



> CREATE author:john SET name.first = 'John' ,  name.last = 'Adams' , name.full = string::join(' ', name.first, name.last) , age = 29, admin  = true,  signup_at = time::now();


> select * from author, account;


Odds Ratio (OR), Logistic Regression Interpretation vs. Prediction, and Ordinal Logistic Regression

An odds ratio (OR) measures the association between an exposure and an outcome. It represents the odds that an outcome will occur given ...