Value is not getting clear in UI in React-Suite DatePicker

I am setting value onSelect and clearing value on button click. The state for DatePicker field is getting cleared but from UI the value is not getting cleared. It remains there until and unless I clicked on cross icon in DatePicker field. I am also facing another issue which is whenever I put value attribute value={moment(searchData.createdDate).toDate()} and when I clicked on field it is throwing me Invalid time error error. Please refer the below code and image for more clarification.

import { DatePicker } from 'rsuite';
< DatePicker
oneTap
placeholder = "Date select"
name = "createdDate"
onSelect = {(date, event) => {
        handleInputChange({
            target: {
                name: "createdDate",
                value: moment(date).format('YYYY-MM-DD')
            }
        })
    }
}
    // value={moment(searchData.createdDate).toDate()}
    />

The date value is still shown in field after clearing value from state

Thank you.

How to convert PK format data to excel in javascript

PKx03x04x14x00x08x08x08x009bwRx00x00x00x00x00x00x00[Content_Types].xml�…nx00x00xl/worksheets/sheet1.xmlPK

This is the reponse from an API I”m trying to download an excel
It is working in postman
Please suggest a code to download excel from this format

Thanks in advance

I tried all blob creating urls

` const blob = new Blob([data], { type: ” });

const url = window.URL.createObjectURL(blob);`

Making .env file dynamic in react

I have a .env file with some keys that I want to make dynamic. So that I can use the same env file for all my servers and remove it from git. For Example

.env
ENV_TYPE: #myVariable

I want to fetch this value in linux from

echo MY_ENV = 'Test'
export MY_ENV

Problem updating Register on BD with Electron

I’m starting with Electron JS and I have a little problem.

I am reading information from a database and copying it to another remote one. I connect well with both databases and insert the records without problem (As seen in the example) but now I want a field to be updated after copying the records to know that it has been copied.

I have tried the following way and the program runs but does not sync. Can you help me? Thank you.

ipcRenderer.on('sync_articulo', (event, results) => {
   const list = results
   list.forEach(element => {
      //
      //
      //ESTE CODIGO ES EL QUE INSERTA LOS REGISTROS 
      //
      //
         const objetoadd = {
                  IdArticulo:element.IdArticulo,
                  Descripcion:element.Descripcion,
                  Descripcion1:element.Descripcion1,
        }

        function addProductff(objetoadd)
        {
            const sql = "INSERT INTO sync_articulo SET ?";  
            dbr.query(sql, objetoadd, (error, results, fields) => {
            if(error) {
                  console.log(error);
            }
         });

        //Code to Update

        function updateproductff(objetoedit) 
         {
            let idElemento = objetoedit.IdArticulo;
            let wm_export = 1;
            const sql = "UPDATE sync_articulo SET wm_export=? WHERE id=?";  
            db.query(sql, [wm_export, id], (error, results, fields) => {
            if(error) {
               console.log(error);
            }
            });

         }   

         addProductff(objetoadd);
         updateproductff(objetoadd);

}

Does authorize.net only accepts payment via node.js api’s?

I am implementing authorize.net payment gateway using node.js api’s. Does authorize.net only accepts money from customer profile to merchant’s account? Do we not have ability to transfer money from merchant’s account to customer profile with new transaction not as a refund transaction?

I want to transfer money from merchant’s account to customer create using create customer profile. But their are no api’s to achieve this for new direct transaction.

Converting lazy loaded module into an eagerly loaded module

I would like to convert one of my lazy loading modules into eagerly loading module. I have this code in my app-routing.module.ts:

const accountModule = () => import('./account/account.module').then(x => x.AccountModule);
const adminModule = () => import('./admin/admin.module').then(x => x.AdminModule);
const profileModule = () => import('./profile/profile.module').then(x => x.ProfileModule);
const scheduleModule = () => import('./schedule/schedule-routing.module').then(x => x.ScheduleRoutingModule);


const routes: Routes = [
    { path: '', component: HomeComponent, canActivate: [AuthGuard] },
    { path: 'account', loadChildren: accountModule },
    { path: 'profile', loadChildren: profileModule, canActivate: [AuthGuard] },
    { path: 'admin', loadChildren: adminModule, canActivate: [AuthGuard], data: { roles: [Role.Admin] } },
    { path: 'schedule', loadChildren: scheduleModule },
    { path: 'report', component: RaportForDateComponent },
    { path: 'floating', component: FloatingSchedulesComponent },

    // otherwise redirect to home
    { path: '**', redirectTo: '' }
];

I would like to convert account into eagerly loading module. This is my account-routing.module module:

const routes: Routes = [
    {
        path: '', component: LayoutComponent,
        children: [
            { path: 'login', component: LoginComponent },
            { path: 'register', component: RegisterComponent },
            { path: 'verify-email', component: VerifyEmailComponent },
            { path: 'forgot-password', component: ForgotPasswordComponent },
            { path: 'reset-password', component: ResetPasswordComponent }
        ]
    }
];

@NgModule({
    imports: [RouterModule.forChild(routes)],
    exports: [RouterModule]
})
export class AccountRoutingModule { }

What do I need to change in my app-routing.module.ts Routes for app-routing.module.ts module to be eagerly loaded?

I have created react js exchange , and after sometime in chrome browser only showing AW,Snap error code SIGILL

here is the image of that page, we have huge amount of order coming through socket and this issue is only in chrome browser(https://i.stack.imgur.com/xo1cV.png). i have checked on Firefox there is not issue there,how i can debugs the issue through my platform or through customising the code
I have tried to customise the order book and data that coming through socket, previously i have managed through redux but now i have change the flow its coming directly through useState in order book.
How i can resolve this issue.

¿como reducir el codigo en base64 de una imagen subida en el summernote usando javascript? [closed]

tengo un summernote en el cual inserto tanto texto como imagenes para despues insertar ese codigo en mi base de datos en la columna contenido con un varchar(max) el problema radica en que cuando el summernote convierte una imagen en base 64 este codigo es tan extenso que supera las capacidades de la columna este es mi summernote <div class="col-lg-12"> <div class="form-group"> <label class="form-label">Mensaje <span class="text-red">*</span></label> <textarea type="text" class="form-control" placeholder="Descripcion" id="summernote" value="" name="contenido" rows="4" oninput="actualizarAsunto()" required></textarea> </div> </div> y este es mi javascript

<script>
        $(document).ready(function () {
            $('#summernote').summernote({
                tabsize: 2,
                height: 120,
                toolbar: [
                    ['style', ['style']],
                    ['font', ['bold', 'underline', 'clear']],
                    ['color', ['color']],
                    ['para', ['ul', 'ol', 'paragraph']],
                    ['table', ['table']],
                    ['insert', ['link', 'picture', 'video']],
                    ['view', ['fullscreen', 'codeview', 'help']]
                ],
                callbacks: {
                    onImageUpload: function (files) {
                        for (let i = 0; files && i < files.length; i++) {
                            const reader = new FileReader();
                            reader.onload = function (e) {
                                const dataUrl = e.target.result;
                                $('#summernote').summernote('insertImage', dataUrl);
                            };
                            reader.readAsDataURL(files[i]);
                        }
                    }
                }
            });
        });

        function actualizarAsunto() {
            var contenidoMensaje = $('#summernote').val();
            $('#asunto').val(contenidoMensaje);
        }
    </script>```


probe extraer la imagen y guardarla en mi sistema de asp.net core mvc 

How to get data inside script tag and use as String inside function in C#

I have code in file program.cs in web app .NET like this, so this code is basically draw canvas and return a link url that parse to base64 of that canvas, im trying to look up for how to get data of c.toDataUrl , and I used

var doc = new HtmlDocument();
doc.LoadHtml(htmlResponse);
var canvasDataUrl = doc.GetElementbyId("myLink").InnerHtml;

but it just can’t take the value of c.toDataUrl() out because in script tags it, just run after app.Run() called

app.MapGet("/", (HttpContext context) =>
{    string userAgent = context.Request.Headers["User-Agent"];


    string htmlResponse = @"
                <!DOCTYPE html>
                <html>
                <head>
                    <title>Canvas Fingerprint</title>
                </head>
                <body>
                    <h1>Canvas Fingerprint</h1>
                    <p>Fingerprint: {fingerprint}</p>
                    <p>Fingerprint: {canvasDataURL}</p>
                    <img style='width:500 ; height:500' src='{canvasDataURL}' alt='Canvas Fingerprint' />
<canvas id=""myCanvas"" width=""300"" height=""100"" style=""border:1px solid #d3d3d3;"">
<input type=""hidden"" id=""canvasDataUrl"">
Your browser does not support the HTML canvas tag.</canvas>
<p id=""demo""></p>
<a id=""myLink"" href=""#"">Click me!</a>
<script>

var c = document.getElementById(""myCanvas"");
var ctx = c.getContext(""2d"");

    const txt = ""Canvas Fingerprint <canvas> 1.0"";

    // Set text baseline
    ctx.textBaseline = ""top"";

    // Set font
    ctx.font = ""14px 'Arial'"";
    ctx.textBaseline = ""alphabetic"";

    // Draw filled rectangle
    ctx.fillStyle = ""#f60"";
    ctx.fillRect(125, 1, 62, 20);

    // Draw text with color #069 at position (2, 15)
    ctx.fillStyle = ""#069"";
    ctx.fillText(txt, 2, 15);

    // Draw text with color rgba(102, 204, 0, 0.7) at position (4, 17)
    ctx.fillStyle = ""rgba(102, 204, 0, 0.8)"";
    ctx.fillText(txt, 4, 17);
    console.log(c.toDataURL());
    var canvasDataUrl = c.toDataURL();
    document.getElementById(""myLink"").innerHTML = canvasDataUrl;
</script>
                </html>";
    context.Response.ContentType = "text/html";

    var doc = new HtmlDocument();
    doc.LoadHtml(htmlResponse);
    var canvasDataUrl = doc.GetElementbyId("myLink").InnerHtml;

    // Set the response content type to HTML


    return context.Response.WriteAsync(htmlResponse);
});

how to get value of c.toDataURL() after i draw canvas to use as a String in C#

Video.js with Browserify – videojs is not defined

I am using the video.js library, and it works well on my site.

However, I am trying to add plugins to video.js, and now need to use Browserify so I can deploy the package to clients.

But I cannot access the video.js library after compiling in Browserify.

videojs is not defined

My Browserify code is very simple, I haven’t included any plugins yet as I can’t even get the base code to work. I installed video.js via npm.

var videojs = require('video.js');

I understand that once compiled you cannot access the old libraries in the global scope, but can if you set it as a variable, as in some example code I found.

var videojs

Should expose that variable as a global, but that does not seem to be the case. I include the bundle.js before any other code to ensure it is available.

I am new to Browserify, and I am at a loss what I am missing. Any help would be appreciated. I don’t want to add all my other code to Browserify, just the video.js and its plugins, so I can keep developing normally.

How to play RTSP stream in React project

I am currently facing a problem in the React project, which is how to play RTSP streaming videos on the React page, which is causing me a headache

I tried using React Player, VideoJs, and other libraries, but none of them were implemented

next.js 14 unable to dislpay loading.tsx

enter image description here

loading not display when navigate to /profile

how to show the loading ?

export default function Loading() {
  // You can add any UI inside Loading, including a Skeleton.
  return (
    <div>
      loading..oading..oading..oading..oading..oading..oading..oading..oading..oading..oading..oading..oading..oading..oading..oading...
    </div>
  );
}

type Props = Readonly<{ children: React.ReactNode }>;

export default function Layout({ children }: Props) {
  return <div>this is profile layout {children}</div>;
}

import Link from 'next/link';

export default function About() {
  return (
    <>
      <div>profile page</div>
      <Link href="/">Dashboard</Link>
    </>
  );
}

Using setInterval in a for loop to iterate through multiple arrays?

I have a for loop that i need to use to iterate through 6 arrays of equal length at the same time but at set intervals. I’m using Javascript. what i am having trouble with is implementing the intervals. Basically what i am trying to do is make the for loop iterate through each array at an interval of 1000ms, so that it prints out the console logs at a rate of 1000ms.

if anyone has any advice please i would greatly appreciate your input.

const noteW = [1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1]
const noteE = [0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1]
const noteR = [1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1]
const noteI = [0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1]
const noteO = [1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1]
const noteP = [0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1]

for (i=0;i<noteW.length;i++){
  

      if (noteW[i] === 1) {
        console.log('shieeet1');
      }
      if (noteE[i] === 1) {
        console.log('shieeet2');
      }
      if (noteR[i] === 1) {
        console.log('shieeet3');
      }
      if (noteI[i] === 1) {
        console.log('shieeet4');
      }
      if (noteO[i] === 1) {
        console.log('shieeet5');
      }
      if (noteP[i] === 1) {
        console.log('shieeet6');
      }
      console.log('Iteration complete');
    } 

I have tried using setintervals but its not working for some reason.

Using React + Vite build in Electron without code sharing (different repositories)

I have a React + Vite application which is in a webapp repository and desktop repository which will be based on Electron.

I want to keep these both codebases separated but I want to use webapp’s build in my desktop application without using any boilerplate like vite-electron or electron-forge.

I can get the build and somehow sync the latest webapp build in desktop repository but I can’t run directly dist/index.html inside Electron.

It says:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///assets/index-169b8187.js. (Reason: CORS request not http).

How should I manage this situation?