Loop in object is faster or loop in array in javascript

I am working on a project with big chunks of financial data. One part of the project is to retrieve the data from the cloud, store it locally in a variable, and run some algorithms.

After retrieving the data, how should I store it in the local variable, whether in an object or an array? For running algorithms, objects are easier but I don’t know about their loop speed with respect to the array?

Two loggers can be used at the same system?

Assuming we got a LARGE system written by JS / Java,

Is it possible to use 2 types of loggers in the same system?

(Both loggers are based on log4j and slf4j)

BUT is it possible to use two loggers at the same code?
(at the aspect of compilation and running well, doing a good logging job, etc.)

Issue in bottom footer

 <script>
    
    // external js: isotope.pkgd.js

// init Isotope elements
var  $box = $(".isotope-box").isotope({
  itemSelector: ".isotope-item"
});
// filter functions
// bind filter button click
$(".isotope-toolbar").on("click", "button", function () {
  var filterValue = $(this).attr("data-type");
  $(".isotope-toolbar").find(".active").removeClass("active");
  $(this).addClass("active");
  if (filterValue !== "*") {
    filterValue = '[data-type="' + filterValue + '"]';
  }
  console.log(filterValue);
  $box.isotope({ filter: filterValue });
  });



// change is-checked class on buttons

</script>
        

issue in page bottom footer. please give some suggestion please…..

https://ardigitalsolutions.com.au/portfolio.php

response as soon as possible.

Thanks

MinIO JS presignedUrl for a dir?

i am working on a free time project with minioJS. I hosted Minio locally inside docker. I can upload and download files as intended.
Now i want to include a share option. If i only want to share a file, everything is working as it should. But as soon as i try to share a complete directory it doesn’t work as indented, i think.

My server code looks like this:

router.get('/item-share', (req, res) => {
  let {name, filename, prefix} = req.query;

  filename = filename === undefined ? '' : filename
  prefix = prefix === undefined ? '' : prefix
  console.log(prefix);
  console.log(filename);
  minioClient.presignedUrl('GET', name, filename, 24*60*60, {'prefix': prefix, 'max-keys': 1000}, function(err, presignedUrl) {
    if (err) return console.log(err)
    console.log(presignedUrl)
  })
})

It will generate a link like

http://localhost:9000/test?prefix=Images&max-keys=1000&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIOSFODNN7EXAMPLE%2F20220522%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220522T093448Z&X-Amz-Expires=86400&X-Amz-SignedHeaders=host&X-Amz-Signature=6f0976109ad01e2c2884eb172e9a5f9da81d25440fa6ce859e63f80d89f4320c

But as soon as i open the link in my browser things for file vs directory will change.
If the Link only points to a singe file, it will be downloaded. If the link points to a directory i only got xml like this one:

<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>test</Name>
<Prefix>Images</Prefix>
<Marker/>
<MaxKeys>1000</MaxKeys>
<Delimiter/>
<IsTruncated>false</IsTruncated>
<Contents>
<Key>Images/1000_F_322192264_BhriQEjzYlpYy2gw3ec2Mh3hdFwiZora.jpg</Key>
<LastModified>2022-05-21T11:08:19.841Z</LastModified>
<ETag>"c7a573c18eb29edb04481ae35c6f559e"</ETag>
<Size>841913</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/Anmerkungen_Texte-Landingpage_Vereine.pdf</Key>
<LastModified>2022-05-21T11:08:19.810Z</LastModified>
<ETag>"f096f257049e8912e485784472237d62"</ETag>
<Size>58585</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/Manfred-Stoffers-Markus-Rejek-Paul-Gauselmann.jpg</Key>
<LastModified>2022-05-21T11:08:21.592Z</LastModified>
<ETag>"5e536a8105ba37fefdd55e4c4584d461"</ETag>
<Size>782106</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/TexturesCom_AsphaltCloseups0050_1_seamless_S.jpg</Key>
<LastModified>2022-05-21T11:08:21.855Z</LastModified>
<ETag>"f61e71d3f430623676e19c7bc42d38f8"</ETag>
<Size>784980</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/Verbände_Vereine_AdobeStock_130999164.jpg</Key>
<LastModified>2022-05-21T11:08:22.711Z</LastModified>
<ETag>"873e435293e540d8150df848a8855ef9"</ETag>
<Size>78907</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/aerial-view-of-a-sports-field-with-footballers-pla-2022-04-05-07-46-06-utc.jpg</Key>
<LastModified>2022-05-21T11:08:20.295Z</LastModified>
<ETag>"ee03664c19c5cde532be5081af797006"</ETag>
<Size>13503770</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/african-american-male-athlete-2021-09-01-11-18-32-utc.jpg</Key>
<LastModified>2022-05-21T11:08:20.095Z</LastModified>
<ETag>"7dd404b6bd659a653fc1fcb74c18240e"</ETag>
<Size>8098032</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/antique-bust-of-male-in-hat-with-carnations-bouque-2022-01-12-03-19-21-utc (Groß).jpg</Key>
<LastModified>2022-05-21T11:08:19.811Z</LastModified>
<ETag>"4d2230e48d2b4c9b965caeab6fab9627"</ETag>
<Size>165074</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/antique-bust-of-male-in-hat-with-carnations-bouque-2022-01-12-03-19-21-utc (Mittel).jpg</Key>
<LastModified>2022-05-21T11:08:19.818Z</LastModified>
<ETag>"464957a226185733eb336b61f11a36b5"</ETag>
<Size>105126</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/antique-bust-of-male-in-hat-with-carnations-bouque-2022-01-12-03-19-21-utc.jpg</Key>
<LastModified>2022-05-21T11:08:21.344Z</LastModified>
<ETag>"490ae0ec4ba720e9b1fb548e4a69e38b"</ETag>
<Size>21354291</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/antique-style-roman-or-grecian-bust-on-a-pedestal-2022-02-04-20-31-17-utc.jpg</Key>
<LastModified>2022-05-21T11:08:20.221Z</LastModified>
<ETag>"4633d666a7c4650a45bb851644bf4add"</ETag>
<Size>4384572</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/arminia-bielefeld-neuzugaenge100__v-gseagaleriexl.jpg</Key>
<LastModified>2022-05-21T11:08:19.940Z</LastModified>
<ETag>"66f5d5a965143f96614ca3e5d70f4362"</ETag>
<Size>342624</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/basketball-board-with-basket-hoop-on-playground-2021-08-29-09-40-33-utc.jpg</Key>
<LastModified>2022-05-21T11:08:20.212Z</LastModified>
<ETag>"3e9e7d9fe7b56e6d07ab450edf77b9e0"</ETag>
<Size>3908728</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/beauty-fashion-man-guy-with-bright-makeup-lgbtq-2022-02-08-03-39-26-utc.jpg</Key>
<LastModified>2022-05-21T11:08:20.690Z</LastModified>
<ETag>"4525d92c284cdba3429fb16e72c364b7"</ETag>
<Size>10129187</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/billboard-entdecke-diversit.jpg</Key>
<LastModified>2022-05-21T11:08:20.176Z</LastModified>
<ETag>"2b6e51cc8da603868d5abf2f561e8eca"</ETag>
<Size>352750</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/concepts-of-a-female-bust-with-taped-mouth-and-gla-2022-02-03-06-17-49-utc.jpg</Key>
<LastModified>2022-05-21T11:08:21.452Z</LastModified>
<ETag>"d5ddd65cebb6e9a8cddab6d30379a2aa"</ETag>
<Size>13581956</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/ef238b5a703395ae88807b1e5eb4c5ad.jpg</Key>
<LastModified>2022-05-21T11:08:20.353Z</LastModified>
<ETag>"7f0b281c3fedb9e9b4b1b72e698c2883"</ETag>
<Size>123185</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/fat-woman-exercises-on-the-floor-workout-in-gym-2021-08-26-16-26-04-utc.jpg</Key>
<LastModified>2022-05-21T11:08:21.227Z</LastModified>
<ETag>"2423ee96a9623c6874c21da5ebded1a8"</ETag>
<Size>10134737</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/fat-woman-talks-with-instructor-after-exercise-2021-08-26-16-26-07-utc.jpg</Key>
<LastModified>2022-05-21T11:08:21.529Z</LastModified>
<ETag>"f090fd9ff9ad8dfeb446cbe3f5eaea0d"</ETag>
<Size>12853994</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/female-athlete-standing-in-city-at-night-2022-03-09-02-27-24-utc.jpg</Key>
<LastModified>2022-05-21T11:08:21.471Z</LastModified>
<ETag>"6b4dd9c3c783fae9a99a018f64dc71b5"</ETag>
<Size>11707113</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/ff2ca50e-383f-4b40-ad5c-7a86403f1baf.webp</Key>
<LastModified>2022-05-21T11:08:20.739Z</LastModified>
<ETag>"93e4bd9c45ed11619d99e581395e742d"</ETag>
<Size>27462</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/footballer-at-stadium-2021-09-24-02-52-26-utc.jpg</Key>
<LastModified>2022-05-21T11:08:21.747Z</LastModified>
<ETag>"e001aa3e2f972063063a2d9a112fbff2"</ETag>
<Size>12978641</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/happy-drag-queen-social-influencer-vlogging-online-2021-09-22-15-33-05-utc.jpg</Key>
<LastModified>2022-05-21T11:08:21.703Z</LastModified>
<ETag>"a164f9fb7a5048a3769e66c513703033"</ETag>
<Size>6233796</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/istockphoto-899642232-170667a.jpg</Key>
<LastModified>2022-05-21T11:08:21.423Z</LastModified>
<ETag>"051820fd308f7a2cb124b28a0c0f991d"</ETag>
<Size>151649</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/jhv2020-02.webp</Key>
<LastModified>2022-05-21T11:08:21.472Z</LastModified>
<ETag>"ccaf2868dcd9ff105545965cdcdf77ce"</ETag>
<Size>70766</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/man-with-disability-laying-basketball-2022-01-19-00-08-58-utc.jpg</Key>
<LastModified>2022-05-21T11:08:22.972Z</LastModified>
<ETag>"539cf6cb1455e2290845e1834644312e"</ETag>
<Size>20629094</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/portrait-of-a-drag-queen-at-gay-pride-event-2021-09-02-21-37-45-utc.jpg</Key>
<LastModified>2022-05-21T11:08:21.720Z</LastModified>
<ETag>"18822d8bf1144b012e1dfb5d8aab9e4b"</ETag>
<Size>2524068</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/portrait-of-transgender-young-man-with-flowers-bou-2022-03-09-03-11-31-utc.jpg</Key>
<LastModified>2022-05-21T11:08:22.740Z</LastModified>
<ETag>"f530309e6677e5a839c1c7334ecbefd9"</ETag>
<Size>13724562</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/side-view-of-thoughtful-female-athlete-standing-ag-2022-03-09-02-19-47-utc.jpg</Key>
<LastModified>2022-05-21T11:08:22.681Z</LastModified>
<ETag>"5085473eca0177547b959758b5d0068d"</ETag>
<Size>12550393</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/texture-color-rubber-floor-on-playground-328935281.htm</Key>
<LastModified>2022-05-21T11:08:21.775Z</LastModified>
<ETag>"7be8ca67aed4634a3f8cd0fcbc471d7b"</ETag>
<Size>293181</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/texture-color-rubber-floor-playground-160530284.jpg</Key>
<LastModified>2022-05-21T11:08:21.792Z</LastModified>
<ETag>"798e467a9344e2acfd17f54716385412"</ETag>
<Size>175322</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/transgender-man-fights-for-human-rights-lgbt-conc-2022-02-03-00-34-03-utc.jpg</Key>
<LastModified>2022-05-21T11:08:23.129Z</LastModified>
<ETag>"dfaf17502d01b1255ca64cdab47830d3"</ETag>
<Size>21192503</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/transgender-man-fights-for-human-rights-lgbt-conc-2022-02-07-07-11-31-utc.jpg</Key>
<LastModified>2022-05-21T11:08:22.648Z</LastModified>
<ETag>"2a7cde94fdb1e972de4f4f29d977f69d"</ETag>
<Size>9460816</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/two-white-roman-or-antique-style-grecian-busts-2022-04-07-00-38-18-utc.jpg</Key>
<LastModified>2022-05-21T11:08:22.878Z</LastModified>
<ETag>"44c5b65a81a6283f655a75d50eb43d2d"</ETag>
<Size>13110482</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
<Contents>
<Key>Images/white-marble-bust-of-david-with-eye-and-lip-patche-2022-01-30-01-35-19-utc.jpg</Key>
<LastModified>2022-05-21T11:08:23.121Z</LastModified>
<ETag>"46550585e1dbbd2bd45a4cb8b61e1787"</ETag>
<Size>8958324</Size>
<Owner>
<ID>02d6176db174dc93cb1b899f7c6078f08654445fe8cf1b6ce98d8855f66bdbf4</ID>
<DisplayName>minio</DisplayName>
</Owner>
<StorageClass>STANDARD</StorageClass>
</Contents>
</ListBucketResult>

But i dont want to get the xml, but want to download the dir.

Is that possible?

Thanks in advise 🙂

Accessing a function from IFrame in the parent document

I have created a javascript library (with URL http://js.myapp.com) which when included in the HEAD of any website http://FOO.BAR:

  • Loads some content in IFrame from http://app.myapp.com

Now, is there a way javascript inside http://js.myapp.com can invoke a function inside my javascript library hosted by a client’s website http://FOO.BAR?

I tried accessing that through parent.document but throws a cross-origin error. Is there a way I can achieve this?

Note: IFrame and JS are hosted on the same domain.

Too many re-renders while setting a state

Getting an error of Unhandled Runtime Error while setting a state in an axios get call.
Even tested with a button click and confirmed that function is not called more that once. I don’t know what is the problem with it.

Error: Too many re-renders. React limits the number of renders to prevent an infinite loop.

const [quizzesTaken, setQuizzesTaken] = useState([])

const quizzesTakenByUser = async () => {
    try {
        const res = await axios.get('/api/quizzes/quizzestaken')
        setQuizzesTaken(res.data) // Getting error on this line.
    } catch (error) {
        log(error)
    }
}

<button onClick={() => quizzesTakenByUser()}>Get Quizzes</button>

How to get Javascript variable value in chartjs

I want to get the js variable as an integer in the chart. Here is my code. If I run this code, the chart is not created. I want to get only one value from the variable. Can you help me?

Hello everyone, I want to get the js variable as an integer in the chart. Here is my code. If I run this code, the chart is not created. I want to get only one value from the variable. Can you help me?

<script>
const api_url ="";  
        async function getapi(url) {
            // Storing response
            const response = await fetch(url);
            
            // Storing data in form of JSON
            var data = await response.json();
            // console.log(data);

            var sper=Number((data[0][10]));  // a number for Example 10.5 
            document.getElementById("per").innerHTML = sper;
               
            if (response) {
                hideloader();
            }
            show(data);
        }
    // Calling that async function 
    getapi(api_url);

</script>


<canvas id="VD2"  width="300" height="300"></canvas>
    <script>
        var ctx = document.getElementById('VD2').getContext('2d');
        var xValues = ["Do","Du"];
        var yValues = [ sper, 20];
    
        var VD2 = new Chart(ctx, {
        type: "doughnut",
        data: {
            labels: xValues,
            datasets: [{
            backgroundColor: [ 'rgba(255, 99, 132, 1)', 'rgba(54, 162, 235, 1)' ],
            data: yValues
            }]
        },
        options: {
            plugins: {
                title: {
                display: false,
                text: "VD"
                },
                legend: {
                display: true              
                }
            }
        }
        });
    </script>

Remember if button was clicked + Stop interval doesnt work

so I’m trying to create two buttons. One is refreshing site on interval and second one should stop it after pressing, but the stop button isn’t working. Second thing is that if I press start button it’s not saved in local storage as I want it. Could you guys help me with this?

window.onload = function () {
    if (localStorage.getItem("refresh")) {
        startref()
    }
};

    function startref() {
        let intervalId = setInterval(function () {
                chrome.tabs.query({ active: true, currentWindow: true }, function (arrayOfTabs) {
                 var code = 'window.location.reload();';
                 chrome.tabs.executeScript(arrayOfTabs[0].id, { code: code });


            });
        
        }, 1000);
        localStorage.setItem('refresh');
    }

function stop() {
    clearInterval(intervalId);
}

document.addEventListener('DOMContentLoaded', function () {
    document.getElementById("startbtn").addEventListener('click', startref);

});


document.addEventListener('DOMContentLoaded', function () {
    document.getElementById("stopbtn").addEventListener('click', stop);

});

Dragged div not being dropped correctly

I am trying to recreate the drag and drop board from this website: http://en.battleship-game.org/
The below code shows how I tried implementing it

const ship = document.querySelector('.ship');
const cells = document.querySelectorAll('.cell');

ship.addEventListener("dragstart",(e)=>{
    e.dataTransfer.setData('text/plain',e.target.id); 
});

cells.forEach((cell)=>{
    cell.addEventListener('dragenter',dragEnter);
    cell.addEventListener('dragover',dragOver);
    cell.addEventListener('dragleave',dragLeave);
    cell.addEventListener('drop',drop);
});

function dragEnter(e){
    e.preventDefault();
    e.target.classList.add('drag-over');
    console.log('drag enter');
}

function dragOver(e) {
    e.preventDefault();
    e.target.classList.add('drag-over');
}

function dragLeave(e) {
    e.target.classList.remove('drag-over');
}

function drop(e) {
    e.target.classList.remove('drag-over');
    // get the draggable element
    const id = e.dataTransfer.getData('text/plain');
    const draggable = document.getElementById(id);

    // add it to the drop target
    e.target.appendChild(draggable);
 }
.row{
    display: flex;
}
.cell{
    background-color: lightblue;
    width: 32px;
    height: 32px;
    border: 1px solid black;
    user-select: none;
    position: relative;
}
.ship{
    z-index: 2;
    display: flex;
    position: absolute;
    top: 0;
    left: 0;
    cursor: move;
}
.ship>div{
    background-color: rgb(255, 221, 226);
    border: 1px solid black;
    width: 32px;
    height: 32px;
}
.drag-over {
    border: dashed 3px red;
}
<div class="row">
  <div class="cell">&nbsp;</div>
  <div class="cell">&nbsp;</div>
  <div class="cell">&nbsp;</div>
  <div class="cell">&nbsp;</div>
  <div class="cell">&nbsp;</div>
  <div class="cell">&nbsp;</div>
</div>
<div class="row">
  <div class="cell">&nbsp;</div>
  <div class="cell">&nbsp;</div>
  <div class="cell">
    &nbsp;
    <div class="ship" draggable="true" id="ship">
        <div>&nbsp;</div>
        <div>&nbsp;</div>
        <div>&nbsp;</div>
    </div>
  </div>
  <div class="cell">&nbsp;</div>
  <div class="cell">&nbsp;</div>
  <div class="cell">&nbsp;</div>
</div>
<div class="row">
  <div class="cell">&nbsp;</div>
  <div class="cell">&nbsp;</div>
  <div class="cell">&nbsp;</div>
  <div class="cell">&nbsp;</div>
  <div class="cell">&nbsp;</div>
  <div class="cell">&nbsp;</div>
</div>

When I drag and drop the 3rd pink box I want it to drop with respect to the first pink box. How can this be done?
Dashed red border shows wrt to which box the pink div will be placed

Server Side of Partial Pages in AngularJS

I’m trying to understand how to use $routeprovider in AngularJS. I’m trying to follow this tutorial to pull in partial pages to my main AngularJS app. I pasted the code into the public folder of a new app and am trying to make it work.
However, I’m missing what is supposed to happen on the server side.
When I open the index.html page all is the actual text without any of the variable values filled like they should be. Webpage that I see
When I try to navigate to one of the book or chapter links I receive the following error: Cannot GET /Book/Moby/ch/1. However, adding a route inside my server side doesn’t help much either:
express route
I then recieve the html of the chapter.html file, which isn’t what I want.
enter image description here

So, while I understand I’m missing something in the server side, I’m not sure what that is.
I’m new to AngularJS, though I’ve used express before, and would appreciate any help on how to correctly use $routeProvider, and what I should do in the both client and the server side.

I’ve tried to google this, and while I’ve found many links on how to use ng-view, routeProvider and AngularJS none of them mention the server side.

Get the respective date in the format dd.mm.yyyy from a Json using the map method

I have a problem. I have a json in and inside this is a string with the format dd.mm.yyyy. I would like to output within a loop for each month, once only the day, the day and the month and the complete date.
Unfortunately, if I write it as I am doing right now. I get 1151 displayed.

How do I get the day, month, and complete date back in a loop?

import React, { useState, useEffect } from 'react'

function Test() {

    const days = [
        "Januar",
        "Februar",
        "März",
        "April",
        "Mai",
        "Juni",
        "Juli",
        "August",
        "September",
        "Oktober",
        "November",
        "Dezember"
    ]

    const matchDays = [
        {
            date: new Date(2002,10,1),
        },
        {
            date: new Date('12.05.2022'),
        },
        {
            date: new Date('01/27/2022'),
        }
    ]

    return (
        <div>
            
                    {
                        days &&
                        <>
                            {
                                days.map((d, i) => (


                                    <>
                                        {d}

                                        <>
                                            {
                                                matchDays.map((d, i) =>
                                                    <>
                                                        {
                                                            d.date.getDate()
                                                        }
                                                    </>)

                                            }
                                        </>)

                            }
                        </>
    )
}
</div>

export default Test

A Flash Of Unstyled Contend Appearing On Only One Page

Below is the menu bar and javascript that I’m using to create a website. I’ve set it so that the flash of unstyled content doesn’t appear. The code that I’m using to do this works well on every other page I’ve tested it on except for this one. This is a page with a fair number of photos and text on it, but that wouldn’t affect the page to load ignoring the code I’ve put in, would it?

Does anyone have any solutions for fixing this flash of unstyled content? Also, does anyone know why the code I implemented doesn’t work on only one page?

<!DOCTYPE html>
<html lang="en">
    
<meta name="viewport" content="width=device-width, initial-scale=1.0;" charset="utf-8">
    
<body style="visibility: hidden;" onload="js_Load() background-color: white; font-family: sans-serif;">
    
<title>#</title>
      
<div class="page-wrap">
    
<div class="cp_cont">
<input id="cp_toggle03" type="checkbox"/>
<div class="cp_mobilebar">
<label for="cp_toggle03" class="cp_menuicon">
<span></span>
</label>
</div>
<label id="h-menu_black" class="cp_toggle03" for="cp_menuicon"></label>
<div id="body" class="noscroll"></div>
        
<header class="cp_offcm03">
        
<nav>
<ul style="text-align: center; margin-left: 210px; overflow: hidden;">
            
<li style="border-bottom: .05px solid lightgray;"><a href="../../../../../Home_English.html">Home</a></li>
<li style="border-bottom: .05px solid lightgray;"><a href="../../../../../Blog_English.html">Blog</a></li>
<li style="border-bottom: .05px solid lightgray;"><a href="../../../../../About_English.html">About This Website</a></li>
<li style="border-bottom: .05px solid lightgray;"><a href="../../../../../Bibliography_English.html">Bibliography</a></li>            
        
<div class="searchbar"> 
            
<form id="frmSearch" class="search2" method="get" action="default.html" style=" padding-right: 10px; padding-top: 20px; text-align: center; position: inline;">
<input class="search2" id="txtSearch" type="text" placeholder="Custom Google Search" name="serach_bar" size="31" maxlength="255" value="" style="top: 185px; width: 180px; height: 26px;">
<input class="search1" type="submit" name="submition" value="Search" style="padding-left: 5px; top: 153px; height: 25px; width: 50px; display: inline-flex; justify-content: center;">
<input class="search2" type="hidden" name="sitesearch" value="default.html">    

</form>
</div>    

    
<script type="text/javascript">
 document.getElementById('frmSearch').onsubmit = function() {
 window.location = 'http://www.google.com/search?q=site:morikoboshi.com' + document.getElementById('txtSearch').value;
        return false;
    }
 
</script>


<script>
 document.getElementById('cp_toggle03').onchange = function() {
 if (document.getElementById('cp_toggle03').checked) {
 document.body.style.overflow = "hidden";
  } else {
 document.body.style.overflow = "";
  }
} 
 
if(!!window.performance && window.performance.navigation.type == 2)
{
    window.location.reload();
}
</script>
    
<script>
    
document.body.style.visibility='visible';
    
</script>

</ul>    
</nav>
</header>

Transferring a Jquery object to a different input

I am working on modifying a WordPress template for a client, one of the inputs im working with has a class that shows a calendar. when ever i call the the input on the console like so jQuery(“#booking_from_date”) it shows a jquery object underneath it thats says
jQuery360045212629567534381: {events: {…}, hasDataAttrs: true, focus: false, handle: ƒ}
jQuery360045212629567534382: {singleDatePicker: false, autoApply: true, alwaysShowCalendars: true, autoUpdateInput: false, minDate: ’05/22/2022′, …}

the html of the input looks like this

it seems like these jquery classes were added to the input via the id of the input
is there a way i can transfer those objects to a input with a different id? my goal is to be able to view the calendar when someone clicks on a different input with a different id. i already tried using another input with the same id but the calendar will not show up. it seems like the calendar will only render the first input rendered on the page with id of “booking_from_date”

how to wait http response in observable (rxjs)

This is the original code.

// info.service.ts.  

  this.info$ = new BehaviorSubject<Info>(null);


  async getInfo() {
    try {
      const info = await this.infoApi.getInfo();
      this.info$.next(info);
    } catch {
      this.info$.next(null);
    }
  }



  // infoApi Class
  getInfo() {
    return this.apiService.get<Info>(`/info`, this.infoService....);
  }

For asynchronous processing using rxjs, we modified the code as follows. Other asynchronous processing codes in my project have also been modified to rxjs in the following way, and they are working fine. However, only the getinfo service does not work properly. Asynchronous processing is not progressing properly.
As a result of checking the network panel, the info data request is checked in the managed state. Please let me know if there are any expected problems.
(Async, wait is not available, so I’m trying to use Rxjs. )

// info.service.ts
  getInfo() {
    from(this.infoApi.getInfo()).subscribe(
      info => this.info$.next(info),
      error => {this.info$.next(error)
      }
    )
  }