Vcard IOS and Android

Ive been trying to make a website that can save emergency hotlines to phone using javascript.
is there anyway that i can save both to ios and android

I already done saving to android using vcard it imports all but in ios it only opens 1 certain contacts and not saving anyone has done this before hoping that there is a solution

Toggle hidden text based on variables

I have multiple texts which I want to display based on the input from a form from the previous page.

For example, if their answer meets certain criteria, in the controller I would make the TestEligibilty = True and if it doesn’t TestEligibility = False. and I would add it to viewbag.

ViewBag.TestEligibility = TestEligbility;

I have tried this:
If variable = true, display a text and if variable = false, hide the text

    <div class ="Test-view">
        <p>-test successful</p>
    </div>        

This is what I put in my code below

<script>
    var TestEligibility = @ViewBag.TestEligibility;
    if (TestEligibility = false) {
        $('#Test-view').hide();
    }
    else {
        $('#Test-view').show();
    }
    
</script>

Rendering an image from Firebase Storage in React Native Expo [duplicate]

My goal is to render multiple images from Firebase Storage and display them in my React Native (Expo-managed) app. The images are stored in folders for each ‘post’ or ‘report’, but some posts may have no images and some may have multiple. My current code does not display the image, but there aren’t any errors either. The download URL outputted in the getImg function is correct (upon testing).

I suspect the issue may be that the getImg function isn’t completing in time (there needs to be a promise), but I’m not completely sure.

My current code:

    const [posts, setPosts] = useState([]);
    const [loading, setLoading] = useState(true);
    const [start, setStart] = useState(0);
    const [images, setImages] = useState([]);

    const getImg = (path) => {
        getDownloadURL(sRef(storage, 'reports/' + path)).then((url) => {
            return url;
        });
    }

    useEffect(() => {
        const fetchPosts = () => {
            const postRef = ref(db, 'reports');
            const fetched = [];
        
            onValue(postRef, (snapshot) => {
                snapshot.forEach((post) => {
                    const report = post.val();
                    report.key = post.key;

                    for (let i = 0; i < report.images.length; i++) {
                        // here i am replacing the name of the file with the download URL
                        report.images[i] = getImg(report.key + "/" + report.images[i]);
                    }

                    fetched.push(report);
                }); 
                setPosts(fetched);
                setLoading(false);
            })
        }
        fetchPosts();
    }, [start]);

And part of the output:

<View style={styles.posts}>
   {posts.map(post => (
      <Pressable key={post.key} style={[styles.card, cardTheme]} onPress={() => {
         navigation.navigate('Report', {post: post});
      }}>
         <Text style={[styles.cardTitle, textTheme]}>{post.location}</Text>
         {post.images.length > 0 ? (
            <View style={styles.cardImages}>
               {post.images.map((image, index) => {
                  <Image key={index} source={{uri: post.images[index]}} style={styles.cardImage} />
               })}
            </View>
          ) : null}
         <Text style={styles.cardDate}>{post.date}</Text>
      </Pressable>
   ))}
</View>

Any help is appreciated! Thanks in advance.

Why this bare minimum Angular – WebTorrent setup is not working?

The setup seem straightforward.

Webtorrent usage reference

My setup:

import WebTorrent from 'webtorrent';

@Component({
  selector: 'app-root',
  standalone: true,
  template: `bla`,
})
export class App {
  client = new WebTorrent();
}

Stackblitz

results in:
enter image description here

WebTorrent: uTP not supported ReferenceError: process is not defined
    at node_modules/node-gyp-build/node-gyp-build.js (webtorrent.js?v=82fe16e7:930:16)
    at __require2 (chunk-NMEUP6WG.js?v=82fe16e7:50:50)
    at node_modules/node-gyp-build/index.js (webtorrent.js?v=82fe16e7:1121:24)
    at __require2 (chunk-NMEUP6WG.js?v=82fe16e7:50:50)
    at node_modules/utp-native/lib/binding.js (webtorrent.js?v=82fe16e7:1130:22)
    at __require2 (chunk-NMEUP6WG.js?v=82fe16e7:50:50)
    at node_modules/utp-native/index.js (webtorrent.js?v=82fe16e7:5932:19)
    at __require2 (chunk-NMEUP6WG.js?v=82fe16e7:50:50)
    at webtorrent.js?v=82fe16e7:6226:16
    at (stackblitzstartersbvjzbh-ox4a--4200--7dbe22a9.local-credentialless.webcontainer.io/disabled):node_modules/webtorrent/lib/utp.cjs (https://stackblitzstartersbvjzbh-ox4a--4200--7dbe22a9.local-credentialless.webcontainer.io/@fs/home/projects/stackblitz-starters-bvjzbh/.angular/cache/17.3.3/vite/deps/webtorrent.js?v=82fe16e7:6231:7)
(anonymous) @ webtorrent.js?v=82fe16e7:6228
(disabled):node_modules/webtorrent/lib/utp.cjs @ webtorrent.js?v=82fe16e7:6231
__require2 @ chunk-NMEUP6WG.js?v=82fe16e7:50
(anonymous) @ webtorrent.js?v=82fe16e7:13396
webtorrent.js?v=82fe16e7:6494 Uncaught ReferenceError: global is not defined
    at node_modules/randombytes/browser.js (webtorrent.js?v=82fe16e7:6494:19)
    at __require2 (chunk-NMEUP6WG.js?v=82fe16e7:50:50)
    at node_modules/k-bucket/index.js (webtorrent.js?v=82fe16e7:6527:24)
    at __require2 (chunk-NMEUP6WG.js?v=82fe16e7:50:50)
    at webtorrent.js?v=82fe16e7:13650:31

IPC Dialog in ElectronJS showing up behind main window after activated a second time

I’m using Electron and when I call the IPC dialog for the first time it shows up on top which is great but when I launch it any time after that it will now show up behind the main window which is not good as I will have the app be launched in fullscreen.

I have tried parenting the dialog to the main window but it continues with this problem until I restart the app, here is my current code:

main.js

ipcMain.handle('dialog:openDirectory', async () => {
                const { canceled, filePaths } = await dialog.showOpenDialog(mainWindow, {
                    properties: ['openDirectory']
                })

                if (canceled) {
                    return;
                } else {
                    return filePaths[0]
                }
            })

System Info:
OS: Ubuntu 22.04
Electron: ^29.1.5
NodeJS: v18.18.2

Invalid Hook Call while calling function into setInterval [duplicate]

Creating Native project and I’m fetching user’s location using custom getLocation function(it run perfectly) and i want to fetch location in every 5 sec so i’m calling getLocation function into setInterval function but it throws error…

**Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:

  1. You might have mismatching versions of React and the renderer (such as React DOM)
  2. You might be breaking the Rules of Hooks
  3. You might have more than one copy of React in the same app**

this is my getLocation function

import { useEffect, useState } from 'react';
import * as Location from 'expo-location';

const getLocation = () => {
    const [currentLocation, setCurrentLocation] = useState(null);
    
    useEffect(() => {
        (async () => {
            let { status } = await Location.requestForegroundPermissionsAsync();
            if (status !== 'granted') {
                return;
            }

            let location = await Location.getCurrentPositionAsync({});
            setCurrentLocation({lat:location?.coords.latitude, lon:location?.coords.longitude});
        })();
    }, []);
    
    console.log("Into Func", currentLocation);
    return currentLocation;
};

export default getLocation;

this is my home.js file from which i’m calling getLocation

const [loc, setLoc] = useState(null);

    useEffect(() => {
        const intervalId = setInterval(() => {
            let newLoc = getLocation();
            setLoc(newLoc);
            console.log("Updating location...");
        }, 5000);

        return () => clearInterval(intervalId);
    }, []);

    useEffect(() => {
        console.log("Location:", loc);
    }, [loc]);

i came to know that we cant use useEffect into another useEffect i tried to call setInterval outside the useEffect but still it throws same error.

may be the problem is in getLocation function

Nested list re-renders

I need to write a nested list component, which will render a list of names with a button to show children if present,

and apply the same logic recursively to child components,

(No libraries)

Json example :

[
  {
    "name": "Rosetta",
    "lastName": "Bins",
    "children": [
      {
        "name": "Tristian",
        "lastName": "Boehm",
        "children": [
          {
            "name": "Ulises",
            "lastName": "Mueller",
            "children": [
              { "name": "Carlo", "lastName": "Hagenes", "hasChildren": false },
              {
                "name": "Mozelle",
                "lastName": "Bauch",
                "children": [
                  {
                    "name": "Roxane",
                    "lastName": "Sauer",
                    "hasChildren": false
                  },
    ...

The catch is for child components to remember the state they’re in, if I open the child list and then collapse the parent list, child list should still be open next time.

I’ve tried the naive approach of keeping a map of all objects i’ve opened by giving them isOpen property and rendering conditionally, but I couldn’t figure out how to prevent re-renders since all components depend on the map which has a new pointer each render.

My friend advised me to try using react context API, which i did:

export const UserContext = createContext<UserContextType>({
    userStatus: {}, 
    toggleOpen: () => { }, 
})

export const UserContextProvider = ({ children }) => {
    const [userStatus, setUserStatus] = useState<UserListStateType>({});
    const toggleOpen = useCallback(
        (id: string) => {
            setUserStatus(prev => ({
                ...prev,
                [id]: {
                    ...prev[id],
                    isOpen: prev[id] ? !prev[id].isOpen : true,
                }
            }));
           
        }, []);
    return <UserContext.Provider value={{ userStatus, toggleOpen }}> {children} </UserContext.Provider>
}

And then shared the context across my User components

const _User: FC<UserPropsType> = ({
    user: { name, lastName, hasChildren, children },
    level,
    id,
}) => {
    const { userStatus, toggleOpen } = useContext(UserContext);
    
    const [isOpen, setOpen] = useState(false)

    useEffect(() => {
        setOpen(userStatus[id]?.isOpen ?? false);
    }, [userStatus]);


    let isLoading = false
    return (
        <div style={{ marginLeft: level * 20 }}>
            <div>
                {name} {lastName}
                {hasChildren && (
                    <button disabled={isLoading} onClick={() => toggleOpen(id)}>
                        {isOpen ? "Hide children" : "Show children"}
                    </button>
                )}
            </div>
            {isLoading ? <> Loading ...</> : isOpen && children?.map(item => (
                <User
                    key={`${item.name}--${item.lastName}`}
                    id={`${item.name}--${item.lastName}`}
                    user={item}
                    userStatus={userStatus}
                    level={level + 1}
                />
            ))}
        </div>
    )
}

I also tried configuring memo to somehow memoize it

export const User = memo(_User
    // , (prev, next) => {
    // const { id } = next;
    // const { isLoading: isLoadingNew, isOpen: isOpenNew } = next.userStatus[id];
    // const { isLoading: isLoadingOld, isOpen: isOpenOld } = prev.userStatus[id];
    // return isLoadingNew !== isLoadingOld || isOpenOld !== isOpenNew
    // }
);

But I still cant wrap my head around how to memoize the whole list while keeping tabs on which are collapsed and which are open, since I have to depend on the state of the map

Please assist, thank you in advance

Vue Router Delay Works on Route Change, But Not With Browser Navigation

I have a delay set up in my router config. It works when I change the route, but it doesn’t work when I use the browser’s back and forward navigation buttons. I need the viewport to always be on top on route change, both when I click on the router-link and browser’s navigation buttons.

export const router = createRouter({
    history: createWebHistory(),
    routes,
    scrollBehavior(to, from, savedPosition) {
        if (savedPosition || to.query.page) {
            return savedPosition;
        } else {
            return new Promise(resolve => {
                setTimeout(() => {
                    resolve({ left: 0, top: 0 });
                }, 400);
            });
        }
    },
});

Looking for a possible solution.

How to solve the problem with CORS policy

I makes a project where wants to use a socket.io.
Now I have an error in browser console:

Access to XMLHttpRequest at ‘https://back.escootrent.com/socket.io/?EIO=4&transport=polling&t=OwxDnkM’ from origin ‘https://www.escootrent.com’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

How you can see I use my sub-domains, with which averything brokes. Awary domain links with their directory.
Client directory is tha basic web application on html, css, js, php. And now to connect with server using io('https://back.escootrent.com/socket.io');
The other directory is server for socket.io with this code:
server.js

const express = require('express');
const https = require('https');
const fs = require('fs');

const app = express();
const options = {
  key: fs.readFileSync('./_.escootrent.com_private_key.key'),
  cert: fs.readFileSync('./escootrent.com_ssl_certificate.cer')
};
const server = https.createServer(options, app);
const io = require('socket.io')(server);

app.get('/chats', function(req, res) {
    res.send('answ');
});

io.on('connection', socket => {
    console.log('User connected', socket.id);
})

io.on('disconnect', () => {
    console.log('User disconnected', socket.id);
});

server.listen(443, (err) => {
    if (err) {
        throw Error(err);
    }
    console.log('Server started!');
});

All this based on OpenServer and works with local parametrs, but don`t work with domains.

I tried this and nothing changed

app.use((req, res, next) => {
  res.setHeader('Access-Control-Allow-Origin', 'https://www.escootrent.com');
  res.setHeader('Access-Control-Allow-Methods', 'GET, POST');
  res.setHeader('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept');
  next();
});
io.origins((origin, callback) => {
  if (origin === 'https://www.escootrent.com') { 
    callback(null, true);
  } else {
    callback('Origin not allowed', false);
  }
});
const cors = require('cors');
app.use(cors());

Android Studio Error: Valid XML document must have a root tag also Can not extract resource from com.android.aaptcompiler

Every time I try to run my application I get the error of my app failing with 2 errors in my Build Output tab:
First section of errors is:
Execution failed for task ':app:mergeDebugResources'.

A failure occurred while executing com.android.build.gradle.internal.res.ResourceCompilerRunnableResource compilation failed (Failed to compile values resource file
  •         Exception is:org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:mergeDebugResources'.at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:148)at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:282)at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:146)at    org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:134)at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:74)at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:78)at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:42)at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:331)at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:318)at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.lambda$execute$0(DefaultTaskExecutionGraph.java:314)at org.gradle.internal.operations.CurrentBuildOperationRef.with(CurrentBuildOperationRef.java:80)at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:314)at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:303)at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:463)at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:380)at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:47)Caused by: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing com.android.build.gradle.internal.res.ResourceCompilerRunnableat org.gradle.workers.internal.DefaultWorkerExecutor$WorkItemExecution.waitForCompletion(DefaultWorkerExecutor.java:283)at org.gradle.internal.work.DefaultAsyncWorkTracker.lambda$waitForItemsAndGatherFailures$2(DefaultAsyncWorkTracker.java:130)at org.gradle.internal.Factories$1.create(Factories.java:31)at org.gradle.internal.work.DefaultWorkerLeaseService.withoutLocks(DefaultWorkerLeaseService.java:336)at org.gradle.internal.work.DefaultWorkerLeaseService.withoutLocks(DefaultWorkerLeaseService.java:319)at org.gradle.internal.work.DefaultWorkerLeaseService.withoutLock(DefaultWorkerLeaseService.java:324)at org.gradle.internal.work.DefaultAsyncWorkTracker.waitForItemsAndGatherFailures(DefaultAsyncWorkTracker.java:126)at org.gradle.internal.work.DefaultAsyncWorkTracker.waitForItemsAndGatherFailures(DefaultAsyncWorkTracker.java:92)at org.gradle.internal.work.DefaultAsyncWorkTracker.waitForAll(DefaultAsyncWorkTracker.java:78)at org.gradle.internal.work.DefaultAsyncWorkTracker.waitForCompletion(DefaultAsyncWorkTracker.java:66)at org.gradle.api.internal.tasks.execution.TaskExecution$3.run(TaskExecution.java:256)at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:47)at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:73)at org.gradle.api.internal.tasks.execution.TaskExecution.executeAction(TaskExecution.java:233)at org.gradle.api.internal.tasks.execution.TaskExecution.executeActions(TaskExecution.java:216)at org.gradle.api.internal.tasks.execution.TaskExecution.executeWithPreviousOutputFiles(TaskExecution.java:199)at org.gradle.api.internal.tasks.execution.TaskExecution.execute(TaskExecution.java:166)at org.gradle.internal.execution.steps.ExecuteStep.executeInternal(ExecuteStep.java:105)at org.gradle.internal.execution.steps.ExecuteStep.access$000(ExecuteStep.java:44)at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:59)at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:56)at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:78)at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:56)at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:44)at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:67)at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:37)at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:41)at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:74)at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:55)at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:50)at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:28)at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.executeDelegateBroadcastingChanges(CaptureStateAfterExecutionStep.java:100)at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:72)at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:50)at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:40)at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:29)at org.gradle.internal.execution.steps.BuildCacheStep.executeWithoutCache(BuildCacheStep.java:179)at org.gradle.internal.execution.steps.BuildCacheStep.lambda$execute$1(BuildCacheStep.java:70)at org.gradle.internal.Either$Right.fold(Either.java:175)at org.gradle.internal.execution.caching.CachingState.fold(CachingState.java:59)at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:68)at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:46)at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:36)at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:25)at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:36)at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:22)at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:91)at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$2(SkipUpToDateStep.java:55)at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:55)at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:37)at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:65)at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:36)at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:37)at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:27)at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:77)at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:38)at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:108)at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:55)at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:71)at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:45)at org.gradle.internal.execution.steps.SkipEmptyWorkStep.executeWithNonEmptySources(SkipEmptyWorkStep.java:177)at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:81)at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:53)at org.gradle.internal.execution.steps.RemoveUntrackedExecutionStateStep.execute(RemoveUntrackedExecutionStateStep.java:32)at org.gradle.internal.execution.steps.RemoveUntrackedExecutionStateStep.execute(RemoveUntrackedExecutionStateStep.java:21)at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:38)at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:36)at org.gradle.internal.execution.steps.LoadPreviousExecutionStateStep.execute(LoadPreviousExecutionStateStep.java:23)at org.gradle.internal.execution.steps.CleanupStaleOutputsStep.execute(CleanupStaleOutputsStep.java:75)at org.gradle.internal.execution.steps.CleanupStaleOutputsStep.execute(CleanupStaleOutputsStep.java:41)at org.gradle.internal.execution.steps.ExecuteWorkBuildOperationFiringStep.lambda$execute$2(ExecuteWorkBuildOperationFiringStep.java:66)at org.gradle.internal.execution.steps.ExecuteWorkBuildOperationFiringStep.execute(ExecuteWorkBuildOperationFiringStep.java:66)at org.gradle.internal.execution.steps.ExecuteWorkBuildOperationFiringStep.execute(ExecuteWorkBuildOperationFiringStep.java:38)at org.gradle.internal.execution.steps.AssignWorkspaceStep.lambda$execute$0(AssignWorkspaceStep.java:32)at org.gradle.api.internal.tasks.execution.TaskExecution$4.withWorkspace(TaskExecution.java:293)at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:30)at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:21)at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:37)at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:27)at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:47)at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:34)at org.gradle.internal.execution.impl.DefaultExecutionEngine$1.execute(DefaultExecutionEngine.java:64)at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:145)at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:134)at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:74)at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:78)at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:42)at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:331)at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:318)at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.lambda$execute$0(DefaultTaskExecutionGraph.java:314)at org.gradle.internal.operations.CurrentBuildOperationRef.with(CurrentBuildOperationRef.java:80)at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:314)at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:303)at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:463)at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:380)at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:47)Caused by: com.android.aaptcompiler.ResourceCompilationException: Resource compilation failed (Failed to compile values resource file C:UsersRangerDesktopBible AppappbuildintermediatesincrementaldebugmergeDebugResourcesmerged.dirvaluesvalues.xml. Cause: java.lang.IllegalStateException: Can not extract resource from com.android.aaptcompiler.ParsedResource@5bcf3a3e.. Check logs for more details.at com.android.aaptcompiler.ResourceCompiler.compileResource(ResourceCompiler.kt:129)at com.android.build.gradle.internal.res.ResourceCompilerRunnable$Companion.compileSingleResource(ResourceCompilerRunnable.kt:34)at com.android.build.gradle.internal.res.ResourceCompilerRunnable.run(ResourceCompilerRunnable.kt:15)at com.android.build.gradle.internal.profile.ProfileAwareWorkAction.execute(ProfileAwareWorkAction.kt:74)at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:66)at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:62)at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:100)at org.gradle.workers.internal.NoIsolationWorkerFactory$1.lambda$execute$0(NoIsolationWorkerFactory.java:62)at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:78)at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:59)at org.gradle.workers.internal.DefaultWorkerExecutor.lambda$submitWork$0(DefaultWorkerExecutor.java:170)at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:187)at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.access$700(DefaultConditionalExecutionQueue.java:120)at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner$1.run(DefaultConditionalExecutionQueue.java:162)at org.gradle.internal.Factories$1.create(Factories.java:31)at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:264)at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:128)at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:133)at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:157)at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:126)... 2 moreCaused by: com.android.aaptcompiler.ResourceCompilationException: Failed to compile values resource file C:UsersRangerDesktopBible AppappbuildintermediatesincrementaldebugmergeDebugResourcesmerged.dirvaluesvalues.xmlat com.android.aaptcompiler.ResourceCompiler.compileTable(ResourceCompiler.kt:192)at com.android.aaptcompiler.ResourceCompiler.access$compileTable(ResourceCompiler.kt:1)at com.android.aaptcompiler.ResourceCompiler$getCompileMethod$1.invoke(ResourceCompiler.kt:138)at com.android.aaptcompiler.ResourceCompiler$getCompileMethod$1.invoke(ResourceCompiler.kt:138)at com.android.aaptcompiler.ResourceCompiler.compileResource(ResourceCompiler.kt:123)... 32 moreCaused by: java.lang.IllegalStateException: Can not extract resource from com.android.aaptcompiler.ParsedResource@5bcf3a3e.,Can not extract resource from com.android.aaptcompiler.ParsedResource@5ff0b59f.,Can not extract resource from com.android.aaptcompiler.ParsedResource@1af23005.,Can not extract resource from com.android.aaptcompiler.ParsedResource@99e6a12.,Can not extract resource from com.android.aaptcompiler.ParsedResource@2ba2afd5.,Can not extract resource from com.android.aaptcompiler.ParsedResource@3b89e8f8.,Can not extract resource from com.android.aaptcompiler.ParsedResource@659baec9.,Can not extract resource from com.android.aaptcompiler.ParsedResource@6cbc4654.,Can not extract resource from com.android.aaptcompiler.ParsedResource@24deab0a.,Can not extract resource from com.android.aaptcompiler.ParsedResource@50e44941.,Can not extract resource from com.android.aaptcompiler.ParsedResource@68315872.,Can not extract resource from com.android.aaptcompiler.ParsedResource@66b12dc6.,Can not extract resource from com.android.aaptcompiler.ParsedResource@37e64ce1.,Can not extract resource from com.android.aaptcompiler.ParsedResource@45baa51d.,Can not extract resource from com.android.aaptcompiler.ParsedResource@272a8710.,Can not extract resource from com.android.aaptcompiler.ParsedResource@489a512e.,Can not extract resource from [email protected] com.android.aaptcompiler.TableExtractor.extractResourceValues(TableExtractor.kt:270)at com.android.aaptcompiler.TableExtractor.extract(TableExtractor.kt:181)at com.android.aaptcompiler.ResourceCompiler.compileTable(ResourceCompiler.kt:188)... 36 more
    
BUILD FAILED in 2s24 actionable tasks: 1 executed, 23 up-to-date
Second section of errors is:Can not extract resource from com.android.aaptcompiler.ParsedResource@5bcf3a3e.,Can not extract resource from com.android.aaptcompiler.ParsedResource@5ff0b59f.,Can not extract resource from com.android.aaptcompiler.ParsedResource@1af23005.,Can not extract resource from com.android.aaptcompiler.ParsedResource@99e6a12.,Can not extract resource from com.android.aaptcompiler.ParsedResource@2ba2afd5.,Can not extract resource from com.android.aaptcompiler.ParsedResource@7124ab73.,Can not extract resource from com.android.aaptcompiler.ParsedResource@7addcf4a.,Can not extract resource from com.android.aaptcompiler.ParsedResource@69e4f9.,Can not extract resource from com.android.aaptcompiler.ParsedResource@3e0b2f26.,Can not extract resource from com.android.aaptcompiler.ParsedResource@6a2064a7.,Can not extract resource from com.android.aaptcompiler.ParsedResource@7e935136.,Can not extract resource from com.android.aaptcompiler.ParsedResource@31123c31.,Can not extract resource from com.android.aaptcompiler.ParsedResource@5607472a.,Can not extract resource from com.android.aaptcompiler.ParsedResource@3f6b0411.,Can not extract resource from com.android.aaptcompiler.ParsedResource@5b95e82b.,Can not extract resource from com.android.aaptcompiler.ParsedResource@7b46a4dc.,Can not extract resource from com.android.aaptcompiler.ParsedResource@17948289.,Can not extract resource from com.android.aaptcompiler.ParsedResource@703857e6.,Can not extract resource from com.android.aaptcompiler.ParsedResource@4183d7a.,Can not extract resource from com.android.aaptcompiler.ParsedResource@4a360961.,Can not extract resource from com.android.aaptcompiler.ParsedResource@79855a64.,Can not extract resource from com.android.aaptcompiler.ParsedResource@4bb0a5d5.,Can not extract resource from com.android.aaptcompiler.ParsedResource@e06b234.,Can not extract resource from com.android.aaptcompiler.ParsedResource@7401cf94.,Can not extract resource from com.android.aaptcompiler.ParsedResource@2784ed0a.,Can not extract resource from com.android.aaptcompiler.ParsedResource@69d46a22.,Can not extract resource from com.android.aaptcompiler.ParsedResource@5278e23e.,Can not extract resource from com.android.aaptcompiler.ParsedResource@287ffa8a.,Can not extract resource from com.android.aaptcompiler.ParsedResource@2813ae32.,Can not extract resource from com.android.aaptcompiler.ParsedResource@625c4468.,Can not extract resource from com.android.aaptcompiler.ParsedResource@77a0330f.,Can not extract resource from com.android.aaptcompiler.ParsedResource@20dc2cdb.,Can not extract resource from com.android.aaptcompiler.ParsedResource@158b74cc.,Can not extract resource from com.android.aaptcompiler.ParsedResource@15740d11.,Can not extract resource from com.android.aaptcompiler.ParsedResource@63ba6cfb.,Can not extract resource from com.android.aaptcompiler.ParsedResource@22c12ea3.,Can not extract resource from com.android.aaptcompiler.ParsedResource@6ca20323.,Can not extract resource from com.android.aaptcompiler.ParsedResource@598b8723.,Can not extract resource from com.android.aaptcompiler.ParsedResource@69e6f55d.,Can not extract resource from com.android.aaptcompiler.ParsedResource@42f97af4.,Can not extract resource from com.android.aaptcompiler.ParsedResource@3ebec293.,Can not extract resource from com.android.aaptcompiler.ParsedResource@3b89e8f8.,Can not extract resource from com.android.aaptcompiler.ParsedResource@659baec9.,Can not extract resource from com.android.aaptcompiler.ParsedResource@6cbc4654.,Can not extract resource from com.android.aaptcompiler.ParsedResource@24deab0a.,Can not extract resource from com.android.aaptcompiler.ParsedResource@50e44941.,Can not extract resource from com.android.aaptcompiler.ParsedResource@68315872.,Can not extract resource from com.android.aaptcompiler.ParsedResource@66b12dc6.,Can not extract resource from com.android.aaptcompiler.ParsedResource@37e64ce1.,Can not extract resource from com.android.aaptcompiler.ParsedResource@45baa51d.,Can not extract resource from com.android.aaptcompiler.ParsedResource@272a8710.,Can not extract resource from com.android.aaptcompiler.ParsedResource@489a512e.,Can not extract resource from com.android.aaptcompiler.ParsedResource@4d1e8d98.

Please help!

I'm also getting some other weird errors of "Valid XML document must have a root tag"
I know it's not wrong though because it's only having problems with 5 of the values when I used the same copy paste of those values in the other 22 values and there's no errors. I don't know what else to do.

Where do callback function parameters come from [duplicate]

<!DOCTYPE html>
<html>
<body>
<h1>JavaScript Arrays</h1>
<h2>The forEach() Method</h2>

<p>Call a function for each array element:</p>

<p id="demo"></p>

<script>
const fruits = ["Banana", "Orange", "Apple", "Mango"];

let text = "<ul>";
fruits.forEach(myFunction);
text += "</ul>";

document.getElementById("demo").innerHTML = text;

function myFunction(value) {
  text += "<li>" + value + "</li>";
} 
</script>

</body>
</html>

in this code i don’t get it why it used “value ” at the end of the code. it’s not declared anywhere. “item” was also used in another code the same way as this one.

it doesn’t make sense they way they used value and item.

how do i make a button submit to a database on multiple url

so i have the same button on multiple url (specifically three). so how do i create a code to have the same type of buttons submit into a database from different url

i have tried to use javascipt but non the less it did not work

    $.ajax({
        url: "your_api_endpoint",
        method: "POST", 
        data: {
            activity_id: $(this).data("id")
        },
        success: function(response) {
            if (response == "success") {
                $(".alert").remove(); 
                $("body").prepend("<div class='alert alert-success'>Added to favorites!</div>");
            } else {
                $(".alert").remove(); 
                $("body").prepend("<div class='alert alert-danger'>Failed to add to favorites.</div>");
            }


            setTimeout(function() {
                $(".alert").fadeOut("slow", function() {
                    $(this).remove();
                });
            }, 2000);
        },
        error: function(xhr, status, error) {
            // Handle any errors that occur during the AJAX request
            console.log("Error:", error);

How Nike Developed its Real-Time Shoe Customization Technology [closed]

I’m really interested in how Nike made it possible for people to customize and play around with 3D images of Air Force shoes on their website. I’m thinking of doing something similar for a different kind of shoe. Can you explain the technology behind what Nike did? Also,As web developer what do I need to know to do something like this for a different type of shoe ?

I trie to inspect nikes website but all I can see is a canvas I am not sure what is happening in the background to make something like this

Prevent an infinite loop while dispatching JavaScript events calling each other

I have a JavaScript Stimulus “controller” (I don’t believe the framework matters here) attached to three different nodes:

<div id="foo" data-controller="scanner"></div>
<div id="bar" data-controller="scanner"></div>
<div id="baz" data-controller="scanner"></div>

What I’m trying to accomplish seems like a simple task… not for me, as I don’t have an in-depth understanding of events, at least without causing an infinite loop:

  • When method activate is called (directly or as an event listener) the method deactivate should be called on other controllers (that is, except itself). For example: #foo->activate is called then #bar->deactivate and #baz->deactivate should run

  • In a similar way: #bar->deactivate is called then #foo->activate and #baz->activate should run.

It seems I can’t because an infinite loop occurs as soon as I call activate:

document.addEventListener('activate', this.activate)
document.addEventListener('deactivate', this.deactivate)

export default class {
    element; // the HTML element

    dispatch(event) {
       this.element.dispatchEvent(new CustomEvent(event, { bubbles: true }));
    }

    activate(e) {
      // Also check for !e (calling this method directly)
      if (!e || e.target === this.element) {
        this.dispatch('deactivate'); 
        document.addEventListener('keyup', this.onKeyUp);
      }
    }

    deactivate(e) {
      // Also check for !e (calling this method directly)
      if (!e || e.target !== this.element) {
        document.removeEventListener('keyup', this.onKeyUp);
        this.dispatch('activate');
      }
    }
}

Any help in developing this logic is much appreciated.

Fetch() Javascript method PUT not working. Error: 404

I have a problem, I make my discord bot but the Put method doesn’t work. It gives me an error. At the same time if I make a regular json file without attachment it works fine. What is my mistake? This problem has been plaguing me for three days.

This code is working:

JSON:

{
  "id": 1,
  "title": "How to Use Fetch to Make GET Requests in React",
  "content": "In this blog post, we will learn how to use the Fetch API to make GET requests in React...",
  "author": "David",
  "date": "2023-01-01"
}

JavaScript


    const data = {
        title: "How to Use Fetch to Make PUT Requests in React",
        content: "In this blog post, we will learn how to use the Fetch API to make PUT requests in React..."
      };
    
      const requestOptions = {
        method: "PUT", // Specify the request method
        headers: { "Content-Type": "application/json" }, // Specify the content type
        body: JSON.stringify(data) // Send the data in JSON format
      };
      
      // Make the request
      fetch("http://localhost:3000/economy", requestOptions)
        .then(response => response.json()) // Parse the response as JSON
        .then(data => console.log(data)) // Do something with the data
        .catch(error => console.error(error)); // Handle errors
    


I tried making attachments as well as sending changes:

    fetch("http://localhost:3000/economy")
    .then(economy => economy.json())
    .then(test1 => {
    
    let gettur = test1[0].op[0].server


      let edit = (test1[0].op[0].server = "Bubalo");
    
      console.log(edit);
    
    
      const respond = fetch("http://localhost:3000/economy", {
        method: "PUT",
        headers: {
          Accept: "application/json",
          "Content-Type": "application/json",
        },
        body: JSON.stringify(),
      })
    .then (response=>console.log(response))
    
      console.log(gettur);
    });

JSON:


{
  "economy": [
    {
      "op": [
        {
          "server": "1089497578141388920",
          "users": [
            {
              "id": "950379710284718111",
              "cash": 200,
              "bank": 300
            },
            {
              "id": "768486511531393024",
              "cash": 0,
              "bank": 2000
            }
          ]
        },
        {
          "server": "1089497578141388720",
          "users": [
            {
              "id": "950379710284718111",
              "cash": 200,
              "bank": 300
            },
            {
              "id": "768486511531393024",
              "cash": 0,
              "bank": 2000
            }
          ]
        }
      ],
      "id": "5b91"
    }
  ]
}

Error 404:

Terminal