MongoDb atlas only returning 1000 records

I’m working with mongodb atlas and apps script. I’m trying to pull all the records in the db with certain criteria (at present there are only about 1100). Up until recently I have been using the following code without problems:

var url = "https://us-east-1.aws.data.mongodb-api.com/app/data-wygci/endpoint/data/v1/action/find";
  var apiKey = "xxx";
  var authToken = "yyy";
  var headers = {
    "Content-Type": "application/json",
    "Access-Control-Request-Headers": "*",
    "api-key": apiKey,
    "Authorization": authToken,
  };

  var payload = {
    "collection": "mycoll",
    "database": "mydata",
    "dataSource": "Cluster0",
    "filter": filterObj,
    "projection": {}

  };

  var options = {
    method: "post",
    headers: headers,
    payload: JSON.stringify(payload),
    muteHttpExceptions: true
  };

  var response = UrlFetchApp.fetch(url, options);

  if (response.getResponseCode() === 200) {
    var result = response.getContentText();
    Logger.log(result);
  const myObjs = JSON.parse(result);
    Logger.log(myObjs.documents.length);

    return result;
  } else {
    Logger.log("Error: " + response.getResponseCode());
    Logger.log(response.getContentText());
    return false;
  }

This code works, but only exactly 1000 records are returned. I need the full 1100.

How can I get this working?

Embed a photo on Discord

I’m using w3schools spaces for a middle click to open ms calculator (calculator:) joke but I cannot make the embed photo.

I’m tried to search websites to find code but I can’t find any related to Discord API, Instead it appears with a link I want the link to turn into a picture.

My code:window.location.replace(“calculator:”);

How can I fix the formatting on these graphs?

I am using the chart.js library to generate these graphs. I cannot get the title of the doughnut chart to stack over the actual chart or the legend of the doughnut chart to be lowered a little, and the label of the grouped bar chart is cut off. (https://i.stack.imgur.com/GxCgn.png)

Here is my code for both the charts: (This is in a Django template)

<div class="grid grid-cols-2 gap-4 mb-4">
     <div class="col-span-0 w-full rounded-xl p-4" style="height: 400px; width: 100%;">
          <canvas id="chart_revenue"></canvas>
     </div>
     <script>
          let ctx_revenue = document.getElementById("chart_revenue").getContext("2d");
          let chart_revenue = new Chart(ctx_revenue, {
               type: "doughnut",
               data: {
                    labels: [
                         {% for project in all_projects %}
                              ['{{project.name}}', '{{project.client.name}}'],
                         {% endfor %}
                    ],
                    datasets: [{
                         label: "Revenue",
                         data: [
                              {% for project in all_projects %}
                                   {{project.total_cost}},
                              {% endfor %}
                         ],
                         hoverOffset: 4
                    }]
               },
               options: {
                    animation: {
                         animateRotate: true,
                         animateScale: true,
                         duration: 1000,
                         easing: "easeOutQuart"
                    },
                    responsive: true,
                    maintainAspectRatio: false,
                    plugins: {
                         title: {
                         display: true,
                         text: ["Revenue Distribution", "Total Revenue: ${{total_revenue}}",
                                   "Total Clients: {{total_clients}}"],
                         align: 'center',
                         padding: {
                              top: 0,
                              bottom: 20
                         },
                         font: {
                              size: 18,
                              weight: "bold"
                         }
                     },
                     legend: {
                          display: true,
                          position: "right",
                          labels: {
                               font: {
                                    size: 14
                               }
                           }
                     },
               }
               }
          });
     </script>
     <div class="col-span-1 w-full rounded-xl p-4" style="height: 400px; width: 100%;">
           <canvas id="chart_project"></canvas>
     </div>
     <script>
           let ctx_project = document.getElementById("chart_project").getContext("2d");
           let chart_project = new Chart(ctx_project, {
                type: "bar",
                data: {
                    labels: [
                        {% for fiscal_year in fiscal_years %}
                            '{{fiscal_year.name}}',
                        {% endfor %}
                    ],
                    datasets: [
                        {
                            label: "Projects",
                            data: [
                                {% for num_projects in num_projects_by_fiscal_year %}
                                    {{num_projects}},
                                {% endfor %}
                             ],
                             hoverOffset: 4
                        },
                        {
                             label: "Pending Project Requests",
                             data:[
                                 {% for num_pending_project_requests in 
                                      num_pending_project_requests_by_fiscal_year %}
                                      {{num_pending_project_requests}},
                                 {% endfor %}
                             ],
                             hoverOffset: 4
                        }
                    ]
                },
                options: {
                    animation: {
                        animateRotate: true,
                        animateScale: true,
                        duration: 1000,
                        easing: "easeOutQuart"
                    },
                    responsive: true,
                    maintainAspectRatio: true,
                    scales: {
                        y: {
                            Min: 0,
                            suggestedMax: 10
                        }
                    },
                    plugins: {
                        title: {
                            display: true,
                            text: ["Project Count", "Total Projects: {{total_projects}}", 
                            "Total Project Requests: {{total_project_requests}}", 
                            "Total Pending Projects Requests: 
                                  {{total_pending_project_requests}}"],
                            align: 'center',
                            padding: {
                                top: 10,
                                bottom: 30
                        },
                        font: {
                            size: 18,
                            weight: "bold"
                        }
                        },
                        legend: {
                            display: true,
                            position: "right",
                            labels: {
                                font: {
                                size: 14
                                }
                            }
                        },
                    }
                }
                });      
            </script>
        </div>

I have tried changing the padding and the position of the titles/legends but none of that has worked. Most of the time there is no change.

JSON.parse() failing due to unescaped double quotes

I am using a survey tool called Qualtrics, in that I am creating a workflow which pulls data from an API. the returned Data is in the following format:

{"feedback_type":"Dining","reservation_id":"1234","order_id":null,"recommend_to_friend":"No","overall":"2","food":"3","ambience":"4","service":"5","notes":"The food was "AWESOME""}

The data is in JSON format, this then gets used in the next task in the workflow called as the code task (uses JavaScript) so that we can process this data.

What I am doing is

JSON.parse(`{"feedback_type":"Dining","reservation_id":"1234","order_id":null,"recommend_to_friend":"No","overall":"2","food":"3","ambience":"4","service":"5","notes":"The food was "AWESOME""}`)

Which is failing due to double quote breaking the JSON format.

This is the only way I can pull data in the code task (in a string).

I tried using regex to replace the problemeatic double quote but i was not able to figure out way to only remove/replace the one we wanted gone.

Problem with Firebase filters, how can i solve?

this is my first post here. I’m learning JS and how to use Firebase. I’m making a do to list with some filters, but every time I change the filters, a new request is being made. So when I submit the file, it shows the added task several times on the screen

https://prnt.sc/F8cePcmzzMvj

In this example, I changed the filters 4 times, so when I add the task, it is rendered 4 times.

enter image description here

The same thing was happening with login and logout, but then I put a removeEventListener and it is working perfectly, but I have no idea how to do it with the filters.

const updateOrderList = user => {
    let inputName = 'taskValue';
    let orderValue = orderBy(inputName);
    let whereValue = '';

    orderAscDesc.forEach(radio => {
        if (!radio.checked) return;

        if (radio.value === 'order__asc') {
            orderValue = orderBy(inputName);
            clearLis();
        } else if (radio.value === 'order__desc') {
            orderValue = orderBy(inputName, 'desc');
            clearLis();
        }
    });

    orderChecked.forEach(radio => {
        if (!radio.checked) return;

        if (radio.value === 'Completas') {
            whereValue = where("checked", "==", true);
            clearLis();
        } else if (radio.value === 'Incompletas') {
            whereValue = where("checked", "==", false);
            clearLis();
        }
    });

    orderAlphaDate.forEach(radio => {
        if (!radio.checked) return;

        if (radio.value === 'data') {
            inputName = 'date';
            clearLis();
        } else if (radio.value === 'alpha') {
            inputName = 'taskValue';
            clearLis();
        }
    });

    const onlyUser = where('userID', '==', user.uid);
    const queryPhrases = query(
        collectionTask, 
        whereValue, 
        onlyUser,
        orderValue
    );

    clearLis();
    onSnapshot(queryPhrases, renderTasks);
};

I just want the filter to work without having to refresh the page every time

My wallet private key got stolen, after I hardcoded it

Some time ago, I inherited an online browser game and with some tinkering, I managed to put it online. It’s mainly vanilla JS, PHP and NodeJS for the server side. The game includes payments (both incomming and outgoing), using MetaMask. I was a novice with transactions, blockchains, Solidity then, so I just went on tried to publish the game to see what happens. While in localhost testing, no harm was done. I copied the old contract from the original owner and implemented it, and to my amazement everything worked very well. But soon after I published the game online, my MetaMask got drained. I had 10$ in it, so it was no big deal and I’ve changed to a new wallet since then. I thought somewhere in the scripts, there might have been a row that led to this.

Currently, I am undergoing some interesting Blockchain/Solidity courses with the dream of making my own project one day. And at some point, during the course, I remembered about this old game and how I’d hardcoded the Private Key in the index.js…I had no experience then. But could that’ve led to the private key leaking in such a short period of time (1-2 days)? Maybe if I encrypt it correctly this time, maybe using .env file at first, after that encrypting in to a separate file and doing something like this:

  const wallet = new ethers.Wallet(process.env.PRIVATE_KEY);
  const encryptedJsonKey = await wallet.encrypt(
    process.env.PASSWORD,
    process.env.PRIVATE_KEY
  );
  fs.writeFileSync("./.encryptedKey.json", encryptedJsonKey);

const encryptedKey = fs.readFileSync("./.encryptedKey.json", "utf8");
    let wallet = new ethers.Wallet.fromEncryptedJsonSync(
    encryptedKey,
    process.env.PASSWORD
    );
    wallet = await wallet.connect(provider);

, thus deploying it with the password that only I know and which might not even be on the PC. I am wondering will that be enough? And how big is the risk? Can the previous private key have leaked due to my hardcoding it in the server-side code, or is the risk still not worth trying one more time? Have you encountered similiar cases and what good practices can you recommend me in this scenario?

I am sorry if the question is inappropriate, but I hope I can find some good advice here. These are the two options I can think of and would appreciate any kind help:

  • either there’s some malicious code in the project
  • or hardcoding the private key last time led to almost instant leakage, once published online

Thanks!

Static files are not loading

I’ve tried to deploy my react app on nginx, server is up but static files are not loading. I’ve tried many things but not of them are working.

http {
server {
  listen 80;
  server_name my-server.test;
  location /{
    root /srv/build;
    index index.html;
    try_files $uri $uri/ /index.html;
  }
}
}

enter image description here

environment variables on vercel with sveltekit

I have a run time environment variable MY_ENV, which I have setup locally and create in my cicd pipeline also.

I access this environment variable in my svelte app, using $env/dynamic/private, locally it works fine. But when deployed into vercel, the environment variable is shown as undefined.

/** +layout.server.js */
import { env } from '$env/dynamic/private';

/** @type {import('./$types').LayoutServerLoad} */
export async function load() {
  let my_env = env.MY_ENV;
  let my_region = env.MY_REGOIN;

  let BASE_SARAL_API_URL = 'api.saral.club/api/v1';
  let url = env.LOCAL ? 'http://localhost:8000/api/v1' : `https://${my_env}-${BASE_SARAL_API_URL}`;
  return {
    BASE_SARAL_API_URL: BASE_SARAL_API_URL,
    URL: url,
    MY_ENV: my_env,
    MY_REGION: my_region
  };
}
<script>
/** someCompnent.svelte */
export let data
</script>
....

In my cicd config yml file, I am using circle-ci. I run the following sets of command:


... 
   vercel pull --yes enviornment=preview --token=$VERCEL_TOKEN
   vercel build --token=$VERCEL_TOKEN
   vercel deploy --prebuilt --token=$VERCEL_TOKEN
...
...

I tried with using --build-env option but it didn’t work. I passed it as follows:

...
   vercel deploy --build-env MY_ENV=$MY_ENV --token=$VERCEL_TOKEN
...

I also tried, by setting up the environment variable in the vercel UI and making sure I run the pull step before, but that was also unsuccessful.

Basically, I am looking for help on how to pass my cicd environment variables such that they are available in vercel functions and it is able to render successfully.

HTML- asp:linkbutton dando tp pra tab inicial

estou fazendo um ERP, nele tenho varias abas, feitas a partir de bootstrap com tags , numa delas, tenho um link button q ao ser precionado (executa normalmente o OnClick) por algum motivo, teleporta para a aba inicial (com classe “active”)

tentei manipular o href, postbackurl, e até usar JS pra tentar mudar a aba com a classe “active” para a atual, mas nada até ent tem funcionado.

How to get multiple ‘bezoekers’ or people from this API?

I need to make a simple website this time that shows 6 different people or ‘bezoekers’ with their full name, picture, email and country. I’ve got almost everything ready apart from getting 6 different people on the website. I tried using a for loop but this gave me the following error: ‘Cross-Origin-request blocked’.

Now apparently it’s possible to get 6 different people from the API in another way that won’t give me the error but I can’t figure it out. I can of course put 6 different fetch requests in 1 function but that’s a lot of unnecessary work when there are other better options that look and read better.

function useData(data) {
    let persons = document.querySelector(".persons");
    let div = document.createElement("div");
    let name = document.createElement("h3");
    let foto = document.createElement("img");
    let email = document.createElement("p");
    let country = document.createElement("p");

    name.innerText = `${data.results[0].name.first} ${data.results[0].name.last}`;
    foto.src = `${data.results[0].picture.medium}`;
    email.innerText = `${data.results[0].email}`;
    country.innerText = `${data.results[0].location.country}`;

    div.appendChild(name);
    div.appendChild(foto);
    div.appendChild(email);
    div.appendChild(country);
    persons.appendChild(div);
}

function getData() {
    const dataUrl = "https://randomuser.me/api/";
    fetch(dataUrl)
        .then((response) => {
            let data = response.json();
            return data;
        })
        .then((data) => {
            useData(data);
        });
}

getData();
body {
    display: flex;
    flex-direction: column;
    align-items: center; 
}

.persons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.persons > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid blue;
    width: clamp(250px, 30vw, 300px);
}

h3 {
    width: 100%;
    text-align: center;
    background: blue;
    color: white;
    padding-block: .5rem;
}
<!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>Javascript Object Notation</title>
    <link rel="stylesheet" href="style.css">
    <script src="script.js" defer></script>
    
</head>

<body>
    <h1>Who is that person?</h1>
    <div class="persons"></div>
</body>

</html>

How to read request attribute in a JSP after a POST request from the same JSP?

I’m working on a webapp with JAVA servlet backend and JSP frontend. This is my problem:
in jsp page i have three select form, the options of this form are taken from the DB, so when i load the page the servlet take the info from DB and set attribute in the request and i fill the options of the form. What i would to do is, when i select an item in the first form, the option in the other two form change depending on the selected value. To do this my idea was to take the value of the first form make a POST request with javascript to the servlet, elaborate data, set the request attributes inside the servlet and forwarding to the same jsp. At this point i don’t understand how to retrive the attributes i set, cause i don’t really understand if the servlet is reloaded or not. I tried using javascritp with no result, i don’t think this is strange case but i don’t find an answer.

When the first select change this code is triggered:

 function postJSON(data){
        try {
            const response = fetch("<%=contextPath%>/Dispatcher?controllerAction=RegistrationManagement.matchComuni",{
            method: "POST",
            body: data,
        }).then((response)=>{
            console.log(response.status);
        });
        
        } catch (error) {
            console.error("Error: ", error);
        }
    }

This is part of method that elaborate data:

public static void matchComuni(HttpServletRequest request, HttpServletResponse response){
        DAOFactory daoFactory= null;
        Logger logger = LogService.getApplicationLogger();
        List<Regione> regioni = new ArrayList<Regione>(); 
        List<Citta> listaCitta = new ArrayList<Citta>();
        List<Provincia> province = new ArrayList<Provincia>();
        String selectedRegioneJSON;
        String regioniJSON;
        String listaCittaJSON;
        String provinceJSON;
        try {
            daoFactory=DAOFactory.getDAOFactory(Configuration.DAO_IMPL, null);
            daoFactory.beginTransaction();
            
            RegioneDAO regioneDAO = daoFactory.getRegioneDAO();
            regioni = regioneDAO.findRegioni();
            ObjectMapper mapper = new ObjectMapper();
            regioniJSON = mapper.writeValueAsString(regioni);
            selectedRegioneJSON = request.getParameter("selectedRegione");
            Regione selctedRegione = mapper.readValue(selectedRegioneJSON, Regione.class);
            CittaDAO cittaDAO = daoFactory.getCittaDAO();
            listaCitta = cittaDAO.findCittaByRegione(selctedRegione.getIdRegione());
            listaCittaJSON = mapper.writeValueAsString(listaCitta);
            ProvinciaDAO provinciaDAO = daoFactory.getProvinciaDAO();
            province = provinciaDAO.findProvinceByRegione(selctedRegione);
            provinceJSON = mapper.writeValueAsString(province);

 
            request.setAttribute("regioniJSON", regioniJSON);
            request.setAttribute("listaCittaJSON", listaCittaJSON);
            request.setAttribute("provinceJSON", provinceJSON);
            request.setAttribute("viewUrl", "/registration/registration");

at this point in the servlet i received the correct data and all the elaboration are fine so the data are send to the jsp with request.setAttribute(), but i don’t find how to read the new data. I don’t understand if at this point the jsp is completely reloaded or partial reloaded or the same as before the POST request.

I tried to read the new data in javascript with:
let var = '<%(String)request.getAttribute(provinceJSON)%>'; but return null

let urlParam = new URLSearchParams(window.location.search);
let paramJSON = urlParam.get("provinceJSON");

return null

let urlParam = new URLSearchParams(response.url);
let paramJSON = urlParam.get("provinceJSON");

return null

As i said before i don’t think this is a strange scenario, but i don’t find a solution, i hope in yours help.

P.S. I’m sorry for my bad english it isn’t my first language.

Moving Points and lines mapbox

I am creating some mapping software with Mapbox GL JS. So far it has gotten a bit complex but everything is working how I intended except for moving features. The behavior is expected except in a few edge cases. It seems to happen when I am editing the point of a LineString with multiple points.

here is a link to a gif demonstrating my issue

MoveFeatures.js

var editing_feature = null;
var moving_features = false;
var get_manipulated_coordinate_index_buffer = 5;
var click_buffer = 5;
var get_attached_lines_buffer = 5;
var manipulated = null;
var manipulated_sources_buffer_array = [];

var get_attached_lines = (point_feature) => {
    var point = window.MAP.mapbox.project(point_feature.geometry.coordinates);
    var buffer = get_attached_lines_buffer;
    var b = [window.MAP.mapbox.project([window.MAP.bounds.x, window.MAP.bounds.y]), window.MAP.mapbox.project([window.MAP.bounds.i, window.MAP.bounds.j])];
    var features = [];

    window.MAP.mapbox.queryRenderedFeatures([[point.x - buffer, point.y - buffer], [point.x + buffer, point.y + buffer]], {layers: ['lines']}).forEach((feature) => {
        features[feature.id] = feature;
    })
   

    var at = window.MAP.mapbox.queryRenderedFeatures(b, {layers: ['lines']}).filter((feature) => {
        return features[feature.id] !== undefined;
    })
    //console.log(at)
    return at
}

var get_manipulated_coordinate_index = (attached_lines, point_feature) => { //gets the index of the coordinates that is being manipulated in a LineString
    console.log(attached_lines)
    var point = window.MAP.mapbox.project(point_feature.geometry.coordinates);
    var buffer = get_manipulated_coordinate_index_buffer;
    var indexes = [];
    var pt1 = turf.polygon([[[point.x - buffer, point.y - buffer],[point.x + buffer, point.y - buffer],[point.x + buffer, point.y + buffer],[point.x - buffer, point.y + buffer],[point.x - buffer, point.y - buffer]]]);
    attached_lines.forEach((feature, i) => {
        feature.geometry.coordinates.forEach((coordinate, j) => {
            var converted = window.MAP.mapbox.project(coordinate);
            var pt = turf.point([converted.x, converted.y]);
            if(turf.booleanPointInPolygon(pt, pt1)){
                indexes.push({line_index:i, coordinate_index:j, source:window.MAP.mapbox.getSource(feature.source)})
            }
        })
    })
    return {indexes:indexes, lines:attached_lines};
}

export default {
    actions:[
        {
            event_type:'click',
            func: (e) => {
                var buffer = click_buffer;
                var feature = window.UTILS.get_clicked_point(e);
                window.UTILS.toggle_point_highlight(feature);
                if(!moving_features){
                    if(feature != null){
                        moving_features = true;
                        editing_feature = window.MAP.mapbox.getSource(feature.properties.s_uid + '_hovered')._data.features.filter((f) => { return f.id == feature.id })[0];
                        manipulated = get_manipulated_coordinate_index(get_attached_lines(editing_feature), editing_feature);
                    }
                }else{
                    editing_feature = null;
                    manipulated = null;
                    manipulated_sources_buffer_array = [];
                    moving_features = false;
                }
            }
        },
        {
            event_type:'mousemove',
            func: (e) => {
                if(moving_features){
                    manipulated.lines.forEach((feature, i) => {
                        var f = feature;
                        if(manipulated.indexes[i] !== undefined){
                            f.geometry.coordinates[manipulated.indexes[i].coordinate_index] = [e.lngLat.lng, e.lngLat.lat];
                        }
                        window.UTILS.update_feature(f);
                    })
                    editing_feature.geometry.coordinates = [e.lngLat.lng, e.lngLat.lat];
                    window.UTILS.update_feature(editing_feature);
                }
            }
        },
        {
            event_type:'disable',
            func: (e) => {
                window.UTILS.toggle_point_highlight(editing_feature);
                editing_feature = null;
                manipulated = null;
                manipulated_sources_buffer_array = [];
                moving_features = false;
            }
        }
    ]
}

Utils.js

var debounced = [];

const UTILS = {
    rgb_to_hex: (rgb) => {
        rgb = rgb.split('(')[1].split(')')[0].split(',')
        var r = parseInt(rgb[0]);
        var g = parseInt(rgb[1]);
        var b = parseInt(rgb[2]);
        return "#" + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1);
    },

    hex_to_rgb: (hex) => {
        if(hex[0] == '#'){
            hex = hex.slice(1);
        }
        return `rgb(${parseInt(hex.slice(1, 3), 16)}, ${parseInt(hex.slice(3, 5), 16)}, ${parseInt(hex.slice(5, 7), 16)})`;
    },

    get_clicked_point: (e) => {
        var buffer = 5;
        var symbol_hover_layers = window.MAP.loaded_images.map((image) => { return image + '_hovered' });
        var feature = window.MAP.mapbox.queryRenderedFeatures([[e.point.x - buffer, e.point.y - buffer], [e.point.x + buffer, e.point.y + buffer]], {layers:[...window.MAP.loaded_images, ...symbol_hover_layers] })[0];

        if(feature && feature.geometry.type == 'Point'){
            return  feature
        }else{
            return null;
        }
    },

    get_render_area(){
        var bounds = window.MAP.mapbox.getBounds();
        var topLeft = bounds.getNorthWest();
        var bottomRight = bounds.getSouthEast();
        return {x: topLeft.lng, y: topLeft.lat, i: bottomRight.lng, j: bottomRight.lat}
    },

    get_render_area2(){
        var render_area = window.UTILS.get_render_area();
        var start = window.MAP.mapbox.project([render_area.x, render_area.y]);
        var end = window.MAP.mapbox.project([render_area.i, render_area.j]);
        return [start, end]
    },

    debounce(func, timeout){
        if(window.debounce_timeout){
            clearTimeout(window.debounce_timeout);
        }
        window.debounce_timeout = setTimeout(func, timeout)
    },

    delete_feature(feature){
        var source = window.MAP.mapbox.getSource(feature.source);
        source._data.features = source._data.features.filter((f) => {
            return f.id !== feature.id;
        });
        source.setData(source._data);
    },

    update_feature(feature){
        this.delete_feature(feature);
        var source = window.MAP.mapbox.getSource(feature.source);
        source._data.features.push(feature);
        source.setData(source._data);
    },

    toggle_point_highlight(feature){
        if(feature){
            if(feature.properties.hover){
                this.unhighlight_point(feature);
            }else{
                this.highlight_point(feature);
            }
        }
    },

    highlight_point(feature){
        if(feature.geometry.type == 'Point'){
            this.delete_feature(feature);
            feature.properties.hover = true;
            var s = window.MAP.mapbox.getSource(feature.source + '_hovered');
            feature.source = feature.source + '_hovered';
            s._data.features.push(feature);
            s.setData(s._data);
        }
    },

    unhighlight_point(feature){
        if(feature.geometry.type == 'Point'){
            this.delete_feature(feature);
            feature.properties.hover = false;
            var s = window.MAP.mapbox.getSource(feature.source.replace('_hovered', ''));
            feature.source = feature.source.replace('_hovered', '');
            s._data.features.push(feature);
            s.setData(s._data);
        }
    }
}

export default UTILS;

Has anyone here implement feature manipulation in mapbox? What could I do differently to make this behave better? All i need to move is the points and the lines attached to them the rest of the lines should be maintained.

Apache guacamole: I can’t establish a valid connection to the apache guacamole server via its javascript api(guacamole-common-js)

I’ve only been using apache guacamole for a short time, and the lack of documentation for devs makes my task too complicated. I’ve already been able to install my apache guacamole server and solve the cors font problem via a reverse proxy, but now I’m stuck trying to establish a connection between my react app and the guacamole server. i get an xml error telling me that the connection request is incorrect. i understand the error but i can’t do anything because i don’t understand part of the request i made to the server myself.

const tunnel = new Guacamole.HTTPTunnel(
      `https://domain/tunnel`, false,
      { 'Authorization': `Bearer C0EF00672DABBC895E76F93E83ABA6A875718564ADEF458FAF4C7CF570D32873` }
    );
    const dataSource = "mysql";
    const id = "2";
    const type = "c";
    const token = "C0EF00672DABBC895E76F93E83ABA6A875718564ADEF458FAF4C7CF570D32873";

    useEffect(()=>{
        //const tunnel = new Guacamole.WebSocketTunnel(baseUrl);
        const guac = new Guacamole.Client(tunnel);
          $('.guacamole').append(guac.getDisplay().getElement());
         // guac.connect(`{"host" : 1, "endpoint" : "/"}`);
          guac.connect(
           `token=${token}&GUAC_DATA_SOURCE=${dataSource}&GUAC_ID=${id}&GUAC_TYPE=${type}&GUAC_WIDTH=3712&GUAC_HEIGHT=1310&GUAC_DPI=192` //&GUAC_TIMEZONE=Europe%2fBerlin&GUAC_AUDIO=audio%2fL8&GUAC_AUDIO=audio%2fL16&GUAC_IMAGE=image%2fjpeg&GUAC_IMAGE=image%2fpng&GUAC_IMAGE=image%2fwebp`
          );
        // eslint-disable-next-line
        guac.onerror = (error) => console.log(error.message);
    },[])

please can someone explain to me how guacamole’s connect() method works and the usefulness of the different attributes(GUAC_ID,GUAD_TYPE). Thank you

i tried to find documentation or explanations of this method and attributes on other sites but couldn’t find any. i tried to look for code examples but nothing was explicit enough.

Im looking for advice with Javascript code

I’m making a website to display and eventually sell my photography works. I want a way to just put my pictures into a folder and have them automatically displayed on the web page, instead of manually typing in the name and file path into the html. Can some one help ?

 
    const folderPath = "/home/jordan/Desktop/python/photo gallery";
    document.getElementById("birdsPage");
    fetch(folderPath).then(response => response.text()).then((data) => {
      const fileNames = data.split('n');

      fileNames.forEach(fileName => {
        if (fileName) {
          const imageUrl = folderPath + fileName;
          const img = document.createElement('img');
          img.src = imageUrl;
          birdsPage.appendChild(img);
          console.log(imageUrl);
          console.log(fileName);

        }
      });
    })

This is the code i tried but it does not work and i do not understand JavaScript enough yet to figure out what is wrong with it