Laravel Delete function not working using ajax

Hi im using datatable and need to delete multiple data using checkbox, I’m using post method javascript,

Controller

 public function deleteselected(Request $request){
    $ids = $request->ids;
    Product::whereIn('id', $ids)->delete();
    return response()->json(['code'=>1, 'msg'=>'Products have been deleted from database']); 
 }

Javascript

                       $.post(url,{countries_ids:checkedCountries, _token: "{{ csrf_token() }}", _method: "POST"},function(data){
                          if(data.code == 1){
                              $('#geniustable').DataTable().ajax.reload(null, true);
                              toastr.success(data.msg);
                          }

                       },'json');

Error

{
“message”: “Function () does not exist”,
“exception”: “ReflectionException”,
“file”: “/var/www/html/lifespace/project/vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php”,
“line”: 22,
“trace”: [
{
“file”: “/var/www/html/lifespace/project/vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php”,
“line”: 22,
“function”: “__construct”,
“class”: “ReflectionFunction”,
“type”: “->”
},

kindly help out.

How to fetch data by weeks and have it display by switching between weeks?

I want to code something like this where you can see the weeks and switch between them. At the moment I wrote these days in HTML, so it is not dynamic. I am new to this, so I don’t know what JS library can do something like this. I managed to find something that gives you the current week. However, I don’t think this is the right approach.

var  week = {
  period: null,

  load: function () {
    var d = new Date(); // today, now
     week.period = d.setDate(d.getDate() + ((7 - d.getDay()) % 7 + 1) % 7);
    document.getElementById("date").innerHTML = dayjs( week.period).format("DD/MMM/YYYY");
  },
  };

 week.load();
 <h1 id="date"></h1>

This way I get the next Monday. How would you go from here? I want to first get the weeks done. I have the fetch under control, as I have JSON data.

hy when run make command to install mulval i got following error

(

cd src/adapter; make; make install) make[1]: Entering directory ‘/home/unaiza/Desktop/opt/java/mulval/src/adapter’ javac GetCVEID.java -cp :/lib/dom4j-1.6.1.jar:/lib/jaxen-1.1.1.jar:/lib/mysql-connector-java-5.1.8-bin.jar GetCVEID.java:26: error: package org.dom4j does not exist import org.dom4j.Attribute; ^ GetCVEID.java:27: error: package org.dom4j does not exist import org.dom4j.Document; ^ GetCVEID.java:28: error: package org.dom4j does not exist import org.dom4j.Element; ^ GetCVEID.java:29: error: package org.dom4j.io does not exist import org.dom4j.io.SAXReader; ^ GetCVEID.java:30: error: package org.dom4j.io does not exist import org.dom4j.io.XMLWriter; ^ GetCVEID.java:49: error: cannot find symbol SAXReader saxReader = new SAXReader(); ^ symbol: class SAXReader location: class GetCVEID GetCVEID.java:49: error: cannot find symbol SAXReader saxReader = new SAXReader(); ^ symbol: class SAXReader location: class GetCVEID GetCVEID.java:51: error: cannot find symbol Document document = saxReader.read(filename); ^ symbol: class Document location: class GetCVEID GetCVEID.java:53: error: cannot find symbol Element hostname =(Element) document.selectSingleNode( “/[local-name(.)=’oval_results’]/[local-name(.)=’results’]/[local-name(.)=’system’]/[local-name(.)=’oval_system_characteristics’]/[local-name(.)=’system_info’]/[local-name(.)=’primary_host_name’]” ); ^ symbol: class Element location: class GetCVEID GetCVEID.java:53: error: cannot find symbol Element hostname =(Element) document.selectSingleNode( “/[local-name(.)=’oval_results’]/[local-name(.)=’results’]/[local-name(.)=’system’]/[local-name(.)=’oval_system_characteristics’]/[local-name(.)=’system_info’]/[local-name(.)=’primary_host_name’]” ); ^ symbol: class Element location: class GetCVEID GetCVEID.java:93: error: cannot find symbol SAXReader saxReader = new SAXReader(); ^ symbol: class SAXReader location: class GetCVEID GetCVEID.java:93: error: cannot find symbol SAXReader saxReader = new SAXReader(); ^ symbol: class SAXReader location: class GetCVEID GetCVEID.java:95: error: cannot find symbol Document document = saxReader.read(new File(filename)); ^ symbol: class Document location: class GetCVEID GetCVEID.java:97: error: cannot find symbol Element definitions =(Element) document.selectSingleNode( “/[local-name(.)=’oval_results’]/[local-name(.)=’oval_definitions’]/[local-name(.)=’definitions’]” ); ^ symbol: class Element location: class GetCVEID GetCVEID.java:97: error: cannot find symbol Element definitions =(Element) document.selectSingleNode( “/[local-name(.)=’oval_results’]/[local-name(.)=’oval_definitions’]/[local-name(.)=’definitions’]” ); ^ symbol: class Element location: class GetCVEID GetCVEID.java:105: error: cannot find symbol Element deft = (Element)def.next(); ^ symbol: class Element location: class GetCVEID GetCVEID.java:105: error: cannot find symbol Element deft = (Element)def.next(); ^ symbol: class Element location: class GetCVEID GetCVEID.java:142: error: cannot find symbol SAXReader saxReader = new SAXReader(); ^ symbol: class SAXReader location: class GetCVEID GetCVEID.java:142: error: cannot find symbol SAXReader saxReader = new SAXReader(); ^ symbol: class SAXReader location: class GetCVEID GetCVEID.java:144: error: cannot find symbol Document document = saxReader.read(new File(filename)); ^ symbol: class Document location: class GetCVEID GetCVEID.java:156: error: cannot find symbol Attribute defid = (Attribute)itdid.next(); ^ symbol: class Attribute location: class GetCVEID GetCVEID.java:156: error: cannot find symbol Attribute defid = (Attribute)itdid.next(); ^ symbol: class Attribute location: class GetCVEID GetCVEID.java:158: error: cannot find symbol Attribute rs = (Attribute)result.next(); ^ symbol: class Attribute location: class GetCVEID GetCVEID.java:158: error: cannot find symbol Attribute rs = (Attribute)result.next(); ^ symbol: class Attribute location: class GetCVEID 24 errors make[1]: *** [Makefile:9: GetCVEID.class] Error 1 make[1]: Leaving directory ‘/home/unaiza/Desktop/opt/java/mulval/src/adapter’ make[1]: Entering directory ‘/home/unaiza/Desktop/opt/java/mulval/src/adapter’ javac GetCVEID.java -cp :/lib/dom4j-1.6.1.jar:/lib/jaxen-1.1.1.jar:/lib/mysql-connector-java-5.1.8-bin.jar GetCVEID.java:26: error: package org.dom4j does not exist import org.dom4j.Attribute; ^ GetCVEID.java:27: error: package org.dom4j does not exist import org.dom4j.Document; ^ GetCVEID.java:28: error: package org.dom4j does not exist import org.dom4j.Element; ^ GetCVEID.java:29: error: package org.dom4j.io does not exist import org.dom4j.io.SAXReader; ^ GetCVEID.java:30: error: package org.dom4j.io does not exist import org.dom4j.io.XMLWriter; ^ GetCVEID.java:49: error: cannot find symbol SAXReader saxReader = new SAXReader(); ^ symbol: class SAXReader location: class GetCVEID GetCVEID.java:49: error: cannot find symbol SAXReader saxReader = new SAXReader(); ^ symbol: class SAXReader location: class GetCVEID GetCVEID.java:51: error: cannot find symbol Document document = saxReader.read(filename); ^ symbol: class Document location: class GetCVEID GetCVEID.java:53: error: cannot find symbol Element hostname =(Element) document.selectSingleNode( “/[local-name(.)=’oval_results’]/[local-name(.)=’results’]/[local-name(.)=’system’]/[local-name(.)=’oval_system_characteristics’]/[local-name(.)=’system_info’]/[local-name(.)=’primary_host_name’]” ); ^ symbol: class Element location: class GetCVEID GetCVEID.java:53: error: cannot find symbol Element hostname =(Element) document.selectSingleNode( “/[local-name(.)=’oval_results’]/[local-name(.)=’results’]/[local-name(.)=’system’]/[local-name(.)=’oval_system_characteristics’]/[local-name(.)=’system_info’]/[local-name(.)=’primary_host_name’]” ); ^ symbol: class Element location: class GetCVEID GetCVEID.java:93: error: cannot find symbol SAXReader saxReader = new SAXReader(); ^ symbol: class SAXReader location: class GetCVEID GetCVEID.java:93: error: cannot find symbol SAXReader saxReader = new SAXReader(); ^ symbol: class SAXReader location: class GetCVEID GetCVEID.java:95: error: cannot find symbol Document document = saxReader.read(new File(filename)); ^ symbol: class Document location: class GetCVEID GetCVEID.java:97: error: cannot find symbol Element definitions =(Element) document.selectSingleNode( “/[local-name(.)=’oval_results’]/[local-name(.)=’oval_definitions’]/[local-name(.)=’definitions’]” ); ^ symbol: class Element location: class GetCVEID GetCVEID.java:97: error: cannot find symbol Element definitions =(Element) document.selectSingleNode( “/[local-name(.)=’oval_results’]/[local-name(.)=’oval_definitions’]/[local-name(.)=’definitions’]” ); ^ symbol: class Element location: class GetCVEID GetCVEID.java:105: error: cannot find symbol Element deft = (Element)def.next(); ^ symbol: class Element location: class GetCVEID GetCVEID.java:105: error: cannot find symbol Element deft = (Element)def.next(); ^ symbol: class Element location: class GetCVEID GetCVEID.java:142: error: cannot find symbol SAXReader saxReader = new SAXReader(); ^ symbol: class SAXReader location: class GetCVEID GetCVEID.java:142: error: cannot find symbol SAXReader saxReader = new SAXReader(); ^ symbol: class SAXReader location: class GetCVEID GetCVEID.java:144: error: cannot find symbol Document document = saxReader.read(new File(filename)); ^ symbol: class Document location: class GetCVEID GetCVEID.java:156: error: cannot find symbol Attribute defid = (Attribute)itdid.next(); ^ symbol: class Attribute location: class GetCVEID GetCVEID.java:156: error: cannot find symbol Attribute defid = (Attribute)itdid.next(); ^ symbol: class Attribute location: class GetCVEID GetCVEID.java:158: error: cannot find symbol Attribute rs = (Attribute)result.next(); ^ symbol: class Attribute location: class GetCVEID GetCVEID.java:158: error: cannot find symbol Attribute rs = (Attribute)result.next(); ^ symbol: class Attribute location: class GetCVEID 24 errors make[1]: *** [Makefile:9: GetCVEID.class] Error 1 make[1]: Leaving directory ‘/home/unaiza/Desktop/opt/java/mulval/src/adapter’ make: *** [Makefile:6: adapter] Error 2## Heading

How to display a sliding animation in my endless runner using Phaser 3

I am trying to make an endless runner game with Phaser 3. I have gotten him to run and jump but I don’t know how to make him slide(I think because the animation Run keeps on running in the update function) is there a way I can make him slide for some seconds then return to playing. Please any suggestions or answers would be greatly needed and accepted. Thanks.

JavaScript : Fastest way to itterate over elements of collection

I am currently pulling data from excel which I then push into an object of array.
I am doing so unsing lodash. My code looks like the following :

  Output = [];
_.forEachRight(data, element => {

    obj = { 
    MyDate: element.Date,
    Cost: element.Cost,
   
    }
    
    Output.push(obj);


});
data = Output;

This takes 27000 milliesseconds for a excel dataset with over 200k entries.
My question : Is there a faster way of doing the above. I dont need to use arryas so every other
data structure is welcomed.

Javascript Array Sort and Groupby input order with various columns

Here are the input data.

const input = [
 {Time: "09:00", SpotName: "Area1", DataLabel: "Location1", Data: "2", CompareFlag: "true"},
 {Time: "09:00", SpotName: "Area1", DataLabel: "Location2", Data: "1", CompareFlag: "true"},
 {Time: "09:00", SpotName: "Area1", DataLabel: "Location2", Data: "1", CompareFlag: "false"},
 {Time: "09:00", SpotName: "Area1", DataLabel: "Location3", Data: "2.0", CompareFlag: "true"},
 {Time: "09:00", SpotName: "Area1", DataLabel: "Location4", Data: "100.0", CompareFlag: "true"},
 {Time: "10:00", SpotName: "Area1", DataLabel: "Location5", Data: "0", CompareFlag: "true"},
 {Time: "10:00", SpotName: "Area1", DataLabel: "Location2", Data: "0", CompareFlag: "true"},
 {Time: "10:00", SpotName: "Area1", DataLabel: "Location3", Data: "0.0", CompareFlag: "true"},
 {Time: "11:00", SpotName: "Area1", DataLabel: "Location5", Data: "0", CompareFlag: "false"},
 {Time: "09:00", SpotName: "Area2", DataLabel: "Location3", Data: "6.0", CompareFlag: "true"},
 {Time: "10:00", SpotName: "Area2", DataLabel: "Location5", Data: "5", CompareFlag: "true"},
 {Time: "11:00", SpotName: "Area1", DataLabel: "Location2", Data: "0", CompareFlag: "false"},
 {Time: "11:00", SpotName: "Area1", DataLabel: "Location3", Data: "0.0", CompareFlag: "true"},
 {Time: "09:00", SpotName: "Area2", DataLabel: "Location5", Data: "5", CompareFlag: "false"},
 {Time: "09:00", SpotName: "Area2", DataLabel: "Location2", Data: "7", CompareFlag: "true"},
 {Time: "10:00", SpotName: "Area2", DataLabel: "Location2", Data: "7", CompareFlag: "true"},
 {Time: "10:00", SpotName: "Area2", DataLabel: "Location3", Data: "0.0", CompareFlag: "true"},
 {Time: "11:00", SpotName: "Area2", DataLabel: "Location5", Data: "5", CompareFlag: "true"},
 {Time: "11:00", SpotName: "Area2", DataLabel: "Location2", Data: "7", CompareFlag: "true"},
 {Time: "11:00", SpotName: "Area2", DataLabel: "Location3", Data: "0.0", CompareFlag: "true"}
];

I want get data as following.

const output = [
 {Time: "09:00", SpotName: "Area1", DataLabel: "Location1", Data: "2", CompareFlag: "true"},
 {Time: "09:00", SpotName: "Area1", DataLabel: "Location2", Data: "1", CompareFlag: "true"},
 {Time: "09:00", SpotName: "Area1", DataLabel: "Location2", Data: "1", CompareFlag: "false"},
 {Time: "10:00", SpotName: "Area1", DataLabel: "Location2", Data: "0", CompareFlag: "true"},
 {Time: "11:00", SpotName: "Area1", DataLabel: "Location2", Data: "0", CompareFlag: "false"},
 {Time: "09:00", SpotName: "Area1", DataLabel: "Location3", Data: "2.0", CompareFlag: "true"},
 {Time: "10:00", SpotName: "Area1", DataLabel: "Location3", Data: "0.0", CompareFlag: "true"},
 {Time: "11:00", SpotName: "Area1", DataLabel: "Location3", Data: "0.0", CompareFlag: "true"},
 {Time: "09:00", SpotName: "Area1", DataLabel: "Location4", Data: "100.0", CompareFlag: "true"},
 {Time: "10:00", SpotName: "Area1", DataLabel: "Location5", Data: "0", CompareFlag: "true"},
 {Time: "11:00", SpotName: "Area1", DataLabel: "Location5", Data: "0", CompareFlag: "false"},
 {Time: "09:00", SpotName: "Area2", DataLabel: "Location5", Data: "5", CompareFlag: "false"},
 {Time: "10:00", SpotName: "Area2", DataLabel: "Location5", Data: "5", CompareFlag: "true"},
 {Time: "11:00", SpotName: "Area2", DataLabel: "Location5", Data: "5", CompareFlag: "true"},
 {Time: "09:00", SpotName: "Area2", DataLabel: "Location2", Data: "7", CompareFlag: "true"},
 {Time: "10:00", SpotName: "Area2", DataLabel: "Location2", Data: "7", CompareFlag: "true"},
 {Time: "11:00", SpotName: "Area2", DataLabel: "Location2", Data: "7", CompareFlag: "true"},
 {Time: "09:00", SpotName: "Area2", DataLabel: "Location3", Data: "6.0", CompareFlag: "true"},
 {Time: "10:00", SpotName: "Area2", DataLabel: "Location3", Data: "0.0", CompareFlag: "true"},
 {Time: "11:00", SpotName: "Area2", DataLabel: "Location3", Data: "0.0", CompareFlag: "true"}
];

I want to sort and groupby “SpotName” and “DataLabel”, “CompareFlag”.
Sort is input order not alphabetic.
I’m trying to implement it as a recursive function, but it doesn’t work.
Who can help me?
This is javascript.

Uncaught TypeError: g is not a function – Browser Direct Print Issue

In vendor provided library for direct browser print. The label test works fine, but when I try to print an image this error pops-up.

“Uncaught TypeError: g is not a function at line 279”

I am printing to Printer Emulator, installed from Browser Extension in Chrome, and for the direct browser print I have installed Browser Print from Zebra.

Any help is appreciated.

Angular – End time not less than start time validation

Working on Start time end time validation can’t resolve start time end time issue “Angular – End time not less than start time validation”

<!DOCTYPE html>
<html>
<head>  
</head>
<body>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker-standalone.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment-with-locales.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
<h1> Disable past time for end time input </h1>
 
      <label for="start_time" class="col-form-label">Start Time</label>
 
        <input type='time' class="form-control" id="starttime" />
<br/>
<br/>
      <label for="end_time" class="col-form-label">End Time</label> 
        <input type='time' class="form-control" id="date" />
  
    <script>
    </script>
</body>
</html>

Execute SPARQL Query with vue.js

I want to make a website by implementing the use of sparql in vue js. The scenario I want is to create a special place to write Sparql Query and then execute it with vue.js. Is all that possible? if possible how should i start it? if not possible, is there any other alternative than using vue.js? Please help.

Leveraging event delegation using three generic buttons

I have some questions regarding event delegation and also best practices.

I have this code(html):

<div id='container'>
   <button>Press me!</button>
   <button>Press this button!</button>

   <ul id="list">

   </ul>
</div>

I have this in my js:

let buttons = document.querySelectorAll('button');
const ulElement = document.getElementById('list');
buttons.forEach(b=>{
   b.addEventListener('click', (e)=>{
   e.currentTarget.disabled = 'true';
   let element = document.createElement('p');
   element.textContent = 'This is a p tag';

   let removeButton = document.createElement('button');
   removeButton.textContent = 'Remove this task';
   removeButton.addEventListener('click', (e)=>{
      e.currentTarget.parentElement.remove();
   })
   element.append(removeButton);
   ulElement.append(element);
   })
})

I have two buttons. When clicked whichever button creates a p element with some text and a button to remove said p element.

  1. I would like (if possible) to use the event and when the remove button is clicked I would like to remove the p element and the remove button. I would also like to somehow remember which out of these two generic buttons is clicked and remove the disabled status. Is this possible with the event? Given that they are generic is it best that they remain as is or should an id be added?

  2. I read in the MDN documents that event listeners should be removed eventually. Is this only in complex programs? What is the best practice here?

  3. Is it fine to have an event listener within an event listener as I have created here?

  4. Is e.currentTarget.parentElement.remove(); fine like this or is there a better way to write it? Currently I think it gets the job done.

Any help would be appreciated. Thank you.

unprotect password in JavaScript with XLSX.read Javascript API

Read I want when upload file excel (excel is protect with password) unprotect or remove the password with XLSX.read but don’t unprotect or remove the password from excel file.

This my code:

<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.8.0/jszip.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.8.0/xlsx.js"></script>
<script>
var reader = new FileReader();
reader.onload = function (e) {  
    var data = e.target.result;  
    /*Converts the excel data in to object*/  
    debugger;
    if (xlsxflag) {  
        var workbook = XLSX.read(data, { type: 'binary' ,  password: '123456' });  
    }  
    else {  
        var workbook = XLS.read(data, { type: 'binary' ,  password: '123456'  });  
    }  
    
    /*Gets all the sheetnames of excel in to a variable*/  
    //var obj = workbook.Open(Location, 0, false, 1, "password");

    var sheet_name_list = workbook.SheetNames;  
}
</script>

where to use async/defer and where to use preload/prefetch while loading assets

I’m working on performance improvements in my application, there are lots of static files loading in head. I came across async, defer, preload, prefetch

Can someone share the advantage of preload/prefetch over async/ defer
and the advantages of using async, defer, preload, prefetch with the
use case

It really helps to understand the behavior and choose the right one

How to disable copy or paste functionality on CKEditor 5 in reactJs?

I’m working on a feature where candidates can answer the questions, but I don’t want them to copy and paste the answers from somewhere else to the CKEditor 5 which I have integrated in my React Js project.

I tried using text field onCopy and onPaste attributes, but it seems to be not working.
Is there any prop or configuration I can do to resolve this issue!

Thank you.