Es findet nicht mein Hauptmenue.js [closed]

Ich programmiere erst seit kurzem und komme grad nicht weiter.

Ich arbeite an einem Projekt und irgendwie wird das Hauptmenue.js nicht mitintegriert. Ich habe jetzt mal nicht die anderen .js datein beigefügt da die grad keine rollen spielen.

Ich kriege es hin das Index mit Electron zu öffnen, dennoch erscheinen nur die drei Buttons, wenn ich drauf drücke passiert nicht sonderlich was. Der plan war das der Hauptmenue.js Skript sich dann öffnet.

Zudem sind folgende Fehler angezeigt im “browswer fenster”:

Unable to load preload script: C:UserskwanjOneDriveProjekteDD2preload.js
(
Error: module not found: ./Hauptmenue
    at preloadRequire (VM4 sandbox_bundle:2:82057)
    at <anonymous>:2:22
    at runPreloadScript (VM4 sandbox_bundle:2:82809)
    at VM4 sandbox_bundle:2:83068
    at VM4 sandbox_bundle:2:83223
    at ___electron_webpack_init__ (VM4 sandbox_bundle:2:83227)
    at VM4 sandbox_bundle:2:83350
(
Uncaught ReferenceError: require is not defined
    at renderer.js:2:20
Uncaught SyntaxError: Identifier 'Hauptmenue' has already been declared (at Hauptmenue.js:1:1)

Hier meine Codes:

index.js

const { app, BrowserWindow } = require('electron');
const path = require('path');

function createWindow() {
    const mainWindow = new BrowserWindow({
      width: 800,
      height: 600,
      webPreferences: {
        sandbox: true,
        nodeIntegration: true,
        preload: path.join(__dirname, 'preload.js') // Replace 'preload.js' with the filename of your preload script
      }
    });
  
    mainWindow.loadFile('index.html');
    mainWindow.webContents.openDevTools();
  }
  

// The following code creates the main window of the application using Electron. The window is set to 800 x 600 pixels and includes the nodeIntegration feature to allow the use of Node.js APIs in the renderer process. The window also loads the index.html file and opens the DevTools.

app.whenReady().then(createWindow);

// The app.whenReady() method waits until the app's ready event is emitted before creating the main window.

app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') {
    app.quit();
  }
});

// The app.on('window-all-closed') method listens for the window-all-closed event, which is emitted when all windows have been closed. If the platform is not macOS, the app quits.

app.on('activate', () => {
  if (BrowserWindow.getAllWindows().length === 0) {
    createWindow();
  }
});

preload.js

const Hauptmenue = require('./Hauptmenue');
const CharakterErstellung = require('./CharakterErstellung');
const Geschichte = require('./Geschichte');

window.Hauptmenue = Hauptmenue;
window.CharakterErstellung = CharakterErstellung;
window.Geschichte = Geschichte;

renderer.js

// renderer.js
const Hauptmenue = require('./Hauptmenue');
const hauptmenue = new Hauptmenue();

document.getElementById('charakterErstellung').addEventListener('click', () => {
  hauptmenue.charakterErstellung();
});

document.getElementById('spielLaden').addEventListener('click', () => {
  hauptmenue.spielLaden();
});

document.getElementById('geschichteAuswählen').addEventListener('click', () => {
  hauptmenue.geschichteAuswählen();
});

index.html

<!-- index.html -->
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>Meine Anwendung</title>
  </head>
  <body>
    <button id="charakterErstellung">Charakter erstellen</button>
    <button id="spielLaden">Spiel laden</button>
    <button id="geschichteAuswählen">Geschichte auswählen</button>

    <!-- Binden Sie die renderer.js-Datei ein -->
    <script src="renderer.js"></script>

    <!-- Binden Sie die Hauptmenue.js-Datei ein -->
    <script src="./Hauptmenue.js"></script>
  </body>
</html>

Hauptmenue.js

const Hauptmenue = require('./Hauptmenue');
const hauptmenue = new Hauptmenue();

document.getElementById('charakterErstellung').addEventListener('click', () => {
  hauptmenue.charakterErstellung();
});

document.getElementById('spielLaden').addEventListener('click', () => {
  hauptmenue.spielLaden();
});

document.getElementById('geschichteAuswählen').addEventListener('click', () => {
  hauptmenue.geschichteAuswählen();
});

// The above code requires the Hauptmenue module and creates a new instance of it. It also adds event listeners to the three buttons on the web page, which call the corresponding methods of the hauptmenue object when clicked.

Hab schon einiges probiert, aber komme einfach nicht weiter. Habe mit verschiedenen Namen probiert etc. Mir fällt jetzt sonst kein weiter Weg ein.

why i am not able to change the source of image using DOM?

    
            <img id ="image" src="E:freecodecampprojectsReviewsfblack.jpg"   alt="">
            

—– HTML ENDS HERE —-

const reviews = [
    {
        id:1,
        photo : "E:freecodecampprojectsReviewsfblack.jpg",
        fullname: "Sara John",
        job: "UX DESIGNER",
        text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
    },
    {
        id:2,
        photo : "E:freecodecampprojectsReviewsfkorean.jpg",
        fullname: "Murakami",
        job: "GRAPHIC DESIGNER",
        text: "As designers attempting to creating functional work, oftentimes we are required to make our designs look as finished as possible. For example, if you are designing a brand new website for someone, most times you will have to make sure the prototype looks finished by inserting text or photos or what have you.",
    },
    
];

const profileImage = document.getElementById("image");




let currentItem = 1;

window.addEventListener("DOMContentLoaded",function(){
    const item = reviews[currentItem];
    profileImage.src = item.photo;
    
});

above is the full code of javascript file

Q. Inside function, all is working except profileImage.

In above profileImage.src = item.photo; should change the profile photo.

If toggle one is being switched off by the user then toggle two should be switched on

I am quite new to knockoutjs and I am trying to create two toggles. When toggle one is switched off and then toggle two is switched off by the user, toggle one should be switched on and vice versa.

function alternatetogglesWithOrWithoutCreditRequests() {
            if (!viewModel.withPendingCreditRequests()) {
                viewModel.withoutPendingCreditRequests(true)
            }
            else if (!viewModel.withoutPendingCreditRequests()) {
                viewModel.withPendingCreditRequests(true)
            }
        }

This code above does not work all the time because in both cases the withPendingCreditRequests and the withoutPendingCredit observables are false.

Below is the html for the toggles:

    <div>
         <toggle-switch params="enable: invoiceFiltersActive, checked: withPendingCreditRequests, label: 'With Pending Credit Requests'"> 
         </toggle-switch>
    </div>
    <div>
         <toggle-switch params="enable: invoiceFiltersActive, checked: withoutPendingCreditRequests, label: 'Without Pending Credit Requests'">
         </toggle-switch>
    </div>

Cubejs: use data from related table

I have the following schemas:
Project and Orders, with Orders being a hasMany relationship to Projects.

I need to create a measure in Projects that sums the column fee from all related Orders, so I have done the following

profit: {
      type: `sum`,
      sql: `${Orders}.fee`,
      shown: true
    }

which produces the error:

Error: 'Projects.profit' references cubes that lead to row multiplication. Please rewrite it using sub query.

Dynamic Object Property Question with Reduce Function

I wanted to ask a simple question about dynamic object properties.
In this example function I made, I noticed that I need square brackets between the cur.name variable but not for cur.age in the return statement. I found that it was something about dynamic object properties but was unsure of when I exactly need square brackets for parameters. Could I ask when I need square brackets?

Here is an example function:

const array = [
  {name: 'A', age: 1},
  {name: 'B', age: 2},
  {name: 'C', age: 3},
];

const example = (array) => {
    return array.reduce((acc, cur) => {return {...acc, [cur.name]: cur.age} }, {})
}

console.log(example(array));

//Output that I want is {A: 1, B: 2, C: 3} and it works.

How to format x-axis time scale values in Chart.js v4.2.1

I am not able to format the display format of Time. I am using chart.js v4.2.1 and date-fns v3.0.0(this as script from cdnjs).
I am able to get the unit but the display format I want is Day of a week day.Month (e.g: Mo 12.04, Tue 13.04, etc…)

Here is the code:

scales: {
            x: {
                type: 'time',
                time: {
                    unit: 'day',
                    displayFormats: {
                        day: 'need to be done'
                    }
                }
            }

I am writing a project with flask (for python) and when I run from the Visual Studio Code 2. The project included html files I got this error message;

jinja2.exceptions.TemplateSyntaxError: expected token ‘,’, got ‘index'[enter image description here](https://i.stack.imgur.com/VIerN.png)

This was the code block from where I encountered the challenge

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <link
      rel="stylesheet"
      href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
      integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
      crossorigin="anonymous"
    />
    <link
      rel="stylesheet"
      href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
      crossorigin="anonymous"
    />

    <title>{% block title %}Home{% endblock %}</title>
  </head>
  <body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
      <button
        class="navbar-toggler"
        type="button"
        data-toggle="collapse"
        data-target="#navbar"
      >
        <span class="navbar-toggler-icon"></span>
      </button>
      <div class="collapse navbar-collapse" id="navbar">
        <div class="navbar-nav">
          <a class="nav-item nav-link" id="login" href="/login">Login</a>
          <a class="nav-item nav-link" id="signUp" href="/sign-up">Sign Up</a>
          <a class="nav-item nav-link" id="logout" href="/logout">Logout</a>
          <a class="nav-item nav-link" id="home" href="/">Home</a>
        </div>
      </div>
    </nav>

    <script
      src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
      integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
      crossorigin="anonymous"
    ></script>
    <script
      src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
      integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
      crossorigin="anonymous"
    ></script>
    <script
      src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
      integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
      crossorigin="anonymous"
    ></script>

    <script
      type="text/javascript"
      src="{{ url_for('static, filename='index.js') }}"
    ></script>
  </body>
</html>

PLEASE I WILL APPRECIATE SOME INSIGHTS AS TO WHAT I WAS DOING WRONG

Javascript modify existing array with object of different key

I’ve got this snippet of code

const name = 'test1'
const payload = [
    {
        "manSegChildId": "5497",
        "manSegChildDesc": "test4"
    },
    {
        "manSegChildId": "5314",
        "manSegChildDesc": "test1"
    },
    {

        "manSegChildId": "5159",
        "manSegChildDesc": "test5"
    }
]

const newObj = payload.map(nameObj => {
  if(nameObj.manSegChildDesc === name) {
    return {
    "id": nameObj.manSegChildId,
    "label" : nameObj.manSegChildDesc,
    "disabled": true
    }
  }
});

console.log(newObj)

I need simply an object I’m returning and not an array and not this undefined ones. Also, is there any optimal way so perform this changes
expected O/P

{
   "id": 5314,
   "label" : "test1",
   "disabled": true
 }

ng-http-loader keeps on loading in angular electron app

I am sending an event from my electron main process to angular using IPC communication as below:

//in main.js

win.webContents.send(‘info’);

//in angular file which is listening to this event

this.electronService.ipcRenderer.on('info', () => {
  // calling a function here which is performing a HTTP request
})

I am using ng-http-loader to show a loader whenever a HTTP request is made. The problem I am facing is that the loader keeps alive (keeps on loading) here. I am not able to understand this behavior that why this is happening because it is working fine everywhere else.
The problem is coming only when I am sending the event from electron to angular. Can anybody help?

How to show loading of table whenever List filter changes in React Admin

Is there any way to get the loading or fetching state of Data provider in react admin?
So that we can show shimmer or loader on tables till the data fetching is done.

I have tried to get using useContextList() hook inside MyActions component but it don’t trigger. Sometimes it show or not.

 <List
            {...props}
            title="Data"
            exporter={false}
            filter={filter}
            empty={false}
            actions={<MyActions filter={filter} />}
>
    <Datagrid>
     <TextField source="name" label="Name" />
     <TextField source="age" label="Age" />
     <TextField source="gender" label="Gender" />
    </Datagrid>
</List>

Tipo de dado inexistente [closed]

Tenho uma chamada de api que um dos dados retornados é do tipo ENUM, porém o looker studio não ler ou não aceita este tipo de dados, já tentei formas de converter ele, mas não funciona, alguém teria alguma solução para converter ou ajustar?

vi sobre criar um novo FieldType, mas não sei como realizar o upload do arquivo com o novo fieldtype.

Chamar uma api para receber todos os dados dela.

Block local holidays and sundays at the native date-picker of HTML5

As far as possible, I avoid using third party resources and I prefer natives. For a project, I need the native HTML5 date container but showing local vacations and blocked sundays.

Many third-party components/plugins allow them to spend the holidays, but do not use the native date-picker, but are customized. I prefer the native not to have to deal with the Browser and the device being used (desktop, Android or iOS).

I will use min="xxxx-xx-xx" and max="xxxx-xx-xx" to establish the range of days available to choose, but is it possible to block specific days within that range or do I have to use the resource of a third?

Sharing code logic between php and javascript

I have a website that does some complex math on the server side (php) and on the client side (javascript). The math is identical on both sides, and the code was manually translated between the languages. The problem is in code maintenance: one always needs to update and validate both sides when doing a modification. Is there a way to have to maintain only one side, and have the other side reflect the changes?

Any other options? Are there automatic code translaters that could auto-generate some core files?

One solution not considered si to do ajax requests to the server instead of doing the math client-side. This has been rejected due to the response time being too long.