equation solving – How to remove unnecessary answers from NSolve without losing speed?

This code:

eqs =
  {Ca/u^2 + 
      r (6 a (c^2 - d^2) + 12 b c d + 6 (a^2 + b^2 + c^2 + d^2) Ca + 
         Ca^3) == 0,
    a (1/u^2 - 1) + 
      r (3 a (a^2 + b^2) + 6 a (c^2 + d^2) + 3 c^2 Ca - 3 d^2 Ca + 
         3 a Ca^2) == 1/2,
    b (1/u^2 - 1) + 
      r (3 b (a^2 + b^2) + 6 b (c^2 + d^2) + 6 c d Ca + 3 b Ca^2) == 0,
    c (1/u^2 - 1/4) + 
      r (6 (a^2 + b^2) c + 3 c (c^2 + d^2) + 6 (a c + b d) Ca + 
         3 c Ca^2) == 0,
    d (1/u^2 - 1/4) + 
      r (6 (a^2 + b^2) d + 3 d (c^2 + d^2) + 6 (-a d + b c) Ca + 
         3 d Ca^2) == 0, c > 0, d >= 0,
QQQ == c^2 + d^2, QQQ != 0
    } // Rationalize(#, 0) &;
NSolve(eqs /. {u -> 5, r -> 0.04}, {a, b, c, d, Ca, QQQ}, Reals)

Gives me this answer:

{{a -> -0.732167, b -> 0, c -> 1.06332, d -> 0, Ca -> 0.443594, 
  QQQ -> 1.13066}, 
 {a -> -0.732167, b -> 0, c -> 1.06332, d -> 0, 
  Ca -> 0.443594, QQQ -> 1.13066}, 
 {a -> -0.732167, b -> 0, 
  c -> 1.06332, d -> 0, Ca -> 0.443594, 
  QQQ -> 1.13066}, {a -> -0.732167, b -> 0, c -> 1.06332, d -> 0, 
  Ca -> 0.443594, QQQ -> 1.13066}, {a -> -0.698614, b -> 0, 
  c -> 0.622043, d -> 0.622043, Ca -> 0, 
  QQQ -> 0.773876}, {a -> -0.698614, b -> 0, c -> 0.622043, 
  d -> 0.622043, Ca -> 0, QQQ -> 0.773876}, {a -> -0.698614, b -> 0, 
  c -> 0.622043, d -> 0.622043, Ca -> 0, 
  QQQ -> 0.773876}, {a -> -0.698614, b -> 0, c -> 0.622043, 
  d -> 0.622043, Ca -> 0, QQQ -> 0.773876}, {a -> -0.698614, b -> 0, 
  c -> 0.622043, d -> 0.622043, Ca -> 0, 
  QQQ -> 0.773876}, {a -> -0.698614, b -> 0, c -> 0.622043, 
  d -> 0.622043, Ca -> 0, QQQ -> 0.773876}, {a -> -0.698614, b -> 0, 
  c -> 0.622043, d -> 0.622043, Ca -> 0, QQQ -> 0.773876}}

But as you see, there are several identical answers.
And if a make WorkingPrecision -> 3, for example, this code is slow down.
Maybe there is other methods to make this code faster?

javascript – Having trouble fixing “Uncaught TypeError: Cannot read property ‘remove’ of undefined”- I’ve consulted other answers

I am trying to implement this bit of code to enable a sticky nav bar on my website:
https://www.w3schools.com/howto/howto_js_navbar_sticky.asp

I keep getting the following error: “index.html:44 Uncaught TypeError: Cannot read property ‘remove’ of undefined”

Here is the snippet:


<body class="is-preload">
        <div class="topnav">
            <a class="active" href="#header">Home</a>
            <a href="#first">Book an Appointment</a>
            <a href="#second">Contact</a>
            <a href="#third">About</a>
            
          </div>
          <script>// When the user scrolls the page, execute myFunction
            
            
            
            
            window.onscroll = function() {myFunction()};
            // Get the navbar
            var navbar = document.getElementsByClassName("topnav");
            
            
            
            
            // Get the offset position of the navbar
            var sticky = navbar.offsetTop;
            
            
            // Add the sticky class to the navbar when you reach its scroll position. Remove "sticky" when you leave the scroll position
            function myFunction() {
              if (window.pageYOffset >= sticky) {
                navbar.classList.add("sticky")
              } else {
                navbar.classList.remove("sticky");
               
              }
            }</script>

I cant figure out for the life of me whats wrong. Its the exact bit of code from the W3C site and it wrks fine there.

Guaranteed Targeted Traffic With 40 Unique Yahoo Answers For Your Website for $20

Guaranteed Targeted Traffic With 40 Unique Yahoo Answers For Your Website

Hi Sir,
Welcome to my service. Here is Something About My Service.

“Yahoo Answers” is a great way to promote your business and get lots of natural traffic. Million’s of people visit this platform every day and ask questions about what they want to know. Yahoo! Answers is given importance in google searches. It is the best way to promote your business on Google 1st page. I answer that question, which is related to your website. I guaranteed you that your website gets 100% Real traffic. I will use Level 3 or higher accounts for answers.

My Services :

1. Answer submitted manually

2. All are a clickable link

3. All answers will be posted with your keyword related

4. Get Unlimited Real Traffic

5. Never delete my answers

6. Get Unique and Best Quality Answer

7. Quick Delivery and 24/7 Support

Work Process:

It’s quite simple and straight forward. First, I will go through your website to understand the theme and niche. And I will search for a relevant question and answer with your website URL. Also, you will get a permanent backlink from Yahoo.

If you have any Questions? Please, feel free to talk mine inbox.

.

javascript – Building a Quiz using JS and React. Suggested approach to show the user the answers they got correct/wrong

This is what I am currently showing the user –

enter image description here

Problem – I would like to show the user what questions they got correct and what answers they got wrong too. But I am not sure on the best way to approach this. Any suggestions would be appreciated.

Here is what I have so far in my Quiz Component –

import React, { useState } from "react"
import questions from "../../quizzes/jsQuiz"

const Quiz = () => {
  const (currentQuestion, setCurrentQuestion) = useState(0)
  const (showScore, setShowScore) = useState(false)
  const (score, setScore) = useState(0)

  const handleAnswerButtonClick = isCorrect => {
    if (isCorrect) {
      setScore(score + 1)
    }

    const nextQuestion = currentQuestion + 1
    if (nextQuestion < questions.length) {
      setCurrentQuestion(nextQuestion)
    } else {
      setShowScore(true)
    }
  }

  const refreshPage = () => {
    window.location.reload()
  }

  return (
    <div className="quiz-container">
      {showScore ? (
        <div>
          <div className="score-section">
            You scored {score} out of {questions.length}
          </div>
          {score === questions.length ? (
            <div>You got 100%! Well Done!</div>
          ) : (
            <button onClick={() => refreshPage()}>Retry</button>
          )}
        </div>
      ) : (
        <div>
          <div className="question-section">
            <div className="question-count">
              <span>Question {currentQuestion + 1}</span> / {questions.length}
            </div>
            <div className="question-text">
              {questions(currentQuestion).questionText}
            </div

Webform bespoke results – Drupal Answers

I am hoping for some pointers from the community if possible please. We recently rebuilt our website in Drupal 8. Previously it was made in the the old-fashioned way with Dreamweaver. It was quite old!

Now, on the old website we had a fun little tool made with some custom php code. The user answered some questions. In the background, weightings were applied to different attributes based on the answers and the result was some page recommendations for the user displayed on-screen.

The topic of the website is scuba diving and marine life, and in our case this recommended scuba diving destinations. It is not commercial, just a bit of fun. A simplified example would be:

Q1: How many dives do you have?
a) Under 25
b) Under 50
c) More than 50

Q2: What type of diving do you like?
a) Coral reefs
b) Ship wrecks
c) Underwater photography

etc..

We then have a list of dive destinations, which would gain a score based on the answers.

So, if Destination 1 was good for beginners and coral reefs, and the user answered a) to Q1 and Q2, Destination 1 might get a score of 3 for each answer, and a total score of 6. Destination 2 might be good for experienced divers who like underwater photography, so would score well if someone answered c) to both questions.

Of course, there are some more questions and more possible destinations. The end result was a list of 6 destinations (the top scoring ones) that we thought they should check out, with links to those pages on the website.

I’d love to recreate it on the new website in Drupal 8. I have been looking at the Webform module. Certainly I could use this to ask questions and collate results. I am not so confident if it (or any module) could be used to process the answers and create the recommendations?

I am ok with coding, but not at the level of creating my own module in Drupal, nor do I really have the time for that at present.

Can I seek some expert opinions please on if Webform or another module could help me achieve this, or if it is a little too bespoke.

Thank you in advance. I am of course happy to provide some more context if I have missed out anything crucial.

Phil

Commerce Stock Control hooks – Drupal Answers

I have a Commerce Demo site that uses the off canvas flyout cart and I am using the Commerce Simple Stock module to stop items being sold if they are out of stock.

The module changes the stock number and prevents the item being loaded to the cart if already purchased. It sends user/status messages and removes the add to cart button using the following hook: commerce_simple_stock_form_commerce_order_item_add_to_cart_form_alter().

This hook doesn’t work for the Commerce Demo form.

The theme hook for the add to cart button in Commerce Demo is commerce_cart_flyout_add_to_cart_button().

The stock status messages show on the admin pages but not on the product page itself.

How to I hook the stock status message from the module to the product page??

Excel: how to move “answers” rows into under column “questions”?

How do I move answers from other column to same question under another column, can any one guide the exact formula to achieve this? See example below what needs to be achieved as shown in picture.

Excel to move coloumn

lhr – Heathrow Airport: Terminal 2 to Terminal 5, can you transit without visa? (conflicting answers)

Yes you will need a visa, specifically the Visitor in Transit visa, but you may have a chance at transit-without-visa (as you fit some of the criteria there) although I wouldnt recommend just chancing it.

Being that your flight leaves the next day, you cannot stay in Heathrow terminals overnight as they close to passengers and there are no airside hotels at either terminal – this means that even though you can transfer airside between Terminal 2 and 5, you need to enter the UK to stay at a hotel before either of those terminals close for the night.

I need some answers on hosting

Good day all, I need some answers to this questions.

– Is it ideal to build my hosting site using wordpress?
– If I started with a packa… | Read the rest of https://www.webhostingtalk.com/showthread.php?t=1834183&goto=newpost

System wanted: Next question depending on multiple previous answers

I want to write an application where the user has to answer several questions. The difficulty is that the third question might depend on the answers of question 1 and 2. For example:

  1. question A: possible answers A1 / A2 / A3
  2. question B: possible answers B1 / B2 / B3
  3. a. question C only if the previous answers where (A1 or A2) and B1
  4. b. question D for all other cases (if A3 or B2 or B3)

I am looking for an existing system that’s dealing with this problem. This system should have an open source code base, so I can transform these steps/ideas into the programming language I want.

Do you have any idea what could help me here?

(I didn’t know what tags to set. So the ones I used might be wrong.)