‘el-select’ of element UI does not display anything

I hope that after selecting ‘form.SubDevice’, the content of all “measurepoint” selection boxes in the table column can be updated, and changing the content of one selection box will not affect the other selection boxes. The actual situation is that after the content of the selection box of the ‘form.SubDevice’ is updated, the selection boxes in the table column will not display any content.
How to solve this problem?

<template>
  <el-dialog :title=" 'fieldMapping'" :close-on-click-modal="false" :visible.sync="visible">
    
    <div class="">
        
        <el-form label-width="1px">
            
            <el-form-item>
                <el-select v-model="form.MainDevice" placeholder="select main device" @change="changeSelect1">
                    <el-option
                        v-for="item in fieldTypes1"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                    </el-option>
                </el-select>
                <el-select v-model="form.SubDevice" placeholder="select sub device" @change="changeSelect2">
                    <el-option
                        v-for="item in fieldTypes2"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                    </el-option>
                </el-select>
            </el-form-item>
            
              <el-table
                :data="dataForm"
                style="width: 100%">
                
                <el-table-column
                  label="field"
                  width="230">
                  <template slot-scope="scope">
                    <span style="margin-left: 10px">{{ scope.row.manualEntryFieldName }}</span>
                  </template>
                </el-table-column>
                
                <el-table-column label="measurepoint" >
                    <template slot-scope="scope">
                        <el-select   v-model="scope.row.value">
                            <el-option
                                v-for="item in fieldTypes3"
                                :key="item.id"
                                :label="item.name"
                                :value="item.id">
                            </el-option>
                        </el-select>
                    </template>
                </el-table-column>

              </el-table>
            <el-button type="primary" @click="inputDataToDataBase()">mapping</el-button>
        </el-form>
    
  </div>
  </el-dialog>
</template>

<script>


export default {
  props:{
      manualEntryFieldMappingId:{
          type:Number,
          required:true
      }
  },
  name:'Simple',
  data() {
    return {
      newManualEntryFieldMappingId:0,
      visible: false,
      code:'',
      fileList: [],
      dataForm:{
          tableName:'',
          fields:[
              {manualEntryFieldName:'', value:''}
          ]
      },
      form: {
          MainDevice: '',
          SubDevice: '',
            MeasurePoint:''
      },
      fieldTypes1:[

      ],
      fieldTypes2:[
      
      ],
      fieldTypes3:[
      
      ],
      dataForm:[
          
      ],
      checkedDetail:[

      ],
    };
  },
  watch:{
      manualEntryFieldMappingId(newValue,oldValue){
        this.newManualEntryFieldMappingId=newValue
      }
  },
  created(){
      this.newManualEntryFieldMappingId=this.manualEntryFieldMappingId;
      
  },
  
  methods: {
    init() {
      this.dataForm=[];
      this.getData();
      this.getField1();
    },
    changeSelect1() {
        this.form.SubDevice = ''
        
        this.getRequest(
            "/dataQualitySubdevice/getSubEquipmentByEquipmentIdForMapping?EquipmentId=" + 
            this.form.MainDevice
        ).then((resp) => {
            if (resp) {
            this.fieldTypes2 = resp.data;
            this.visible=true;
            }
        });
    },
    changeSelect2() {
        this.form.MeasurePoint = ''
        
        this.getRequest(
            "/dataQualityMeasurePoint/getMeasurePointbySubEquipmentIdForMapping?subEquipmentId=" + 
            this.form.SubDevice
        ).then((resp) => {
            if (resp) {
            this.fieldTypes3 = resp.data;
            this.visible=true;
            }
        });
    },
    getField1() {
        this.getRequest(
            "/dataQualityDevice/getAllDevice"
        ).then((resp) => {
            if (resp) {
            this.fieldTypes1 = resp.data;
            this.visible=true;
            }
        });
    },
  getData(){
        this.getRequest(
            "/manualEntry/getFieldInfo/?manualEntryId=" +
            this.newManualEntryFieldMappingId
        ).then((resp) => {
            if (resp) {
            this.dataForm = resp.data.data;
            this.visible=true;
            }
      });
  },

  },
};
</script>

c# m3u8 player with http header

No access to video without http header.

There is no problem in downloading and merging the m3u8 file, but how can it be watched live?

I’m using WebClient while downloading m3u8 content, but how can I use the same method to watch live?

when I try to stream live by downloading the videos one by one, it starts intermittently because it starts with a delay of about 1 second.

Mongodb FindOne returns object with undefined property

I’m trying to get a user from my collection with findOne using its name attribute but it returns undefined whereas my user is in the db.

This is my schema :

var schema = new mongoose.Schema({
  name: {
    type: String,
    required: [true, "Please enter a name"],
    maxlength: 32,
  },
  password: {
    type: String,
    required: true,
    minlength: [6, "Password must be at least 6 characters"],
  },
  email: {
    type: String,
    required: true,
    unique: true,
  },
  isAdmin: {
    type: Boolean,
    default: false,
  },
});

const Userdb = mongoose.model("userdb", schema);

module.exports = Userdb;

And this is where i try to get my user :

const name = req.body.name;
  const password = req.body.password;
  const user = Userdb.findOne({name: name});
  // console.log(user.name, user.password);
  if (user.name === undefined)
    return res.status(400).send({ message: "User not found" });

  const dbpassword = user.password;

where my console.log returns undefined

In the db :

screenshot

My postman post request :

screenshot postman

Call setters from property descriptor and change its values

Is it possible to call it?

Something like this:

private updateProperties(to: Object, from: Object) {
    Object.keys(from).forEach(key => {
        const toDescriptor = Object.getOwnPropertyDescriptor(to, key)
        const fromDescriptor = Object.getOwnPropertyDescriptor(from, key)

        if (toDescriptor?.value === undefined || fromDescriptor?.value === undefined) {
            return
        }

        const toValue = toDescriptor.value
        const fromValue = fromDescriptor.value

        if (this.isObject(fromValue) && this.isObject(toValue)) {
            this.updateProperties(toValue, fromValue)
        } else if (toDescriptor.set !== undefined) {
            //Call setter
            toDescriptor.set(fromValue)
        } else {
            //Just change value
            toDescriptor.value = fromValue
        }
    })
}

private isObject(obj: Object) {
    return obj !== null && typeof obj == 'object' && !Array.isArray(obj)
}

If not how can i do this?

This not working with setters:

(to as any)[key] = fromValue

And i don’t know how to solve this issue.

How does SpringBoot determine multiple file uploads, and what does the back end return to the front end after a successful file upload

I just want to pass in every file js to the back end to generate uid, and then return uid to change file state.
The back end doesn’t know how to get the uid, and then I define a class to hold the MultipartFile and uid, but the MultipartFile doesn’t seem to be able to pass values through objects, right
I would like to ask whether it is better to make one request to the back-end or multiple requests for multiple file uploads on the front-end interface
If a file fails to be uploaded and some files are saved on the server but not in the database, do you want to delete the file or do you want to save the file to the database?
The most interesting thing to know is how the multi-file front end and back end determine file uniqueness from the same data.
Do you have any good ideas?
The shi ‘t

QML Map Smooth Zoom using Buttons

I am trying to create a map of a small area. On this map I have 2 buttons, one is for zooming in and the other is for out. I have created 2 buttons and 1 loader, then connected these together to make it work. My code for buttons and loader:

Loader.qml

Loader{
            id: mapLoader
            source: "map.qml"

            function reload () {
                source = ""
                source = "map.qml"
                console.log("Map Updated")
            }
        }

buttons.qml

//This button zooms in 1 unit
// get_Zoomlevel() works on C++; therefore, it isn'T affected from qml reloads.
Button {
        ...
        onClicked: {
            map.setZoomLevel(map.get_ZoomLevel() + 1)
            mapLoader.reload()
        }
        ...
}



After all, it works as expected, I can zoom in and out easily. However, since the loader loads all the map components from scratch it takes a little longer for a normal and smooth user experience. Therefore, I am looking for a better way of loading or any other advice. Thanks in advance.

How to display a json with ajax into your hbs page with handlebars

I have an array of objects that i get from localstore, into javascript(trying to make a shopping cart with ajax) and I want to display at all times the contents of the array into my hbs file.
Array looks like this

  {[{onoma_proiontos:"ΠΑΝΣΕΤΑ ΕΛΛΗΝΙΚΗ ΧΟΙΡΙΝΟ",posotita:"2",kopi:"Για φούρνο"},{onoma_proiontos:"ΠΑΝΣΕΤΑ ΕΛΛΗΝΙΚΗ ΧΟΙΡΙΝΟ",posotita:"2.5",kopi:"Για φούρνο"}]}

I cant get around to showing the contents with handlebars somehow in my page(paraggelia.hbs).I don’t want to render the cart in another page since i want to have it constantly on top of all my links.

Encrypt video served by php to only show on certain html player

Im using following php code to display a video to an html player ( video.js library ).


if ($fp = fopen($path, "rb")) {
    $size = filesize($path); 
    $length = $size;
    $start = 0;  
    $end = $size - 1; 
    header('Content-type: video/mp4');
    header("Accept-Ranges: bytes");
    if (isset($_SERVER['HTTP_RANGE'])) {
      $c_start = $start;
      $c_end = $end;
      list(, $range) = explode('=', $_SERVER['HTTP_RANGE'], 2);
      if (strpos($range, ',') !== false) {
        header('HTTP/1.1 416 Requested Range Not Satisfiable');
        header("Content-Range: bytes $start-$end/$size");
        exit;
      }
      if ($range == '-') {
        $c_start = $size - substr($range, 1);
      } else {
        $range = explode('-', $range);
        $c_start = $range[0];
        $c_end = (isset($range[1]) && is_numeric($range[1])) ? $range[1] : $size;
      }
      $c_end = ($c_end > $end) ? $end : $c_end;
      if ($c_start > $c_end || $c_start > $size - 1 || $c_end >= $size) {
        header('HTTP/1.1 416 Requested Range Not Satisfiable');
        header("Content-Range: bytes $start-$end/$size");
        exit;
      }
      $start = $c_start;
      $end = $c_end;
      $length = $end - $start + 1;
      fseek($fp, $start);
      header('HTTP/1.1 206 Partial Content');
    }
    header("Content-Range: bytes $start-$end/$size");
    header("Content-Length: ".$length);
    $buffer = 1024 * 8;
    while(!feof($fp) && ($p = ftell($fp)) <= $end) {
      if ($p + $buffer > $end) {
        $buffer = $end - $p + 1;
      }
      set_time_limit(0);
      echo fread($fp, $buffer);
      flush();
    }
    fclose($fp);
    exit();
  } else {
    die('file not found');
  }

problem, when i open the link to that file i can easly access the video. What i’m asking is, can i encrypt it somehow so that only the player can display it in a way where i can still open it locally from outside the site its saved on, but not from the url directly, but rather in a specific player?

child_process.exec tries to launch node (instead of shell command) in some odd circumstances

I am trying to run some simple commands using child_process.exec. But in some odd corner cases, it tries to execute the given command with node, rather than the given (or default) shell.

Results

E.g., given below code, I get the following results:

cmd Result
❌ '"yarn" install' Error: Cannot find module 'C:cwdyarn.js'
✅ 'yarn install' (works as expected)
✅ '"C:pathtoyarn" install' (works as expected)

OS: Win10
Node: v16.13.0
I tested it with cmd, bash and PS. All the same result.

Full Error Message

node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'C:cwdyarn.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Done - code 1 signal null

Thoughts

It appears that there is a special logic that is triggered, iff the “executable” is in double quotes, and has no spaces or path separators in them…?

Not sure if feature or bug?

Code

// test.js
const cp = require('child_process');

const cmd = '"yarn" install';
const child = cp.exec(cmd);

// ###########################################################################
// process monitoring
// ###########################################################################

child.on('exit', (code, signal) => {
  console.log('Done - code', code, ' signal', signal);
});

child.on('error', (err) => {
  console.error(`Error:`, err);
});

// inherit stdio
child.stdout.pipe(process.stdout);
process.stdin.pipe(child.stdin);
child.stderr.pipe(process.stderr);

Stream downloadable files on client side using Javascript

I have this idea of integrating a video player in my website that can stream files that are download only by default , so far I have researched that concluded to a question , that Can I create a blob object on client side and stream it ?

<video id="player" src="THE_BLOB_OBJECT">

<script>
function blob_create(){
    passedUrl = 'PASSED FROM BACKEND'
    function blob_obj(url){
        // MAGIC CODE TO CREATE A BLOB
        return link
    }
    createdObj = blob_obj(passedUrl)
    document.getElementById('player').src = createdObj
}
</script>

I don’t know if the above is possible as I have a very little understanding of blob, any alternates to stream a download file will work too.

conditional filtering is not working in react js

I am trying to filter with 2 conditions. I have 3 values on my database which are Delivery, Take Away, and Both. Both values mean Delivery and take away. So I am trying to filter when a user searches for data that has delivery value it will return the data but also I want which data has both values it will return also those data.

So basically When the user selects the delivery, those data which have the delivery property will return from the array, and also those which have both properties will also return.

I am trying like this but I am getting an empty array

updatedList.filter(
      (item) =>
        item.additional.itemPick === "Both" &&
        item.additional.itemPick.toLowerCase() === pickItem.toLowerCase()
    );

My data

[
  {
    "_id": "62526de0b2540137f2a77b59",
    "additional": {
      "category": "Chinese",
      "rating": 9,
      "itemPick": "Both",
      "offer": 6
    },
    "name": "Consuelo Cameron"

  },
  {
    "_id": "62526de0d8ffb784e15ccc9e",

    "additional": {
      "category": "Italian",
      "rating": 6,
      "itemPick": "Both",
      "offer": 13
    },
    "name": "Susan Palmer"

  },
  {
    "_id": "62526de0de91084a9c71b50e",

    "additional": {
      "category": "Japanese",
      "rating": 7,
      "itemPick": "Take Away",
      "offer": 12
    },
    "name": "Meghan Mooney"
    
  },
  {
    "_id": "62526de0c3bdf5932586c610",

    "additional": {
      "category": "Vegitarian",
      "rating": 5,
      "itemPick": "Take Away",
      "offer": 10
    },
    "name": "Jody Lopez"
  },
  {
    "_id": "62526de0974a41b4cbd6827a",

    "additional": {
      "category": "Vegitarian",
      "rating": 6,
      "itemPick": "Both",
      "offer": 5
    },
    "name": "Kirsten Petersen"

  },
  {
    "_id": "62526de0e56f5f3c7d00ae47",

    "additional": {
      "category": "Italian",
      "rating": 10,
      "itemPick": "Both",
      "offer": 9
    },
    "name": "Garrison Mcbride"

  },
  {
    "_id": "62526de0a5c051722016c558",

    "additional": {
      "category": "Vegitarian",
      "rating": 8,
      "itemPick": "Delivery",
      "offer": 9
    },
    "name": "Jo Skinner"

  }
]

Expected output if the user selects delivery

[
  {
    "_id": "62526de0b2540137f2a77b59",
    "additional": {
      "category": "Chinese",
      "rating": 9,
      "itemPick": "Both",
      "offer": 6
    },
    "name": "Consuelo Cameron"

  },
  {
    "_id": "62526de0d8ffb784e15ccc9e",

    "additional": {
      "category": "Italian",
      "rating": 6,
      "itemPick": "Both",
      "offer": 13
    },
    "name": "Susan Palmer"

  },


  {
    "_id": "62526de0974a41b4cbd6827a",

    "additional": {
      "category": "Vegitarian",
      "rating": 6,
      "itemPick": "Both",
      "offer": 5
    },
    "name": "Kirsten Petersen"

  },
  {
    "_id": "62526de0e56f5f3c7d00ae47",

    "additional": {
      "category": "Italian",
      "rating": 10,
      "itemPick": "Both",
      "offer": 9
    },
    "name": "Garrison Mcbride"

  },
  {
    "_id": "62526de0a5c051722016c558",

    "additional": {
      "category": "Vegitarian",
      "rating": 8,
      "itemPick": "Delivery",
      "offer": 9
    },
    "name": "Jo Skinner"

  }
]

How do I associate the id of a custom field or the content of a wordpress post to a bootstrap modal?

I try to briefly explain my problem:

I have some blocks of text (the content) that I show with excerpt in a wordpress loop.
In the wordpress function file I inserted a button (read more) that shows all the content in bootstrap modal:

function excerpt ($limit) {
$id = get_the_ID ();
$excerpt = explode ('', get_the_excerpt (), $limit);
if (count ($excerpt)> = $limit) {
    array_pop ($excerpt);
    $excerpt = implode ("", $excerpt) .'... <button id = "myModal- '. $id.'" type = "button" class = "btn btn-light btn-sm" data-bs-toggle = "modal" data-bs-target = "#myModal">Open</button>';
} else {
    $excerpt = implode ("", $excerpt);
}
$excerpt = preg_replace ('`[[^]] *]`', '', $excerpt);
return $excerpt;}

to the modal I associated the id of the contents:

<div class = "pt-cv-ctf-list">
            <? php echo excerpt (50); ?>
        </div>
    <div id = "myModal" class = "modal" tabindex = "- 1" role = "dialog" aria-labeledby = "myModalLabel" aria-hidden = "true">
        <div class = "modal-dialog">
            <div class = "modal-content">
                <div class = "modal-header">
                    <h5 class = "modal-title" id = "myModalLabel"> <? php the_title (); ?> </h5>
                    <button type = "button" class = "btn-close" data-bs-dismiss = "modal" aria-label = "Close"> </button>
                </div>
                <div class = "modal-body">
                    <? php the_content (); ?>
                </div>
                <div class = "modal-footer">
                    <button type = "button" class = "btn btn-default" data-bs-dismiss = "modal"> Close </button>
                </div>
            </div>
        </div>
    </div>

The code works but it shows me only the first contents (rightly because I have no associated ID), but if I associate it:

<div id = "myModal- '. $ id.'" class = "modal" tabindex = "- 1" role = "dialog" aria-labeledby = "myModalLabel" aria-hidden = "true">

it doesn’t work and the google console gives me this error:

bootstrap.min.js? ver = 5.9.3: 6 Uncaught TypeError: Cannot read properties of undefined (reading ‘classList’)

Where am I wrong?

The button I inserted in a function in the wordpress functions.php file and the modal under the div of the excerpt as you can see from the snippets above. Should I include it in the footer perhaps?