Posts

Showing posts from September, 2023

javascriptcommonprogram

  /*1program for maximum no in an array */ https://www.freecodecamp.org/news/improve-reactjs-code/ // function max(arr) // { //     maxvalue=arr[0] //     for(i=1;i<arr.length;i++){ //         if(arr[i]>maxvalue){ //         maxvalue=arr[i] //         } //     } // return maxvalue; // } // console.log(max(array)); /*2program for palindrome no*/ // function palindrome(str){ //     var splitString = str.split(""); //string to array       //     var reverseArray = splitString.reverse();//reverse a array           //     var joinArray = reverseArray.join("");//array join //    if(joinArray===str){ //         return "palindrome"; //     } //     else{ //         return "not a palindrome" //     } // } // s="usuk" // console.log(palindrome(s)); /...

todolistwitheditreact

import React , { useState } from 'react' import { TextField , Button } from '@mui/material' ; import { MdDelete , MdDensityMedium } from "react-icons/md" ; // import ShowList from './ShowList'; export default function Todo () {     const [ item , setItem ] = useState ([]);     const [ input , setInput ] = useState ( '' ); const [ toggle , setToggle ] = useState ( false ); const [ edititemid , setEdititemid ] = useState ( null );     const Additem = () => {         // console.log(input);         if ( ! input ){           alert ( "please fill the data" );         }       else if ( input && toggle === true ){       setToggle ( false );         console . log ( edititemid );         console . log ( input );         setItem ( item . map (( el , key ) => { ...

javascript datetime

  JavaScript Intl DateTimeFormat format() Method

react query

 1  a:---getting data https://github.com/WebDevSimplified/react-query-crash-course-example/blob/main/client/src/App.jsx //automatic retry system import React from 'react' import { useQuery , useMutation } from 'react-query' const POSTS = [     { id : 1 , title : 'goodmorning' },     { id : 2 , title : 'goodafternoon' }     ] export default function Example () {     //my wait function...     const   wait = ( duration ) => {         return new Promise ( resolve => setTimeout ( resolve , duration ))     }     const Postquery = useQuery ({         queryKey : [ "Posts" ],         // queryFn:()=>wait(5000).then(()=>[...POSTS])         queryFn : () => Promise . reject ( "Error message" )     })     if ( Postquery . isLoading ) return < h1 > loading.... </ h1 >   ...

git reading

Image
 https://www.datacamp.com/tutorial/git-push-pull In similar situations where we get a lot of information, we can keep on pressing enter until we get stuck with the following “ (END) ”. how do I enter command now? :/ Solution:  press  ‘q’ . This will enable you to enter command again.

insertionsort js

      // Function to sort an array using insertion sort function insertionSort ( arr , n ) {     let i , key , j ;     for ( i = 1 ; i < n ; i ++ )     {         key = arr [ i ];         j = i - 1 ;             /* Move elements of arr[0..i-1], that are         greater than key, to one position ahead         of their current position */         while ( j >= 0 && arr [ j ] > key )         {             arr [ j + 1 ] = arr [ j ];             j = j - 1 ;         }         arr [ j + 1 ] = key ;     } }     // A utility function to print an array of size n function printArray ( arr , n ) {     let i ;     for ( i =...

javascript module

1:--- {   "name" : "testcheckbox" ,   "version" : "1.0.0" ,   "description" : "" ,   "main" : "A.js" ,   "type" : "module" ,   "scripts" : {     "test" : "echo \" Error: no test specified \" && exit 1"   },   "author" : "" ,   "license" : "ISC" } 2:-- function getPower () {     return "good morning" ; } function capitalize ( word ) {     return word [ 0 ]. toUpperCase () + word . slice ( 1 ); } export { getPower , capitalize }; 3:--  import { getPower , capitalize } from "./A.js" ; console . log ( getPower ()); console . log ( capitalize ( "rajkumar" ));

u can learn

 https://drive.google.com/file/d/11syYdNHSeY3mGs7UeEJNYtlL5m3ecKxs/view?trk=public_post_comment-text&pli=1 • Used passport.js for authentication and authorisation. https://tanstack.com/query/v3/docs/react/overview

react-pdf

  // "react-pdf": "^7.1.3" import React ,{ useRef , useState } from 'react' import { AiFillCloseCircle } from "react-icons/ai" ; import { Button , Modal , Spinner } from 'react-bootstrap' ; import 'bootstrap/dist/css/bootstrap.min.css' ; import { Document , Page , pdfjs } from 'react-pdf' ; import 'react-pdf/dist/esm/Page/AnnotationLayer.css' ; import 'react-pdf/dist/esm/Page/TextLayer.css' ; import ImageWork from './Components/ImageWork' ; export default function App () {     pdfjs . GlobalWorkerOptions . workerSrc = `//unpkg.com/pdfjs-dist@ ${ pdfjs . version } /build/pdf.worker.min.js` ;   const fileInput = useRef ();   const [ files , setFiles ] = useState ([]);   const filearray = [ ... files ];   const [ finalFile , setFinalFile ] = useState ([])   const [ pdfString , setPdfString ] = useState ( '' );   const [ numPages , setNumPages ] = useState ( null );  ...