connect online existing database with node js

I have a database an online link to the database and I want to connect it to node js and fetch data in my javascript project.
https://unplausible-trouble.000webhostapp.com/editor-4.8.1-mysql.php
And a Data in this database is related to this project.
https://visjs.github.io/vis-timeline/examples/timeline/other/groupsPerformance.html
I want to connect my project with the database which exists online.

Why does .join Method not work on my array?

I want to use JS to create a XML file, for thus I want to print my array that contains the snippets of my XML file without commas but .join() doesnt work

// creating of the XML snippets “<test” and “>”

let testArray = [];
var XML = new XMLWriter();
XML.BeginNode("test");
XML.EndNodeSingle();

// pushing into array and using .join()

testArray.push(XML.XML);

testArray = testArray.join(' ');

// trying to print array into a textarea

document.getElementById('xml').innerHTML = testArray;

// returns <test,>” but <test> is needed

Regex to validate comma separated string with special characters [closed]

I want a common regex to validate below comma separated strings.

input: 10.25.02.12:19092,10.25.02.12:29092,10.25.02.12:39092,10.25.02.12:49092 => should pass

input: at-sdf-dfds-in,at-dfd-in-32,at-wtn-df-df-dfd-in => should pass

input: localhost:19092,localhost:29092,localhost:39092,localhost:49092 => should pass

input: strg1,strg2,strg3 => should pass

input: localhost:19092, => should fail as comma at the end

Please help in this. Thanks in advance.

Loading CSV file to Neo4j using Docker not working

I have a problem while importing .csv file to Neo4j. My neo4j is on docker, when trying to import the csv using express, I get an error:
Neo4jError: Couldn't load the external resource at: file:/organizations.csv

I followed this: Neo4j LOAD CSV Error: unknown protocol: c, so I changed my neo4j.conf file, but it didn’t resolve my problem, I still get the error. The path is 100% fine, because my .js file is where the .csv file is.

LOAD CSV FROM 'file:///organizacje.csv' AS line
MERGE (o: Organization {organizationNr: toInteger(line[0]),name: line[1]})
RETURN o

What is wrong here?

Why does this function prompt twice?

I’ve written a bookmarklet for clicking a controllable amount of times on a HTML element (for clicker games, the like). However, when I run it, it prompts “How many times do you want to click?” twice.

To the best of my knowledge, the second prompt doesn’t do anything. Is there a way I can get rid of it?

Code:

javascript:
var clicked = false
document.onclick= function(event) {  
    if (!clicked) {
      var target= 'target' in event? event.target : event.srcElement;

      var clickamount= parseInt(prompt("Enter time to click "+target.id))-1;

      for (let i = 0; i < clickamount; i++) {
          target.click();
      }
      clicked = true
    }
    
};

Why does the smallest bubble size of this Highcharts jsFiddle example seem incorrect and how do I fix it?

I’m creating a bubble map and am having a problem with the smallest bubble sizes which are not behaving as I expect. After searching a bit in the documentation to understand the problem, I found this:
https://api.highcharts.com/highcharts/plotOptions.bubble.sizeBy

I don’t want to change the setting for ‘sizeBy’ from its default Area (that makes the most sense for my data) but there is helpful example alongside the API entry in JSFiddle:

https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/bubble-sizeby/

Highcharts.chart(‘container’, {

chart: {
    type: 'bubble',
    plotBorderWidth: 1,
    zoomType: 'xy'
},

title: {
    text: 'Highcharts Bubbles Sizing'
},
subtitle: {
    text: 'Smallest and largest bubbles are equal, intermediate bubbles different.'
},

xAxis: {
    gridLineWidth: 1
},

yAxis: {
    startOnTick: false,
    endOnTick: false
},

series: [{
    data: [
        [1, 1, 1],
        [2, 2, 2],
        [3, 3, 3],
        [4, 4, 4],
        [5, 5, 5]
    ],
    sizeBy: 'area',
    name: 'Size by area'
}, {
    data: [
        [1, 1, 1],
        [2, 2, 2],
        [3, 3, 3],
        [4, 4, 4],
        [5, 5, 5]
    ],
    sizeBy: 'width',
    name: 'Size by width'
}]

});

Keeping in mind that I’m only nterested in showing by Area (the default), what I don’t understand about the example is why the first bubble (which has a z value of 1) is so small compared to the other bubbles. It’s area should be 0.5 times the area of the second bubble (which has a z value of 2). But it’s much much smaller (like 1/10 of the area). All of the other bubbles however seem to be proportionally correct — it’s really just that first bubble.

So my question is — why is the first bubble so small and is there a way to prevent this from happening so that all of the bubbles are proportionate according to area?

Many thanks in advance,

David

How to display divs on each other, horizontally and centered?

I have a container, which children from 1 to 6 elements, it depends. Here are the styles of the container:

  display: flex;
  min-height: 40.25rem;
  justify-content: center;

Here is what I need:
enter image description here

When I’m setting position: relative; left: 60px * n; it moves the children as expected. But the container itself doesn’t center the items in the center. So visually the items occupy more space in the left side. How can I stack the items, keeping the common position centered?

Array of string to array of array in Javascript

I’m wondering how to convert an array of strings

lines = ['101','010','110'];

to an array of arrays like this:

x = [
[1,0,1],
[0,1,0],
[1,1,0]'
]

I already tried

x = (lines.forEach(e => (e.split(''))))

and realized String.split doesnt mutate the current string. So my next step was to create a new array with these values.

x = new Array(lines.forEach(e => (e.split(''))))

My thoughts behind this line:
The code should take an element (e) of the lines array and apply the split funtion to it. (which is does when i console.log() it.) BUT it doesnt apply it to the new array.

Maybe the problem is, that it doesn’t loop through x but maybe i overlook another fact.

How input accepts only HEX numbers

I have an input field and I want to give this field a validation that accepts only hex numbers. So it should accept numbers from 0 to 9 and letters from A to F.

Here is my input field:

<input type="text" class="form-control" tabindex="9" maxlength="2">

How do you think I can achieve this?

How do you serve this different HTML version depending on viewport width?

So I have a rather primitive HTML table, but it should have two versions – one for mobile, one for desktop/tablet.

In the desktop version the table is normal – information is on the left side and the corresponding points are at the right side.

Now in the mobile version there should be a new tablerow which contains the same text in a rowspan of 2.

As far as I am aware, this isn’t possible to do with purely CSS (media queries)…

I am aware you can get the viewport height and width using JavaScript, but then it should be transmitted to an API which gives corresponding content.

  • Is this prototype any good?:

The frontend sends a POST request using Fetch to the Backend with the data of the viewport width and then fetches the corresponding HTML from the Backend via AJAX.

  • Would this work?
  • This looks rather cumbersome and complicated for such basic functionality. Is there a better way to do this?

My pseudocode:
Frontend:

var width = getViewportwidth();
var xhr = new XMLHttpRequest();
xhr.open(width, url);

.fetch(API URL here, options here etc).then {
Ajax call here.addtodomhere("#domelement");
}

Backend:

[/Apiurlhere]
[GET]
if (width) < 600 {
table markup for mobile view here
} else {
table markup for desktop view here 
}

I am using .NET Core for the Backend if it matters.