How to handle error and return observable while subscribe inside an observable function in Rxjs Angular

I want to check one api call inside an observable which I will subscribe in a component. As written below, I want to run my observable in this manner but it is not working. What changes shall I do to this code to make it work. Whenever I try to subscribe through it especially through the scenario when someObservableWrittenInTheSameService returns with an error 404, I want to return url2.

getfunction(submissionId: string ){

if (some condition) {
   this.someObservableWrittenInTheSameService(parameter).subscribe(
    (httpValue: any) => {
      let url = '';
      if (httpValue.code === 200) {
         return this.http.get(url1); 
      }
    }, err => {
      if (err.code === 404) {
        return this.http.get(url2);
      }
      
    }
  )
}

  let url3
  return this.http.get(url3);
}

This function is then is called in a component where it is subscribed. But whenever someObservableWrittenInTheSameService return 404, the subscription always fails and go to error block in the component.

How to load Redux conditionally in a component?

One of my component is in Git submodule, and loaded in a React app, and in different WordPress shortcodes also.

React components can communicate via Redux, but WordPress shortcodes not. Shortcodes can communicate with Javascipt events.

How can I load followings conditionally, not load into a shortcode, but load event notification?

import { setGetUser } from "../../slices/User";
import { RootStateOrAny, useDispatch, useSelector } from "react-redux";

function LoginAndRegistration(props: LoginAndRegistrationProps) {
  const completion = (getUserOut: GetUserOut) => {
    dispatch(setGetUser(getUserOut));

Prevent Event Listener firing event multiple times

I am using this event listener to fire an event which basically updates my state of Interval in a useEffect and enabling me to go up and down in my table. The up and down approach working fine for me but its firing the event multiple times. This multiple times firing of event causing the top and down events works slow and slows over all application.

  useEffect(() => {
    console.log("HAAN MEI WUHI PAPPI HUN");
    document.addEventListener("keyup", (e) => {
      if (e.shiftKey && e.code === "ArrowRight") {
        console.log("shift + right", vjsRef.current.currentTime);
        vjsRef.current.currentTime = vjsRef.current.currentTime + 1;
      } 
      else if (e.shiftKey && e.code === "ArrowLeft") {
        console.log("fire! left", vjsRef.current.currentTime);
        vjsRef.current.currentTime = vjsRef.current.currentTime - 1;
      }
    });

    document.addEventListener("keyup", async(event) => {
      if (event.code === "ArrowUp") {
        console.log('aj mei upar ');
        await props.setSelectInterval(props.selectInterval - 1);
      }
      if (event.code === "ArrowDown") {
        if (props.selectInterval + 1 < props.row.length) {
          console.log('asmaan nichay');
          props.setSelectInterval(props.selectInterval + 1);
        }
      }
    });
  }, []);

enter image description here

enter image description here

Add values on subsequent call in javascript function.?

Let’s consider I have the following function call,

function add(){
    x = 0;    
    return function(){        
        x+=1
            return function(){        
                return x+=1
            }
    };
}

add()()(); // output is 3

I am trying to make the above method in dynamic way, for example, If I add the multiple brackents those many time methods needs to called and it should give the final added value

function add(){
    x = 0 ;
    for(i = 0 i < ##; i++){ // need to run a loop four times
    x+=1
    }
}

add()()()(); 

Header does not display the same for friend as does for me on desktop

So This is how I see the Header

How I see it on my computer

How my friend see it on their computer
As you can see on my friend picture there alot of white space and things don’t aline as they do on mine.
but our browsers at 100% zoom and it seems the same on friends other devices too.

I can’t work out why maybe I’m missing something so here my code Please help me out here Thanks

/* body style */

@-ms-viewport {
  width: device-width;
}

body {
  background: rgba(0, 0, 0, 0.05);
  color: #000000;
  font-family: "Source Sans Pro", "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif !important;
}

/* Add a black background color to the top navigation */

.topnav {
  background-color: #FFF;
  overflow: hidden;
}


/* Style the links inside the navigation bar */

.topnav a {
  float: right;
  display: block;
  color: #333;
  text-align: center;
  padding: 14px 16px;
  text-decoration: none;
  font-size: 17px;
  line-height: 25px;
  overflow: hidden;
}


/* Add an active class to highlight the current page */

.active {
  background-color: #fde402;
  color: #ed1010 !important;
  text-decoration: none !important;
}

/* Dropdown container - needed to position the dropdown content */

.dropdown {
  float: right;
  overflow: hidden;
}


/* Style the dropdown button to fit inside the topnav */

.dropdown .dropbtn {
  font-size: 17px;
  border: none;
  outline: none;
  color: #333;
  padding: 14px 16px;
  background-color: inherit;
  font-family: inherit;
  margin: 0;
}
/* Style the links inside the dropdown */

.dropdown-content a {
  float: none;
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  text-align: left;
}


/* Add a dark background on topnav links and the dropdown button on hover */

.topnav a:hover,
.dropdown:hover .dropbtn {
  background-color: #fde402;
  color: #ed1010;
  text-decoration: none !important;
}

/* Add a grey background to dropdown links on hover */

.dropdown-content a:hover {
  background-color: #fde402;
  color: #ed1010;
  text-decoration: none !important;
}

/* Show the dropdown menu when the user moves the mouse over the dropdown button */

.dropdown:hover .dropdown-content {
  display: block;
}

/* The "responsive" class is added to the topnav with JavaScript when the user clicks on the icon. This class makes the topnav look good on small screens (display the links vertically instead of horizontally) */

@media screen and (max-width: 600px) {
  .topnav.responsive {
    position: relative;
  }
  .topnav.responsive a.icon {
    position: absolute;
    right: 0;
    top: 0;
  }
  .topnav.responsive a {
    float: none;
    display: block;
    text-align: left;
  }
  .topnav.responsive .dropdown {
    float: none;
  }
  .topnav.responsive .dropdown-content {
    position: relative;
  }
  .topnav.responsive .dropdown .dropbtn {
    display: block;
    width: 100%;
    text-align: left;
  }
}

/* Style the dropdown content (hidden by default) */

.dropdown-content {
  display: none;
  position: fixed;
  background-color: #FFFFFF;
  min-width: 120px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 99999999;
}

.dropdown:hover .dropdown-content {
  display: block;
}

/* scroll text style */

.scroll-left {
  height: 50px;
  width: auto;
  overflow: hidden;
  position: relative;
  background: #bd0d0d;
  color: #fcf903;
  font-size: 18px;
  font-weight: 500;
  border: none;
}

.scroll-left p {
  position: absolute;
  width: 130%;
  height: 100%;
  margin: 0;
  line-height: 50px;
  text-align: center;
  /* Starting position */
  transform: translateX(70%);
  /* Apply animation to this element */
  animation: scroll-left 30s linear infinite;
}

/* Move it (define the animation) */

@keyframes scroll-left {
  0% {
    transform: translateX(70%);
  }
  100% {
    transform: translateX(-80%);
  }
}

.Flash {
  float: right;
  background-color: #fcba03;
  border: none;
  color: #FFFFFF;
  cursor: pointer;
  display: inline-block;
  font-family: Arial;
  font-size: 16px;
  padding: 10px 15px;
  text-align: center;
  text-decoration: none;
  -webkit-animation: glowing 1500ms infinite;
  -moz-animation: glowing 1500ms infinite;
  -o-animation: glowing 1500ms infinite;
  animation: glowing 1500ms infinite;
  z-index: 99 !important;
}

@-webkit-keyframes glowing {
  0% {
    background-color: #fcba03;
    -webkit-box-shadow: 0 0 3px #B20000;
  }
  50% {
    background-color: #fcc11c;
    -webkit-box-shadow: 0 0 40px #FF0000;
  }
  100% {
    background-color: #B20000;
    -webkit-box-shadow: 0 0 3px #B20000;
  }
}

@-moz-keyframes glowing {
  0% {
    background-color: #fcba03;
    -moz-box-shadow: 0 0 3px #B20000;
  }
  50% {
    background-color: #fcc11c;
    -moz-box-shadow: 0 0 40px #FF0000;
  }
  100% {
    background-color: #B20000;
    -moz-box-shadow: 0 0 3px #B20000;
  }
}

@-o-keyframes glowing {
  0% {
    background-color: #fcba03;
    box-shadow: 0 0 3px #B20000;
  }
  50% {
    background-color: #fcc11c;
    box-shadow: 0 0 40px #FF0000;
  }
  100% {
    background-color: #B20000;
    box-shadow: 0 0 3px #B20000;
  }
}

@keyframes glowing {
  0% {
    background-color: #fcba03;
    box-shadow: 0 0 3px #B20000;
  }
  50% {
    background-color: #fcc11c;
    box-shadow: 0 0 40px #FF0000;
  }
  100% {
    background-color: #B20000;
    box-shadow: 0 0 3px #B20000;
  }
}


/* Style all font awesome icons */

.fa2 {
  padding: 15px !important;
  width: 50px !important;
  text-align: center !important;
  text-decoration: none !important;
  line-height: 25px;
}

.fa1 {
  padding: 15px !important;
  width: 30px !important;
  text-align: center !important;
  text-decoration: none !important;
  margin: 10px !important;
  line-height: 25px;
}


/* Add a hover effect if you want */

.fa:hover {
  opacity: 0.7 !important;
}


/* Set a specific color for each brand */


/* Facebook */

.fa-facebook {
  background: #3B5998 !important;
  color: white !important;
}


/* Twitter */

.fa-twitter {
  background: #55ACEE !important;
  color: white !important;
}


/* instagram */

.fa-instagram {
  background: #833AB4 !important;
  color: white !important;
}


/* instagram */

.fa-amazon {
  background: #FF9900 !important;
  color: white !important;
}

.support {
  padding: 15px !important;
  height: 55px !important;
  text-align: center !important;
  text-decoration: none !important;
  background-color: #bd0d0d !important;
  color: #fff !important;
  line-height: 25px;
}

.support:hover {
  opacity: 0.7;
}

.fundrise {
  padding: 15px !important;
  height: 55px !important;
  text-align: center !important;
  text-decoration: none !important;
  background-color: #FFC300 !important;
  color: #252e6e !important;
  line-height: 25px;
}

.fundrise:hover {
  opacity: 0.7;
}

.ebay {
  background-color: #FFF !important;
  padding: 15px !important;
  height: 55px !important;
  text-align: center !important;
  text-decoration: none !important;
  line-height: 25px;
}

.ebay:hover {
  opacity: 0.7;
}

.ebay2 {
  background-color: #FFF !important;
  padding: 15px !important;
  width: 300px !important;
  text-align: center !important;
  text-decoration: none !important;
  line-height: 25px;
}

.ebay2:hover {
  opacity: 0.7;
}
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="viewport" content="width=device-width">
  <meta name="description" content="Portsmouth Lifeguards" />
  <link rel="shortcut icon" href="favicon.ico">
  <link rel="stylesheet" href="style.css">
  <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
  <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  <title>Nav</title>
</head>
<body>
  <!-- ============================== THIS IS THE HEADER IT HAS THE LINKS, LOGO, SOCIAL MEDIA BUTTON, SCROLLBAR100 AND FLASHING DONATE BUTTON  ================================== -->
  <header>
    <div class="topnav" id="myTopnav">
      <a href="store.html">Store</a>
      <a href="donate.html">Support Us</a>
      <a href="gallery.html">Gallery</a>
      <a href="blogs.html">News</a>
      <a href="join-us.html">Join Us</a>
      <a href="contact.html">Contact</a>
      <a href="lifesaving.html">Lifesaving</a>
      <div class="dropdown">
        <button class="dropbtn" data-bs-toggle="dropdown">Equipment
        </button>
        <div class="dropdown-content">
          <a href="boat.html">Water Rescue Craft</a>
          <a href="vehicle.html">Rescue Vehicles</a>
          <a href="equipment.html">Lifeguard Equipment</a>
          <a href="hqstorge.html">HQ / Storge</a>
        </div>
      </div>
      <a href="about.html">About</a>
      <a href="index.html" class="active">Home</a><br>
    </div>
    </div>
    <img src="images/logo.png" class="p-2" class="img-responsive mt-auto" style="max-width:100%" alt="branded">
    <a href="https://www.facebook.com/portsearescue" target="_blank" class="fa fa2 fa-facebook" style="margin-left: 13%;"></a>
    <a href="https://twitter.com/portsearescue" target="_blank" class="fa fa2 fa-twitter"></a>
    <a href="https://www.instagram.com/portsearescue/" target="_blank" class="fa fa2 fa-instagram"></a>
    <a href="https://smile.amazon.co.uk/ch/265431-0" target="_blank" class="fa fa2 fa-amazon"></a>
    <a href="https://charity.ebay.co.uk/charity/i/Portsmouth-&-Southsea-Voluntary-Lifeguards/167080" target="_blank" class="ebay"><span style="color: #E53238;">e</span><span style="color :#0064D2;">b</span><span style="color: #F5AF02;">a</span><span style="color: #86B817;">y</span></a>
    <a href="https://www.paypal.com/uk/fundraiser/charity/3128890" target="_blank" class="support"> Donate to us &#10084; </a>
    <a href="https://www.justgiving.com/psvl" target="_blank" class="fundrise"> Fundrise for us &#10047; </a>
  </header><br>
  <div class="scroll-left">
    <p>As a voluntary lifeguard service, we rely solely on your kind donations to run and maintain our services.&nbsp;Any donation, big or small, is very much appreciated, and will help us to continue to save lives.</p>
  </div>
  <br><br>
  <a href="donate.html"><button class="Flash" style="position: fixed; bottom: 10px; right: 10px;">Support us &#10084;</button></a>
</body>
</html>

The style used Bootstrap 5 as well

I’m at a lost here Many Thanks

Reload vue-owl-carousel after dynamic data update

Initialized a vue-owl-carousel using dynamic data

<script>

import carousel from 'vue-owl-carousel'

export default {
    components: { carousel },
}
<carousel :items="1">
    <img v-for="(img, index) in images" :src="img" :key="index">
  </carousel>


 data: function() {
    return {
      images: [
        "https://placeimg.com/200/200/any?1",
        "https://placeimg.com/200/200/any?2",
        "https://placeimg.com/200/200/any?3",
        "https://placeimg.com/200/200/any?4"
      ]
    };
  }

Removed one of images from the images array

How to update the owl carousel with new images array?

Vuejs method ajax call other method on component

how to call another method inside jquery ajax?

methods : {
    calert(type,msg="",error=""){
        console.log("call me");
    },
    getData(){
        $.ajax({
            type: "GET",
            success: function(data){
                // error calert not found
                calert(true,"","asd");
            },
            error: function (error) {
                // also error calert not found
                this.calert(false,"",error);
            },
            complete: function(){
            },
            url: "/test",
        });
    },
}

i have try to using this.calert but it doesn’t work, still error

Want to “ay” at the end of word

This code reverses the string and I want to add “ay” at the end of the word.

var string = prompt(“Enter string:”);
var strLen = string.length;

  for(var i = strLen-1; i >= 0; i--){
     document.writeln(string[i]);
 } 

fail to embed tableau worksheet into vue compoenent?

I am trying to embed tableau worksheets into my webpage,
I’m using laravel and VueJs, however in the backend I managed to sign in successfully into tableau through Laravel, but when trying to show worksheet it returns tableau refused to connect,

my code looks like this:

first included JavaScript API in app.

<script src="https://my_server_name/javascripts/api/tableau-2.8.0.min.js.min.js"></script>

and installed vue-tableau using

npm i vue-tableau

Tableau vue component:

<template>
  <Tableau 
    ref="tableau" 
    :url="url" /// https://my_server_name/#/site/site_name/views/workbook_name/view_name 
    height="1000" 
    width="1000"
  />
</template>
<script>

export default {
  name: "TableauWorkbookShow",
  props: {
    url: {
      type: String, 
      required: true,
    },
  },
};
</script>

what am I missing here ?

Custom Attributes values Javascript

The innline style Attributes has values such as style = "color: green; background: red;". If I want to dynamically change only the background I change with the javascript Attribute style, I do it with: element.style.background = "blue".

How to create a “custum Attributes” so that the values within an attribute change dynamically.

For example:
myAttributes = "car: mercedes; truck: volvo;" so that I change only car values dynamically as style changes, as an element.myAttributes.car = "ferrari" or with setAttributes ("myAttributes", car = "ferrari" ). Is there a possibility to do this, or some similar alternative, some idea?

Is there a way to selectively pick CSV Data in Javascript

I am new to Javascript and want to find a way read from a CSV File selectively (using a given range).

For example, something like CSVRead(row3,col5, toRow10, toCol15).

I found d3.csv which just reads the CSV and there are no arguments to do this. Also saw PapaParse – which from what i can tell doesn’t have this functionality either.

The goal is to product charts using selective areas from ONE CSV file, rather than create multiple CSV Data files.