Keep css class on Quill clipboard.dangerouslyPasteHTML

I use the Quill Text Editor, and i use the method clipboard.dangerouslyPasteHTML for paste HTML in the editor, but if i send this :

let content= '<p class="perso-class">test</p>'; quill.clipboard.dangerouslyPasteHTML(content)

Editor contents show as: <p>test</p>, i want to keep the custom class CSS.

Thank you for your help !

When using expo to build eas, Android keeps giving me an error

I set package.json as below, but I get an error. In ios, the build was successful, but the url image is not coming out. What should I do?

{ "name": "expo-zazero-app", "version": "1.0.0", "scripts": { "start": "expo start --dev-client", "android": "expo run:android", "ios": "expo run:ios", "web": "expo start --web" }, "dependencies": { "@actbase/react-daum-postcode": "^1.0.4", "@expo/webpack-config": "^0.17.2", "@ouroboros/react-native-picker": "^0.2.1", "@powerdesigninc/react-native-prompt": "^0.1.2", "@react-native-async-storage/async-storage": "~1.17.3", "@react-native-community/checkbox": "^0.5.14", "@react-native-community/datetimepicker": "6.5.2", "@react-native-picker/picker": "2.4.8", "@react-navigation/material-top-tabs": "^6.5.1", "@react-navigation/native": "^6.0.16", "@react-navigation/stack": "^6.3.7", "@tanstack/react-query": "^4.24.4", "accordion-collapse-react-native": "^1.1.1", "AsyncStorage": "^0.1.5", "axios": "^1.2.1", "dropdown-picker": "^0.0.1", "expo": "^47.0.0", "expo-checkbox": "~2.2.2", "expo-clipboard": "~4.0.1", "expo-font": "~11.0.1", "expo-image-picker": "~14.0.2", "expo-modules-autolinking": "~1.0.0", "expo-splash-screen": "~0.17.5", "expo-status-bar": "~1.4.2", "expo-updates": "~0.15.6", "http-proxy-middleware": "^2.0.6", "https-proxy-agent": "^5.0.1", "iamport-react-native": "^2.0.4", "npm": "^9.2.0", "query-string": "^8.1.0", "react": "18.0.0", "react-daum-postcode": "^3.1.1", "react-dom": "18.1.0", "react-native": "0.69.6", "react-native-animatable": "^1.3.3", "react-native-bootstrap": "^0.1.0", "react-native-bootstrap-styles": "^4.5.0-r", "react-native-calendar-strip": "^2.2.6", "react-native-calendars": "^1.1292.0", "react-native-collapsible": "^1.6.0", "react-native-dropdown-picker": "^5.4.3", "react-native-dropdown-select-list": "^2.0.4", "react-native-fast-image": "^8.6.3", "react-native-gesture-handler": "~2.8.0", "react-native-image-slider-banner": "^1.0.3", "react-native-image-slider-box": "^2.0.7", "react-native-keyboard-aware-scroll-view": "^0.9.5", "react-native-modal-datetime-picker": "^14.0.1", "react-native-pager-view": "6.0.1", "react-native-paper": "^5.0.1", "react-native-picker": "^4.3.7", "react-native-picker-select": "^8.0.4", "react-native-render-html": "^6.3.4", "react-native-safe-area-context": "4.4.1", "react-native-screens": "~3.18.0", "react-native-svg": "13.4.0", "react-native-svg-transformer": "^1.0.0", "react-native-tab-view": "^3.3.4", "react-native-vector-icons": "^9.2.0", "react-native-web": "~0.18.7", "react-native-webview": "11.23.1", "react-native-wrapped-text": "^1.2.2", "sharp-cli": "^4.1.0", "yarn": "^1.22.19" }, "devDependencies": { "@babel/core": "^7.19.3" }, "proxy": "http://49.50.162.86:80" }

How to create a multi-series funnel chart with AmCharts (or other chart libraries)?

I am trying to create a funnel chart with multiple series using AmCharts (or any other chart library). Specifically, I want to display multiple funnel values within an existing funnel, as shown in this image.

multi-series funnel chart

// Create series
var series = chart.series.push(
  am5percent.FunnelSeries.new(root, {
    name: "Series",
    valueField: "applicants",
    categoryField: "stage",
    orientation: "vertical",
  })
);
series.data.setAll(data);
series.labels.template.set("visible", false);

var series2 = chart.series.push(
  am5percent.PyramidSeries.new(root, {
    name: "Series",
    valueField: "applicants",
    categoryField: "stage",
    orientation: "vertical",
  })
);
series2.data.setAll(data);
series2.labels.template.set("visible", false);

Tried to come up with a concept from this pen here -> https://codepen.io/team/amcharts/pen/abWVPeo and tried to combine the dataseries within by looking at their docs. It seems that when creating two dataseries, it aggregates them into the same chart, but I’m unaware of any syntax from within their docs that allows you to display multiple values in the same chart (like you would for a bar chart / line chart)

I have searched the entire AmCharts documentation, but couldn’t find anything that matches this concept. Can anyone provide guidance on how to achieve this with AmCharts, or recommend another chart library that can support this functionality? Any help would be greatly appreciated.

How to call npm script with environment variable inside workflow step?

Given a .js file

const renderer = process.env.RENDERER;

if(!renderer) {
    console.log('missing');

    return;
}

console.log(renderer);

and a package.json

{
  "scripts": {
    "dev": "node app.js"
  }
}

I want to call the npm script inside my Github actions workflow but I want to pass the environment variable to it

name: Do

on:
  workflow_dispatch:
    inputs:
      renderer:
        description: 'A,B,C,...'
        required: true
        type: string

jobs:
  do:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Setup Node
        uses: actions/setup-node@v3
        with:
          node-version: 19.x

      - name: Install dependencies
        run: npm install

      - name: Set environment variable for renderer
        run: export RENDERER=${{ inputs.renderer }}

      - name: Test output
        run: npm run dev

When running the workflow the script writes

missing

to the console so it seems the npm script didn’t run with the environment variable.

How can I prepend RENDERER=${{ inputs.renderer }} to npm run dev?

How to create CSV with headers in JavaScript/jQuery and Write a text in html tags to respective column of csv?

I have a html code with multiple tags which is having text in it.

Problem Statement : I want to create a csv with headers and write a text in html tags in the respective column of csv and then want a downloadable button in a UI with which I can download the csv.

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <tbody>
        <tr data-index="0">
            <td>
                <div class="card border-left-success shadow h-100 py-2 mb-2 ml-2">
                    <div class="card-body">
                        <h4 class="card-title mb-2 font-weight-bold">Service Name -1 </h4>
                        <div class="clearfix my-3"></div>
                        <h5 class="card-text">Regarding Service Name-1</h5>
                        <h5><span class="badge badge-pill badge-success"><a title="Job Details" target="_blank"
                                    href="hhh" class="text-white">DOG</a> </span> <span
                                class="badge badge-pill badge-success"><a title="Job Details" target="_blank" href="hhh"
                                    class="text-white">CAT</a> <a title="Volumetric report" class="text-white"
                                    target="_blank" href="hhh"><i class="fas fa-file-medical-alt"></i></a> <a
                                    title="Dup report" class="text-white" href="hhh"><i class="fas fa-copy"></i></a> <a
                                    title="Embargo Privacy Filter Report" class="text-white" href="hhh"><i
                                        class="fas fa-file-excel"></i></a> <a title="CAC report" class="text-white"
                                    href="hhh"><i class="fas fa-file-signature"></i></a> <a
                                    title="Existing Source Place Report" class="text-white" href="hhh"><i
                                        class="fas fa-file-archive"></i></a> <a title="VVS Validation Failed Report"
                                    class="text-white" href="hhh"><i class="fas fa-file-code"></i></a> <a
                                    title="Job report" class="text-white" href="hhh"><i
                                        class="fas fa-file-invoice"></i></a> <a title="Cumulative report"
                                    class="text-white" href="hhh"><i class="fas fa-file-medical"></i></a></span> <span
                                class="badge badge-pill badge-success"><a title="Job Details" target="_blank" href="hhh"
                                    class="text-white">LION</a> <a title="Volumetric report" class="text-white"
                                    target="_blank" href="hhh"><i class="fas fa-file-medical-alt"></i></a> <a
                                    title="Job report" class="text-white" href="hhh"><i
                                        class="fas fa-file-invoice"></i></a> <a title="Cumulative report"
                                    class="text-white" href="hhh"><i class="fas fa-file-medical"></i></a></span> <span
                                class="badge badge-pill badge-success"><a title="Job Details" target="_blank" href="hhh"
                                    class="text-white">TIGER</a> <a title="Volumetric report" class="text-white"
                                    target="_blank" href="hhh"><i class="fas fa-file-medical-alt"></i></a> <a
                                    title="Job report" class="text-white" href="hhh"><i
                                        class="fas fa-file-invoice"></i></a> <a title="Cumulative report"
                                    class="text-white" href="hhh"><i class="fas fa-file-medical"></i></a></span> <span
                                class="badge badge-pill badge-success"><a title="Job Details" target="_blank" href="hhh"
                                    class="text-white">RABBIT</a> <a title="Volumetric report" class="text-white"
                                    target="_blank" href="hhh"><i class="fas fa-file-medical-alt"></i></a> <a
                                    title="Job report" class="text-white" href="hhh"><i
                                        class="fas fa-file-invoice"></i></a> <a title="Cumulative report"
                                    class="text-white" href="hhh"><i class="fas fa-file-medical"></i></a> </span> </h5>
                        <div class="text-muted"><small><i class="fa fa-user"></i> Submitted By: xyz On: 7/29/2022,
                                11:19:24 AM </small></div>
                        <div class="text-muted"><small><i class="fa fa-envelope"></i> Email To: [email protected]</small>
                        </div>
                        <div class="my-2 clearfix">
                            <div class="row">
                                <div class="col-10">
                                    <a class="btn btn-sm btn-light btn-icon-split copier float-left"
                                        data-clipboard-text="uihfg" title="Click to Copy">
                                        <span class="icon text-gray-600"><i class="fas fa-hdd"></i> NFFS</span>
                                        <span class="text">mycomputer/folder</span>
                                    </a>
                                </div>

                                <div class="col">
                                    <span class="float-right">&nbsp;<span>
                                            <a tabindex="0" class="btn btn-sm btn-dark float-right" role="button"
                                                title="" onclick="yu" data-original-title="Payload"><i
                                                    class="fas fa-info-circle"></i></a>
                                        </span></span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </td>
            <td><a target="_blank" href="hhh">4567</a></td>
        </tr>
        <tr data-index="1">
            <td>
                <div class="card border-left-success shadow h-100 py-2 mb-2 ml-2">
                    <div class="card-body">
                        <h4 class="card-title mb-2 font-weight-bold">Service Name -2</h4>
                        <div class="clearfix my-3"></div>
                        <h5 class="card-text"> Regarding Service Name-2</h5>
                        <h5><span class="badge badge-pill badge-success"><a title="Job Details" target="_blank"
                                    href="hhh" class="text-white">DOG</a> </span> <span
                                class="badge badge-pill badge-success"><a title="Job Details" target="_blank" href="hhh"
                                    class="text-white">CAT</a> <a title="Volumetric report" class="text-white"
                                    target="_blank" href="hhh"><i class="fas fa-file-medical-alt"></i></a> <a
                                    title="Dup report" class="text-white" href="hhh"><i class="fas fa-copy"></i></a> <a
                                    title="Embargo Privacy Filter Report" class="text-white" href="hhh"><i
                                        class="fas fa-file-excel"></i></a> <a title="CAC report" class="text-white"
                                    href="hhh"><i class="fas fa-file-signature"></i></a> <a
                                    title="Existing Source Place Report" class="text-white" href="hhh"><i
                                        class="fas fa-file-archive"></i></a> <a title="VVS Validation Failed Report"
                                    class="text-white" href="hhh"><i class="fas fa-file-code"></i></a> <a
                                    title="Job report" class="text-white" href="hhh"><i
                                        class="fas fa-file-invoice"></i></a> <a title="Cumulative report"
                                    class="text-white" href="hhh"><i class="fas fa-file-medical"></i></a></span> </h5>
                        <div class="text-muted"><small><i class="fa fa-user"></i> Submitted By: abc On: 6/9/2022,
                                8:21:30 PM </small></div>
                        <div class="text-muted"><small><i class="fa fa-envelope"></i> Email To: [email protected]</small>
                        </div>
                        <div class="my-2 clearfix">
                            <div class="row">
                                <div class="col-10">
                                    <a class="btn btn-sm btn-light btn-icon-split copier float-left"
                                        data-clipboard-text="uiih/" title="Click to Copy">
                                        <span class="icon text-gray-600"><i class="fas fa-hdd"></i> SSS</span>
                                        <span class="text">mycomputer/folder/</span>
                                    </a>
                                </div>

                                <div class="col">
                                    <span class="float-right">&nbsp;<span>
                                            <a tabindex="0" class="btn btn-sm btn-dark float-right" role="button"
                                                title="Payload" onclick="showJsonPopover(hhhh)"><i
                                                    class="fas fa-info-circle"></i></a>
                                        </span></span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </td>
            <td><a target="_blank" href="hhh">7634</a></td>
        </tr>
        <tr data-index="2">
            <td>
                <div class="card border-left-danger shadow h-100 py-2 mb-2 ml-2">
                    <div class="card-body">
                        <h4 class="card-title mb-2 font-weight-bold">Service Name -3</h4>
                        <div class="clearfix my-3"></div>
                        <h5 class="card-text"> Regarding Service Name-3</h5>
                        <h5><span class="badge badge-pill badge-success"><a title="Job Details" target="_blank"
                                    href="hhh" class="text-white">DOG</a> <a title="Resume Staging" class="text-white"
                                    href="hhh"><i class="fas fa-play-circle"></i></a> </span> <span
                                class="badge badge-pill badge-danger"><a title="Job Details" target="_blank" href="hhh"
                                    class="text-white">CAT</a> </span> </h5>
                        <div class="text-muted"><small><i class="fa fa-user"></i> Submitted By: uui On: 6/9/2022,
                                8:38:17 AM </small></div> <div class="text-muted"><small><i class="fa fa-envelope"></i>
                            Email To: [email protected]</small>
                    </div>
                    <div class="my-2 clearfix">
                        <div class="row">
                            <div class="col-10">
                                <a class="btn btn-sm btn-light btn-icon-split copier float-left"
                                    data-clipboard-text="xml" title="Click to Copy">
                                    <span class="icon text-gray-600"><i class="fas fa-hdd"></i> YU3</span>
                                    <span class="text">mycomputer/folder/</span>
                                </a>
                            </div>

                            <div class="col">
                                <span class="float-right">&nbsp;<span>
                                        <a tabindex="0" class="btn btn-sm btn-dark float-right" role="button"
                                            title="Payload" onclick="showJsonPopover(yuh)"><i
                                                class="fas fa-info-circle"></i></a>
                                    </span></span>
                            </div>
                        </div>
                    </div>
                </div>
                </div>
            </td>
            <td><a target="_blank" href="yuhg">9087</a></td>
        </tr>
        <tr data-index="3">
            <td>
                <div class="card border-left-danger shadow h-100 py-2 mb-2 ml-2">

                    <span>
                        <i class="fa fa-download" aria-hidden="true"></i>
                    </span>

</body>

</html>

Expected CSv :
enter image description here

if <span> tag of DOG has a class = 'badge-success' then in a DOG column success should get inserted.
if any one of the column is absent then - should appear in csv.

Reffer fiddle link : https://jsfiddle.net/f5kc1g2d/

How to call a method from a distinct component using Vue 3 & Pinia

I want to call an inner function of a component if I click a button. There are many suggestions using shared data, but it should work separately for different components. Here’s an example:

// Page.vue
<template>
    <MyComponent my-prop="abc"/>
    <button @click="???">ButtonX</button>

    <MyComponent my-prop="123"/>
    <button @click="???">ButtonY</button>
</template>
// ...
// MyComponent.vue:
<script>
    function foo() {
        //Do something inside this component
    }
</script>
// ...

My goal is that if I press ButtonX then foo() function called for <MyComponent my-prop="abc"/> but if I press ButtonY the same inner foo() function runs for <MyComponent my-prop="123"/>.
How could I achieve that? (The components could be far from each other in the component tree.)

I prefer solution using only Vue 3 and Pinia.

Mongoose: define a schema property with one name in Document object and another in the actual database

I have in my app multiple models defined for one collection: Trainee, Employee, Contractor, Manager, and Removed.

Each model schema has a date property that represents the time the person “entered” into the status represented by the model:

const TraineeSchema = new Schema({
  ...
  accetedOn: Date,
  ...
});

const EmployeeSchema = new Schema({
  ...
  hiredOn: Date,
  ...
});

const ContractorSchema = new Schema({
  ...
  contractedOn: Date,
  ...
});

const ManagerSchema = new Schema({
  ...
  promotedOn: Date,
  ...
});

const RemovedSchema = new Schema({
  ...
  terminatedOn: Date,
  ...
});

In one case I perform an aggregation that filters data based on these properties. It would be a simpler code if all of these properties had the same name in the database. So, if for example, the data property is named enteredIntoStatusOn for all these schemas, I could just have:

{ $match: { enteredIntoStatusOn: { $gt: ... } }

Is it possible to define in a schema a property that has one name when used in a mongoose Document object, but actually saved under a different name in the database?

I know I could do something similar using aliases. For example, I could define the manager schema with the enteredIntoStatusOn defined, and then also define a virtual field named promotedOn that simply gets and sets the enteredIntoStatusOn field. But then, both promotedOn and enteredIntoStatusOn are exposed in a document for the Manager model. Is there a way in Mongoose to just have the alias without the original property?

How to intercept backend (api) requests at browser level in multi monitor setup

Problem:
Assume an application launched in multimonitor. i.e. Application launched in 2 monitors with separate browser instances.
Now each browser instance makes a API call to backend to load the data i.e. http:///loadData

As we see here, there are two requests to backend from separate browser instances but actually both are trying to load same data. This will create unnecessary overhead on backend.

Is there any way we can intercept backend API at browser level and make sure only one request goes to backend. And other browser request will be served from the response.

enter image description here

Looked into Service worker to handle this scenario. But it is main intent to use for offline mode. And not sure if it handles all the scenarios like intercepting GET/POST requests.

How to general 4D, 3D and 2D number from 4 input numbers

I got stuck how to generate array like this from 4 input values.

enter image description here

As = first position = 12

Kop = second position = 34

Kepala = third position = 56

ekor = fourth position = 78

User will be able to any number into those position (input) or sometime some field can be blank.

I would like the those 4 input values combine together and form as 4D, 3D and 2D number. But make sure the position cannot be change and the generate number cannot duplicate.

Example:

  • number 1 and 2 are on first position ever.
  • number 3 and 4 are on second position ever.
  • number 5 and 6 are on third position ever.
  • number 7 and 8 are on fourth position ever.

Source code (PHP or JS) or Idea both are appreciated.

problem with setting a value of a global variable inside a function [duplicate]

i have a problem with setting the value of a global variable inside a function so that it can be later used inside another function.

My code:

var user_id;

router.post('/add_note', function(request, response, next){
var note_title = request.body.note_title;
var note_content = request.body.note_content;

database.query(sql,function(err, result) {
  if (err) throw err;
  var results=JSON.parse(JSON.stringify(result))
  user_id=results[0].user_id;
  console.log("from inside: "+user_id);
});

var sql = `INSERT INTO notes (user_id, note_title, note_content) VALUES (${user_id}, "${note_title}", "${note_content}", NOW())`;
console.log("from outside: "+user_id);
console.log(sql);

when i submit the form it returns:

from outside: undefined
INSERT INTO notes (user_id, note_title, note_content) VALUES (undefined, "ads", "ads", NOW())
from inside: 2

why is it undefined, the variable should be global, i am going insane

Categorization Projects with HTML, CSS & JS

I have a webpage with lists of DIV that shows my projects. Each project has a tag that describes its type, such as Graphic Design, Animation, or Photography. I want to add buttons as well for viewers to filter through tags. If a viewer clicks on the Photography button, all other projects should be hidden.

Is it possible to make a function like this in JS? How do I target projects (divs) with their tag?

Eel Python : VS code isn’t printing anything when button is triggered

I have been trying to print hello world on the VS code terminal when my button is pressed. The javascript code takes the input from an HTML button and passes to python through Eel

my HTML code –

<button
type="button"
id="setuplogger"
style="background-color: #dd9000"
class="btn btn-dark"
onclick="setuplogger_fnc()"
>

My JS code —

function setuplogger_fnc() {
     
  eel.logger()(return_msg);

};

function return_msg() {
  console.log('returned hello')
}

My python Eel code –

@eel.expose
def logger():
    print("hello world")

    return "hello"

The code is returning “hello” back to the JS but isn’t printing anything on VS code. Can anyone explain why?

Adding Javascript to check dimensions in Qualtrics

Does anyone know if it’s possible to alter the meta info question in Qualtrics to check phone dimensions?

By default, it provides the screen resolution of the respondent’s browser in pixels. However, I’m trying to create a screening survey that checks respondents’ phone dimensions so I can determine whether are eligible for a study without asking them to measure their phones as it seems lots of people don’t know their phone dimensions.

Does anyone know how to do this using Javascript?

I’m familiar with Javascript but not sure where to start with this particular issue.

Thank you!