My question is of data manipulation. Say I have multiple data arrays with the structure as follows: With real data it could look e.g. like this: The I need to merge multiple of such arrays into one, which is is easy if the time axes are matching. If I have e.g. three short sample arrays: they would be merged …
mapbox change source property
I want to make a cluster layer with mapbox, yes I made it :D. But I want to be able to turn it off So I’m making a source Now I’m able to set the data: After this I am setting the layers for the clusters and circles. Now clustering is working But now: How can I set the cluster:
getting the height of the text in a fixed height div
Say I have this code: With a font-size of 150px it’s none to surprising that the text inside the div would be bigger than the div itself. At least in Google Chrome it is. My question is… how might I go about figuring out the height / width of the text within a fixed size div? Using jQquery, $(R…
ERR_IMPORT_ASSERTION_TYPE_MISSING for import of json file
This code was working fine. I don’t know if it’s because I upgraded to Node 17 or what, but now I get In my api.ts I have: Here’s how I start api.ts which is used by server.ts: Answer You will need to use: https://github.com/tc39/proposal-import-assertions
Is there any way to get milliseconds in CronJobs?
I want to render JavaScript function in every 500ms using node Cronjobs. But I could find function for every 1 second as below. Is there anyway to run function on every 500ms using node Cronjob? Answer Setting a cron job to execute that frequently is not possible, and for good reason – a task executing …
Send order to children
Basically, as above, there is the Accordion components and a parent component that hosts all of them. Each Accordion component has a state called open. I want to change state of each child from parent component. How can I send an order to a child component to change its state? Answer Lift your state up into P…
CSS/JS : How to Retrieve a numerical value from a CSS property in JS and modify it?
I’ve tried looking around but was not able to find a clear/easy answer. Let’s say I want to retrieve some value (size) in px for a CSS style sheet like this : I’ve tried But it returns a string. I’d like to modify the value in px dynamically with JS. Is there a better way or should I c…
React never ending loop in useEffect
Apologies. React noob here. Got an issue where my code has stuck on a never ending loop. I’ve stripped the code down only to the part I believe that’s causing the problem. I’ve used the useEffect method to match the componentDidMount. Is that correct? The moment I comment “setPackages(…
How to sort two sorted arrays without using sort methods (sort) nor sort algorithms (bubble sort, quick sort)
I was asked in an interview and my answer was similar to this, which is wrong due to the final loop. Answer What you are talking about — “sorting” two arrays that are each themselves already sorted — is called a merge. This is how you do that:
Constructing array within vue method
I’m currently sending multiple values through a selection change event in vue, and I’m logging the values within my method call to make sure they exist in the method( they do) My issue is that I need to take the values within that method and create an array structured like this: My issue is that I…