Toggle Boolean on ‘flick’

Have a next task

Create a function that always returns True/true for every item in a given list.
However, if an element is the word ‘flick’, switch to always returning the opposite boolean value.

Examples

[‘codewars’, ‘flick’, ‘code’, ‘wars’] ➞ [True, False, False, False]

[‘flick’, ‘chocolate’, ‘adventure’, ‘sunshine’] ➞ [False, False, False, False]

[‘bicycle’, ‘jarmony’, ‘flick’, ‘sheep’, ‘flick’] ➞ [True, True, False, False, True]

[“flick”, “flick”, “flick”, “flick”, “flick”]), [false, true, false, true, false]

How I understand problem statment.

If an element in the array is ‘flick’, it toggles a switch. ‘flick’ may turn the switch to false, and the elements after it will follow this state. If the next ‘flick’ is encountered, it toggles the switch again to true, and the following elements will follow that state, and so on.

Here is how I solved this task.

function flickSwitch(arr) {
    let flag = true
    let array = [];
    for (let i = 0; i < arr.length; i++) {
        if (arr[i].toLowerCase() == 'flick') {
            flag = false;
            array.push(flag);
        } else {
            array.push(flag);
        }
    }
    return array;
}

console.log(flickSwitch(["codewars", "flick", "code", "wars"]));

And most of the tests passed successfully.

But if there are two ‘flick’ elements next to each other in the array, like [“codewars”, “flick”, “flick”, “wars”], my solution breaks.

How can I solve this problem? Please help me!

Why is my “ not displaying anything when using JavaScript in a separate file?

I’m trying to display the current time inside a paragraph element using JavaScript. My HTML and JavaScript are in separate files.

Here’s my HTML snippet:

<p id="time"></p>

And in my JavaScript file, I have:

const showTime = document.querySelector("p#time");

const intervalId = setInterval(() => {
  if (!showTime) {
    clearInterval(intervalId);
    return;
  }
  showTime.innerText = new Date().toLocaleTimeString();
}, 1000);

But nothing is showing up in the paragraph. There are no errors in the browser console.

What could be the reason p#time is not displaying anything?

Where is the default style on button, input, etc. in create-next-app?

I just created a default create-next-app application.

I added some simple elements in the app/page.tsx , like <button>click</button> and an <input type="text" placeholder="name" />. However these elements are displayed without any style at all; you can’t understand that it’s a button, on the screen, neither the input box.
Why is this happening? Should I install anything else on top?

I see the global.css file imports @import "tailwindcss"; and this impacts the <button> and <input>. So it is Tailwind that overides the HTML components and they don’t have style at all.

Is the solution to read the Tailwind documentation for every component that I need to use and add styles or is there another approach?

How to register a custom REST API endpoint in WordPress?

I’m learning WordPress and want to create a custom REST API endpoint that returns JSON data. I read about the register_rest_route() function but I’m not sure where to put the code or how to test it properly.

Can someone give a basic example of creating a REST route in WordPress with authentication, and how to call it?

Thanks in advance!

I created a plugin and used register_rest_route() inside the init hook, but when I visit the route URL, it shows a 404 error. I’m not sure if I’m using the right hook or path.

I want a basic example to register a REST API route in WordPress that returns JSON like {“status”: “success”} and how to test it in the browser.

How to create an increase system + multiplier where every time you buy a slot, price increases [closed]

I need some help with an increase system where price gets higher the more slots you buy
The slots are basically items in a shop. I have the shop and item system already in the website. But there is no increase system so its a new mechanic.

I’ve pretty much gotten this direction:
a flat multiplier, add a field that’s a purchase multiplier to shop stock, grab a user’s total lifetime purchases and do the math

I couldn’t find any info online about a multiplier
Is there someone that can help and maybe walk me though portions of the multiplier so I could understand it? I never dealt with multipliers before which is why I’m stuck.

I can provide code snippets if needed, as I’m not sure what to provide.
This is coded in php/laravel.

Thank you!

Why isn’t AWS PHP SDK setting Content Disposition for a presigned URL?

I’m having an issue with generating a presigned URL for S3 using AWS SDK for PHP. Here is my request, $s3 is an instance of S3Client:

$request = $s3->createPresignedRequest($s3->getCommand('getObject',array(
            'Bucket' => $myBucket,
            'Key' => $filename,
            'ContentDisposition' => 'inline'
        )),
    '+1 hour');

After looking around on stack overflow, and running through every page of documentation on the SDK I can find, I’ve tried setting ‘ContentDisposition’, ‘ResponseContentDisposition’, ‘response_content_disposition’ and ‘Content-Disposition’ in the headers, to no avail.

No matter what, the content disposition is set as “attachment” and clicking the presigned URL starts a download of the file. I’ve also experimented with the same headers above when I’m sending the object with putObject – still no luck. Any ideas?

Get product id inside of Quote in magneto 2

I want to alter product price in magento 2.4.7 To do it in catalog and single view i have plugin

<type name="MagentoCatalogModelProduct">

inside afterGetPrice. This is wrok for me well.

However after i add product in checkout price alters. So i have another plugin
<type name="MagentoQuoteModelQuote">, and inside
beforeCollectTotals

My problem is that i want to change price based on product id(external logic per product).
I can do

    public function beforeCollectTotals(MagentoQuoteModelQuote $subject)
    {
        /**
         * @var $item Item
         */
        foreach ($subject->getAllItems() as $item) {
            /**
             * @var $product Product
             */
            $product = $item->getProduct();

But now my if product is configurable i have id of parent not a child.
I Found that i can do

            if ($product->getTypeId() === 'configurable') {
                $id = array_first($item->getData()['qty_options'])->getData('product_id');
            } else {
                $id = $product->getId();
            }

To get **child id** But i wonder is there any alternatives here ? To get this working ? 

Windows.open losing session in PHP [closed]

I have a simple chat scenario in my PHP web app. On the other side I have selenium based python script to show automatiom. The purpose is that when someone sends link, the selenium bots clicks on the URL and visits it

The code is that bot logs in using username abc and password abc and a sessiond ID is set in PHP.

When it receives a link it does the windows.open(link) and then returns back to original window

The issue I am facing is that if I send a link against a different domain and that domain posts data to original domain.. the session values are not preserved.. typical csrf scenario.. what I should do in this case

Overlapping SVG animations cause jumps

If an <animate> animation begins while another one is running, the animated attribute jumps to some weird intermediate value (and animates from there). How is that value computed?

And the speed of the animation becomes weird and then becomes normal again midway.

Click for example “Go left” (optionally wait for the animation to finish), “Go right” (don’t wait for this one to finish), “Go left”:

<svg>
  <circle cx="10" cy="10" r="5" />
  <circle cx="60" cy="10" r="5" />
  <circle cx="110" cy="10" r="5" />
  <circle cx="60" cy="10" r="5" fill="orange">
    <animate id="go-right" attributeName="cx" to="110" dur="2s" begin="indefinite" fill="freeze" additive="replace" accumulate="none" />
    <animate id="go-left" attributeName="cx" to="10" dur="2s" begin="indefinite" fill="freeze" additive="replace" accumulate="none" />
  </circle>
</svg>

<script>
  goLeft = document.getElementById('go-left');
  goRight = document.getElementById('go-right');
</script>

<button onclick="goLeft.beginElement()">Go left</button>
<button onclick="goRight.beginElement()">Go right</button>

Spec Section 12.4.3 The animation sandwich model says

A non-additive animation simply overrides the result of all lower sandwich layers.

Spec Section 12.4.5 The animation effect function F(t,u) says

Higher priority animations that are not additive will override all earlier (lower priority) animations, and simply set the attribute value.

And I explicitly set these animations to be neither additive nor cumulative.

So why do the animations influence each other? Specifically, how is the value computed?

Adding calls to endElement() makes the values even weirder.

How to use a sprite sheet in A-Frame?

How do I make the texture for a simple box/cube in a-frame a sprite sheet, like, a 6 image sprite sheet, as if it was for a single cube in Minecraft or something, i know if you put an image in for the src attribute it makes all 6 sides that image, but i would like to make each* side have a different texture.
and also, if i add an img tag to an assets tag, which in a-frame

The following code has 3 cubes:

  • The front one is just a single image that is repeated,
  • The one on the left is a 1×6 sprite sheet, inputted for the src, but it is still just a stretched version of the image repeated, instead of have each bit on 1 side,
  • And on the right is that same sprite sheet but in a cross shape, which also didn’t work.
    None of them do what I want, which is to display a different image on each side of the cube using a sprite sheet, (and also maybe different polygons like pyramids and rectangular prisms…) 3;

    <html>
      <head>
        <script src="https://aframe.io/releases/1.7.1/aframe.min.js"></script>
      </head>
      <body>
        <a-scene>
          <a-assets>
          </a-assets>
    
          <a-box
            src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAAAXNSR0IArs4c6QAAAf9JREFUeF7t3EEKwzAQxdDx/Q/t0isIBBOj7udD9Fqy65mZOw987n3iMeYEsuvbGMguj34hyzwCCUQq0EtdCktnA6HlpLtApLB0NhBaTroLRApLZwOh5aS7QKSwdDYQWk66C0QKS2cDoeWku0CksHQ2EFpOugtECktnA6HlpLtApLB0NhBaTroLRApLZwOh5aS7QKSwdDYQWk66C0QKS2cDoeWku0CksHQ2EFpOugtECktnA6HlpLtApLB0NhBaTroLRApLZwOh5aS7QKSwdDYQWk66C0QKS2cDoeWku0CksHQ2EFpOugtECktnA6HlpLtApLB0NhBaTroLRApLZwOh5aS7QKSwdDYQWk66ewbkPvIk5/z/+uv7nxPILsRAdnlMIIE4BXqHOF3xaiA4nXMYiNMVrwaC0zmHgThd8WogOJ1zGIjTFa8GgtM5h4E4XfFqIDidcxiI0xWvBoLTOYeBOF3xaiA4nXMYiNMVrwaC0zmHgThd8WogOJ1zGIjTFa8GgtM5h4E4XfFqIDidcxiI0xWvBoLTOYeBOF3xaiA4nXMYiNMVrwaC0zmHgThd8WogOJ1zGIjTFa8GgtM5h4E4XfFqIDidcxiI0xWvBoLTOYeBOF3xaiA4nXMYiNMVrwaC0zmHgThd8WogOJ1zGIjTFa8GgtM5h4E4XfHqKyA/1xGPeqikrOsAAAAASUVORK5CYII="
            position="0 0 -5"
            rotation="0 45 0"
            scale="2 2 2">
          </a-box>
    
          <a-box
            src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAAEsCAYAAACG+vy+AAAAAXNSR0IArs4c6QAACZpJREFUeF7t11GOGzcUBdHW/hetwIC/HeiRBArN4+8hI95SpWY+z/N8nxf8+35f8Yzn8/m8gMZ7nvCHxiu+WQR5z5ey9BKClGg8j4LUeChIi4hfsWI8CBID4m+QFBC/YqVw+BUrhuMhSIyIX7FaQAjS4uGP9BoPf4O0iChIjAdBYkD8kZ4C4lesFA5/pMdw+CM9B0RBUkgUJIVDQWI4FCQHREFSSBQkhUNBYjgUJAdEQVJIFCSFQ0FiOBQkB0RBUkgUJIVDQWI4FCQHREFSSBQkhUNBYjgUJAdEQVJIFCSFQ0FiOBQkB0RBUkgUJIVDQWI4FCQHREFSSBQkhUNBYjgUJAdEQVJIFCSFQ0FiOBQkB0RBUkgUJIVDQWI4FCQHREFSSBQkhUNBYjgUJAdEQVJIFCSFQ0FiOBQkB0RBUkgUJIVDQWI4FCQHREFSSBQkhUNBYjgUJAdEQVJIFCSFQ0FiOBQkB0RBUkgUJIVDQWI4FCQHREFSSBQkhUNBYjgUJAdEQVJIFCSFQ0FiOBQkB0RBUkgUJIVDQWI4FCQHREFSSD7f7/eb+kTDD/N5yRfrJTiGFHvHCBJjQpAWEIK0eDwEaQEhSIsHQWI8CBIDoiAtIARp8VCQGA+CxIAoSAsIQVo8FCTGgyAxIArSAkKQFg8FifEgSAyIgrSAEKTFQ0FiPAgSA6IgLSAEafFQkBgPgsSAKEgLCEFaPBQ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xHgQJAZEQVpACNLioSAxHgSJAVGQFhCCtHgoSIwHQWJAFKQFhCAtHgoS40GQGBAFaQEhSIuHgsR4ECQGREFaQAjS4qEgMR4EiQFRkBYQgrR4KEiMB0FiQBSkBYQgLR4KEuNBkBgQBWkBIUiLh4LEeBAkBkRBWkAI0uKhIDEeBIkBUZAWEIK0eChIjAdBYkAUpAWEIC0eChLjQZAYEAVpASFIi4eCxHgQJAZEQVpACNLioSAxHgSJAVGQFhCCtHgoSIwHQWJAFKQFhCAtHgoS40GQGBAFaQEhSIuHgsR4ECQGREFaQAjS4qEgMR4EiQFRkBYQgrR4KEiMB0FiQBSkBYQgLR4KEuNBkBgQBWkBIUiLh4LEeBAkBkRBWkAI0uKhIDEeBIkBUZAWEIK0eChIjMdbBPkPUYRwmbmkSu0AAAAASUVORK5CYII=
    "
            position="-5 0 0"
            rotation="0 45 0"
            scale="2 2 2">
          </a-box>
    
          <a-box
            src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAADICAYAAAAKhRhlAAAAAXNSR0IArs4c6QAABnBJREFUeF7tncFuWzkQBO3//2gvBGTvXSJmMGhUzvMos7pVZILI+v3p+fNXspXfhn1UbOJfEBbrUCMt1qEw/v0oFZlUbEJj+e6YJOBROEkXrq2xILCF8YpMKjbhUbhQd/gSFgsCWxivyKRiExproe7wJSwWBLYwXpFJxSY01kLd4UtYLAhsYbwik4pNaKyFusOXsFgQ2MJ4RSYVm9BYC3WHL2GxILCF8YpMKjahsRbqDl/CYkFgC+MVmVRsQmMt1B2+hMWCwBbGKzKp2ITGWqg7fAmLBYEtjFdkUrEJjbVQd/gSFgsCWxivyKRiExproe7wJWqK9ff3V/Fhit/f34pMKjbxeTNZLKiU4XGLNQyYLq+xKLHheY01DBgur7EgsOlxjTVNGK6vsSCw4XGNNQyYLq+xKLHheY01DBgur7EgsOlxjTVNGK6vsSCw4XGNNQyYLq+xKLHheY01DBgur7EgsOlxjTVNGK6vsSCw4XGNNQyYLq+xKLHheY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0FiPVR543GINQH1csiKTik1orMcqDzxusQagPi5ZkUnFJjTWY5UHHrdYA1Afl6zIpGITW8ba+E5ovwjz8W058Pj4B1YtVp6axspZrXzZuMYCgSyNaqwl0MnLaKyE0v+XuL/x7vprjEAeW6PjqXvHyqPUWDkr71iAlcUCsDRWDsti5aw0FmBlsQAsjZXDslg5K40FWFksAEtj5bAsVs5KYwFWFgvA0lg5LIuVs9JYgJXFArA0Vg7LYuWsNBZgZbEALI2Vw7JYOSuNBVhZLABLY+WwLFbOSmMBVhYLwNJYOSyLlbPSWICVxQKwNFYOy2LlrDQWYFVTrI0vG1/6gvmKTCo28XkjWSygk4VRiwUga6wclsXKWX0+8wemvx5deZGvf7rwwYpNeBSGaS+OWSwAW2PlsCxWzsqjkLACs6dH/VvhrXg0FsjDozCHZbFyVh6FhBWYPT3qUXgrHo0F8vAozGFZrJyVRyFhBWZPj3oU3opHY4E8PApzWBYrZ+VRSFiB2dOjHoW34tFYIA+PwhyWxcpZeRQSVmD29KhH4a14NBbIw6Mwh2WxclYehYQVmD096lF4Kx6NBfLwKMxhWayclUchYPUfGUwgxLGETOoAAAAASUVORK5CYII=
    "
            position="5 0 0"
            rotation="0 45 0"
            scale="2 2 2">
          </a-box>
    
          <a-sky color="#222"></a-sky>
        </a-scene>
      </body>
    </html>
    
    <!-- you can use wasd or arrow keys to move around BTW!.:3 -->

How to reverse SVG animations with JS in HTML

I am creating a website to simulate lever frames for railways that currently use them. To simulate the levers I decided to use SVGs which seems to be working relatively well. However, I am currently running into the issue not being able to reverse the animations so reset the levers to their original state.

The animation worked fine (other than the text moving too far down) with both keyPoints="0; 1" and keyPoints="1; 0" while using beginElement()` to trigger the animation, but as I have it set up right now there is no animation at all.

How can I get the animation to play in reverse so the levers can move either direction? Is there a better way than reversing the keyPoints?

//defined in a json file
leverframe = {
  "1": {
    "id": "HJ1",
    "type": "d"
  },
  "2": {
    "id": "HJ2",
    "type": "s"
  },
  "3": {
    "id": "HJ3",
    "type": "s"
  },
  "4": {
    "id": "HJ4",
    "type": "es"
  }
}

// box.html
const leverlist = new Map()

for (const lever of Object.keys(leverframe)) {
  const leverimg = document.createElementNS("http://www.w3.org/2000/svg", "svg")
  levers.appendChild(leverimg)
  leverimg.outerHTML = '<svg xmlns="http://www.w3.org/2000/svg" id="' + lever + '" viewBox="0 0 35 300" width="35px" height="300px"><image href="https://cdn.glitch.global/35ec23e6-47cb-4d5f-87eb-598ad1888739/' + leverframe[lever].type + '.png?v=1749249192147" height="329" y="-0.579" style="transform-box: fill-box; transform-origin: 50% 50%;"><title>image</title><animateTransform id="' + lever + 'pull1" type="scale" additive="sum" attributeName="transform" values="1 1;1 0.9" begin="indefinite" dur="2s" fill="freeze" keyTimes="0; 1" keyPoints="0; 1"></animateTransform><animateMotion id="' + lever + 'pull2" path="M 0 0 L 0 34.352" calcMode="linear" begin="pull1.begin" dur="2s" fill="freeze" keyTimes="0; 1" keyPoints="0; 1"></animateMotion></image><text style="white-space: pre; fill: rgb(51, 51, 51); font-family: Arial, sans-serif; font-size: 10px; text-anchor: middle;" x="12.5" y="117.5" id="object-0"><title>text</title>' + lever + '<animateMotion id="' + lever + 'pull3" path="M 0 0 L 0 43.512" calcMode="linear" begin="pull1.begin" dur="2s" fill="freeze" keyTimes="0; 1" keyPoints="0; 1"></animateMotion></text></svg>'

  leversvg = document.getElementById(lever)
  leverlist.set(lever, false)

  leversvg.onclick = function() {
    leverlist.set(lever, !leverlist.get(lever))

    if (leverlist.get(lever)) {
      console.log("doing animation")
      console.log(document.getElementById(lever + "pull1"))
      document.getElementById(lever + 'pull1').setAttribute("keyPoints", "0; 1")
      document.getElementById(lever + 'pull2').setAttribute("keyPoints", "0; 1")
      document.getElementById(lever + 'pull3').setAttribute("keyPoints", "0; 1")
      document.getElementById(lever + 'pull1').beginElement();
      console.log("done animation")
    } else {
      console.log("doing animation")
      console.log(document.getElementById(lever + "pull1"))
      document.getElementById(lever + 'pull1').setAttribute("keyPoints", "1; 0")
      document.getElementById(lever + 'pull2').setAttribute("keyPoints", "1; 0")
      document.getElementById(lever + 'pull3').setAttribute("keyPoints", "1; 0")
      document.getElementById(lever + 'pull1').beginElement();
      console.log("done animation")
    }
  }
}
<div id="levers" alt="Box Levers" style="max-width: 90vw; overflow-y: auto; white-space: nowrap;"></div>

Node modules not getting install in user mode linux

so i recently switched to linux and i have a Next JS project on github, I’m able to clone to the project but to work on it i have to install node modules. The problem is whenever i run “npm i” command it takes around 15 mins tops to just throw me an error that I don’t have permission to download it.

So i tried installing it via “sudo npm i” but I am getting same error. I tried using NVM too but no success in that either.

I even tried changing the ownership to my hard_disk but still same thing. Also one more thing, whenever i login into my system, i always has to mount my hard_disk again and again everytime can you guys please help me 🙂

what’s the best medication for prolong cough?

Meet the leading Prolong cough Pain Management pharmacy at Uslinctusstore. Experience tailored solutions for a life free from discomfort. Choose expertise, choose relief. Your well-being is our priority.#buyhitechpromethazinehydrochloride #buywockhardtpromethazine. Secure your order before it runs out! Limited stocks- Buy now!

Contact our online pharmacy now; +1(945)266-6325 | 19452666325

https://uslinctusstore.com/product/wockhardt-promethazine/

https://uslinctusstore.com/

[email protected]

modal does not block body from scrolling

  useEffect(() => {
    if (modal_ref.current) {
        modal_ref.current.showModal();
    } else {
        modal_ref.current.close();
    }
  }, [foc]);

when my <dialogue /> component is rendered and covers the entire viewpoint, the above useEffect fires, but body beneath still scrolls. There is no position: fixed, in the dialogue either.

How to ensure that the blocks scrolling of all components beneath?

My Node Js server is running slower when there is no client input

I have been working on a game using javascript canvas and Node JS as a personal project, and noticed some odd server behaviour so I made a minimal server and client to test it and I noticed something very odd. For example if I set the tick rate of the server to be 100 ticks per second (this also happens with other tick rates) and then run the server with this as the main loop:

let tickCounter = 0; 
let lastPrint = Date.now();

function gameLoop() { 
    tickCounter++; 
    const now = Date.now(); 
    if (now - lastPrint >= 1000) { 
        console.log(Ticks per second: ${tickCounter}); 
        lastPrint = now; tickCounter = 0; 
    }
    setTimeout(gameLoop, TICK_INTERVAL)
} 
gameLoop();

The server will output 65 ticks per second (which should be 100). However, when I run my client with the following code

var mouse = { X: canvas.width / 2, Y: canvas.height / 2, }

window.addEventListener('mousemove', e => {
    mouse.X = e.clientX;
    mouse.Y = e.clientY;
    
    console.log(mouse.X, mouse.Y)
    
    socket.emit("rotate", { "angle": Math.atan2(mouse.X - canvas.width / 2, mouse.Y - canvas.height / 2) + Math.PI })
});

And then move my mouse, inexplicably the tick speed goes up to 100 (what it is supposed to be) on the server. This tick speed change is causing a lot of problems with my actual project. Just to clarify I am using Windows and also express js to make the server.

I have already tried using different tick speeds (the same thing will happen with all of them), I have tried using setInterval instead, I have tried increasing the task priority in task manager of node.exe, all to no avail. The only thing that does work is to just constantly send useless data from the client to the server, but that is not a sustainable solution and will cause unnecessary strain to the server later on in the project.

Edit: It is definitely a problem with Windows, because I sent the code to a friend who uses linux and he did not have the same problem.