How can I get the sum of an array of objects value? [closed]

I have an array of objects that is grouped by year. And in year are some numbers. How can I count all numbers in that array ?

[
  {
    '2024': [
       6,  7, 15,  2,  3,  1,  2,  1,  3,  3,  4,  4,
       3,  3,  3,  3,  3,  4,  1,  3,  1,  3,  1,  5,
       5,  1,  3,  3,  3,  2,  3,  3,  1,  2,  4,  3,
       1, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
      10, 10, 10, 10, 10, 10, 10
    ]
  },
  { '2023': [ 9, 1, 8 ] }
]

DOMPDF not downloading pdf when used with ajax

***DOMPDF not downloading pdf when used with ajax ***

can anybody tell how to download pdf what showed i write in success i tried mutiple things but nothing works

1ST PAGE

`

$(document).ready(function () {
      $('#print_order').click(function () {
        var order_id = $('#order_id').val();
        $.ajax({
          type: "post",
          url: "print.php",
          data: {
            "order_id": order_id
          },
          success: function (res) {
            alert(res)
          }

        })
      })
    })

PRINT.PHP PAGE

<?php
// Include autoloader 
require_once 'vendor/autoload.php';

// Reference the Dompdf namespace 
use DompdfDompdf;

// Instantiate and use the dompdf class 
$dompdf = new Dompdf();
if (isset($_POST['order_id'])) {
    include "config.php";
    $order_id = $_POST['order_id'];
    $query = mysqli_query($db, "SELECT * FROM orders WHERE id = '$order_id'");
    $data = mysqli_fetch_assoc($query);
    $html = '<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="images/logo.png" rel="icon" />
    <title>Order Invoice K-Medicos</title>

    <link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
</head>

<body>
    <div class="max-w-7xl mx-auto">
        <header class="flex justify-between px-10 py-5">
            <div class="flex">
            <img src="images/logo.png" alt="logo" class="w-20">
            <h2 class="text-2xl font-bold" style="margin-top: 20px;">K-Medicos</h2>
            </div>
            <h1 class="text-4xl tracking-tight font-extrabold text-gray-900 sm:text-5xl md:text-6xl flex items-end">
                Invoice</h1>
        </header>

        <hr>

        <section class="flex justify-between px-10 py-5">
            <p class="text-xs">
                <strong>Date:</strong>
                <span class="current_date"></span>
            </p>

            <p class="text-xs">
                <strong>Invoice No:</strong>
                18635
            </p>
        </section>

        <hr>

        <section class="flex justify-between px-10 py-5">
            <p class="text-xs">
                <strong>Invoiced To:</strong><br>
                <span class="name">Her Majesty The Queen</span><br>
                <span class="place">Buckingham Palace</span><br>
                <span class="city">London</span><br>
                <span class="country">pak</span><br>
            </p>

            <p class="text-xs text-right">
                <strong>Pay Mode:</strong><br>
                <span class="pay_mode">cod</span>
            </p>
        </section>

        <section class="px-10 py-5">
            <div class="shadow overflow-hidden border-b border-gray-200 sm:rounded-lg">
                <table class="min-w-full divide-y divide-gray-200">
                    <thead class="bg-gray-50">
                        <tr>
                            <th scope="col"
                                class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
                                Product Name
                            </th>
                            <th scope="col"
                                class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
                                Quantity
                            </th>
                            <th scope="col"
                                class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider text-right">
                                Unit Price
                            </th>
                            <th scope="col"
                                class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider text-right">
                                Amount
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr class="bg-white">
                            <td class="px-4 py-4 whitespace-nowrap text-xs text-gray-900">
                                Custom Website Design
                            </td>
                            <td class="px-4 py-4 whitespace-nowrap text-xs text-gray-500">
                                Wireframes and mockups <br>
                                for a 3 page website.
                            </td>
                            <td class="px-4 py-4 whitespace-nowrap text-xs text-gray-500 text-right">
                                $50ph
                            </td>
                            <td class="px-4 py-4 whitespace-nowrap text-xs text-gray-500 text-right">
                                $1,200
                            </td>
                        </tr>
                        <tr class="bg-gray-50">
                            <td class="px-4 py-4 whitespace-nowrap text-xs text-gray-900 font-medium text-right"
                                colspan="3">
                                Sub-Total
                            </td>
                            <td class="px-4 py-4 whitespace-nowrap text-xs text-gray-500 text-right font-medium">
                                $2,140
                            </td>
                        </tr>
                        <tr class="bg-gray-50">
                            <td class="px-4 py-4 whitespace-nowrap text-xs text-gray-900 font-medium text-right"
                                colspan="3">
                                GST @ 18%
                            </td>
                            <td class="px-4 py-4 whitespace-nowrap text-xs text-gray-500 text-right font-medium">
                                $428
                            </td>
                        </tr>
                        <tr class="bg-gray-50">
                            <td class="px-4 py-4 whitespace-nowrap text-sm text-gray-900 font-medium text-right"
                                colspan="3">
                                Total
                            </td>
                            <td class="px-4 py-4 whitespace-nowrap text-sm text-gray-500 text-right font-medium">
                                $2,568
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </section>
    </div>
    <script>
        var c_date = document.querySelector(".current_date");
        var date = new Date();
        c_date.innerHTML = date;   
    </script>
</body>

</html>';

    // Load HTML content 
    $dompdf->loadHtml($html);


    // (Optional) Setup the paper size and orientation 
    $dompdf->setPaper('A4', 'landscape');
    // Render the HTML as PDF 
    $dompdf->render();

    // Output the generated PDF to Browser 
    $dompdf->stream();
}


?>
`

i tried to enter entire code in success but still didn’t work and i also tried to render and stream in succes but it still does notting at all and showes no error just refreshes rest is shown

Back-end choice [closed]

If it were you which are you choosing and why:

1- C# + SQL-SERVER+ .NET .

2- JavaScript + MongoDb + Node.js .

3- Php + MySql + Laravel .

I am new and i want some advice and help to know facts about this field to know what to choose

Environment variables undefined in react app

I am setting up environment variabes for the keys needed for sending an email through emailjs. I have tried putting the values in directly to make sure it works, and it works fine, but when I store the values in environment variables, for some reason I am getting undefined values. I have done this before this exact same way so I am not sure whats going on.

here are the environment variables:

REACT_APP_EMAIL_SERVICE_ID=myServiceId
REACT_APP_EMAIL_PUBLIC_KEY=myPublicKey
REACT_APP_EMAIL_TEMPLATE_ID=myTemplateId

and here is where I use it in my send email function:

import emailjs from "@emailjs/browser"

export default async function sendEmail(formData){
    const serviceId = process.env.REACT_APP_EMAIL_SERVICE_ID
    const templateId = process.env.REACT_APP_EMAIL_TEMPLATE_ID
    const publicKey = process.env.REACT_APP_EMAIL_PUBLIC_KEY


    const templateparams = {
        from_name: formData.firstname + " " + formData.lastname,
        email: formData.email,
        to_name: "my name",
        message: formData.message
    }
    console.log(publicKey)

    emailjs.send(serviceId, templateId, templateparams, publicKey)
    .then(res =>{
        console.log('Email sent successfully')
        alert('Email sent successfully')
        formData.firstname = ''
        formData.lastname = ''
        formData.email = ''
        formData.message = ''
    })
    .catch(err =>{
        console.log('Error sending email', err)
        alert('Error sending email')
        formData.firstname = ''
        formData.lastname = ''
        formData.email = ''
        formData.message = ''
    })
  return formData
}

Error: cannot find module ‘./discord.js’ on Heroku

First time deploying on Heroku and I’ve come across this hurdle that won’t let me successfully deploy my discord bot. I’ve been following a tutorial and the creator seemed to deploy his project on the platform no problem, however as with most things, it hasn’t been as straightforward the past hour.

A screenshot of error logs on Heroku
The jist being the Error: cannot find module './discord.js'

I tried the solution from this answer, but no luck.

Here is my package.json:

    "name": "booster-bot",
    "version": "1.0.0",
    "main": "index.js",
    "engines": {
        "node": "12.14.1",
        "npm": "6.13.4"
    },
    "repository": {
        "type": "git",
        "url": "git+link"
    },
    "scripts": {
        "test": "echo "Error: no test specified" && exit 1",
        "start": "node bot.js",
        "devStart": "nodemon bot.js"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "description": "",
    "dependencies": {
        "dotenv": "^16.4.5",
        "requirements-txt": "^0.0.5"
    },
    "devDependencies": {
        "nodemon": "^3.1.4"
    }
}

As well as the block of code it points back to:

const {
  Client,
  Events,
  GatewayIntentBits,
  EmbedBuilder,
} = require("./discord.js");

const client = new Client({
  partials: ["GUILD_MEMBER"],
  intents: [
    GatewayIntentBits.Guilds,
    GatewayIntentBits.GuildMessages,
    GatewayIntentBits.MessageContent,
    GatewayIntentBits.GuildMembers,
    GatewayIntentBits.GuildPresences,
  ],
});

To note is that I initially did not have the ./ in the ./discord.js, but as per this other answer and my desperation, I thought I’d try it (didn’t work). I also have the Procfile turned on and the requirements.txt installed, showing in this snippet on my package.json file:

    "name": "booster-bot",
    "version": "1.0.0",
    "lockfileVersion": 3,
    "requires": true,
    "packages": {
        "": {
            "name": "booster-bot",
            "version": "1.0.0",
            "license": "ISC",
            "dependencies": {
                "dotenv": "^16.4.5",
                "requirements-txt": "^0.0.5"
            },
            "devDependencies": {
                "nodemon": "^3.1.4"
            },
            "engines": {
                "node": "12.14.1",
                "npm": "6.13.4"
            }
        },

Thank you for any input / help!

HTML Element on Extension Not Being Recognized by Console Immediately

I am using https://github.com/IndieKKY/bilibili-subtitle on Bilibili and at first I can clearly see the content in the extension after it loads. However, when I use the javascript code to get the content, it says undefined until I explicitly inspect a text inside the extension and rerun the code. I am running on Brave Browser and Chrome.

The code is:

var spans = document.querySelectorAll('span[style="display: inline;"]');

var concatenatedText = Array.from(spans).map(function(span) {
    var textElement = span.querySelector('text.font-medium');
    return textElement ? textElement.textContent : null;
}).filter(Boolean).join(', ');

console.log(concatenatedText);

1

2

3

And the video is:

https://drive.google.com/file/d/1TT6IvVopNOyWGBibNGyGF-o0oEFbTl4l/view?usp=sharing

Any idea what is going on?

I am planning to visit consecutive urls in the playlist in a loop and run this code but since the extension code never gets recognized properly on the first try its not going to work out.

Any help would be appreciated! Perhaps it has to do with some dynamically added content? I’ve looked for similar topics as well like this: Dynamically added HTML not being recognized by jQuery

but my attempts to modify the code have not worked so far?

Is it possible to SSR from a node express server to a nextJS react client without using dangerouslySetInnerHTML?

I would like to SSR the homepage from a node express server to a react nextJS client without using dangerouslySetInnerHTML.

The server and client are in separate directories.
I have verified the server successfully serves this JSX to the browser b/c I can go to localhost:5000 where the server is running and see the rendered HTML.

// server.js file in node express repo
// Serve SSR React component
app.get("/", (req, res) => {
  const appHtml = ReactDOMServer.renderToString(<SSRApp />);

  res.send(`
    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>SSR App</title>
    </head>
    <body>
      <div id="root">${appHtml}</div>
    </body>
    </html>
  `);
});

const PORT = process.env.PORT || 5000;
app.listen(PORT, () => {
  console.log(`Server is running on http://localhost:${PORT}`);
});

However, when running the nextJS client on port 3000, I’m only able to render the JSX from the server if I use dangerouslySetInnerHTML:

// page.js file in next client repo
import React from "react";

export default async function HomePage() {
  // Fetch the SSR HTML from your Express server
  const res = await fetch("http://localhost:5000", {
    cache: "no-store",
  });
  const ssrHtml = await res.text();

  return (
    <div>
      <div dangerouslySetInnerHTML={{ __html: ssrHtml }} />
    </div>
  );
}

I’m aware you can sanitize the input to reduce risk of XSS attacks but I’d prefer to avoid dangerouselySetInnerHTML all together.

How can I SSR from a node express server to a nextJS react client and allow the client to hydrate the JSX from the server in a nextJS app without using dangerouslySetInnerHTML?

How to change the port number if it is already taken?

I’m trying to build my current project it in a way so my friends can create servers on one network so we can connect to each other (LAN communication, pretty much). The only problem is when I run my program in two terminal windows, my second run fails and throws errors at me because ports are already taken, which is logical.

I am working with Vite, express, and ws. This is one of my server’s code.

const { WebSocketServer } = require('ws')

const sockserver1 = new WebSocketServer({ port: 311 })
sockserver1.on('connection', ws => {
    sockserver1.clients.forEach(client => {
        client.send(`A new player connection has been established`);
    })

    ws.on('message', data => {
        sockserver1.clients.forEach(client => {
            client.send(`${data}`)
        })
    })

    ws.on('close', () => {
        sockserver1.clients.forEach(client => {
            client.send(`A player has disconnected`)
        })
    })

    ws.onerror = function () {
        console.log('websocket error')
    }
});

When I run this the second time, it will fail and say that port ::311 is taken. How can I add 1 to the port number till I find one that isn’t taken? I have notice Vite does this.

Got error “Function called outside component initialization” when testing Svelte component with Vitest

I want to test the following Svelte component with Vitest:

<script context="module">
    import {push} from 'svelte-spa-router'
    import {onDestroy} from 'svelte'

    let time = 1000*120;
    let interval = 1000;
    let running = true;
        
    export const twoDigits = (number) => {
        return number.toLocaleString('en-US', {
            minimumIntegerDigits: 2,
            useGrouping: false
        })
    }
    
    export const timeString = (ms) => {
        let seconds = ms / 1000;
        const minutes = Math.floor(seconds / 60);
        seconds = seconds % 60;
        const timeString = twoDigits(minutes) + ":" + twoDigits(seconds);
        return timeString
    }
    
    let timeShown = timeString(time)
    
    export const startCountdown = () => {
        setTimeout(()=>{
            time -= interval;
            timeShown = timeString(time);
            if (time > 0 && running) {
                startCountdown();
            } else if (time > 0 && !running) {
                console.log("Countdown stopped")
            } else {
                console.log("Done!")
                setTimeout( () => {
                    push('/gameover')
                },1000)
            }
        }, interval)
    }

    startCountdown()

    onDestroy(()=>{
        running = false;
    })

</script>

<div id="countdown">
    {timeShown}
</div>

Unfortunately, I get an error saying Function called outside component initialization as soon as I try to import the component in my test file with import Countdown from "../lib/Countdown.svelte".

The problem could have something to do with the onDestroy function but I don’t know, how to fix this.

the disappearing assignment after handlering the data in fetch response

After using the fetch request to get data, I assigned some values of the data to other variables. However, when I call these variables in subsequent code, they show undefined, while inside the fetch request body these variables have values. What could be the reason for this, and how can I resolve this issue?
Here is the specific code:

let machineTypeArr, machineModelArr, machineBrandArr, machineSupplierArr, machineArr;
function getMachineInfo() {
    fetch('/machineInfoConfig?handlerType=getMachineInfo')
        .then(response => response.json())
        .then(data => {
            // console.log(data);
            // console.log(data.machineType);
            // console.log(data.machineModel);
            // console.log(data.machineBrand);
            // console.log(data.machineSupplier);
            // console.log(data.machine);
            // machineTypeArr = JSON.parse(JSON.stringify(data.machineType));
            // machineModelArr = JSON.parse(JSON.stringify(data.machineModel));
            // machineBrandArr = JSON.parse(JSON.stringify(data.machineBrand));
            // machineSupplierArr = JSON.parse(JSON.stringify(data.machineSupplier));
            // machineArr = JSON.parse(JSON.stringify(data.machine));
            machineTypeArr = data.machineType;
            machineModelArr = data.machineModel;
            machineBrandArr = data.machineBrand;
            machineSupplierArr = data.machineSupplier;
            machineArr = data.machine;
            typeLen = machineTypeArr.length;
            brandLen = machineBrandArr.length;
            modelLen = machineModelArr.length;
            supplierLen = machineSupplierArr.length;
            machineLen = machineArr.length;
            // console.log(typeLen, modelLen, brandLen, supplierLen, machineLen);
            // console.log(machineArr);
            // console.log(machineTypeArr);
            // console.log(machineModelArr);
            // console.log(machineBrandArr);
            // console.log(machineSupplierArr);
            // loadTableInfo();
        })
}
window.onload = function() {
  getMachineInfo();
      console.log(typeLen, modelLen, brandLen, supplierLen, machineLen);
      console.log(machineArr);
      console.log(machineTypeArr);
      console.log(machineModelArr);
      console.log(machineBrandArr);
      console.log(machineSupplierArr);
}

I already checked with the search engine and gpt.
I don’t know what the exact problem is.

I want to know why this situation will happen.

TypeORM not saving entity on database – Sutck on Save/Insert – SQL Lite Expo – React Native

I’m new on React Native world, and I’m trying to store data on SQL Lite.

I have an expo React Native project, with SQL Lite and TypeORM configured (I followed the documentation).

The problem is that TypeORM is never saving data on the database.

Here is the entity that I’m trying to save:

import {
  Entity,
  Column,
  PrimaryColumn,
} from 'typeorm/browser';
import { User } from '../user/User';

@Entity('wallet')
export class Wallet {
  @PrimaryColumn()
  id: string;

  @Column()
  name: string;

  @Column()
  accountId: string;

  @Column()
  amount: number;


}

ID is generated by my backend service, so this is why is not a @PrimaryGeneratedColumn.

Here is the piece of code that I’m trying to use to save the data:

... some imports ....
import * as SQLite from 'expo-sqlite/legacy';
import { DataSource, Repository } from 'typeorm/browser';
import { Wallet } from '@/data/wallet/Wallet';
....

export default function HomeScreen() 
  const network = useNetwork();

  const dataSource = new DataSource({
    database: "test_db_local",
    driver: SQLite,
    entities: [
      Wallet,
      User,
      Financial
    ],
    synchronize: true,
    type: "expo",

  })

    let walletRepo: Repository<Wallet> = null;


  const call = useCallback(async () => {
    let wallet = new Wallet();
    wallet.accountId = "b8d89f94-516a-4ff0-9dac-257f25587b81";
    wallet.name = 'Default'

    let result: Response = await network.doPost("wallets", JSON.stringify(wallet));

    if (result.status !== 201) {
      throw new Error();
    }

    let body = await result.json();

    wallet.id = body.id;


    if (!dataSource.isInitialized) {
      var source = await dataSource.initialize();
      walletRepo = await source.getRepository(Wallet);
    }

    let all = await walletRepo.createQueryBuilder("wallet").getMany();
    console.log(all)

    console.log("SAVING")
    walletRepo.save(wallet).then(res => console.log(res)).catch(err => console.log(err));



  }, [])


  useEffect(() => {

    call().catch(err => console.log(err));

  }, [])


.... THE REST OF MY CODE ....

So, as you can see, I’m running a query to findAll before to see if there’s something on the DB.This query is executed and return an empty array.

Then I run the insert method. The problem is here. It never works. It get stuck on saving and never run the “then” or the “catch”.

I’ve tried changing it to “.insert” but there’s no difference.

The data is not being saved on the local SQL Lite.

About my environment: I’m executing the App in An Android Phone (Samsung S21) through Expo App.

Do you guys have any idea of what is going on?

How i run python function without loading a page in django

i am working on a project which has a function which generate response automatically on loop using google gemini api and show it to the html page by saving it to the database, i want this function to run behind the scene without loading the page

Currently what is happening is, if the function is generating 10 response in a loop then it is keep loading the page until all response get generated and then it is showing me home.html page.

this is the function

enter code here

def home(request):

print("Bot: Hello how can i help you?")


# main code starts here

i = 0
while i < 2:

    if len(history_global) == 0:
        user_input = input("You: ")

        chat_session = model.start_chat(
        history=history
        )

        response = chat_session.send_message(user_input)                        #1 Taking input from user
        
                                                                                #generating output result.......

        model_response = response.text
        
        

        history.append({"role" : "user", "parts" : [user_input]})              #3 updating history - (user part)
        history.append({"role" : "model", "parts" : [model_response]})         #4 updating history - (response part)
        history_global = model_response                                        #5 updating value of history_global with the response created

        
        
            
            # Save the data to the database
        saveit = Data1(question=user_input, answer=history_global)
        saveit.save()


      
      
        print(i)
        print("Question : ", user_input)
        print()
        print("Answer : ", model_response)
        print()
        print("...............................................................................................1")
        print()

      

        random_interval = random.randint(10, 15)
        time.sleep(random_interval)

     
    else:
        chat_session = model.start_chat(
        history=history
        )

        new_prompt = "[make any one question from the following content] - " + history_global

        response = chat_session.send_message(new_prompt)                      #1 Taking input from previous response
        
                                                                               #generating output result (basically question).......

        model_response = response.text                                        #2 Generated question
        history_global_question = model_response
                                         
        

        history.append({"role" : "user", "parts" : [new_prompt]})              #3 updating history - (user part)
        history.append({"role" : "model", "parts" : [model_response]})         #4 updating history - (response part)
        history_global = model_response                                        #5 updating value of history_global
       
        random_interval_01 = random.randint(10, 15)
        time.sleep(random_interval_01)

        response2 = chat_session.send_message(history_global_question)         #6 Taking question generated in #2 as a prompt
        model_response2 = response2.text                                       #7 Generated answer

        history.append({"role" : "user", "parts" : [user_input]})              #8 updating history - (user part)
        history.append({"role" : "model", "parts" : [model_response]})         #9 updating history - (response part)
        history_global = model_response2                                       #10 updating history_global with new response


        
        
            
            # Save the data to the database
        saveit = Data1(question=history_global_question, answer=model_response2)
        saveit.save()

        print(i)
        print("Question : ", history_global_question)
        print()
        print("Answer : ", model_response2)
        print()
        print("...............................................................................................2")
        print()

       


        random_interval = random.randint(10, 15)
        time.sleep(random_interval)
        
    i+=1

data1 = Data1.objects.all()


context = {"data_test" : data1}

return render(request, 'home.html', context)

here is index.html

enter code here
{% load static %}
<!-- main/templates/home.html -->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Welcome</title>
    <link rel="stylesheet" type="text/css" href="{% static 'home.css' %}">
</head>

<body>
    <h1>Welcome to our website</h1>

    {% for data1 in data_test %}
    <div>
        <h1 style="color: antiquewhite;">{{data1.question_html}}</h1>
        <br>
        <p style="color: aqua;">{{data1.answer_html}}</p>
        <a href="contentpage/{{data1.id}}">click here</a>
    </div>
    {% endfor %}
</body>

</html>

Image is not being rendered while on a react(typescript) project

I was working on a project to build a simple UI of chessboard using react for practice. I have encountered a problem where I am unable to render a given piece on a specific tile. Can anyone help me on where the potential issue may lie? I have made sure the image path is correct. It is located in the images folder inside the public folder.

PS: I am a beginner, I don’t know much.

//Typescript for react component

import './chessboard.css';
import Tile from "../Tiles/tile";


interface piece {
    image?: string;
    x: number;
    y: number;
}

const pieces: piece[] = [];
const horizontalAxis = ["a", "b", "c", "d", "e", "f", "g", "h"];
const verticalAxis = [1, 2, 3, 4, 5, 6, 7, 8];


pieces.push({ image: "/images/black_pawn.png", x: 0, y: 1 });

export default function Chessboard() {
    let board = [];

    for (let j = verticalAxis.length - 1; j >= 0; j--) {
        for (let i = 0; i < horizontalAxis.length; i++) {
            const number = i + j + 2;
            let image = undefined;

            pieces.forEach(p => {
                if (p.x === i && p.y === j) {
                    image = p.image;
                }
            });
            
            board.push(<Tile  image={image} number={number} />);
        }
    }

    

    return <div id="chessboard">{board}</div>;
}





//TypeScript for tile component

import './tile.css';


interface props{
    image?: string;
    number: number;
}

export default function Tile({image, number}: props){
    if(number%2===0){
        return (<div className="tile black-tile"></div>)
    }else{
        return (<div className="tile white-tile"></div>)
    }
}

chrome files download directory change in Chrome preferences

Dim chrome As New clsBrowser
Dim addArguments As String

addArguments = “–download.default_directory=””C:Users****Desktop”””
chrome.start cleanActiveSession:=True, userProfile:=”User T”, addArguments:=addArguments
chrome.navigate “chrome://settings/downloads”

I need your help to change the chrome browser “download directory”.

text
text

excel vba file available in this link
selenium basic unusable
It provides remote control to Chrome and Edge browsers.

have to work with excel etca with a javascript decoder
They did it for the convenience of others.

It’s a good thing they did it.

Users forgetting to change the Chrome download folder causes malfunctions in the programs I create.
I want to change the download folder with code to prevent this.

SSRS and Imbedded Java Script

I have a SSRS report Embed on a Brower’s Page. On this report i have an image. When I got Image properties on this image I select
“Actions” , “Go to URL” and have the following
JavaScript =”javascript:void(window.open(‘https://p21.castertech.com/Prophet21/index.html#/window/m_customermasterinquiry?customer_id=” & parameters!CustID.value & “‘,’_blank’))”

When I go the command line of the Brower and fill in custid with a value such as =javascript:void(window.open(‘https://p21.castertech.com/Prophet21/index.html#/window/m_customermasterinquiry?customer_id=50′,’_blank’))” for testing it works.

When I click on the image on the Report with the same date nothing happens. Not sure what I am doing wrong. Brower is chrome, Java is on, SSRS Current Version 15

One other note I have scripts on textbox properties again go to statements

=”javascript:void(window.open(‘https://p21.castertech.com/Prophet21/index.html#/window/m_orderentry?order_no=” & Fields!order_number.Value & “‘,’_blank’))”

that are not working also.

Any help would be very much appreciated