Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    hassan
    @hmmokidk_twitter

    looking for filenames and size, where I am grouping all images types, and all video types

    str = fart.jpg 110b ok.zip 1b jk.png 1b

    I tried a few thigns
    oh shit there should be new lines after all those sizes
    (.+).(mp3 | aac | flac) (.)
    ^ tried that for video but no luck
    Raghav Garg
    @raghavgarg1257
    Hello everyone,
    I wanted to understand about redis pub/sub. Say if I have a producer which publish messages on multiple channels.
    Now, should I create single subscriber and listen to all channel.
    or should I create individual subscriber for every channel?
    I want to understands what are the best practices..!
    knostradamus
    @knostradamus
    this channel seems dead
    Miguel Espinoza
    @purefan
    @knostradamus there's #nodejs/node
    nikhil jain
    @nikhilmodasiya
    Hi currently we are using node 4.. on our production system and we are facing major cpu utilization issue.what happen is at some point of time it consume 100% cpu and stop accepting the request. we are struggling with from long time.we need a solution for this. anyone has any idea about it ?
    roflcopter3123
    @roflcopter3123
    heyho guys how can i get all values and childs of one child in this case i need everything in "c" updated into another ref
    please help me im stuck here :/
    exports.updateRoom = functions.database.ref('/users/{pushID}/c').onWrite((change, context) => {
    Hitesh Joshi
    @evoxtorm
    router.validateData = function(req, res) {
        let data = req.body;
        let redudantData = [];
        for (let i = 1; i < data.length; i++) {
            let number = data[i][6].toString();
                User.aggregate([
                    { $match: { contactNumber: number}},
                    { $project: {
                        'name': 1,
                        'contactNumber': 1
                    }}
                ]).exec(function(err, userData) {
                    if (err) {
                        res.status(500).json(err);
                    } else if (userData.length == 0) {
                        console.log("No old user found for this number ");
                        console.log(number);
                        redudantData.push(number);
                        console.log(redudantData);
                    } else {
                        // userData.rowNo = i;
                        // redudantData.push(userData);
                        //console.log(redudantData);
                    }
                })
        }
        if (data.length - 1 == i ) {
            res.status(200).send(redudantData);
        }    
    }
    Hey, My response is fired before the loop end
    how I can send it after the loop is over
    I've used async await but it is also not working I don't know where is the problem is
    Thanks in advance
    Kishan
    @Kishan08

    @evoxtorm does it resolved?

    if (data.length - 1 == i ) {
            res.status(200).send(redudantData);
        }

    you need to put the above code in the for loop. Because variable i is undefined outside for loop. And one more thing also, you're using ==,
    whenever possible use === instead.

    Hitesh Joshi
    @evoxtorm
    Thanks @Kishan08
    Hey can anyone tell me how I can use render a simple page which convert excel to table then validate the table and sends data to the database then again send data back to this page and show
    but I want to run the page after one of api is hit then the page show on the browser
    I've tried to use pug but I'm not able to do my javascript part in it
    any suggestions ???
    Jason Gladen
    @jgladen
    I ran into an interesting issue: and I'm not even sure where to go.
    npm link will test intall the command line tool... and on windows everything works fine... except if paramerter contains and ampersand.. I have a workaround with double escaping & gets replaced with ^^^&
    so it looks like %* in the "BIN_NAME_HERE.cmd" batch file doesn't re-escape the command line arguments..
    I have not found a good document that covers %* "batch command substituions" maybe I have to use power shell instead..
    samithn
    @samithn
    NodeJS -> any pointers on a library similar to Java Vert.X in the NodeJS world? .... Node/JS noob here
    Jeff Zucker
    @jeff-zucker
    A library of mine works if it is in one folder location but not another. It has no relative links. All of its dependencies are --saved ... any ideas on trouble-shooting?
    If I symbolic link to it, it works but if I copy it or npm install it, it does not.
    Fagner
    @fagner_nsz_gitlab
    Good night guys, I'm new to the node and I'm looking for knowledge about it .. I'm preparing a Centos7 server for production and I would like to know if someone can pass me material on installation and configuration of server for nodejs.Thank you all.
    Abhishek Mathur
    @abhishekwebcode
    Hi , I am having a issue, "Open dedicated DevTools for Node" no longer automatically detects when i run node --inspect index.js in webstorm terminal, it used to do but after my chrome got updated , then i installed yarn , it has happened
    the console still shows debugger attached
    Thanks in advance
    Abhishek Mathur
    @abhishekwebcode

    Hi , I am having a issue, "Open dedicated DevTools for Node" no longer automatically detects when i run node --inspect index.js in webstorm terminal, it used to do but after my chrome got updated , then i installed yarn , it has happened
    the console still shows debugger attached
    Thanks in advance

    Used opera , works fine, still couldn't understand why , even chrome canary failed :)

    Heenu
    @heenu_gitlab

    Hi,,
    I'm trying to login to facebook, after successful login; am getting one notification popup asking for allowing and block. I'm fine with either case. I am using webstorm IDE framework cucumber.

    I have already tried browser.alertDismiss(), browser.alertAccept() none of them are working. could anyone help me in dealing with these notifications.

    andihoxha
    @andihoxha
    Hey I am trying to use live server but seems to have this problem
    Error: listen EACCES: permission denied 0.0.0.0:8080
    Miguel Espinoza
    @purefan
    @andihoxha more than likely you have another program already listening on port 8080, maybe even another instance of your own live server. If you are on linux you can find which program is using that port with lsof -i :8080
    shenbagapandian
    @shenbagapandian
    any one help me to make webpack server for nodejs and reactjs server side rendering application !
    ORES
    @ORESoftware
    @samithn are you serious :) vertx was written to be like node.js in general - express is fine or koa 2.0
    John1997x
    @John1997x
    @John1997x
    Hi there! Wondering if someone could help me, I'm going crazy trying to find a solution.
    I have an async function that should return a Promise with a string, but it always returns undefined !
    Code in question:
    async function FetchAppGraph(AppID) {
    db.collection("Apps/" + AppID + "/{docIDs}")
    .doc("Graph")
    .get()
    .then((doc) => {
    if (!doc.exists) {
    console.log("No graph available");
    return "NA";
    } else {
    return doc.data();
    }
    })
    .catch((err) => {
    console.log(err);
    return "ERR";
    });
    }
    Bernard Baker
    @bernibear2000_twitter
    Hi everyone 👋 I'm using termux and I'm seeing a cross origin error. Any ideas?
    alaa almasri
    @alaaalmasri12
    hello
    so im trying to learn react what is the best way to learn ???
    Adhikansh Mittal
    @HrithikMittal
    @bernibear2000_twitter Please check your API endpoint if you are deploy them on 2 different service or server then you have to use Cross origin resource sharing which you can enable in your code
    In node js by adding npm install cors
    In react js just add Allowed-Cross-origin:* while hitting any api any, it was usinf axios or http call
    alaa almasri
    @alaaalmasri12
    hello
    guys can anyone help me with something
    alaa almasri
    @alaaalmasri12
    guys I'm trying to build a node js project using OAuth and socket io so what's the best ideas for a project
    shahprog
    @shahprog
    Who asks for idea. Make your own idea. Making others idea dont make you unique
    Nadir Abbas
    @nadirabbas

    I am building a YouTube video trimmer, and currently, it takes the YouTube video ID, downloads the whole video from the server (Even it is like 10 hours long), and then it trims it according to user's inputted timeframe using ffmpeg.

    enter image description here

    Now the problem with this is that it takes so much time to download the whole video even if we want a small piece of it hence it is highly impractical.

    I was thinking to implement something like an HTML5 video player does when you seek the video forward. It just jumps to the part where you seek-ed to without downloading the part you skipped over. How can I only download a part of a video file from a server in form of a buffer and then generate an already trimmed video file from that? I don't know if that is even possible on the server-side, but video players do it on the client-side.

    lane203m
    @lane203m

    Hi folks, im using validate from validate-typscript. Unfortunately, the schema I pass through the validator function varies

    When the validator fails, how can I print the element of the schema that isn't being validated?

    142.PNG
    In my example, I passed a string to somthing that should have been a number. How can I say what isnt matching, instead of saying "the model is actually a duck"
    Rohit Pawar
    @roh8t
    var express= require("express")
    var bodyParser=require("body-parser")
    
    var app= express()
    var http=require('http').Server(app)
    
    var io = require('socket.io')(http)
    
    var mongoose=require('mongoose')
    var port=process.env.PORT || 5000
    
    app.use(express.static(__dirname))
    app.use(bodyParser.json())
    app.use(bodyParser.urlencoded({extended:false}))
    
    var dbUrl='mongodb+srv://user:*******@cluster0.jbbh5.mongodb.net/<dbname>?retryWrites=true&w=majority'
    var Message=mongoose.model('Message',{
    
        name:String,
        message:String
    })
    
    
    app.get('/messages', (req,res) =>{
        Message.find({},(err,messages) =>{
            res.send(messages)
    
    
        })
    
    
    
    
    })
    
    app.post('/messages',(req,res)=>{
        var message=new Message(req.body)
        message.save((err)=>{
    
            if(err)
            sendStatus(500)
    
    
            io.emit('message',req.body)
            res.sendStatus(200)
        })
    
    })
    io.on('connection',(socket)=>{
        console.log('user connected')
    })
    
    mongoose.connect(dbUrl,{useUnifiedTopology: true, useNewUrlParser: true},(err) =>{
    
        console.log('mongodb connection successfull')
    })
    
    var server= http.listen(port, () => {
    
        console.log("Server is listening on port %d",port)
    })

    above is js file

    <!DOCTYPE html>
    <html>
    
    <head>
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
        <script src="https://code.jquery.com/jquery-3.5.1.min.js" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
    <link rel="shortcut icon" href="#">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.0/socket.io.js"></script>
    
    
    
    
    </head>
    <body>
        <div class="container">
            <br>
            <div class="jumbotron">
                <h1 class="display-4">Send Message</h1>
                <br>
                <input  id ="name" class="form-control" placeholder="Name">
                <br>
                <textarea  id ="message" class="form-control" placeholder="Message"></textarea>
                <br>
                <button id="send" class="btn btn-success">Send</button>
    
    
    
            </div>
            <div id="messages">
    
    
            </div>
    
    
    
        </div>
        <script>
    
            var socket=io()
    
            $(()=>  {
                $("#send").click(() =>{
    
               var message={name: $("#name").val(),message: $("#message").val()}
               postMessage(message)
            })
            getMessages()
            })
            socket.on('message',addMessage)
    
            function addMessage(message){
    
                $("#messages").append(`<h4> ${message.name} </h4> <p> ${message.message} </p>`)
            }
            function getMessages(){
    
                $.get('https://tranquil-bastion-57621.herokuapp.com/messages',(data)=>{
    
                    data.forEach(addMessage);
                })
            }
    
            function postMessage(message){
    
                  $.post('https://tranquil-bastion-57621.herokuapp.com/messages',message)
    
    
            }
    
    
        </script>
    
    
    
    
    
    </body>
    
    
    
    
    
    
    </html>

    above is html file
    https://tranquil-bastion-57621.herokuapp.com/messages
    cannot access it pls help

    Rohit Pawar
    @roh8t
       $("#messages").append(`<h4> ${message.name} </h4> <p> ${message.message} </p>`)
            }
            function getMessages(){
    
                $.get('https://tranquil-bastion-57621.herokuapp.com/messages',(data)=>{
    
                    data.forEach(addMessage);
                })
    i want to channge these function to assync Function
    Miguel Espinoza
    @purefan
    @roh8t its usually better to post links to a pastebin instead of pasting the entire file here. There are many but github gists and pastebin.com are popular options. Why do you want to change those functions to be async?
    alaa almasri
    @alaaalmasri12

    Hi
    I am using loopback 4 for backend and react for front end.
    when I make a request on API, it gives me blocked Cors.

    I tried this :
    let config = {
    mode: 'cors',
    cache: 'no-cache',
    credentials: 'same-origin',
    headers: {
    'Access-Control-Allow-Origin': '*',
    'Content-Type': 'application/json',
    },
    redirect: 'follow',
    referrerPolicy: 'no-referrer',
    }
    const response = await axios.post(${API}/signUppatient, obj, config);
    but it didn't work