Can’t execute ./gradlew clean

I’m currently working on my react native project and wanted to build apk to send my friend. I did everything according to this instruction https://reactnative.dev/docs/signed-apk-android and some video on youtube.

Everything worked fine till the moment when I tried to execute ./gradlew clean and then another command starting with ./gradlew. It just starts downloading it from https://services.gradle.org/distributions/gradle-8.3-all.zip and then fails.

I tried downloading it manually and everything seemed good, gradle -v command works fine from any console, but ./gradlew command still do the same.

I would be really grateful if someone could help me

chrome.downloads.download on MS Edge: windows update this week added a bug. Work-around?

I’m working on an extension for MS Edge (Version 122.0.2365.80) running on Win10 pro. The extension has been working properly, but not any more.
I’m using chrome.downloads.download in javascript and what it used to do is invoke the SaveAs dialog box pointing to the last saved-to folder. Now it points to the browser’s default directory.
Is anyone else seeing this?
Is there an option in chrome.downloads.download to point the SaveAs in the right direction?
Here’s the code for the background.js:

chrome.runtime.onInstalled.addListener(function() {
  console.log('Extension installed / updated');
});

chrome.runtime.onMessage.addListener(function (request, sender) {
  if (request.type === 'popupMessage') {
    // Access parameters from the content script
  var receivedParams = request.data;

  // Do something with the parameters
    console.log(receivedParams);
chrome.downloads.download({
       url: receivedParams,
       filename: 'desired_filename.ext',
       saveAs: true
    }, function(downloadId) {
       console.log('Download initiated with ID:', downloadId);
    });
   }
 });

Thanks in advance for any pointers you can provide.

When I call the background.js, I expect it to bring up the SaveAs dialog box pointing at the last-saved-to-directory.
Instead, the code (unchanged) now brings up the SaveAs dialog box pointing to the browser’s default directory.

browser still in loading state after adding a lib for my components nx monorepo

Current Behavior

browser still in loading state after adding a lib for my components im using nx monorepo with react and vite

Expected Behavior

the app to be loaded and shown the ui in browser

Steps to Reproduce

  • create nx monorepo
  • add workspace for react
  • add react and typescript in also vite in package.json
  • import your ui in apps/yourApp
  • nx serve yourApp
  • success compilation
  • open the url
  • the app will still in loading state

Nx Report

Node   : 21.5.0
OS     : linux-x64
pnpm   : 8.15.3

nx (global)        : 18.0.0
nx                 : 18.0.6
@nx/js             : 18.0.6
@nx/linter         : 18.0.6
@nx/eslint         : 18.0.6
@nx/workspace      : 18.0.6
@nx/devkit         : 18.0.6
@nx/eslint-plugin  : 18.0.6
@nx/react          : 18.0.6
@nrwl/tao          : 18.0.6
@nx/vite           : 18.0.6
@nx/web            : 18.0.6
typescript         : 5.3.3

Failure Logs

when i try to build:


The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
vite v5.1.4 building for production...

/src/styles.scss doesn't exist at build time, it will remain unchanged to be resolved at runtime
x Build failed in 9.31s
error during build:
Error: Unexpected early exit. This happens when Promises returned by plugins cannot resolve. Unfinished hook action(s) on exit:
(vite:esbuild) transform "/home/oem/ppppppp/paletta monorepo/react-monorepo/Libs/Assets/src/lib/icons/StatistiqueIcon.tsx"
(vite:esbuild) transform "/home/oem/ppppppp/paletta monorepo/react-monorepo/Libs/Assets/src/lib/icons/ExpandRightIcon.tsx"
(vite:esbuild) transform "/home/oem/ppppppp/paletta monorepo/react-monorepo/Libs/Assets/src/lib/icons/HomeIcon.tsx"
(vite:esbuild) transform "/home/oem/ppppppp/paletta monorepo/react-monorepo/Libs/Assets/src/lib/icons/ParcCheckIcon.tsx"
    at process.handleBeforeExit (file:///home/oem/ppppppp/paletta%20monorepo/react-monorepo/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:19915:28)
    at Object.onceWrapper (node:events:634:26)
    at process.emit (node:events:519:28)
Warning: command "vite build" exited with non-zero status code

when i try to serve: (it seems working)

 nx run admin:serve

The CJS build of Vite's Node API is deprecated. See https://vitejs.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.

  VITE v5.1.4  ready in 402 ms

  ➜  Local:   http://localhost:4200/
  ➜  press h + enter to show help

[TypeScript] Found 0 errors. Watching for file changes.
h

  Shortcuts
  press r + enter to restart the server
  press u + enter to show server url
  press o + enter to open in browser
  press c + enter to clear console
  press q + enter to quit

Package Manager Version

pnpm 8.15.3

Operating System

Linux

Additional Information
enter image description here

Open Angular page with parameters

There is an old jsp +javascript application, I need to redirect to the page of a new application written in Angular and send data
Is it possible to transfer, for example, a token to the angular?

I tried to make a redirect to – http://localhost:4200/token/hrl4lhlhga – hrl4lhlhga <== token

const routes: Routes = [
  {
    path: 'token/:value',
    component: TestComponent,
  }
];
export class TestComponent {
  @Input() value?: string;
}
bootstrapApplication(AppComponent, {
  providers: [
    provideRouter(appRoutes, withComponentInputBinding()),

But ‘value’ always undefined

How to properly connect to Guacamole through guacamole-common-js

I have a Google Cloud Virtual Machine instance which has Guacamole installed on it via Docker. I can access via my browser correctly via http://[virtualmachineip]:8080/guacamole/#/ and control it.

I’m building a Svelte app that would let me control the virtual machine through this Client, however I keep receiving the error: ERROR o.a.g.w.GuacamoleWebSocketTunnelEndpoint - Creation of WebSocket tunnel to guacd failed: Parameter "GUAC_ID" is required. on my guacamole docker logs.

Here is how my javascript code is looking:

  function initializeGuacamoleClient() {

    var tunnel = new Guacamole.WebSocketTunnel(
      "ws://[virtualmachineaddress]:8080/guacamole/websocket-tunnel"
    );

    guacClient = new Guacamole.Client(tunnel);

 
    if (displayContainer) {
      displayContainer.appendChild(guacClient.getDisplay().getElement());
      displayContainer.style.display = "block";
      guacClient.connect("username=guacadmin&password=guacadmin");
    }
  }

I would appreciate any inputs because I have not found any rellevant information on the documentation.

Here is my docker-compose.yml just in case it may have something to do.

version: '3'

services:
  guacd:
    image: guacamole/guacd
    container_name: guacd
    restart: always
    ports:
      - "4822:4822"

  mysql:
    image: mysql:5.7
    container_name: guac_mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: (my password)
      MYSQL_DATABASE: guacamole_db
      MYSQL_USER: guacamole_user
      MYSQL_PASSWORD: (my password)
    volumes:
      - guacamole_db:/var/lib/mysql

  guacamole:
    image: guacamole/guacamole
    container_name: guacamole
    restart: always
    depends_on:
      - guacd
      - mysql
    environment:
      GUACD_HOSTNAME: guacd
      MYSQL_HOSTNAME: mysql
      MYSQL_DATABASE: guacamole_db
      MYSQL_USER: guacamole_user
      MYSQL_PASSWORD: (my password)
      GUACAMOLE_CORS_ENABLED: 'true'
      GUACAMOLE_CORS_ALLOWED_ORIGINS: '*'
      GUACAMOLE_CORS_ALLOWED_METHODS: 'GET, POST, PUT, DELETE, OPTIONS'
    ports:
      - "8080:8080"
    links:
      - guacd
      - mysql

volumes:
  guacamole_db:

I’m using this library https://www.npmjs.com/package/guacamole-common-js
Thank you so much.

useNavigate not redirecting to a new page

So after entering data to a form, it should redirect to the /VisitorConfirmationPage with the data of the user stored in the object “formData”,but instead it refreshes the form page( the data has been sent to the server and database). The alert(‘added’) doesn’t always show up. Why is this happening?

    const navigate = useNavigate();

const addData=async()=>{

        var name = document.getElementById("inputName").value;
        var email = document.getElementById("inputEmail").value;
        var phoneNo = document.getElementById("inputPhoneNumber").value;
        var employee = document.getElementById("employee").value;
        // var image = p_image;
        const imageSrc = webcamRef.current.getScreenshot();
        setImageSrc(imageSrc);
        
        const response = await fetch(imageSrc);
        const blob = await response.blob();

        let formData = new FormData();
        formData.append("name", name)
        formData.append("email", email)
        formData.append("phoneNo", phoneNo)
        formData.append("employee", employee)

       
        formData.append("p_image",blob, "captured-image.jpg");

        

        axios.post("http://localhost:4000/api/registerVisitor",formData,{headers:{"Content-Type":"multipart/form-data"}}).then(response =>{
            alert('added');
            navigate('/VisitorConfirmationPage',{state:formData})
        }).catch(error => {
            console.error(error);
            alert("error!")
        });        
    }

I tried to move the navigate function outside the axios function. That didn’t work. I also tried this code inside the response of the axios response case and it didn’t work.

               <Link to={{
                pathname: "/VisitorConfirmationPage",
                state:formData
            }} />
            window.location = "/VisitorConfirmationPage";;

I found a strange behavior in JS. How to stop this behavior [duplicate]

let’s start with two files index.html and script.js

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button>click me</button>
    <div></div>
    <script src="script.js"></script>
</body>
</html>
const buttonUser = document.querySelector("button");
const divUser = document.querySelector("div");

buttonUser.addEventListener("click", () => {
    divUser.innerHTML = `
        <h1> welcome to the page </h1> 
        <button onclick="welcomeMassage()"> click me 2 <button>
    `
})

function welcomeMassage() {
    console.log("Hello World!");
}

if i clicked in the first button the addEventListener work and adding h1 and second button two divUser adn if i click on the second one it’s also work and console.log(“Hello world”) but :::::::

if change the javascript file two script.mjs and index.js

    <script type="module" src="script.mjs"></script>

When I click on the first button, the addEventListener works, but when I click on the second button, it does not work and shows up in the console. The welcomeMassage function is not defined, and I can’t access it from the console. So why has this happened, and how can I prevent this behavior?

i want when use scritp.mjs file and i click in the button not show in console functionNamve not defined and perform the function

How Can I Edit the Body of an API Request With a Firefox Addon

I’m trying to write a firefox addon that modifies the body of a background http request to an api. I found webRequest.filterResponseData(), but it did not work for my use case:

If I go directly to the api url, the response body gets changed by the filter.

If I go to the website that makes the request in the background as it loads, the filter doesn’t change the response body. I debugged the addon and saw that the response was being sent to the loading page and only after that filter.ondata was called, so the filter had no effect.

Does anyone know how can I make sure the filter is applied before the api response is passed to the page being loaded?

How to run a Python model in React Native using TensorFlow.js?

I’m trying to run a Python model in my React Native project using TensorFlow.js. The model I have is a ResNet50 model trained in Python. How can I integrate this model into my React Native project and use it for image prediction?

import streamlit as st
import os
from PIL import Image
import numpy as np
import pickle
import tensorflow
from tensorflow.keras.layers import GlobalMaxPooling2D
from tensorflow.keras.applications.resnet50 import ResNet50,preprocess_input
from sklearn.neighbors import NearestNeighbors
from numpy.linalg import norm
import cv2

feature_list = np.array(pickle.load(open('featurevector.pkl','rb')))
filenames = pickle.load(open('filenames.pkl','rb'))

model = ResNet50(weights='imagenet',include_top=False,input_shape=(224,224,3))
model.trainable = False

model = tensorflow.keras.Sequential([
    model,
    GlobalMaxPooling2D()
])

st.title('Man & Women Fashion Recommender System')

def save_uploaded_file(uploaded_file):
    try:
        with open(os.path.join('uploads',uploaded_file.name),'wb') as f:
            f.write(uploaded_file.getbuffer())
        return 1
    except:
        return 0

def extract_feature(img_path, model):
    img=cv2.imread(img_path)
    img=cv2.resize(img, (224,224))
    img=np.array(img)
    expand_img=np.expand_dims(img, axis=0)
    pre_img=preprocess_input(expand_img)
    result=model.predict(pre_img).flatten()
    normalized=result/norm(result)
    return normalized

def recommend(features,feature_list):
    neighbors = NearestNeighbors(n_neighbors=6, algorithm='brute', metric='euclidean')
    neighbors.fit(feature_list)

    distances, indices = neighbors.kneighbors([features])

    return indices

# steps
# file upload -> save
uploaded_file = st.file_uploader("Choose an image")
print(uploaded_file)
if uploaded_file is not None:
    if save_uploaded_file(uploaded_file):
        # display the file
        display_image = Image.open(uploaded_file)
        resized_img = display_image.resize((200, 200))
        st.image(resized_img)
        # feature extract
        features = extract_feature(os.path.join("uploads",uploaded_file.name),model)
        #st.text(features)
        # recommendention
        indices = recommend(features,feature_list)
        # show
        col1,col2,col3,col4,col5 = st.columns(5)

        with col1:
            st.image(filenames[indices[0][1]])
        with col2:
            st.image(filenames[indices[0][2]])
        with col3:
            st.image(filenames[indices[0][3]])
        with col4:
            st.image(filenames[indices[0][4]])
        with col5:
            st.image(filenames[indices[0][5]])
    else:
        st.header("Some error occured in file upload")

code looks like this.

Goal of the application is to provide 5 similar images based on the input image. I also want to use this for a clothing application but I’m not experienced in the field of artificial intelligence. Is anyone know how to convert the code?

Multiple review from on single woocomerce product

I’m building a custom single-product template for woocommerce and as a result of the way certain divs are shown on desktop and certain divs are shown on mobile I am calling the review from with twice, however this breaks the “Star” input, on the first form, it shows the “Star” input twice and on the second form it changes the form to show the “Star” input as a dropdown with “good, excellent etc..”.

Both forms do submit and work fine apart from that.

I know this must be related to the js that changes the dropdown into stars but I don’t know how or where to change it to work for both forms

ScrollTrigger.js: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘pin’) GreenSock, GSAP

I inherited a project with no documentation and keep getting the error ScrollTrigger.js: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'pin') in the web console when going away from a page and then back to it. How do I define pin as true or false or something in the various JavaScript components? This is built in Pug JS. Also getting this error Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'curTrigger.pin')

Some components have this:

this.magicPin();

magicPin() {
        ScrollTrigger.matchMedia({
            '(min-width:768px)': () => {
                ScrollTrigger.create({
                    trigger: this.items,
                    start: 'center center',
                    end: () => (80 * this.item.length * 2) + '%',
                    pin: true,
                });
            }
        });
    }

And some do not have magicPin or ScrollTrigger defined:

import {Component} from 'bona';
import gsap from 'gsap';
import ScrollTrigger from 'gsap/ScrollTrigger';
import {magicSlideElementAppear} from '../lib/transitions';

export default class Billboard extends Component {
    constructor() {
        super(...arguments);

        this.header = this.el.querySelector('.billboard-header');
        this.text = this.el.querySelector('.billboard-text');
        this.action = this.el.querySelector('.billboard-action');
    }

    async onInit() {
        await document.fonts.ready;

        this.magicShow();
    }

    magicShow() {
        if (this.header) magicSlideElementAppear(this.header);
        if (this.text) magicSlideElementAppear(this.text);
        if (this.action) magicSlideElementAppear(this.action);
    }
}

I am just wondering how to define it in the components that don’t have or need it.

Web scraping issue from Text Node from a website with dynamic content

I am working on a project to scrape data from the following website:

https://search.hotellook.com/hotels?=1&adults=2&checkIn=2024-03-19&checkOut=2024-03-26&children=&currency=gbp&destination=Lisbon&language=en_us&marker=google.Zz93ac967d879848dba99b874-126017#f

I am using Node JS & have used Puppeteer. I have managed to scrape everything except price of a hotel from the website. I am attaching the screenshot to point out what price I am interested in to scrape.

I have tried the following variations but they all return null or empty values. I am not sure what is going on:

const price = element.querySelector('.main_gate-price .currency_font currency_font--gbp').textContent;
const price = element.querySelector('.currency_font currency_font--gbp').textContent;
const price = element.querySelector('.card-main_gate .main_gate-price_info .currency_font.currency_font--gbp').innerText;

I have used the above variations with “textContent”, “innerHTML”, “innerText” but nothing when it clearly seems that the price is stored as a text node in the span element with class “currency_font currency_font–gbp”.

Can someone please assist & point me in right direction? The image I was referring to for reference:

Price Scrape Reference