how i can fit the html title tag for lengthy content

I’m having trouble with the HTML title tag for lengthy content since it keeps cutting the content off the screen. is there a way to fit text on the screen or is there another option that functions similarly to a tooltip?

<h1 title="
test 1
           
test 2
           
test 3
           
test 4
           
test 5
           
test 6
           
test 7
           
test 8
           
test 9
           
test 10
           
test 11
           
test 12
           
test 13
           
test 14
           
test 15

test 1
           
test 2
           
test 3
           
test 4
           
test 5
           
test 6
           
test 7
           
test 8
           
test 9
           
test 10
           
test 11
           
test 12
           
test 13
           
test 14
           
test 15
           
test 1
           
test 2
           
test 3
           
test 4
           
test 5
           
test 6
           
test 7
           
test 8
           
test 9
           
test 10
           
test 11
           
test 12
           
test 13
           
test 14
           
test 15
">Tooltip</h1>

How do i loop through divs using jsoup in groovy script

My requirement is to scrap all the review data like reviewer name, date and comment in array. That i am doing in mulesoft in groovy script by importing Jsoup.

Using below query i am able to fetch the review data but it’s coming in a single string. Not sure how to separate the div tag here.
Please inspect the mentioned url and please suggest how i can run a loop on <div class=”Jwxk6d” and make the expected output.

code:

    import org.jsoup.Jsoup
    def url= "https://play.google.com/store/apps/details?id=at.bitfire.davdroid&hl=en_IN"
    def doc= Jsoup.connect(url).get()
    def appReviewData= doc.select("div[class='EGFGHd']").text()
    return [ReviewData: appReviewData]
    
    

expected output:

    {
        "ReviewData": [{
            "name": "Ben Perkins",
            "reviewDate": "7 June 2024",
            "reviewComment": "xyz"
        }]
    }

Getting issue while passing _id to find an existing item

Creating a job portal website using react and mongodb. A user logins and save the job. So a model is created to save the jobs and created Controller. Before saving a job checks if it is exist or not by passing the _id which fetched from the req.params and the userId which from the req.payload . But it doesn’t checks the existingJob and creating it as a new object.

exports.savedJobsController = async (req,res) =>{

console.log("Inside Saved Jobs Controller");



const {title,salary,email,company,location,description,category,jobType,experience,vacancy,deadline} = req.body



const {id} = req.params



const userId = req.payload



console.log(user id is : ${userId} and id is ${id});



try {



    const existingJob = await savedjobs.findOne({_id:id,userId})



    console.log(exist ${existingJob});



    if(existingJob){



        res.status(406).json("Job Already Saved to Your Collection!")



    }else{



        const newJob = new savedjobs({



            title,salary,email,company,location,description,category,jobType,experience,vacancy,deadline,userId



        })



        await newJob.save()



        res.status(200).json(newJob)



        console.log(Saved job is 



            ${newJob}



            );



    }



    



} catch (error) {



    res.status(401).json(error)



    console.log(error);



}

}

Discord js gives me “DiscordAPIError: Cannot send an empty message” when I put “async, await” in the script

When a user sends a fur file with “$fur2mp3”,
the bot has to download it to the local repository,
convert it through an external batch script,
and send the converted file to a channel.

but an asynchronous problem causes the bot to run the script in the middle of downloading the sent file so display it as an empty file…

So I tried to solve the problem using await and async, but every time I do, I get this error

C:UsersUserDocumentsDiscord-CommandLine-1.0.1node_modulesdiscord.jssrcrestRequestHandler.js:154
      throw new DiscordAPIError(request.path, data, request.method, res.status);
            ^

DiscordAPIError: Cannot send an empty message
    at RequestHandler.execute (C:UsersUserDocumentsDiscord-CommandLine-1.0.1node_modulesdiscord.jssrcrestRequestHandler.js:154:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async RequestHandler.push (C:UsersUserDocumentsDiscord-CommandLine-1.0.1node_modulesdiscord.jssrcrestRequestHandler.js:39:14) {
  method: 'post',
  path: '/channels/(hidden channel ID)/messages',
  code: 50006,
  httpStatus: 400
}

Node.js v20.16.0

The script is

commands.add('fur2mp3', async () => {
      const filePath = 'buffer_furrendering.txt';
    
    if (fs.existsSync(filePath)) {
        msg.channel.send('Another file is being processed! Please wait!');
        return;
    }
        if(msg.attachments.first()){//checks if an attachment is sent
            //if(msg.attachments.first().filename === `fur`){
                msg.channel.send('Uploading...');
                await download(msg.attachments.first().url);
                msg.channel.send('Uploaded!');
                //msg.channel.send('d');
                msg.channel.send('Current Furnace Tracker Version : 0.6.5nConverting started!');
                msg.channel.startTyping();
                exec('fur2wav.bat buffer_furinput.fur', (error, stdout, stderr) => {
                    if (error) {
                        msg.channel.send(`Error during conversion: ${stderr}`);
                        console.error(`Conversion error: ${stderr}`);
                        return;
                    }
                    fs.readFile('buffer_fur2wavmsg.txt', 'utf8', (err, gwav) => {
                    if (err) {
                        msg.channel.send('Error reading conversion message.');
                        console.error(err);
                        return;
                    }
                    console.log('gwav content:', gwav);  // Log content
                    if (gwav.trim()) {  // Ensure gwav is not empty
                        
                    } else {
                        msg.channel.send('The conversion did not produce any output.');
                    }
                    msg.channel.send({ files: ["furoutput.mp3"] });
                }); 
                });
                
    
            
        } //msg.channel. // 파이 이름 ㅍbuffer_furinput.fur'
               else { msg.channel.send('Send your file with this command!');
               return; }
});

I need to remove await and async from here to proceed without error (though of course nothing is converted)

is there a mistake?

creating a boolean evaluator in javascript

i have some text like

text = "this is some text that have a bunch of words in it."

I have a boolean expression that will run against that text, for example:

boolPhrase = "(text OR keyword) AND (words OR keyword2)"

in this scenario, it would evaluate to be (true OR false) AND (true OR false) –> which evaluates to be true

so if I had the function that handles this logic

result = booleanEvaluator(text, boolPhrase)

I was able to do this using .eval() but I didn’t realize chrome blocks eval most of the time.

is there a javascript library that handles this kind of thing? or do I need to write this from scratch?

building a boolean interpreter in javascript

i need to ask a question in stack overflow

i have some text like

text = "this is a blob of text that have a bunch of words in it."

then I have a boolean expression that will run against that text, for example:

boolPhrase = "(blob OR keyword) AND (words OR keyword2)"

in this scenario, it would evaluate to be (true OR false) AND (true OR false) –> which evaluates to be true

so if I had the function that handles this logic

result = booleanEvaluator(text, boolPhrase)

I was able to do this using .eval() but I didn’t realize chrome blocks eval most of the time.

is there a javascript library that handles this kind of thing? or do I need to write this from scratch?

How to get the httprequest result from Xslist search url in Tampermonkey?

I want to get the Xslist result, but it seems to be forbidden to request, and it shows this in the console.

I use this in Tampermonkey by the GM_xmlhttpRequest

    GM_xmlhttpRequest({
         method: 'GET',
         url: 'https://xslist.org/search?query=%E7%AF%A0%E5%AE%AE%E8%8A%B1%E9%9F%B3&lg=zh',
         onload: function (result) {
             // xhrResult = result.status;
             let domNewx = new DOMParser().parseFromString(result.responseText, 'text/html');
             console.log(domNewx)
         }
     });

If I use HttpRequest, it will show Cross-domain

                         const Http = new XMLHttpRequest();
                         const url= 'https://xslist.org/search?query=%E7%AF%A0%E5%AE%AE%E8%8A%B1%E9%9F%B3&lg=zh';
                         Http.open("GET", url);
                         Http.send();
                         Http.onload = function(e) {
                            let domNewx = new DOMParser().parseFromString(Http.responseText, 'text/html');
                            console.log(domNewx)
                         }

The first result.
enter image description here

Xslist will show a real person verify page.

enter image description here

Updating the src attribute of the img tag in HTML results in overlapping with old images

I continuously send binary streams of images from the backend server to the frontend HTML page. After receiving the binary stream, the frontend HTML page uses the URL.nestObjectionURL function to convert it and directly applies it to the src attribute of the img tag, just like this

socket.onmessage = function (event) {
    document.getElementById('img').src = URL.createObjectURL(event.data)
}

I continuously display new images transmitted from the backend by updating the src attribute of the img tag
But new images will always be displayed overlaid with old images
enter image description here
This phenomenon is very strange. As long as my perspective remains in the current window, it will cause this. Once my perspective leaves the current page, it will return to normal. It seems that this situation occurs when I just look at this image. This is what happens when my perspective leaves the current page
enter image description here

Oh my god, I’m really going to crash. I’m a beginner in HTML and I can’t find any explanation for this phenomenon online. Can you please help me

I need help on why my three.js code isn’t working

I want to learn three.js and tried following the getting started code on the three.js documentation, but the scene isn’t rendering, and I am completely stumped.

index.html:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <h1>My first three.js app</h1>
        <style>
            body { 
                margin: 0; 
            }
        </style>
        <script type="importmap">
            {
              "imports": {
                "three": "https://cdn.jsdelivr.net/npm/three@<v0.167.1>/build/three.module.js",
                "three/addons/": "https://cdn.jsdelivr.net/npm/three@<v0.167.1>/examples/jsm/"
              }
            }
          </script>
    </head>
    <body>
        <script  type="module" src="/main.js"></script>
    </body>
</html>

main.js:

import * as THREE from 'three';

const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );

const renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );

const geometry = new THREE.BoxGeometry( 1, 1, 1 );
const material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
const cube = new THREE.Mesh( geometry, material );
scene.add( cube );

camera.position.z = 5;

function animate() {
    cube.rotation.x += 0.01;
    cube.rotation.y += 0.01;
    renderer.render( scene, camera );
}
renderer.setAnimationLoop( animate );

I have no idea what is wrong, but the only thing showing up is the header. Please help!

Problems uploading images in a form and saving this array of images in MongoDB

i have a create productForm component in react and when i upload images, it didn´t save the image and the data on the DB, only error message,

Server.js

// Instanciando dependências
const express = require('express');
const mongoose = require('mongoose');
const bodyParser = require('body-parser');
const cors = require('cors');
const productRoutes = require('./routes/productRoutes'); 
const adminRoutes = require('./routes/AdminRoutes');

// Iniciando servidor express
const app = express();
const PORT = process.env.PORT || 3000;

// Configurando middlewares
app.use(bodyParser.json());
app.use(cors());

// Servir arquivos estáticos (imagens)
app.use('/uploads', express.static('uploads'));

// Usar as rotas
app.use('/api', productRoutes);
app.use('/api', adminRoutes);

// Conexão com MongoDB
mongoose.connect('mongodb://localhost:27017/impermaq', {
    useNewUrlParser: true,
    useUnifiedTopology: true,
});

// Verificação na conexão do MongoDB
const db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', () => {
    console.log('Connected to MongoDB');
});

// Inicializar servidor
app.listen(PORT, () => {
    console.log(`Server is running on port ${PORT}`);
});

ProductRoutes.js

const express = require('express');
const multer = require('multer');
const router = express.Router();
const Product = require('../models/Product');

// Configuração do multer para armazenamento de arquivos
const storage = multer.diskStorage({
    destination: function (req, file, cb) {
        // Caminho para o diretório uploads
        cb(null, path.join(__dirname, '/uploads'));
    },
    filename: function (req, file, cb) {
        cb(null, Date.now() + '-' + file.originalname);
    }
});

const upload = multer({ storage: storage });

// CREATE - Criar um novo produto
router.post('/products', upload.array('images', 5), async (req, res) => {
    try {
        const productData = req.body;
        if (req.files) {
            productData.images = req.files.map(file => `/uploads/${file.filename}`); // Salvar caminhos das imagens
        }
        const product = new Product(productData);
        await product.save();
        res.status(201).send(product);
    } catch (error) {
        console.error(error); // Log de erro para debug
        res.status(500).send({ error: 'Failed to create product', details: error.message });
    }
});


// READ - Obter todos os produtos
router.get('/products', async (req, res) => {
    try {
        const products = await Product.find({});
        res.status(200).send(products);
    } catch (error) {
        res.status(500).send(error);
    }
});

// READ - Obter um produto pelo ID
router.get('/products/:id', async (req, res) => {
    try {
        const product = await Product.findById(req.params.id);
        if (!product) {
            return res.status(404).send();
        }
        res.status(200).send(product);
    } catch (error) {
        res.status(500).send(error);
    }
});

// UPDATE - Atualizar um produto pelo ID
router.put('/products/:id', upload.single('image'), async (req, res) => {
    try {
        const productData = req.body;
        if (req.file) {
            productData.image_main = req.file.path; // Atualize o caminho da imagem principal
        }
        const updatedProduct = await Product.findByIdAndUpdate(req.params.id, productData, { new: true });
        if (!updatedProduct) {
            return res.status(404).send({ message: 'Product not found' });
        }
        res.status(200).send(updatedProduct);
    } catch (error) {
        res.status(500).send({ message: 'Failed to update product', error });
    }
});

// DELETE - Deletar um produto pelo ID
router.delete('/products/:id', async (req, res) => {
    try {
        const product = await Product.findByIdAndDelete(req.params.id);

        if (!product) {
            return res.status(404).send();
        }

        res.status(200).send(product);
    } catch (error) {
        res.status(500).send(error);
    }
});

module.exports = router;

ProductForm.jsx

import { Form, Input, Radio, Upload, Button, message } from 'antd';
import { PlusOutlined } from '@ant-design/icons';

const { TextArea } = Input;

const CreateProductForm = () => {
  const [form] = Form.useForm();

  const normFile = (e) => {
    if (Array.isArray(e)) {
      return e;
    }
    return e?.fileList;
  };

  const handleSubmit = async (values) => {
    try {
      const formData = new FormData();
      formData.append('name', values.nome);
      formData.append('description', values.descricao);
      formData.append('specifications', values.detalhes);
      formData.append('accessories', values.acessorios);
      formData.append('condition', values.condicao);

      if (values.imagens) {
        values.imagens.forEach((file) => {
          formData.append('images', file.originFileObj);
        });
      }

      const response = await fetch('http://localhost:3000/api/products', {
        method: 'POST',
        body: formData,
      });

      if (!response.ok) {
        const errorData = await response.json();
        throw new Error(errorData.details || 'Failed to create product');
      }

      message.success('Produto criado com sucesso!');
      form.resetFields();
    } catch (error) {
      message.error(error.message);
    }
  };

  return (
    <Form
      form={form}
      layout="horizontal"
      style={{ maxWidth: 600 }}
      initialValues={{
        condicao: 'Novo',
      }}
      onFinish={handleSubmit}
    >
      <Form.Item
        label="Nome"
        name="nome"
        rules={[{ required: true, message: 'Por favor, insira o nome do produto!' }]}
      >
        <Input />
      </Form.Item>

      <Form.Item
        label="Imagens"
        name="imagens"
        valuePropName="fileList"
        getValueFromEvent={normFile}
      >
        <Upload listType="picture-card" beforeUpload={() => false} multiple>
          <button
            style={{
              border: 0,
              background: 'none',
            }}
            type="button"
          >
            <PlusOutlined />
            <div
              style={{
                marginTop: 8,
              }}
            >
              Adicionar Imagens
            </div>
          </button>
        </Upload>
      </Form.Item>

      <Form.Item label="Descrição" name="descricao">
        <TextArea rows={4} />
      </Form.Item>

      <Form.Item label="Detalhes" name="detalhes">
        <TextArea rows={4} />
      </Form.Item>

      <Form.Item label="Acessórios" name="acessorios">
        <TextArea rows={4} />
      </Form.Item>

      <Form.Item label="Condição" name="condicao">
        <Radio.Group>
          <Radio value="Novo">Novo</Radio>
          <Radio value="Usado">Usado</Radio>
        </Radio.Group>
      </Form.Item>

      <Form.Item>
        <Button type="primary" htmlType="submit">
          Criar Produto
        </Button>
      </Form.Item>
    </Form>
  );
};

export default CreateProductForm;



i created a folder called uploads to save the images but when i test it on postman, he returns this error postman log error but the way is correct, because my project is splitted in 3 folders: server, client and uploads

Automatically assign user in custom app and wordpress at the same time?

I have an app on domain.tld and I use wordpress to manage people to
subscribe and purchase the app. I would like to have the users login to
the app and wordpress automatically. I am using wishlist member to handle
registed users on wordpress.

What is the best method to approach this. The app is built on mongodb.com

many thanks

currently I need to assign users manually who sign up to the wordpress. but if so many people start to buy the product it will take time to do this

i would like a custom solution to automatically assign users to the app when they purchase through wordpress