Posts

Showing posts from September, 2022

angular services[get&post]

insertPost ( data : any ){    return   this . httpClient . post ( this . url1 , data     ,     { responseType :   'text' }); } //rx js topic obeserver in angular?  step 1:- services:--(apiFetch) AppModule.ts //for http call:--- import { HttpClientModule } from '@angular/common/http'; imports: [ HttpClientModule, ] step 2:-- getapi.service.ts:-- import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; @Injectable({   providedIn: 'root' }) export class GetapiService {   private url = 'http://jsonplaceholder.typicode.com/posts';    private url1="http://localhost:4000/myapp";    //this is post api address..   constructor(private httpClient: HttpClient) { }      getPosts(){     return this.httpClient.get(this.url);   }   insertPosts(data:any){     return this.httpClient.post(this.url1,data);   } } step 3:--...

node mongo db compass

  mongodb+srv://gaurav:<password>@cluster0.uhopp0a.mongodb.net/test

css Responsive menu

 Html:--- < link   rel = "stylesheet"   href = "style/menuresp.css" > </ head > < body >      < div   class = "container" >          < div   class = "header" >              < div   class = "title" >                  < h1 > Premium </ h1 >              </ div >              <!-- adding responsiveness -->              < a   href = "#"   class = "togglebutton" >                  < span   class = "bar" ></ ...

angular Property binding

 Note:--interpolatin works only with number and string{{}} [value]=name   value={{name}} property change time we have to use property binding[button click try]

jquery

calling a function after some time in jquery: setTimeout ( function (){                  $ ( 'span' ). css ( { 'background-color' : 'red' , 'color' : 'blue' });                }, 5000 ) css transition with jquery:    $ ( 'span' ). css ({ 'background-color' : 'red' , 'color' : 'blue' ,                 'transition' : 'color 20s ease-in-out, background-color 10s ease-in-out'                          });

mysqlconnectivityphp

 php mysql oops connectivity: <?php $con=new mysqli("localhost","root","root","test"); if($con->connect_error){     die("connection failed".$con->connect_error); } else{     $sql="select * from records where name='amit'";     $result=$con->query($sql);     if($result->num_rows>0){         while($data=$result->fetch_assoc()){             echo $data['name']."",$data['class'];         }     }      } pdo connectivity: <?php $dbname="mysql:host=localhost;dbname=student"; $con=new PDO($dbname,"root",""); $sql=$con->query("select * from student_records"); while($data=$sql->fetch(PDO::FETCH_ASSOC)){     //print_r($row);     echo $data['student_id']."".$data['student_name']; } ?>

Typescriptcode

1. open source programming language devloped by microsoft 2. typed superset of javascript 3. compiles down to plain javascript 4.optional static typing and type interface[adds type support to javascript]. 5.IDE support. ............................................................................................................................ tsc -v[typescript version]

React search solve

  import   axios   from   'axios' ; import   React ,{ useState , useEffect }  from   'react' export   default   function   Aboutorg () {    const  [ data , setData ]= useState ({}); //    const  [ firstname , setFirstName ]= useState ( '' );    const  [ buttonclick , setButtonclick ]= useState ();    const   search =() => { setButtonclick ( firstname );   }    //  const getData=()=>{    //   axios.get(`https://dummy.restapiexample.com/api/v1/employee/${buttonclick}`).then(res=>{      //   //  console.log(res.data);    //    console.log(res.data.data);    //    setData(res.data.data);    //   }).catch(err=>console.log(err))    // }   useEffect (() => { c...

react controlled formProblem

searching problem:----   javascript - React - changing an uncontrolled input - Stack Overflow reactjs - How to fix missing dependency warning when using useEffect React Hook - Stack Overflow

javascript validation

Image
 

css

  Learn CSS Pseudo Elements In 8 Minutes

phpupload

 <!DOCTYPE html> <html lang="en"> <head>     <meta charset="UTF-8">     <meta http-equiv="X-UA-Compatible" content="IE=edge">     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <title>Document</title> </head> <body>     <form action="upload.php" method="post" enctype="multipart/form-data"> <input type="file" name="f" id=""> <button type="submit">upload</button>     </form> </body> </html> <?php //include connection page here /*Php.ini /*upload_max_filesize=40M ; Maximum number of files that can be uploaded via a single request max_file_uploads=20*/ $f=$_FILES["f"]; //print_r($f); $filename=$_FILES['f']['name']; $filetype=$_FILES['f']['type']; $filetmp_name=$_FILES['f']['tmp_...

useReducer&useref

useReducer: 1.  An alternative to  useState . Accepts a reducer of type  (state, action) => newState , and returns the current state paired with a  dispatch  method. 2. useReducer  is usually preferable to  useState  when you have complex state logic that involves multiple sub-values or when the next state depends on the previous one.  3. useReducer  also lets you optimize performance for components that trigger deep updates because  you can pass  dispatch  down instead of callbacks . import   React ,{ useReducer }  from   'react' export   default   function   HookRed () {      // const initialstate = { count: 0 };      // function increment(){      //     return {      //         type:...

NodeJs

 1.read and file to a computer 2.connect to a database 3.act as a server for a content

css transform

scale:.5 scale:1,.5x,y rotate:45deg//normal rotate rotate:x 45deg rotate:y 45deg rotate:z 45deg//normal rotate translate:50px hover{ animation:rotate 5000ms infinite alternate; } @keyframes rotate{ 0%{ rotate:0; } 100%{ rotate:45deg }

angular style

Image
style binding showme:boolean:true this.showme=!this.showme  NgStyle:-- ngStyle directive to set style properties to dom element we can pass dynamic value via variable ex:-- <div [ngStyle]="background-color:value'>example</div> ex:--- tsfile:    colorval = 'red' ; htmlfile < span   [ngStyle] = "{'color':colorval}" >     hi </ span > we can pass more then one value.. < span   [ngStyle] = "{'color':colorval,'background-color':color1}" >     hi </ span > ngClass:--- set a class name for the element we can pass dynamic values via variables 1.ng class with string,array,object 2.ng class with component based method example:-- <div [ngClass]="'one'">using string</div> <div [ngClass]="{'one':true,'two:false}">with multiple class</div> static html file:-- <!-- ngclass --> < span   [ngClass] = "'one'" > good ...

clone object javascript

 const A={ } const B=Object.assign({},A); const B={...A} console.log(B)