Handlebars: Access has been denied to resolve the property “status” because it is not an “own property” of its parent

GET /admin/add-product 200 70.156 ms – 3932
Handlebars: Access has been denied to resolve the property “status” because it is not an “own property” of its parent.
You can add a runtime option to disable the check or this warning:
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details
POST /admin/add-product 404 31.120 ms – 3921

can anyone help me to slove this problem . I tried submiting a form to collect data in admin page but the res.post is not working ,The browser shows ‘not found’ and the above error message is from the console.but the nodemon still continues to run

app.js file

var createError = require('http-errors');
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');
const { engine : hbs } = require("express-handlebars")
var fileUpload = require('express-fileupload')
var userRouter = require('./routes/user');
var adminRouter = require('./routes/admin');
var handlebars = require('handlebars')
const template = handlebars.compile("{{aString.trim}}");
const result = template(
  { aString: "  abc  " },
  {
    allowedProtoMethods: {
      trim: true
    }
  }
);
var app = express();

// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'hbs');
app.engine('hbs',hbs({extname:'hbs',defaultLayout:'layout',layoutsDir:__dirname+'/views/layout/',partialsDir:__dirname+'/views/partials/'}))
app.use(fileUpload())
app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));

app.use('/', userRouter);
app.use('/admin', adminRouter);

// catch 404 and forward to error handler
app.use(function(req, res, next) {
  next(createError(404));
});

// error handler
app.use(function(err, req, res, next) {
  // set locals, only providing error in development
  res.locals.message = err.message;
  res.locals.error = req.app.get('env') === 'development' ? err : {};

  // render the error page
  res.status(err.status || 500);
  res.render('error');
});

module.exports = app;

admin.js file







var express = require('express');
const { log } = require('handlebars');
var router = express.Router();

/* GET users listing. */
router.get('/', function(req, res, next) {

  let products = [
    {
        name:"Apple iPhone 15",
        description:"Apple iPhone 15 (128 GB) - Black",
        category:"Mobile",
        price:"₹72,690",
        image:"https://m.media-amazon.com/images/I/71657TiFeHL._SX679_.jpg"
    },
    {
        name:"Apple iPhone 15 Plus",
        description:"Apple iPhone 15 Plus (128 GB) - Blue",
        category:"Mobile",
        price:"₹80,990",
        image:"https://m.media-amazon.com/images/I/71PjpS59XLL._SX679_.jpg"
    },
    {
        name:"Apple iPhone 15 Pro",
        description:"Apple iPhone 15 Pro (1 TB) - Black Titanium",
        category:"Mobile",
        price:"₹1,77,990",
        image:"https://m.media-amazon.com/images/I/81+GIkwqLIL._SX679_.jpg"
    },
    {
        name:"Apple iPhone 15 Pro Max",
        description:"Apple iPhone 15 Pro Max (256 GB) - Black Titanium",
        category:"Mobile",
        price:"₹1,48,900",
        image:"https://m.media-amazon.com/images/I/81Os1SDWpcL._SX679_.jpg"
    }
]

  res.render('admin/view-products',{products,admin:true})
});

router.get('/add-product',(req,res)=>{
  res.render('admin/add-product')
})

router.post('/admin/add-product',(req,res)=>{
    console.log(req.body);
    console.log(req.files.Image);
})

module.exports = router;

add-product.hbs file

<section>
    <div class="container">
        <div class="row">
            <div class="col-md-6">
                <h2 class="text-center">Add Product</h2>
                <form action="/admin/add-product" method="post" enctype="multipart/form-data">
                
                    <label for="">Name</label>
                    <input type="text" name="Name" class="form-control">

                    <label for="">Description</label>
                    <input type="text" name="Description" class="form-control">

                    <label for="">Category</label>
                    <input type="text" name="Category" class="form-control">

                    <label for="">Price</label>
                    <input type="text" name="Price" class="form-control">

                    <label for="">Image</label>
                    <input type="file" name="Image" class="form-control">

                    <br>

                    <button type="submit" class="btn btn-success">Submit</button>

                </form>
            </div>
        </div>
    </div>
</section>

Image reveal on hover does not work in Safari

I used a a cool js script to have a creative ang engaging section on a new client site where the user can hover over a word and a image will then reveal itsself. I found the following codepen that does exactly what I want.

https://codepen.io/RMKNGY/pen/rrpzgW

This is the script>

const items = document.querySelectorAll('.item')
const image = document.querySelector('img')

items.forEach((el) => {
  el.addEventListener('mouseover', (e) => {
    imageData = e.target.getAttribute('data-image')
    console.log(imageData)
    e.target.style.zIndex = 99
    image.setAttribute('src', imageData)
  })
  el.addEventListener('mousemove', (e) => {
    image.style.top = e.clientY + 'px'
    image.style.left = e.clientX + 'px'
  })
  el.addEventListener('mouseleave', (e) => {
    e.target.style.zIndex = 1
    image.setAttribute('src', '')
  })
})

I integrated this section on my shopify site and it all works well in chrome, firefox and edge.

But it doesn’t in safari. There are weird glitches and mostly the first image pops up but then sometime does not hide again on mouse out. At best you have to open the codepen in safari and check it out for yourself.

The script uses a mouseover and mousemove and mouseleave Eventlistener to replace the image src=”” when the mouse hovers. Again, this script works perfect in all the other browsers but not in safari.

Does anyone know how to fix that?

I already tried to replace const with var and several more small detail changes based on some comments I found on stackoverflow but nothing really worked.

Any way to automate filling circles into gaps on a circle grid with some missing circles

I have a grid of circles with holes. I copy and paste circles into the holes. Is there any way this could be automated? I have a script to remove hidden circles behind circles so maybe its the case of finding a way to populate all then remove the ones behind. Just need to know if its possible really. Thanks for any guidance.

i copy and paste currently in illustrator

“NetworkError when attempting to fetch resource” in JavaScript fetch despite successful server-side file download

I’m encountering a “NetworkError when attempting to fetch resource.” error in a fetch call on the client-side and then a following page refresh, even though my server-side code successfully fetches and downloads the image. I’m not sure why the client is throwing this error when the server indicates success.

Front-end API call:

//config.servername = ""         my package.json is proxying to my back end on localhost
export const uploadCoverImage = async (isbn, imageUrl) => {
  try {
    const response = await fetch(`${config.servername}/api/downloadCover/${isbn}`, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({ imageUrl }),
    });

    if (!response.ok) {
      throw new Error(`HTTP error! Status: ${response.status}`);
    }

    return await response.json();
  } catch (error) {
    console.error('Error uploading cover image', error);
    throw error;
  }
};

Server-side endpoint:

app.post('/api/downloadCover/:isbn', async (req, res) => {
  const { isbn } = req.params;
  const { imageUrl } = req.body;

  if (!imageUrl) {
    return res.status(400).json({ message: "Image URL is required" });
  }

  const destination = path.join(__dirname, '../client/public/covers', `${isbn}.jpg`);
  const file = fs.createWriteStream(destination);

  https.get(imageUrl, (response) => {
    if (response.statusCode !== 200) {
      res.status(500).json({ message: 'Failed to fetch image', error: `Server responded with status code ${response.statusCode}` });
      return;
    }

    response.pipe(file);

    file.on('finish', () => {
      file.close();
      res.json({ message: 'Image downloaded successfully' });
    });
  }).on('error', (err) => {
    console.error('Error fetching the image:', err.message);
    fs.unlink(destination, () => res.status(500).json({ message: 'Error fetching the image', error: err.message }));
  });

  file.on('error', (err) => {
    console.error('Error writing the file:', err.message);
    fs.unlink(destination, () => res.status(500).json({ message: 'Error writing the image', error: err.message }));
  });
});

Despite these efforts, the client still throws a “NetworkError when attempting to fetch resource.” error. What could be causing this issue, and how can I resolve it?

What I’ve tried:

  • Checked the server logs, and the image is downloaded successfully.
  • Ensured the server responds correctly after the image is downloaded.
  • Verified that there are no network issues between the client and server, the server and client are on localhost.
  • Enables cors and allowed localhost.
  • Enabled proxy in json.packages for he server
  • Logged res on the server and compared to another endpoint looking for anomalies.
  • Inspected network tab, no response is present.
  • Inspected traceback, the error is thrown by the fetch itself in overrideMethod

How do I fix the error code for JavaFX in NetBeans

When I’m going to run my code I’m getting the following error codes:

Java 15 has removed Nashorn, you must provide an engine for running JavaScript yourself. 
GraalVM JavaScript currently is the preferred option.
BUILD FAILED
C:UsersnatasOneDriveDocumentsNetBeansProjectsKilometerMilesConverternbprojectjfx-impl.xml:1251: The following error occurred while executing this line:
C:UsersnatasOneDriveDocumentsNetBeansProjectsKilometerMilesConverternbprojectjfx-impl.xml:1259: Unable to create javax script engine for javascript

I currently have Apache NetBeans IDE 21 with libraries JavaFX22, JavaSDK (among others) already installed.

I imported the GraalVM Javascript as a Library but am I meant to upload this elsewhere? Thanks for any help, I’m a new Java programming student, so I greatly appreciate it!

This is the full output when running my project:

-mark-project-state-running:

-pre-init:

-init-private:

-init-user:

-init-project:

-check-clean-if-config-changed:

-clean-if-config-changed:

-init-macrodef-property:

-init-modules-supported:

-do-init:

-check-property-javafx.sdk:

-check-platform-home-fxsdk-java:

-set-platform-home-fxsdk-java:

-check-platform-home-java:

-set-platform-home-java:

-check-platform-home-probjdk-java:

-set-platform-home-probjdk-java:

-check-platform-home-envjdk-java:

-set-platform-home-envjdk-java:

-check-property-javafx.runtime:

-check-platform-home-fxrt-java:

-set-platform-home-fxrt-java:

-check-platform-home-jre-java:

-set-platform-home-jre-java:

-check-platform-home:

-check-jdk-version:

-check-jfxrt-in-fxrt:

-set-jfxrt-in-fxrt-old:

-set-jfxrt-in-fxrt-new:

-set-jfxrt-in-fxrt-mods:

-check-jfxrt-in-fxsdk-jre:

-set-jfxrt-in-fxsdk-jre-old:

-set-jfxrt-in-fxsdk-jre-new:

-check-jfxrt-in-fxsdk-rt:

-set-jfxrt-in-fxsdk-rt-old:

-set-jfxrt-in-fxsdk-rt-new:

-check-jfxrt-in-platform-home-jre:

-set-jfxrt-in-platform-home-jre-old:

-set-jfxrt-in-platform-home-jre-new:

-check-jfxrt-in-platform-home-rt:

-set-jfxrt-in-platform-home-rt-old:

-set-jfxrt-in-platform-home-rt-new:

-check-jfxrt-modules-in-platform-home:

-set-jfxrt-modules-in-platform-home:

-check-jfxrt-in-jre:

-set-jfxrt-in-jre-old:

-set-jfxrt-in-jre-new:

-set-jfxrt-in-jre-mods:

-check-jfxrt-in-envjdk-jre:

-set-jfxrt-in-envjdk-jre-old:

-set-jfxrt-in-envjdk-jre-new:

-check-jfxrt-modules-in-envjdk:

-set-jfxrt-modules-in-envjdk:

-pre-check-jfx-runtime:

-check-jfx-runtime:

-check-project:

-warn-of-preloader:

-post-init:

-init-check:

-init-ap-cmdline-properties:

-init-macrodef-modulename:

-init-source-module-properties:

-init-macrodef-javac-with-module:

-init-macrodef-javac-with-processors:

-init-macrodef-javac-without-processors:

-init-macrodef-javac:

-init-macrodef-test-impl:

-init-macrodef-junit-init:

-init-test-properties:

-init-macrodef-junit-prototype-with-module:

-init-macrodef-junit-prototype-without-module:

-init-macrodef-junit-single:

-init-macrodef-junit-batch:

-init-macrodef-junit:

-init-macrodef-junit-impl:

-init-macrodef-testng:

-init-macrodef-testng-impl:

-init-macrodef-test:

-init-macrodef-junit-debug-impl:

-init-macrodef-test-debug-junit:

-init-macrodef-testng-debug:

-init-macrodef-testng-debug-impl:

-init-macrodef-test-debug-testng:

-init-macrodef-test-debug:

-init-debug-args:

-init-macrodef-nbjpda:

-init-macrodef-debug:

-init-macrodef-java-with-module:

-init-macrodef-java-with-unnamed-module:

-init-macrodef-java-without-module:

-init-macrodef-java:

-init-presetdef-jar:

-init-ap-cmdline-supported:

-init-ap-cmdline:

init:

-deps-jar-init:
   [delete] Deleting: C:UsersnatasOneDriveDocumentsNetBeansProjectsKilometerMilesConverterbuildbuilt-jar.properties

deps-jar:

-warn-already-built-jar:
[propertyfile] Updating property file: C:UsersnatasOneDriveDocumentsNetBeansProjectsKilometerMilesConverterbuildbuilt-jar.properties

-check-automatic-build:

-clean-after-automatic-build:

-verify-automatic-build:

-pre-pre-compile:

-pre-compile:

-copy-persistence-xml:

-compile-depend:

-do-compile:

-post-compile:

compile:

-pre-jar:

-check-module-main-class:

-set-module-main-class:

-pre-pre-jar:

-do-jar-create-manifest:

-do-jar-copy-manifest:

-do-jar-set-mainclass:

-do-jar-set-profile:

-do-jar-set-splashscreen:

-check-do-mkdist:

-do-jar-jar:

-init-macrodef-copylibs:

-do-jar-copylibs:

-do-jar-delete-manifest:

-do-jar-without-libraries:

-do-jar-with-libraries:

-jfx-copylibs-warning:

-jfx-copylibs:
Java 15 has removed Nashorn, you must provide an engine for running JavaScript yourself. GraalVM JavaScript currently is the preferred option.

BUILD FAILED
C:UsersnatasOneDriveDocumentsNetBeansProjectsKilometerMilesConverternbprojectjfx-impl.xml:1251: The following error occurred while executing this line:
C:UsersnatasOneDriveDocumentsNetBeansProjectsKilometerMilesConverternbprojectjfx-impl.xml:1259: Unable to create javax script engine for javascript

Total time: 0 seconds
Result: 1
BUILD SUCCESSFUL (total time: 1 second)

How to read cookie expiration date in Express?

I want to read the expiration date of a cookie.
This is how I set up a cookie:

res.cookie("tokenCookie", token, {
      secure: false,
      httpOnly: true,
      expires: dayjs().add(1, "hour").toDate(),
    });

I used the cookie-parser library and req.cookies returned the key value pair of the cookie and its value. However, the value doesn’t include the expiration date of the cookie, only the value I assigned the cookie to store.

{
  tokenCookie: 'sample.auth.token'
}

How can I read or access the expiration date in the expires attribute?

Why tailwind typography not render

<script setup>
import { computed } from "vue"
import { marked } from "marked"
const props = defineProps({
  history: {
    type: Array,
    default: () => [],
    required: true,
  },
})
const histories = computed(() => {
  console.log("History recompute")
  return props.history
})
</script>
<template>
  <div class="w-full h-full max-h-fit flex flex-col gap-2 overflow-auto">
    <div
      class="max-h-fit w-full bg-black flex flex-row"
      alt="container"
      v-for="(history, index) in histories"
      :key="index"
    >
      <div class="avatar p-3 pt-6 max-h-28">
        <div class="w-12 max-h-12 rounded">
          <img
            src="https://media.newyorker.com/photos/59095bb86552fa0be682d9d0/master/pass/Monkey-Selfie.jpg"
            alt=""
          />
        </div>
      </div>
      <div class="p-7 text-justify max-h-fit">
        <div>
          {{ history.request.content }}
        </div>
        <div v-if="history.response.content === ''">
          <span class="loading loading-ring loading-sm"></span>
        </div>
        <div v-else>
          <article class="prose">
            {{ marked.parse(history.response.content) }}
          </article>
        </div>
      </div>
    </div>
  </div>
</template>

<style></style>

I try to use tailwind typography plugin but it not render mark down to tag HTML for me I try to use marked to change markdown to HTML tag before use tailwind typography but it not working please helpme

How to shave off a fixed number of pixels from a PNG with a transparent background using ImageMagick

I want to use ImageMagick to go along the outside of any shape and shave off a desired number of pixels. The shave option only applies in the x and y directions. Whereas I need it to applying along the entire edge of the shape. Does anyone know if this can be done with ImageMagick? Would really appreciate some pointers. Even if it’s to a specific option. I can’t seem to find anything that will do it, but it’s such a powerful library that I would think it should be possible.

Thanks.

enter image description here

I can’t build web in flutter [closed]

I am trying to build my web page using the command (flutter build web), when the build process finishes and I go to the build/web folder where the index.html is supposed to be to open the web page in my browser but when I open it I find that it is blank and it does not load anything.[enter image description here](http[enter image description here](https://i.stackenter image description here.imgur.com/liDRV.png)s://i.stack.imgur.com/DA6kS.png)

i need your help please

can I using import without annotating the script to be type=’module’

Actually, I am using a non-module javascript files
I have installed creditor and I want to use Base64UploadAdapter from ckeditor
the official documentation tells me to use

import Base64UploadAdapter from "@ckeditor/ckeditor5-upload";
i

nside my js
but when I use this, it will say that

SyntaxError: Unexpected identifier ‘Base64UploadAdapter’. import call expects one or two arguments.

when I change the script to

<script src='test.js' type='module'>

I have to set some functions from test.js to export function

for example:

export function test() {
   alert('this is testing');
}

but I have used directly test() from other many many js files already,
if I change to export
I have to add

import { test } from 'test.js'

before using test function

I wonder how can I fix this problem? Thanks!!

I have tried following the instruction from official ckeditor5

Random Name Generator Using Multiple Variable Lists

I have a random ‘name’ generator code that I am trying to modify, but not sure how to go about it.

I would like to generate the name using one button, but comprised of a combination of characters (names) using 4 different variable name lists.

For example… the first variable name list might be:

example: var nameList = [ ‘A’ , ‘B’ , ‘C’ , ‘D’ ];

With a second, third and fourth variable name list being:

example: var nameList = [ ‘1’ , ‘2’ , ‘3’ , ‘4’ ];

So… when the button is clicked, it may yield a name of ex. ‘C131’.

This is the code I am currently using to generate a name using on a single variable name list…

INPUTS:

<input id="uNameInput" class="choosename" type="text" maxlength="12" minlength="4" 
placeholder="username" required>

<input onclick="generate()" id="gen-button" class="modern" type="button" value="Generate 
usename" </input>

SCRIPT:

var nameList = [ 'A' , 'B' , 'C' , 'D' ];

function generate() {
var finalName = nameList[Math.floor(Math.random() * nameList.length)];
        document.getElementById('uNameInput').value = finalName;
};

How to trigger a .glb animation (animation mixer) at the same time as an A-frame animation property animation?

How to trigger a .glb animation (animation mixer) at the same time as an A-frame animation property animation?


I have three animations I want to play:

  • Walking animation that is baked into the .glb model. I play it using A-frame’s animation mixer.
  • Animate position and scale from an event called walk-in. They’re both properties of the a-entity.

Is there a way where I can play both simultaneously? Or will I need to bake in an animation that does all three at once?


Here is the simplified entity code:

<a-entity
      gltf-model="#peacock-glb"
      position="5 0.17 -5"
      scale="0.01 0.01 0.01"
      id="peacock-entity"
      animation__position="property: position; to: 0.2 0.6 4.5; delay:1500; dur: 4500; startEvents: walk-in"
      animation__scale="property: scale; to: 0.05 0.05 0.05; delay:1500; dur: 4500; startEvents: walk-in">
</a-entity>

Here is the javascript code where I try to trigger the animation property and the animation mixer animation called Walking. It seems to play Walking first, then plays the two animation properties for the walk-in event.

this.el.emit('walk-in', null, false)
this.el.setAttribute('animation-mixer', 'clip:Walking')

Create static polyline in CesiumJS

I create a GroundPolylinePrimitive with the material type PolylineDash. When I move the camera, the lines start to move. How can I make my polyline static?

My code:

let countyBorderPrimitive = new GroundPolylinePrimitive({
                    geometryInstances: new GeometryInstance({
                        geometry: new GroundPolylineGeometry({
                            positions: Cartesian3.fromDegreesArray(newBorPos),
                            width: 3,
                        })
                    }),
                    show: stores.groundStore.visibleStatus,
                    appearance: new PolylineMaterialAppearance({
                        material: Material.fromType('PolylineDash', {
                            color: Color.RED,
                            dashLength: 50,
                            dashPattern: 255
                        })
                    })
                });
                cesium.scene.groundPrimitives.add(countyBorderPrimitive)

Search properties, create custom shader