Not sure why this code isnt working. The program should search through this word list and remove any words that include the letter A

This is being done on code.org, for some reason it removes some words with the letter A but not all, im not sure why it wont work.

    var wordList = ["abase", "abate", "abbey", "abbot", "abhor", "abide", "abled", "abode", 
"abort", "about", "above", "abuse", "abyss", "acorn", "acrid", "actor", "acute", "adage", 
"adapt",  "adept", "admin", "admit", "adobe", "adopt", "adore", "adorn", "adult", "affix", 
"afire", "afoot", "afoul", "after", "bulge", "bulky", "bully", "bunch", "bunny", "burly", 
"burnt", "burst", "bused", "bushy", "butch", "butte", "buxom", "buyer", "bylaw", "cabal", 
"cabby", "cabin", "cable", "cacao", "cache", "cacti", "pique", "setup", "seven", "sever", 
"wrote", "wrung", "wryly", "yacht", "yearn", 
"yeast", "yield", "young", "youth", "zebra", "zesty", "zonal"];
var wrongLettersList = ["a"];
var unsureLettersList = [];
var goodLettersList = [];
onEvent("wrongLetterInput", "input", function( ) {
  appendItem(wrongLettersList, getText("wrongLetterInput"));
  setProperty("wrongLetterInput","text", "");
  setProperty("wrongLetterInput", "placeholder", "Letters inputted: "+wrongLettersList);
  listFilter(wrongLettersList, unsureLettersList, goodLettersList);
});

function listFilter(wrongLetters, unsureLetters, goodLetters) {
  for(var j = 0; j<wordList.length; j++) {
    if(wordList[j].includes(wrongLetters[0])){
      wordList.splice(j, 1);
    }
  }
  console.log(wordList);
}

Transferring data through localhost?

For my college project, I’m developing an application that analyzes/detects anomalies in videos.

The backend is Python and the frontend is JS/NodeJS. I setup the backend so it runs 4 ML models and writes the outputs to 4 separate .txt files. I created a JS file that reads the .txt files and reformats the data to be saved as 4 .json files. Currently, the frontend just reads the .json files and displays the data… I run npm start to display the application in the browser at localhost:3000. Here is my problem:

In the application, the user can upload a .mp4 file and watch the video (react-player). I think I can setup a button interaction to execute a script that runs the backend .py file. However, I don’t know how to continue from there. I need to exchange data twice: First, I need to download the video to the .py file local directory as input to the ML models. Once the models have finished running, I need to
transfer the outputs (Python list or .json format… I know how to do either) back to the application so it can be displayed to the user.

I’m reading online that I can execute data transfer using jquery and/or ajax calls? Or maybe I setup a database? I have 0 experience w/ any of that so I’d like advice on the easiest approach. If you can recommend resources that can help me learn more on the topic, that’d also be helpful.

Data from axios showing up in wrong place in vue app

I’m working on an issue tracking system using vue. I have a side bar where the user can choose a project and can view the project’s issues in a table. Everything works fine. However, the weird thing is that if the user has one issue only, it shows in the wrong project’s table. If another issue is added, that issues then goes back to the correct table.

The way the code works, is that VerticalNavMenu gets all the projects, using axios, and creates a 2d list were each sub array contains the issues of a certain project and have the same index(i.e if project x has an index 3 in the porjects array, its issues are at index 3 in the 2d list)

VerticalNavMenu.vue

<template>
  <v-navigation-drawer
    :value="isDrawerOpen"
    app
    expand-on-hover
    mini-variant-width="60px"
    floating
    width="260"
    class="app-navigation-menu"
    :right="$vuetify.rtl"
    @input="val => $emit('update:is-drawer-open', val)"
  >
    <!-- Navigation Header -->
    <div class="vertical-nav-header d-flex items-center ps-6 pe-5 pt-5 pb-2">
      <router-link to="/" class="d-flex align-center text-decoration-none">
        <v-slide-x-transition>
          <h2 class="app-title text--primary">ITrackerHub</h2>
        </v-slide-x-transition>
      </router-link>
    </div>

    <!-- Navigation Items -->
    <v-list expand shaped class="vertical-nav-menu-items pr-5">
      <nav-menu-link
        title="Dashboard"
        :to="{ name: 'dashboard' }"
        :icon="icons.mdiHomeOutline"
      ></nav-menu-link>

      <v-list>
        <v-list-group :prepend-icon="icons.mdiTelevisionGuide">
          <template v-slot:activator>
            <v-list-item-content>
              <v-list-item-title v-text="'My Projects'"></v-list-item-title>
            </v-list-item-content>
          </template>

          <v-list-item v-for="(project, index) in ProjectList" :key="index">
            <v-icon class="mx-2">{{ icons.mdiAccountGroup }}</v-icon>
            <v-list-item-content>
              <router-link
                class="d-flex align-center text-decoration-none black--text"
                :to="{ name: 'ProjectPage', params: { id: project.id, project, ProjectIssuesList, index } }"
              >
                {{ project.title }}
              </router-link>
            </v-list-item-content>
          </v-list-item>
        </v-list-group>
      </v-list>

      <nav-menu-link title="My Issues" :to="{ name: 'MyIssues' }" :icon="icons.mdiBookEditOutline"></nav-menu-link>
      <nav-menu-link
        style="position:relative; top:70px;"
        title="Account Settings"
        :to="{ name: 'pages-account-settings' }"
        :icon="icons.mdiAccountCogOutline"
      ></nav-menu-link>

      <nav-menu-link
        style="position: relative; top: 200px"
        title="Create Project"
        :to="{ name: 'CreateProject' }"
        :icon="icons.mdiPlusMinus"
      ></nav-menu-link>
    </v-list>
  </v-navigation-drawer>
</template>

<script>
// eslint-disable-next-line object-curly-newline
import {
  mdiHomeOutline,
  mdiAlphaTBoxOutline,
  mdiEyeOutline,
  mdiCreditCardOutline,
  mdiTable,
  mdiFileOutline,
  mdiFormSelect,
  mdiAccountCogOutline,
  mdiAccountGroup,
  mdiAccountMultiple,
  mdiTelevisionGuide,
  mdiBookEditOutline,
  mdiPlusMinus,
} from '@mdi/js'

// import NavMenuSectionTitle from './components/NavMenuSectionTitle.vue'
import NavMenuGroup from './components/NavMenuGroup.vue'
import NavMenuLink from './components/NavMenuLink.vue'
import { mapGetters, mapActions } from 'vuex'


export default {
  components: {
    // NavMenuSectionTitle,
    NavMenuGroup,
    NavMenuLink,
  },
 
  computed: {
    ...mapGetters(['ProjectList']),
    ...mapGetters(['ProjectIssuesList']),
    
  },
  

  methods: {
    ...mapActions(['getProjectList'])
  },

  created() {
    this.getProjectList()
  },

  props: {
    isDrawerOpen: {
      type: Boolean,
      default: null,
    },
  },

  setup() {
    return {
      icons: {
        mdiHomeOutline,
        mdiAlphaTBoxOutline,
        mdiEyeOutline,
        mdiCreditCardOutline,
        mdiTable,
        mdiFileOutline,
        mdiFormSelect,
        mdiAccountCogOutline,
        mdiAccountGroup,
        mdiAccountMultiple,
        mdiTelevisionGuide,
        mdiBookEditOutline,
        mdiPlusMinus,
      },
    }
  },
}
</script>

<style lang="scss" scoped>
.app-title {
  font-size: 1.25rem;
  font-weight: 700;
  font-stretch: normal;
  font-style: normal;
  line-height: normal;
  letter-spacing: 0.3px;
}

// ? Adjust this `translateX` value to keep logo in center when vertical nav menu is collapsed (Value depends on your logo)
.app-logo {
  transition: all 0.18s ease-in-out;
  .v-navigation-drawer--mini-variant & {
    transform: translateX(-10px);
  }
}

@include theme(app-navigation-menu) using ($material) {
  background-color: map-deep-get($material, 'background');
}

.app-navigation-menu {
  .v-list-item {
    &.vertical-nav-menu-link {
      ::v-deep .v-list-item__icon {
        .v-icon {
          transition: none !important;
        }
      }
    }
  }
}
</style>

NavBar.js (for vuex)

import axios from 'axios'

const state = {
  Projects: [],
  ProjectsIssuesList: []
}

const getters = {
  ProjectList: (state) => state.Projects,
  ProjectIssuesList: (state) => state.ProjectsIssuesList
}

const actions = {
  async getProjectList({ commit }) {

    var projectList = []
    var issuesList = []
    await axios
        .get('https://fadiserver.herokuapp.com/api/v1/my-projects/')
        .then(response => {
          projectList = response.data

          for (let i = 0; i < projectList.length; i++) {
            let projectid = projectList[i].id
            
            axios
              .get('https://fadiserver.herokuapp.com/api/v1/my-issues-titles/?projectid=' + projectid)
              .then(response => {
                issuesList.push(response.data)
              })
              .catch(error => {
                console.log(error)
              })
          }
        })
        .catch(error => {
          console.log(error)
        })

    commit('setProjects', projectList),
    commit('setProjectsIssues', issuesList)
  },
}

const mutations = {
  setProjects: (state, Projects) => (state.Projects = Projects),
  setProjectsIssues: (state, ProjectsIssuesList) => (state.ProjectsIssuesList = ProjectsIssuesList)
}

export default {
  state,
  getters,
  actions,
  mutations
}

ProjectPage.vue

<template>
  <v-card>
    <v-card-title class="text-center justify-center py-6">
      <h1 class="font-weight-bold text-h2 basil--text">
        {{ project.title }}
      </h1>
    </v-card-title>
    <v-tabs v-model="tab" background-color="primary" dark centered>
      <v-tab v-for="item in items" :key="item.tab">{{ item.tab }}</v-tab>
    </v-tabs>

    <v-tabs-items v-model="tab">
      <v-tab-item v-for="item in items" :key="item.tab">
        <v-card flat>
          <v-card v-if="item.tab == 'Issues'">
            <template>
              <AddIssue :projectid="id"></AddIssue>
              <!-- <div class="text-center">
                <v-dialog v-model="dialog" width="500">
                  <template v-slot:activator="{ on }">
                    <v-btn class="success" dark v-on="on">
                      <v-icon align-self: left>
                        mdi-plus-thick
                      </v-icon>
                      Add Issue
                    </v-btn>
                  </template>
                  <v-card>
                    <v-card-title>
                      <h2>Add Issue</h2>
                    </v-card-title>
                    <v-card-text>
                      <v-form class="px-3">
                        <v-text-field v-model="title" label="Title"></v-text-field>
                        <v-textarea v-model="description" label="Description"></v-textarea>
                        <v-select
                          item-text="text"
                          item-value="value"
                          :items="time_est"
                          v-model="time_estimate"
                          label="Time Estimate"
                        ></v-select>

                        <v-select
                          item-text="title"
                          item-value="id"
                          :items="issueType"
                          v-model="issue_type"
                          label="Issue Type"
                        ></v-select>
                        <v-select
                          item-text="title"
                          item-value="id"
                          v-model="issue_status"
                          label="Issue Status"
                          :items="issueStatus"
                        ></v-select>
                        <v-select
                          item-text="title"
                          item-value="id"
                          :items="issueSeverity"
                          v-model="issue_severity"
                          label="Issue Severity"
                        ></v-select>
                        <v-spacer></v-spacer>
                        <v-btn
                          flat
                          @click="
                            postIssue()
                            reloadPage()
                          "
                          class="success mx-0 mt-3"
                        >
                          <v-icon align-self:left>mdi-content-save-check-outline</v-icon> Save</v-btn
                        >
                      </v-form>
                    </v-card-text>
                  </v-card>
                </v-dialog>
              </div> -->
            </template>

            <v-card>
              <v-data-table
                :headers="headers"
                :items="ProjectIssuesList[index]"
                item-key="full_name"
                class="table-rounded"
                hide-default-footer
                enable-sort
                @click:row="handleClick"
              >
              </v-data-table>
            </v-card>
          </v-card>
        </v-card>
      </v-tab-item>
    </v-tabs-items>
  </v-card>
</template>

<script>
import axios from 'axios'
import AddIssue from './AddIssue.vue'

export default {
  props: ['id', 'project', 'ProjectIssuesList', 'index'],

  components: {
    AddIssue
  },

  data() {
    return {
      tab: null,
      items: [{ tab: 'Issues' }, { tab: 'Calender' }, { tab: 'About' }],

      title: '',
      description: '',
      time_estimate: '',
      issue_type: '',
      issue_status: '',
      issue_severity: '',
      time_est: [
        { value: '1', text: '1' },
        { value: '2', text: '2' },
        { value: '3', text: '3' },
        { value: '4', text: '4' },
        { value: '5', text: '5' },
        { value: '6', text: '6' },
        { value: '7', text: '7' },
        { value: '8', text: '8' },
      ],
    }
  },

  setup() {
    return {
      headers: [
        { text: 'Title', value: 'title' },
        { text: 'Description', value: 'description' },
        { text: 'Estimate', value: 'time_estimate' },
        { text: 'Assignees', value: 'user' },
        { text: 'Type', value: 'issueType' },
        { text: 'Status', value: 'issueStatus' },
        { text: 'Severity', value: 'issueSeverity' },
      ],
    }
  },

  methods: {
    handleClick(issue) {
      this.$router.push({
        name: 'IssuePage',
        params: { id: issue.id, issue },
      })
    },
    postIssue() {
      axios
        .post('https://fadiserver.herokuapp.com/api/v1/my-issues/', {
          title: this.title,
          description: this.description,
          time_estimate: this.time_estimate,
          userid: 'f3260d22-8b5b-4c40-be1e-d93ba732c576',
          projectid: this.id,
          issueTypeId: this.issue_type,
          issueStatusId: this.issue_status,
          issueSeverityId: this.issue_severity,
        })
        .then(response => {
          console.log(response)
        })
    },
    reloadPage() {
      window.location.reload()
    },
  },


}
</script>

<style scoped>
.v-btn {
  left: 43%;
}
</style>

Redis storing and getting multiple records

I’m quite new to redis and have a task at hand to optimize redis operations for a dashboard of a non-profit.

The scenario:

  • We have multiple cities (London, Rome,…)
  • We have 1000s of users in each city

We have a need to load users from a particular city, and at the moment it is stored by city ID. As you can imagine, this results in a massive document that needs to be re-cached on every small change to the user.

I want to change this methodology so users are stored in Redis in the following format: [cityID][userID]. So if I need to pull all users from london, I can just call IDFORLONDON?

Would this be the correct way to approach it? Is there a way to load only 10 users from IDFORLONDON? (for pagination). Or is my option to load all and then slice?

Thank you!

Laravel Variable Does Not Appear In JavaScript

I have a PHP/Laravel variable like this:

$total_counts = 4;

Then I tried this code to return the $total_counts variable inside JS variable counters:

var counters = {!! json_encode($total_counts) !!};
console.log(counters);

But nothing appears at Console bar!

So what’s going wrong here? How can I properly show PHP variable inside Javascript ?

How to obtain generated cookies from a request with axios?

So, when I make a GET request in postman, in the response, one cookie was generated. I am trying to do this request with axios in Node.js. However, I am not able to get this generated cookie.

I am using axios interceptors like:

axios.interceptors.response.use(function (response) {
  console.log(response.headers);
  return response;
  }, function (error) {
  return Promise.reject(error);
});

But, it only returns:

{
  'cache-control': 'private',
  'content-type': 'text/html',
  expires: 'Tue, 01 Mar 2022 19:53:24 GMT',
  server: 'Microsoft-IIS/8.5',
  'x-powered-by': 'ASP.NET',
  date: 'Tue, 01 Mar 2022 19:53:23 GMT',
  'content-length': '4067'
}

In the headers, there is no information about the cookie that is being generated. The problem is that I need this cookie to make other requests in the website.

In the request I already add one cookie like

{
'Cookie': 'ASPSESSIONIDAWSQAQSA=AKLJADOCJNNPPHOKGGMOPHJD',
'Connection': 'keep-alive'
}

But I need the new cookie that is generated in the response. Therefore, the next request that I do will have two cookies.

What is the best approach to declare variable in typescript for class assignment?

I don’t want to declare accountHandler as any it is not good practice. What is a better approach to create class variable when you have to assign it to class in the constructor.

main.ts

{
 private accountHandler: any= {};
 private requestLOB: string[] = [];


    constructor() {
        if (process.env.ENABLEBackendSwitch === "true") {
            this.accountHandler = new AccountBalanceHandlerV2();
        } else {
            this.accountHandler = new AccountBalanceHandler();
        }
    }

Display nested array depending on nested value

I’m trying to display a nested array in my screen (see array below), the first layer display correctly, but when I try to display the second one, it doesn’t return anything, the items in the second layer array should be displayed only if selected=false, that’s why I decided to use a forEach function first.

map

   const items = order.order.map((item) => {
    
          const additional = item.additional.forEach((e) => {
                e.data.map((a) => {
                    const id = Math.random() * Math.random() + a.id
                    if(a.selected == false){
                      return(
                        <View key={id}>
                          <Text>{a.title}</Text>
                          <Text>$ {a.price}</Text>
                        </View>
                      )
                    }
                  })
              })
    
          return (
            <View key={item.id}>
               <Text>{item.quantity}</Text>
               <Text>{item.title}</Text>
               <Text>$ {item.price.toFixed(2)}</Text>
              {additional}
            </View>
          )
        })

array ITEM

Object {
  "additional": Array [
    Object {
      "data": Array [
        Object {
          "id": 0,
          "price": 0,
          "selected": false,
          "title": "Hot Sauce",
          "type": "Sauces",
        },
        Object {
          "id": 1,
          "price": 0,
          "selected": false,
          "title": "Medium Sauce",
          "type": "Sauces",
        },
      ],
      "id": 1,
      "required": true,
      "title": "Sauces",
    },
    Object {
      "data": Array [
        Object {
          "id": 0,
          "price": 1,
          "selected": false,
          "title": "Ranch",
          "type": "Sides",
        },
        Object {
          "id": 1,
          "price": 1,
          "selected": false,
          "title": "Blue Cheese",
          "type": "Sides",
        },
      ],
      "id": 0,
      "required": false,
      "title": "Sides",
    },
  ],
  "id": 0.103,
  "price": 6.95,
  "quantity": 1,
  "title": "Buffalo Wings",
}

Kubernetes, Nginx, SPA hosted on a shared domain

I’m working on a project thats hosted on kubernetes, theres an ingress configured so that going to the domain root (lets call it example.com) directs to an nginx service hosting an spa thats already running. certain api paths /v1, /v2 etc point to different api services.

We are adding a second SPA that will be hosted under example.com/ui

I should probably mention this SPA is built using lit element (web components), but gets pre-processed(minified/transpiled/etc) and hosted via nginx rather than using polymer-serve or something similar. The processing is done via rollupjs and tailwind-cli(for the css). Also the site using routing, so other routes example.com/ui/someOtherRoute define user views in the SPA but would just return the index.html from the server.

I started with an nginx config I use for all of my other SPAs however it’s set up to use the root domain.

server {
listen   80;
listen   [::]:80 default ipv6only=on;

root /usr/share/nginx/html;
index index.html;

server_name _; # all hostnames

location / {
    try_files $uri /index.html;
}

add_header Access-Control-Allow-Origin *;

}

So we have a situation where if the uri doesn’t have /ui it wont get routed to my nginx server

When something does contain /ui I want to check for matching files otherwise serve the index.html

I don’t have much experience with nginx but have been researching potential solutions.

currently I’m trying to leverage the alias feature as such:

 location /ui/ {
    alias /usr/share/nginx/html;
    try_files $uri /index.html;
}

My understanding is that using the alias will strip the “/ui” from the search path so that a request of example.com/ui/somefile.css would look up files as if it was example.com/somefile.css

However I also found an old bug thats still open here

Stating that leveraging try_files $uri isn’t effected by the alias. so the try_files command must still use the /ui in its file look up.

I also tried leveraging the html base tag in my index but that started adding /ui/ui to all of my css and js script requests.

I may be way off on my understanding here but any guidance would be great. I have limited control over what can be changed in the kuberenetes ingress, but I have complete control over the ngix container and the SPA code base.

We have a fallback plan of adding a separate sub domain for the new ui app, which will work and we’ve done many times before. I’m just really stuck in my head on this because I’m sure it can be solved as is and I’d really like to figure it out.

How can I prevent bootstrap collapse from making overlapping divs when their size is variable during program usage

JSFiddle – https://jsfiddle.net/silkpuma/fb1gqxh5/#&togetherjs=Pt1jA1Ri2K

When using bootstrap collapse my div sizes can change. This leads to my divs then overlapping. I tried using a container with row for each section of my program that I don’t want to overlap but when my repair div gets larger due to bootstrap collapse it overlaps my next element. I tried changing positions but nothing would prevent then from overlapping when the size changes.

<body style="background-color: #e5e5e5">
  <div class="container-fluid" style="background-color: #e5e5e5">

    <div class="row">
        <div style="height: 100vh; margin: 0 -15px 0 -15px; background-image: url('assets/bg.jpg');"   class="bg-image">
        <nav class="navbar navbar-expand-sm navbar-light bg-light " >
      <div class="container-fluid" style="background-color: transparent !important;">
        <a class="navbar-brand" href="#">iRepair</a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon"></span>
        </button>
        <div style="background-color: transparent !important;" class="collapse navbar-collapse " id="navbarSupportedContent" >
          <ul class="navbar-nav me-auto mb-2 mb-lg-0">
            <li class="nav-item">
              <a class="nav-link" href="#repair">Repair</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="#purchase">Purchase</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="#aboutUs">About Us</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="#contact">Contact</a>
            </li>
            <li class="nav-item">
              <a class="nav-link" href="#location">Location</a>
            </li>
            <li class="nav-item">
              <a class="nav-link active" aria-current="page" href="tel:+15404215581">(540)421-5581</a>
            </li>
          </ul>
        </div>
      </div>
    </nav>
      <div style="background-color: transparent !important; padding-top: 24px" class="text-center position-absolute top-50 start-50 translate-middle" >
      <h1>iRepair</h1>
      <h5 style="margin-bottom: 24px">Harrisonburg's original professional Phone & PC Repair Shop.</h5>
      <a style="margin-right: 8px" class="btn btn-outline-dark" href="#repair">Repair</a>
      <a class="btn btn-outline-dark" href="#purchase">Purchase</a>
    </div>
      </div>
    </div>

    <div class="row">
        <div id="repair" class="container" style=" padding-top: 24px; height: 50vh; text-align: center" >
    <h1>Device Repair</h1>
    <p></p>
    <h5 style="padding-bottom: 96px">All your electronics are welcome! We have the tool and expertize your device needs.</h5>
    <!--  device repair option-->
    <div class="d-flex justify-content-center row img-fluid panel-group" >

      <div class="card-formatting card col-md-4 col-6" style="align-items: center"  >
        <img class="img-fluid img-size card-img-top" src="assets/iphone/iphone13.png" alt="...">
        <div class="card-body">
          <button onclick="location.href='#iphoneRepair'" class="btn card-text stretched-link" type="button"  data-bs-toggle="collapse" data-bs-target="#iphoneRepair" aria-expanded="false" aria-controls="collapseExample">
            iPhone Repair
          </button>
        </div>
      </div>


      <div class="card-formatting card col-md-4 col-6" style="align-items: center">
        <img class="img-fluid img-size card-img-top" src="assets/iPad/ipadPro2021.png" alt="...">
        <div class="card-body">
          <button onclick="location.href='#ipadRepair'" class="btn card-text stretched-link" type="button" data-bs-toggle="collapse" data-bs-target="#ipadRepair" aria-expanded="false" aria-controls="collapseExample">
            iPad Repair
          </button>
        </div>
      </div>

      <div class="card-formatting card col-md-4 col-6 text-center" >
        <img class="card-img-top img-fluid img-size" src="assets/Android/s21.png"  alt="...">
        <div class="card-body">
          <button onclick="location.href='#AndroidRepair'" class="btn card-text stretched-link" type="button" data-bs-toggle="collapse" data-bs-target="#AndroidRepair" aria-expanded="false" aria-controls="collapseExample">
            Android Phone Repair
          </button>
        </div>
      </div>

      <div class="card-formatting card col-md-4 col-6 text-center" >
        <img class="card-img-top img-fluid img-size" src="assets/Android/galaxyTab.webp"  alt="...">
        <div class="card-body">
          <button onclick="location.href='#AndroidTabletRepair'" class="btn   card-text stretched-link" type="button" data-bs-toggle="collapse" data-bs-target="#AndroidTabletRepair" aria-expanded="false" aria-controls="collapseExample">
            Android Tablet Repair
          </button>
        </div>
      </div>

      <div class="card-formatting card col-md-4 col-6 text-center">
        <img class="card-img-top img-size img-fluid " src="assets/Macbook/macbookTop.png"  alt="...">
        <div class="card-body">
          <button onclick="location.href='#PcRepair'" class="nav-link btn   card-text stretched-link" type="button" data-bs-toggle="collapse" data-bs-target="#PcRepair" aria-expanded="false" aria-controls="collapseExample">
            Mac/PC Repair
          </button>
        </div>
      </div>

      <div class="card-formatting card col-md-4 col-6 text-center">
        <img class="card-img-top img-fluid img-size" src="assets/watch/appleWatch.png"  alt="...">
        <div class="card-body">
          <button onclick="location.href='#WatchRepair'" class="btn card-text stretched-link" type="button" data-bs-toggle="collapse" data-bs-target="#WatchRepair" aria-expanded="false" aria-controls="collapseExample">
            Smart Watch Repair
          </button>
        </div>
      </div>
  </div>


  <!--DevicesInterface show hide panels-->
  <div  style="height: 50vh" class="container-fluid" id="chooseDevice">


    <!--  iPhone Repair-->

    <div class="px-lg-5 collapse justify-content-center row dropdown img-fluid" data-bs-parent="#chooseDevice" style=" padding-top: 48px" id="iphoneRepair">
    <h1 style="padding-bottom: 96px">Select iPhone</h1>

  <!--    Iteration for device-->
    <ng-container *ngFor="let iphone of iphones" >
       <div class="card-formatting-devices card col-6 col-md-3 text-center" >
        <img src="{{iphone.deviceImg}}" class="img-product-details card-img-top" alt="...">
         <div class="card-body">
        <button class="btn card-text stretched-link" type="button"  data-bs-toggle="collapse" [attr.data-bs-target]="'#' + iphone.repairId">
          {{iphone.deviceName}}
        </button>
       </div>
      </div>

  <!--      REPAIR DATA-->
       <div class="img-fluid repair-info-div card-formatting-devices collapse justify-content-center" data-bs-parent="#iphoneRepair" style="padding-bottom: 20vh" id="{{iphone.repairId}}">
        <h3 class="card-title " style="padding: 48px 0 48px 0;">{{iphone.deviceName}} Repair Cost: <p style="font-size: medium">Select the repair you are interested in to schedule an appointment!</p></h3>

        <div class="row justify-content-center">
          <div *ngFor="let repair of iphone.repair"  class="card-formatting-repairs card col-md-6 col-lg-4  col-12 text-center">
            <img src="{{repair.repairImg}}" class="card-img-repairs card-img-top img-fluid " alt="...">
            <div class="card-body ">
              <h5 class="card-title">{{repair.repairTitle}} {{repair.repairPrice}}</h5>
              <p>{{repair.repairDetails}}</p>

              <a class="btn"><a class="nav-link active stretched-link" aria-current="page" href="sms:+15404215581&body=Hi! I would like to get my {{iphone.deviceName}} {{repair.repairTitle}} repaired. Can I schedule an appointment?"></a></a>
            </div>
          </div>
        </div>

         <p></p>
         <p></p>
         <div class="justify-content-evenly">
           <h3 style="padding-bottom: 16px">Schedule your service!</h3>
           <button style="margin-right: 8px; font-size: large" class="btn btn-outline-secondary"><a class="nav-link active" aria-current="page" href="tel:+15404215581">Call</a></button>
           <button style=" font-size: large" class="btn btn-outline-dark"><a class="nav-link active" aria-current="page" href="sms:+15404215581">Text</a></button>
         </div>
         <hr style="background-color: black; margin-top: 24px">

      </div>

    </ng-container>

    </div>







      <!--  Ipad Repair-->
    <div class="px-lg-5 collapse justify-content-center row dropdown img-fluid" data-bs-parent="#chooseDevice" style=" padding-top: 48px" id="ipadRepair">
        <h1 style="padding-bottom: 96px">Select iPad</h1>

        <!--    Iteration for device-->
        <ng-container *ngFor="let ipad of ipads" >
          <div class="card-formatting-devices card col-6 col-md-3 text-center">
            <img src="{{ipad.deviceImg}}" class="annoying-imgs card-img-top" alt="...">
            <div class="card-body">
              <button class="btn card-text stretched-link" type="button" data-bs-toggle="collapse" [attr.data-bs-target]="'#' + ipad.repairId">
                {{ipad.deviceName}}
              </button>
            </div>
          </div>

          <!--      REPAIR DATA-->
          <div class=" img-fluid repair-info-div card-formatting-devices collapse justify-content-center" data-bs-parent="#ipadRepair" style="padding-bottom: 20vh" id="{{ipad.repairId}}">
            <h3 class="card-title " style="padding-bottom: 48px; padding-top: 24px">{{ipad.deviceName}} Repair Cost: <p style="font-size: medium">Select repair</p></h3>

            <div class="row justify-content-center">
              <div *ngFor="let repair of ipad.repair"  class="card-formatting-repairs card col-md-6 col-lg-4 col-12 text-center">
                <img src="{{repair.repairImg}}" class="card-img-repairs card-img-top img-fluid " alt="...">
                <div class="card-body ">
                  <h5 class="card-title">{{repair.repairTitle}} {{repair.repairPrice}}</h5>
                  <p>{{repair.repairDetails}}</p>
                  <a class="btn"><a class="nav-link active stretched-link" aria-current="page" href="sms:+15404215581&body=Hi! I would like to get my {{ipad.deviceName}} {{repair.repairTitle}} repaired. Can I schedule an appointment?"></a></a>
                </div>
              </div>
            </div>
            <p></p>
            <p></p>
            <div class="justify-content-evenly">
              <h3 style="padding-bottom: 16px">Schedule your service!</h3>
              <button style="margin-right: 8px; font-size: large" class="btn btn-outline-secondary"><a class="nav-link active" aria-current="page" href="tel:+15404215581">Call</a></button>
              <button style=" font-size: large" class="btn btn-outline-dark"><a class="nav-link active" aria-current="page" href="sms:+15404215581">Text</a></button>
            </div>
            <hr style="background-color: black; margin-top: 24px">
          </div>
        </ng-container>
      </div>





    <!--


    ANDROID PHONE REPAIR


    -->
      <div class="px-lg-5 collapse justify-content-center row dropdown img-fluid" data-bs-parent="#chooseDevice" style=" padding-top: 48px" id="AndroidRepair">
        <h1 style="padding-bottom: 96px">Select Phone</h1>

        <!--    Iteration for device-->
        <ng-container *ngFor="let android of androidPhones" >
          <div class="card-formatting-devices card col-6 col-md-3 text-center">
            <img src="{{android.deviceImg}}" class="annoying-imgs card-img-top" alt="...">
            <div class="card-body">
              <button class="btn card-text stretched-link" type="button" data-bs-toggle="collapse" [attr.data-bs-target]="'#' + android.repairId">
                {{android.deviceName}}
              </button>
            </div>
          </div>

          <!--      REPAIR DATA-->
          <div class=" img-fluid repair-info-div card-formatting-devices collapse justify-content-center" data-bs-parent="#AndroidRepair" style="padding-bottom: 20vh" id="{{android.repairId}}">
            <h3 class="card-title " style="padding-bottom: 48px; padding-top: 24px">{{android.deviceName}} Repair Cost: <p style="font-size: medium">Select repair</p></h3>

            <div class="row justify-content-center">
              <div *ngFor="let repair of android.repair"  class="card-formatting-repairs card col-md-6 col-lg-4 col-12 text-center">
                <img src="{{repair.repairImg}}" class="card-img-repairs card-img-top img-fluid " alt="...">
                <div class="card-body ">
                  <h5 class="card-title">{{repair.repairTitle}} {{repair.repairPrice}}</h5>
                  <p>{{repair.repairDetails}}</p>
                  <a class="btn"><a class="nav-link active stretched-link" aria-current="page" href="sms:+15404215581&body=Hi! I would like to get my {{android.deviceName}} {{repair.repairTitle}} repaired. Can I schedule an appointment?"></a></a>
                </div>
              </div>
            </div>
            <p></p>
            <p></p>
            <div class="justify-content-evenly">
              <h3 style="padding-bottom: 16px">Schedule your service!</h3>
              <button style="margin-right: 8px; font-size: large" class="btn btn-outline-secondary"><a class="nav-link active" aria-current="page" href="tel:+15404215581">Call</a></button>
              <button style=" font-size: large" class="btn btn-outline-dark"><a class="nav-link active" aria-current="page" href="sms:+15404215581">Text</a></button>
            </div>
            <hr style="background-color: black; margin-top: 24px">
          </div>
        </ng-container>
      </div>




  <!--

  ANDROID Tablet REPAIR

  -->
      <div class="px-lg-5 collapse justify-content-center row dropdown img-fluid" data-bs-parent="#chooseDevice" style=" padding-top: 48px" id="AndroidTabletRepair">
        <h1 style="padding-bottom: 96px">Select Tablet</h1>

        <!--    Iteration for device-->
        <ng-container *ngFor="let androidTablet of androidTablets" >
          <div class="card-formatting-devices card col-6 col-md-3 text-center">
            <img src="{{androidTablet.deviceImg}}" class="annoying-imgs card-img-top" alt="...">
            <div class="card-body">
              <button class="btn card-text stretched-link" type="button" data-bs-toggle="collapse" [attr.data-bs-target]="'#' + androidTablet.repairId">
                {{androidTablet.deviceName}}
              </button>
            </div>
          </div>

          <!--      REPAIR DATA-->
          <div class=" img-fluid repair-info-div card-formatting-devices collapse justify-content-center" data-bs-parent="#AndroidTabletRepair" style="padding-bottom: 20vh" id="{{androidTablet.repairId}}">
            <h3 class="card-title " style="padding-bottom: 48px; padding-top: 24px">{{androidTablet.deviceName}}</h3>

            <div class="row justify-content-center">
              <div *ngFor="let repair of androidTablet.repair"  class="card-formatting-repairs card col-md-6 col-lg-4  col-12 text-center">
                <img src="{{repair.repairImg}}" class="card-img-repairs card-img-top img-fluid " alt="...">
                <div class="card-body ">
                  <h5 class="card-title">{{repair.repairTitle}} {{repair.repairPrice}}</h5>
                  <p>{{repair.repairDetails}}</p>
                  <a class="btn"><a class="nav-link active stretched-link" aria-current="page" href="sms:+15404215581&body=Hi! I would like to get my android tablet repaired. Can I schedule an appointment?"></a></a>
                </div>
              </div>
            </div>
            <p></p>
            <p></p>
            <div class="justify-content-evenly">
              <h3 style="padding-bottom: 16px">Schedule your service!</h3>
              <button style="margin-right: 8px; font-size: large" class="btn btn-outline-secondary"><a class="nav-link active" aria-current="page" href="tel:+15404215581">Call</a></button>
              <button style=" font-size: large" class="btn btn-outline-dark"><a class="nav-link active" aria-current="page" href="sms:+15404215581">Text</a></button>
            </div>
            <hr style="background-color: black; margin-top: 24px">
          </div>
        </ng-container>
      </div>




    <!--Mac/PC Repair-->
      <div class="px-lg-5 collapse justify-content-center row dropdown img-fluid" data-bs-parent="#chooseDevice" style=" padding-top: 48px" id="PcRepair">
        <h1 style="padding-bottom: 96px">Select Computer</h1>

        <!--    Iteration for device-->
        <ng-container *ngFor="let computer of computers" >
          <div class="card-formatting-devices card col-6 col-md-3 text-center">
            <img src="{{computer.deviceImg}}" class="annoying-imgs card-img-top" alt="...">
            <div class="card-body">
              <button class="btn card-text stretched-link" type="button" data-bs-toggle="collapse" [attr.data-bs-target]="'#' + computer.repairId">
                {{computer.deviceName}}
              </button>
            </div>
          </div>

          <!--      REPAIR DATA-->
          <div class=" img-fluid repair-info-div card-formatting-devices collapse justify-content-center" data-bs-parent="#PcRepair" style="padding-bottom: 20vh" id="{{computer.repairId}}">
            <h3 class="card-title " style="padding-bottom: 48px; padding-top: 24px">{{computer.deviceName}}</h3>

            <div class="row justify-content-center">
              <div *ngFor="let repair of computer.repair"  class="card-formatting-repairs card col-md-6 col-lg-4 col-12 text-center">
                <img src="{{repair.repairImg}}" class="card-img-repairs card-img-top img-fluid " alt="...">
                <div class="card-body ">
                  <h5 class="card-title">{{repair.repairTitle}} {{repair.repairPrice}}</h5>
                  <p>{{repair.repairDetails}}</p>
                  <a class="btn"><a class="nav-link active stretched-link" aria-current="page" href="sms:+15404215581&body=Hi! I would like to get my computer repaired. Can I schedule an appointment?"></a></a>
                </div>
              </div>
            </div>
            <p></p>
            <p></p>
            <div class="justify-content-evenly">
              <h3 style="padding-bottom: 16px">Schedule your service!</h3>
              <button style="margin-right: 8px; font-size: large" class="btn btn-outline-secondary"><a class="nav-link active" aria-current="page" href="tel:+15404215581">Call</a></button>
              <button style=" font-size: large" class="btn btn-outline-dark"><a class="nav-link active" aria-current="page" href="sms:+15404215581">Text</a></button>
            </div>
            <hr style="background-color: black; margin-top: 24px">
          </div>
        </ng-container>
      </div>






    <!--Watch Repair-->
      <div class="px-lg-5 collapse justify-content-center row dropdown img-fluid" data-bs-parent="#chooseDevice" style=" padding-top: 48px" id="WatchRepair">
        <h1 style="padding-bottom: 96px">Select Watch</h1>

        <!--    Iteration for device-->
        <ng-container *ngFor="let watch of watches" >
          <div class="card-formatting-devices card col-6 col-md-3 text-center">
            <img src="{{watch.deviceImg}}" class="img-product-details card-img-top" alt="...">
            <div class="card-body">
              <button class="btn card-text stretched-link" type="button" data-bs-toggle="collapse" [attr.data-bs-target]="'#' + watch.repairId">
                {{watch.deviceName}}
              </button>
            </div>
          </div>

          <!--      REPAIR DATA-->
          <div class=" img-fluid repair-info-div card-formatting-devices collapse justify-content-center" data-bs-parent="#WatchRepair" style="padding-bottom: 20vh" id="{{watch.repairId}}">
            <h3 class="card-title " style="padding-bottom: 48px; padding-top: 24px">{{watch.deviceName}} Repair Cost: <p style="font-size: medium">Select repair</p></h3>

            <div class="row justify-content-center">
              <div *ngFor="let repair of watch.repair"  class="card-formatting-repairs card col-md-6 col-lg-4 col-12 text-center">
                <img src="{{repair.repairImg}}" class="annoying-imgs card-img-top img-fluid " alt="...">
                <div class="card-body ">
                  <h5 class="card-title">{{repair.repairTitle}} {{repair.repairPrice}}</h5>
                  <p>{{repair.repairDetails}}</p>
                  <a class="btn"><a class="nav-link active stretched-link" aria-current="page" href="sms:+15404215581&body=Hi! I would like to get my {{watch.deviceName}} {{repair.repairTitle}} repaired. Can I schedule an appointment?"></a></a>
                </div>
              </div>
            </div>
            <p></p>
            <p></p>
            <div class="justify-content-evenly">
              <h3 style="padding-bottom: 16px">Schedule your service!</h3>
              <button style="margin-right: 8px; font-size: large" class="btn btn-outline-secondary"><a class="nav-link active" aria-current="page" href="tel:+15404215581">Call</a></button>
              <button style=" font-size: large" class="btn btn-outline-dark"><a class="nav-link active" aria-current="page" href="sms:+15404215581">Text</a></button>
            </div>
            <hr style="background-color: black; margin-top: 24px">
          </div>
        </ng-container>
      </div>


    </div>
  </div>
    </div>

    <div class="row" >
        <div class="text-center row " style="padding-top: 75vh">
        <div id="purchase"  >
        <h3>Devices for Sale</h3>
        <br>
        <p>Looking for a quality used phone? Look no further than iRepair! We sell new and quality used phones and iPads. Devices in stock are available for immediate pickup.</p>
        <p>Looking for something we don't have listed? We can order certain devices just for you!</p>
        <p>With unbeatable prices and service, choose us for your next Smart device!</p>
        <p>Call us today to see if we have the iPhone, iPad, Android, or computer you are searching for!</p>
      </div>

        <div style="margin-top: 160px" id="aboutUs">
        <h3>About Us</h3>
        <p>We are a locally owned and operated iPhone repair shop that started back in 2014. We have qualified technicians that are
          happy to assist you and repair your device</p>
      </div>

        <div style="margin-top: 160px" id="contact">
        <h3>Contact</h3>
        <p>Have a question? Need help? Get in touch with us by calling, stopping by</p>
        <p></p>
        <p></p>
        <div class="justify-content-evenly">
          <button style="margin-right: 8px; font-size: large" class="btn btn-outline-secondary"><a class="nav-link active" aria-current="page" href="tel:+15404215581">Call</a></button>
          <button style=" font-size: large" class="btn btn-outline-dark"><a class="nav-link active" aria-current="page" href="sms:+15404215581">Text</a></button>
        </div>
      </div>

        <div class="position-relative" style="margin-top: 160px" id="location">
      <h3>Location</h3>
      <div class=" mapouter" style="">
  <!--      position-absolute top-75 start-50-->
          <iframe width="100%" height="500px" id="gmap_canvas" src="https://maps.google.com/maps?q=924%20S%20High%20St,%20Harrisonburg,%20VA%2022801&t=&z=15&ie=UTF8&iwloc=&output=embed" frameborder="0" scrolling="no" marginheight="0" marginwidth="0"></iframe>
  <!--        <style>.mapouter{text-align:center;height:350px;width:350px;}</style>-->
      </div>
    </div>
      </div>
    </div>

  </div>
</body>


Filtering array of objects based on multiple strings inside another array

I’m trying to create product filter function for my store project.

Now it looks like this

    useEffect(() => {
        let newClothesData = [...clothesData]
        let newFilteredData
        const filterArray = () => {
            newFilteredData = newClothesData
                .filter(({ title }) => title.toLowerCase().includes(filterValue))
                .map(({ title, id, price, image, description }) => ({ title, id, price, image, description }))
            setFilteredData(newFilteredData)
        }
        filterArray()
    }, [clothesData, filterValue])

filterValue is an empty string which is being updated by pressing checkboxes, then it becomes array of strings, (f.e. [‘backpack’, ‘jacket’].
What I want to do is to filter newClothesData, which is an array of objects, and check if object’s key title matches any of these strings stored in filterValue’s array.

F.e. If user presses backpacks and jackets checkboxes, function will fill newFilteredData with objects that have backpack or jacket indluced in their title key value.

I don’t really know how to achieve this. At this moment filter works only for 1 or 0 string being stored in filterValue array

The best programming language and frameworsk for a image sharing website [closed]

We are two students who are going to make a image sharing website with image functionality like ROI(Region of interest).

The idea is about easy access to medical imgages. E.g a doctor need to send a mediacal image with a ROI to a other doctor.

We are both unsure what programming language and framework we shall use. We both are used with PHP with MySQL, but we acknowledge that a framework with Django is more suitable since it combines Python with HTML, CSS and Javascript. The upside is also libary’s Python have that might be to use for us.

We are curious about the community opinions and idea about this.

Thanks for your time.

Nicholai

Include custom map markers in places autocomplete or full text search within the markers

On my website, I have a google map which I populate with custom markers. The markers represent our partners. Each marker has its info window with a detail about the partner such as name, address or website. Above the map, I also have a search field using google autocomplete. It’s limited to cities only. If you search for a city and confirm the input, the map gets zoomed to the desired city.

Apart from cities, I would like website visitors to be able to search within the markers too. Ideally, I’d like to include all marker names in the autocomplete field, so that it would be searching not just for the cities, but also for our partner names. If a user search for a partner and confirms the input, the map would zoom directly on the partner’s marker.

I’m not sure if this is possible though. If not, providing another search field just for full-text searching within the markers would be an option too. With this solution, we’d have two search fields – one for cities and one for the markers.

Could anyone help me with either of the solutions? Thank you for any help!

Google Maps JavaScript API – WP Plugin

We understand that the WP Google Maps plugin does not directly share any information with Google, however, the plugin does make use of the Google Maps API and in doing so, for certain features such as Geolocation as an example, the Google Maps API requires a users IP information in order to make use of the Geolocation features.

Can someone let us know if the specific Google Maps JavaScript API make use of Visitor IP information for it’s feature?

If yes, is there any way that we can avoid usage of Visitors IP or implement any NAT solution from this info being exposed?